@everfur/sdk 0.15.1 → 0.16.1
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/CHANGELOG.md +138 -0
- package/README.md +3 -1
- package/chat/lite/package.json +8 -0
- package/dist/Chat.d-CzI2228d.d.ts +11 -0
- package/dist/Chat.d-D3ScVQ22.d.cts +11 -0
- package/dist/{DepthViews.d-PuBGdAYk.d.cts → DepthViews.d-6U4QqaW3.d.cts} +1 -1
- package/dist/{DepthViews.d--1daZblh.d.cts → DepthViews.d-BLx_ZTwa.d.cts} +1 -1
- package/dist/{DepthViews.d-CKTnEeUo.d.ts → DepthViews.d-Cwbel5o4.d.ts} +1 -1
- package/dist/{DepthViews.d-BuEWI6Ln.d.ts → DepthViews.d-DVIydPLt.d.ts} +1 -1
- package/dist/{RecordsPage.d-CBB8sfoY.d.ts → RecordsPage.d-Bwalb0wU.d.ts} +1 -1
- package/dist/{RecordsPage.d-Dq5gpQG0.d.cts → RecordsPage.d-Do7T8Fns.d.cts} +1 -1
- package/dist/animations/index.d.cts +5 -5
- package/dist/animations/index.d.ts +5 -5
- package/dist/{Chat.d-BlsnQwCQ.d.ts → appStateLifecycle.d-Bd-rNy6K.d.ts} +62 -144
- package/dist/{Chat.d-BO5iJsR2.d.cts → appStateLifecycle.d-_mh4CEAq.d.cts} +62 -144
- package/dist/attachmentTransport.d-Syrvv5zH.d.ts +41 -0
- package/dist/attachmentTransport.d-r1XCCdUB.d.cts +41 -0
- package/dist/{attachments.d-DFP9yvz9.d.ts → attachments.d-BiBGBE4o.d.ts} +24 -6
- package/dist/{attachments.d-C2nkIyDB.d.ts → attachments.d-CyB8hzDo.d.ts} +2 -2
- package/dist/{attachments.d-DRHsJkni.d.cts → attachments.d-GlO5UP7H.d.cts} +24 -6
- package/dist/{attachments.d-DRUC35Ti.d.cts → attachments.d-Y-qvSHVU.d.cts} +2 -2
- package/dist/{bookingCopy.d-bF_QknDC.d.cts → bookingCopy.d-BIaCiRuW.d.cts} +2 -2
- package/dist/{bookingCopy.d-CFL-1Be2.d.ts → bookingCopy.d-DgWvNKD5.d.ts} +2 -2
- package/dist/{casesRepository.d-C__BnffJ.d.ts → casesRepository.d-BW8DTYeN.d.ts} +1 -1
- package/dist/{casesRepository.d-BMOnT1fg.d.cts → casesRepository.d-_0AO2YrL.d.cts} +1 -1
- package/dist/chat/index.cjs +246 -231
- package/dist/chat/index.d.cts +16 -49
- package/dist/chat/index.d.ts +16 -49
- package/dist/chat/index.js +246 -231
- package/dist/chat/lite/index.cjs +430 -0
- package/dist/chat/lite/index.d.cts +35 -0
- package/dist/chat/lite/index.d.ts +35 -0
- package/dist/chat/lite/index.js +430 -0
- package/dist/client/index.cjs +4 -4
- package/dist/client/index.d.cts +6 -6
- package/dist/client/index.d.ts +6 -6
- package/dist/client/index.js +4 -4
- package/dist/{clinicBatch.d-D68RYvc3.d.ts → clinicBatch.d-BXwATY3-.d.ts} +2 -2
- package/dist/{clinicBatch.d-C5deJ4xY.d.cts → clinicBatch.d-BcuSaOkv.d.cts} +2 -2
- package/dist/{config.d-BQgrIDdu.d.cts → config.d-D1xcxALX.d.cts} +1 -1
- package/dist/{config.d-XSMThgVj.d.ts → config.d-jTVsAeky.d.ts} +1 -1
- package/dist/consent/index.d.cts +5 -5
- package/dist/consent/index.d.ts +5 -5
- package/dist/{context.d-Ba8YyJpk.d.cts → context.d-C3x-z665.d.cts} +5 -5
- package/dist/{context.d-xoh5vmxS.d.ts → context.d-goZeZO2I.d.ts} +5 -5
- package/dist/{copy.d-Cq-s-UUv.d.cts → copy.d-DPwFY4r5.d.cts} +2 -2
- package/dist/{copy.d-HV9fU5kh.d.ts → copy.d-yfJv7fl6.d.ts} +2 -2
- package/dist/core/index.cjs +10 -10
- package/dist/core/index.d.cts +13 -13
- package/dist/core/index.d.ts +13 -13
- package/dist/core/index.js +10 -10
- package/dist/{depth.d-D7kKiYl7.d.ts → depth.d-SJzknw_P.d.ts} +2 -2
- package/dist/{depth.d-DYnkz8Re.d.cts → depth.d-e_8_icip.d.cts} +2 -2
- package/dist/{entitlementRepository.d-DmnUZLl_.d.ts → entitlementRepository.d-BNgZhwoE.d.ts} +2 -2
- package/dist/{entitlementRepository.d-B_kEPLhz.d.cts → entitlementRepository.d-C_LdzINM.d.cts} +2 -2
- package/dist/{focus.d-BHm_QtQ9.d.cts → focus.d-CXpIkIuU.d.cts} +3 -3
- package/dist/{focus.d-CjL6Cj0m.d.ts → focus.d-DzIgOqNB.d.ts} +3 -3
- package/dist/health-plan/index.cjs +136 -133
- package/dist/health-plan/index.d.cts +77 -24
- package/dist/health-plan/index.d.ts +77 -24
- package/dist/health-plan/index.js +136 -133
- package/dist/{idempotency.d-BSRK8od4.d.cts → idempotency.d-0biUa_Vw.d.cts} +1 -1
- package/dist/{idempotency.d-CFc4CCc9.d.ts → idempotency.d-DcqIqmf9.d.ts} +1 -1
- package/dist/{identity.d-Be2Es9Td.d.ts → identity.d-BEJcHY-5.d.ts} +1 -1
- package/dist/{identity.d-HbwYQ4-z.d.cts → identity.d-COcNGuCJ.d.cts} +1 -1
- package/dist/index.cjs +245 -230
- package/dist/index.d.cts +15 -12
- package/dist/index.d.ts +15 -12
- package/dist/index.js +246 -231
- package/dist/{introEvents.d-Dr34KIaD.d.cts → introEvents.d-D8N9bbGO.d.cts} +1 -1
- package/dist/{introEvents.d-DflJ6J9H.d.ts → introEvents.d-GCdyQyUG.d.ts} +1 -1
- package/dist/notifications/index.d.cts +4 -4
- package/dist/notifications/index.d.ts +4 -4
- package/dist/{optInView.d-3mbj1mR6.d.ts → optInView.d-CY2IueSZ.d.ts} +2 -2
- package/dist/{optInView.d-D23o1gtT.d.cts → optInView.d-DVuuWDRw.d.cts} +2 -2
- package/dist/{parse.d-BERabxHw.d.ts → parse.d--ztmWIIP.d.ts} +1 -1
- package/dist/{parse.d-4lUXdmvY.d.cts → parse.d-B-WrkW2C.d.cts} +1 -1
- package/dist/{pets.d-CHU0UbXt.d.cts → pets.d-BSW0oEYx.d.cts} +1 -1
- package/dist/{pets.d-D_ayuqjp.d.ts → pets.d-DwsImaHU.d.ts} +1 -1
- package/dist/{petsRepository.d-Bwfe8yuR.d.cts → petsRepository.d-BQfWC3d4.d.cts} +1 -1
- package/dist/{petsRepository.d-DUaAWoTv.d.ts → petsRepository.d-BudLFHVe.d.ts} +1 -1
- package/dist/photo/index.cjs +2 -2
- package/dist/photo/index.js +2 -2
- package/dist/{ports.d-DzEJMVRs.d.ts → ports.d-B6kDPKF7.d.ts} +4 -4
- package/dist/{ports.d-ClbPRUtx.d.cts → ports.d-DzPbmiDT.d.cts} +4 -4
- package/dist/records/depth/index.cjs +10 -10
- package/dist/records/depth/index.d.cts +9 -9
- package/dist/records/depth/index.d.ts +9 -9
- package/dist/records/depth/index.js +10 -10
- package/dist/records/index.cjs +253 -211
- package/dist/records/index.d.cts +169 -73
- package/dist/records/index.d.ts +169 -73
- package/dist/records/index.js +254 -212
- package/dist/{requestFunnel.d-YabU6G-Z.d.ts → requestFunnel.d-BPsCHJWf.d.ts} +2 -2
- package/dist/{requestFunnel.d-JoqddYSx.d.cts → requestFunnel.d-BdpL7gwg.d.cts} +2 -2
- package/dist/{runtimeTypes.d-DQTBJAbk.d.ts → runtimeTypes.d-C_Pcxn-n.d.ts} +4 -4
- package/dist/{runtimeTypes.d-Cv38YuzP.d.cts → runtimeTypes.d-Cfq3IrZG.d.cts} +4 -4
- package/dist/{screenProps.d-C-AuHoyF.d.cts → screenProps.d-BJMn1kTR.d.cts} +2 -2
- package/dist/{screenProps.d-BuJLzFkN.d.ts → screenProps.d-DGrfO17l.d.ts} +2 -2
- package/dist/server/events/index.cjs +3 -3
- package/dist/server/events/index.d.cts +48 -6
- package/dist/server/events/index.d.ts +48 -6
- package/dist/server/events/index.js +3 -3
- package/dist/server/index.cjs +2 -2
- package/dist/server/index.d.cts +3 -3
- package/dist/server/index.d.ts +3 -3
- package/dist/server/index.js +2 -2
- package/dist/shop/index.cjs +16 -16
- package/dist/shop/index.d.cts +12 -3
- package/dist/shop/index.d.ts +12 -3
- package/dist/shop/index.js +16 -16
- package/dist/tabs/index.cjs +4 -4
- package/dist/tabs/index.d.cts +34 -15
- package/dist/tabs/index.d.ts +34 -15
- package/dist/tabs/index.js +5 -5
- package/dist/{tabsModel.d-BfIQg6yS.d.ts → tabsModel.d-B7QMug1u.d.cts} +1 -17
- package/dist/{tabsModel.d-BfIQg6yS.d.cts → tabsModel.d-B7QMug1u.d.ts} +1 -17
- package/dist/televet/booking/index.cjs +2 -2
- package/dist/televet/booking/index.d.cts +6 -6
- package/dist/televet/booking/index.d.ts +6 -6
- package/dist/televet/booking/index.js +2 -2
- package/dist/televet/call/index.cjs +1 -1
- package/dist/televet/call/index.js +1 -1
- package/dist/televet/index.cjs +4 -3
- package/dist/televet/index.d.cts +1 -0
- package/dist/televet/index.d.ts +1 -0
- package/dist/televet/index.js +5 -4
- package/dist/testing/index.d.cts +1 -1
- package/dist/testing/index.d.ts +1 -1
- package/dist/testing/rn/index.cjs +1 -1
- package/dist/testing/rn/index.d.cts +7 -7
- package/dist/testing/rn/index.d.ts +7 -7
- package/dist/testing/rn/index.js +1 -1
- package/dist/testing/web/index.d.cts +7 -7
- package/dist/testing/web/index.d.ts +7 -7
- package/dist/texting/index.cjs +21 -16
- package/dist/texting/index.d.cts +5 -5
- package/dist/texting/index.d.ts +5 -5
- package/dist/texting/index.js +22 -17
- package/dist/threadOptions.d-B0folrKm.d.cts +147 -0
- package/dist/{threadOptions.d-DBrmOwmb.d.cts → threadOptions.d-B8HTJa9A.d.cts} +6 -40
- package/dist/{threadOptions.d-8x_1evAr.d.ts → threadOptions.d-BnhE7T8Y.d.ts} +6 -40
- package/dist/threadOptions.d-DTsJFkL-.d.ts +147 -0
- package/dist/threadOptions.d-GPJPprkn.d.cts +55 -0
- package/dist/threadOptions.d-GPJPprkn.d.ts +55 -0
- package/dist/{timelineRows.d-B6lLC8Ud.d.cts → timelineRows.d-BTcUdNeI.d.cts} +1 -1
- package/dist/{timelineRows.d-Brlkti-G.d.ts → timelineRows.d-kmBms1W5.d.ts} +1 -1
- package/dist/{planSignals.d-Dha2CMDF.d.cts → useHealthPlanSubscription.d-B_cth_iF.d.cts} +81 -3
- package/dist/{planSignals.d-CON9gTvJ.d.ts → useHealthPlanSubscription.d-BzNaVl89.d.ts} +81 -3
- package/dist/{usePresentation.d-Bne14SlX.d.ts → usePresentation.d-B7Uf44Ax.d.ts} +40 -40
- package/dist/{usePresentation.d-BcdCIuEU.d.cts → usePresentation.d-BkAMOfb5.d.cts} +40 -40
- package/dist/{useRecordsDepth.d-Cd6J03o5.d.ts → useRecordsDepth.d-BHkZi0tM.d.ts} +1 -1
- package/dist/{useRecordsDepth.d-DAa169VY.d.cts → useRecordsDepth.d-BxHpKipf.d.cts} +1 -1
- package/dist/video/index.cjs +2 -2
- package/dist/video/index.js +2 -2
- package/dist/{view.d-DkGM8GNA.d.ts → view.d-2BYMRnWj.d.ts} +3 -3
- package/dist/{view.d-3d5_O7Xk.d.cts → view.d-CoDbnv0f.d.cts} +3 -3
- package/dist/web/consent/index.d.cts +5 -5
- package/dist/web/consent/index.d.ts +5 -5
- package/dist/web/health-plan/index.cjs +5 -5
- package/dist/web/health-plan/index.d.cts +15 -69
- package/dist/web/health-plan/index.d.ts +15 -69
- package/dist/web/health-plan/index.js +5 -5
- package/dist/web/index.cjs +8 -8
- package/dist/web/index.d.cts +26 -43
- package/dist/web/index.d.ts +26 -43
- package/dist/web/index.js +8 -8
- package/dist/web/intro/index.d.cts +6 -6
- package/dist/web/intro/index.d.ts +6 -6
- package/dist/web/notifications/index.d.cts +3 -3
- package/dist/web/notifications/index.d.ts +3 -3
- package/dist/web/records/depth/index.cjs +9 -9
- package/dist/web/records/depth/index.d.cts +9 -9
- package/dist/web/records/depth/index.d.ts +9 -9
- package/dist/web/records/depth/index.js +9 -9
- package/dist/web/records/index.cjs +12 -12
- package/dist/web/records/index.d.cts +11 -11
- package/dist/web/records/index.d.ts +11 -11
- package/dist/web/records/index.js +12 -12
- package/dist/web/records-sheet/index.cjs +17 -17
- package/dist/web/records-sheet/index.js +17 -17
- package/dist/web/shop/index.cjs +12 -12
- package/dist/web/shop/index.d.cts +3 -3
- package/dist/web/shop/index.d.ts +3 -3
- package/dist/web/shop/index.js +12 -12
- package/dist/web/televet/booking/index.cjs +2 -2
- package/dist/web/televet/booking/index.d.cts +6 -6
- package/dist/web/televet/booking/index.d.ts +6 -6
- package/dist/web/televet/booking/index.js +2 -2
- package/dist/web/televet/call/index.cjs +1 -1
- package/dist/web/televet/call/index.js +1 -1
- package/dist/web/texting/index.d.cts +5 -5
- package/dist/web/texting/index.d.ts +5 -5
- package/package.json +22 -27
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*! @everfur/sdk. Copyright (c) 2026 Strand Health Inc. dba Everfur. All rights reserved. Use is subject to the Everfur SDK License: https://docs.everfur.com/license */
|
|
2
|
-
import{createContext,forwardRef,createElement,useState,useMemo,useContext,useEffect,useSyncExternalStore,useCallback,useRef,Fragment,useLayoutEffect,Component}from"react";import{TextInput,View,Pressable,StyleSheet,Animated,useWindowDimensions,Easing,ScrollView,Image,Modal,Text as Text$1,Linking,AppState
|
|
2
|
+
import{createContext,forwardRef,createElement,useState,useMemo,useContext,useEffect,useSyncExternalStore,useCallback,useRef,Fragment,useLayoutEffect,Component}from"react";import{TextInput,View,Pressable,StyleSheet,Animated,useWindowDimensions,Easing,ScrollView,Image,Modal,KeyboardAvoidingView,Platform,Text as Text$1,Linking,AppState}from"react-native";import{jsxs,jsx,Fragment as Fragment$1}from"react/jsx-runtime";import{useSafeAreaInsets}from"react-native-safe-area-context";import{useEverfurRecords}from"@everfur/sdk/records";var FACE_WEIGHT=/* @__PURE__ */Object.freeze({regular:"regular",medium:"medium",bold:"bold",mono:"regular",monoMedium:"medium",monoBold:"bold"});function face(theme,weight){let type=theme.type,fontFamily=type.families[weight];return weight==="mono"||type.namedFaces[weight]?{fontFamily:fontFamily}:{fontFamily:fontFamily,fontWeight:type.weight[FACE_WEIGHT[weight]]}}function headingFace(theme,fallback="bold"){let{headingFamily:headingFamily,headingWeight:headingWeight}=theme.type;if(headingFamily===null&&headingWeight===null)return face(theme,fallback);if(headingFamily!==null)return{fontFamily:headingFamily,fontWeight:headingWeight??theme.type.weight[FACE_WEIGHT[fallback]]};let base3=face(theme,fallback);return base3.fontWeight===void 0||headingWeight===null?base3:{fontFamily:base3.fontFamily,fontWeight:headingWeight}}var HEALTH_PLAN_COPY=/* @__PURE__ */Object.freeze({loading:"Loading",retry:"Try again",signedOut:"Sign in required",addToCart:"Add to cart",added:"Added",remove:"Remove",checkout:"Checkout",subtotal:"Subtotal",sample:"Sample",cartEmpty:"Your cart is empty.",choosePet:"Choose a pet",emptyTitle:"",emptyBody:"",emptyAsk:""}),COPY_ASKS=/* @__PURE__ */Object.freeze({emptyTitle:true,emptyBody:true,emptyAsk:true}),HEALTH_PLAN_REASON_LABELS=/* @__PURE__ */Object.freeze({dna:"",records:"Records",inside:"Inside",profile:""}),HEALTH_PLAN_TEMPLATES=/* @__PURE__ */Object.freeze({planTitle:petName=>`${petName}'s care plan`,cartLabel:brand=>`${brand} cart`}),HEALTH_PLAN_COPY_PLACEHOLDERS=/* @__PURE__ */Object.freeze([...Object.keys(HEALTH_PLAN_COPY).filter(key=>COPY_ASKS[key]===true&&HEALTH_PLAN_COPY[key]==="").map(key=>`HEALTH_PLAN_COPY.${key}`),...["profile"].filter(kind=>HEALTH_PLAN_REASON_LABELS[kind]==="").map(kind=>`HEALTH_PLAN_REASON_LABELS.${kind}`)]);var HEALTH_PLAN_LAYOUT_DEFAULTS=/* @__PURE__ */Object.freeze({imageVariant:"wide",reasonVariant:"pills",cartBarVisibility:"whenItems",cartBarPlacement:"sticky",addButtonSize:"full",addedVariant:"link",categoryVariant:"text",showCategory:false,cardShadow:false,cardBorder:true});function healthPlanWrites(plan,setInPlan){return{setInPlan:setInPlan,addAll:async()=>{let missing=(plan?.items??[]).filter(item=>!item.inPlan);return(await Promise.all(missing.map(item=>setInPlan(item.productId,true)))).every(Boolean)}}}function showHealthPlanCartBar(visibility,count){return(visibility??HEALTH_PLAN_LAYOUT_DEFAULTS.cartBarVisibility)==="always"||count>0}var HEALTH_PLAN_CARD_OPTION_KEYS=/* @__PURE__ */Object.freeze(["showCategory","cardShadow","cardBorder","addButtonSize","addButtonFontSize","addedVariant","categoryVariant","cardPadding","itemTitleSize","itemTitleWeight","priceSize","priceWeight","reasonTextSize","reasonLabelWidth","reasonGap"]);function pickHealthPlanCardOptions(props){let out={};for(let key of HEALTH_PLAN_CARD_OPTION_KEYS)props[key]!==void 0&&(out[key]=props[key]);return out}function healthPlanAddButtonHeight(size){let height=typeof size=="number"&&Number.isFinite(size)&&size>0?size:size==="compact"?32:44;return{height:height,hit:Math.max(44,height)}}function parseHealthPlanShadow(css){if(css.length>200||css.includes(",")&&!/rgba?\(|hsla?\(/i.test(css))return null;let color=/(rgba?\([^)]*\)|hsla?\([^)]*\)|#[0-9a-f]{3,8}\b|[a-z]+)\s*$/i.exec(css.trim())?.[1]??null;if(color===null)return null;let lengths=css.trim().slice(0,css.trim().length-color.length).trim().split(/\s+/).filter(Boolean);if(lengths.length<2||lengths.length>4)return null;let px=lengths.map(part=>part==="0"?0:/^-?\d*\.?\d+px$/.test(part)?Number(part.slice(0,-2)):Number.NaN);return px.some(n=>!Number.isFinite(n))?null:{color:color,offsetX:px[0]??0,offsetY:px[1]??0,blur:Math.max(0,px[2]??0)}}function healthPlanLength(value){return typeof value=="number"&&Number.isFinite(value)&&value>=0?value:null}function healthPlanTitleOffset(titleGap,sectionGap){let gap=healthPlanLength(titleGap);return gap===null?0:gap-sectionGap}function isHealthPlanSessionRequired(error){return error!==null&&(error.reasonCode==="session_required"||error.code==="sessionRequired")}var DockContext=createContext(null);function HealthPlanCartScope({children:children}){let[dock,setDock]=useState(null),store=useMemo(()=>({dock:dock,publish:setDock}),[dock]);return createElement(DockContext.Provider,{value:store},children)}function useHealthPlanCartDock(){return useContext(DockContext)?.dock??null}function usePublishHealthPlanCart(enabled,cart,busy,petRef,plan,setInPlan){let publish=useContext(DockContext)?.publish,latest=useRef(setInPlan);useEffect(()=>{latest.current=setInPlan},[setInPlan]);let writes=useMemo(()=>healthPlanWrites(plan,(productId,inPlan)=>latest.current(productId,inPlan)),[plan]);useEffect(()=>{if(!(publish===void 0||!enabled))return publish(/* @__PURE__ */Object.freeze({cart:cart,busy:busy,petRef:petRef,plan:plan,...writes})),()=>publish(null)},[publish,enabled,cart,busy,petRef,plan,writes])}var noopTelemetry=/* @__PURE__ */Object.freeze({track(){},trackExpectedFailure(){}});function ok(value,warning){/* @__PURE__ */
|
|
3
3
|
return Object.freeze({ok:true,value:value})}function err(error){/* @__PURE__ */
|
|
4
4
|
return Object.freeze({ok:false,error:error})}var EverfurConfigError=class _EverfurConfigError extends Error{constructor(kind,message){super(message),this.name="EverfurConfigError",this.kind=kind,Object.setPrototypeOf(this,_EverfurConfigError.prototype)}};var EVERFUR_CONTEXT_SYMBOL=/* @__PURE__ */Symbol.for("@everfur/sdk#EverfurContext@v1"),globalContextHost=globalThis,EverfurContext=globalContextHost[EVERFUR_CONTEXT_SYMBOL]??(globalContextHost[EVERFUR_CONTEXT_SYMBOL]=createContext(null));EverfurContext.displayName??="EverfurContext";function useEverfurContext(){let ctx=useContext(EverfurContext);if(ctx===null)throw new EverfurConfigError("not-initialized","Everfur hooks must be called inside <EverfurProvider>. Wrap your tree once, high.");return ctx}var HEALTH_PLAN_EVENTS=/* @__PURE__ */Object.freeze({opened:"health_plan.opened",productClicked:"health_plan.product_clicked",checkoutStarted:"health_plan.checkout_started"});function useHealthPlanTelemetry(){return useContext(EverfurContext)?.runtime.registry.services.telemetry??noopTelemetry}var PlanPetContext=createContext(null);function HealthPlanPetScope({petRef:petRef,children:children}){return createElement(PlanPetContext.Provider,{value:petRef},children)}function useHealthPlanBarPet(dockPet){let page=useContext(PlanPetContext),ctx=useContext(EverfurContext);return page??dockPet??ctx?.activePet??null}function useHealthPlanOpened(drawn,petRef,plan){let telemetry=useHealthPlanTelemetry(),sent=useRef(null);useEffect(()=>{if(!drawn||petRef===null||sent.current===petRef)return;sent.current=petRef;let items=plan?.items??[];telemetry.track(HEALTH_PLAN_EVENTS.opened,{petRef:petRef,itemsCount:items.length,inPlanCount:items.filter(item=>item.inPlan).length})},[drawn,petRef,plan,telemetry])}function trackProductClicked(telemetry,petRef,productId,inPlan){telemetry.track(HEALTH_PLAN_EVENTS.productClicked,{petRef:petRef,productId:productId,inPlan:inPlan})}function trackCheckoutStarted(telemetry,petRef,cart){telemetry.track(HEALTH_PLAN_EVENTS.checkoutStarted,{petRef:petRef,itemsCount:cart.count,subtotal:cart.subtotal,currency:cart.currency})}function healthPlanPageDrawsWithoutItems(design){return design!=null&&(design.wait!==void 0||design.pick.hidden===true)}function withoutProductPart(design){return{...design,pick:{...design.pick,none:true,hidden:true}}}var NO_PLAN_ITEM=/* @__PURE__ */Object.freeze({productId:"",partnerSku:null,title:"",description:null,category:null,price:null,currency:null,imageUrl:null,url:null,reasons:[],inPlan:false,sample:false});var CONTRACT_RETRYABILITY=/* @__PURE__ */Object.freeze([
|
|
5
5
|
/* @__PURE__ */Object.freeze({wireCode:"AccessDeniedException",envelope:"http_envelope",httpStatus:403,retryable:false}),
|
|
@@ -95,16 +95,16 @@ return Object.freeze({ok:false,error:error})}var EverfurConfigError=class _Everf
|
|
|
95
95
|
/* @__PURE__ */Object.freeze({wireCode:"webhook_endpoint_update_empty",envelope:"http_envelope",httpStatus:400,retryable:false}),
|
|
96
96
|
/* @__PURE__ */Object.freeze({wireCode:"webhook_endpoint_update_invalid",envelope:"http_envelope",httpStatus:400,retryable:false}),
|
|
97
97
|
/* @__PURE__ */Object.freeze({wireCode:"webhook_url_rejected",envelope:"http_envelope",httpStatus:400,retryable:false})]);/* @__PURE__ */Object.freeze(CONTRACT_RETRYABILITY.map(row=>row.wireCode));var NORMALIZED_FOLD=/* @__PURE__ */Object.freeze({ValidationException:"validationFailed",AuthorizationException:"authRejected",PaymentRequiredException:"paymentRequired",AccessDeniedException:"accessDenied",ResourceNotFoundException:"resourceNotFound",ConflictException:"conflict",ThrottlingException:"rateLimited",InternalFailureException:"internalError",NotImplementedException:"notImplemented",ServiceUnavailableException:"serviceUnavailable",MethodNotAllowedException:"validationFailed",authExpired:"authExpired",unavailable:"serviceUnavailable",session_required:"sessionRequired",session_revoked:"authExpired",accessDenied:"accessDenied",invalidRequest:"sdkUpdateRequired",authRejected:"authRejected",rateLimited:"rateLimited",insufficientCapability:"accessDenied",unrestrictedKeyRequired:"accessDenied",user_ref_invalid:"validationFailed",event_cursor_invalid:"validationFailed",event_filter_invalid:"validationFailed",event_payload_invalid:"validationFailed",event_type_unknown:"validationFailed",idempotency_key_invalid:"validationFailed",idempotency_key_required:"validationFailed",idempotency_key_reused:"idempotencyConflict",payload_too_large:"validationFailed",webhook_url_rejected:"validationFailed",webhook_endpoint_update_empty:"validationFailed",webhook_endpoint_update_invalid:"validationFailed",event_type_not_available:"conflict",record_subject_not_found:"resourceNotFound",records_consent_required:"conflict",record_species_unsupported:"validationFailed",record_upload_invalid:"validationFailed",FILE_TOO_LARGE:"validationFailed",INVALID_CONTENT_TYPE:"validationFailed",attachment_unreadable:"validationFailed",provider_unsupported:"validationFailed",token_invalid:"validationFailed",device_cipher_unavailable:"serviceUnavailable",email_invalid:"validationFailed",consent_required:"validationFailed",consent_invalid:"validationFailed",consent_scope_wrong_route:"validationFailed",IDEMPOTENCY_KEY_IN_FLIGHT:"idempotencyInFlight",IDEMPOTENCY_KEY_REUSED_DIFFERENT_REQUEST:"idempotencyConflict",DAILY_QUOTA_EXCEEDED:"quotaExceeded",TIER_UPGRADE_REQUIRED:"paymentRequired",not_found:"conversationNotFound",timeout:"streamTimeout",internal_error:"internalError",invalid_request:"validationFailed",invalid_client:"authRejected",invalid_grant:"authRejected",unsupported_grant_type:"validationFailed",invalid_scope:"validationFailed",invalid_target:"validationFailed",invalid_redirect_uri:"validationFailed",invalid_client_metadata:"validationFailed",unsupported_response_type:"validationFailed",access_denied:"accessDenied",slow_down:"rateLimited",mcp_request_not_found:"resourceNotFound",mcp_request_gone:"resourceNotFound",mcp_connection_not_found:"resourceNotFound",mcp_request_conflict:"conflict",sandbox_only:"accessDenied",tenant_has_no_capabilities:"conflict",verify_mint_refused:"accessDenied",verify_mint_rate_limited:"rateLimited",verify_mint_unavailable:"serviceUnavailable",verify_user_ref_invalid:"validationFailed",insufficient_scope:"accessDenied",tenant_filter_invalid:"validationFailed",tenant_resource_not_found:"resourceNotFound",tenant_surface_not_enabled:"conflict",pet_health_species_unsupported:"validationFailed",pet_health_list_removals_unconfirmed:"validationFailed",petRefInUse:"conflict",share_limit_reached:"conflict",pet_not_registered:"resourceNotFound",species_unsupported:"validationFailed",partner_visit_owner_only:"accessDenied",partner_visit_link_conflict:"conflict",partner_visit_pet_already_mapped:"conflict",linked_account_read_only:"conflict",catalog_empty_refused:"conflict",catalog_shrink_refused:"conflict"}),CONTRACT_ERROR_ROWS=/* @__PURE__ */Object.freeze(CONTRACT_RETRYABILITY.map(generated=>/* @__PURE__ */Object.freeze({wireCode:generated.wireCode,envelope:generated.envelope,retryable:generated.retryable,normalized:NORMALIZED_FOLD[generated.wireCode]}))),BY_KEY=new Map(CONTRACT_ERROR_ROWS.map(r=>[r.envelope+r.wireCode.toUpperCase(),r])),ENVELOPE_LOOKUP_ORDER=/* @__PURE__ */Object.freeze(["http_envelope",...[...new Set(CONTRACT_ERROR_ROWS.map(r=>r.envelope))].filter(e=>e!=="http_envelope").sort()]);function contractErrorFor(wireCode,envelope){if(typeof wireCode!="string")return;let key=wireCode.trim().toUpperCase();if(key.length!==0)for(let candidate of[envelope??"http_envelope",...ENVELOPE_LOOKUP_ORDER]){let row=BY_KEY.get(candidate+key);if(row)return row}}var CATEGORY_OF=/* @__PURE__ */Object.freeze({authExpired:"authentication",authRejected:"authentication",sessionRequired:"authentication",identitySignatureRequired:"authentication",accessDenied:"authorization",paymentRequired:"entitlement",quotaExceeded:"rateLimit",rateLimited:"rateLimit",validationFailed:"invalidRequest",sdkUpdateRequired:"invalidRequest",runtimeDisposed:"invalidRequest",conversationNotFound:"notFound",petNotFound:"notFound",resourceNotFound:"notFound",conflict:"conflict",idempotencyConflict:"conflict",idempotencyInFlight:"conflict",streamTimeout:"connection",streamIncomplete:"connection",upstreamLlmTimeout:"connection",serviceUnavailable:"connection",internalError:"server",notImplemented:"server",mediaUploadFailed:"media",moderationBlocked:"policy",unknown:"unknown"});function categoryFor(code){return CATEGORY_OF[code]}function fromWire(wire){let contractRow=contractErrorFor(wire);if(contractRow)return contractRow.normalized;let upper=(wire??"").trim().toUpperCase(),canonical=upper.replace(/[^A-Z0-9]/g,"");if(canonical==="AUTHREJECTED")return"authRejected";if(upper.startsWith("AUTH"))return"authExpired";switch(canonical){case"DAILYQUOTAEXCEEDED":case"QUOTAEXCEEDED":return"quotaExceeded";case"RATELIMITED":case"TOOMANYREQUESTS":case"TELEVETRATELIMITED":return"rateLimited";case"IDEMPOTENCYKEYCONFLICT":case"IDEMPOTENCYCONFLICT":return"idempotencyConflict";case"ACCESSDENIED":case"FORBIDDEN":return"accessDenied";case"IDENTITYSIGNATUREREQUIRED":return"identitySignatureRequired";case"RUNTIMEDISPOSED":return"runtimeDisposed";case"NOTFOUND":case"CONVERSATIONNOTFOUND":return"conversationNotFound";case"PETNOTFOUND":return"petNotFound";case"TIMEOUT":case"STREAMTIMEOUT":return"streamTimeout";case"MEDIAUPLOADFAILED":case"UNRECOGNIZEDVIDEOFORMAT":case"FILETOOSMALL":return"mediaUploadFailed";case"MODERATIONBLOCKED":return"moderationBlocked";case"UPSTREAMLLMTIMEOUT":return"upstreamLlmTimeout";case"INTERNALERROR":case"INTERNALSERVERERROR":return"internalError";case"STREAMINCOMPLETE":case"CHATSTREAMINCOMPLETE":return"streamIncomplete";case"INVALIDANALYSISTYPE":case"INVALIDUPLOADPURPOSE":return"unknown";default:return"unknown"}}var AUTO_RETRYABLE_CODES=/* @__PURE__ */new Set(["streamTimeout","rateLimited","internalError","upstreamLlmTimeout","streamIncomplete"]);function isAutoRetryable(code){return AUTO_RETRYABLE_CODES.has(code)}var RETRYABLE_CONTRACT_CODES=/* @__PURE__ */new Set(["serviceUnavailable","conflict","idempotencyInFlight"]);function isRetryableCode(code){return isAutoRetryable(code)||RETRYABLE_CONTRACT_CODES.has(code)}var BACKOFF_BASE_MS=500,BACKOFF_CAP_MS=8e3,MAX_RETRY_ATTEMPTS=4;function backoffDelayMs(attempt,rng=Math.random){let bounded=Math.max(0,attempt),ceiling=Math.min(BACKOFF_BASE_MS*2**bounded,BACKOFF_CAP_MS);return Math.floor(rng()*ceiling)}var ACCESS_DENIED_COPY="This feature isn't available on your account right now.",VALIDATION_FAILED_COPY="Something in that request was not right. Check the details and try again.",USER_FACING_COPY=/* @__PURE__ */Object.freeze({authExpired:"Please sign in again to continue.",authRejected:"Please sign in again to continue.",sessionRequired:"This app needs to be updated to keep using Everfur.",accessDenied:ACCESS_DENIED_COPY,paymentRequired:"This is part of a paid plan.",quotaExceeded:"You have used today's messages. This resets tomorrow.",rateLimited:"You are sending messages quickly. Try again in a few seconds.",validationFailed:VALIDATION_FAILED_COPY,sdkUpdateRequired:"This app needs to be updated to keep using Everfur.",conflict:"That is already running. Wait for it to finish, then try again.",idempotencyConflict:"That message was already delivered.",idempotencyInFlight:"That is still processing. Give it a moment.",conversationNotFound:"This conversation is no longer available.",petNotFound:"We could not find that pet. Please pick a pet and try again.",resourceNotFound:"We could not find that.",streamTimeout:"The response timed out. Tap retry to try again.",mediaUploadFailed:"We could not upload that photo. Please attach it again.",moderationBlocked:"This request cannot be answered here.",upstreamLlmTimeout:"The response timed out. Tap retry to try again.",internalError:"We hit a snag on our end. Please try again.",notImplemented:"That is not available yet.",serviceUnavailable:"That service is briefly unavailable. Try again shortly.",streamIncomplete:"The connection dropped mid-answer. Tap retry to continue.",identitySignatureRequired:ACCESS_DENIED_COPY,runtimeDisposed:VALIDATION_FAILED_COPY,unknown:"Something went wrong. Please try again."}),SESSION_REVOKED_COPY="This session has ended. Please sign in again.",LINKED_ACCOUNT_READ_ONLY="linked_account_read_only";function displayFor(code,wireCode,reasonCode){return code==="conflict"&&reasonCode===LINKED_ACCOUNT_READ_ONLY?ACCESS_DENIED_COPY:(code==="authRejected"||code==="authExpired")&&typeof wireCode=="string"&&wireCode.trim().toLowerCase()==="session_revoked"?SESSION_REVOKED_COPY:userFacingError(code)}function userFacingError(code){return USER_FACING_COPY[code]}function defineHidden(target,key,value){Object.defineProperty(target,key,{value:value,enumerable:false,writable:false,configurable:false})}var REASON_CODE_SHAPE=/^[a-z][a-z0-9_]{0,63}$/;function makeEverfurError(code,opts){let row=contractErrorFor(opts?.wireCode,opts?.wireEnvelope),linkedReadOnly=code==="conflict"&&opts?.reasonCode===LINKED_ACCOUNT_READ_ONLY,error={code:code,category:categoryFor(code),retryable:opts?.retryable??(linkedReadOnly?false:isRetryableCode(code)),displayMessage:displayFor(code,opts?.wireCode,linkedReadOnly?LINKED_ACCOUNT_READ_ONLY:null)};opts?.httpStatus!==void 0&&(error.httpStatus=opts.httpStatus),opts?.requestId&&(error.requestId=opts.requestId),typeof opts?.reasonCode=="string"&&REASON_CODE_SHAPE.test(opts.reasonCode)&&(error.reasonCode=opts.reasonCode);let wait=opts?.retryAfterSeconds;if(typeof wait=="number"&&Number.isFinite(wait)&&wait>=0&&(error.retryAfterSeconds=Math.round(wait)),row);return opts?.wireMessage&&defineHidden(error,"wireMessage",opts.wireMessage),opts?.raw!==void 0&&opts.raw!==null&&defineHidden(error,"raw",opts.raw),/* @__PURE__ */Object.freeze(error)}function assertNever(x){throw new Error(`assertNever: unhandled discriminated-union member ${JSON.stringify(x)}`)}function errorFrame(fields){/* @__PURE__ */
|
|
98
|
-
return Object.freeze({kind:"error",terminal:true,code:fields.code,retryable:fields.retryable,wireMessage:fields.wireMessage,synthesized:fields.synthesized,lastEventId:fields.lastEventId,serverRequestId:null})}function mintFailedError(cause,refusal){let message=cause instanceof Error?cause.message:typeof cause=="string"?cause:null;return makeEverfurError("authRejected",{retryable:false,...refusal?.wireCode?{wireCode:refusal.wireCode}:{},...refusal?.requestId?{requestId:refusal.requestId}:{},...message?{wireMessage:message}:{},...cause!=null?{raw:cause}:{}})}function authHeaders(auth){let headers={};return auth.mode==="personalized"?headers.authorization=`Bearer ${auth.token}`:headers["x-everfur-partner-key"]=auth.publishableKey,auth.userRef&&(headers["x-everfur-user-ref"]=auth.userRef),auth.sessionId&&(headers["x-everfur-session-id"]=auth.sessionId),headers}function withAuthHeaders(req,auth){return{...req,headers:{...stripAuthHeaders(req.headers),...authHeaders(auth)}}}function stripAuthHeaders(headers){if(!headers)return{};let out={};for(let[key,value]of Object.entries(headers)){let lower=key.toLowerCase();lower==="authorization"||lower==="x-everfur-partner-key"||(out[key]=value)}return out}async function authedSend(req,ctx){if(ctx.mode==="anonymous")return ctx.transport.request(withAuthHeaders(req,{mode:"anonymous",publishableKey:ctx.publishableKey,userRef:ctx.userRef,...ctx.sessionId?{sessionId:ctx.sessionId}:{}}));let token;try{token=await ctx.identity.currentToken()}catch(cause){return ctx.identity.reportRejected?.(),err(mintFailedError(cause))}let first=await ctx.transport.request(withAuthHeaders(req,{mode:"personalized",token:token,userRef:ctx.userRef,...ctx.sessionId?{sessionId:ctx.sessionId}:{}}));if(first.ok||first.error.httpStatus!==401)return first;let refreshed;try{refreshed=await ctx.identity.currentToken({forceRefresh:!0})}catch(cause){return ctx.identity.reportRejected?.(),err(mintFailedError(cause,{wireCode:wireCodeOf(first.error.raw),requestId:first.error.requestId}))}let retry=await ctx.transport.request(withAuthHeaders(req,{mode:"personalized",token:refreshed,userRef:ctx.userRef,...ctx.sessionId?{sessionId:ctx.sessionId}:{}}));return!retry.ok&&retry.error.httpStatus===401?(ctx.identity.reportRejected?.(),err(refusedAfterRemintError(retry.error))):retry}function refusedAfterRemintError(refusal){let raw=refusal.raw,wireCode=wireCodeOf(raw);return makeEverfurError("authRejected",{retryable:false,...refusal.httpStatus!==void 0?{httpStatus:refusal.httpStatus}:{},...refusal.requestId?{requestId:refusal.requestId}:{},...wireCode?{wireCode:wireCode}:{},...refusal.reasonCode?{reasonCode:refusal.reasonCode}:{},...refusal.wireMessage?{wireMessage:refusal.wireMessage}:{},...raw!=null?{raw:raw}:{}})}function wireCodeOf(body){if(typeof body!="object"||body===null)return null;let b=body,code=(typeof b.error=="object"&&b.error!==null?b.error.code:void 0)??b.code;return typeof code=="string"&&code.length>0?code:null}function networkError(cause){return makeEverfurError("internalError",{retryable:true,wireMessage:describeCause(cause)})}function describeCause(cause){return cause instanceof Error?cause.message:typeof cause=="string"?cause:"network request failed"}var FUNNEL_UNARY_TIMEOUT_MS=3e4,RETRY_OVERRIDE_MAX_MS=BACKOFF_CAP_MS*2,IDEMPOTENCY_HEADER="idempotency-key",MUTATING_METHODS=/* @__PURE__ */new Set(["POST","PUT","PATCH","DELETE"]),NOOP_OBSERVER=/* @__PURE__ */Object.freeze({onEvent(){}}),defaultFunnelTimers=/* @__PURE__ */Object.freeze({setTimeout:(handler,ms)=>setTimeout(handler,ms),clearTimeout:handle=>clearTimeout(handle),now:()=>Date.now()});function seededIdempotencyKey(seed){let safe=seed.trim().replace(/[^A-Za-z0-9_.:-]/g,"-");return safe.length===0?null:`efs_${safe}`.slice(0,128)}function createRequestFunnel(deps){let observer=deps.observer??NOOP_OBSERVER,timers=deps.timers??defaultFunnelTimers,rng=deps.rng??Math.random,sleep=deps.sleep??((ms,signal)=>delayAbortable(ms,timers,signal)),ceiling=deps.maxAttempts??MAX_RETRY_ATTEMPTS,timeoutMs=deps.unaryTimeoutMs??FUNNEL_UNARY_TIMEOUT_MS,mintKey=deps.newIdempotencyKey??defaultIdempotencyKeyFactory(),emit=event=>{try{observer.onEvent(event)}catch{}};async function send(call,req,opts){let perCallMaxAttempts=opts?.maxAttempts,maxAttempts=Math.max(1,perCallMaxAttempts??ceiling),idempotent=opts?.idempotent??MUTATING_METHODS.has(req.method),seeded=opts?.idempotencyKey===void 0?null:seededIdempotencyKey(opts.idempotencyKey),idempotencyKey=idempotent?seeded??mintKey():null,base3=assembleHeaders(req,idempotencyKey),attempt=0;for(;;){let stamp=extra=>/* @__PURE__ */Object.freeze({call:call,method:req.method,path:req.path,attempt:attempt,...idempotencyKey?{idempotencyKey:idempotencyKey}:{},...extra});emit(stamp({phase:"attempt"}));let deadline=boundedSignal(timeoutMs,timers),merged=mergeSignals(deadline.signal,req.signal),settled;try{settled=await authedSend({...base3,signal:merged.signal},deps.auth)}catch(cause){settled=err(networkError(cause))}finally{merged.dispose(),deadline.cancel()}if(settled.ok)return emit(stamp({phase:"settled",ok:true,reason:"ok"})),settled;let error=settled.error,decision=decideRetry(error,attempt,{maxAttempts:maxAttempts,rng:rng,now:timers.now(),aborted:req.signal?.aborted===true,...perCallMaxAttempts!==void 0?{perCallMaxAttempts:perCallMaxAttempts}:{},...deps.errorPolicy!==void 0?{policy:deps.errorPolicy}:{}}),settledEvent={ok:false,code:error.code,reason:decision.reason,...error.httpStatus!==void 0?{httpStatus:error.httpStatus}:{},...error.requestId!==void 0?{requestId:error.requestId}:{}};if(!decision.retry)return emit(stamp({phase:"settled",...settledEvent})),err(error);if(emit(stamp({phase:"retry",...settledEvent,delayMs:decision.delayMs})),await sleep(decision.delayMs,req.signal),req.signal?.aborted===true)return emit(stamp({phase:"settled",...settledEvent,reason:"aborted"})),err(error);attempt+=1}}async function authorize(req){return withAuthHeaders(req,await resolveDeviceAuth(deps.auth))}async function*stream(call,req,signal){emit(
|
|
98
|
+
return Object.freeze({kind:"error",terminal:true,code:fields.code,retryable:fields.retryable,wireMessage:fields.wireMessage,synthesized:fields.synthesized,lastEventId:fields.lastEventId,serverRequestId:null})}function mintFailedError(cause,refusal){let message=cause instanceof Error?cause.message:typeof cause=="string"?cause:null;return makeEverfurError("authRejected",{retryable:false,...refusal?.wireCode?{wireCode:refusal.wireCode}:{},...refusal?.requestId?{requestId:refusal.requestId}:{},...message?{wireMessage:message}:{},...cause!=null?{raw:cause}:{}})}function authHeaders(auth){let headers={};return auth.mode==="personalized"?headers.authorization=`Bearer ${auth.token}`:headers["x-everfur-partner-key"]=auth.publishableKey,auth.userRef&&(headers["x-everfur-user-ref"]=auth.userRef),auth.sessionId&&(headers["x-everfur-session-id"]=auth.sessionId),headers}function withAuthHeaders(req,auth){return{...req,headers:{...stripAuthHeaders(req.headers),...authHeaders(auth)}}}function stripAuthHeaders(headers){if(!headers)return{};let out={};for(let[key,value]of Object.entries(headers)){let lower=key.toLowerCase();lower==="authorization"||lower==="x-everfur-partner-key"||(out[key]=value)}return out}async function authedSend(req,ctx){if(ctx.mode==="anonymous")return ctx.transport.request(withAuthHeaders(req,{mode:"anonymous",publishableKey:ctx.publishableKey,userRef:ctx.userRef,...ctx.sessionId?{sessionId:ctx.sessionId}:{}}));let token;try{token=await ctx.identity.currentToken()}catch(cause){return ctx.identity.reportRejected?.(),err(mintFailedError(cause))}let first=await ctx.transport.request(withAuthHeaders(req,{mode:"personalized",token:token,userRef:ctx.userRef,...ctx.sessionId?{sessionId:ctx.sessionId}:{}}));if(first.ok||first.error.httpStatus!==401)return first;let refreshed;try{refreshed=await ctx.identity.currentToken({forceRefresh:!0})}catch(cause){return ctx.identity.reportRejected?.(),err(mintFailedError(cause,{wireCode:wireCodeOf(first.error.raw),requestId:first.error.requestId}))}let retry=await ctx.transport.request(withAuthHeaders(req,{mode:"personalized",token:refreshed,userRef:ctx.userRef,...ctx.sessionId?{sessionId:ctx.sessionId}:{}}));return!retry.ok&&retry.error.httpStatus===401?(ctx.identity.reportRejected?.(),err(refusedAfterRemintError(retry.error))):retry}function refusedAfterRemintError(refusal){let raw=refusal.raw,wireCode=wireCodeOf(raw);return makeEverfurError("authRejected",{retryable:false,...refusal.httpStatus!==void 0?{httpStatus:refusal.httpStatus}:{},...refusal.requestId?{requestId:refusal.requestId}:{},...wireCode?{wireCode:wireCode}:{},...refusal.reasonCode?{reasonCode:refusal.reasonCode}:{},...refusal.wireMessage?{wireMessage:refusal.wireMessage}:{},...raw!=null?{raw:raw}:{}})}function wireCodeOf(body){if(typeof body!="object"||body===null)return null;let b=body,code=(typeof b.error=="object"&&b.error!==null?b.error.code:void 0)??b.code;return typeof code=="string"&&code.length>0?code:null}function parseUrl(raw,base3){let Url=globalThis.URL;if(typeof Url=="function"){let url;try{url=base3===void 0?new Url(raw):new Url(raw,base3)}catch{return null}try{if(url.protocol)return url}catch{}}return parseByPattern(raw)}var WHOLE_URL=/^([a-z][a-z0-9+.-]*):\/\/(?:([^:@/?#]*)(?::([^@/?#]*))?@)?(\[[0-9a-f:.]+\]|[\w.~-]+)(?::(\d*))?(\/[^?#]*)?(\?[^#]*)?(#.*)?$/i,REWRITTEN_BY_STANDARD_PARSER=/[\s\u0000-\u001f\u007f\\]/,DEFAULT_PORTS={"http:":"80","https:":"443"};function parseByPattern(raw,base3){let input=raw.trim();let match=REWRITTEN_BY_STANDARD_PARSER.test(input)?null:WHOLE_URL.exec(input);if(match===null)return null;let[,scheme="",username="",password="",host="",portText="",path="",query="",fragment=""]=match,protocol=`${scheme.toLowerCase()}:`,portNumber=Number(portText);if(portNumber>65535)return null;let port=portText===""||String(portNumber)===DEFAULT_PORTS[protocol]?"":String(portNumber),special=DEFAULT_PORTS[protocol]!==void 0,hostPort=host.toLowerCase()+(port&&`:${port}`),pathname=path||(special?"/":""),credentials=username||password?`${username}${password&&`:${password}`}@`:"";return{href:`${protocol}//${credentials}${hostPort}${pathname}${query}${fragment}`,protocol:protocol,username:username,password:password,hostname:host.toLowerCase(),port:port,origin:special?`${protocol}//${hostPort}`:"null",pathname:pathname,search:query==="?"?"":query,hash:fragment==="#"?"":fragment}}function networkError(cause){return makeEverfurError("internalError",{retryable:true,wireMessage:describeCause(cause)})}function describeCause(cause){return cause instanceof Error?cause.message:typeof cause=="string"?cause:"network request failed"}var FUNNEL_UNARY_TIMEOUT_MS=3e4,RETRY_OVERRIDE_MAX_MS=BACKOFF_CAP_MS*2,IDEMPOTENCY_HEADER="idempotency-key",MUTATING_METHODS=/* @__PURE__ */new Set(["POST","PUT","PATCH","DELETE"]),NOOP_OBSERVER=/* @__PURE__ */Object.freeze({onEvent(){}}),defaultFunnelTimers=/* @__PURE__ */Object.freeze({setTimeout:(handler,ms)=>setTimeout(handler,ms),clearTimeout:handle=>clearTimeout(handle),now:()=>Date.now()});function seededIdempotencyKey(seed){let safe=seed.trim().replace(/[^A-Za-z0-9_.:-]/g,"-");return safe.length===0?null:`efs_${safe}`.slice(0,128)}function createRequestFunnel(deps){let observer=deps.observer??NOOP_OBSERVER,timers=deps.timers??defaultFunnelTimers,rng=deps.rng??Math.random,sleep=deps.sleep??((ms,signal)=>delayAbortable(ms,timers,signal)),ceiling=deps.maxAttempts??MAX_RETRY_ATTEMPTS,timeoutMs=deps.unaryTimeoutMs??FUNNEL_UNARY_TIMEOUT_MS,mintKey=deps.newIdempotencyKey??defaultIdempotencyKeyFactory(),emit=event=>{try{observer.onEvent(event)}catch{}};async function send(call,req,opts){let perCallMaxAttempts=opts?.maxAttempts,maxAttempts=Math.max(1,perCallMaxAttempts??ceiling),idempotent=opts?.idempotent??MUTATING_METHODS.has(req.method),seeded=opts?.idempotencyKey===void 0?null:seededIdempotencyKey(opts.idempotencyKey),idempotencyKey=idempotent?seeded??mintKey():null,base3=assembleHeaders(req,idempotencyKey),attempt=0;for(;;){let stamp=extra=>/* @__PURE__ */Object.freeze({call:call,method:req.method,path:req.path,attempt:attempt,...idempotencyKey?{idempotencyKey:idempotencyKey}:{},...extra});emit(stamp({phase:"attempt"}));let deadline=boundedSignal(timeoutMs,timers),merged=mergeSignals(deadline.signal,req.signal),settled;try{settled=await authedSend({...base3,signal:merged.signal},deps.auth)}catch(cause){settled=err(networkError(cause))}finally{merged.dispose(),deadline.cancel()}if(settled.ok)return emit(stamp({phase:"settled",ok:true,reason:"ok"})),settled;let error=settled.error,decision=decideRetry(error,attempt,{maxAttempts:maxAttempts,rng:rng,now:timers.now(),aborted:req.signal?.aborted===true,...perCallMaxAttempts!==void 0?{perCallMaxAttempts:perCallMaxAttempts}:{},...deps.errorPolicy!==void 0?{policy:deps.errorPolicy}:{}}),settledEvent={ok:false,code:error.code,reason:decision.reason,...error.httpStatus!==void 0?{httpStatus:error.httpStatus}:{},...error.requestId!==void 0?{requestId:error.requestId}:{}};if(!decision.retry)return emit(stamp({phase:"settled",...settledEvent})),err(error);if(emit(stamp({phase:"retry",...settledEvent,delayMs:decision.delayMs})),await sleep(decision.delayMs,req.signal),req.signal?.aborted===true)return emit(stamp({phase:"settled",...settledEvent,reason:"aborted"})),err(error);attempt+=1}}async function authorize(req){return withAuthHeaders(req,await resolveDeviceAuth(deps.auth))}async function*stream(call,req,signal){emit(
|
|
99
99
|
/* @__PURE__ */Object.freeze({call:call,phase:"stream.open",method:req.method,path:req.path,attempt:0}));try{yield*deps.auth.transport.stream(req,signal)}catch{yield errorFrame({code:"internal_error",retryable:true,wireMessage:null,synthesized:true,lastEventId:null})}}/* @__PURE__ */
|
|
100
100
|
return Object.freeze({send:send,authorize:authorize,stream:stream})}function assembleHeaders(req,idempotencyKey){let headers={};for(let[key,value]of Object.entries(req.headers??{}))key.toLowerCase()!==IDEMPOTENCY_HEADER&&(headers[key]=value);return idempotencyKey!==null&&(headers["Idempotency-Key"]=idempotencyKey),{...req,headers:headers}}function defaultIdempotencyKeyFactory(){let counter=0;return()=>`efk_${Date.now().toString(36)}_${(counter++).toString(36)}_${Math.random().toString(36).slice(2,12)}`}var POLICY_MAX_ATTEMPTS_CAP=10;function decideRetry(error,attempt,ctx){if(ctx.aborted)return{retry:false,reason:"aborted"};let throttle=throttleKind(error);if(throttle==="quota")return{retry:false,reason:"daily-quota-exhausted"};if(throttle!=="burst"&&!isAutoRetryable(error.code))return{retry:false,reason:"terminal-code"};let reason=throttle==="burst"?"burst-throttle":"retryable-code";if((()=>{if(ctx.policy===void 0)return false;try{return!ctx.policy.shouldRetry(error.code,attempt)}catch{return false}})())return{retry:false,reason:"terminal-code"};let policyCeiling=()=>{if(ctx.policy===void 0)return null;let raw;try{raw=ctx.policy.maxAttempts(error.code)}catch{return null}return typeof raw!="number"||!Number.isFinite(raw)?null:Math.max(1,Math.min(POLICY_MAX_ATTEMPTS_CAP,Math.floor(raw)))},ceiling=ctx.perCallMaxAttempts??policyCeiling()??ctx.maxAttempts;if(attempt+1>=ceiling)return{retry:false,reason:"attempts-exhausted"};let override=retryOverrideMs(error,ctx.now);return override!==null?override>RETRY_OVERRIDE_MAX_MS?{retry:false,reason:"server-reset-beyond-budget"}:{retry:true,reason:reason,delayMs:override}:{retry:true,reason:reason,delayMs:backoffDelayMs(attempt,ctx.rng)}}function throttleKind(error){let code=error.code==="unknown"?fromWire(rawWireCode(error.raw)):error.code;return code==="quotaExceeded"?"quota":code==="rateLimited"||error.httpStatus===429?"burst":null}function retryOverrideMs(error,now){let at=findResetsAt(error.raw);if(at!==null){let delta=at-now;return delta>0?delta:0}let wait=findRetryAfterSeconds(error.raw);return wait===null?null:Math.round(wait*1e3)}function findRetryAfterSeconds(raw){for(let scope of candidateScopes(raw)){let value=scope.retry_after_seconds;if(typeof value=="number"&&Number.isFinite(value)&&value>=0)return value}return null}function findResetsAt(raw){for(let scope of candidateScopes(raw)){let value=scope.resets_at,parsed=parseInstantMs(value);if(parsed!==null)return parsed}return null}function candidateScopes(raw){if(!isRecord(raw))return[];let out=[raw];for(let nested of["error","detail"]){let value=raw[nested];isRecord(value)&&out.push(value)}return out}function parseInstantMs(value){if(typeof value=="number"&&Number.isFinite(value))return value<1e11?Math.round(value*1e3):Math.round(value);if(typeof value=="string"&&value.trim().length>0){let parsed=Date.parse(value);return Number.isFinite(parsed)?parsed:null}return null}function rawWireCode(raw){for(let scope of candidateScopes(raw)){let code=scope.code;if(typeof code=="string"&&code.length>0)return code}return null}function isRecord(value){return typeof value=="object"&&value!==null}async function resolveDeviceAuth(auth){return auth.mode==="anonymous"?{mode:"anonymous",publishableKey:auth.publishableKey,userRef:auth.userRef,...auth.sessionId?{sessionId:auth.sessionId}:{}}:{mode:"personalized",token:await auth.identity.currentToken(),userRef:auth.userRef,...auth.sessionId?{sessionId:auth.sessionId}:{}}}function boundedSignal(ms,timers){let ctrl=new AbortController,handle=timers.setTimeout(()=>ctrl.abort(),ms);return{signal:ctrl.signal,cancel:()=>timers.clearTimeout(handle)}}function mergeSignals(deadline,caller){let noop=()=>{};if(!caller)return{signal:deadline,dispose:noop};let ctrl=new AbortController;if(deadline.aborted||caller.aborted)return ctrl.abort(),{signal:ctrl.signal,dispose:noop};let onAbort=()=>ctrl.abort();return deadline.addEventListener("abort",onAbort,{once:true}),caller.addEventListener("abort",onAbort,{once:true}),{signal:ctrl.signal,dispose:()=>{deadline.removeEventListener("abort",onAbort),caller.removeEventListener("abort",onAbort)}}}function delayAbortable(ms,timers,signal){return ms<=0||signal?.aborted===true?Promise.resolve():new Promise(resolve=>{let handle=timers.setTimeout(()=>{signal?.removeEventListener("abort",onAbort),resolve()},ms),onAbort=()=>{timers.clearTimeout(handle),resolve()};signal?.addEventListener("abort",onAbort,{once:true})})}function isNotFoundError(error){return error!=null&&(error.httpStatus===404||error.category==="notFound")}function plainNotFound(error){return error.code!=="conversationNotFound"?error:makeEverfurError("resourceNotFound",{retryable:false,...error.httpStatus===void 0?{}:{httpStatus:error.httpStatus},...error.requestId===void 0?{}:{requestId:error.requestId},...error.reasonCode===void 0?{}:{reasonCode:error.reasonCode},...error.wireMessage===void 0?{}:{wireMessage:error.wireMessage},...error.raw===void 0?{}:{raw:error.raw}})}function plainResult(res){return res.ok?res:err(plainNotFound(res.error))}function withPlainNotFound(funnel){return{send:async(...args)=>plainResult(await funnel.send(...args)),authorize:req=>funnel.authorize(req),stream:(call,req,signal)=>funnel.stream(call,req,signal)}}var HEALTH_PLAN_REASON_KINDS=/* @__PURE__ */Object.freeze(["dna","records","inside","profile"]),REF_MAX=128;function invalid(wireMessage){return makeEverfurError("validationFailed",{retryable:false,wireMessage:wireMessage})}function disposed(verb){return makeEverfurError("runtimeDisposed",{retryable:false,wireMessage:`the Everfur runtime is disposed; ${verb} was called after unmount`})}function malformed(call){return makeEverfurError("internalError",{retryable:false,httpStatus:502,wireMessage:`${call}: the response carried no plan`})}var str=(value,max=4e3)=>typeof value=="string"&&value.trim().length>0&&value.length<=max?value.trim():null;function httpsUrl(value){let s=str(value,2048);return s===null?null:/^https:\/\/[^\s]+$/i.test(s)?s:null}function priceOf(value){let n=typeof value=="number"?value:typeof value=="string"&&/^\d+(\.\d+)?$/.test(value.trim())?Number(value):Number.NaN;return Number.isFinite(n)&&n>=0?n:null}function currencyOf(value){return typeof value=="string"&&/^[A-Za-z]{3}$/.test(value)?value.toUpperCase():null}function reasonsOf(value){if(!Array.isArray(value))/* @__PURE__ */return Object.freeze([]);let out=[];for(let raw of value){if(raw===null||typeof raw!="object")continue;let o=raw,text2=str(o.text,1e3);if(text2===null)continue;let kind=typeof o.kind=="string"&&HEALTH_PLAN_REASON_KINDS.includes(o.kind)?o.kind:"profile";out.push(/* @__PURE__ */Object.freeze({kind:kind,text:text2}))}/* @__PURE__ */
|
|
101
101
|
return Object.freeze(out)}function itemOf(raw){if(raw===null||typeof raw!="object")return null;let o=raw,rawId=o.product_id,productId=typeof rawId=="number"&&Number.isInteger(rawId)?String(rawId):str(rawId,REF_MAX),title=str(o.title,300);return productId===null||title===null?null:/* @__PURE__ */Object.freeze({productId:productId,partnerSku:str(o.partner_sku,200),title:title,description:str(o.description),category:str(o.category,60),price:priceOf(o.price),currency:currencyOf(o.currency),imageUrl:httpsUrl(o.image_url),url:httpsUrl(o.url),reasons:reasonsOf(o.reasons),inPlan:o.in_plan===true,sample:o.sample===true})}function healthPlanFromWire(raw,petRef){if(raw===null||typeof raw!="object")return null;let o=raw;if(!Array.isArray(o.items))return null;let items=[],seen=/* @__PURE__ */new Set;for(let row of o.items){let item=itemOf(row);item===null||seen.has(item.productId)||(seen.add(item.productId),items.push(item))}/* @__PURE__ */
|
|
102
|
-
return Object.freeze({petRef:str(o.pet_ref,REF_MAX)??petRef,headline:str(o.headline,300),items:/* @__PURE__ */Object.freeze(items),updatedAt:str(o.updated_at,64),...o.tracking_texts_enabled===true?{trackingTextsEnabled:true}:{}})}function validRef(value){return typeof value=="string"&&value.length>0&&value.length<=REF_MAX}function planPath(petRef){return`/widget/v1/pets/${encodeURIComponent(petRef)}/plan`}function createHealthPlanRepository(runtime){let over=()=>{let{services:services}=runtime.registry;return createHealthPlanRepositoryOver({auth:services.authFor(null),...services.errorPolicy?{errorPolicy:services.errorPolicy}:{}})};return{read:(petRef,opts)=>runtime.isDisposed?Promise.resolve(err(disposed("read"))):over().read(petRef,opts),addItem:(petRef,id)=>runtime.isDisposed?Promise.resolve(err(disposed("addItem"))):over().addItem(petRef,id),removeItem:(petRef,id)=>runtime.isDisposed?Promise.resolve(err(disposed("removeItem"))):over().removeItem(petRef,id)}}function createHealthPlanRepositoryOver(deps){let funnel=withPlainNotFound(deps.funnel??createRequestFunnel({auth:deps.auth,...deps.errorPolicy?{errorPolicy:deps.errorPolicy}:{}})),
|
|
102
|
+
return Object.freeze({petRef:str(o.pet_ref,REF_MAX)??petRef,headline:str(o.headline,300),items:/* @__PURE__ */Object.freeze(items),updatedAt:str(o.updated_at,64),...o.tracking_texts_enabled===true?{trackingTextsEnabled:true}:{}})}function validRef(value){return typeof value=="string"&&value.length>0&&value.length<=REF_MAX}function planPath(petRef){return`/widget/v1/pets/${encodeURIComponent(petRef)}/plan`}function createHealthPlanRepository(runtime){let over=()=>{let{services:services}=runtime.registry;return createHealthPlanRepositoryOver({auth:services.authFor(null),...services.errorPolicy?{errorPolicy:services.errorPolicy}:{}})};return{read:(petRef,opts)=>runtime.isDisposed?Promise.resolve(err(disposed("read"))):over().read(petRef,opts),addItem:(petRef,id)=>runtime.isDisposed?Promise.resolve(err(disposed("addItem"))):over().addItem(petRef,id),removeItem:(petRef,id)=>runtime.isDisposed?Promise.resolve(err(disposed("removeItem"))):over().removeItem(petRef,id)}}function createHealthPlanRepositoryOver(deps){let funnel=withPlainNotFound(deps.funnel??createRequestFunnel({auth:deps.auth,...deps.errorPolicy?{errorPolicy:deps.errorPolicy}:{}})),write2=async(method,petRef,productId)=>{if(!validRef(petRef))return err(invalid("petRef must be 1..128 characters"));if(!validRef(productId))return err(invalid("productId must be 1..128 characters"));let call=method==="PUT"?"healthPlan.item.add":"healthPlan.item.remove",res=await funnel.send(call,{method:method,path:`${planPath(petRef)}/items/${encodeURIComponent(productId)}`});return res.ok?res.value===null||res.value===void 0||res.value===""?ok(null):ok(healthPlanFromWire(res.value,petRef)):err(res.error)};return{async read(petRef,opts){if(!validRef(petRef))return err(invalid("petRef must be 1..128 characters"));let req={method:"GET",path:planPath(petRef),...opts?.signal?{signal:opts.signal}:{}},res=await funnel.send("healthPlan.read",req);if(!res.ok)return err(res.error);let plan=healthPlanFromWire(res.value,petRef);return plan===null?err(malformed("healthPlan.read")):ok(plan)},addItem:(petRef,productId)=>write2("PUT",petRef,productId),removeItem:(petRef,productId)=>write2("DELETE",petRef,productId)}}var IDLE=/* @__PURE__ */Object.freeze({phase:"idle",petRef:null,plan:null,pending:/* @__PURE__ */Object.freeze([]),itemErrors:/* @__PURE__ */Object.freeze({}),error:null});function withItem(plan,productId,inPlan){let items=plan.items.map(item=>item.productId===productId?/* @__PURE__ */Object.freeze({...item,inPlan:inPlan}):item);/* @__PURE__ */
|
|
103
103
|
return Object.freeze({...plan,items:/* @__PURE__ */Object.freeze(items)})}var HealthPlanController=class{constructor(repository){this.repository=repository;this.snapshot=IDLE;this.listeners=/* @__PURE__ */new Set;this.generation=0;this.writes=0;this.revalidations=0;this.refreshAfterWrites=false;this.disposed=false;this.subscribe=listener=>(this.listeners.add(listener),()=>{this.listeners.delete(listener)});this.getSnapshot=()=>this.snapshot}set(next){if(!this.disposed){this.snapshot=/* @__PURE__ */Object.freeze({...this.snapshot,...next});for(let listener of this.listeners)listener()}}async load(petRef){let gen=++this.generation;if(this.refreshAfterWrites=false,petRef===null){this.set({...IDLE});return}let samePet=this.snapshot.petRef===petRef;this.set({phase:"loading",petRef:petRef,plan:samePet?this.snapshot.plan:null,pending:/* @__PURE__ */Object.freeze([]),itemErrors:samePet?this.snapshot.itemErrors:/* @__PURE__ */Object.freeze({}),error:null});let result=await this.repository.read(petRef);if(gen===this.generation){if(!result.ok){this.set({phase:"failed",error:result.error});return}this.set({phase:"ready",plan:result.value,error:null,itemErrors:/* @__PURE__ */Object.freeze({})})}}async revalidate(){let{phase:phase,petRef:petRef,pending:pending}=this.snapshot;if(phase!=="ready"||petRef===null||pending.length>0)return;let gen=this.generation,writes=this.writes,seq=++this.revalidations,result=await this.repository.read(petRef);gen!==this.generation||writes!==this.writes||seq!==this.revalidations||this.snapshot.pending.length>0||this.snapshot.petRef!==petRef||result.ok&&this.set({plan:result.value,itemErrors:/* @__PURE__ */Object.freeze({})})}async refresh(){let{phase:phase,petRef:petRef,pending:pending}=this.snapshot;if(!(petRef===null||phase==="idle")){if(phase!=="ready")return this.load(petRef);if(pending.length>0){this.refreshAfterWrites=true;return}return this.revalidate()}}settleWrite(){!this.refreshAfterWrites||this.snapshot.pending.length>0||(this.refreshAfterWrites=false,this.revalidate())}async setInPlan(productId,inPlan){let{plan:plan,petRef:petRef,pending:pending}=this.snapshot;if(this.snapshot.phase!=="ready"||plan===null||petRef===null||pending.includes(productId))return false;let before=plan.items.find(item=>item.productId===productId);if(before===void 0||before.inPlan===inPlan)return false;this.writes+=1;let gen=this.generation,otherErrors=Object.fromEntries(Object.entries(this.snapshot.itemErrors).filter(([id])=>id!==productId));this.set({plan:withItem(plan,productId,inPlan),pending:/* @__PURE__ */Object.freeze([...pending,productId]),itemErrors:/* @__PURE__ */Object.freeze(otherErrors)});let result=inPlan?await this.repository.addItem(petRef,productId):await this.repository.removeItem(petRef,productId);if(gen!==this.generation)return result.ok;let current=this.snapshot.plan??plan,stillPending=/* @__PURE__ */Object.freeze(this.snapshot.pending.filter(id=>id!==productId));if(!result.ok)return this.set({plan:withItem(current,productId,before.inPlan),pending:stillPending,itemErrors:/* @__PURE__ */Object.freeze({...this.snapshot.itemErrors,[productId]:result.error})}),this.settleWrite(),false;let next=result.value??current;for(let id of stillPending){let mine=current.items.find(item=>item.productId===id);mine!==void 0&&(next=withItem(next,id,mine.inPlan))}return this.set({plan:next,pending:stillPending}),this.settleWrite(),true}dispose(){this.generation+=1,this.disposed=true,this.listeners.clear()}};function useScopedController(create,deps){let[controller,setController]=useState(create),adopted=useRef(false);return useEffect(()=>{let current=controller;return adopted.current&&(current=create(),setController(current)),adopted.current=true,()=>current.dispose()},deps),controller}function reportHostFailure(error){let globalConsole=globalThis.console;try{globalConsole?.error?.("[everfur] A host callback threw; the SDK ignored it.",error)}catch{}}function isThenable(value){return(typeof value=="object"||typeof value=="function")&&value!==null&&typeof value.then=="function"}function callHost(fn,...args){if(typeof fn=="function")try{let result=fn(...args);return isThenable(result)&&Promise.resolve(result).then(void 0,reportHostFailure),result}catch(error){reportHostFailure(error);return}}var GUARDED=/* @__PURE__ */new WeakMap;function guardHost(fn){if(typeof fn!="function")return;let cached=GUARDED.get(fn);if(cached!==void 0)return cached;let guarded=(...args)=>{callHost(fn,...args)};return GUARDED.set(fn,guarded),guarded}function guardHostProps(props,names){let guarded=null;for(let name of names){let fn=props[name];typeof fn=="function"&&(guarded??={...props},guarded[name]=guardHost(fn))}return guarded??props}var HEALTH_PLAN_STALE_MS=6e4;function useHealthPlanRevalidation({lifecycle:lifecycle,refreshKey:refreshKey,readyAt:readyAt,revalidate:revalidate,refresh:refresh,now:now=Date.now}){let latest=useRef({readyAt:readyAt,revalidate:revalidate,refresh:refresh??revalidate,now:now});latest.current={readyAt:readyAt,revalidate:revalidate,refresh:refresh??revalidate,now:now},useEffect(()=>{if(lifecycle==null)return;let stop=callHost(()=>lifecycle.onForeground(()=>{let{readyAt:at,revalidate:run2,now:clock}=latest.current;at!==null&&clock()-at>=HEALTH_PLAN_STALE_MS&&run2()}));return()=>{typeof stop=="function"&&callHost(stop)}},[lifecycle]);let seenKey=useRef(refreshKey);useEffect(()=>{Object.is(seenKey.current,refreshKey)||(seenKey.current=refreshKey,latest.current.refresh())},[refreshKey])}function healthPlanCart(plan){let items=/* @__PURE__ */Object.freeze((plan?.items??[]).filter(item=>item.inPlan));if(items.length===0)/* @__PURE__ */return Object.freeze({items:items,count:0,subtotal:null,currency:null});let currencies=new Set(items.map(item=>item.currency));if(!items.every(item=>item.price!==null)||currencies.size!==1)/* @__PURE__ */return Object.freeze({items:items,count:items.length,subtotal:null,currency:null});let cents=items.reduce((sum,item)=>sum+Math.round(item.price*100),0);/* @__PURE__ */
|
|
104
104
|
return Object.freeze({items:items,count:items.length,subtotal:cents/100,currency:items[0]?.currency??null})}function formatHealthPlanPrice(amount,currency,locale,format){if(amount===null||currency===null||!Number.isFinite(amount))return null;let whole=format?.dropZeroCents===true&&Number.isInteger(amount);try{return new Intl.NumberFormat(locale,{style:"currency",currency:currency,...whole?{minimumFractionDigits:0,maximumFractionDigits:0}:{}}).format(amount)}catch{return`${currency} ${whole?String(amount):amount.toFixed(2)}`}}function formatHealthPlanPriceWith(amount,currency,format){return formatHealthPlanPrice(amount,currency,format?.locale,format)}function useEverfurHealthPlanRepository(){let{runtime:runtime}=useEverfurContext();return useMemo(()=>createHealthPlanRepository(runtime),[runtime])}function useEverfurHealthPlan(options){let{userRef:userRef,activePet:activePet,scopeEpoch:scopeEpoch}=useEverfurContext(),repository=useEverfurHealthPlanRepository(),petRef=options?.petRef??activePet??null,controller=useScopedController(()=>new HealthPlanController(repository),[repository,userRef,scopeEpoch]);useEffect(()=>{controller.load(userRef===null?null:petRef)},[controller,userRef,petRef]);let snapshot=useSyncExternalStore(controller.subscribe,controller.getSnapshot,controller.getSnapshot),cart=useMemo(()=>healthPlanCart(snapshot.plan),[snapshot.plan]),[readyAt,setReadyAt]=useState(null);useEffect(()=>{setReadyAt(snapshot.phase==="ready"&&snapshot.plan!==null?Date.now():null)},[snapshot.phase,snapshot.plan]),useHealthPlanRevalidation({lifecycle:options?.lifecycle,refreshKey:options?.refreshKey,readyAt:readyAt,revalidate:()=>{controller.revalidate()},refresh:()=>{controller.refresh()}});let status;return userRef===null?status="signedOut":petRef===null?status="noPet":snapshot.petRef!==petRef||snapshot.phase==="idle"||snapshot.phase==="loading"?status="loading":snapshot.phase==="failed"?status=isNotFoundError(snapshot.error)?"empty":"failed":status=(snapshot.plan?.items.length??0)===0?"empty":"ready",useMemo(()=>({status:status,petRef:petRef,plan:snapshot.petRef===petRef?snapshot.plan:null,cart:cart,pending:snapshot.pending,itemErrors:snapshot.itemErrors,error:status==="empty"?null:snapshot.error,setInPlan:(productId,inPlan)=>controller.setInPlan(productId,inPlan),refresh:()=>controller.load(userRef===null?null:petRef)}),[status,petRef,snapshot,cart,controller,userRef])}var REF_MAX2=128,DATE=/^\d{4}-\d{2}-\d{2}$/,STEPS=/* @__PURE__ */new Set(["first_box_ships","checkin","refill_reminder","next_box_ships"]);function isHealthPlanSubscriptionUnavailable(error){return error!=null&&(error.httpStatus===404||error.category==="notFound")}var str2=(value,max=300)=>typeof value=="string"&&value.trim().length>0&&value.length<=max?value.trim():null;function money(value){let n=typeof value=="number"?value:typeof value=="string"&&/^\d+(\.\d+)?$/.test(value.trim())?Number(value):Number.NaN;return Number.isFinite(n)&&n>=0?n:null}function int(value){return typeof value=="number"&&Number.isInteger(value)&&value>0?value:null}function idOf(value){return typeof value=="number"&&Number.isInteger(value)?String(value):str2(value,REF_MAX2)}function currencyOf2(value){return typeof value=="string"&&/^[A-Za-z]{3}$/.test(value)?value.toUpperCase():null}function dateOf(value){return typeof value=="string"&&DATE.test(value)?value:null}function intervalsOf(value){return Array.isArray(value)?/* @__PURE__ */Object.freeze(value.map(int).filter(n=>n!==null)):/* @__PURE__ */Object.freeze([])}function renewalOf(value){if(value===null||typeof value!="object")return null;let o=value,amount=money(o.amount),currency=currencyOf2(o.currency),intervalDays=int(o.interval_days);return amount===null||currency===null||intervalDays===null?null:/* @__PURE__ */Object.freeze({amount:amount,currency:currency,intervalDays:intervalDays})}function timelineOf(value){if(!Array.isArray(value))/* @__PURE__ */return Object.freeze([]);let out=[];for(let raw of value){if(raw===null||typeof raw!="object")continue;let o=raw,on=dateOf(o.on);typeof o.step!="string"||!STEPS.has(o.step)||on===null||out.push(/* @__PURE__ */Object.freeze({step:o.step,on:on}))}/* @__PURE__ */
|
|
105
105
|
return Object.freeze(out)}function healthPlanSubscriptionFromWire(raw){if(raw===null||typeof raw!="object")return null;let o=raw,subscriptionId=idOf(o.subscription_id),productId=idOf(o.product_id),status=o.status==="active"||o.status==="cancelled"?o.status:null,intervalDays=int(o.interval_days),currency=currencyOf2(o.currency),boxPrice=money(o.box_price);if(subscriptionId===null||productId===null||status===null||intervalDays===null||currency===null||boxPrice===null)return null;let options=intervalsOf(o.interval_options);/* @__PURE__ */
|
|
106
106
|
return Object.freeze({subscriptionId:subscriptionId,productId:productId,title:str2(o.title),status:status,intervalDays:intervalDays,intervalOptions:options.length>0?options:/* @__PURE__ */Object.freeze([intervalDays]),currency:currency,boxPrice:boxPrice,firstBoxPrice:money(o.first_box_price)??boxPrice,offerApplied:o.offer_applied===true,nextBoxDate:status==="active"?dateOf(o.next_box_date):null,renewal:renewalOf(o.renewal),timeline:status==="active"?timelineOf(o.timeline):/* @__PURE__ */Object.freeze([])})}function healthPlanOneBoxOrderFromWire(raw){if(raw===null||typeof raw!="object")return null;let o=raw,orderId=idOf(o.order_id),productId=idOf(o.product_id),currency=currencyOf2(o.currency),price=money(o.price);if(orderId===null||productId===null||currency===null||price===null)return null;let quantity=int(o.quantity),qty=quantity!==null&&quantity<=QUANTITY_MAX?quantity:1;/* @__PURE__ */
|
|
107
|
-
return Object.freeze({orderId:orderId,productId:productId,title:str2(o.title),currency:currency,boxPrice:money(o.box_price)??price,price:price,discountPercent:int(o.discount_percent)??0,shipsOn:dateOf(o.ships_on),createdAt:instantOf(o.created_at),quantity:qty,total:money(o.total)??Math.round(price*qty*100)/100,...trackingOf(o.tracking)})}var QUANTITY_MAX=10,TRACKING_STATUSES=/* @__PURE__ */new Set(["ordered","shipped","delivered"]),UNSAFE_TEXT=/[\u0000-\u001f\u007f\u202a-\u202e\u2066-\u2069]/;function trackingText(value,max){if(typeof value!="string"||UNSAFE_TEXT.test(value))return null;let v=value.trim();return v.length>0&&v.length<=max?v:null}function trackingUrlOf(value){
|
|
107
|
+
return Object.freeze({orderId:orderId,productId:productId,title:str2(o.title),currency:currency,boxPrice:money(o.box_price)??price,price:price,discountPercent:int(o.discount_percent)??0,shipsOn:dateOf(o.ships_on),createdAt:instantOf(o.created_at),quantity:qty,total:money(o.total)??Math.round(price*qty*100)/100,...trackingOf(o.tracking)})}var QUANTITY_MAX=10,TRACKING_STATUSES=/* @__PURE__ */new Set(["ordered","shipped","delivered"]),UNSAFE_TEXT=/[\u0000-\u001f\u007f\u202a-\u202e\u2066-\u2069]/;function trackingText(value,max){if(typeof value!="string"||UNSAFE_TEXT.test(value))return null;let v=value.trim();return v.length>0&&v.length<=max?v:null}function trackingUrlOf(value){return typeof value!="string"||value.length>2048||UNSAFE_TEXT.test(value)||/[\s@]/.test(value)||!/^https:\/\/[^/]/i.test(value)?null:parseUrl(value)?.protocol==="https:"?value:null}function healthPlanOrderTrackingFromWire(raw){if(raw===null||typeof raw!="object"||Array.isArray(raw))return null;let o=raw,status=typeof o.status=="string"&&TRACKING_STATUSES.has(o.status)?o.status:"ordered";/* @__PURE__ */
|
|
108
108
|
return Object.freeze({status:status,orderNumber:trackingText(o.order_number,64),carrier:trackingText(o.carrier,64),trackingNumber:trackingText(o.tracking_number,128),trackingUrl:trackingUrlOf(o.tracking_url),shippedAt:instantOf(o.shipped_at),estimatedDelivery:dateOf(o.estimated_delivery),updatedAt:instantOf(o.updated_at)})}function trackingOf(raw){let t=healthPlanOrderTrackingFromWire(raw);return t===null?{}:{tracking:t}}function healthPlanOneBoxOrderPageFromWire(raw){let rows=raw!==null&&typeof raw=="object"?raw.orders:null;if(!Array.isArray(rows))return null;let cursor=raw.next_cursor;/* @__PURE__ */
|
|
109
109
|
return Object.freeze({orders:/* @__PURE__ */Object.freeze(rows.map(healthPlanOneBoxOrderFromWire).filter(x=>x!==null)),nextCursor:typeof cursor=="string"&&cursor.length>0&&cursor.length<=REF_MAX2?cursor:null})}function instantOf(value){return typeof value!="string"||value.length>40||!/^\d{4}-\d{2}-\d{2}T/.test(value)||Number.isNaN(Date.parse(value))?null:value}function oneBoxOf(value,boxPrice){if(value===null||typeof value!="object")return null;let o=value,price=money(o.price);return price===null||price>boxPrice?null:/* @__PURE__ */Object.freeze({price:price,discountPercent:int(o.discount_percent)??0})}function healthPlanSubscriptionQuoteFromWire(raw){if(raw===null||typeof raw!="object")return null;let o=raw,productId=idOf(o.product_id),currency=currencyOf2(o.currency),boxPrice=money(o.box_price),options=intervalsOf(o.interval_options);if(productId===null||currency===null||boxPrice===null||options.length===0)return null;let offerApplies=o.offer_applies===true,def=int(o.default_interval_days),s=o.supply,supply=null;if(s!==null&&typeof s=="object"){let so=s,unitsPerBox=int(so.units_per_box),unitsPerDay=money(so.units_per_day),supplyDays=int(so.supply_days);unitsPerBox!==null&&unitsPerDay!==null&&supplyDays!==null&&(supply=/* @__PURE__ */Object.freeze({unitsPerBox:unitsPerBox,unitLabel:str2(so.unit_label,30),unitsPerDay:unitsPerDay,supplyDays:supplyDays,doseBasis:so.dose_basis==="weight"?"weight":"assumed"}))}let pct=int(o.first_box_discount_percent)??0;/* @__PURE__ */
|
|
110
110
|
return Object.freeze({productId:productId,currency:currency,boxPrice:boxPrice,firstBoxPrice:offerApplies?money(o.first_box_price)??boxPrice:boxPrice,firstBoxDiscountPercent:offerApplies?pct:0,offerApplies:offerApplies,oneBox:oneBoxOf(o.one_box,boxPrice),intervalOptions:options,defaultIntervalDays:def!==null&&options.includes(def)?def:options[0],supply:supply,firstBoxShipsOn:dateOf(o.first_box_ships_on),subscription:healthPlanSubscriptionFromWire(o.subscription)})}function invalid2(wireMessage){return makeEverfurError("validationFailed",{retryable:false,wireMessage:wireMessage})}function malformed2(call){return makeEverfurError("internalError",{retryable:false,httpStatus:502,wireMessage:`${call}: the response carried no subscription`})}function disposed2(verb){return makeEverfurError("runtimeDisposed",{retryable:false,wireMessage:`the Everfur runtime is disposed; ${verb} was called after unmount`})}var validRef2=value=>typeof value=="string"&&value.length>0&&value.length<=REF_MAX2;function base(petRef){return`/widget/v1/pets/${encodeURIComponent(petRef)}/plan/subscriptions`}function createHealthPlanSubscriptionRepositoryOver(deps){let funnel=withPlainNotFound(deps.funnel??createRequestFunnel({auth:deps.auth,...deps.errorPolicy?{errorPolicy:deps.errorPolicy}:{}})),one=async(call,petRef,method,suffix,body)=>{if(!validRef2(petRef))return err(invalid2("petRef must be 1..128 characters"));let res=await funnel.send(call,{method:method,path:`${base(petRef)}${suffix}`,...body===void 0?{}:{body:body}});if(!res.ok)return err(res.error);let sub=healthPlanSubscriptionFromWire(res.value);return sub===null?err(malformed2(call)):ok(sub)},idSuffix=(id,tail="")=>validRef2(id)?`/${encodeURIComponent(id)}${tail}`:null;return{async quote(petRef,productId){if(!validRef2(petRef))return err(invalid2("petRef must be 1..128 characters"));if(!validRef2(productId))return err(invalid2("productId must be 1..128 characters"));let res=await funnel.send("healthPlan.subscription.quote",{method:"GET",path:`${base(petRef)}/quote`,query:{product_id:productId}});if(!res.ok)return err(res.error);let quote=healthPlanSubscriptionQuoteFromWire(res.value);return quote===null?err(malformed2("healthPlan.subscription.quote")):ok(quote)},async list(petRef){if(!validRef2(petRef))return err(invalid2("petRef must be 1..128 characters"));let res=await funnel.send("healthPlan.subscription.list",{method:"GET",path:base(petRef)});if(!res.ok)return err(res.error);let rows=res.value!==null&&typeof res.value=="object"?res.value.subscriptions:null;return Array.isArray(rows)?ok(/* @__PURE__ */Object.freeze(rows.map(healthPlanSubscriptionFromWire).filter(s=>s!==null))):err(malformed2("healthPlan.subscription.list"))},create(petRef,productId,intervalDays){return validRef2(productId)?one("healthPlan.subscription.create",petRef,"POST","",{product_id:productId,...intervalDays===void 0?{}:{interval_days:intervalDays}}):Promise.resolve(err(invalid2("productId must be 1..128 characters")))},changeInterval(petRef,id,intervalDays){let s=idSuffix(id);return s===null?Promise.resolve(err(invalid2("subscriptionId must be 1..128 characters"))):one("healthPlan.subscription.interval",petRef,"PATCH",s,{interval_days:intervalDays})},skip(petRef,id){let s=idSuffix(id,"/skip");return s===null?Promise.resolve(err(invalid2("subscriptionId must be 1..128 characters"))):one("healthPlan.subscription.skip",petRef,"POST",s,{})},cancel(petRef,id){let s=idSuffix(id,"/cancel");return s===null?Promise.resolve(err(invalid2("subscriptionId must be 1..128 characters"))):one("healthPlan.subscription.cancel",petRef,"POST",s,{})},restart(petRef,id,intervalDays){let s=idSuffix(id,"/restart");return s===null?Promise.resolve(err(invalid2("subscriptionId must be 1..128 characters"))):one("healthPlan.subscription.restart",petRef,"POST",s,intervalDays===void 0?{}:{interval_days:intervalDays})},async buyOneBox(petRef,productId,tapKey){if(!validRef2(petRef))return err(invalid2("petRef must be 1..128 characters"));if(!validRef2(productId))return err(invalid2("productId must be 1..128 characters"));let res=await funnel.send("healthPlan.subscription.oneBox",{method:"POST",path:`${base(petRef)}/one-box`,body:{product_id:productId}},{idempotent:true,...tapKey===void 0?{}:{idempotencyKey:`hp-one-box:${tapKey}`}});if(!res.ok)return err(res.error);let order=healthPlanOneBoxOrderFromWire(res.value);return order===null?err(malformed2("healthPlan.subscription.oneBox")):ok(order)},async listOneBoxOrders(petRef){if(!validRef2(petRef))return err(invalid2("petRef must be 1..128 characters"));let res=await funnel.send("healthPlan.subscription.oneBoxList",{method:"GET",path:`${base(petRef)}/one-box`});if(!res.ok)return err(res.error);let page=healthPlanOneBoxOrderPageFromWire(res.value);return page===null?err(malformed2("healthPlan.subscription.oneBoxList")):ok(page.orders)},async listOneBoxOrderPage(petRef,opts){if(!validRef2(petRef))return err(invalid2("petRef must be 1..128 characters"));let limit=opts?.limit;if(limit!==void 0&&!(Number.isInteger(limit)&&limit>=1&&limit<=50))return err(invalid2("limit must be a whole number 1..50"));if(opts?.cursor!==void 0&&!validRef2(opts.cursor))return err(invalid2("cursor must be 1..128 characters"));let query={...limit!==void 0?{limit:String(limit)}:{},...opts?.cursor!==void 0?{cursor:opts.cursor}:{}},res=await funnel.send("healthPlan.subscription.oneBoxList",{method:"GET",path:`${base(petRef)}/one-box`,query:query});if(!res.ok)return err(res.error);let page=healthPlanOneBoxOrderPageFromWire(res.value);return page===null?err(malformed2("healthPlan.subscription.oneBoxList")):ok(page)}}}function createHealthPlanSubscriptionRepository(runtime){let over=()=>{let{services:services}=runtime.registry;return createHealthPlanSubscriptionRepositoryOver({auth:services.authFor(null),...services.errorPolicy?{errorPolicy:services.errorPolicy}:{}})},guard=(verb,f)=>(...a)=>runtime.isDisposed?Promise.resolve(err(disposed2(verb))):f(over(),...a);return{quote:guard("quote",(r,p,id)=>r.quote(p,id)),list:guard("list",(r,p)=>r.list(p)),create:guard("create",(r,p,id,n)=>r.create(p,id,n)),changeInterval:guard("changeInterval",(r,p,id,n)=>r.changeInterval(p,id,n)),skip:guard("skip",(r,p,id)=>r.skip(p,id)),cancel:guard("cancel",(r,p,id)=>r.cancel(p,id)),restart:guard("restart",(r,p,id,n)=>r.restart(p,id,n)),buyOneBox:guard("buyOneBox",(r,p,id,k)=>r.buyOneBox(p,id,k)),listOneBoxOrders:guard("listOneBoxOrders",(r,p)=>r.listOneBoxOrders(p)),listOneBoxOrderPage:guard("listOneBoxOrderPage",(r,p,o)=>r.listOneBoxOrderPage(p,o))}}var REFUSALS=/* @__PURE__ */new Set(["cart_disabled","cart_has_subscription","cart_currency_mixed","sample_product","partner_endpoint_missing","checkout_pending","already_subscribed"]);function healthPlanCheckoutRefusal(error){if(error==null||error.httpStatus!==409)return null;let raw=obj(error.raw);for(let candidate of[error.reasonCode,error.wireMessage,raw?.detail,raw?.message,raw?.reason_code])if(typeof candidate=="string"&&REFUSALS.has(candidate.trim()))return candidate.trim();return null}var REF_MAX3=128,CART_MAX=10,ICONS=/* @__PURE__ */new Set(["shield","arrow","check","star","truck","refresh","card","alert","x","chat","repeat","calendar","flame","box","cart","minus","plus","chev","pulse","file","kit","dna","heart","bottle","harness","ramp"]),TONES=/* @__PURE__ */new Set(["y","c","g","r"]),TRACK_STATES=/* @__PURE__ */new Set(["done","now","next"]),obj=value=>value!==null&&typeof value=="object"&&!Array.isArray(value)?value:null,str3=(value,max=1e3)=>typeof value=="string"&&value.trim().length>0&&value.length<=max?value.trim():null,kindOf=value=>typeof value=="string"&&/^[A-Za-z0-9_-]{1,40}$/.test(value)?value:null,iconOf=value=>typeof value=="string"&&ICONS.has(value)?value:null;function imageOf(value){let s=str3(value,2048);return s===null||/\s/.test(s)?null:/^https:\/\/[^/]/i.test(s)||/^\/(?![/\\])/.test(s)?s:null}var idOf2=value=>typeof value=="number"&&Number.isInteger(value)?String(value):str3(value,REF_MAX3);function weightOf(value){return typeof value=="number"&&Number.isFinite(value)&&value>0?value:null}function clean(fields){/* @__PURE__ */
|
|
@@ -116,14 +116,14 @@ return Object.freeze({profileVersion:typeof version=="number"&&Number.isInteger(
|
|
|
116
116
|
return Object.freeze({petRef:str5(o.pet_ref)??petRef,name:str5(o.name),species:str5(o.species),breed:str5(o.breed),ageYears:num(o.age_years),weightKg:num(o.weight_kg)})}function widgetPetFromWire(raw){if(typeof raw!="object"||raw===null)return null;let o=raw,petRef=str5(o.pet_ref);return petRef===null||petRef.length===0?null:/* @__PURE__ */Object.freeze({petId:str5(o.pet_id),petRef:petRef,name:str5(o.name),species:str5(o.species),breed:str5(o.breed),ageYears:num(o.age_years),weightKg:num(o.weight_kg),updatedAt:str5(o.updated_at)})}function widgetPetProfileFromWire(raw){let pet=widgetPetFromWire(raw);return pet===null?null:/* @__PURE__ */Object.freeze({...pet,...petHealthFromWire(raw)})}function petListFromWire(raw){let rows=Array.isArray(raw)?raw:typeof raw=="object"&&raw!==null&&Array.isArray(raw.pets)?raw.pets:[];/* @__PURE__ */
|
|
117
117
|
return Object.freeze(rows.flatMap(row=>{let pet=widgetPetFromWire(row);return pet===null?[]:[pet]}))}function createPetsRepository(auth){return createPetsRepositoryOver(createRequestFunnel({auth:auth}),createRequestFunnel({auth:auth,unaryTimeoutMs:ERASE_USER_DATA_TIMEOUT_MS}))}function createPetsRepositoryOver(funnel,eraseFunnel=funnel){let withSignal=(req,signal)=>signal?{...req,signal:signal}:req,petPath=petRef=>validate(petRef,void 0)??`/widget/v1/pets/${encodeURIComponent(petRef)}`;return{async list(opts){let res=await funnel.send("pets.list",withSignal({method:"GET",path:"/widget/v1/pets"},opts?.signal));return res.ok?ok(petListFromWire(res.value)):err(res.error)},async registerPet(petRef,profile,opts){let invalid5=validate(petRef,profile);if(invalid5!==null)return err(invalid5);let wire=toWire(profile);if("error"in wire)return err(wire.error);let base3={method:"POST",path:`/widget/v1/pets/${encodeURIComponent(petRef)}`,body:wire.body},res=await funnel.send("pets.registerPet",opts?.signal?{...base3,signal:opts.signal}:base3);return res.ok?ok(fromWire2(res.value,petRef)):err(res.error)},async updatePet(petRef,patch,opts){let path=petPath(petRef);if(typeof path!="string")return err(path);let wire=patchToWire(patch);if("error"in wire)return err(wire.error);let res=await funnel.send("pets.updatePet",withSignal({method:"PATCH",path:path,body:wire.body},opts?.signal));return res.ok?ok(fromWire2(res.value,petRef)):err(res.error)},async getPetProfile(petRef,opts){let path=petPath(petRef);if(typeof path!="string")return err(path);let res=await funnel.send("pets.getPetProfile",withSignal({method:"GET",path:`${path}/profile`},opts?.signal));if(!res.ok)return err(res.error);let profile=widgetPetProfileFromWire(res.value);return profile===null?err(makeEverfurError("internalError",{retryable:false,httpStatus:502,wireMessage:"the pet profile response carried no pet_ref"})):ok(profile)},async deletePet(petRef,opts){let path=petPath(petRef);if(typeof path!="string")return err(path);let res=await funnel.send("pets.deletePet",withSignal({method:"DELETE",path:path},opts?.signal));return res.ok?ok(void 0):err(res.error)},async eraseUserData(opts){let res=await eraseFunnel.send("pets.eraseUserData",withSignal({method:"DELETE",path:"/widget/v1/me"},opts?.signal),{maxAttempts:1});return res.ok?ok(void 0):err(res.error)}}}var listeners=/* @__PURE__ */new WeakMap;function subscribePetsChanged(runtime,listener){let set=listeners.get(runtime);return set===void 0&&(set=/* @__PURE__ */new Set,listeners.set(runtime,set)),set.add(listener),()=>{set?.delete(listener)}}function useEverfurPets(){let{runtime:runtime,userRef:userRef,activePet:activePetRef,scopeEpoch:scopeEpoch}=useEverfurContext(),repository=useMemo(()=>createPetsRepository(runtime.registry.services.authFor(userRef)),[runtime,userRef,scopeEpoch]),[state2,setState]=useState({repository:repository,pets:[],loading:true,error:null}),current=state2.repository===repository?state2:{pets:[],loading:true,error:null},generation=useRef(0),load=useCallback(async()=>{let request=++generation.current;setState(previous=>({...previous,repository:repository,loading:true,error:null,pets:previous.repository===repository?previous.pets:[]}));let result=await repository.list();request===generation.current&&setState(result.ok?{repository:repository,pets:result.value,loading:false,error:null}:previous=>({repository:repository,pets:previous.repository===repository?previous.pets:[],loading:false,error:result.error}))},[repository]);useEffect(()=>(load(),()=>{generation.current+=1}),[load]),useEffect(()=>subscribePetsChanged(runtime,()=>{load()}),[runtime,load]);let activePet=useMemo(()=>activePetRef===null?null:current.pets.find(pet=>pet.petRef===activePetRef)??null,[activePetRef,current.pets]);return useMemo(()=>({pets:current.pets,activePet:activePet,loading:current.loading,error:current.error,refresh:load}),[current.pets,current.loading,current.error,activePet,load])}var freezeInPlace=Object.freeze;function deepFreeze(value){if(value!==null&&typeof value=="object"&&!Object.isFrozen(value)){freezeInPlace(value);for(let key of Object.keys(value))deepFreeze(value[key])}return value}var TEXT_SCALE_TIER_CAPS=/* @__PURE__ */Object.freeze({content:0,heading:2,control:1.8,compact:1.5,badge:1.3}),SPACE={xs:4,sm:8,md:12,lg:16,xl:24,xxl:32},RADIUS={tile:5,xs:6,sm:10,md:14,lg:20,xl:28,pill:500},TYPE_SIZE={nano:8,small:9,micro:10,tiny:11,caption:13,bodyTight:15,body:17,subtitle:20,heading:22,verdict:24},LINE_HEIGHT={tight:1.15,snug:1.3,normal:1.4,relaxed:1.55},WEIGHT={regular:"400",medium:"500",bold:"700"},LETTER_SPACING={eyebrow:1,monoWide:.9,headerBrand:-.42,tight:-.35},DEFAULT_MAX_FONT_SCALE=0,SYSTEM_FONT_FAMILY="System",SYSTEM_MONO_FAMILY="monospace",TIERS=["content","heading","control","compact","badge"];function authoredTierSizes(size){let out={};for(let tier of TIERS)out[tier]=size;return out}var NO_FONT_SOURCES=[];function baseType(){return{family:SYSTEM_FONT_FAMILY,mono:SYSTEM_MONO_FAMILY,fontUrl:null,families:{regular:SYSTEM_FONT_FAMILY,medium:SYSTEM_FONT_FAMILY,bold:SYSTEM_FONT_FAMILY,mono:SYSTEM_MONO_FAMILY,monoMedium:SYSTEM_MONO_FAMILY,monoBold:SYSTEM_MONO_FAMILY},namedFaces:{regular:false,medium:false,bold:false,mono:false,monoMedium:false,monoBold:false},fontUrls:{},size:TYPE_SIZE,tierSizes:authoredTierSizes(TYPE_SIZE),lineHeight:LINE_HEIGHT,weight:WEIGHT,letterSpacing:LETTER_SPACING,scale:1,maxScale:DEFAULT_MAX_FONT_SCALE,scaleCaps:TEXT_SCALE_TIER_CAPS,headingFamily:null,headingWeight:null,fontSources:NO_FONT_SOURCES}}var NO_SLOTS={},EASING_CURVES=/* @__PURE__ */Object.freeze({standard:/* @__PURE__ */Object.freeze([.2,0,0,1]),emphasized:/* @__PURE__ */Object.freeze([.2,.8,.2,1]),exit:/* @__PURE__ */Object.freeze([.4,0,1,1])});function cssCubicBezier(curve2){return`cubic-bezier(${curve2.join(", ")})`}var MOTION={duration:{instant:80,fast:140,normal:220,slow:320},spring:{gentle:{damping:18,stiffness:200}},easing:{standard:cssCubicBezier(EASING_CURVES.standard),emphasized:cssCubicBezier(EASING_CURVES.emphasized),exit:cssCubicBezier(EASING_CURVES.exit)},reducedMotion:false},LIGHT_COLOR={brand:"#10462E",brandSoft:"rgba(16,70,46,0.10)",brandSofter:"rgba(16,70,46,0.15)",brandBorder:"rgba(16,70,46,0.18)",borderHairlineGreen:"rgba(16,70,46,0.25)",brandBorderStrong:"rgba(16,70,46,0.55)",brandInk:"#10462E",linkInk:"#10462E",surface:"#FFFFFF",surfaceCream:"#FFFFFF",surfaceSubtle:"#F1F5F2",background:"#FFFFFF",borderRingCream:"#E4E4E4",chatGround:"#FFFFFF",composerFill:"#FFFFFF",composerBorder:"rgba(16,70,46,0.75)",shadow:"#0B3421",text:{primary:"#000000",secondary:"#0E462E",muted:"#6B6B6B",placeholder:"rgba(61,61,61,0.75)",onBrand:"#FFFFFF",metaCool:"#3D3D3D",timestamp:"rgba(61,61,61,0.75)"},primary:"#10462E",onPrimary:"#FFFFFF",accent:"#10462E",onAccent:"#FFFFFF",accentEdge:"#07C168",success:"#07C168",danger:"#C03410",onDanger:"#FFFFFF",errorRed:"#C03410",warningStrong:"#A45610",cautionAccent:"#D9821D",riskConcern:"#EFA700",sentiment:{up:"#07C168",neutral:"#FBC558",down:"#FF1B00"},badgeBgPositive:"rgba(7,193,104,0.12)",badgeBgCaution:"rgba(217,130,29,0.14)",badgeBgCritical:"rgba(192,52,16,0.06)",badgeBgNeutral:"rgba(107,107,107,0.12)",bubbleUser:"#10462E",bubbleAssistant:"#FFFFFF",bubbleVet:"#FFC3BC",onBubbleVet:"#000000",skeleton:"#E9F1E9",scanButtonPink:"#FFC3BC",highlight:"#FFC3BC",onHighlight:"#000000",mark:"#07C168",controlEdge:"rgba(16,70,46,0.18)",structureEdge:"rgba(16,70,46,0.25)",primaryEdge:"#10462E",checkupCardLowRiskBg:"rgba(7,193,104,0.10)",checkupCardConcernBg:"rgba(239,167,0,0.10)",info:"#10462E",badgeBgInfo:"rgba(16,70,46,0.10)",infoEdge:"rgba(16,70,46,0.25)"},EVERFUR_LIGHT=deepFreeze({brightness:"light",highContrast:false,meta:{displayName:"Everfur",logoUrl:null,placeholder:null,hidePoweredBy:false,assistantAvatarUrl:null},color:LIGHT_COLOR,space:SPACE,radius:RADIUS,type:baseType(),motion:MOTION,slots:NO_SLOTS}),DARK_COLOR={brand:"#6BD39A",brandSoft:"rgba(107,211,154,0.12)",brandSofter:"rgba(107,211,154,0.18)",brandBorder:"rgba(107,211,154,0.22)",borderHairlineGreen:"rgba(107,211,154,0.28)",brandBorderStrong:"rgba(107,211,154,0.55)",brandInk:"#6BD39A",linkInk:"#6BD39A",surface:"#1C1F23",surfaceCream:"#23272C",surfaceSubtle:"#23272C",background:"#15171A",borderRingCream:"#3A3F45",chatGround:"#1C1F23",composerFill:"#23272C",composerBorder:"rgba(107,211,154,0.75)",shadow:"#000000",text:{primary:"#F5F3F0",secondary:"#A9E4C4",muted:"#9A9A9A",placeholder:"rgba(255,255,255,0.55)",onBrand:"#0E1F17",metaCool:"#C9C9C9",timestamp:"rgba(245,243,240,0.7)"},primary:"#6BD39A",onPrimary:"#0E1F17",accent:"#6BD39A",onAccent:"#0E1F17",accentEdge:"#34D888",success:"#07C168",danger:"#F87171",onDanger:"#0E1F17",errorRed:"#FF6B5B",warningStrong:"#F0A35E",cautionAccent:"#D9821D",riskConcern:"#EFA700",sentiment:{up:"#07C168",neutral:"#FBC558",down:"#FF1B00"},badgeBgPositive:"rgba(7,193,104,0.18)",badgeBgCaution:"rgba(217,130,29,0.20)",badgeBgCritical:"rgba(185,28,28,0.22)",badgeBgNeutral:"rgba(255,255,255,0.10)",bubbleUser:"#6BD39A",bubbleAssistant:"#1C1F23",bubbleVet:"#FFC3BC",onBubbleVet:"#000000",skeleton:"#23272C",scanButtonPink:"#FFC3BC",highlight:"#605051",onHighlight:"#F5F3F0",mark:"#07C168",controlEdge:"rgba(107,211,154,0.22)",structureEdge:"rgba(107,211,154,0.28)",primaryEdge:"#6BD39A",checkupCardLowRiskBg:"rgba(7,193,104,0.16)",checkupCardConcernBg:"rgba(239,167,0,0.16)",info:"#6BD39A",badgeBgInfo:"rgba(107,211,154,0.12)",infoEdge:"rgba(107,211,154,0.28)"};deepFreeze({brightness:"dark",highContrast:false,meta:{displayName:"Everfur",logoUrl:null,placeholder:null,hidePoweredBy:false,assistantAvatarUrl:null},color:DARK_COLOR,space:SPACE,radius:RADIUS,type:baseType(),motion:MOTION,slots:NO_SLOTS});var EVERFUR_THEME_CONTEXT_SYMBOL=/* @__PURE__ */Symbol.for("@everfur/sdk#EverfurThemeContext@v1"),globalThemeHost=globalThis,EverfurThemeContext=globalThemeHost[EVERFUR_THEME_CONTEXT_SYMBOL]??(globalThemeHost[EVERFUR_THEME_CONTEXT_SYMBOL]=createContext(EVERFUR_LIGHT));EverfurThemeContext.displayName??="EverfurThemeContext";function useEverfurTheme(){return useContext(EverfurThemeContext)}function tierMultiplier(type,tier){let cap2=type.scaleCaps[tier];return cap2>0?cap2:void 0}function Text({tier:tier="content",...props}){let{type:type}=useEverfurTheme(),cap2=tierMultiplier(type,tier);return createElement(Text$1,cap2===void 0?props:{maxFontSizeMultiplier:cap2,...props})}forwardRef(function(props,ref){return createElement(TextInput,{...props,...ref===null?{}:{ref:ref}})});var REQUIRES=/* @__PURE__ */Object.freeze({chat:/* @__PURE__ */Object.freeze(["chat.message.create"]),records:/* @__PURE__ */Object.freeze(["records.upload.create","records.record.read"]),recordsClinic:/* @__PURE__ */Object.freeze(["records.clinic.create"]),video:/* @__PURE__ */Object.freeze(["video.gait.execute"]),photo:/* @__PURE__ */Object.freeze(["photo.checkup.execute"]),animations:/* @__PURE__ */Object.freeze(["animations.state.read"]),televet:/* @__PURE__ */Object.freeze(["televet.visit.create"]),texting:/* @__PURE__ */Object.freeze(["sms.identity.read","sms.identity.update"]),healthPlan:/* @__PURE__ */Object.freeze(["shop.plan.read","shop.plan.update"])});function requires(name){return REQUIRES[name]}function decideCapability(name,decisions,opts){let keys=requires(name),byResource=/* @__PURE__ */new Map;for(let decision of decisions)byResource.set(decision.resource,decision);if(opts?.isPending===true&&keys.some(key=>!byResource.has(key)))return freezeDecision({name:name,enabled:false,isPending:true,limits:{}});let limits=mergeLimits(keys,byResource);return keys.filter(key=>byResource.get(key)?.granted!==true).length===0?freezeDecision({name:name,enabled:true,isPending:false,limits:limits}):freezeDecision({name:name,enabled:false,isPending:false,limits:limits,disabled:disabledFor(keys,byResource)})}function mergeLimits(keys,byResource){let out={};for(let key of keys){let decisionLimits=byResource.get(key)?.limits;if(decisionLimits)for(let[limitKey,limitValue]of Object.entries(decisionLimits)){let existing=out[limitKey];out[limitKey]=existing===void 0?limitValue:Math.min(existing,limitValue)}}return out}function disabledFor(keys,byResource){for(let key of keys){let explicit=byResource.get(key)?.disabled;if(explicit)/* @__PURE__ */
|
|
118
118
|
return Object.freeze({reason:explicit.reason,level:explicit.level,recoverable:explicit.recoverable})}/* @__PURE__ */
|
|
119
|
-
return Object.freeze({reason:userFacingError("accessDenied"),level:"user_entitlement",recoverable:false})}function freezeDecision(d){let base3={name:d.name,enabled:d.enabled,isPending:d.isPending,limits:/* @__PURE__ */Object.freeze({...d.limits})};return d.disabled!==void 0&&(base3.disabled=d.disabled),/* @__PURE__ */Object.freeze(base3)}function useCapability(name){let{runtime:runtime}=useEverfurContext(),store=runtime.entitlements,snapshot=useSyncExternalStore(store.subscribe,store.getSnapshot,store.getSnapshot);return useMemo(()=>decideCapability(name,snapshot.decisions,{isPending:snapshot.isPending}),[name,snapshot])}var MIN_OFFSTATE_HEIGHT=48;function selectView(decision){return decision.isPending?"pending":decision.enabled?"enabled":"disabled"}function CapabilityGate(props){let{capability:capability,children:children,renderDisabled:renderDisabled,renderPending:renderPending,style:style}=props,decision=useCapability(capability),view=useMemo(()=>selectView(decision),[decision]);switch(view){case"enabled":return children;case"pending":return renderPending?/* @__PURE__ */jsx(HostRender,{render:renderPending,fallback:/* @__PURE__ */jsx(PendingSkeleton,{capability:capability,style:style})}):/* @__PURE__ */jsx(PendingSkeleton,{capability:capability,style:style});case"disabled":return renderDisabled?/* @__PURE__ */jsx(HostRender,{render:()=>renderDisabled(decision),fallback:/* @__PURE__ */jsx(OffState,{decision:decision,style:style}),resetKey:decision}):/* @__PURE__ */jsx(OffState,{decision:decision,style:style});default:return assertNever(view)}}function PendingSkeleton({capability:capability,style:style}){let theme=useEverfurTheme(),
|
|
120
|
-
return jsx(View,{style:[
|
|
121
|
-
return jsx(View,{style:[
|
|
122
|
-
return jsxs(View,{style:[
|
|
123
|
-
/* @__PURE__ */jsxs(View,{style:
|
|
124
|
-
/* @__PURE__ */jsxs(View,{style:
|
|
125
|
-
/* @__PURE__ */jsx(Text,{style:styles.label,children:HEALTH_PLAN_TEMPLATES.cartLabel(theme.meta.displayName)}),cart.count>0?/* @__PURE__ */jsx(View,{style:styles.count,accessibilityElementsHidden:true,importantForAccessibility:"no",children:/* @__PURE__ */jsx(Text,{tier:"badge",style:styles.countLabel,children:String(cart.count)})}):null]}),cart.count===0?/* @__PURE__ */jsx(Text,{style:styles.line,children:HEALTH_PLAN_COPY.cartEmpty}):subtotal===null?null:/* @__PURE__ */jsxs(Text,{style:styles.line,children:[HEALTH_PLAN_COPY.subtotal," ",subtotal]})]}),onCheckout===void 0?null:/* @__PURE__ */jsx(Pressable,{onPress:()=>{trackCheckoutStarted(telemetry,petRef,cart),onCheckout(cart.items)},disabled:disabled,accessibilityRole:"button",accessibilityLabel:HEALTH_PLAN_COPY.checkout,accessibilityState:{disabled:disabled,busy:busy},style:[styles.checkout,disabled?styles.dimmed:null],testID:"health-plan-checkout",children:/* @__PURE__ */jsx(Text,{tier:"control",style:styles.checkoutLabel,children:HEALTH_PLAN_COPY.checkout})})]})}function makeStyles2(theme){let{color:color,radius:radius,space:space,type:type,slots:slots}=theme,ink=slots.cartBar?.textColor??color.text.onBrand,fill=slots.cartBar?.backgroundColor??color.brandInk,text2=(size,tint,weight)=>({...face(theme,weight),fontSize:size,lineHeight:Math.round(size*type.lineHeight.snug),color:tint});return StyleSheet.create({bar:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",gap:space.md,paddingHorizontal:space.lg,paddingVertical:space.md,borderRadius:radius.lg,backgroundColor:color.brand,...slotBox(slots.cartBar)},copy:{flex:1,gap:2},labelRow:{flexDirection:"row",alignItems:"center",gap:space.sm},label:text2(type.size.body,ink,"bold"),count:{minWidth:22,height:22,paddingHorizontal:space.xs,borderRadius:radius.pill,alignItems:"center",justifyContent:"center",backgroundColor:ink},countLabel:text2(type.size.caption,fill,"bold"),line:text2(type.size.caption,ink,"regular"),checkout:{minHeight:44,paddingHorizontal:space.lg,borderRadius:radius.pill,alignItems:"center",justifyContent:"center",backgroundColor:ink},checkoutLabel:text2(type.size.body,fill,"bold"),dimmed:{opacity:.5}})}var SIGNALS_SYMBOL=/* @__PURE__ */Symbol.for("@everfur/sdk#HealthPlanSignals@v1"),signalHost=globalThis;function isSignalState(value){if(typeof value!="object"||value===null)return false;let v=value;return v.landed instanceof Set&&v.noVet instanceof Set&&v.noVetByPet instanceof Map}var stored=signalHost[SIGNALS_SYMBOL],fresh=()=>({landed:/* @__PURE__ */new Set,noVet:/* @__PURE__ */new Set,noVetByPet:/* @__PURE__ */new Map}),state=isSignalState(stored)?stored:signalHost[SIGNALS_SYMBOL]=fresh(),landedListeners=state.landed,noVetListeners=state.noVet,noVetByPet=state.noVetByPet;function notifyHealthPlanRecordsLanded(petRef,source="host"){for(let listener of[...landedListeners])try{listener(petRef,source)}catch{}}function onHealthPlanRecordsLanded(listener){return landedListeners.add(listener),()=>{landedListeners.delete(listener)}}function setHealthPlanNoVet(petRef,noVet){if((noVetByPet.get(petRef)??false)!==noVet){noVet?noVetByPet.set(petRef,true):noVetByPet.delete(petRef);for(let listener of[...noVetListeners])try{listener(petRef,noVet)}catch{}}}function healthPlanNoVet(petRef){return noVetByPet.get(petRef)??false}function onHealthPlanNoVet(listener){return noVetListeners.add(listener),()=>{noVetListeners.delete(listener)}}function healthPlanPetWords(name,sex){let n=name?.trim()??"",named=n===""?"your pet":n,Named=n===""?"Your pet":n;return sex==="female"?{name:named,Name:Named,poss:"her",Poss:"Her",obj:"her"}:sex==="male"?{name:named,Name:Named,poss:"his",Poss:"His",obj:"him"}:{name:named,Name:Named,poss:`${named}'s`,Poss:`${Named}'s`,obj:named}}var cartRenewal=p=>p===null?"":`${p.productName} renews every ${p.intervalDays} days at ${p.box??""} until you cancel; skip or cancel anytime in the app.`,HEALTH_PLAN_NO_SHIP_DAY_COPY=/* @__PURE__ */Object.freeze({onceFine:"",cartFine:cartRenewal,startedWhat:()=>""});function healthPlanFocusCopyFor(pet){let w=healthPlanPetWords(pet.name,pet.sex),nameOf=p=>p.petName?.trim()||w.name,NameOf=p=>p.petName?.trim()||w.Name,copy=/* @__PURE__ */Object.freeze({jumpKicker:(p,subscribed)=>subscribed?`In ${w.poss} plan, every ${p.intervalDays} days`:p.offer?`${p.discountPercent}% off ${w.poss} first box`:p.intervalDays>0?`Ships every ${p.intervalDays} days`:copy.onceLine(p),optionsLabel:"How to buy",subscribe:"Subscribe",bestValue:"Best value",subscribeLine:p=>p.offer?`First box, then ${p.box??""}`:`${p.box??""} every ${p.intervalDays} days`,priceLine:p=>p.offer?`${p.discountPercent}% off the first box. Ships every ${p.intervalDays} days.`:p.intervalDays>0?`Ships every ${p.intervalDays} days.`:copy.onceOffer(p),once:"One box",onceLine:p=>p.onceDiscountPercent>0?`${p.onceDiscountPercent}% off, ships once`:"Ships once",buyOnce:p=>`Buy one box, ${p.once??p.box??""}`,subscribed:"Subscribed",subscribedLine:(p,next)=>next===null?`Every ${p.intervalDays} days`:`Every ${p.intervalDays} days · next box ${next}`,manage:"Manage",checkoutKicker:"Checkout",checkoutTitle:p=>`Checkout: ${p.productName}`,checkoutOffer:p=>`${p.discountPercent}% off your first box.`,shipsEvery:"Ships every",days:n=>`${n} days`,buyOnceOption:"Buy once",checkoutGo:(_p,subscribe,today)=>`${subscribe?"Subscribe":"Buy now"} · ${today} today`,renews:p=>`Renews every ${p.intervalDays} days at ${p.box??""} until you cancel; skip or cancel anytime in the app.`,onceFine:"One box, ships tomorrow.",onceOffer:p=>p.onceDiscountPercent>0?`${p.onceDiscountPercent}% off, ships once.`:"Ships once.",checkoutNote:"",close:"Close",startedTitle:p=>`${NameOf(p)}'s plan has started.`,orderedTitle:()=>"Order placed.",startedWhat:p=>`${p.productName} ships tomorrow.`,startedNote:"",startedSteps:"What happens next",tomorrow:"Tomorrow",firstBoxShips:`${w.Poss} first box ships.`,trackingComesByText:"Tracking comes by text.",checkin:q=>q===null?"A 2-week check-in by text.":`A 2-week check-in by text: ${q}`,refill:`A text 3 days before ${w.poss} next box. Reply SKIP to skip it.`,nextBoxShips:p=>`${w.Poss} next box ships, ${p.box??""}.`,startedDone:`Back to ${w.poss} plan`,manageKicker:"Your subscription",manageTitle:p=>`Manage ${p.productName}`,skip:"Skip the next box",cancel:"Cancel subscription",skipped:(_p,next)=>next===null?"Skipped.":`Skipped. ${w.Poss} next box ships ${next}.`,cancelled:p=>`${p.productName} is cancelled. Restart it from ${w.poss} plan anytime.`,orders:"Orders",startedHeader:"Subscribed",placedHeader:"Order placed",cartCheckoutTitle:"Checkout",orderNote:"",cartLabel:n=>n>0?`Cart, ${n} item${n>1?"s":""}`:"Cart, empty",addToCart:price=>`Add to cart · ${price}`,viewCart:"View cart",addedToCart:(p,subscription)=>`${p.productName} is in your cart${subscription?", as a subscription":""}.`,removedFromCart:name=>`${name} is out of your cart.`,cartTitle:"Cart",cartEmptyTitle:"Your cart is empty",cartEmptyBody:p=>`${NameOf(p)}'s plan pick lands here when you add it.`,seeOrders:`See ${w.poss} orders`,quantityLabel:name=>`How many: ${name}`,fewer:"One fewer",more:"One more",remove:"Remove",cartSubLine:p=>p.offer?`First box ${p.discountPercent}% off, then ${p.box??""} every ${p.intervalDays} days`:`Every ${p.intervalDays} days`,cartOnceLine:(p,subscribed)=>subscribed?`An extra box. ${w.Poss} plan keeps shipping.`:p.onceDiscountPercent>0?`One box, ${p.onceDiscountPercent}% off`:"One box",cartModeLabel:name=>`How to buy ${name}`,cartModeSubscribe:p=>p.offer?`Subscribe, ${p.discountPercent}% off the first box`:"Subscribe",cartModeOnce:p=>p.onceDiscountPercent>0?`One box, ${p.onceDiscountPercent}% off`:"One box",subtotal:"Subtotal",shipping:"Shipping",shippingValue:"",shippingTag:"",total:"Total",dueToday:"Due today",thenRenews:p=>`Then ${p.productName}`,renewsEvery:p=>`${p.box??""} every ${p.intervalDays} days`,checkoutCart:total=>`Checkout · ${total}`,cartOneAtATime:"",cartSubscriptionApart:"",cartItemSubscription:p=>`Subscription, every ${p.intervalDays} days`,cartItemQuantity:n=>`Qty ${n}`,placeOrder:(total,subscribe)=>`${subscribe?"Place order and subscribe":"Place order"} · ${total}`,cartFine:p=>`${p===null?"":`${cartRenewal(p)} `}Ships tomorrow.`,placedSteps:"What's coming",placedShips:"It ships.",placedArrives:"It arrives at home.",viewOrder:"View order",herSubscription:`${w.Poss} subscription`,nextBox:day=>`Next box ${day}`,everyDays:n=>`Every ${n} days`,ordersHeading:afterSubscription=>afterSubscription?"Orders":`${w.Poss} orders`,ordersFine:"",ordersEmptyTitle:"No orders yet",ordersEmptyBody:p=>`The boxes from ${nameOf(p)}'s plan show up here.`,moreOrders:"",orderSteps:["Ordered","Shipped","Out for delivery","Delivered"],subscriptionBox:"Subscription box",orderTitle:n=>n===null?"Order":`Order ${n}`,arrivesBy:day=>`Arrives by ${day}`,deliveredOn:day=>`Delivered ${day}`,expected:day=>`Expected ${day}`,tracking:"Tracking",trackingByText:"The tracking number comes by text when it ships.",trackOn:carrier=>`Track on ${carrier}`,trackLink:"",inThisOrder:"In this order",orderItemLine:(n,box)=>`Qty ${n}${box?" · subscription box":""}`,paidWith:"Paid with",buyAgain:"Buy again",orderHelp:"Get help with this order",addWeightTitle:`Add ${w.poss} weight to size ${w.poss} dose`,addWeightBody:`From a home scale or ${w.poss} last vet visit.`,connectRecordsTitle:`Connect ${w.poss} vet records`,connectRecordsBody:`${w.Poss} weight, visits and labs make ${w.poss} plan sharper.`,weightKicker:`${w.Poss} weight`,weightTitle:p=>`Add ${nameOf(p)}'s weight`,weightBody:`From a home scale or ${w.poss} last vet visit. ${w.Poss} plan uses it to size ${w.poss} dose.`,weightField:`${w.Poss} weight`,weightUnit:"lb",weightUnitKg:"kg",weightErrorKg:"Enter your pet’s weight",weightError:`Enter ${w.poss} weight in pounds, like 14.1.`,weightSave:`Save ${w.poss} weight`,weightSaved:lb=>`Saved: ${lb} lb. ${w.Poss} dose is sized for ${w.obj}.`,weightSavedKg:kg=>`Saved: ${kg} kg. ${w.Poss} dose is sized for ${w.obj}.`,checkoutFailed:"That didn't go through. Please try again.",builtWith:vet=>`Built with ${vet}`,fromVet:shortName=>`From ${shortName}`,waitVetTips:vet=>`Free tips from ${vet}, built around that risk`,signalsFit:count=>`${count} of ${count} signals fit ${w.Name}`,signalsValue:count=>`${count}/${count}`,noPick:`No supplement for this one. ${w.Poss} vet comes first.`,callYourVet:"Call your vet today",callAVet:"Call a vet today",saveForCheckup:`Save for ${w.poss} next checkup`,savedForCheckup:`Saved for ${w.poss} next checkup`,blanksLabel:`${w.Poss} three blanks`,blanksAsked:clinic=>`Asked ${clinic}`,blanksAskedNoClinic:"",blanksWaitPill:"2 to 5 days",blanksFilledKicker:`From ${w.poss} vet records`,blanksFilled:(filled,total)=>`${filled} of ${total} filled`,blanksWeight:`Keep ${w.obj} at `,blanksWeightSource:`From ${w.poss} vet visits`,blanksDose:(dose,product)=>`${dose} of ${product}`,blanksDoseSource:`Sized to ${w.poss} weight`,blanksShots:`${w.Poss} next shots are due `,blanksShotsSource:`From ${w.poss} clinic`,blankEmpty:"blank",recordsLanded:`${w.Poss} records are in. ${w.Poss} plan now uses ${w.poss} weight and ${w.poss} visits.`});return copy}var HEALTH_PLAN_FOCUS_COPY=healthPlanFocusCopyFor({sex:"female"});function formatHealthPlanDay(iso,locale){if(iso===null||!/^\d{4}-\d{2}-\d{2}$/.test(iso))return null;let d=/* @__PURE__ */new Date(`${iso}T00:00:00Z`);if(Number.isNaN(d.getTime()))return null;try{return new Intl.DateTimeFormat(locale??"en-US",{month:"short",day:"numeric",timeZone:"UTC"}).format(d)}catch{return iso}}function useHealthPlanSubscriptionRepository(){let{runtime:runtime}=useEverfurContext();return useMemo(()=>createHealthPlanSubscriptionRepository(runtime),[runtime])}function useHealthPlanSubscription(options){let{userRef:userRef}=useEverfurContext(),own=useHealthPlanSubscriptionRepository(),repository=options.repository??own,enabled=options.enabled!==false&&userRef!==null&&options.petRef!==null&&options.productId!==null,{petRef:petRef,productId:productId}=options,[phase,setPhase]=useState("idle"),[quote,setQuote]=useState(null),[subscription,setSubscription]=useState(null),[busy,setBusy]=useState(false),[error,setError]=useState(null),[readyAt,setReadyAt]=useState(null),epoch=useRef(0),writes=useRef(0),quiet=useRef(0),busyRef=useRef(false),refreshAfterWrite=useRef(false),revalidateRef=useRef(()=>Promise.resolve()),load=useCallback(async()=>{let mine=++epoch.current;if(refreshAfterWrite.current=false,setReadyAt(null),!enabled||petRef===null||productId===null){setPhase("idle"),setQuote(null),setSubscription(null);return}setPhase("loading");let res=await repository.quote(petRef,productId);if(mine===epoch.current){if(!res.ok){setQuote(null),setSubscription(null),setError(res.error),setPhase(isHealthPlanSubscriptionUnavailable(res.error)?"unavailable":"failed");return}setError(null),setQuote(res.value),setSubscription(res.value.subscription),setPhase("ready"),setReadyAt(Date.now())}},[enabled,petRef,productId,repository]),ready=enabled&&phase==="ready",revalidate=useCallback(async()=>{if(!ready||busyRef.current||petRef===null||productId===null)return;let mine=epoch.current,wrote=writes.current,seq=++quiet.current,res=await repository.quote(petRef,productId);mine!==epoch.current||wrote!==writes.current||seq!==quiet.current||busyRef.current||!res.ok||(setQuote(res.value),setSubscription(res.value.subscription),setReadyAt(Date.now()))},[ready,petRef,productId,repository]);revalidateRef.current=revalidate;let refreshOnKey=()=>{if(!ready){load();return}if(busyRef.current){refreshAfterWrite.current=true;return}revalidate()};useHealthPlanRevalidation({lifecycle:options.lifecycle,refreshKey:options.refreshKey,readyAt:ready?readyAt:null,revalidate:()=>{revalidate()},refresh:refreshOnKey});let settleWrite=useCallback(()=>{refreshAfterWrite.current&&(refreshAfterWrite.current=false,revalidateRef.current())},[]);useEffect(()=>(load(),()=>{epoch.current+=1}),[load]);let write=useCallback(async run2=>{let mine=epoch.current;writes.current+=1,busyRef.current=true,setBusy(true);let res=await run2();return busyRef.current=false,mine!==epoch.current?res:(setBusy(false),res.ok?(setError(null),setSubscription(res.value),settleWrite(),res):(setError(res.error),isHealthPlanSubscriptionUnavailable(res.error)?setPhase("unavailable"):settleWrite(),res))},[settleWrite]),buy=useCallback(async tapKey=>{let mine=epoch.current;writes.current+=1,busyRef.current=true,setBusy(true);let res=await repository.buyOneBox(petRef,productId,tapKey);return busyRef.current=false,mine!==epoch.current?res:(setBusy(false),res.ok?(setError(null),load(),res):(setError(res.error),isHealthPlanSubscriptionUnavailable(res.error)?setPhase("unavailable"):settleWrite(),res))},[repository,petRef,productId,load,settleWrite]);return useMemo(()=>{let p=petRef,sid=subscription?.subscriptionId??"",none=()=>Promise.resolve(err(makeEverfurError("validationFailed",{retryable:false,wireMessage:"the subscription quote is not ready"})));return{phase:phase,quote:quote,subscription:subscription,busy:busy,error:error,subscribe:n=>ready&&productId!==null?write(()=>repository.create(p,productId,n)):none(),changeInterval:n=>ready&&sid!==""?write(()=>repository.changeInterval(p,sid,n)):none(),skip:()=>ready&&sid!==""?write(()=>repository.skip(p,sid)):none(),cancel:()=>ready&&sid!==""?write(()=>repository.cancel(p,sid)):none(),restart:n=>ready&&sid!==""?write(()=>repository.restart(p,sid,n)):none(),buyOneBox:k=>ready&&productId!==null?buy(k):none(),refresh:load}},[phase,quote,subscription,busy,error,ready,petRef,productId,repository,write,buy,load])}var BLANKS_MEMO_KV_PREFIX="everfur.healthPlan.blanks",NONE=/* @__PURE__ */Object.freeze({waited:null,flashed:null}),memos=/* @__PURE__ */new Map,loads=/* @__PURE__ */new Map,keyOf2=petRef=>`${BLANKS_MEMO_KV_PREFIX}:${petRef}`;function parse(raw){if(raw===null)return NONE;try{let o=JSON.parse(raw);if(o===null||typeof o!="object")return NONE;let r=o;return{waited:typeof r.waited=="string"?r.waited:null,flashed:typeof r.flashed=="string"?r.flashed:null}}catch{return NONE}}function loadBlanksMemo(kv,petRef){let own=memos.get(petRef);if(own!==void 0)return Promise.resolve(own);let load=loads.get(petRef);return load===void 0&&(load=(async()=>{let read=NONE;try{read=kv?parse(await kv.getItem(keyOf2(petRef))):NONE}catch{}let memo=memos.get(petRef)??read;return memos.set(petRef,memo),memo})(),loads.set(petRef,load)),load}function blanksMemo(petRef){return memos.get(petRef)??NONE}function setBlanksMemo(kv,petRef,memo){if(memos.set(petRef,memo),!!kv)try{kv.setItem(keyOf2(petRef),JSON.stringify(memo)).catch(()=>{})}catch{}}var RAPH_RN_PLAN=/* @__PURE__ */Object.freeze({root:{backgroundColor:"$paper",color:"$ink",fontFamily:"sans",fontSize:17,lineHeight:25.5,paddingBottom:28,paddingLeft:16,paddingRight:16,paddingTop:16},pageFine:{color:"$ink3",fontFamily:"sans",fontSize:12.5,lineHeight:18.13,marginBottom:0,marginLeft:0,marginRight:0,marginTop:16,textAlign:"center"},tools:{alignItems:"center",color:"$ink",flexDirection:"row",fontFamily:"sans",fontSize:17,gap:8,justifyContent:"space-between",lineHeight:25.5,marginBottom:2,marginLeft:2,marginRight:-6,marginTop:-8},toolsEyebrow:{color:"$ink3",fontFamily:"mono",fontSize:11,letterSpacing:.77,lineHeight:16.5,marginBottom:0,marginLeft:0,marginRight:0,marginTop:0,textTransform:"uppercase"},toolsEnd:{alignItems:"center",color:"$ink",flexDirection:"row",fontFamily:"sans",fontSize:17,gap:2,lineHeight:25.5},orders:{alignItems:"center",alignSelf:"flex-start",backgroundColor:"transparent",borderRadius:999,color:"$ink",flexDirection:"row",fontFamily:"sans",fontSize:15,fontWeight:"700",gap:6,lineHeight:22.5,minHeight:44,paddingBottom:0,paddingLeft:8,paddingRight:8,paddingTop:0},ordersIcon:{height:21,width:21},cart:{alignItems:"center",backgroundColor:"transparent",borderRadius:22,color:"$ink",fontFamily:"sans",fontSize:17,height:44,justifyContent:"center",lineHeight:25.5,paddingBottom:0,paddingLeft:0,paddingRight:0,paddingTop:0,position:"relative",width:44},cartIcon:{height:26,width:26},cartCount:{backgroundColor:"$riskDot",borderRadius:999,color:"$card",fontFamily:"sans",fontSize:12,fontVariant:["tabular-nums"],fontWeight:"800",height:20,lineHeight:20,minWidth:20,paddingBottom:0,paddingLeft:5,paddingRight:5,paddingTop:0,position:"absolute",right:1,ring:[{width:2,color:"$paper"}],textAlign:"center",top:3},head:{alignItems:"center",color:"$ink",flexDirection:"row",fontFamily:"sans",fontSize:17,gap:12,grid:["fr",56],lineHeight:25.5,paddingBottom:0,paddingLeft:2,paddingRight:2,paddingTop:2},eyebrow:{color:"$ink3",fontFamily:"mono",fontSize:11,letterSpacing:.77,lineHeight:16.5,marginBottom:6,marginLeft:0,marginRight:0,marginTop:0,textTransform:"uppercase"},title:{color:"$ink",fontFamily:"serif",fontSize:29,fontWeight:"800",letterSpacing:-.29,lineHeight:30.74,marginBottom:0,marginLeft:0,marginRight:0,marginTop:0},subtitle:{color:"$ink2",fontFamily:"sans",fontSize:15,lineHeight:22.5,marginBottom:0,marginLeft:0,marginRight:0,marginTop:6},headImage:{backgroundColor:"$tile",borderRadius:28,height:56,ring:[{width:3,color:"$paper"},{width:5.5,color:"$accent"}],width:56},by:{alignItems:"center",backgroundColor:"$card",borderRadius:16,color:"$ink",flexDirection:"row",fontFamily:"sans",fontSize:17,gap:10,grid:[40,"fr",22],lineHeight:25.5,marginBottom:0,marginLeft:0,marginRight:0,marginTop:14,paddingBottom:10,paddingLeft:12,paddingRight:12,paddingTop:10,shadow:{x:0,y:1,blur:3,color:"#262523",opacity:.06}},byImage:{backgroundColor:"$tile",borderRadius:20,height:40,width:40},byName:{color:"$ink",fontFamily:"sans",fontSize:15,fontWeight:"800",lineHeight:18.75},byRole:{color:"$ink3",fontFamily:"mono",fontSize:10.5,letterSpacing:.53,lineHeight:15.75,marginTop:2,textTransform:"uppercase"},byOk:{color:"$link",height:22,width:22},need:{backgroundColor:"$card",borderRadius:22,color:"$ink",fontFamily:"sans",fontSize:17,lineHeight:25.5,marginTop:14,paddingBottom:16,paddingLeft:16,paddingRight:16,paddingTop:16,shadow:{x:0,y:1,blur:3,color:"#262523",opacity:.06}},needKicker:{alignItems:"center",color:"$ink",flexDirection:"row",fontFamily:"sans",fontSize:15,fontWeight:"800",gap:8,lineHeight:22.5,marginBottom:0,marginLeft:0,marginRight:0,marginTop:0},sources:{color:"$ink",flexDirection:"row",fontFamily:"sans",fontSize:15,fontWeight:"800",gap:4,lineHeight:22.5,marginLeft:"auto"},source:{alignItems:"center",alignSelf:"flex-start",backgroundColor:"$tile",borderRadius:999,color:"$ink2",flexDirection:"row",fontFamily:"sans",fontSize:12,fontWeight:"700",height:24,lineHeight:18,paddingBottom:0,paddingLeft:9,paddingRight:9,paddingTop:0},sourceDna:{backgroundColor:"$linkWash",color:"$link"},needTitle:{color:"$ink",fontFamily:"sans",fontSize:19,fontWeight:"800",lineHeight:23.18,marginBottom:0,marginLeft:0,marginRight:0,marginTop:12},needRisk:{alignItems:"baseline",color:"$ink2",flexDirection:"row",fontFamily:"sans",fontSize:15,gap:9,grid:[9,"fr"],lineHeight:21.75,marginBottom:0,marginLeft:0,marginRight:0,marginTop:6},needRiskLead:{color:"$ink",fontFamily:"sans",fontSize:15,fontWeight:"800",lineHeight:21.75},dot:{alignSelf:"flex-start",borderRadius:4.5,flexGrow:0,flexShrink:0,height:9,width:9},dotRisk:{backgroundColor:"$riskDot"},odds:{alignItems:"center",backgroundColor:"$accent4",borderRadius:14,color:"$ink",flexDirection:"row",fontFamily:"sans",fontSize:17,gap:12,justifyContent:"space-between",lineHeight:25.5,marginTop:12,paddingBottom:10,paddingLeft:14,paddingRight:14,paddingTop:10},oddsKicker:{color:"$ink2",fontFamily:"sans",fontSize:13.5,fontWeight:"600",lineHeight:18.23,marginBottom:0,marginLeft:0,marginRight:0,marginTop:0,maxWidth:135},oddsTag:{alignSelf:"flex-start",backgroundColor:"$card",borderRadius:5,color:"$ink",fontFamily:"mono",fontSize:10,fontWeight:"600",letterSpacing:.6,lineHeight:13.5,marginTop:3,paddingBottom:2,paddingLeft:6,paddingRight:6,paddingTop:2,textTransform:"uppercase"},oddsNumbers:{alignItems:"center",color:"$ink",columnGap:6,flexDirection:"row",fontFamily:"sans",fontSize:17,grid:["auto","auto","auto"],justifyItems:"flex-end",lineHeight:25.5,marginBottom:0,marginLeft:0,marginRight:0,marginTop:0,rowGap:0},oddsFrom:{color:"$ink3",fontFamily:"sans",fontSize:17,fontWeight:"700",lineHeight:25.5,textDecorationLine:"line-through"},oddsIcon:{color:"$ink3",height:16,width:16},oddsTo:{color:"$ink",fontFamily:"serif",fontSize:28,fontWeight:"800",lineHeight:28},oddsLabel:{color:"$link",fontFamily:"sans",fontSize:12.5,fontWeight:"700",lineHeight:18.75,marginTop:3},says:{alignItems:"flex-start",backgroundColor:"$paper",borderRadius:14,color:"$ink",flexDirection:"row",fontFamily:"sans",fontSize:17,gap:10,grid:[32,"fr"],lineHeight:25.5,marginBottom:0,marginLeft:0,marginRight:0,marginTop:12,paddingBottom:10,paddingLeft:12,paddingRight:12,paddingTop:10},saysImage:{borderRadius:16,height:32,width:32},saysText:{color:"$ink2",fontFamily:"sans",fontSize:14.5,lineHeight:20.3,marginBottom:0,marginLeft:0,marginRight:0,marginTop:0},saysBy:{color:"$ink",fontFamily:"sans",fontSize:14.5,fontWeight:"800",lineHeight:20.3,marginRight:2},saysSerif:{color:"$ink",fontFamily:"serif",fontSize:17,fontWeight:"800",letterSpacing:-.17,lineHeight:25.5,marginBottom:0,marginLeft:0,marginRight:0,marginTop:0},tag:{backgroundColor:"$card",borderRadius:5,color:"$ink",fontFamily:"mono",fontSize:10,letterSpacing:.6,lineHeight:14,paddingBottom:2,paddingLeft:6,paddingRight:6,paddingTop:2,textTransform:"uppercase"},jump:{alignItems:"center",backgroundColor:"$primary",borderRadius:14,color:"$onPrimary",flexDirection:"row",fontFamily:"sans",fontSize:17,gap:12,grid:[44,"fr","auto"],lineHeight:25.5,marginTop:12,paddingBottom:8,paddingLeft:8,paddingRight:14,paddingTop:8,textAlign:"left",width:"100%"},jumpNoImage:{grid:["fr","auto"]},jumpImage:{backgroundColor:"$card",borderRadius:10,height:44,width:44},jumpSmall:{color:"$accent",fontFamily:"sans",fontSize:13,fontWeight:"800",lineHeight:19.5,textAlign:"left"},jumpStrong:{color:"$onPrimary",fontFamily:"sans",fontSize:15,fontWeight:"800",lineHeight:18.75,textAlign:"left"},jumpGo:{color:"$onPrimary",fontFamily:"sans",fontSize:14,fontWeight:"800",lineHeight:21,textAlign:"left"},steps:{backgroundColor:"$card",borderRadius:22,color:"$ink",fontFamily:"sans",fontSize:17,lineHeight:25.5,marginTop:14,paddingBottom:12,paddingLeft:12,paddingRight:12,paddingTop:16,shadow:{x:0,y:1,blur:3,color:"#262523",opacity:.06}},stepsHead:{alignItems:"baseline",color:"$ink",flexDirection:"row",fontFamily:"sans",fontSize:17,gap:12,justifyContent:"space-between",lineHeight:25.5,paddingBottom:0,paddingLeft:4,paddingRight:4,paddingTop:0},stepsTitle:{alignItems:"center",color:"$ink",flexDirection:"row",fontFamily:"sans",fontSize:19,fontWeight:"800",gap:10,lineHeight:22.8,marginBottom:0,marginLeft:0,marginRight:0,marginTop:0},stepsLabel:{color:"$ink3",fontFamily:"mono",fontSize:11,letterSpacing:.55,lineHeight:16.5,marginBottom:0,marginLeft:0,marginRight:0,marginTop:0,textTransform:"uppercase"},n:{alignItems:"center",backgroundColor:"$primary",borderRadius:12,color:"$onPrimary",flexGrow:0,flexShrink:0,fontFamily:"sans",fontSize:12.5,fontWeight:"800",height:24,justifyContent:"center",lineHeight:15,width:24},tips:{color:"$ink",flexDirection:"row",fontFamily:"sans",fontSize:17,gap:10,lineHeight:25.5,marginBottom:0,marginLeft:-12,marginRight:-12,marginTop:10,paddingBottom:2,paddingLeft:12,paddingRight:12,paddingTop:0},tip:{borderRadius:18,color:"$ink",flexBasis:"78%",flexDirection:"column",flexGrow:0,flexShrink:0,fontFamily:"sans",fontSize:17,lineHeight:25.5,maxWidth:280,paddingBottom:12,paddingLeft:14,paddingRight:14,paddingTop:14},tipY:{backgroundColor:"$accentChip"},tipC:{backgroundColor:"$linkChip"},tipG:{backgroundColor:"$clearChip"},tipR:{backgroundColor:"$riskChip"},tipTop:{alignItems:"center",color:"$ink",flexDirection:"row",fontFamily:"sans",fontSize:17,justifyContent:"space-between",lineHeight:25.5},tipIcon:{color:"$ink",height:26,width:26},tipN:{color:"$ink",fontFamily:"serif",fontSize:30,fontWeight:"900",lineHeight:30},tipStrong:{color:"$ink",fontFamily:"sans",fontSize:17,fontWeight:"800",lineHeight:21.25,marginTop:14},tipSmall:{color:"$ink2",fontFamily:"sans",fontSize:14.5,lineHeight:20.3,marginTop:4},tipEm:{color:"$link",fontFamily:"mono",fontSize:10.5,fontStyle:"normal",letterSpacing:.42,lineHeight:15.75,marginTop:"auto",paddingTop:10,textTransform:"uppercase"},sec:{backgroundColor:"$card",borderRadius:22,color:"$ink",fontFamily:"sans",fontSize:17,lineHeight:25.5,marginTop:14,paddingBottom:16,paddingLeft:16,paddingRight:16,paddingTop:16,shadow:{x:0,y:1,blur:3,color:"#262523",opacity:.06}},secTitle:{alignItems:"center",color:"$ink",flexDirection:"row",fontFamily:"sans",fontSize:19,fontWeight:"800",gap:10,lineHeight:22.8,marginBottom:0,marginLeft:0,marginRight:0,marginTop:0},secN:{alignItems:"center",backgroundColor:"$primary",borderRadius:12,color:"$onPrimary",flexGrow:0,flexShrink:0,fontFamily:"sans",fontSize:12.5,fontWeight:"800",height:24,justifyContent:"center",lineHeight:15,width:24},pick:{backgroundColor:"transparent",borderRadius:16,color:"$ink",fontFamily:"sans",fontSize:17,lineHeight:25.5,marginTop:14,paddingBottom:0,paddingLeft:0,paddingRight:0,paddingTop:0},pickTop:{alignItems:"center",color:"$ink",flexDirection:"row",fontFamily:"sans",fontSize:17,gap:12,grid:[76,"fr"],lineHeight:25.5},pickImage:{backgroundColor:"$paper",borderRadius:14,height:76,overflow:"hidden",width:76},pickTitle:{color:"$ink",fontFamily:"sans",fontSize:17,fontWeight:"800",lineHeight:20.4,marginBottom:0,marginLeft:0,marginRight:0,marginTop:0},stars:{alignItems:"center",color:"$ink",flexDirection:"row",fontFamily:"sans",fontSize:13.5,fontWeight:"800",gap:4,lineHeight:20.25,marginBottom:0,marginLeft:0,marginRight:0,marginTop:2},starsIcon:{color:"$watchDot",height:14,width:14},starsLabel:{color:"$ink3",fontFamily:"sans",fontSize:13.5,fontWeight:"500",lineHeight:20.25},pickLine:{color:"$ink2",fontFamily:"sans",fontSize:14,lineHeight:19.6,marginBottom:0,marginLeft:0,marginRight:0,marginTop:3},reviews:{color:"$ink",flexDirection:"row",fontFamily:"sans",fontSize:17,gap:10,lineHeight:25.5,marginBottom:0,marginLeft:-16,marginRight:-16,marginTop:12,paddingBottom:0,paddingLeft:16,paddingRight:16,paddingTop:0},review:{backgroundColor:"$paper",borderRadius:14,color:"$ink",flexBasis:"78%",flexGrow:0,flexShrink:0,fontFamily:"sans",fontSize:17,lineHeight:25.5,marginBottom:0,marginLeft:0,marginRight:0,marginTop:0,maxWidth:280,paddingBottom:12,paddingLeft:14,paddingRight:14,paddingTop:12},reviewStars:{color:"$watchDot",flexDirection:"row",fontFamily:"sans",fontSize:17,gap:1,lineHeight:25.5,marginBottom:0,marginLeft:0,marginRight:0,marginTop:0},reviewStar:{height:13,width:13},reviewText:{color:"$ink",fontFamily:"sans",fontSize:15,lineHeight:21,marginBottom:0,marginLeft:0,marginRight:0,marginTop:5},reviewBy:{color:"$ink3",fontFamily:"sans",fontSize:13,lineHeight:19.5,marginTop:4},why:{borderRadius:16,color:"$ink",fontFamily:"sans",fontSize:17,inner:{width:1.5,color:"$ink"},lineHeight:25.5,marginTop:14,paddingBottom:12,paddingLeft:14,paddingRight:14,paddingTop:12},whyMini:{color:"$ink3",fontFamily:"mono",fontSize:10.5,letterSpacing:.63,lineHeight:15.75,marginBottom:0,marginLeft:0,marginRight:0,marginTop:0,textTransform:"uppercase"},whyList:{color:"$ink",fontFamily:"sans",fontSize:17,lineHeight:25.5,marginBottom:0,marginLeft:0,marginRight:0,marginTop:0,paddingBottom:0,paddingLeft:0,paddingRight:0,paddingTop:0},whyRow:{alignItems:"flex-start",color:"$ink",flexDirection:"row",fontFamily:"sans",fontSize:17,gap:10,grid:[58,"fr"],lineHeight:25.5,marginTop:10},whyStrong:{color:"$ink",fontFamily:"sans",fontSize:15,fontWeight:"800",lineHeight:19.5},whySmall:{color:"$ink2",fontFamily:"sans",fontSize:14,lineHeight:19.6,marginTop:1},chip:{alignItems:"center",borderRadius:6,color:"$ink",fontFamily:"mono",fontSize:10.5,fontWeight:"700",height:22,justifyContent:"center",letterSpacing:.42,lineHeight:15.75,textTransform:"uppercase"},chipDna:{backgroundColor:"$linkWash",color:"$link"},chipAsk:{backgroundColor:"$accent4",color:"$ink"},chipRec:{backgroundColor:"$tile",color:"$ink2"},score:{alignItems:"center",backgroundColor:"$primary",borderRadius:12,color:"$onPrimary",flexDirection:"row",fontFamily:"sans",fontSize:14.5,fontWeight:"800",gap:8,justifyContent:"space-between",lineHeight:18.85,marginBottom:0,marginLeft:0,marginRight:0,marginTop:12,paddingBottom:11,paddingLeft:14,paddingRight:12,paddingTop:11},scoreValue:{color:"$accent",flexGrow:0,flexShrink:0,fontFamily:"mono",fontSize:16,fontWeight:"700",lineHeight:20.8},dose:{backgroundColor:"$linkWash",borderRadius:16,color:"$ink",fontFamily:"sans",fontSize:17,lineHeight:25.5,marginTop:10,paddingBottom:14,paddingLeft:14,paddingRight:14,paddingTop:12},doseMini:{color:"$link",fontFamily:"mono",fontSize:10.5,letterSpacing:.63,lineHeight:15.75,marginBottom:0,marginLeft:0,marginRight:0,marginTop:0,textTransform:"uppercase"},doseList:{color:"$ink",flexDirection:"row",fontFamily:"sans",fontSize:17,gap:8,grid:["fr","fr","fr"],lineHeight:25.5,marginBottom:0,marginLeft:0,marginRight:0,marginTop:10,paddingBottom:0,paddingLeft:0,paddingRight:0,paddingTop:0},doseItem:{alignItems:"center",backgroundColor:"$card",borderRadius:12,color:"$ink",fontFamily:"sans",fontSize:17,gap:2,lineHeight:25.5,paddingBottom:10,paddingLeft:4,paddingRight:4,paddingTop:10,textAlign:"center"},doseValue:{color:"$ink",fontFamily:"mono",fontSize:21,fontVariant:["tabular-nums"],fontWeight:"700",lineHeight:23.1,textAlign:"center"},doseLabel:{color:"$ink2",fontFamily:"sans",fontSize:12.5,lineHeight:16.25,textAlign:"center"},doseNote:{color:"$link",fontFamily:"sans",fontSize:14,lineHeight:20.3,marginBottom:0,marginLeft:0,marginRight:0,marginTop:10},ingredients:{color:"$ink",flexDirection:"row",flexWrap:"wrap",fontFamily:"sans",fontSize:17,gap:6,lineHeight:25.5,marginBottom:0,marginLeft:0,marginRight:0,marginTop:12},ingredient:{backgroundColor:"$tile",borderRadius:999,color:"$ink",fontFamily:"sans",fontSize:13.5,fontWeight:"600",lineHeight:20.25,paddingBottom:6,paddingLeft:10,paddingRight:10,paddingTop:6},opts:{color:"$ink",fontFamily:"sans",fontSize:17,gap:8,lineHeight:25.5,marginTop:14},opt:{alignItems:"center",backgroundColor:"$card",borderRadius:16,color:"$ink",flexDirection:"row",fontFamily:"sans",fontSize:17,gap:12,inner:{width:1.5,color:"$n_DEDCD7"},justifyContent:"space-between",lineHeight:25.5,paddingBottom:14,paddingLeft:14,paddingRight:14,paddingTop:14,textAlign:"left",width:"100%"},optOn:{inner:{width:2.5,color:"$ink"}},optOnce:{backgroundColor:"$paper",inner:null,paddingBottom:10,paddingLeft:14,paddingRight:14,paddingTop:10,shadow:null},optOnceOn:{backgroundColor:"$card",inner:{width:2,color:"$ink"}},optText:{alignItems:"flex-start",color:"$ink",fontFamily:"sans",fontSize:17,gap:2,lineHeight:25.5,textAlign:"left"},optStrong:{color:"$ink",fontFamily:"sans",fontSize:16,fontWeight:"800",lineHeight:24,textAlign:"left"},optOnceStrong:{fontSize:15,fontWeight:"700",lineHeight:22.5},optSmall:{color:"$ink2",fontFamily:"sans",fontSize:13.5,lineHeight:20.25,textAlign:"left"},optOnceSmall:{fontSize:13,lineHeight:19.5},optTag:{backgroundColor:"$riskInk",borderRadius:6,color:"$card",fontFamily:"sans",fontSize:12,fontWeight:"800",lineHeight:18,marginBottom:4,paddingBottom:2,paddingLeft:8,paddingRight:8,paddingTop:2,textAlign:"left"},price:{alignItems:"flex-end",color:"$ink",columnGap:8,flexDirection:"column",flexWrap:"nowrap",fontFamily:"sans",fontSize:17,lineHeight:25.5,minWidth:0,rowGap:0,textAlign:"left"},priceValue:{color:"$ink",fontFamily:"sans",fontSize:24,fontVariant:["tabular-nums"],fontWeight:"800",lineHeight:26.4,textAlign:"left"},priceWas:{color:"$riskInk",fontFamily:"sans",fontSize:15,fontWeight:"700",lineHeight:22.5,textAlign:"left",textDecorationLine:"line-through"},optPrice:{color:"$ink",fontFamily:"sans",fontSize:18,fontWeight:"800",lineHeight:27,textAlign:"left"},optOncePrice:{color:"$ink2",fontSize:15,fontWeight:"700",lineHeight:22.5},buy:{alignItems:"center",color:"$ink",fontFamily:"sans",fontSize:17,gap:12,justifyContent:"space-between",lineHeight:25.5,marginTop:12},button:{alignItems:"center",alignSelf:"flex-start",backgroundColor:"$primary",borderRadius:999,color:"$onPrimary",flexDirection:"row",flexGrow:0,flexShrink:0,fontFamily:"sans",fontSize:17,fontWeight:"700",gap:8,justifyContent:"center",lineHeight:25.5,minHeight:52,paddingBottom:0,paddingLeft:20,paddingRight:20,paddingTop:0,textDecorationLine:"none",width:"100%"},buttonDisabled:{opacity:.32},proof:{alignItems:"center",color:"$riskInk",flexDirection:"row",fontFamily:"sans",fontSize:14.5,fontWeight:"800",gap:6,justifyContent:"center",lineHeight:21.75,marginBottom:0,marginLeft:0,marginRight:0,marginTop:10},proofIcon:{flexGrow:0,flexShrink:0,height:21,marginTop:-2,width:21},trust:{color:"$ink",flexDirection:"row",fontFamily:"sans",fontSize:17,gap:6,grid:["fr","fr","fr"],lineHeight:25.5,marginBottom:0,marginLeft:0,marginRight:0,marginTop:12,paddingBottom:0,paddingLeft:0,paddingRight:0,paddingTop:0},trustItem:{alignItems:"center",color:"$ink2",fontFamily:"sans",fontSize:12.5,fontWeight:"600",gap:4,lineHeight:16.25,textAlign:"center"},trustIcon:{color:"$link",height:20,width:20},on:{alignItems:"center",backgroundColor:"$clearBg",borderRadius:14,color:"$ink",flexDirection:"row",fontFamily:"sans",fontSize:17,gap:10,grid:[34,"fr","auto"],lineHeight:25.5,marginTop:12,paddingBottom:10,paddingLeft:12,paddingRight:10,paddingTop:10},onIcon:{alignItems:"center",backgroundColor:"$clearDot",borderRadius:17,color:"$card",fontFamily:"sans",fontSize:17,height:34,justifyContent:"center",lineHeight:25.5,width:34},onIconSvg:{height:18,width:18},onStrong:{color:"$clearInk",fontFamily:"sans",fontSize:15,fontWeight:"700",lineHeight:18.75},onSmall:{color:"$ink2",fontFamily:"sans",fontSize:13,lineHeight:17.55,marginTop:1},onButton:{backgroundColor:"$card",borderRadius:999,color:"$ink",fontFamily:"sans",fontSize:14,fontWeight:"800",inner:{width:1.5,color:"$ink"},lineHeight:21,minHeight:38,paddingBottom:0,paddingLeft:14,paddingRight:14,paddingTop:0},more:{color:"$ink",columnGap:18,flexDirection:"row",flexWrap:"wrap",fontFamily:"sans",fontSize:17,lineHeight:25.5,marginBottom:0,marginLeft:0,marginRight:0,marginTop:8,rowGap:0},moreButton:{backgroundColor:"transparent",color:"$link",fontFamily:"sans",fontSize:14,fontWeight:"700",lineHeight:21,minHeight:34,paddingBottom:0,paddingLeft:0,paddingRight:0,paddingTop:0,textDecorationLine:"underline"},fine:{color:"$ink3",fontFamily:"sans",fontSize:13,lineHeight:18.85,marginBottom:0,marginLeft:0,marginRight:0,marginTop:8},others:{backgroundColor:"$card",borderRadius:22,color:"$ink",fontFamily:"sans",fontSize:17,lineHeight:25.5,marginBottom:0,marginLeft:0,marginRight:0,marginTop:14,paddingBottom:16,paddingLeft:16,paddingRight:16,paddingTop:16,shadow:{x:0,y:1,blur:3,color:"#262523",opacity:.06}},sign:{borderRadius:16,color:"$ink",fontFamily:"sans",fontSize:17,inner:{width:1.5,color:"$n_DEDCD7"},lineHeight:25.5,marginTop:12,paddingBottom:14,paddingLeft:14,paddingRight:14,paddingTop:14},signUrgent:{backgroundColor:"$riskBg",inner:null,shadow:null},signTitle:{alignItems:"center",color:"$ink",flexDirection:"row",fontFamily:"sans",fontSize:16,fontWeight:"800",gap:8,lineHeight:20,marginBottom:0,marginLeft:0,marginRight:0,marginTop:0},signUrgentTitle:{color:"$riskInk"},signUrgentIcon:{height:20,width:20},signBody:{color:"$ink2",fontFamily:"sans",fontSize:15,lineHeight:21.75,marginBottom:0,marginLeft:0,marginRight:0,marginTop:4},signUrgentBody:{color:"$ink"},questionsKicker:{color:"$ink",fontFamily:"sans",fontSize:16,fontWeight:"800",lineHeight:20,marginBottom:0,marginLeft:0,marginRight:0,marginTop:18},questions:{color:"$ink",fontFamily:"sans",fontSize:15,gap:6,lineHeight:21.75,marginBottom:0,marginLeft:0,marginRight:0,marginTop:10,paddingLeft:22},questionsAfterKicker:{marginTop:6},add:{alignItems:"center",backgroundColor:"transparent",borderRadius:999,color:"$ink",flexDirection:"row",fontFamily:"sans",fontSize:16,fontWeight:"800",inner:{width:2,color:"$ink"},justifyContent:"center",lineHeight:24,marginTop:14,minHeight:48,paddingBottom:0,paddingLeft:16,paddingRight:16,paddingTop:0,width:"100%"},addOn:{backgroundColor:"$clearBg",color:"$clearInk",inner:null,shadow:null},askRow:{alignItems:"center",backgroundColor:"$linkWash",borderRadius:16,color:"$ink",flexDirection:"row",fontFamily:"sans",fontSize:17,gap:12,grid:[40,"fr",18],lineHeight:25.5,marginTop:10,paddingBottom:12,paddingLeft:12,paddingRight:14,paddingTop:12,textAlign:"left",width:"100%"},askRowInSec:{marginTop:12},askRowIcon:{alignItems:"center",backgroundColor:"$card",borderRadius:11,color:"$link",fontFamily:"sans",fontSize:17,height:40,justifyContent:"center",lineHeight:25.5,textAlign:"left",width:40},askRowIconSvg:{height:21,width:21},askRowStrong:{color:"$ink",fontFamily:"sans",fontSize:15.5,fontWeight:"800",lineHeight:20.15,textAlign:"left"},askRowSmall:{color:"$ink2",fontFamily:"sans",fontSize:14,lineHeight:19.6,marginTop:1,textAlign:"left"},askRowChev:{color:"$ink2",height:18,width:18},extras:{color:"$ink",fontFamily:"sans",fontSize:17,gap:10,lineHeight:25.5,marginTop:22},extrasTitle:{color:"$ink3",fontFamily:"mono",fontSize:11,fontWeight:"400",letterSpacing:.77,lineHeight:12.65,marginBottom:0,marginLeft:4,marginRight:4,marginTop:0,textTransform:"uppercase"},extra:{alignItems:"flex-start",backgroundColor:"$card",borderRadius:22,color:"$ink",columnGap:12,flexDirection:"row",fontFamily:"sans",fontSize:17,grid:[56,"fr"],lineHeight:25.5,paddingBottom:14,paddingLeft:14,paddingRight:14,paddingTop:14,rowGap:4,shadow:{x:0,y:1,blur:3,color:"#262523",opacity:.06}},extraKit:{backgroundColor:"$linkWash",inner:null,shadow:null},extraImage:{backgroundColor:"$card",borderRadius:14,height:56,width:56},extraKitImage:{backgroundColor:"$card"},extraIcon:{alignItems:"center",backgroundColor:"$linkWash",borderRadius:14,color:"$link",height:56,justifyContent:"center",width:56},extraIconSvg:{height:26,width:26},extraTitle:{color:"$ink",fontFamily:"sans",fontSize:17,fontWeight:"800",lineHeight:20.4,marginBottom:0,marginLeft:0,marginRight:0,marginTop:0},extraTitleSerif:{fontFamily:"serif",fontSize:21,fontWeight:"800",letterSpacing:-.21,lineHeight:25.2},extraBody:{color:"$ink2",fontFamily:"sans",fontSize:14.5,lineHeight:20.3,marginBottom:0,marginLeft:0,marginRight:0,marginTop:3},extraPrice:{alignItems:"center",color:"$ink",columnGap:8,flexDirection:"row",flexWrap:"wrap",fontFamily:"sans",fontSize:14.5,lineHeight:20.3,marginBottom:0,marginLeft:0,marginRight:0,marginTop:6,rowGap:0},extraPriceValue:{color:"$ink",fontFamily:"sans",fontSize:19,fontVariant:["tabular-nums"],fontWeight:"800",lineHeight:26.6},extraPriceWas:{color:"$ink3",fontFamily:"sans",fontSize:14,fontWeight:"700",lineHeight:19.6,textDecorationLine:"line-through"},extraGo:{backgroundColor:"$primary",borderRadius:999,color:"$onPrimary",fontFamily:"sans",fontSize:14.5,fontWeight:"800",lineHeight:21.75,marginTop:8,minHeight:40,paddingBottom:0,paddingLeft:18,paddingRight:18,paddingTop:0},extraGoOn:{backgroundColor:"$clearBg",color:"$clearInk"},wait:{backgroundColor:"$card",borderRadius:22,color:"$ink",fontFamily:"sans",fontSize:17,lineHeight:25.5,marginTop:14,paddingBottom:16,paddingLeft:16,paddingRight:16,paddingTop:16,shadow:{x:0,y:1,blur:3,color:"#262523",opacity:.06}},waitTop:{alignItems:"center",color:"$ink",flexDirection:"row",fontFamily:"sans",fontSize:17,gap:12,grid:[46,"fr"],lineHeight:25.5},waitTile:{alignItems:"center",backgroundColor:"$linkWash",borderRadius:13,color:"$link",flexGrow:0,flexShrink:0,fontFamily:"sans",fontSize:22,height:46,justifyContent:"center",lineHeight:33,width:46},waitTileSvg:{height:23,width:23},waitMini:{color:"$ink3",fontFamily:"mono",fontSize:10.5,letterSpacing:.63,lineHeight:15.75,marginBottom:0,marginLeft:0,marginRight:0,marginTop:0,textTransform:"uppercase"},waitTitle:{color:"$ink",fontFamily:"serif",fontSize:26,fontWeight:"800",letterSpacing:-.26,lineHeight:27.3,marginBottom:0,marginLeft:0,marginRight:0,marginTop:2},waitKey:{color:"$ink",fontFamily:"sans",fontSize:16,fontWeight:"800",lineHeight:24,marginBottom:0,marginLeft:0,marginRight:0,marginTop:18},waitText:{alignItems:"center",color:"$ink",flexDirection:"row",fontFamily:"sans",fontSize:15.5,fontWeight:"700",gap:8,lineHeight:23.25,marginBottom:12,marginLeft:0,marginRight:0,marginTop:16},waitTextSvg:{color:"$link",flexGrow:0,flexShrink:0,height:20,width:20},waitButton:{alignItems:"center",alignSelf:"flex-start",backgroundColor:"$primary",borderRadius:999,color:"$onPrimary",flexDirection:"row",fontFamily:"sans",fontSize:16,fontWeight:"700",gap:8,justifyContent:"center",lineHeight:24,minHeight:48,paddingBottom:0,paddingLeft:22,paddingRight:22,paddingTop:0,textDecorationLine:"none",width:"100%"},track:{color:"$ink",fontFamily:"sans",fontSize:17,lineHeight:25.5,marginBottom:0,marginLeft:0,marginRight:0,marginTop:14,paddingBottom:0,paddingLeft:0,paddingRight:0,paddingTop:0},trackStep:{color:"$ink",flexDirection:"row",fontFamily:"sans",fontSize:17,gap:12,grid:[22,"fr"],lineHeight:25.5,paddingBottom:16,position:"relative"},trackStepLast:{paddingBottom:0},trackLine:{backgroundColor:"$n_E2DFD9",borderRadius:1,bottom:-2,left:10,position:"absolute",top:20,width:2},trackLineDone:{backgroundColor:"$primary"},trackDot:{alignItems:"center",backgroundColor:"$card",borderRadius:11,height:22,inner:{width:2,color:"$n_CFCBC4"},justifyContent:"center",position:"relative",width:22,zIndex:1},trackDotDone:{backgroundColor:"$primary",inner:null,shadow:null},trackDotNow:{backgroundColor:"$accent",inner:{width:2,color:"$ink"}},trackDotSvg:{color:"$card",height:13,width:13},trackTitle:{color:"$ink",fontFamily:"sans",fontSize:15.5,fontWeight:"800",lineHeight:20.15},trackTitleTodo:{color:"$ink3",fontWeight:"700"},trackDetail:{color:"$ink3",fontFamily:"sans",fontSize:14,lineHeight:18.9,marginTop:1},trackTag:{backgroundColor:"$ink",borderRadius:5,color:"$onInk",fontFamily:"mono",fontSize:10,letterSpacing:.6,lineHeight:13.5,paddingBottom:2,paddingLeft:6,paddingRight:6,paddingTop:2,textTransform:"uppercase"},next:{backgroundColor:"$card",borderRadius:18,color:"$ink",fontFamily:"sans",fontSize:17,lineHeight:25.5,marginBottom:0,marginLeft:0,marginRight:0,marginTop:22,paddingBottom:4,paddingLeft:16,paddingRight:16,paddingTop:4,shadow:{x:0,y:1,blur:3,color:"#262523",opacity:.06},textAlign:"left"},nextIn:{backgroundColor:"$paper",inner:null,marginTop:8,shadow:null},nextRow:{alignItems:"center",color:"$ink",flexDirection:"row",fontFamily:"sans",fontSize:17,gap:12,grid:[36,"fr"],lineHeight:25.5,paddingBottom:10,paddingLeft:0,paddingRight:0,paddingTop:10,textAlign:"left"},nextIcon:{alignItems:"center",backgroundColor:"$linkWash",borderRadius:11,color:"$link",fontFamily:"sans",fontSize:17,height:36,justifyContent:"center",lineHeight:25.5,textAlign:"left",width:36},nextIconSvg:{height:19,width:19},nextIconImage:{borderRadius:11,height:"100%",width:"100%"},nextLabel:{color:"$ink3",fontFamily:"mono",fontSize:10.5,letterSpacing:.53,lineHeight:15.75,textAlign:"left",textTransform:"uppercase"},nextText:{color:"$ink",fontFamily:"sans",fontSize:15,fontWeight:"600",lineHeight:20.25,marginTop:1,textAlign:"left"},shop:{color:"$ink",fontFamily:"sans",fontSize:17,gap:12,lineHeight:25.5,paddingBottom:28,paddingLeft:18,paddingRight:18,paddingTop:8},shopTitle:{color:"$ink",fontFamily:"serif",fontSize:29,fontWeight:"800",letterSpacing:-.29,lineHeight:31.32,marginBottom:0,marginLeft:0,marginRight:0,marginTop:0},shopSub:{color:"$ink2",fontFamily:"sans",fontSize:15,lineHeight:21.75,marginBottom:0,marginLeft:0,marginRight:0,marginTop:-6},shopKey:{color:"$ink",fontFamily:"sans",fontSize:16,fontWeight:"800",lineHeight:18.4,marginBottom:-4,marginLeft:2,marginRight:2,marginTop:6},shopCard:{backgroundColor:"$card",borderRadius:22,color:"$ink",fontFamily:"sans",fontSize:17,lineHeight:25.5,paddingBottom:14,paddingLeft:16,paddingRight:16,paddingTop:14,shadow:{x:0,y:1,blur:3,color:"#262523",opacity:.06}},shopFine:{color:"$ink3",fontFamily:"sans",fontSize:13,lineHeight:18.85,marginBottom:0,marginLeft:0,marginRight:0,marginTop:0},shopFineCenter:{marginTop:14,textAlign:"center"},shopEmpty:{alignItems:"center",color:"$ink",fontFamily:"sans",fontSize:17,gap:8,lineHeight:25.5,paddingBottom:8,paddingLeft:12,paddingRight:12,paddingTop:48,textAlign:"center"},shopEmptyTile:{alignItems:"center",backgroundColor:"$linkWash",borderRadius:20,color:"$link",flexGrow:0,flexShrink:0,fontFamily:"sans",fontSize:22,height:72,justifyContent:"center",lineHeight:33,marginBottom:8,textAlign:"center",width:72},shopEmptyTileSvg:{height:34,width:34},shopEmptyTitle:{color:"$ink",fontFamily:"serif",fontSize:28,fontWeight:"800",letterSpacing:-.28,lineHeight:30.8,marginBottom:0,marginLeft:0,marginRight:0,marginTop:0,textAlign:"center"},shopEmptyText:{color:"$ink2",fontFamily:"sans",fontSize:15.5,lineHeight:22.48,marginBottom:0,marginLeft:0,marginRight:0,marginTop:0,maxWidth:298.07,textAlign:"center"},shopEmptyButton:{alignItems:"center",alignSelf:"flex-start",backgroundColor:"$primary",borderRadius:999,color:"$onPrimary",flexDirection:"row",fontFamily:"sans",fontSize:16,fontWeight:"700",gap:8,justifyContent:"center",lineHeight:24,marginTop:12,minHeight:48,paddingBottom:0,paddingLeft:22,paddingRight:22,paddingTop:0,textAlign:"center",textDecorationLine:"none"},shopLink:{backgroundColor:"transparent",color:"$link",fontFamily:"sans",fontSize:15,fontWeight:"700",lineHeight:22.5,minHeight:40,paddingBottom:0,paddingLeft:0,paddingRight:0,paddingTop:0,textDecorationLine:"underline"},shopActions:{alignItems:"center",color:"$ink",fontFamily:"sans",fontSize:17,gap:4,lineHeight:25.5,marginTop:4},orderList:{color:"$ink",fontFamily:"sans",fontSize:17,gap:10,lineHeight:25.5,marginBottom:0,marginLeft:0,marginRight:0,marginTop:0,paddingBottom:0,paddingLeft:0,paddingRight:0,paddingTop:0},order:{alignItems:"center",backgroundColor:"$card",borderRadius:22,color:"$ink",flexDirection:"row",fontFamily:"sans",fontSize:17,gap:10,grid:["fr",18],lineHeight:25.5,paddingBottom:14,paddingLeft:16,paddingRight:14,paddingTop:14,shadow:{x:0,y:1,blur:3,color:"#262523",opacity:.06},textAlign:"left",width:"100%"},orderChev:{color:"$ink3",height:18,width:18},orderTop:{alignItems:"center",color:"$ink",columnGap:10,flexDirection:"row",flexWrap:"wrap",fontFamily:"sans",fontSize:17,lineHeight:25.5,rowGap:4,textAlign:"left"},orderNo:{color:"$ink3",fontFamily:"mono",fontSize:12,letterSpacing:.48,lineHeight:18,textAlign:"left"},orderWhat:{color:"$ink",fontFamily:"sans",fontSize:16,fontWeight:"800",lineHeight:20.8,marginTop:8,textAlign:"left"},orderMeta:{color:"$ink3",fontFamily:"sans",fontSize:14,lineHeight:19.6,marginTop:2,textAlign:"left"},orderPics:{color:"$ink",flexDirection:"row",fontFamily:"sans",fontSize:17,gap:6,lineHeight:25.5,marginTop:10,textAlign:"left"},orderPic:{alignItems:"center",backgroundColor:"$linkWash",borderRadius:10,color:"$link",fontFamily:"sans",fontSize:17,height:40,justifyContent:"center",lineHeight:25.5,overflow:"hidden",textAlign:"left",width:40},orderPicImage:{height:"100%",width:"100%"},orderPicSvg:{height:20,width:20},pill:{alignItems:"center",alignSelf:"flex-start",backgroundColor:"$accent3",borderRadius:999,color:"$ink",flexDirection:"row",fontFamily:"sans",fontSize:13,fontWeight:"800",gap:6,lineHeight:19.5,minHeight:26,paddingBottom:0,paddingLeft:10,paddingRight:10,paddingTop:0,textAlign:"left"},pillDone:{backgroundColor:"$clearBg",color:"$clearInk"},pillSub:{backgroundColor:"$linkWash",color:"$link"},toast:{backgroundColor:"$ink",borderRadius:16,color:"$onInk",fontFamily:"sans",fontSize:14.5,left:16,lineHeight:20.3,opacity:1,paddingBottom:12,paddingLeft:15,paddingRight:15,paddingTop:12,position:"absolute",right:16,top:62,zIndex:50},scrim:{backgroundColor:"$scrim",bottom:0,left:0,opacity:1,position:"absolute",right:0,top:0,zIndex:40},sheet:{backgroundColor:"$card",borderBottomLeftRadius:0,borderBottomRightRadius:0,borderTopLeftRadius:28,borderTopRightRadius:28,bottom:0,color:"$ink",fontFamily:"sans",fontSize:17,left:0,lineHeight:25.5,maxHeight:"80%",paddingBottom:40,paddingLeft:20,paddingRight:20,paddingTop:10,position:"absolute",right:0,zIndex:41},sheetGrab:{backgroundColor:"$n_DAD7D1",borderRadius:3,height:5,marginBottom:10,marginLeft:"auto",marginRight:"auto",marginTop:0,width:40},sheetTop:{alignItems:"center",color:"$ink",flexDirection:"row",fontFamily:"sans",fontSize:17,justifyContent:"space-between",lineHeight:25.5},sheetKicker:{color:"$ink3",fontFamily:"mono",fontSize:11,letterSpacing:.88,lineHeight:16.5,marginBottom:0,marginLeft:0,marginRight:0,marginTop:0,textTransform:"uppercase"},sheetClose:{alignItems:"center",backgroundColor:"transparent",borderRadius:20,color:"$ink",fontFamily:"sans",fontSize:17,height:40,justifyContent:"center",lineHeight:25.5,marginRight:-8,paddingBottom:0,paddingLeft:0,paddingRight:0,paddingTop:0,position:"relative",width:40},sheetCloseSvg:{height:22,width:22},sheetTitle:{color:"$ink",fontFamily:"serif",fontSize:24,fontWeight:"800",letterSpacing:-.24,lineHeight:27.6,marginBottom:0,marginLeft:0,marginRight:0,marginTop:0},sheetBody:{color:"$black",fontFamily:"sans",fontSize:16,gap:10,lineHeight:24,marginTop:12},blanksWrap:{color:"$ink",fontFamily:"sans",fontSize:17,lineHeight:25.5,marginTop:14},blanksCard:{backgroundColor:"$card",borderRadius:20,color:"$ink",fontFamily:"sans",fontSize:17,gap:8,lineHeight:25.5,paddingBottom:13,paddingLeft:12,paddingRight:12,paddingTop:12,shadow:{x:0,y:1,blur:3,color:"#262523",opacity:.06}},blanksHead:{alignItems:"center",color:"$ink3",flexDirection:"row",fontFamily:"sans",fontSize:12.5,fontWeight:"800",gap:10,justifyContent:"space-between",letterSpacing:.88,lineHeight:18.75,marginBottom:0,marginLeft:0,marginRight:0,marginTop:0,paddingBottom:2,paddingLeft:2,paddingRight:2,paddingTop:0,textTransform:"uppercase"},blanksPill:{backgroundColor:"$accent",borderRadius:999,color:"$ink",fontFamily:"sans",fontSize:13,fontStyle:"normal",fontWeight:"800",letterSpacing:.13,lineHeight:19.5,paddingBottom:2,paddingLeft:10,paddingRight:10,paddingTop:2,textTransform:"none"},blanksPillFilled:{backgroundColor:"$clearBg",color:"$clearInk"},blanksList:{color:"$ink",fontFamily:"sans",fontSize:17,gap:7,lineHeight:25.5,marginBottom:0,marginLeft:0,marginRight:0,marginTop:0,paddingBottom:0,paddingLeft:0,paddingRight:0,paddingTop:0},blanksRow:{alignItems:"center",backgroundColor:"$paper",borderRadius:15,color:"$ink",columnGap:11,flexDirection:"row",fontFamily:"sans",fontSize:17,grid:[34,"fr"],lineHeight:25.5,paddingBottom:9,paddingLeft:9,paddingRight:12,paddingTop:9},blanksNum:{alignItems:"center",backgroundColor:"$accentChip",borderRadius:11,color:"$ink",fontFamily:"serif",fontSize:22,fontWeight:"800",height:40,justifyContent:"center",lineHeight:33,width:34},blanksText:{color:"$ink",fontFamily:"sans",fontSize:16,fontWeight:"700",lineHeight:21.6},blanksSource:{color:"$ink3",fontFamily:"sans",fontSize:13.5,lineHeight:20.25},blank:{alignSelf:"flex-start",backgroundColor:"$accent4",borderRadius:6,color:"$ink",fontFamily:"sans",fontSize:16,fontStyle:"normal",fontWeight:"700",height:20,inner:{width:1.5,color:"$accent"},lineHeight:21.6,minWidth:36},blankS:{minWidth:24},blankL:{minWidth:64},blankFilled:{backgroundColor:"transparent",borderRadius:6,height:"auto",inner:null,marginBottom:0,marginLeft:-3,marginRight:-3,marginTop:0,minWidth:0,paddingBottom:0,paddingLeft:3,paddingRight:3,paddingTop:0,shadow:null},manageOrders:{backgroundColor:"transparent",color:"$link",fontFamily:"sans",fontSize:15,fontWeight:"700",lineHeight:22.5,minHeight:40,paddingBottom:0,paddingLeft:0,paddingRight:0,paddingTop:0,textDecorationLine:"underline"}}),RAPH_RN_PLAN_ICONS=/* @__PURE__ */Object.freeze({shield:{strokes:[{width:1.8,cap:true,closed:true,points:[12,3,19,6,19,12,18.759,14.125,18.074,16,17,17.625,15.593,19,13.907,20.125,12,21,10.093,20.125,8.407,19,7,17.625,5.926,16,5.241,14.125,5,12,5,6]},{width:1.8,cap:true,closed:false,points:[9,12,11,14,15,10]}],boxes:[],triangles:[],seams:[]},arrow:{strokes:[{width:2,cap:true,closed:false,points:[4.5,12,19,12]},{width:2,cap:true,closed:false,points:[13.5,6.5,19,12,13.5,17.5]}],boxes:[],triangles:[],seams:[]},check:{strokes:[{width:2.4,cap:true,closed:false,points:[5,12.6,9.4,17,19,7.4]}],boxes:[],triangles:[],seams:[]},star:{strokes:[],boxes:[],triangles:[[12,16.9,6.8,19.6,7.8,13.8],[16.2,13.8,17.2,19.6,12,16.9],[7.8,13.8,3.5,9.7,9.4,8.8],[14.6,8.8,20.5,9.7,16.2,13.8],[9.4,8.8,12,3.5,14.6,8.8],[16.2,13.8,12,16.9,7.8,13.8],[14.6,8.8,16.2,13.8,7.8,13.8],[14.6,8.8,7.8,13.8,9.4,8.8]],seams:[[12,16.9,7.8,13.8,.245,.677],[12,16.9,16.2,13.8,.245,.677],[7.8,13.8,9.4,8.8,.69,.248],[14.6,8.8,16.2,13.8,.248,.243],[14.6,8.8,9.4,8.8,.68,.245],[16.2,13.8,7.8,13.8,.677,.68],[14.6,8.8,7.8,13.8,.68,.69]]},truck:{strokes:[{width:1.7,cap:false,closed:true,points:[2.8,6.5,14.2,6.5,14.2,16,2.8,16]},{width:1.7,cap:false,closed:false,points:[14.2,9.5,17.8,9.5,21.2,12.9,21.2,16,14.2,16]}],boxes:[{x:5,y:15.8,w:3.6,h:3.6,radius:1.8,width:1.7},{x:15.4,y:15.8,w:3.6,h:3.6,radius:1.8,width:1.7}],triangles:[],seams:[]},refresh:{strokes:[{width:1.7,cap:true,closed:false,points:[4,12,4.343,14.363,5.368,16.52,6.985,18.278,9.048,19.48,11.374,20.021,13.756,19.85,15.981,18.984,17.852,17.5,19.201,15.53,19.909,13.249,19.912,10.861,19.21,8.578,17.865,6.605,15.998,5.116,13.775,4.245,11.393,4.068,9.066,4.602,7,5.8]},{width:1.7,cap:true,closed:false,points:[4,4,4,8,8,8]}],boxes:[],triangles:[],seams:[]},card:{strokes:[{width:1.7,cap:true,closed:false,points:[3,9.5,21,9.5]},{width:1.7,cap:true,closed:false,points:[6.5,15,10.5,15]}],boxes:[{x:3,y:5.5,w:18,h:13,radius:2.2,width:1.7}],triangles:[],seams:[]},alert:{strokes:[{width:1.9,cap:true,closed:true,points:[12,3.5,21.5,20,2.5,20]},{width:1.9,cap:true,closed:false,points:[12,10,12,14.5]},{width:1.9,cap:true,closed:false,points:[12,17.2,12.01,17.2]}],boxes:[],triangles:[],seams:[]},x:{strokes:[{width:2,cap:true,closed:false,points:[6.5,6.5,17.5,17.5]},{width:2,cap:true,closed:false,points:[17.5,6.5,6.5,17.5]}],boxes:[],triangles:[],seams:[]},chat:{strokes:[{width:1.7,cap:false,closed:true,points:[5,5.2,19,5.2,19.8,5.414,20.386,6,20.6,6.8,20.6,15.4,20.386,16.2,19.8,16.786,19,17,10.3,17,5.5,20.6,5.5,17,5,17,4.2,16.786,3.614,16.2,3.4,15.4,3.4,6.8,3.614,6,4.2,5.414,5,5.2]}],boxes:[],triangles:[],seams:[]},repeat:{strokes:[{width:1.8,cap:true,closed:false,points:[4.5,11,4.824,8.824,5.766,6.837,7.244,5.208,9.131,4.077,11.264,3.543,13.461,3.65,15.533,4.391,17.3,5.7,19.5,8]},{width:1.8,cap:true,closed:false,points:[19.5,3.5,19.5,8,15,8]},{width:1.8,cap:true,closed:false,points:[19.5,13,19.176,15.176,18.234,17.163,16.756,18.792,14.869,19.923,12.736,20.457,10.539,20.35,8.467,19.609,6.7,18.3,4.5,16]},{width:1.8,cap:true,closed:false,points:[4.5,20.5,4.5,16,9,16]}],boxes:[],triangles:[],seams:[]},calendar:{strokes:[{width:1.8,cap:true,closed:false,points:[4,10,20,10]},{width:1.8,cap:true,closed:false,points:[8.5,3.5,8.5,7.5]},{width:1.8,cap:true,closed:false,points:[15.5,3.5,15.5,7.5]}],boxes:[{x:4,y:5.5,w:16,h:15,radius:2.5,width:1.8}],triangles:[],seams:[]},flame:{strokes:[],boxes:[],triangles:[[12.15,14.513,13.1,15.2,13.1,13.7],[11.5,13.3,12.15,14.513,13.1,13.7],[16.874,10.907,15.7,9.3,15.381,10.659],[14.7,16.7,16.838,18.516,17.693,16.84],[14.7,16.7,14.489,17.681,16.838,18.516],[18,14.9,14.507,15.633,17.693,16.84],[16.874,10.907,15.381,10.659,14.685,11.707],[17.693,12.759,16.874,10.907,14.685,11.707],[15.538,19.832,16.838,18.516,14.489,17.681],[14.685,11.707,13.959,14.633,17.693,12.759],[17.693,12.759,13.959,14.633,18,14.9],[13.891,20.692,13.055,19.006,12,21],[12,21,12,19.2,10.109,20.692],[8.462,19.832,10.109,20.692,10.659,18.863],[10.659,18.863,9.741,17.97,8.462,19.832],[6.307,16.84,9.602,15.677,6,14.9],[6.273,13.033,6,14.9,9.602,15.677],[9.602,15.677,10.113,14.812,6.273,13.033],[6.988,11.438,6.273,13.033,10.113,14.812],[13.525,7.088,12.856,5.017,12,3.5],[13.856,9.589,13.525,7.088,12,3.5],[13.7,12.4,13.856,9.589,12,3.5],[10.113,14.812,10.792,14.042,6.988,11.438],[14.7,16.7,17.693,16.84,14.507,15.633],[13.7,12.4,13.959,14.633,14.685,11.707],[14.507,15.633,18,14.9,13.959,14.633],[13.1,13.7,13.959,14.633,13.7,12.4],[11.5,13.3,13.1,13.7,13.7,12.4],[7.983,10.048,6.988,11.438,10.792,14.042],[10.792,14.042,11.5,13.3,7.983,10.048],[14.489,17.681,13.913,18.475,15.538,19.832],[13.891,20.692,15.538,19.832,13.913,18.475],[13.891,20.692,13.913,18.475,13.055,19.006],[12,19.2,12,21,13.055,19.006],[10.659,18.863,10.109,20.692,12,19.2],[7.162,18.516,8.462,19.832,9.741,17.97],[9.741,17.97,9.4,16.7,7.162,18.516],[6.307,16.84,7.162,18.516,9.4,16.7],[6.307,16.84,9.4,16.7,9.602,15.677],[9.1,8.8,7.983,10.048,11.5,13.3],[11.5,13.3,13.7,12.4,9.1,8.8],[10.054,7.77,9.1,8.8,13.7,12.4],[10.927,6.683,10.054,7.77,13.7,12.4],[11.613,5.481,10.927,6.683,13.7,12.4],[12.006,4.106,11.613,5.481,13.7,12.4],[12,2.5,12.006,4.106,13.7,12.4],[12,2.5,13.7,12.4,12,3.5]],seams:[[12.15,14.513,13.1,13.7,.121,.428],[11.5,13.3,13.1,13.7,.681,.356],[15.381,10.659,16.874,10.907,.033,.883],[14.7,16.7,16.838,18.516,.648,1.318],[14.7,16.7,17.693,16.84,.648,1.533],[14.489,17.681,16.838,18.516,.51,1.318],[14.507,15.633,18,14.9,.782,1.787],[14.507,15.633,17.693,16.84,.782,1.533],[14.685,11.707,16.874,10.907,.68,.883],[14.685,11.707,17.693,12.759,.61,.484],[14.489,17.681,15.538,19.832,.51,1.115],[13.959,14.633,14.685,11.707,1.333,.576],[13.959,14.633,17.693,12.759,.851,.484],[13.959,14.633,18,14.9,.851,1.787],[13.055,19.006,13.891,20.692,.36,.984],[12,21,13.055,19.006,.945,.395],[12,19.2,12,21,.394,.945],[10.109,20.692,12,19.2,.715,.394],[10.109,20.692,10.659,18.863,.715,.428],[10.659,18.863,8.462,19.832,.428,.809],[8.462,19.832,9.741,17.97,.809,.525],[6.307,16.84,9.602,15.677,1.65,.812],[6,14.9,9.602,15.677,.194,1.012],[6.273,13.033,9.602,15.677,2.068,1.012],[10.113,14.812,6.273,13.033,1.217,2.068],[10.113,14.812,6.988,11.438,1.217,2.2],[12,3.5,13.525,7.088,4.697,5.571],[12,3.5,13.856,9.589,4.697,3.017],[12,3.5,13.7,12.4,4.648,26.765],[10.792,14.042,6.988,11.438,1.339,2.2],[13.7,12.4,13.959,14.633,.819,1.333],[13.1,13.7,13.7,12.4,0,.819],[11.5,13.3,13.7,12.4,.681,.537],[10.792,14.042,7.983,10.048,1.339,2.328],[11.5,13.3,7.983,10.048,1.438,2.328],[13.913,18.475,15.538,19.832,.409,1.115],[13.891,20.692,13.913,18.475,.984,.409],[7.162,18.516,9.741,17.97,.977,.525],[7.162,18.516,9.4,16.7,.977,.677],[6.307,16.84,9.4,16.7,1.65,.677],[11.5,13.3,9.1,8.8,1.438,1.129],[13.7,12.4,9.1,8.8,2.046,1.129],[10.054,7.77,13.7,12.4,.079,2.285],[10.927,6.683,13.7,12.4,.237,3.126],[11.613,5.481,13.7,12.4,.475,5.451],[12.006,4.106,13.7,12.4,.961,15.892],[12,2.5,13.7,12.4,2.974,26.765]]},box:{strokes:[{width:1.7,cap:false,closed:true,points:[3.8,7.8,12,4,20.2,7.8,20.2,16.4,12,20,3.8,16.4]},{width:1.7,cap:false,closed:false,points:[3.8,7.8,12,11.6,20.2,7.8]},{width:1.7,cap:false,closed:false,points:[12,11.6,12,20]}],boxes:[],triangles:[],seams:[]},cart:{strokes:[{width:1.8,cap:true,closed:false,points:[2.8,4,5.4,4,7.7,14.6,8.203,15.401,9.1,15.7,17.3,15.7,18.197,15.401,18.7,14.6,20.4,7.6,6.3,7.6]}],boxes:[{x:8.3,y:18.3,w:2.6,h:2.6,radius:1.3,width:1.8},{x:15.8,y:18.3,w:2.6,h:2.6,radius:1.3,width:1.8}],triangles:[],seams:[]},minus:{strokes:[{width:2.2,cap:true,closed:false,points:[6,12,18,12]}],boxes:[],triangles:[],seams:[]},plus:{strokes:[{width:2.2,cap:true,closed:false,points:[12,6,12,18]},{width:2.2,cap:true,closed:false,points:[6,12,18,12]}],boxes:[],triangles:[],seams:[]},chev:{strokes:[{width:2,cap:true,closed:false,points:[9,5.5,15.5,12,9,18.5]}],boxes:[],triangles:[],seams:[]},pulse:{strokes:[{width:1.8,cap:true,closed:false,points:[3,12.5,6.8,12.5,9.2,6.9,13.4,17.5,15.8,12.5,21,12.5]}],boxes:[],triangles:[],seams:[]},file:{strokes:[{width:1.7,cap:true,closed:true,points:[7,3.5,14.2,3.5,18.5,7.8,18.5,20,18.324,20.424,17.9,20.6,7,20.6,6.576,20.424,6.4,20,6.4,4.1,6.576,3.676,7,3.5]},{width:1.7,cap:true,closed:false,points:[14,3.6,14,8,18.4,8]},{width:1.7,cap:true,closed:false,points:[9.4,12.4,14.6,12.4]},{width:1.7,cap:true,closed:false,points:[9.4,15.8,14.6,15.8]}],boxes:[],triangles:[],seams:[]},kit:{strokes:[{width:1.7,cap:false,closed:true,points:[4,7.6,12,3.6,20,7.6,20,16.4,12,20.4,4,16.4]},{width:1.7,cap:false,closed:false,points:[4,7.6,12,11.6,20,7.6]},{width:1.7,cap:false,closed:false,points:[12,11.6,12,20.4]}],boxes:[],triangles:[],seams:[]},dna:{strokes:[{width:1.7,cap:true,closed:false,points:[7,3.5,7.28,4.645,8.04,5.594,9.16,6.394,10.52,7.097,12,7.75,13.48,8.403,14.84,9.106,15.96,9.906,16.72,10.855,17,12,16.72,13.145,15.96,14.094,14.84,14.894,13.48,15.597,12,16.25,10.52,16.903,9.16,17.606,8.04,18.406,7.28,19.355,7,20.5]},{width:1.7,cap:true,closed:false,points:[17,3.5,16.72,4.645,15.96,5.594,14.84,6.394,13.48,7.097,12,7.75,10.52,8.403,9.16,9.106,8.04,9.906,7.28,10.855,7,12,7.28,13.145,8.04,14.094,9.16,14.894,10.52,15.597,12,16.25,13.48,16.903,14.84,17.606,15.96,18.406,16.72,19.355,17,20.5]},{width:1.7,cap:true,closed:false,points:[8.6,6.3,15.4,6.3]},{width:1.7,cap:true,closed:false,points:[8.6,17.7,15.4,17.7]},{width:1.7,cap:true,closed:false,points:[10.4,9.6,13.6,9.6]},{width:1.7,cap:true,closed:false,points:[10.4,14.4,13.6,14.4]}],boxes:[],triangles:[],seams:[]},heart:{strokes:[{width:1.8,cap:false,closed:true,points:[12,20.2,11.739,20.035,11.041,19.559,10.03,18.804,8.831,17.799,7.569,16.575,6.37,15.163,5.359,13.593,4.661,11.895,4.4,10.1,4.833,8.454,5.87,7.105,7.349,6.264,9.039,6.062,10.675,6.532,12,7.6,13.325,6.532,14.961,6.062,16.651,6.264,18.13,7.105,19.167,8.454,19.6,10.1,19.339,11.895,18.641,13.593,17.63,15.163,16.431,16.575,15.169,17.799,13.97,18.804,12.959,19.559,12.261,20.035,12,20.2]}],boxes:[],triangles:[],seams:[]},bottle:{strokes:[{width:1.7,cap:false,closed:true,points:[7.2,6.2,16.8,6.2,17.507,6.493,17.8,7.2,17.8,19.5,17.572,20.35,16.95,20.972,16.1,21.2,7.9,21.2,7.05,20.972,6.428,20.35,6.2,19.5,6.2,7.2,6.493,6.493,7.2,6.2]},{width:1.7,cap:false,closed:true,points:[9,11,15,11,15,16,9,16]}],boxes:[{x:8,y:2.8,w:8,h:3.4,radius:1,width:1.7}],triangles:[],seams:[]},harness:{strokes:[{width:1.5,cap:true,closed:false,points:[7.5,4.5,7.728,6.82,8.364,8.708,9.336,10.116,10.572,10.996,12,11.3,13.428,10.996,14.664,10.116,15.636,8.708,16.272,6.82,16.5,4.5]},{width:1.5,cap:true,closed:true,points:[5,12.6,19,12.6,19,17.2,18.692,18.35,17.85,19.192,16.7,19.5,7.3,19.5,6.15,19.192,5.308,18.35,5,17.2]},{width:1.5,cap:true,closed:false,points:[8.2,15.3,15.8,15.3]}],boxes:[{x:10.7,y:8.9,w:2.6,h:2.6,radius:1.3,width:1.5}],triangles:[],seams:[]},ramp:{strokes:[{width:1.5,cap:true,closed:false,points:[2.5,19.5,21.5,19.5]},{width:1.5,cap:true,closed:false,points:[3.5,19.5,3.5,16.5,8,16.5,8,13.5,12.5,13.5,12.5,10.5,17,10.5,17,7.5,20.5,7.5,20.5,19.5]},{width:1.5,cap:true,closed:false,points:[3.5,16.5,20.5,7.5],opacity:.35}],boxes:[],triangles:[],seams:[]}});var BOX=24,FINE=16,SEAM=.8,fine=dp=>Math.round(dp*FINE);function place(cx,cy,W,H,ux,uy){let left=cx-W/2,top=cy-H/2,x=Math.round(left),y=Math.round(top);return{position:"absolute",left:x,top:y,width:W,height:H,transform:[{translateX:left-x},{translateY:top-y},{rotate:`${Math.atan2(uy,ux)*180/Math.PI}deg`},{scale:1/FINE}]}}function strokePieces(icon,k,out){for(let s of icon.strokes){let w=s.width*k,pts=s.points,n=pts.length/2,last=s.closed?n:n-1;for(let i=0;i<last;i+=1){let j=(i+1)%n,px=(pts[i*2]??0)*k,py=(pts[i*2+1]??0)*k,dx=(pts[j*2]??0)*k-px,dy=(pts[j*2+1]??0)*k-py,len=Math.hypot(dx,dy);if(len===0&&!(n===2&&s.cap))continue;let ux=len===0?1:dx/len,uy=len===0?0:dy/len,e0=s.closed||i>0||s.cap?w/2:0,e1=s.closed||j!==n-1||s.cap?w/2:0,along=(len+e1-e0)/2;out.push({paint:"backgroundColor",style:{...place(px+ux*along,py+uy*along,fine(len+e0+e1),fine(w),ux,uy),borderTopLeftRadius:e0>0?fine(w)/2:0,borderBottomLeftRadius:e0>0?fine(w)/2:0,borderTopRightRadius:e1>0?fine(w)/2:0,borderBottomRightRadius:e1>0?fine(w)/2:0,...s.opacity===void 0?{}:{opacity:s.opacity}}})}}}function boxPieces(icon,k,out){for(let b of icon.boxes){let w=(b.w+b.width)*k,h=(b.h+b.width)*k;out.push({paint:"borderColor",style:{...place((b.x-b.width/2)*k+w/2,(b.y-b.width/2)*k+h/2,fine(w),fine(h),1,0),borderWidth:fine(b.width*k),borderRadius:(b.radius+b.width/2)*k*FINE,...b.opacity===void 0?{}:{opacity:b.opacity}}})}}function trianglePieces(icon,k,out){for(let t of icon.triangles){let p=[0,1,2].map(i=>[(t[i*2]??0)*k,(t[i*2+1]??0)*k]),base3=0,len=-1;for(let i=0;i<3;i+=1){let a2=p[i]??[0,0],b=p[(i+1)%3]??[0,0],d=Math.hypot(b[0]-a2[0],b[1]-a2[1]);d>len&&(len=d,base3=i)}if(len<=0)continue;let b0=p[base3]??[0,0],b1=p[(base3+1)%3]??[0,0],a=p[(base3+2)%3]??[0,0],ux=(b1[0]-b0[0])/len,uy=(b1[1]-b0[1])/len,along=(a[0]-b0[0])*ux+(a[1]-b0[1])*uy,across=(a[0]-b0[0])*-uy+(a[1]-b0[1])*ux,h=Math.abs(across),up=across<0,mid=up?-h/2:h/2,bl=fine(along),br=fine(len)-bl,bh=fine(h);out.push({paint:up?"borderBottomColor":"borderTopColor",style:{...place(b0[0]+ux*(len/2)-uy*mid,b0[1]+uy*(len/2)+ux*mid,bl+br,bh,ux,uy),width:0,height:0,borderLeftWidth:bl,borderRightWidth:br,borderLeftColor:"transparent",borderRightColor:"transparent",...up?{borderBottomWidth:bh}:{borderTopWidth:bh}}})}for(let e of icon.seams){let x0=(e[0]??0)*k,y0=(e[1]??0)*k,dx=(e[2]??0)*k-x0,dy=(e[3]??0)*k-y0,d=Math.hypot(dx,dy),in0=SEAM*(e[4]??0),in1=SEAM*(e[5]??0),bar=d-in0-in1;if(d===0||bar<=0)continue;let mid=in0+bar/2;out.push({paint:"backgroundColor",style:place(x0+dx/d*mid,y0+dy/d*mid,fine(bar),fine(SEAM),dx/d,dy/d)})}}var cache=/* @__PURE__ */new Map;function piecesOf(name,size){let key=`${name}:${size}`,hit=cache.get(key);if(hit!==void 0)return hit;let icon=RAPH_RN_PLAN_ICONS[name],out=[],k=size/BOX;return boxPieces(icon,k,out),strokePieces(icon,k,out),trianglePieces(icon,k,out),cache.set(key,out),out}function FocusIcon({name:name,size:size=18,color:color}){let pieces=RAPH_RN_PLAN_ICONS[name]===void 0?[]:piecesOf(name,size);/* @__PURE__ */
|
|
126
|
-
return jsx(View,{accessibilityElementsHidden:true,importantForAccessibility:"no-hide-descendants",testID:`health-plan-icon-${name}`,children:/* @__PURE__ */jsx(View,{style:{width:size,height:size},children:pieces.map((piece,i)=>/* @__PURE__ */jsx(View,{style:[piece.style,{[piece.paint]:color}]},i))})})}function healthPlanPossessive(pet){if(pet.sex==="female")return"her";if(pet.sex==="male")return"his";let name=pet.name?.trim();return name?`${name}'s`:null}var HEALTH_PLAN_FOCUS_RN_COPY=/* @__PURE__ */Object.freeze({...HEALTH_PLAN_FOCUS_COPY,firstBoxShips:"Her first box ships.",placedShips:"It ships.",trackingByText:"",moreOrders:"Load more",checkoutFailed:"That didn't go through. Please try again.",weightErrorKg:"",weightSavedKg:()=>"",back:"Back"}),cap=s=>s===""?s:`${s.charAt(0).toUpperCase()}${s.slice(1)}`;function healthPlanPetCopy(pet){let name=pet.name?.trim()??"",her=healthPlanPossessive(pet)??"your pet's",Her=cap(her),them=pet.sex==="female"?"her":pet.sex==="male"?"him":name!==""?name:"your pet",base3=HEALTH_PLAN_FOCUS_COPY,r5=healthPlanFocusCopyFor({name:pet.name,sex:pet.sex});return{jumpKicker:(p,subscribed)=>subscribed?`In ${her} plan, every ${p.intervalDays} days`:p.offer?`${p.discountPercent}% off ${her} first box`:base3.jumpKicker(p,false),firstBoxShips:pet.trackingTexts===true?`${Her} first box ships. Tracking comes by text.`:`${Her} first box ships.`,placedShips:pet.trackingTexts===true?base3.placedShips:HEALTH_PLAN_FOCUS_RN_COPY.placedShips,trackingByText:pet.trackingTexts===true?base3.trackingByText:"",refill:`A text 3 days before ${her} next box. Reply SKIP to skip it.`,nextBoxShips:p=>`${Her} next box ships, ${p.box??""}.`,startedDone:`Back to ${her} plan`,skipped:(_p,next)=>next===null?"Skipped.":`Skipped. ${Her} next box ships ${next}.`,cancelled:p=>`${p.productName} is cancelled. Restart it from ${her} plan anytime.`,seeOrders:`See ${her} orders`,cartOnceLine:(p,subscribed)=>subscribed?`An extra box. ${Her} plan keeps shipping.`:base3.cartOnceLine(p,false),herSubscription:`${Her} subscription`,ordersHeading:afterSubscription=>afterSubscription?"Orders":`${Her} orders`,addWeightTitle:`Add ${her} weight to size ${her} dose`,addWeightBody:`From a home scale or ${her} last vet visit.`,connectRecordsTitle:`Connect ${her} vet records`,connectRecordsBody:`${Her} weight, visits and labs make ${her} plan sharper.`,weightKicker:`${Her} weight`,weightBody:`From a home scale or ${her} last vet visit. ${Her} plan uses it to size ${her} dose.`,weightField:`${Her} weight`,weightError:`Enter ${her} weight in pounds, like 14.1.`,weightSave:`Save ${her} weight`,weightSaved:lb=>`Saved: ${lb} lb. ${Her} dose is sized for ${them}.`,signalsFit:r5.signalsFit,noPick:r5.noPick,saveForCheckup:r5.saveForCheckup,savedForCheckup:r5.savedForCheckup,blanksLabel:r5.blanksLabel,blanksFilledKicker:r5.blanksFilledKicker,blanksWeight:r5.blanksWeight,blanksWeightSource:r5.blanksWeightSource,blanksDoseSource:r5.blanksDoseSource,blanksShots:r5.blanksShots,blanksShotsSource:r5.blanksShotsSource,recordsLanded:r5.recordsLanded}}function toRgba(value){if(typeof value=="number")return argbIntToRgba(value);if(typeof value!="string")return null;let s=value.trim();if(s.length===0)return null;if(s.startsWith("#"))return fromHex(s.slice(1));if(s.toLowerCase().startsWith("0x"))return fromHex(s.slice(2));if(s.toLowerCase().startsWith("rgb"))return fromRgbFunc(s);if(/^[0-9a-fA-F]+$/.test(s)){let hex=fromHex(s);if(hex!==null)return hex}return/^\d+$/.test(s)?argbIntToRgba(Number.parseInt(s,10)):null}function fromHex(hex){let h=hex.trim();if(!/^[0-9a-fA-F]+$/.test(h))return null;if(h.length===3)return{r:dup(h[0]),g:dup(h[1]),b:dup(h[2]),a:1};if(h.length===6)return{r:byte(h,0),g:byte(h,2),b:byte(h,4),a:1};if(h.length===8){let a=byte(h,0);return{r:byte(h,2),g:byte(h,4),b:byte(h,6),a:a/255}}return null}function fromRgbFunc(input){let open=input.indexOf("("),close=input.indexOf(")");if(open<0||close<0||close<open)return null;let parts=input.slice(open+1,close).split(",").map(p=>p.trim());if(parts.length<3)return null;let r=clampByte(Number(parts[0])),g=clampByte(Number(parts[1])),b=clampByte(Number(parts[2]));if(r===null||g===null||b===null)return null;let a=1;if(parts.length>=4){let alpha=Number(parts[3]);if(!Number.isFinite(alpha))return null;a=Math.min(1,Math.max(0,alpha))}return{r:r,g:g,b:b,a:a}}function argbIntToRgba(n){if(!Number.isFinite(n))return null;let int2=Math.trunc(n)>>>0,a=int2>>>24&255;return{r:int2>>>16&255,g:int2>>>8&255,b:int2&255,a:a===0?1:a/255}}function byte(hex,at){return Number.parseInt(hex.slice(at,at+2),16)}function dup(nibble){return Number.parseInt(`${nibble??"0"}${nibble??"0"}`,16)}function clampByte(n){return Number.isFinite(n)?Math.min(255,Math.max(0,Math.round(n))):null}function rgbToHex(r,g,b){return`#${hex2(r)}${hex2(g)}${hex2(b)}`.toUpperCase()}function hex2(n){return n.toString(16).padStart(2,"0")}var NEAR_BLACK="#111111",WHITE="#FFFFFF",BLACK="#000000";function readableOn(background){let rgba=toRgba(background);if(rgba===null)return WHITE;let bg=relativeLuminance(rgba),black=relativeLuminance({r:17,g:17,b:17}),white=relativeLuminance({r:255,g:255,b:255});return luminanceContrast(bg,white)>=luminanceContrast(bg,black)?WHITE:NEAR_BLACK}function legibleOn(background,target){let first=readableOn(background);return contrastRatio(first,background)>=target?first:contrastRatio(WHITE,background)>=contrastRatio(BLACK,background)?WHITE:BLACK}function poleForGrounds(grounds){let worst=ink=>grounds.reduce((low,ground)=>Math.min(low,contrastRatio(ink,ground)),Number.POSITIVE_INFINITY);return worst(WHITE)>=worst(BLACK)?WHITE:BLACK}function relativeLuminance(rgba){let r=linearize(rgba.r/255),g=linearize(rgba.g/255),b=linearize(rgba.b/255);return.2126*r+.7152*g+.0722*b}function linearize(channel){return channel<=.03928?channel/12.92:Math.pow((channel+.055)/1.055,2.4)}function luminanceContrast(l1,l2){let lighter=Math.max(l1,l2),darker=Math.min(l1,l2);return(lighter+.05)/(darker+.05)}function contrastRatio(a,b){let fg=toRgba(a),bg=toRgba(b);if(fg===null||bg===null)return 1;let ground=bg.a>=1?bg:{...bg},fore=fg.a>=1?fg:composite(fg,ground);return luminanceContrast(relativeLuminance(fore),relativeLuminance(ground))}function composite(fg,bg){let a=fg.a,mix=(f,g)=>Math.round(f*a+g*(1-a));return{r:mix(fg.r,bg.r),g:mix(fg.g,bg.g),b:mix(fg.b,bg.b),a:1}}function flattenOnto(color,background){let fg=toRgba(color),bg=toRgba(background);if(fg===null||bg===null)return null;let out=fg.a>=1?fg:composite(fg,{...bg});return rgbToHex(out.r,out.g,out.b)}var PUSH_STEP=.05;function pushToContrast(color,grounds,pole,target){let first=grounds[0];if(first===void 0)return pole;let reads=candidate=>grounds.every(ground=>contrastRatio(candidate,ground)>=target);if(toRgba(color)===null)return pole;if(reads(color))return color;let flat=flattenOnto(color,first),from=flat===null?null:toRgba(flat),to=toRgba(pole);if(from===null||to===null)return pole;for(let step=1;step<1/PUSH_STEP;step+=1){let t=step*PUSH_STEP,mix=(a,b)=>Math.round(a+(b-a)*t),candidate=rgbToHex(mix(from.r,to.r),mix(from.g,to.g),mix(from.b,to.b));if(reads(candidate))return candidate}return pole}var RAPH_V3_LIGHT=/* @__PURE__ */Object.freeze({ink:"#262523",ink2:"#4A4845",ink3:"#6B6863",paper:"#F8F7F4",card:"#FFFFFF",line:"#E7E6E2",tile:"#F2F1EE",shadow:"rgba(38, 37, 35, .07)",riskBg:"#FFE3E1",riskInk:"#B0231B",riskDot:"#E5372B",clearBg:"#E6F4D3",clearInk:"#2F6A12",clearDot:"#5FA82B",watchDot:"#E5A000"}),cache2=/* @__PURE__ */new WeakMap;function v3Palette(theme){let hit=cache2.get(theme);if(hit!==void 0)return hit;let c=theme.color,dark=theme.brightness==="dark",neutrals=dark?{dark:dark,ink:c.text.primary,ink2:c.text.secondary,ink3:c.text.muted,paper:c.background,card:c.surface,line:c.borderRingCream,tile:c.surfaceSubtle,shadow:c.shadow,riskBg:c.badgeBgCritical,riskInk:c.danger,riskDot:c.danger,clearBg:c.badgeBgPositive,clearInk:c.success,clearDot:c.success,watchDot:c.warningStrong}:{dark:dark,...RAPH_V3_LIGHT},textOn=(ink,grounds)=>pushToContrast(ink,grounds,poleForGrounds(grounds),V3_TEXT_CONTRAST),labelOn=(ink,fill)=>contrastRatio(ink,fill)>=V3_TEXT_CONTRAST?ink:legibleOn(fill,V3_TEXT_CONTRAST),badgeGrounds=[neutrals.card,neutrals.paper].map(under=>flattenOnto(c.brandSoft,under)??under),brand={primary:c.primary,onPrimary:labelOn(c.onPrimary,c.primary),accent:c.accent,onAccent:labelOn(c.onAccent,c.accent),link:textOn(c.linkInk,[neutrals.card,neutrals.paper,neutrals.tile]),badge:c.brandSoft,onBadge:textOn(c.brandInk,badgeGrounds)},palette=/* @__PURE__ */Object.freeze({...neutrals,...brand});return cache2.set(theme,palette),palette}var V3_TEXT_CONTRAST=4.5;var PLAN_LIGHT=/* @__PURE__ */Object.freeze({black:"#000000",onInk:"#FFFFFF",wash:"rgba(38, 37, 35, 0.06)",scrim:"rgba(38, 37, 35, 0.38)",riskChip:"#FFD8D6",clearChip:"#DDEFC4"});function rgb(color){let c=color.trim(),h=/^#([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(c);if(h!==null){let x=h[1].length===3?h[1].split("").map(d=>d+d).join(""):h[1];return[0,2,4].map(k=>parseInt(x.slice(k,k+2),16))}let r=/^rgba?\(\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)/i.exec(c);return r===null?null:[Number(r[1]),Number(r[2]),Number(r[3])]}function mixPlanColor(color,share,ground){let a=rgb(color),b=rgb(ground);if(a===null||b===null)return ground;let to=k=>Math.round(a[k]*share+b[k]*(1-share)).toString(16).padStart(2,"0");return`#${to(0)}${to(1)}${to(2)}`.toUpperCase()}function clearOf(color){let c=rgb(color);return c===null?"transparent":`rgba(${c[0]}, ${c[1]}, ${c[2]}, 0)`}function planRoles(theme){let c=theme.color,v=v3Palette(theme),card=v.card,link=v.link;return{ink:v.ink,ink2:v.ink2,ink3:v.ink3,paper:v.paper,tile:v.tile,line:v.line,card:card,riskBg:v.riskBg,riskInk:v.riskInk,riskDot:v.riskDot,clearBg:v.clearBg,clearInk:v.clearInk,clearDot:v.clearDot,watchDot:v.watchDot,...v.dark?{black:c.text.primary,onInk:c.background,wash:mixPlanColor(c.text.primary,.08,c.surface),scrim:"rgba(0, 0, 0, 0.6)",riskChip:c.badgeBgCritical,clearChip:c.badgeBgPositive}:PLAN_LIGHT,primary:v.primary,onPrimary:v.onPrimary,accent:v.accent,accent4:mixPlanColor(c.accent,.17,card),accent3:mixPlanColor(c.accent,.25,card),accentChip:mixPlanColor(c.accent,.47,card),link:link,linkWash:(v.dark?void 0:theme.slots.planWash?.backgroundColor)??mixPlanColor(link,.12,card),linkChip:(v.dark?void 0:theme.slots.planChip?.backgroundColor)??mixPlanColor(link,.2,card)}}var TEXT_KEYS=/* @__PURE__ */new Set(["fontSize","fontWeight","fontFamily","fontStyle","letterSpacing","lineHeight","textTransform","color","textAlign","textDecorationLine","fontVariant"]),DROP=/* @__PURE__ */new Set(["justifyItems"]);function font(theme,family,weight){let w=Number(weight??400);if(family==="serif"){let h=headingFace(theme,"bold");return h.fontWeight===void 0?{fontFamily:h.fontFamily}:{fontFamily:h.fontFamily,fontWeight:String(w)}}let mono=family==="mono",key=w>=650?mono?"monoBold":"bold":w>=450?mono?"monoMedium":"medium":mono?"mono":"regular",f=face(theme,key);return theme.type.namedFaces[key]?{fontFamily:f.fontFamily}:{fontFamily:f.fontFamily,fontWeight:String(w)}}function paintPart(theme,roles,part,dark,line){let box={},text2={},colour=v=>{if(!v.startsWith("$"))return v;let name=v.slice(1);return name.startsWith("n_")?dark?line:`#${name.slice(2)}`:roles[name]??v},rings=[],inner;for(let[key,value]of Object.entries(part))if(!(value===void 0||DROP.has(key)||key==="grid"||key==="fontWeight"))if(key==="fontFamily")Object.assign(text2,font(theme,String(value),part.fontWeight));else if(key==="shadow"){if(value===null)Object.assign(box,{shadowOpacity:0,elevation:0});else if(!dark){let s=value;Object.assign(box,{shadowColor:colour(s.color),shadowOpacity:s.opacity,shadowRadius:s.blur,shadowOffset:{width:s.x,height:s.y},elevation:Math.max(1,Math.round(s.blur/2))})}}else if(key==="inner"){let r=value;inner=r===null?null:{position:"absolute",top:0,right:0,bottom:0,left:0,borderWidth:r.width,borderColor:colour(r.color),pointerEvents:"none"}}else if(key==="ring"){let list=value,radius=typeof part.borderRadius=="number"?part.borderRadius:0;rings=list.map((r,i)=>({borderWidth:r.width-(list[i-1]?.width??0),borderColor:colour(r.color),borderRadius:radius+r.width})).reverse()}else key==="color"||key==="backgroundColor"||key==="borderColor"?(key==="color"?text2:box)[key]=colour(String(value)):(TEXT_KEYS.has(key)?text2:box)[key]=value;part.fontWeight!==void 0&&part.fontFamily===void 0&&Object.assign(text2,font(theme,"sans",part.fontWeight));let outer=rings[0];if(outer!==void 0){let w=part.ring.reduce((m,r)=>Math.max(m,r.width),0),place2={...outer};if(box.position==="absolute"){for(let k of["position","zIndex"])box[k]!==void 0&&(place2[k]=box[k]);for(let k of["top","right","bottom","left"])typeof box[k]=="number"&&(place2[k]=box[k]-w);for(let k of["position","zIndex","top","right","bottom","left"])delete box[k]}else{for(let k of["marginTop","marginRight","marginBottom","marginLeft"])place2[k]=(typeof box[k]=="number"?box[k]:0)-w,delete box[k];box.alignSelf!==void 0&&(place2.alignSelf=box.alignSelf,delete box.alignSelf)}rings[0]=place2}return{box:box,text:text2,rings:rings,...inner===void 0?{}:{inner:inner},grid:part.grid??[]}}var cache3=/* @__PURE__ */new WeakMap;function planPaint(theme){let hit=cache3.get(theme);if(hit!==void 0)return hit;let roles=planRoles(theme),dark=theme.brightness==="dark",out={roles:roles};for(let[name,part]of Object.entries(RAPH_RN_PLAN))out[name]=paintPart(theme,roles,part,dark,roles.line);let painted=out;return cache3.set(theme,painted),painted}function gridCell(p,i){let t=p.grid[i];return t===void 0?{}:t==="fr"?{flexGrow:1,flexShrink:1,flexBasis:0,minWidth:0}:t==="auto"?{flexShrink:0}:typeof t=="number"?{width:t,flexShrink:0}:{}}var RADII=["borderRadius","borderTopLeftRadius","borderTopRightRadius","borderBottomRightRadius","borderBottomLeftRadius"],MARGINS=["margin","marginTop","marginRight","marginBottom","marginLeft","marginHorizontal","marginVertical"],draws=/* @__PURE__ */new WeakMap;function planDraw(X){let hit=draws.get(X);if(hit!==void 0)return hit;let list=names=>names.filter(n=>typeof n=="string"),draw={bx:(...names)=>list(names).map(n=>X[n].box),im:(...names)=>list(names).map(n=>X[n].box),tx:(...names)=>list(names).map(n=>X[n].text),tb:(...names)=>list(names).flatMap(n=>[X[n].box,X[n].text]),ring:(name,node,place2)=>{let rings=X[name].rings;return rings.length===0?node:rings.reduceRight((child,style,i)=>createElement(View,{key:i,style:i===0&&place2!==void 0?[style,place2]:style},child),node)},inner:(...names)=>{let ring=null,radius={};for(let n of list(names)){let p=X[n];p.inner!==void 0&&(ring=p.inner);for(let k of RADII)p.box[k]!==void 0&&(radius={...radius,[k]:p.box[k]})}return ring===null?null:createElement(View,{style:[ring,radius]})},ink:(name,fallback)=>typeof X[name].text.color=="string"?X[name].text.color:fallback,side:(name,fallback)=>typeof X[name].box.width=="number"?X[name].box.width:fallback,mod:(base3,kind)=>{if(kind===void 0||kind==="")return null;let name=`${base3}${kind.charAt(0).toUpperCase()}${kind.slice(1)}`;return name!=="roles"&&name in X?name:null},scroll:name=>{let place2={},content={};for(let[k,v]of Object.entries(X[name].box))(MARGINS.includes(k)?place2:content)[k]=v;return{place:place2,content:content}},swipe:(name,inner)=>{let b=X[name].box,share=typeof b.flexBasis=="string"&&b.flexBasis.endsWith("%")?Number(b.flexBasis.slice(0,-1))/100:1,max=typeof b.maxWidth=="number"?b.maxWidth:1/0;return Math.round(Math.min(max,inner*share)*100)/100}};return draws.set(X,draw),draw}var PLAN_PRESS_SCALE=/* @__PURE__ */Object.freeze({button:.97,onButton:.96,jump:.98,opt:.98,add:.98,extraGo:.96,every:.96,askRow:.98,stepper:.9,mode:.98,order:.98});function pressScale(style,scale,off){return off?style:({pressed:pressed})=>pressed?[style,{transform:[{scale:scale}]}]:style}function focusPalette(theme){let c=theme.color;if(theme.brightness==="dark")return{ink:c.text.primary,ink2:c.text.secondary,ink3:c.text.muted,paper:c.surfaceSubtle,tile:c.badgeBgNeutral,line:c.brandBorder,card:c.surface,teal:c.brandInk,cyan:c.brandSofter,yellow:c.accent,riskDot:c.errorRed,riskBg:c.badgeBgCritical,riskInk:c.text.primary,clearDot:c.success,clearBg:c.badgeBgPositive,clearInk:c.text.primary,star:c.accent,button:c.primary,onButton:c.onPrimary,jump:c.surfaceSubtle,onJump:c.text.primary,jumpSmall:c.accent,tints:{y:c.badgeBgCaution,c:c.brandSofter,g:c.badgeBgPositive,r:c.badgeBgCritical},scrim:"rgba(0,0,0,0.6)"};let v=v3Palette(theme);return{ink:v.ink,ink2:v.ink2,ink3:v.ink3,paper:v.paper,tile:v.tile,line:v.line,card:v.card,teal:c.brandInk,cyan:c.brandSofter,yellow:v.accent,riskDot:v.riskDot,riskBg:v.riskBg,riskInk:v.riskInk,clearDot:v.clearDot,clearBg:v.clearBg,clearInk:v.clearInk,star:v.watchDot,button:v.primary,onButton:v.onPrimary,jump:v.ink,onJump:v.card,jumpSmall:v.accent,tints:{y:"#FFE7A1",c:"#C8F4F8",g:"#DDEFC4",r:"#FFD8D6"},scrim:"rgba(38,37,35,0.45)"}}function makeFocusStyles(theme){let P=focusPalette(theme),{space:space}=theme,t=(size,ink,weight="regular",ratio=1.35)=>({...face(theme,weight),fontSize:size,lineHeight:Math.round(size*ratio),color:ink}),s=StyleSheet.create({shrink:{flexShrink:1,minWidth:0},row:{flexDirection:"row",alignItems:"center",gap:space.sm},toolLabel:t(14,P.ink,"bold"),mini:{...t(10.5,P.ink3,"mono"),textTransform:"uppercase",letterSpacing:.9},h3:{...t(19,P.ink,"bold",1.2),marginTop:space.sm},bold:face(theme,"bold"),noPick:{...t(15,P.ink2,"regular",1.45),marginTop:14},pickTop:{flexDirection:"row",alignItems:"flex-start",gap:space.md},h4:t(17,P.ink,"bold",1.3),small:t(13,P.ink3,"regular",1.35),smallInk:t(13,P.ink2,"regular",1.35),opts:{gap:space.sm,marginTop:space.md},opt:{flexDirection:"row",alignItems:"flex-start",justifyContent:"space-between",gap:space.sm,padding:14,borderRadius:16,borderWidth:1.5,borderColor:"#DEDCD7"},optOn:{borderWidth:2.5,borderColor:P.ink},priceText:t(17,P.ink,"bold",1.2),strike:{...t(13,P.ink3,"regular",1.2),textDecorationLine:"line-through"},buttonGhost:{minHeight:48,borderRadius:999,alignItems:"center",justifyContent:"center",paddingHorizontal:space.lg,borderWidth:2,borderColor:P.ink,marginTop:space.sm},buttonGhostText:{...t(15,P.ink,"bold",1.2),textAlign:"center"},disabled:{opacity:.5},fine:{...t(13,P.ink3,"regular",1.4),marginTop:space.sm},notice:{marginTop:space.sm,padding:space.md,borderRadius:14,backgroundColor:P.riskBg},noticeText:t(14,P.riskInk,"medium",1.35),scrim:{flex:1,justifyContent:"flex-end",backgroundColor:P.scrim},sheet:{maxHeight:"92%",paddingHorizontal:space.lg,paddingTop:space.sm,paddingBottom:space.xl,borderTopLeftRadius:22,borderTopRightRadius:22,backgroundColor:P.card},sheetGrab:{alignSelf:"center",width:40,height:4,borderRadius:2,backgroundColor:P.line,marginBottom:space.sm},sheetTop:{flexDirection:"row",alignItems:"center",justifyContent:"space-between"},close:{width:44,height:44,alignItems:"center",justifyContent:"center"},screen:{paddingHorizontal:space.lg,paddingBottom:space.xl,gap:space.sm},back:{flexDirection:"row",alignItems:"center",gap:space.xs,minHeight:44,alignSelf:"flex-start"},done:{alignItems:"center",gap:space.sm,paddingTop:space.xl},doneCheck:{width:56,height:56,borderRadius:28,alignItems:"center",justifyContent:"center",backgroundColor:P.clearBg},doneTitle:{...t(29,P.ink,"bold",1.1),...headingFace(theme,"bold"),textAlign:"center"},doneWhen:{...t(15,P.ink2,"regular",1.4),textAlign:"center"},next:{alignSelf:"stretch",gap:space.sm,marginTop:space.md},nextRow:{flexDirection:"row",alignItems:"center",gap:space.sm},nextIcon:{width:36,height:36,borderRadius:18,alignItems:"center",justifyContent:"center",backgroundColor:P.tile},shopItem:{flexDirection:"row",alignItems:"flex-start",gap:space.md},shopImage:{width:64,height:64,borderRadius:14,backgroundColor:P.paper,alignItems:"center",justifyContent:"center"},stepper:{flexDirection:"row",alignItems:"center",gap:space.xs,borderRadius:999,borderWidth:1.5,borderColor:P.line},stepperButton:{width:44,height:44,alignItems:"center",justifyContent:"center"},modeRow:{flexDirection:"row",gap:space.xs,marginTop:space.xs},modeButton:{flex:1,minWidth:0,minHeight:44,padding:space.sm,borderRadius:12,borderWidth:1.5,borderColor:"#DEDCD7"},chips:{flexDirection:"row",flexWrap:"wrap",gap:space.xs,marginTop:space.xs},chipButton:{minHeight:44,paddingHorizontal:space.md,borderRadius:22,borderWidth:1.5,borderColor:"#DEDCD7",justifyContent:"center"},summary:{gap:space.xs,paddingVertical:space.sm},summaryRow:{flexDirection:"row",justifyContent:"space-between",gap:space.sm},summaryTotal:t(17,P.ink,"bold",1.3),input:{...t(21,P.ink,"mono",1.2),flex:1,minHeight:48,paddingHorizontal:space.md,borderRadius:12,borderWidth:1.5,borderColor:P.line,backgroundColor:P.card}}),X=planPaint(theme);return{...s,palette:P,X:X,D:planDraw(X)}}var SHEET_MOTION={in:320,out:220,inCurve:"drawer",outCurve:"out"},SCRIM_MOTION={in:240,out:200,inCurve:"ease",outCurve:"ease"},PUSH_MOTION={in:300,out:220,inCurve:"drawer",outCurve:"out"},TOAST_MOTION={in:220,out:160,inCurve:"out",outCurve:"out"},FADE_MOTION={in:160,out:160,inCurve:"ease",outCurve:"ease"},curves={};function curve(name){let made=curves[name];if(made!==void 0)return made;let[a,b,c,d]=name==="drawer"?[.32,.72,0,1]:name==="out"?[.23,1,.32,1]:[.25,.1,.25,1],built=Easing.bezier(a,b,c,d);return curves[name]=built,built}function run(values,motions,open,done){let left=motions.length,drivers=motions.map((m,i)=>Animated.timing(values[i],{toValue:open?1:0,duration:open?m.in:m.out,easing:curve(open?m.inCurve:m.outCurve),useNativeDriver:true}));for(let d of drivers)d.start(({finished:finished})=>{left-=1,finished&&left===0&&done()});return()=>{for(let d of drivers)d.stop()}}function PlanLinger({draw:draw,motions:motions}){let open=draw!==null,[kept,setKept]=useState(null);open&&kept?.draw!==draw&&setKept({draw:draw});let a=useRef(new Animated.Value(0)).current,b=useRef(new Animated.Value(0)).current,values=[a,b];useEffect(()=>{if(!(!open&&kept===null))return run(values,motions,open,()=>{open||setKept(null)})},[open]);let current=draw??kept?.draw;return current===void 0?null:current(values)}function PlanPushes({id:id,depth:depth,node:node,width:width,paper:paper,still:still}){let[at,setAt]=useState({id:id,depth:depth,node:node,leaving:null}),moved=id!==at.id;(moved||node!==at.node)&&setAt({id:id,depth:depth,node:node,leaving:moved?depth<at.depth?at.node:null:at.leaving});let enter=useRef(new Animated.Value(1)).current,exit=useRef(new Animated.Value(1)).current,motion=still?FADE_MOTION:PUSH_MOTION,last=useRef(depth);useLayoutEffect(()=>{let from=last.current;if(last.current=depth,depth>from)return enter.setValue(0),run([enter],[motion],true,()=>{});if(depth!==from)return exit.setValue(1),run([exit],[motion],false,()=>setAt(s=>({...s,leaving:null})))},[id]);let look=v=>still?{opacity:v}:{transform:[{translateX:v.interpolate({inputRange:[0,1],outputRange:[width,0]})}]};/* @__PURE__ */
|
|
119
|
+
return Object.freeze({reason:userFacingError("accessDenied"),level:"user_entitlement",recoverable:false})}function freezeDecision(d){let base3={name:d.name,enabled:d.enabled,isPending:d.isPending,limits:/* @__PURE__ */Object.freeze({...d.limits})};return d.disabled!==void 0&&(base3.disabled=d.disabled),/* @__PURE__ */Object.freeze(base3)}function useCapability(name){let{runtime:runtime}=useEverfurContext(),store=runtime.entitlements,snapshot=useSyncExternalStore(store.subscribe,store.getSnapshot,store.getSnapshot);return useMemo(()=>decideCapability(name,snapshot.decisions,{isPending:snapshot.isPending}),[name,snapshot])}var MIN_OFFSTATE_HEIGHT=48;function selectView(decision){return decision.isPending?"pending":decision.enabled?"enabled":"disabled"}function CapabilityGate(props){let{capability:capability,children:children,renderDisabled:renderDisabled,renderPending:renderPending,style:style}=props,decision=useCapability(capability),view=useMemo(()=>selectView(decision),[decision]);switch(view){case"enabled":return children;case"pending":return renderPending?/* @__PURE__ */jsx(HostRender,{render:renderPending,fallback:/* @__PURE__ */jsx(PendingSkeleton,{capability:capability,style:style})}):/* @__PURE__ */jsx(PendingSkeleton,{capability:capability,style:style});case"disabled":return renderDisabled?/* @__PURE__ */jsx(HostRender,{render:()=>renderDisabled(decision),fallback:/* @__PURE__ */jsx(OffState,{decision:decision,style:style}),resetKey:decision}):/* @__PURE__ */jsx(OffState,{decision:decision,style:style});default:return assertNever(view)}}function PendingSkeleton({capability:capability,style:style}){let theme=useEverfurTheme(),styles2=useMemo(()=>makeStyles(theme),[theme]);/* @__PURE__ */
|
|
120
|
+
return jsx(View,{style:[styles2.offstate,style],accessible:true,accessibilityState:{busy:true},accessibilityLabel:`Loading ${capability}`,children:/* @__PURE__ */jsx(View,{style:styles2.skeletonBar})})}function OffState({decision:decision,style:style}){let theme=useEverfurTheme(),styles2=useMemo(()=>makeStyles(theme),[theme]),message=decision.disabled?.reason??"";/* @__PURE__ */
|
|
121
|
+
return jsx(View,{style:[styles2.offstate,style],accessible:true,accessibilityRole:"text",accessibilityLabel:message,children:message.length>0?/* @__PURE__ */jsx(Text,{style:styles2.offstateText,children:message}):null})}function makeStyles(theme){let{color:color,space:space,radius:radius,type:type}=theme;return StyleSheet.create({offstate:{minHeight:MIN_OFFSTATE_HEIGHT,justifyContent:"center",paddingHorizontal:space.lg,paddingVertical:space.md,backgroundColor:color.surfaceCream,borderRadius:radius.md,borderWidth:StyleSheet.hairlineWidth,borderColor:color.brandBorder},offstateText:{...face(theme,"regular"),fontSize:type.size.body,lineHeight:Math.round(type.size.body*type.lineHeight.normal),color:color.text.muted},skeletonBar:{height:space.md,borderRadius:radius.xs,backgroundColor:color.brandSofter}})}function slotBox(slot,borderWidth){if(slot===void 0)return{};let out={};return slot.backgroundColor!==void 0&&(out.backgroundColor=slot.backgroundColor),slot.borderColor!==void 0&&(out.borderColor=slot.borderColor,out.borderWidth=borderWidth??1),slot.borderRadius!==void 0&&(out.borderRadius=slot.borderRadius),out}function slotText(slot){return slot?.textColor===void 0?{}:{color:slot.textColor}}function HealthPlanCartBar(props){let{cart:cart,onCheckout:onCheckout,busy:busy=false,priceFormat:priceFormat,style:style}=guardHostProps(props,["onCheckout"]),theme=useEverfurTheme(),styles2=useMemo(()=>makeStyles2(theme),[theme]),subtotal=formatHealthPlanPriceWith(cart.subtotal,cart.currency,priceFormat),disabled=cart.count===0||busy,telemetry=useHealthPlanTelemetry(),petRef=useHealthPlanBarPet(useHealthPlanCartDock()?.petRef);/* @__PURE__ */
|
|
122
|
+
return jsxs(View,{style:[styles2.bar,style],accessibilityLabel:HEALTH_PLAN_TEMPLATES.cartLabel(theme.meta.displayName),children:[
|
|
123
|
+
/* @__PURE__ */jsxs(View,{style:styles2.copy,children:[
|
|
124
|
+
/* @__PURE__ */jsxs(View,{style:styles2.labelRow,children:[
|
|
125
|
+
/* @__PURE__ */jsx(Text,{style:styles2.label,children:HEALTH_PLAN_TEMPLATES.cartLabel(theme.meta.displayName)}),cart.count>0?/* @__PURE__ */jsx(View,{style:styles2.count,accessibilityElementsHidden:true,importantForAccessibility:"no",children:/* @__PURE__ */jsx(Text,{tier:"badge",style:styles2.countLabel,children:String(cart.count)})}):null]}),cart.count===0?/* @__PURE__ */jsx(Text,{style:styles2.line,children:HEALTH_PLAN_COPY.cartEmpty}):subtotal===null?null:/* @__PURE__ */jsxs(Text,{style:styles2.line,children:[HEALTH_PLAN_COPY.subtotal," ",subtotal]})]}),onCheckout===void 0?null:/* @__PURE__ */jsx(Pressable,{onPress:()=>{trackCheckoutStarted(telemetry,petRef,cart),onCheckout(cart.items)},disabled:disabled,accessibilityRole:"button",accessibilityLabel:HEALTH_PLAN_COPY.checkout,accessibilityState:{disabled:disabled,busy:busy},style:[styles2.checkout,disabled?styles2.dimmed:null],testID:"health-plan-checkout",children:/* @__PURE__ */jsx(Text,{tier:"control",style:styles2.checkoutLabel,children:HEALTH_PLAN_COPY.checkout})})]})}function makeStyles2(theme){let{color:color,radius:radius,space:space,type:type,slots:slots}=theme,ink=slots.cartBar?.textColor??color.text.onBrand,fill=slots.cartBar?.backgroundColor??color.brandInk,text2=(size,tint,weight)=>({...face(theme,weight),fontSize:size,lineHeight:Math.round(size*type.lineHeight.snug),color:tint});return StyleSheet.create({bar:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",gap:space.md,paddingHorizontal:space.lg,paddingVertical:space.md,borderRadius:radius.lg,backgroundColor:color.brand,...slotBox(slots.cartBar)},copy:{flex:1,gap:2},labelRow:{flexDirection:"row",alignItems:"center",gap:space.sm},label:text2(type.size.body,ink,"bold"),count:{minWidth:22,height:22,paddingHorizontal:space.xs,borderRadius:radius.pill,alignItems:"center",justifyContent:"center",backgroundColor:ink},countLabel:text2(type.size.caption,fill,"bold"),line:text2(type.size.caption,ink,"regular"),checkout:{minHeight:44,paddingHorizontal:space.lg,borderRadius:radius.pill,alignItems:"center",justifyContent:"center",backgroundColor:ink},checkoutLabel:text2(type.size.body,fill,"bold"),dimmed:{opacity:.5}})}var LB_PER_KG=2.20462262;function healthPlanWeightForSave(entered,inKg){return{weightKg:inKg?entered:Math.round(entered/LB_PER_KG*100)/100,pounds:inKg?Math.round(entered*LB_PER_KG*10)/10:entered}}var SIGNALS_SYMBOL=/* @__PURE__ */Symbol.for("@everfur/sdk#HealthPlanSignals@v1"),signalHost=globalThis;function isSignalState(value){if(typeof value!="object"||value===null)return false;let v=value;return v.landed instanceof Set&&v.noVet instanceof Set&&v.noVetByPet instanceof Map}var stored=signalHost[SIGNALS_SYMBOL],fresh=()=>({landed:/* @__PURE__ */new Set,noVet:/* @__PURE__ */new Set,noVetByPet:/* @__PURE__ */new Map}),state=isSignalState(stored)?stored:signalHost[SIGNALS_SYMBOL]=fresh(),landedListeners=state.landed,noVetListeners=state.noVet,noVetByPet=state.noVetByPet;function notifyHealthPlanRecordsLanded(petRef,source="host"){for(let listener of[...landedListeners])try{listener(petRef,source)}catch{}}function onHealthPlanRecordsLanded(listener){return landedListeners.add(listener),()=>{landedListeners.delete(listener)}}function setHealthPlanNoVet(petRef,noVet){if((noVetByPet.get(petRef)??false)!==noVet){noVet?noVetByPet.set(petRef,true):noVetByPet.delete(petRef);for(let listener of[...noVetListeners])try{listener(petRef,noVet)}catch{}}}function healthPlanNoVet(petRef){return noVetByPet.get(petRef)??false}function onHealthPlanNoVet(listener){return noVetListeners.add(listener),()=>{noVetListeners.delete(listener)}}function healthPlanPetWords(name,sex){let n=name?.trim()??"",named=n===""?"your pet":n,Named=n===""?"Your pet":n;return sex==="female"?{name:named,Name:Named,poss:"her",Poss:"Her",obj:"her"}:sex==="male"?{name:named,Name:Named,poss:"his",Poss:"His",obj:"him"}:{name:named,Name:Named,poss:`${named}'s`,Poss:`${Named}'s`,obj:named}}var cartRenewal=p=>p===null?"":`${p.productName} renews every ${p.intervalDays} days at ${p.box??""} until you cancel; skip or cancel anytime in the app.`,HEALTH_PLAN_NO_SHIP_DAY_COPY=/* @__PURE__ */Object.freeze({onceFine:"",cartFine:cartRenewal,startedWhat:()=>""});function healthPlanFocusCopyFor(pet){let w=healthPlanPetWords(pet.name,pet.sex),nameOf=p=>p.petName?.trim()||w.name,NameOf=p=>p.petName?.trim()||w.Name,copy=/* @__PURE__ */Object.freeze({jumpKicker:(p,subscribed)=>subscribed?`In ${w.poss} plan, every ${p.intervalDays} days`:p.offer?`${p.discountPercent}% off ${w.poss} first box`:p.intervalDays>0?`Ships every ${p.intervalDays} days`:copy.onceLine(p),optionsLabel:"How to buy",subscribe:"Subscribe",bestValue:"Best value",subscribeLine:p=>p.offer?`First box, then ${p.box??""}`:`${p.box??""} every ${p.intervalDays} days`,priceLine:p=>p.offer?`${p.discountPercent}% off the first box. Ships every ${p.intervalDays} days.`:p.intervalDays>0?`Ships every ${p.intervalDays} days.`:copy.onceOffer(p),once:"One box",onceLine:p=>p.onceDiscountPercent>0?`${p.onceDiscountPercent}% off, ships once`:"Ships once",buyOnce:p=>`Buy one box, ${p.once??p.box??""}`,subscribed:"Subscribed",subscribedLine:(p,next)=>next===null?`Every ${p.intervalDays} days`:`Every ${p.intervalDays} days · next box ${next}`,manage:"Manage",checkoutKicker:"Checkout",checkoutTitle:p=>`Checkout: ${p.productName}`,checkoutOffer:p=>`${p.discountPercent}% off your first box.`,shipsEvery:"Ships every",days:n=>`${n} days`,buyOnceOption:"Buy once",checkoutGo:(_p,subscribe,today)=>`${subscribe?"Subscribe":"Buy now"} · ${today} today`,renews:p=>`Renews every ${p.intervalDays} days at ${p.box??""} until you cancel; skip or cancel anytime in the app.`,onceFine:"One box, ships tomorrow.",onceOffer:p=>p.onceDiscountPercent>0?`${p.onceDiscountPercent}% off, ships once.`:"Ships once.",checkoutNote:"",close:"Close",startedTitle:p=>`${NameOf(p)}'s plan has started.`,orderedTitle:()=>"Order placed.",startedWhat:p=>`${p.productName} ships tomorrow.`,startedNote:"",startedSteps:"What happens next",tomorrow:"Tomorrow",firstBoxShips:`${w.Poss} first box ships.`,trackingComesByText:"Tracking comes by text.",checkin:q=>q===null?"A 2-week check-in by text.":`A 2-week check-in by text: ${q}`,refill:`A text 3 days before ${w.poss} next box. Reply SKIP to skip it.`,nextBoxShips:p=>`${w.Poss} next box ships, ${p.box??""}.`,startedDone:`Back to ${w.poss} plan`,manageKicker:"Your subscription",manageTitle:p=>`Manage ${p.productName}`,skip:"Skip the next box",cancel:"Cancel subscription",skipped:(_p,next)=>next===null?"Skipped.":`Skipped. ${w.Poss} next box ships ${next}.`,cancelled:p=>`${p.productName} is cancelled. Restart it from ${w.poss} plan anytime.`,orders:"Orders",startedHeader:"Subscribed",placedHeader:"Order placed",cartCheckoutTitle:"Checkout",orderNote:"",cartLabel:n=>n>0?`Cart, ${n} item${n>1?"s":""}`:"Cart, empty",addToCart:price=>`Add to cart · ${price}`,viewCart:"View cart",addedToCart:(p,subscription)=>`${p.productName} is in your cart${subscription?", as a subscription":""}.`,removedFromCart:name=>`${name} is out of your cart.`,cartTitle:"Cart",cartEmptyTitle:"Your cart is empty",cartEmptyBody:p=>`${NameOf(p)}'s plan pick lands here when you add it.`,seeOrders:`See ${w.poss} orders`,quantityLabel:name=>`How many: ${name}`,fewer:"One fewer",more:"One more",remove:"Remove",cartSubLine:p=>p.offer?`First box ${p.discountPercent}% off, then ${p.box??""} every ${p.intervalDays} days`:`Every ${p.intervalDays} days`,cartOnceLine:(p,subscribed)=>subscribed?`An extra box. ${w.Poss} plan keeps shipping.`:p.onceDiscountPercent>0?`One box, ${p.onceDiscountPercent}% off`:"One box",cartModeLabel:name=>`How to buy ${name}`,cartModeSubscribe:p=>p.offer?`Subscribe, ${p.discountPercent}% off the first box`:"Subscribe",cartModeOnce:p=>p.onceDiscountPercent>0?`One box, ${p.onceDiscountPercent}% off`:"One box",subtotal:"Subtotal",shipping:"Shipping",shippingValue:"",shippingTag:"",total:"Total",dueToday:"Due today",thenRenews:p=>`Then ${p.productName}`,renewsEvery:p=>`${p.box??""} every ${p.intervalDays} days`,checkoutCart:total=>`Checkout · ${total}`,cartOneAtATime:"",cartSubscriptionApart:"",cartItemSubscription:p=>`Subscription, every ${p.intervalDays} days`,cartItemQuantity:n=>`Qty ${n}`,placeOrder:(total,subscribe)=>`${subscribe?"Place order and subscribe":"Place order"} · ${total}`,cartFine:p=>`${p===null?"":`${cartRenewal(p)} `}Ships tomorrow.`,placedSteps:"What's coming",placedShips:"It ships.",placedArrives:"It arrives at home.",viewOrder:"View order",herSubscription:`${w.Poss} subscription`,nextBox:day=>`Next box ${day}`,everyDays:n=>`Every ${n} days`,ordersHeading:afterSubscription=>afterSubscription?"Orders":`${w.Poss} orders`,ordersFine:"",ordersEmptyTitle:"No orders yet",ordersEmptyBody:p=>`The boxes from ${nameOf(p)}'s plan show up here.`,moreOrders:"",orderSteps:["Ordered","Shipped","Out for delivery","Delivered"],subscriptionBox:"Subscription box",orderTitle:n=>n===null?"Order":`Order ${n}`,arrivesBy:day=>`Arrives by ${day}`,deliveredOn:day=>`Delivered ${day}`,expected:day=>`Expected ${day}`,tracking:"Tracking",trackingByText:"The tracking number comes by text when it ships.",trackOn:carrier=>`Track on ${carrier}`,trackLink:"",inThisOrder:"In this order",orderItemLine:(n,box)=>`Qty ${n}${box?" · subscription box":""}`,paidWith:"Paid with",buyAgain:"Buy again",orderHelp:"Get help with this order",addWeightTitle:`Add ${w.poss} weight to size ${w.poss} dose`,addWeightBody:`From a home scale or ${w.poss} last vet visit.`,connectRecordsTitle:`Connect ${w.poss} vet records`,connectRecordsBody:`${w.Poss} weight, visits and labs make ${w.poss} plan sharper.`,weightKicker:`${w.Poss} weight`,weightTitle:p=>`Add ${nameOf(p)}'s weight`,weightBody:`From a home scale or ${w.poss} last vet visit. ${w.Poss} plan uses it to size ${w.poss} dose.`,weightField:`${w.Poss} weight`,weightUnit:"lb",weightUnitKg:"kg",weightErrorKg:"Enter your pet’s weight",weightError:`Enter ${w.poss} weight in pounds, like 14.1.`,weightSave:`Save ${w.poss} weight`,weightSaved:lb=>`Saved: ${lb} lb. ${w.Poss} dose is sized for ${w.obj}.`,weightSavedKg:kg=>`Saved: ${kg} kg. ${w.Poss} dose is sized for ${w.obj}.`,checkoutFailed:"That didn't go through. Please try again.",builtWith:vet=>`Built with ${vet}`,fromVet:shortName=>`From ${shortName}`,waitVetTips:vet=>`Free tips from ${vet}, built around that risk`,signalsFit:count=>`${count} of ${count} signals fit ${w.Name}`,signalsValue:count=>`${count}/${count}`,noPick:`No supplement for this one. ${w.Poss} vet comes first.`,callYourVet:"Call your vet today",callAVet:"Call a vet today",saveForCheckup:`Save for ${w.poss} next checkup`,savedForCheckup:`Saved for ${w.poss} next checkup`,blanksLabel:`${w.Poss} three blanks`,blanksAsked:clinic=>`Asked ${clinic}`,blanksAskedNoClinic:"",blanksWaitPill:"2 to 5 days",blanksFilledKicker:`From ${w.poss} vet records`,blanksFilled:(filled,total)=>`${filled} of ${total} filled`,blanksWeight:`Keep ${w.obj} at `,blanksWeightSource:`From ${w.poss} vet visits`,blanksDose:(dose,product)=>`${dose} of ${product}`,blanksDoseSource:`Sized to ${w.poss} weight`,blanksShots:`${w.Poss} next shots are due `,blanksShotsSource:`From ${w.poss} clinic`,blankEmpty:"blank",recordsLanded:`${w.Poss} records are in. ${w.Poss} plan now uses ${w.poss} weight and ${w.poss} visits.`});return copy}var HEALTH_PLAN_FOCUS_COPY=healthPlanFocusCopyFor({sex:"female"});function formatHealthPlanDay(iso,locale){if(iso===null||!/^\d{4}-\d{2}-\d{2}$/.test(iso))return null;let d=/* @__PURE__ */new Date(`${iso}T00:00:00Z`);if(Number.isNaN(d.getTime()))return null;try{return new Intl.DateTimeFormat(locale??"en-US",{month:"short",day:"numeric",timeZone:"UTC"}).format(d)}catch{return iso}}function useHealthPlanSubscriptionRepository(){let{runtime:runtime}=useEverfurContext();return useMemo(()=>createHealthPlanSubscriptionRepository(runtime),[runtime])}function useHealthPlanSubscription(options){let{userRef:userRef}=useEverfurContext(),own=useHealthPlanSubscriptionRepository(),repository=options.repository??own,enabled=options.enabled!==false&&userRef!==null&&options.petRef!==null&&options.productId!==null,{petRef:petRef,productId:productId}=options,[phase,setPhase]=useState("idle"),[quote,setQuote]=useState(null),[subscription,setSubscription]=useState(null),[busy,setBusy]=useState(false),[error,setError]=useState(null),[readyAt,setReadyAt]=useState(null),epoch=useRef(0),writes=useRef(0),quiet=useRef(0),busyRef=useRef(false),refreshAfterWrite=useRef(false),revalidateRef=useRef(()=>Promise.resolve()),load=useCallback(async()=>{let mine=++epoch.current;if(refreshAfterWrite.current=false,setReadyAt(null),!enabled||petRef===null||productId===null){setPhase("idle"),setQuote(null),setSubscription(null);return}setPhase("loading");let res=await repository.quote(petRef,productId);if(mine===epoch.current){if(!res.ok){setQuote(null),setSubscription(null),setError(res.error),setPhase(isHealthPlanSubscriptionUnavailable(res.error)?"unavailable":"failed");return}setError(null),setQuote(res.value),setSubscription(res.value.subscription),setPhase("ready"),setReadyAt(Date.now())}},[enabled,petRef,productId,repository]),ready=enabled&&phase==="ready",revalidate=useCallback(async()=>{if(!ready||busyRef.current||petRef===null||productId===null)return;let mine=epoch.current,wrote=writes.current,seq=++quiet.current,res=await repository.quote(petRef,productId);mine!==epoch.current||wrote!==writes.current||seq!==quiet.current||busyRef.current||!res.ok||(setQuote(res.value),setSubscription(res.value.subscription),setReadyAt(Date.now()))},[ready,petRef,productId,repository]);revalidateRef.current=revalidate;let refreshOnKey=()=>{if(!ready){load();return}if(busyRef.current){refreshAfterWrite.current=true;return}revalidate()};useHealthPlanRevalidation({lifecycle:options.lifecycle,refreshKey:options.refreshKey,readyAt:ready?readyAt:null,revalidate:()=>{revalidate()},refresh:refreshOnKey});let settleWrite=useCallback(()=>{refreshAfterWrite.current&&(refreshAfterWrite.current=false,revalidateRef.current())},[]);useEffect(()=>(load(),()=>{epoch.current+=1}),[load]);let write2=useCallback(async run2=>{let mine=epoch.current;writes.current+=1,busyRef.current=true,setBusy(true);let res=await run2();return busyRef.current=false,mine!==epoch.current?res:(setBusy(false),res.ok?(setError(null),setSubscription(res.value),settleWrite(),res):(setError(res.error),isHealthPlanSubscriptionUnavailable(res.error)?setPhase("unavailable"):settleWrite(),res))},[settleWrite]),buy=useCallback(async tapKey=>{let mine=epoch.current;writes.current+=1,busyRef.current=true,setBusy(true);let res=await repository.buyOneBox(petRef,productId,tapKey);return busyRef.current=false,mine!==epoch.current?res:(setBusy(false),res.ok?(setError(null),load(),res):(setError(res.error),isHealthPlanSubscriptionUnavailable(res.error)?setPhase("unavailable"):settleWrite(),res))},[repository,petRef,productId,load,settleWrite]);return useMemo(()=>{let p=petRef,sid=subscription?.subscriptionId??"",none=()=>Promise.resolve(err(makeEverfurError("validationFailed",{retryable:false,wireMessage:"the subscription quote is not ready"})));return{phase:phase,quote:quote,subscription:subscription,busy:busy,error:error,subscribe:n=>ready&&productId!==null?write2(()=>repository.create(p,productId,n)):none(),changeInterval:n=>ready&&sid!==""?write2(()=>repository.changeInterval(p,sid,n)):none(),skip:()=>ready&&sid!==""?write2(()=>repository.skip(p,sid)):none(),cancel:()=>ready&&sid!==""?write2(()=>repository.cancel(p,sid)):none(),restart:n=>ready&&sid!==""?write2(()=>repository.restart(p,sid,n)):none(),buyOneBox:k=>ready&&productId!==null?buy(k):none(),refresh:load}},[phase,quote,subscription,busy,error,ready,petRef,productId,repository,write2,buy,load])}var BLANKS_MEMO_KV_PREFIX="everfur.healthPlan.blanks",NONE=/* @__PURE__ */Object.freeze({waited:null,flashed:null}),memos=/* @__PURE__ */new Map,loads=/* @__PURE__ */new Map,keyOf2=petRef=>`${BLANKS_MEMO_KV_PREFIX}:${petRef}`;function parse(raw){if(raw===null)return NONE;try{let o=JSON.parse(raw);if(o===null||typeof o!="object")return NONE;let r=o;return{waited:typeof r.waited=="string"?r.waited:null,flashed:typeof r.flashed=="string"?r.flashed:null}}catch{return NONE}}function loadBlanksMemo(kv,petRef){let own=memos.get(petRef);if(own!==void 0)return Promise.resolve(own);let load=loads.get(petRef);return load===void 0&&(load=(async()=>{let read=NONE;try{read=kv?parse(await kv.getItem(keyOf2(petRef))):NONE}catch{}let memo=memos.get(petRef)??read;return memos.set(petRef,memo),memo})(),loads.set(petRef,load)),load}function blanksMemo(petRef){return memos.get(petRef)??NONE}function setBlanksMemo(kv,petRef,memo){if(memos.set(petRef,memo),!!kv)try{kv.setItem(keyOf2(petRef),JSON.stringify(memo)).catch(()=>{})}catch{}}var RAPH_RN_PLAN=/* @__PURE__ */Object.freeze({root:{backgroundColor:"$paper",color:"$ink",fontFamily:"sans",fontSize:17,lineHeight:25.5,paddingBottom:28,paddingLeft:16,paddingRight:16,paddingTop:16},pageFine:{color:"$ink3",fontFamily:"sans",fontSize:12.5,lineHeight:18.13,marginBottom:0,marginLeft:0,marginRight:0,marginTop:16,textAlign:"center"},tools:{alignItems:"center",color:"$ink",flexDirection:"row",fontFamily:"sans",fontSize:17,gap:8,justifyContent:"space-between",lineHeight:25.5,marginBottom:2,marginLeft:2,marginRight:-6,marginTop:-8},toolsEyebrow:{color:"$ink3",fontFamily:"mono",fontSize:11,letterSpacing:.77,lineHeight:16.5,marginBottom:0,marginLeft:0,marginRight:0,marginTop:0,textTransform:"uppercase"},toolsEnd:{alignItems:"center",color:"$ink",flexDirection:"row",fontFamily:"sans",fontSize:17,gap:2,lineHeight:25.5},orders:{alignItems:"center",alignSelf:"flex-start",backgroundColor:"transparent",borderRadius:999,color:"$ink",flexDirection:"row",fontFamily:"sans",fontSize:15,fontWeight:"700",gap:6,lineHeight:22.5,minHeight:44,paddingBottom:0,paddingLeft:8,paddingRight:8,paddingTop:0},ordersIcon:{height:21,width:21},cart:{alignItems:"center",backgroundColor:"transparent",borderRadius:22,color:"$ink",fontFamily:"sans",fontSize:17,height:44,justifyContent:"center",lineHeight:25.5,paddingBottom:0,paddingLeft:0,paddingRight:0,paddingTop:0,position:"relative",width:44},cartIcon:{height:26,width:26},cartCount:{backgroundColor:"$riskDot",borderRadius:999,color:"$card",fontFamily:"sans",fontSize:12,fontVariant:["tabular-nums"],fontWeight:"800",height:20,lineHeight:20,minWidth:20,paddingBottom:0,paddingLeft:5,paddingRight:5,paddingTop:0,position:"absolute",right:1,ring:[{width:2,color:"$paper"}],textAlign:"center",top:3},head:{alignItems:"center",color:"$ink",flexDirection:"row",fontFamily:"sans",fontSize:17,gap:12,grid:["fr",56],lineHeight:25.5,paddingBottom:0,paddingLeft:2,paddingRight:2,paddingTop:2},eyebrow:{color:"$ink3",fontFamily:"mono",fontSize:11,letterSpacing:.77,lineHeight:16.5,marginBottom:6,marginLeft:0,marginRight:0,marginTop:0,textTransform:"uppercase"},title:{color:"$ink",fontFamily:"serif",fontSize:29,fontWeight:"800",letterSpacing:-.29,lineHeight:30.74,marginBottom:0,marginLeft:0,marginRight:0,marginTop:0},subtitle:{color:"$ink2",fontFamily:"sans",fontSize:15,lineHeight:22.5,marginBottom:0,marginLeft:0,marginRight:0,marginTop:6},headImage:{backgroundColor:"$tile",borderRadius:28,height:56,ring:[{width:3,color:"$paper"},{width:5.5,color:"$accent"}],width:56},by:{alignItems:"center",backgroundColor:"$card",borderRadius:16,color:"$ink",flexDirection:"row",fontFamily:"sans",fontSize:17,gap:10,grid:[40,"fr",22],lineHeight:25.5,marginBottom:0,marginLeft:0,marginRight:0,marginTop:14,paddingBottom:10,paddingLeft:12,paddingRight:12,paddingTop:10,shadow:{x:0,y:1,blur:3,color:"#262523",opacity:.06}},byImage:{backgroundColor:"$tile",borderRadius:20,height:40,width:40},byName:{color:"$ink",fontFamily:"sans",fontSize:15,fontWeight:"800",lineHeight:18.75},byRole:{color:"$ink3",fontFamily:"mono",fontSize:10.5,letterSpacing:.53,lineHeight:15.75,marginTop:2,textTransform:"uppercase"},byOk:{color:"$link",height:22,width:22},need:{backgroundColor:"$card",borderRadius:22,color:"$ink",fontFamily:"sans",fontSize:17,lineHeight:25.5,marginTop:14,paddingBottom:16,paddingLeft:16,paddingRight:16,paddingTop:16,shadow:{x:0,y:1,blur:3,color:"#262523",opacity:.06}},needKicker:{alignItems:"center",color:"$ink",flexDirection:"row",fontFamily:"sans",fontSize:15,fontWeight:"800",gap:8,lineHeight:22.5,marginBottom:0,marginLeft:0,marginRight:0,marginTop:0},sources:{color:"$ink",flexDirection:"row",fontFamily:"sans",fontSize:15,fontWeight:"800",gap:4,lineHeight:22.5,marginLeft:"auto"},source:{alignItems:"center",alignSelf:"flex-start",backgroundColor:"$tile",borderRadius:999,color:"$ink2",flexDirection:"row",fontFamily:"sans",fontSize:12,fontWeight:"700",height:24,lineHeight:18,paddingBottom:0,paddingLeft:9,paddingRight:9,paddingTop:0},sourceDna:{backgroundColor:"$linkWash",color:"$link"},needTitle:{color:"$ink",fontFamily:"sans",fontSize:19,fontWeight:"800",lineHeight:23.18,marginBottom:0,marginLeft:0,marginRight:0,marginTop:12},needRisk:{alignItems:"baseline",color:"$ink2",flexDirection:"row",fontFamily:"sans",fontSize:15,gap:9,grid:[9,"fr"],lineHeight:21.75,marginBottom:0,marginLeft:0,marginRight:0,marginTop:6},needRiskLead:{color:"$ink",fontFamily:"sans",fontSize:15,fontWeight:"800",lineHeight:21.75},dot:{alignSelf:"flex-start",borderRadius:4.5,flexGrow:0,flexShrink:0,height:9,width:9},dotRisk:{backgroundColor:"$riskDot"},odds:{alignItems:"center",backgroundColor:"$accent4",borderRadius:14,color:"$ink",flexDirection:"row",fontFamily:"sans",fontSize:17,gap:12,justifyContent:"space-between",lineHeight:25.5,marginTop:12,paddingBottom:10,paddingLeft:14,paddingRight:14,paddingTop:10},oddsKicker:{color:"$ink2",fontFamily:"sans",fontSize:13.5,fontWeight:"600",lineHeight:18.23,marginBottom:0,marginLeft:0,marginRight:0,marginTop:0,maxWidth:135},oddsTag:{alignSelf:"flex-start",backgroundColor:"$card",borderRadius:5,color:"$ink",fontFamily:"mono",fontSize:10,fontWeight:"600",letterSpacing:.6,lineHeight:13.5,marginTop:3,paddingBottom:2,paddingLeft:6,paddingRight:6,paddingTop:2,textTransform:"uppercase"},oddsNumbers:{alignItems:"center",color:"$ink",columnGap:6,flexDirection:"row",fontFamily:"sans",fontSize:17,grid:["auto","auto","auto"],justifyItems:"flex-end",lineHeight:25.5,marginBottom:0,marginLeft:0,marginRight:0,marginTop:0,rowGap:0},oddsFrom:{color:"$ink3",fontFamily:"sans",fontSize:17,fontWeight:"700",lineHeight:25.5,textDecorationLine:"line-through"},oddsIcon:{color:"$ink3",height:16,width:16},oddsTo:{color:"$ink",fontFamily:"serif",fontSize:28,fontWeight:"800",lineHeight:28},oddsLabel:{color:"$link",fontFamily:"sans",fontSize:12.5,fontWeight:"700",lineHeight:18.75,marginTop:3},says:{alignItems:"flex-start",backgroundColor:"$paper",borderRadius:14,color:"$ink",flexDirection:"row",fontFamily:"sans",fontSize:17,gap:10,grid:[32,"fr"],lineHeight:25.5,marginBottom:0,marginLeft:0,marginRight:0,marginTop:12,paddingBottom:10,paddingLeft:12,paddingRight:12,paddingTop:10},saysImage:{borderRadius:16,height:32,width:32},saysText:{color:"$ink2",fontFamily:"sans",fontSize:14.5,lineHeight:20.3,marginBottom:0,marginLeft:0,marginRight:0,marginTop:0},saysBy:{color:"$ink",fontFamily:"sans",fontSize:14.5,fontWeight:"800",lineHeight:20.3,marginRight:2},saysSerif:{color:"$ink",fontFamily:"serif",fontSize:17,fontWeight:"800",letterSpacing:-.17,lineHeight:25.5,marginBottom:0,marginLeft:0,marginRight:0,marginTop:0},tag:{backgroundColor:"$card",borderRadius:5,color:"$ink",fontFamily:"mono",fontSize:10,letterSpacing:.6,lineHeight:14,paddingBottom:2,paddingLeft:6,paddingRight:6,paddingTop:2,textTransform:"uppercase"},jump:{alignItems:"center",backgroundColor:"$primary",borderRadius:14,color:"$onPrimary",flexDirection:"row",fontFamily:"sans",fontSize:17,gap:12,grid:[44,"fr","auto"],lineHeight:25.5,marginTop:12,paddingBottom:8,paddingLeft:8,paddingRight:14,paddingTop:8,textAlign:"left",width:"100%"},jumpNoImage:{grid:["fr","auto"]},jumpImage:{backgroundColor:"$card",borderRadius:10,height:44,width:44},jumpSmall:{color:"$accent",fontFamily:"sans",fontSize:13,fontWeight:"800",lineHeight:19.5,textAlign:"left"},jumpStrong:{color:"$onPrimary",fontFamily:"sans",fontSize:15,fontWeight:"800",lineHeight:18.75,textAlign:"left"},jumpGo:{color:"$onPrimary",fontFamily:"sans",fontSize:14,fontWeight:"800",lineHeight:21,textAlign:"left"},steps:{backgroundColor:"$card",borderRadius:22,color:"$ink",fontFamily:"sans",fontSize:17,lineHeight:25.5,marginTop:14,paddingBottom:12,paddingLeft:12,paddingRight:12,paddingTop:16,shadow:{x:0,y:1,blur:3,color:"#262523",opacity:.06}},stepsHead:{alignItems:"baseline",color:"$ink",flexDirection:"row",fontFamily:"sans",fontSize:17,gap:12,justifyContent:"space-between",lineHeight:25.5,paddingBottom:0,paddingLeft:4,paddingRight:4,paddingTop:0},stepsTitle:{alignItems:"center",color:"$ink",flexDirection:"row",fontFamily:"sans",fontSize:19,fontWeight:"800",gap:10,lineHeight:22.8,marginBottom:0,marginLeft:0,marginRight:0,marginTop:0},stepsLabel:{color:"$ink3",fontFamily:"mono",fontSize:11,letterSpacing:.55,lineHeight:16.5,marginBottom:0,marginLeft:0,marginRight:0,marginTop:0,textTransform:"uppercase"},n:{alignItems:"center",backgroundColor:"$primary",borderRadius:12,color:"$onPrimary",flexGrow:0,flexShrink:0,fontFamily:"sans",fontSize:12.5,fontWeight:"800",height:24,justifyContent:"center",lineHeight:15,width:24},tips:{color:"$ink",flexDirection:"row",fontFamily:"sans",fontSize:17,gap:10,lineHeight:25.5,marginBottom:0,marginLeft:-12,marginRight:-12,marginTop:10,paddingBottom:2,paddingLeft:12,paddingRight:12,paddingTop:0},tip:{borderRadius:18,color:"$ink",flexBasis:"78%",flexDirection:"column",flexGrow:0,flexShrink:0,fontFamily:"sans",fontSize:17,lineHeight:25.5,maxWidth:280,paddingBottom:12,paddingLeft:14,paddingRight:14,paddingTop:14},tipY:{backgroundColor:"$accentChip"},tipC:{backgroundColor:"$linkChip"},tipG:{backgroundColor:"$clearChip"},tipR:{backgroundColor:"$riskChip"},tipTop:{alignItems:"center",color:"$ink",flexDirection:"row",fontFamily:"sans",fontSize:17,justifyContent:"space-between",lineHeight:25.5},tipIcon:{color:"$ink",height:26,width:26},tipN:{color:"$ink",fontFamily:"serif",fontSize:30,fontWeight:"900",lineHeight:30},tipStrong:{color:"$ink",fontFamily:"sans",fontSize:17,fontWeight:"800",lineHeight:21.25,marginTop:14},tipSmall:{color:"$ink2",fontFamily:"sans",fontSize:14.5,lineHeight:20.3,marginTop:4},tipEm:{color:"$link",fontFamily:"mono",fontSize:10.5,fontStyle:"normal",letterSpacing:.42,lineHeight:15.75,marginTop:"auto",paddingTop:10,textTransform:"uppercase"},sec:{backgroundColor:"$card",borderRadius:22,color:"$ink",fontFamily:"sans",fontSize:17,lineHeight:25.5,marginTop:14,paddingBottom:16,paddingLeft:16,paddingRight:16,paddingTop:16,shadow:{x:0,y:1,blur:3,color:"#262523",opacity:.06}},secTitle:{alignItems:"center",color:"$ink",flexDirection:"row",fontFamily:"sans",fontSize:19,fontWeight:"800",gap:10,lineHeight:22.8,marginBottom:0,marginLeft:0,marginRight:0,marginTop:0},secN:{alignItems:"center",backgroundColor:"$primary",borderRadius:12,color:"$onPrimary",flexGrow:0,flexShrink:0,fontFamily:"sans",fontSize:12.5,fontWeight:"800",height:24,justifyContent:"center",lineHeight:15,width:24},pick:{backgroundColor:"transparent",borderRadius:16,color:"$ink",fontFamily:"sans",fontSize:17,lineHeight:25.5,marginTop:14,paddingBottom:0,paddingLeft:0,paddingRight:0,paddingTop:0},pickTop:{alignItems:"center",color:"$ink",flexDirection:"row",fontFamily:"sans",fontSize:17,gap:12,grid:[76,"fr"],lineHeight:25.5},pickImage:{backgroundColor:"$paper",borderRadius:14,height:76,overflow:"hidden",width:76},pickTitle:{color:"$ink",fontFamily:"sans",fontSize:17,fontWeight:"800",lineHeight:20.4,marginBottom:0,marginLeft:0,marginRight:0,marginTop:0},stars:{alignItems:"center",color:"$ink",flexDirection:"row",fontFamily:"sans",fontSize:13.5,fontWeight:"800",gap:4,lineHeight:20.25,marginBottom:0,marginLeft:0,marginRight:0,marginTop:2},starsIcon:{color:"$watchDot",height:14,width:14},starsLabel:{color:"$ink3",fontFamily:"sans",fontSize:13.5,fontWeight:"500",lineHeight:20.25},pickLine:{color:"$ink2",fontFamily:"sans",fontSize:14,lineHeight:19.6,marginBottom:0,marginLeft:0,marginRight:0,marginTop:3},reviews:{color:"$ink",flexDirection:"row",fontFamily:"sans",fontSize:17,gap:10,lineHeight:25.5,marginBottom:0,marginLeft:-16,marginRight:-16,marginTop:12,paddingBottom:0,paddingLeft:16,paddingRight:16,paddingTop:0},review:{backgroundColor:"$paper",borderRadius:14,color:"$ink",flexBasis:"78%",flexGrow:0,flexShrink:0,fontFamily:"sans",fontSize:17,lineHeight:25.5,marginBottom:0,marginLeft:0,marginRight:0,marginTop:0,maxWidth:280,paddingBottom:12,paddingLeft:14,paddingRight:14,paddingTop:12},reviewStars:{color:"$watchDot",flexDirection:"row",fontFamily:"sans",fontSize:17,gap:1,lineHeight:25.5,marginBottom:0,marginLeft:0,marginRight:0,marginTop:0},reviewStar:{height:13,width:13},reviewText:{color:"$ink",fontFamily:"sans",fontSize:15,lineHeight:21,marginBottom:0,marginLeft:0,marginRight:0,marginTop:5},reviewBy:{color:"$ink3",fontFamily:"sans",fontSize:13,lineHeight:19.5,marginTop:4},why:{borderRadius:16,color:"$ink",fontFamily:"sans",fontSize:17,inner:{width:1.5,color:"$ink"},lineHeight:25.5,marginTop:14,paddingBottom:12,paddingLeft:14,paddingRight:14,paddingTop:12},whyMini:{color:"$ink3",fontFamily:"mono",fontSize:10.5,letterSpacing:.63,lineHeight:15.75,marginBottom:0,marginLeft:0,marginRight:0,marginTop:0,textTransform:"uppercase"},whyList:{color:"$ink",fontFamily:"sans",fontSize:17,lineHeight:25.5,marginBottom:0,marginLeft:0,marginRight:0,marginTop:0,paddingBottom:0,paddingLeft:0,paddingRight:0,paddingTop:0},whyRow:{alignItems:"flex-start",color:"$ink",flexDirection:"row",fontFamily:"sans",fontSize:17,gap:10,grid:[58,"fr"],lineHeight:25.5,marginTop:10},whyStrong:{color:"$ink",fontFamily:"sans",fontSize:15,fontWeight:"800",lineHeight:19.5},whySmall:{color:"$ink2",fontFamily:"sans",fontSize:14,lineHeight:19.6,marginTop:1},chip:{alignItems:"center",borderRadius:6,color:"$ink",fontFamily:"mono",fontSize:10.5,fontWeight:"700",height:22,justifyContent:"center",letterSpacing:.42,lineHeight:15.75,textTransform:"uppercase"},chipDna:{backgroundColor:"$linkWash",color:"$link"},chipAsk:{backgroundColor:"$accent4",color:"$ink"},chipRec:{backgroundColor:"$tile",color:"$ink2"},score:{alignItems:"center",backgroundColor:"$primary",borderRadius:12,color:"$onPrimary",flexDirection:"row",fontFamily:"sans",fontSize:14.5,fontWeight:"800",gap:8,justifyContent:"space-between",lineHeight:18.85,marginBottom:0,marginLeft:0,marginRight:0,marginTop:12,paddingBottom:11,paddingLeft:14,paddingRight:12,paddingTop:11},scoreValue:{color:"$accent",flexGrow:0,flexShrink:0,fontFamily:"mono",fontSize:16,fontWeight:"700",lineHeight:20.8},dose:{backgroundColor:"$linkWash",borderRadius:16,color:"$ink",fontFamily:"sans",fontSize:17,lineHeight:25.5,marginTop:10,paddingBottom:14,paddingLeft:14,paddingRight:14,paddingTop:12},doseMini:{color:"$link",fontFamily:"mono",fontSize:10.5,letterSpacing:.63,lineHeight:15.75,marginBottom:0,marginLeft:0,marginRight:0,marginTop:0,textTransform:"uppercase"},doseList:{color:"$ink",flexDirection:"row",fontFamily:"sans",fontSize:17,gap:8,grid:["fr","fr","fr"],lineHeight:25.5,marginBottom:0,marginLeft:0,marginRight:0,marginTop:10,paddingBottom:0,paddingLeft:0,paddingRight:0,paddingTop:0},doseItem:{alignItems:"center",backgroundColor:"$card",borderRadius:12,color:"$ink",fontFamily:"sans",fontSize:17,gap:2,lineHeight:25.5,paddingBottom:10,paddingLeft:4,paddingRight:4,paddingTop:10,textAlign:"center"},doseValue:{color:"$ink",fontFamily:"mono",fontSize:21,fontVariant:["tabular-nums"],fontWeight:"700",lineHeight:23.1,textAlign:"center"},doseLabel:{color:"$ink2",fontFamily:"sans",fontSize:12.5,lineHeight:16.25,textAlign:"center"},doseNote:{color:"$link",fontFamily:"sans",fontSize:14,lineHeight:20.3,marginBottom:0,marginLeft:0,marginRight:0,marginTop:10},ingredients:{color:"$ink",flexDirection:"row",flexWrap:"wrap",fontFamily:"sans",fontSize:17,gap:6,lineHeight:25.5,marginBottom:0,marginLeft:0,marginRight:0,marginTop:12},ingredient:{backgroundColor:"$tile",borderRadius:999,color:"$ink",fontFamily:"sans",fontSize:13.5,fontWeight:"600",lineHeight:20.25,paddingBottom:6,paddingLeft:10,paddingRight:10,paddingTop:6},opts:{color:"$ink",fontFamily:"sans",fontSize:17,gap:8,lineHeight:25.5,marginTop:14},opt:{alignItems:"center",backgroundColor:"$card",borderRadius:16,color:"$ink",flexDirection:"row",fontFamily:"sans",fontSize:17,gap:12,inner:{width:1.5,color:"$n_DEDCD7"},justifyContent:"space-between",lineHeight:25.5,paddingBottom:14,paddingLeft:14,paddingRight:14,paddingTop:14,textAlign:"left",width:"100%"},optOn:{inner:{width:2.5,color:"$ink"}},optOnce:{backgroundColor:"$paper",inner:null,paddingBottom:10,paddingLeft:14,paddingRight:14,paddingTop:10,shadow:null},optOnceOn:{backgroundColor:"$card",inner:{width:2,color:"$ink"}},optText:{alignItems:"flex-start",color:"$ink",fontFamily:"sans",fontSize:17,gap:2,lineHeight:25.5,textAlign:"left"},optStrong:{color:"$ink",fontFamily:"sans",fontSize:16,fontWeight:"800",lineHeight:24,textAlign:"left"},optOnceStrong:{fontSize:15,fontWeight:"700",lineHeight:22.5},optSmall:{color:"$ink2",fontFamily:"sans",fontSize:13.5,lineHeight:20.25,textAlign:"left"},optOnceSmall:{fontSize:13,lineHeight:19.5},optTag:{backgroundColor:"$riskInk",borderRadius:6,color:"$card",fontFamily:"sans",fontSize:12,fontWeight:"800",lineHeight:18,marginBottom:4,paddingBottom:2,paddingLeft:8,paddingRight:8,paddingTop:2,textAlign:"left"},price:{alignItems:"flex-end",color:"$ink",columnGap:8,flexDirection:"column",flexWrap:"nowrap",fontFamily:"sans",fontSize:17,lineHeight:25.5,minWidth:0,rowGap:0,textAlign:"left"},priceValue:{color:"$ink",fontFamily:"sans",fontSize:24,fontVariant:["tabular-nums"],fontWeight:"800",lineHeight:26.4,textAlign:"left"},priceWas:{color:"$riskInk",fontFamily:"sans",fontSize:15,fontWeight:"700",lineHeight:22.5,textAlign:"left",textDecorationLine:"line-through"},optPrice:{color:"$ink",fontFamily:"sans",fontSize:18,fontWeight:"800",lineHeight:27,textAlign:"left"},optOncePrice:{color:"$ink2",fontSize:15,fontWeight:"700",lineHeight:22.5},buy:{alignItems:"center",color:"$ink",fontFamily:"sans",fontSize:17,gap:12,justifyContent:"space-between",lineHeight:25.5,marginTop:12},button:{alignItems:"center",alignSelf:"flex-start",backgroundColor:"$primary",borderRadius:999,color:"$onPrimary",flexDirection:"row",flexGrow:0,flexShrink:0,fontFamily:"sans",fontSize:17,fontWeight:"700",gap:8,justifyContent:"center",lineHeight:25.5,minHeight:52,paddingBottom:0,paddingLeft:20,paddingRight:20,paddingTop:0,textDecorationLine:"none",width:"100%"},buttonDisabled:{opacity:.32},proof:{alignItems:"center",color:"$riskInk",flexDirection:"row",fontFamily:"sans",fontSize:14.5,fontWeight:"800",gap:6,justifyContent:"center",lineHeight:21.75,marginBottom:0,marginLeft:0,marginRight:0,marginTop:10},proofIcon:{flexGrow:0,flexShrink:0,height:21,marginTop:-2,width:21},trust:{color:"$ink",flexDirection:"row",fontFamily:"sans",fontSize:17,gap:6,grid:["fr","fr","fr"],lineHeight:25.5,marginBottom:0,marginLeft:0,marginRight:0,marginTop:12,paddingBottom:0,paddingLeft:0,paddingRight:0,paddingTop:0},trustItem:{alignItems:"center",color:"$ink2",fontFamily:"sans",fontSize:12.5,fontWeight:"600",gap:4,lineHeight:16.25,textAlign:"center"},trustIcon:{color:"$link",height:20,width:20},on:{alignItems:"center",backgroundColor:"$clearBg",borderRadius:14,color:"$ink",flexDirection:"row",fontFamily:"sans",fontSize:17,gap:10,grid:[34,"fr","auto"],lineHeight:25.5,marginTop:12,paddingBottom:10,paddingLeft:12,paddingRight:10,paddingTop:10},onIcon:{alignItems:"center",backgroundColor:"$clearDot",borderRadius:17,color:"$card",fontFamily:"sans",fontSize:17,height:34,justifyContent:"center",lineHeight:25.5,width:34},onIconSvg:{height:18,width:18},onStrong:{color:"$clearInk",fontFamily:"sans",fontSize:15,fontWeight:"700",lineHeight:18.75},onSmall:{color:"$ink2",fontFamily:"sans",fontSize:13,lineHeight:17.55,marginTop:1},onButton:{backgroundColor:"$card",borderRadius:999,color:"$ink",fontFamily:"sans",fontSize:14,fontWeight:"800",inner:{width:1.5,color:"$ink"},lineHeight:21,minHeight:38,paddingBottom:0,paddingLeft:14,paddingRight:14,paddingTop:0},more:{color:"$ink",columnGap:18,flexDirection:"row",flexWrap:"wrap",fontFamily:"sans",fontSize:17,lineHeight:25.5,marginBottom:0,marginLeft:0,marginRight:0,marginTop:8,rowGap:0},moreButton:{backgroundColor:"transparent",color:"$link",fontFamily:"sans",fontSize:14,fontWeight:"700",lineHeight:21,minHeight:34,paddingBottom:0,paddingLeft:0,paddingRight:0,paddingTop:0,textDecorationLine:"underline"},fine:{color:"$ink3",fontFamily:"sans",fontSize:13,lineHeight:18.85,marginBottom:0,marginLeft:0,marginRight:0,marginTop:8},others:{backgroundColor:"$card",borderRadius:22,color:"$ink",fontFamily:"sans",fontSize:17,lineHeight:25.5,marginBottom:0,marginLeft:0,marginRight:0,marginTop:14,paddingBottom:16,paddingLeft:16,paddingRight:16,paddingTop:16,shadow:{x:0,y:1,blur:3,color:"#262523",opacity:.06}},sign:{borderRadius:16,color:"$ink",fontFamily:"sans",fontSize:17,inner:{width:1.5,color:"$n_DEDCD7"},lineHeight:25.5,marginTop:12,paddingBottom:14,paddingLeft:14,paddingRight:14,paddingTop:14},signUrgent:{backgroundColor:"$riskBg",inner:null,shadow:null},signTitle:{alignItems:"center",color:"$ink",flexDirection:"row",fontFamily:"sans",fontSize:16,fontWeight:"800",gap:8,lineHeight:20,marginBottom:0,marginLeft:0,marginRight:0,marginTop:0},signUrgentTitle:{color:"$riskInk"},signUrgentIcon:{height:20,width:20},signBody:{color:"$ink2",fontFamily:"sans",fontSize:15,lineHeight:21.75,marginBottom:0,marginLeft:0,marginRight:0,marginTop:4},signUrgentBody:{color:"$ink"},questionsKicker:{color:"$ink",fontFamily:"sans",fontSize:16,fontWeight:"800",lineHeight:20,marginBottom:0,marginLeft:0,marginRight:0,marginTop:18},questions:{color:"$ink",fontFamily:"sans",fontSize:15,gap:6,lineHeight:21.75,marginBottom:0,marginLeft:0,marginRight:0,marginTop:10,paddingLeft:22},questionsAfterKicker:{marginTop:6},add:{alignItems:"center",backgroundColor:"transparent",borderRadius:999,color:"$ink",flexDirection:"row",fontFamily:"sans",fontSize:16,fontWeight:"800",inner:{width:2,color:"$ink"},justifyContent:"center",lineHeight:24,marginTop:14,minHeight:48,paddingBottom:0,paddingLeft:16,paddingRight:16,paddingTop:0,width:"100%"},addOn:{backgroundColor:"$clearBg",color:"$clearInk",inner:null,shadow:null},askRow:{alignItems:"center",backgroundColor:"$linkWash",borderRadius:16,color:"$ink",flexDirection:"row",fontFamily:"sans",fontSize:17,gap:12,grid:[40,"fr",18],lineHeight:25.5,marginTop:10,paddingBottom:12,paddingLeft:12,paddingRight:14,paddingTop:12,textAlign:"left",width:"100%"},askRowInSec:{marginTop:12},askRowIcon:{alignItems:"center",backgroundColor:"$card",borderRadius:11,color:"$link",fontFamily:"sans",fontSize:17,height:40,justifyContent:"center",lineHeight:25.5,textAlign:"left",width:40},askRowIconSvg:{height:21,width:21},askRowStrong:{color:"$ink",fontFamily:"sans",fontSize:15.5,fontWeight:"800",lineHeight:20.15,textAlign:"left"},askRowSmall:{color:"$ink2",fontFamily:"sans",fontSize:14,lineHeight:19.6,marginTop:1,textAlign:"left"},askRowChev:{color:"$ink2",height:18,width:18},extras:{color:"$ink",fontFamily:"sans",fontSize:17,gap:10,lineHeight:25.5,marginTop:22},extrasTitle:{color:"$ink3",fontFamily:"mono",fontSize:11,fontWeight:"400",letterSpacing:.77,lineHeight:12.65,marginBottom:0,marginLeft:4,marginRight:4,marginTop:0,textTransform:"uppercase"},extra:{alignItems:"flex-start",backgroundColor:"$card",borderRadius:22,color:"$ink",columnGap:12,flexDirection:"row",fontFamily:"sans",fontSize:17,grid:[56,"fr"],lineHeight:25.5,paddingBottom:14,paddingLeft:14,paddingRight:14,paddingTop:14,rowGap:4,shadow:{x:0,y:1,blur:3,color:"#262523",opacity:.06}},extraKit:{backgroundColor:"$linkWash",inner:null,shadow:null},extraImage:{backgroundColor:"$card",borderRadius:14,height:56,width:56},extraKitImage:{backgroundColor:"$card"},extraIcon:{alignItems:"center",backgroundColor:"$linkWash",borderRadius:14,color:"$link",height:56,justifyContent:"center",width:56},extraIconSvg:{height:26,width:26},extraTitle:{color:"$ink",fontFamily:"sans",fontSize:17,fontWeight:"800",lineHeight:20.4,marginBottom:0,marginLeft:0,marginRight:0,marginTop:0},extraTitleSerif:{fontFamily:"serif",fontSize:21,fontWeight:"800",letterSpacing:-.21,lineHeight:25.2},extraBody:{color:"$ink2",fontFamily:"sans",fontSize:14.5,lineHeight:20.3,marginBottom:0,marginLeft:0,marginRight:0,marginTop:3},extraPrice:{alignItems:"center",color:"$ink",columnGap:8,flexDirection:"row",flexWrap:"wrap",fontFamily:"sans",fontSize:14.5,lineHeight:20.3,marginBottom:0,marginLeft:0,marginRight:0,marginTop:6,rowGap:0},extraPriceValue:{color:"$ink",fontFamily:"sans",fontSize:19,fontVariant:["tabular-nums"],fontWeight:"800",lineHeight:26.6},extraPriceWas:{color:"$ink3",fontFamily:"sans",fontSize:14,fontWeight:"700",lineHeight:19.6,textDecorationLine:"line-through"},extraGo:{backgroundColor:"$primary",borderRadius:999,color:"$onPrimary",fontFamily:"sans",fontSize:14.5,fontWeight:"800",lineHeight:21.75,marginTop:8,minHeight:40,paddingBottom:0,paddingLeft:18,paddingRight:18,paddingTop:0},extraGoOn:{backgroundColor:"$clearBg",color:"$clearInk"},wait:{backgroundColor:"$card",borderRadius:22,color:"$ink",fontFamily:"sans",fontSize:17,lineHeight:25.5,marginTop:14,paddingBottom:16,paddingLeft:16,paddingRight:16,paddingTop:16,shadow:{x:0,y:1,blur:3,color:"#262523",opacity:.06}},waitTop:{alignItems:"center",color:"$ink",flexDirection:"row",fontFamily:"sans",fontSize:17,gap:12,grid:[46,"fr"],lineHeight:25.5},waitTile:{alignItems:"center",backgroundColor:"$linkWash",borderRadius:13,color:"$link",flexGrow:0,flexShrink:0,fontFamily:"sans",fontSize:22,height:46,justifyContent:"center",lineHeight:33,width:46},waitTileSvg:{height:23,width:23},waitMini:{color:"$ink3",fontFamily:"mono",fontSize:10.5,letterSpacing:.63,lineHeight:15.75,marginBottom:0,marginLeft:0,marginRight:0,marginTop:0,textTransform:"uppercase"},waitTitle:{color:"$ink",fontFamily:"serif",fontSize:26,fontWeight:"800",letterSpacing:-.26,lineHeight:27.3,marginBottom:0,marginLeft:0,marginRight:0,marginTop:2},waitKey:{color:"$ink",fontFamily:"sans",fontSize:16,fontWeight:"800",lineHeight:24,marginBottom:0,marginLeft:0,marginRight:0,marginTop:18},waitText:{alignItems:"center",color:"$ink",flexDirection:"row",fontFamily:"sans",fontSize:15.5,fontWeight:"700",gap:8,lineHeight:23.25,marginBottom:12,marginLeft:0,marginRight:0,marginTop:16},waitTextSvg:{color:"$link",flexGrow:0,flexShrink:0,height:20,width:20},waitButton:{alignItems:"center",alignSelf:"flex-start",backgroundColor:"$primary",borderRadius:999,color:"$onPrimary",flexDirection:"row",fontFamily:"sans",fontSize:16,fontWeight:"700",gap:8,justifyContent:"center",lineHeight:24,minHeight:48,paddingBottom:0,paddingLeft:22,paddingRight:22,paddingTop:0,textDecorationLine:"none",width:"100%"},track:{color:"$ink",fontFamily:"sans",fontSize:17,lineHeight:25.5,marginBottom:0,marginLeft:0,marginRight:0,marginTop:14,paddingBottom:0,paddingLeft:0,paddingRight:0,paddingTop:0},trackStep:{color:"$ink",flexDirection:"row",fontFamily:"sans",fontSize:17,gap:12,grid:[22,"fr"],lineHeight:25.5,paddingBottom:16,position:"relative"},trackStepLast:{paddingBottom:0},trackLine:{backgroundColor:"$n_E2DFD9",borderRadius:1,bottom:-2,left:10,position:"absolute",top:20,width:2},trackLineDone:{backgroundColor:"$primary"},trackDot:{alignItems:"center",backgroundColor:"$card",borderRadius:11,height:22,inner:{width:2,color:"$n_CFCBC4"},justifyContent:"center",position:"relative",width:22,zIndex:1},trackDotDone:{backgroundColor:"$primary",inner:null,shadow:null},trackDotNow:{backgroundColor:"$accent",inner:{width:2,color:"$ink"}},trackDotSvg:{color:"$card",height:13,width:13},trackTitle:{color:"$ink",fontFamily:"sans",fontSize:15.5,fontWeight:"800",lineHeight:20.15},trackTitleTodo:{color:"$ink3",fontWeight:"700"},trackDetail:{color:"$ink3",fontFamily:"sans",fontSize:14,lineHeight:18.9,marginTop:1},trackTag:{backgroundColor:"$ink",borderRadius:5,color:"$onInk",fontFamily:"mono",fontSize:10,letterSpacing:.6,lineHeight:13.5,paddingBottom:2,paddingLeft:6,paddingRight:6,paddingTop:2,textTransform:"uppercase"},next:{backgroundColor:"$card",borderRadius:18,color:"$ink",fontFamily:"sans",fontSize:17,lineHeight:25.5,marginBottom:0,marginLeft:0,marginRight:0,marginTop:22,paddingBottom:4,paddingLeft:16,paddingRight:16,paddingTop:4,shadow:{x:0,y:1,blur:3,color:"#262523",opacity:.06},textAlign:"left"},nextIn:{backgroundColor:"$paper",inner:null,marginTop:8,shadow:null},nextRow:{alignItems:"center",color:"$ink",flexDirection:"row",fontFamily:"sans",fontSize:17,gap:12,grid:[36,"fr"],lineHeight:25.5,paddingBottom:10,paddingLeft:0,paddingRight:0,paddingTop:10,textAlign:"left"},nextIcon:{alignItems:"center",backgroundColor:"$linkWash",borderRadius:11,color:"$link",fontFamily:"sans",fontSize:17,height:36,justifyContent:"center",lineHeight:25.5,textAlign:"left",width:36},nextIconSvg:{height:19,width:19},nextIconImage:{borderRadius:11,height:"100%",width:"100%"},nextLabel:{color:"$ink3",fontFamily:"mono",fontSize:10.5,letterSpacing:.53,lineHeight:15.75,textAlign:"left",textTransform:"uppercase"},nextText:{color:"$ink",fontFamily:"sans",fontSize:15,fontWeight:"600",lineHeight:20.25,marginTop:1,textAlign:"left"},done:{color:"$ink",fontFamily:"sans",fontSize:17,lineHeight:25.5,paddingBottom:20,paddingLeft:22,paddingRight:22,paddingTop:40,textAlign:"center"},doneCheck:{alignItems:"center",backgroundColor:"$accent",borderRadius:38,color:"$ink",fontFamily:"sans",fontSize:17,height:76,justifyContent:"center",lineHeight:25.5,marginBottom:0,marginLeft:"auto",marginRight:"auto",marginTop:0,textAlign:"center",width:76},doneCheckSvg:{height:38,width:38},doneTitle:{color:"$ink",fontFamily:"serif",fontSize:34,fontWeight:"800",letterSpacing:-.34,lineHeight:39.1,marginBottom:0,marginLeft:0,marginRight:0,marginTop:20,textAlign:"center"},doneWhen:{color:"$ink",fontFamily:"sans",fontSize:16,fontWeight:"700",lineHeight:24,marginBottom:0,marginLeft:0,marginRight:0,marginTop:10,textAlign:"center"},doneWho:{color:"$ink2",fontFamily:"sans",fontSize:15,lineHeight:22.5,marginBottom:0,marginLeft:0,marginRight:0,marginTop:2,textAlign:"center"},pushFoot:{backgroundColor:"$paper",borderTopColor:"$line",borderTopWidth:1,color:"$ink",flexGrow:0,flexShrink:0,fontFamily:"sans",fontSize:17,lineHeight:25.5,paddingBottom:34,paddingLeft:18,paddingRight:18,paddingTop:12},pushFootStack:{color:"$ink",fontFamily:"sans",fontSize:17,gap:10,lineHeight:25.5},shop:{color:"$ink",fontFamily:"sans",fontSize:17,gap:12,lineHeight:25.5,paddingBottom:28,paddingLeft:18,paddingRight:18,paddingTop:8},shopTitle:{color:"$ink",fontFamily:"serif",fontSize:29,fontWeight:"800",letterSpacing:-.29,lineHeight:31.32,marginBottom:0,marginLeft:0,marginRight:0,marginTop:0},shopSub:{color:"$ink2",fontFamily:"sans",fontSize:15,lineHeight:21.75,marginBottom:0,marginLeft:0,marginRight:0,marginTop:-6},shopKey:{color:"$ink",fontFamily:"sans",fontSize:16,fontWeight:"800",lineHeight:18.4,marginBottom:-4,marginLeft:2,marginRight:2,marginTop:6},shopCard:{backgroundColor:"$card",borderRadius:22,color:"$ink",fontFamily:"sans",fontSize:17,lineHeight:25.5,paddingBottom:14,paddingLeft:16,paddingRight:16,paddingTop:14,shadow:{x:0,y:1,blur:3,color:"#262523",opacity:.06}},shopFine:{color:"$ink3",fontFamily:"sans",fontSize:13,lineHeight:18.85,marginBottom:0,marginLeft:0,marginRight:0,marginTop:0},shopFineCenter:{marginTop:14,textAlign:"center"},shopEmpty:{alignItems:"center",color:"$ink",fontFamily:"sans",fontSize:17,gap:8,lineHeight:25.5,paddingBottom:8,paddingLeft:12,paddingRight:12,paddingTop:48,textAlign:"center"},shopEmptyTile:{alignItems:"center",backgroundColor:"$linkWash",borderRadius:20,color:"$link",flexGrow:0,flexShrink:0,fontFamily:"sans",fontSize:22,height:72,justifyContent:"center",lineHeight:33,marginBottom:8,textAlign:"center",width:72},shopEmptyTileSvg:{height:34,width:34},shopEmptyTitle:{color:"$ink",fontFamily:"serif",fontSize:28,fontWeight:"800",letterSpacing:-.28,lineHeight:30.8,marginBottom:0,marginLeft:0,marginRight:0,marginTop:0,textAlign:"center"},shopEmptyText:{color:"$ink2",fontFamily:"sans",fontSize:15.5,lineHeight:22.48,marginBottom:0,marginLeft:0,marginRight:0,marginTop:0,maxWidth:298.07,textAlign:"center"},shopEmptyButton:{alignItems:"center",alignSelf:"flex-start",backgroundColor:"$primary",borderRadius:999,color:"$onPrimary",flexDirection:"row",fontFamily:"sans",fontSize:16,fontWeight:"700",gap:8,justifyContent:"center",lineHeight:24,marginTop:12,minHeight:48,paddingBottom:0,paddingLeft:22,paddingRight:22,paddingTop:0,textAlign:"center",textDecorationLine:"none"},shopLink:{backgroundColor:"transparent",color:"$link",fontFamily:"sans",fontSize:15,fontWeight:"700",lineHeight:22.5,minHeight:40,paddingBottom:0,paddingLeft:0,paddingRight:0,paddingTop:0,textDecorationLine:"underline"},shopActions:{alignItems:"center",color:"$ink",fontFamily:"sans",fontSize:17,gap:4,lineHeight:25.5,marginTop:4},orderList:{color:"$ink",fontFamily:"sans",fontSize:17,gap:10,lineHeight:25.5,marginBottom:0,marginLeft:0,marginRight:0,marginTop:0,paddingBottom:0,paddingLeft:0,paddingRight:0,paddingTop:0},order:{alignItems:"center",backgroundColor:"$card",borderRadius:22,color:"$ink",flexDirection:"row",fontFamily:"sans",fontSize:17,gap:10,grid:["fr",18],lineHeight:25.5,paddingBottom:14,paddingLeft:16,paddingRight:14,paddingTop:14,shadow:{x:0,y:1,blur:3,color:"#262523",opacity:.06},textAlign:"left",width:"100%"},orderChev:{color:"$ink3",height:18,width:18},orderTop:{alignItems:"center",color:"$ink",columnGap:10,flexDirection:"row",flexWrap:"wrap",fontFamily:"sans",fontSize:17,lineHeight:25.5,rowGap:4,textAlign:"left"},orderNo:{color:"$ink3",fontFamily:"mono",fontSize:12,letterSpacing:.48,lineHeight:18,textAlign:"left"},orderWhat:{color:"$ink",fontFamily:"sans",fontSize:16,fontWeight:"800",lineHeight:20.8,marginTop:8,textAlign:"left"},orderMeta:{color:"$ink3",fontFamily:"sans",fontSize:14,lineHeight:19.6,marginTop:2,textAlign:"left"},orderPics:{color:"$ink",flexDirection:"row",fontFamily:"sans",fontSize:17,gap:6,lineHeight:25.5,marginTop:10,textAlign:"left"},orderPic:{alignItems:"center",backgroundColor:"$linkWash",borderRadius:10,color:"$link",fontFamily:"sans",fontSize:17,height:40,justifyContent:"center",lineHeight:25.5,overflow:"hidden",textAlign:"left",width:40},orderPicImage:{height:"100%",width:"100%"},orderPicSvg:{height:20,width:20},pill:{alignItems:"center",alignSelf:"flex-start",backgroundColor:"$accent3",borderRadius:999,color:"$ink",flexDirection:"row",fontFamily:"sans",fontSize:13,fontWeight:"800",gap:6,lineHeight:19.5,minHeight:26,paddingBottom:0,paddingLeft:10,paddingRight:10,paddingTop:0,textAlign:"left"},pillDone:{backgroundColor:"$clearBg",color:"$clearInk"},pillSub:{backgroundColor:"$linkWash",color:"$link"},cartItems:{color:"$ink",fontFamily:"sans",fontSize:17,gap:18,lineHeight:25.5,marginBottom:0,marginLeft:0,marginRight:0,marginTop:0,paddingBottom:0,paddingLeft:0,paddingRight:0,paddingTop:0},cartItem:{alignItems:"flex-start",color:"$ink",flexDirection:"row",fontFamily:"sans",fontSize:17,gap:12,grid:[64,"fr"],lineHeight:25.5},cartItemImage:{alignItems:"center",backgroundColor:"$linkWash",borderRadius:14,color:"$link",fontFamily:"sans",fontSize:17,height:64,justifyContent:"center",lineHeight:25.5,overflow:"hidden",width:64},cartItemImageSvg:{height:28,width:28},cartItemTitle:{color:"$ink",fontFamily:"sans",fontSize:16.5,fontWeight:"800",lineHeight:20.63,marginBottom:0,marginLeft:0,marginRight:0,marginTop:0},cartItemPrice:{alignItems:"center",color:"$ink",columnGap:8,flexDirection:"row",flexWrap:"wrap",fontFamily:"sans",fontSize:17,lineHeight:25.5,marginTop:3,rowGap:2},cartItemPriceValue:{color:"$ink",fontFamily:"sans",fontSize:16,fontVariant:["tabular-nums"],fontWeight:"800",lineHeight:24},cartItemPriceWas:{color:"$ink3",fontFamily:"sans",fontSize:14,fontWeight:"600",lineHeight:21,textDecorationLine:"line-through"},cartItemPriceNote:{color:"$ink3",fontFamily:"sans",fontSize:14,lineHeight:21},cartItemActions:{alignItems:"center",color:"$ink",flexDirection:"row",fontFamily:"sans",fontSize:17,gap:16,lineHeight:25.5,marginTop:8},stepper:{alignItems:"center",alignSelf:"flex-start",backgroundColor:"$card",borderRadius:999,color:"$ink",flexDirection:"row",fontFamily:"sans",fontSize:17,grid:[40,30,40],height:40,inner:{width:1.5,color:"$n_DAD7D1"},lineHeight:25.5},stepperButton:{alignItems:"center",backgroundColor:"transparent",borderRadius:999,color:"$ink",fontFamily:"sans",fontSize:17,height:40,justifyContent:"center",lineHeight:25.5,paddingBottom:0,paddingLeft:0,paddingRight:0,paddingTop:0},stepperButtonDisabled:{opacity:.3},stepperButtonSvg:{height:16,width:16},stepperValue:{color:"$ink",fontFamily:"sans",fontSize:15.5,fontVariant:["tabular-nums"],fontWeight:"800",lineHeight:23.25,textAlign:"center"},remove:{backgroundColor:"transparent",color:"$ink2",fontFamily:"sans",fontSize:14.5,fontWeight:"700",lineHeight:21.75,minHeight:40,paddingBottom:0,paddingLeft:0,paddingRight:0,paddingTop:0,textDecorationLine:"underline"},mode:{color:"$ink",fontFamily:"sans",fontSize:17,gap:6,lineHeight:25.5,marginTop:8},modeButton:{alignItems:"center",backgroundColor:"$paper",borderRadius:12,color:"$ink",flexDirection:"row",fontFamily:"sans",fontSize:14.5,fontWeight:"700",gap:10,justifyContent:"space-between",lineHeight:18.85,minHeight:44,paddingBottom:8,paddingLeft:12,paddingRight:12,paddingTop:8,textAlign:"left"},modeButtonOn:{backgroundColor:"$card",inner:{width:2,color:"$ink"}},modePrice:{color:"$ink",fontFamily:"sans",fontSize:14.5,fontVariant:["tabular-nums"],fontWeight:"800",lineHeight:18.85,textAlign:"left"},every:{backgroundColor:"$card",borderRadius:999,color:"$ink",flexDirection:"row",fontFamily:"sans",fontSize:17,gap:4,grid:["fr","fr","fr"],inner:{width:1.5,color:"$n_DAD7D1"},lineHeight:25.5,marginTop:8,paddingBottom:4,paddingLeft:4,paddingRight:4,paddingTop:4},everyButton:{backgroundColor:"transparent",borderRadius:999,color:"$ink",fontFamily:"sans",fontSize:14,fontWeight:"700",lineHeight:21,minHeight:36,paddingBottom:0,paddingLeft:6,paddingRight:6,paddingTop:0,textAlign:"center"},everyButtonOn:{backgroundColor:"$primary",color:"$onPrimary"},summary:{backgroundColor:"$card",borderRadius:16,color:"$ink",fontFamily:"sans",fontSize:17,lineHeight:25.5,marginBottom:0,marginLeft:0,marginRight:0,marginTop:0,paddingBottom:6,paddingLeft:16,paddingRight:16,paddingTop:6,shadow:{x:0,y:1,blur:3,color:"#262523",opacity:.06}},summaryRow:{alignItems:"center",color:"$ink",flexDirection:"row",fontFamily:"sans",fontSize:15,fontVariant:["tabular-nums"],gap:12,justifyContent:"space-between",lineHeight:22.5,minHeight:34},summaryLabel:{alignItems:"center",alignSelf:"flex-start",color:"$ink2",flexDirection:"row",fontFamily:"sans",fontSize:15,fontVariant:["tabular-nums"],gap:8,lineHeight:22.5},summaryTotal:{fontSize:17,fontWeight:"800",lineHeight:25.5,minHeight:42},summaryTotalLabel:{color:"$ink"},summaryRenew:{fontSize:14,lineHeight:21,marginTop:-6,minHeight:28},summaryTag:{backgroundColor:"$ink",borderRadius:5,color:"$onInk",fontFamily:"mono",fontSize:10,fontVariant:["tabular-nums"],letterSpacing:.6,lineHeight:15,paddingBottom:2,paddingLeft:6,paddingRight:6,paddingTop:2,textTransform:"uppercase"},foot:{color:"$ink",fontFamily:"sans",fontSize:17,gap:8,lineHeight:25.5},footFine:{color:"$ink3",fontFamily:"sans",fontSize:13,lineHeight:18.85,marginBottom:0,marginLeft:0,marginRight:0,marginTop:0,textAlign:"center"},co:{color:"$ink",fontFamily:"sans",fontSize:17,gap:10,lineHeight:25.5,marginTop:2},coProduct:{alignItems:"center",color:"$ink",flexDirection:"row",fontFamily:"sans",fontSize:17,gap:12,grid:[56,"fr"],lineHeight:25.5},coProductImage:{alignItems:"center",backgroundColor:"$accent3",borderRadius:14,color:"$ink",fontFamily:"sans",fontSize:17,height:56,justifyContent:"center",lineHeight:25.5,overflow:"hidden",width:56},coProductImageSvg:{height:30,width:30},coProductTitle:{color:"$ink",fontFamily:"sans",fontSize:20,fontWeight:"800",lineHeight:24,marginBottom:0,marginLeft:0,marginRight:0,marginTop:0},coProductLine:{color:"$ink2",fontFamily:"sans",fontSize:14,lineHeight:18.9,marginBottom:0,marginLeft:0,marginRight:0,marginTop:2},coOptions:{color:"$ink",fontFamily:"sans",fontSize:17,gap:8,lineHeight:25.5},coOption:{borderRadius:16,color:"$ink",fontFamily:"sans",fontSize:17,inner:{width:1.5,color:"$n_DAD7D1"},lineHeight:25.5},coOptionOn:{backgroundColor:"$accent4",inner:{width:2,color:"$ink"}},coOptionHit:{alignItems:"flex-start",backgroundColor:"transparent",borderRadius:16,color:"$ink",columnGap:12,flexDirection:"row",fontFamily:"sans",fontSize:17,grid:[22,"fr","auto"],lineHeight:25.5,paddingBottom:12,paddingLeft:14,paddingRight:14,paddingTop:12,rowGap:2,textAlign:"left",width:"100%"},coOptionStrong:{color:"$ink",fontFamily:"sans",fontSize:16,fontWeight:"700",lineHeight:21.6,textAlign:"left"},coOptionSmall:{color:"$ink2",fontFamily:"sans",fontSize:13,lineHeight:18.2,textAlign:"left"},coOptionPrice:{color:"$ink",fontFamily:"sans",fontSize:16,fontVariant:["tabular-nums"],fontWeight:"800",lineHeight:21.6,textAlign:"right"},coOptionPriceWas:{color:"$riskInk",fontFamily:"sans",fontSize:13,fontVariant:["tabular-nums"],fontWeight:"600",lineHeight:17.55,textAlign:"right",textDecorationLine:"line-through"},coRadio:{alignItems:"center",borderRadius:11,height:22,inner:{width:2,color:"$n_BDB9B2"},justifyContent:"center",width:22},coRadioOn:{inner:{width:7,color:"$ink"}},coKicker:{color:"$ink3",fontFamily:"mono",fontSize:10.5,letterSpacing:.63,lineHeight:15.75,marginBottom:6,marginLeft:0,marginRight:0,marginTop:0,textTransform:"uppercase"},coWhen:{color:"$ink",fontFamily:"sans",fontSize:17,lineHeight:25.5,paddingBottom:12,paddingLeft:48,paddingRight:14,paddingTop:0},coItems:{color:"$ink",fontFamily:"sans",fontSize:17,gap:10,lineHeight:25.5,marginBottom:0,marginLeft:0,marginRight:0,marginTop:0,paddingBottom:0,paddingLeft:0,paddingRight:0,paddingTop:0},coItem:{alignItems:"center",color:"$ink",flexDirection:"row",fontFamily:"sans",fontSize:15,gap:12,grid:[44,"fr","auto"],lineHeight:22.5},coItemPic:{alignItems:"center",backgroundColor:"$linkWash",borderRadius:10,color:"$link",fontFamily:"sans",fontSize:15,height:44,justifyContent:"center",lineHeight:22.5,overflow:"hidden",width:44},coItemStrong:{color:"$ink",fontFamily:"sans",fontSize:15.5,fontWeight:"800",lineHeight:19.38},coItemSmall:{color:"$ink3",fontFamily:"sans",fontSize:13.5,lineHeight:20.25},coItemValue:{color:"$ink",fontFamily:"sans",fontSize:15,fontVariant:["tabular-nums"],fontWeight:"800",lineHeight:22.5},coRows:{backgroundColor:"$paper",borderRadius:16,color:"$ink",fontFamily:"sans",fontSize:17,lineHeight:25.5,marginBottom:0,marginLeft:0,marginRight:0,marginTop:0,paddingBottom:2,paddingLeft:14,paddingRight:14,paddingTop:2},coRow:{alignItems:"center",color:"$ink",flexDirection:"row",fontFamily:"sans",fontSize:14.5,gap:10,grid:[20,73.6,"fr"],lineHeight:21.75,minHeight:40},coRowSvg:{color:"$ink2",height:20,width:20},coRowLabel:{color:"$ink3",fontFamily:"sans",fontSize:14.5,lineHeight:21.75},coRowValue:{color:"$ink",fontFamily:"sans",fontSize:14.5,fontWeight:"700",lineHeight:21.75},coRowsShop:{backgroundColor:"$card",shadow:{x:0,y:1,blur:3,color:"#262523",opacity:.06}},coFine:{color:"$ink3",fontFamily:"sans",fontSize:12.5,lineHeight:18.13,marginBottom:0,marginLeft:0,marginRight:0,marginTop:0,textAlign:"center"},coSummary:{backgroundColor:"$paper",borderRadius:16,color:"$ink",fontFamily:"sans",fontSize:17,inner:null,lineHeight:25.5,marginBottom:0,marginLeft:0,marginRight:0,marginTop:0,paddingBottom:6,paddingLeft:16,paddingRight:16,paddingTop:6,shadow:null},weightField:{color:"$ink",fontFamily:"sans",fontSize:15,fontWeight:"700",gap:8,lineHeight:22.5,marginTop:14},weightInputWrap:{color:"$ink",fontFamily:"sans",fontSize:15,fontWeight:"700",lineHeight:22.5,position:"relative"},weightInput:{backgroundColor:"$card",borderRadius:16,color:"$ink",fontFamily:"sans",fontSize:24,fontVariant:["tabular-nums"],fontWeight:"800",height:58,inner:{width:1.5,color:"$n_DAD7D1"},lineHeight:36,paddingBottom:0,paddingLeft:18,paddingRight:56,paddingTop:0,width:"100%"},weightInputFocus:{inner:{width:2.5,color:"$ink"}},weightUnit:{color:"$ink3",fontFamily:"sans",fontSize:17,fontWeight:"700",lineHeight:25.5,position:"absolute",right:18,top:"50%"},weightError:{color:"$riskInk",fontFamily:"sans",fontSize:14,fontWeight:"700",lineHeight:21,marginBottom:0,marginLeft:0,marginRight:0,marginTop:6,minHeight:20},weightActions:{color:"$ink",fontFamily:"sans",fontSize:17,gap:8,lineHeight:25.5,marginTop:10},subCard:{alignItems:"center",backgroundColor:"$clearBg",borderRadius:22,color:"$ink",flexDirection:"row",fontFamily:"sans",fontSize:17,gap:12,grid:[56,"fr","auto"],lineHeight:25.5,paddingBottom:12,paddingLeft:12,paddingRight:14,paddingTop:12},subCardImage:{backgroundColor:"$card",borderRadius:14,height:56,width:56},subCardStrong:{color:"$ink",fontFamily:"sans",fontSize:16,fontWeight:"800",lineHeight:20},subCardSmall:{color:"$ink2",fontFamily:"sans",fontSize:14,lineHeight:18.9,marginTop:2},subCardButton:{backgroundColor:"$card",borderRadius:999,color:"$ink",fontFamily:"sans",fontSize:14,fontWeight:"800",inner:{width:1.5,color:"$ink"},lineHeight:21,minHeight:40,paddingBottom:0,paddingLeft:14,paddingRight:14,paddingTop:0},carrier:{alignItems:"center",color:"$ink",columnGap:12,flexDirection:"row",fontFamily:"sans",fontSize:17,grid:[40,"fr"],lineHeight:25.5,rowGap:4},carrierIcon:{alignItems:"center",backgroundColor:"$linkWash",borderRadius:11,color:"$link",fontFamily:"sans",fontSize:17,height:40,justifyContent:"center",lineHeight:25.5,width:40},carrierIconSvg:{height:21,width:21},carrierStrong:{color:"$ink",fontFamily:"sans",fontSize:16,fontWeight:"800",lineHeight:24},carrierSmall:{alignItems:"center",color:"$ink2",columnGap:8,flexDirection:"row",flexWrap:"wrap",fontFamily:"mono",fontSize:13,letterSpacing:.26,lineHeight:19.5,marginTop:1,rowGap:2},carrierButton:{alignItems:"center",alignSelf:"flex-start",backgroundColor:"transparent",borderRadius:999,color:"$ink",flexDirection:"row",fontFamily:"sans",fontSize:15,fontWeight:"700",gap:8,inner:{width:1.5,color:"$ink"},justifyContent:"center",lineHeight:22.5,marginTop:10,minHeight:40,paddingBottom:0,paddingLeft:16,paddingRight:16,paddingTop:0,textDecorationLine:"none"},carrierWait:{color:"$ink2",fontFamily:"sans",fontSize:14.5,lineHeight:20.3},carrierTag:{backgroundColor:"$ink",borderRadius:5,color:"$onInk",fontFamily:"mono",fontSize:10,letterSpacing:.6,lineHeight:15,paddingBottom:2,paddingLeft:6,paddingRight:6,paddingTop:2,textTransform:"uppercase"},toast:{backgroundColor:"$ink",borderRadius:16,color:"$onInk",fontFamily:"sans",fontSize:14.5,left:16,lineHeight:20.3,opacity:1,paddingBottom:12,paddingLeft:15,paddingRight:15,paddingTop:12,position:"absolute",right:16,top:62,zIndex:50},scrim:{backgroundColor:"$scrim",bottom:0,left:0,opacity:1,position:"absolute",right:0,top:0,zIndex:40},sheet:{backgroundColor:"$card",borderBottomLeftRadius:0,borderBottomRightRadius:0,borderTopLeftRadius:28,borderTopRightRadius:28,bottom:0,color:"$ink",fontFamily:"sans",fontSize:17,left:0,lineHeight:25.5,maxHeight:"80%",paddingBottom:40,paddingLeft:20,paddingRight:20,paddingTop:10,position:"absolute",right:0,zIndex:41},sheetGrab:{backgroundColor:"$n_DAD7D1",borderRadius:3,height:5,marginBottom:10,marginLeft:"auto",marginRight:"auto",marginTop:0,width:40},sheetTop:{alignItems:"center",color:"$ink",flexDirection:"row",fontFamily:"sans",fontSize:17,justifyContent:"space-between",lineHeight:25.5},sheetKicker:{color:"$ink3",fontFamily:"mono",fontSize:11,letterSpacing:.88,lineHeight:16.5,marginBottom:0,marginLeft:0,marginRight:0,marginTop:0,textTransform:"uppercase"},sheetClose:{alignItems:"center",backgroundColor:"transparent",borderRadius:20,color:"$ink",fontFamily:"sans",fontSize:17,height:40,justifyContent:"center",lineHeight:25.5,marginRight:-8,paddingBottom:0,paddingLeft:0,paddingRight:0,paddingTop:0,position:"relative",width:40},sheetCloseSvg:{height:22,width:22},sheetTitle:{color:"$ink",fontFamily:"serif",fontSize:24,fontWeight:"800",letterSpacing:-.24,lineHeight:27.6,marginBottom:0,marginLeft:0,marginRight:0,marginTop:0},sheetBody:{color:"$black",fontFamily:"sans",fontSize:16,gap:10,lineHeight:24,marginTop:12},blanksWrap:{color:"$ink",fontFamily:"sans",fontSize:17,lineHeight:25.5,marginTop:14},blanksCard:{backgroundColor:"$card",borderRadius:20,color:"$ink",fontFamily:"sans",fontSize:17,gap:8,lineHeight:25.5,paddingBottom:13,paddingLeft:12,paddingRight:12,paddingTop:12,shadow:{x:0,y:1,blur:3,color:"#262523",opacity:.06}},blanksHead:{alignItems:"center",color:"$ink3",flexDirection:"row",fontFamily:"sans",fontSize:12.5,fontWeight:"800",gap:10,justifyContent:"space-between",letterSpacing:.88,lineHeight:18.75,marginBottom:0,marginLeft:0,marginRight:0,marginTop:0,paddingBottom:2,paddingLeft:2,paddingRight:2,paddingTop:0,textTransform:"uppercase"},blanksPill:{backgroundColor:"$accent",borderRadius:999,color:"$ink",fontFamily:"sans",fontSize:13,fontStyle:"normal",fontWeight:"800",letterSpacing:.13,lineHeight:19.5,paddingBottom:2,paddingLeft:10,paddingRight:10,paddingTop:2,textTransform:"none"},blanksPillFilled:{backgroundColor:"$clearBg",color:"$clearInk"},blanksList:{color:"$ink",fontFamily:"sans",fontSize:17,gap:7,lineHeight:25.5,marginBottom:0,marginLeft:0,marginRight:0,marginTop:0,paddingBottom:0,paddingLeft:0,paddingRight:0,paddingTop:0},blanksRow:{alignItems:"center",backgroundColor:"$paper",borderRadius:15,color:"$ink",columnGap:11,flexDirection:"row",fontFamily:"sans",fontSize:17,grid:[34,"fr"],lineHeight:25.5,paddingBottom:9,paddingLeft:9,paddingRight:12,paddingTop:9},blanksNum:{alignItems:"center",backgroundColor:"$accentChip",borderRadius:11,color:"$ink",fontFamily:"serif",fontSize:22,fontWeight:"800",height:40,justifyContent:"center",lineHeight:33,width:34},blanksText:{color:"$ink",fontFamily:"sans",fontSize:16,fontWeight:"700",lineHeight:21.6},blanksSource:{color:"$ink3",fontFamily:"sans",fontSize:13.5,lineHeight:20.25},blank:{alignSelf:"flex-start",backgroundColor:"$accent4",borderRadius:6,color:"$ink",fontFamily:"sans",fontSize:16,fontStyle:"normal",fontWeight:"700",height:20,inner:{width:1.5,color:"$accent"},lineHeight:21.6,minWidth:36},blankS:{minWidth:24},blankL:{minWidth:64},blankFilled:{backgroundColor:"transparent",borderRadius:6,height:"auto",inner:null,marginBottom:0,marginLeft:-3,marginRight:-3,marginTop:0,minWidth:0,paddingBottom:0,paddingLeft:3,paddingRight:3,paddingTop:0,shadow:null},manageOrders:{backgroundColor:"transparent",color:"$link",fontFamily:"sans",fontSize:15,fontWeight:"700",lineHeight:22.5,minHeight:40,paddingBottom:0,paddingLeft:0,paddingRight:0,paddingTop:0,textDecorationLine:"underline"}}),RAPH_RN_PLAN_ICONS=/* @__PURE__ */Object.freeze({shield:{strokes:[{width:1.8,cap:true,closed:true,points:[12,3,19,6,19,12,18.759,14.125,18.074,16,17,17.625,15.593,19,13.907,20.125,12,21,10.093,20.125,8.407,19,7,17.625,5.926,16,5.241,14.125,5,12,5,6]},{width:1.8,cap:true,closed:false,points:[9,12,11,14,15,10]}],boxes:[],triangles:[],seams:[]},arrow:{strokes:[{width:2,cap:true,closed:false,points:[4.5,12,19,12]},{width:2,cap:true,closed:false,points:[13.5,6.5,19,12,13.5,17.5]}],boxes:[],triangles:[],seams:[]},check:{strokes:[{width:2.4,cap:true,closed:false,points:[5,12.6,9.4,17,19,7.4]}],boxes:[],triangles:[],seams:[]},star:{strokes:[],boxes:[],triangles:[[12,16.9,6.8,19.6,7.8,13.8],[16.2,13.8,17.2,19.6,12,16.9],[7.8,13.8,3.5,9.7,9.4,8.8],[14.6,8.8,20.5,9.7,16.2,13.8],[9.4,8.8,12,3.5,14.6,8.8],[16.2,13.8,12,16.9,7.8,13.8],[14.6,8.8,16.2,13.8,7.8,13.8],[14.6,8.8,7.8,13.8,9.4,8.8]],seams:[[12,16.9,7.8,13.8,.245,.677],[12,16.9,16.2,13.8,.245,.677],[7.8,13.8,9.4,8.8,.69,.248],[14.6,8.8,16.2,13.8,.248,.243],[14.6,8.8,9.4,8.8,.68,.245],[16.2,13.8,7.8,13.8,.677,.68],[14.6,8.8,7.8,13.8,.68,.69]]},truck:{strokes:[{width:1.7,cap:false,closed:true,points:[2.8,6.5,14.2,6.5,14.2,16,2.8,16]},{width:1.7,cap:false,closed:false,points:[14.2,9.5,17.8,9.5,21.2,12.9,21.2,16,14.2,16]}],boxes:[{x:5,y:15.8,w:3.6,h:3.6,radius:1.8,width:1.7},{x:15.4,y:15.8,w:3.6,h:3.6,radius:1.8,width:1.7}],triangles:[],seams:[]},refresh:{strokes:[{width:1.7,cap:true,closed:false,points:[4,12,4.343,14.363,5.368,16.52,6.985,18.278,9.048,19.48,11.374,20.021,13.756,19.85,15.981,18.984,17.852,17.5,19.201,15.53,19.909,13.249,19.912,10.861,19.21,8.578,17.865,6.605,15.998,5.116,13.775,4.245,11.393,4.068,9.066,4.602,7,5.8]},{width:1.7,cap:true,closed:false,points:[4,4,4,8,8,8]}],boxes:[],triangles:[],seams:[]},card:{strokes:[{width:1.7,cap:true,closed:false,points:[3,9.5,21,9.5]},{width:1.7,cap:true,closed:false,points:[6.5,15,10.5,15]}],boxes:[{x:3,y:5.5,w:18,h:13,radius:2.2,width:1.7}],triangles:[],seams:[]},alert:{strokes:[{width:1.9,cap:true,closed:true,points:[12,3.5,21.5,20,2.5,20]},{width:1.9,cap:true,closed:false,points:[12,10,12,14.5]},{width:1.9,cap:true,closed:false,points:[12,17.2,12.01,17.2]}],boxes:[],triangles:[],seams:[]},x:{strokes:[{width:2,cap:true,closed:false,points:[6.5,6.5,17.5,17.5]},{width:2,cap:true,closed:false,points:[17.5,6.5,6.5,17.5]}],boxes:[],triangles:[],seams:[]},chat:{strokes:[{width:1.7,cap:false,closed:true,points:[5,5.2,19,5.2,19.8,5.414,20.386,6,20.6,6.8,20.6,15.4,20.386,16.2,19.8,16.786,19,17,10.3,17,5.5,20.6,5.5,17,5,17,4.2,16.786,3.614,16.2,3.4,15.4,3.4,6.8,3.614,6,4.2,5.414,5,5.2]}],boxes:[],triangles:[],seams:[]},repeat:{strokes:[{width:1.8,cap:true,closed:false,points:[4.5,11,4.824,8.824,5.766,6.837,7.244,5.208,9.131,4.077,11.264,3.543,13.461,3.65,15.533,4.391,17.3,5.7,19.5,8]},{width:1.8,cap:true,closed:false,points:[19.5,3.5,19.5,8,15,8]},{width:1.8,cap:true,closed:false,points:[19.5,13,19.176,15.176,18.234,17.163,16.756,18.792,14.869,19.923,12.736,20.457,10.539,20.35,8.467,19.609,6.7,18.3,4.5,16]},{width:1.8,cap:true,closed:false,points:[4.5,20.5,4.5,16,9,16]}],boxes:[],triangles:[],seams:[]},calendar:{strokes:[{width:1.8,cap:true,closed:false,points:[4,10,20,10]},{width:1.8,cap:true,closed:false,points:[8.5,3.5,8.5,7.5]},{width:1.8,cap:true,closed:false,points:[15.5,3.5,15.5,7.5]}],boxes:[{x:4,y:5.5,w:16,h:15,radius:2.5,width:1.8}],triangles:[],seams:[]},flame:{strokes:[],boxes:[],triangles:[[12.15,14.513,13.1,15.2,13.1,13.7],[11.5,13.3,12.15,14.513,13.1,13.7],[16.874,10.907,15.7,9.3,15.381,10.659],[14.7,16.7,16.838,18.516,17.693,16.84],[14.7,16.7,14.489,17.681,16.838,18.516],[18,14.9,14.507,15.633,17.693,16.84],[16.874,10.907,15.381,10.659,14.685,11.707],[17.693,12.759,16.874,10.907,14.685,11.707],[15.538,19.832,16.838,18.516,14.489,17.681],[14.685,11.707,13.959,14.633,17.693,12.759],[17.693,12.759,13.959,14.633,18,14.9],[13.891,20.692,13.055,19.006,12,21],[12,21,12,19.2,10.109,20.692],[8.462,19.832,10.109,20.692,10.659,18.863],[10.659,18.863,9.741,17.97,8.462,19.832],[6.307,16.84,9.602,15.677,6,14.9],[6.273,13.033,6,14.9,9.602,15.677],[9.602,15.677,10.113,14.812,6.273,13.033],[6.988,11.438,6.273,13.033,10.113,14.812],[13.525,7.088,12.856,5.017,12,3.5],[13.856,9.589,13.525,7.088,12,3.5],[13.7,12.4,13.856,9.589,12,3.5],[10.113,14.812,10.792,14.042,6.988,11.438],[14.7,16.7,17.693,16.84,14.507,15.633],[13.7,12.4,13.959,14.633,14.685,11.707],[14.507,15.633,18,14.9,13.959,14.633],[13.1,13.7,13.959,14.633,13.7,12.4],[11.5,13.3,13.1,13.7,13.7,12.4],[7.983,10.048,6.988,11.438,10.792,14.042],[10.792,14.042,11.5,13.3,7.983,10.048],[14.489,17.681,13.913,18.475,15.538,19.832],[13.891,20.692,15.538,19.832,13.913,18.475],[13.891,20.692,13.913,18.475,13.055,19.006],[12,19.2,12,21,13.055,19.006],[10.659,18.863,10.109,20.692,12,19.2],[7.162,18.516,8.462,19.832,9.741,17.97],[9.741,17.97,9.4,16.7,7.162,18.516],[6.307,16.84,7.162,18.516,9.4,16.7],[6.307,16.84,9.4,16.7,9.602,15.677],[9.1,8.8,7.983,10.048,11.5,13.3],[11.5,13.3,13.7,12.4,9.1,8.8],[10.054,7.77,9.1,8.8,13.7,12.4],[10.927,6.683,10.054,7.77,13.7,12.4],[11.613,5.481,10.927,6.683,13.7,12.4],[12.006,4.106,11.613,5.481,13.7,12.4],[12,2.5,12.006,4.106,13.7,12.4],[12,2.5,13.7,12.4,12,3.5]],seams:[[12.15,14.513,13.1,13.7,.121,.428],[11.5,13.3,13.1,13.7,.681,.356],[15.381,10.659,16.874,10.907,.033,.883],[14.7,16.7,16.838,18.516,.648,1.318],[14.7,16.7,17.693,16.84,.648,1.533],[14.489,17.681,16.838,18.516,.51,1.318],[14.507,15.633,18,14.9,.782,1.787],[14.507,15.633,17.693,16.84,.782,1.533],[14.685,11.707,16.874,10.907,.68,.883],[14.685,11.707,17.693,12.759,.61,.484],[14.489,17.681,15.538,19.832,.51,1.115],[13.959,14.633,14.685,11.707,1.333,.576],[13.959,14.633,17.693,12.759,.851,.484],[13.959,14.633,18,14.9,.851,1.787],[13.055,19.006,13.891,20.692,.36,.984],[12,21,13.055,19.006,.945,.395],[12,19.2,12,21,.394,.945],[10.109,20.692,12,19.2,.715,.394],[10.109,20.692,10.659,18.863,.715,.428],[10.659,18.863,8.462,19.832,.428,.809],[8.462,19.832,9.741,17.97,.809,.525],[6.307,16.84,9.602,15.677,1.65,.812],[6,14.9,9.602,15.677,.194,1.012],[6.273,13.033,9.602,15.677,2.068,1.012],[10.113,14.812,6.273,13.033,1.217,2.068],[10.113,14.812,6.988,11.438,1.217,2.2],[12,3.5,13.525,7.088,4.697,5.571],[12,3.5,13.856,9.589,4.697,3.017],[12,3.5,13.7,12.4,4.648,26.765],[10.792,14.042,6.988,11.438,1.339,2.2],[13.7,12.4,13.959,14.633,.819,1.333],[13.1,13.7,13.7,12.4,0,.819],[11.5,13.3,13.7,12.4,.681,.537],[10.792,14.042,7.983,10.048,1.339,2.328],[11.5,13.3,7.983,10.048,1.438,2.328],[13.913,18.475,15.538,19.832,.409,1.115],[13.891,20.692,13.913,18.475,.984,.409],[7.162,18.516,9.741,17.97,.977,.525],[7.162,18.516,9.4,16.7,.977,.677],[6.307,16.84,9.4,16.7,1.65,.677],[11.5,13.3,9.1,8.8,1.438,1.129],[13.7,12.4,9.1,8.8,2.046,1.129],[10.054,7.77,13.7,12.4,.079,2.285],[10.927,6.683,13.7,12.4,.237,3.126],[11.613,5.481,13.7,12.4,.475,5.451],[12.006,4.106,13.7,12.4,.961,15.892],[12,2.5,13.7,12.4,2.974,26.765]]},box:{strokes:[{width:1.7,cap:false,closed:true,points:[3.8,7.8,12,4,20.2,7.8,20.2,16.4,12,20,3.8,16.4]},{width:1.7,cap:false,closed:false,points:[3.8,7.8,12,11.6,20.2,7.8]},{width:1.7,cap:false,closed:false,points:[12,11.6,12,20]}],boxes:[],triangles:[],seams:[]},cart:{strokes:[{width:1.8,cap:true,closed:false,points:[2.8,4,5.4,4,7.7,14.6,8.203,15.401,9.1,15.7,17.3,15.7,18.197,15.401,18.7,14.6,20.4,7.6,6.3,7.6]}],boxes:[{x:8.3,y:18.3,w:2.6,h:2.6,radius:1.3,width:1.8},{x:15.8,y:18.3,w:2.6,h:2.6,radius:1.3,width:1.8}],triangles:[],seams:[]},minus:{strokes:[{width:2.2,cap:true,closed:false,points:[6,12,18,12]}],boxes:[],triangles:[],seams:[]},plus:{strokes:[{width:2.2,cap:true,closed:false,points:[12,6,12,18]},{width:2.2,cap:true,closed:false,points:[6,12,18,12]}],boxes:[],triangles:[],seams:[]},chev:{strokes:[{width:2,cap:true,closed:false,points:[9,5.5,15.5,12,9,18.5]}],boxes:[],triangles:[],seams:[]},pulse:{strokes:[{width:1.8,cap:true,closed:false,points:[3,12.5,6.8,12.5,9.2,6.9,13.4,17.5,15.8,12.5,21,12.5]}],boxes:[],triangles:[],seams:[]},file:{strokes:[{width:1.7,cap:true,closed:true,points:[7,3.5,14.2,3.5,18.5,7.8,18.5,20,18.324,20.424,17.9,20.6,7,20.6,6.576,20.424,6.4,20,6.4,4.1,6.576,3.676,7,3.5]},{width:1.7,cap:true,closed:false,points:[14,3.6,14,8,18.4,8]},{width:1.7,cap:true,closed:false,points:[9.4,12.4,14.6,12.4]},{width:1.7,cap:true,closed:false,points:[9.4,15.8,14.6,15.8]}],boxes:[],triangles:[],seams:[]},kit:{strokes:[{width:1.7,cap:false,closed:true,points:[4,7.6,12,3.6,20,7.6,20,16.4,12,20.4,4,16.4]},{width:1.7,cap:false,closed:false,points:[4,7.6,12,11.6,20,7.6]},{width:1.7,cap:false,closed:false,points:[12,11.6,12,20.4]}],boxes:[],triangles:[],seams:[]},dna:{strokes:[{width:1.7,cap:true,closed:false,points:[7,3.5,7.28,4.645,8.04,5.594,9.16,6.394,10.52,7.097,12,7.75,13.48,8.403,14.84,9.106,15.96,9.906,16.72,10.855,17,12,16.72,13.145,15.96,14.094,14.84,14.894,13.48,15.597,12,16.25,10.52,16.903,9.16,17.606,8.04,18.406,7.28,19.355,7,20.5]},{width:1.7,cap:true,closed:false,points:[17,3.5,16.72,4.645,15.96,5.594,14.84,6.394,13.48,7.097,12,7.75,10.52,8.403,9.16,9.106,8.04,9.906,7.28,10.855,7,12,7.28,13.145,8.04,14.094,9.16,14.894,10.52,15.597,12,16.25,13.48,16.903,14.84,17.606,15.96,18.406,16.72,19.355,17,20.5]},{width:1.7,cap:true,closed:false,points:[8.6,6.3,15.4,6.3]},{width:1.7,cap:true,closed:false,points:[8.6,17.7,15.4,17.7]},{width:1.7,cap:true,closed:false,points:[10.4,9.6,13.6,9.6]},{width:1.7,cap:true,closed:false,points:[10.4,14.4,13.6,14.4]}],boxes:[],triangles:[],seams:[]},heart:{strokes:[{width:1.8,cap:false,closed:true,points:[12,20.2,11.739,20.035,11.041,19.559,10.03,18.804,8.831,17.799,7.569,16.575,6.37,15.163,5.359,13.593,4.661,11.895,4.4,10.1,4.833,8.454,5.87,7.105,7.349,6.264,9.039,6.062,10.675,6.532,12,7.6,13.325,6.532,14.961,6.062,16.651,6.264,18.13,7.105,19.167,8.454,19.6,10.1,19.339,11.895,18.641,13.593,17.63,15.163,16.431,16.575,15.169,17.799,13.97,18.804,12.959,19.559,12.261,20.035,12,20.2]}],boxes:[],triangles:[],seams:[]},bottle:{strokes:[{width:1.7,cap:false,closed:true,points:[7.2,6.2,16.8,6.2,17.507,6.493,17.8,7.2,17.8,19.5,17.572,20.35,16.95,20.972,16.1,21.2,7.9,21.2,7.05,20.972,6.428,20.35,6.2,19.5,6.2,7.2,6.493,6.493,7.2,6.2]},{width:1.7,cap:false,closed:true,points:[9,11,15,11,15,16,9,16]}],boxes:[{x:8,y:2.8,w:8,h:3.4,radius:1,width:1.7}],triangles:[],seams:[]},harness:{strokes:[{width:1.5,cap:true,closed:false,points:[7.5,4.5,7.728,6.82,8.364,8.708,9.336,10.116,10.572,10.996,12,11.3,13.428,10.996,14.664,10.116,15.636,8.708,16.272,6.82,16.5,4.5]},{width:1.5,cap:true,closed:true,points:[5,12.6,19,12.6,19,17.2,18.692,18.35,17.85,19.192,16.7,19.5,7.3,19.5,6.15,19.192,5.308,18.35,5,17.2]},{width:1.5,cap:true,closed:false,points:[8.2,15.3,15.8,15.3]}],boxes:[{x:10.7,y:8.9,w:2.6,h:2.6,radius:1.3,width:1.5}],triangles:[],seams:[]},ramp:{strokes:[{width:1.5,cap:true,closed:false,points:[2.5,19.5,21.5,19.5]},{width:1.5,cap:true,closed:false,points:[3.5,19.5,3.5,16.5,8,16.5,8,13.5,12.5,13.5,12.5,10.5,17,10.5,17,7.5,20.5,7.5,20.5,19.5]},{width:1.5,cap:true,closed:false,points:[3.5,16.5,20.5,7.5],opacity:.35}],boxes:[],triangles:[],seams:[]}});var BOX=24,FINE=16,SEAM=.8,fine=dp=>Math.round(dp*FINE);function place(cx,cy,W,H,ux,uy){let left=cx-W/2,top=cy-H/2,x=Math.round(left),y=Math.round(top);return{position:"absolute",left:x,top:y,width:W,height:H,transform:[{translateX:left-x},{translateY:top-y},{rotate:`${Math.atan2(uy,ux)*180/Math.PI}deg`},{scale:1/FINE}]}}function strokePieces(icon,k,out){for(let s of icon.strokes){let w=s.width*k,pts=s.points,n=pts.length/2,last=s.closed?n:n-1;for(let i=0;i<last;i+=1){let j=(i+1)%n,px=(pts[i*2]??0)*k,py=(pts[i*2+1]??0)*k,dx=(pts[j*2]??0)*k-px,dy=(pts[j*2+1]??0)*k-py,len=Math.hypot(dx,dy);if(len===0&&!(n===2&&s.cap))continue;let ux=len===0?1:dx/len,uy=len===0?0:dy/len,e0=s.closed||i>0||s.cap?w/2:0,e1=s.closed||j!==n-1||s.cap?w/2:0,along=(len+e1-e0)/2;out.push({paint:"backgroundColor",style:{...place(px+ux*along,py+uy*along,fine(len+e0+e1),fine(w),ux,uy),borderTopLeftRadius:e0>0?fine(w)/2:0,borderBottomLeftRadius:e0>0?fine(w)/2:0,borderTopRightRadius:e1>0?fine(w)/2:0,borderBottomRightRadius:e1>0?fine(w)/2:0,...s.opacity===void 0?{}:{opacity:s.opacity}}})}}}function boxPieces(icon,k,out){for(let b of icon.boxes){let w=(b.w+b.width)*k,h=(b.h+b.width)*k;out.push({paint:"borderColor",style:{...place((b.x-b.width/2)*k+w/2,(b.y-b.width/2)*k+h/2,fine(w),fine(h),1,0),borderWidth:fine(b.width*k),borderRadius:(b.radius+b.width/2)*k*FINE,...b.opacity===void 0?{}:{opacity:b.opacity}}})}}function trianglePieces(icon,k,out){for(let t of icon.triangles){let p=[0,1,2].map(i=>[(t[i*2]??0)*k,(t[i*2+1]??0)*k]),base3=0,len=-1;for(let i=0;i<3;i+=1){let a2=p[i]??[0,0],b=p[(i+1)%3]??[0,0],d=Math.hypot(b[0]-a2[0],b[1]-a2[1]);d>len&&(len=d,base3=i)}if(len<=0)continue;let b0=p[base3]??[0,0],b1=p[(base3+1)%3]??[0,0],a=p[(base3+2)%3]??[0,0],ux=(b1[0]-b0[0])/len,uy=(b1[1]-b0[1])/len,along=(a[0]-b0[0])*ux+(a[1]-b0[1])*uy,across=(a[0]-b0[0])*-uy+(a[1]-b0[1])*ux,h=Math.abs(across),up=across<0,mid=up?-h/2:h/2,bl=fine(along),br=fine(len)-bl,bh=fine(h);out.push({paint:up?"borderBottomColor":"borderTopColor",style:{...place(b0[0]+ux*(len/2)-uy*mid,b0[1]+uy*(len/2)+ux*mid,bl+br,bh,ux,uy),width:0,height:0,borderLeftWidth:bl,borderRightWidth:br,borderLeftColor:"transparent",borderRightColor:"transparent",...up?{borderBottomWidth:bh}:{borderTopWidth:bh}}})}for(let e of icon.seams){let x0=(e[0]??0)*k,y0=(e[1]??0)*k,dx=(e[2]??0)*k-x0,dy=(e[3]??0)*k-y0,d=Math.hypot(dx,dy),in0=SEAM*(e[4]??0),in1=SEAM*(e[5]??0),bar=d-in0-in1;if(d===0||bar<=0)continue;let mid=in0+bar/2;out.push({paint:"backgroundColor",style:place(x0+dx/d*mid,y0+dy/d*mid,fine(bar),fine(SEAM),dx/d,dy/d)})}}var cache=/* @__PURE__ */new Map;function piecesOf(name,size){let key=`${name}:${size}`,hit=cache.get(key);if(hit!==void 0)return hit;let icon=RAPH_RN_PLAN_ICONS[name],out=[],k=size/BOX;return boxPieces(icon,k,out),strokePieces(icon,k,out),trianglePieces(icon,k,out),cache.set(key,out),out}function FocusIcon({name:name,size:size=18,color:color}){let pieces=RAPH_RN_PLAN_ICONS[name]===void 0?[]:piecesOf(name,size);/* @__PURE__ */
|
|
126
|
+
return jsx(View,{accessibilityElementsHidden:true,importantForAccessibility:"no-hide-descendants",testID:`health-plan-icon-${name}`,children:/* @__PURE__ */jsx(View,{style:{width:size,height:size},children:pieces.map((piece,i)=>/* @__PURE__ */jsx(View,{style:[piece.style,{[piece.paint]:color}]},i))})})}var CLOSE_FALLBACK="Close",HEALTH_PLAN_TOP_CARD_COPY=/* @__PURE__ */Object.freeze({action:who=>who.possessive===null?null:`See ${who.possessive} Health Plan`,ask:"What does it mean?",askPrompt:(focus,ask)=>focus.risk?.lead?`${focus.risk.lead} ${ask}`:`${focus.title}: ${ask}`,close:who=>who.possessive===null?null:`Close ${who.possessive} focus`});function healthPlanPossessive(pet){let sex=typeof pet.sex=="string"?pet.sex.trim().toLowerCase():null;if(sex==="female")return"her";if(sex==="male")return"his";let name=typeof pet.name=="string"?pet.name.trim():"";return name!==""?`${name}'s`:null}function healthPlanTopCard(page,options={}){let focus=page?.page?.focus;if(page===null||focus===void 0||focus.title.trim()===""||focus.kicker.trim()==="")return;let copy={...HEALTH_PLAN_TOP_CARD_COPY,...options.copy},who={pet:page.pet,possessive:healthPlanPossessive(page.pet)},badge=focus.sources?.find(source=>source.label.trim()!=="")?.label,onOpenPlan=options.onOpenPlan,action=onOpenPlan===void 0?null:copy.action(who),close=copy.close(who),ask=copy.ask.trim();return{kicker:focus.kicker,...badge===void 0?{}:{badge:badge},title:focus.title,...focus.risk?.lead?{lead:focus.risk.lead}:{},...focus.risk?.body?{body:focus.risk.body}:{},...action===null||action.trim()===""||onOpenPlan===void 0?{}:{action:{label:action,onPress:onOpenPlan}},...ask===""?{}:{ask:{label:ask,prompt:copy.askPrompt(focus,ask)}},closeLabel:close===null||close.trim()===""?CLOSE_FALLBACK:close,pill:focus.kicker,...options.renderIcon===void 0?{}:{renderIcon:options.renderIcon}}}var HEALTH_PLAN_FOCUS_RN_COPY=/* @__PURE__ */Object.freeze({...HEALTH_PLAN_FOCUS_COPY,firstBoxShips:"Her first box ships.",placedShips:"It ships.",trackingComesByText:"",trackingByText:"",moreOrders:"Load more",checkoutFailed:"That didn't go through. Please try again.",back:"Back"}),cap=s=>s===""?s:`${s.charAt(0).toUpperCase()}${s.slice(1)}`;function healthPlanPetCopy(pet){let name=pet.name?.trim()??"",her=healthPlanPossessive(pet)??"your pet's",Her=cap(her),them=pet.sex==="female"?"her":pet.sex==="male"?"him":name!==""?name:"your pet",base3=HEALTH_PLAN_FOCUS_COPY,r5=healthPlanFocusCopyFor({name:pet.name,sex:pet.sex});return{jumpKicker:(p,subscribed)=>subscribed?`In ${her} plan, every ${p.intervalDays} days`:p.offer?`${p.discountPercent}% off ${her} first box`:base3.jumpKicker(p,false),firstBoxShips:pet.trackingTexts===true?`${Her} first box ships. Tracking comes by text.`:`${Her} first box ships.`,placedShips:base3.placedShips,trackingComesByText:pet.trackingTexts===true?base3.trackingComesByText:"",trackingByText:pet.trackingTexts===true?base3.trackingByText:"",refill:`A text 3 days before ${her} next box. Reply SKIP to skip it.`,nextBoxShips:p=>`${Her} next box ships, ${p.box??""}.`,startedDone:`Back to ${her} plan`,skipped:(_p,next)=>next===null?"Skipped.":`Skipped. ${Her} next box ships ${next}.`,cancelled:p=>`${p.productName} is cancelled. Restart it from ${her} plan anytime.`,seeOrders:`See ${her} orders`,cartOnceLine:(p,subscribed)=>subscribed?`An extra box. ${Her} plan keeps shipping.`:base3.cartOnceLine(p,false),herSubscription:`${Her} subscription`,ordersHeading:afterSubscription=>afterSubscription?"Orders":`${Her} orders`,addWeightTitle:`Add ${her} weight to size ${her} dose`,addWeightBody:`From a home scale or ${her} last vet visit.`,connectRecordsTitle:`Connect ${her} vet records`,connectRecordsBody:`${Her} weight, visits and labs make ${her} plan sharper.`,weightKicker:`${Her} weight`,weightBody:`From a home scale or ${her} last vet visit. ${Her} plan uses it to size ${her} dose.`,weightField:`${Her} weight`,weightError:`Enter ${her} weight in pounds, like 14.1.`,weightSave:`Save ${her} weight`,weightSaved:lb=>`Saved: ${lb} lb. ${Her} dose is sized for ${them}.`,weightErrorKg:r5.weightErrorKg,weightSavedKg:r5.weightSavedKg,signalsFit:r5.signalsFit,noPick:r5.noPick,saveForCheckup:r5.saveForCheckup,savedForCheckup:r5.savedForCheckup,blanksLabel:r5.blanksLabel,blanksFilledKicker:r5.blanksFilledKicker,blanksWeight:r5.blanksWeight,blanksWeightSource:r5.blanksWeightSource,blanksDoseSource:r5.blanksDoseSource,blanksShots:r5.blanksShots,blanksShotsSource:r5.blanksShotsSource,recordsLanded:r5.recordsLanded}}function toRgba(value){if(typeof value=="number")return argbIntToRgba(value);if(typeof value!="string")return null;let s=value.trim();if(s.length===0)return null;if(s.startsWith("#"))return fromHex(s.slice(1));if(s.toLowerCase().startsWith("0x"))return fromHex(s.slice(2));if(s.toLowerCase().startsWith("rgb"))return fromRgbFunc(s);if(/^[0-9a-fA-F]+$/.test(s)){let hex=fromHex(s);if(hex!==null)return hex}return/^\d+$/.test(s)?argbIntToRgba(Number.parseInt(s,10)):null}function fromHex(hex){let h=hex.trim();if(!/^[0-9a-fA-F]+$/.test(h))return null;if(h.length===3)return{r:dup(h[0]),g:dup(h[1]),b:dup(h[2]),a:1};if(h.length===6)return{r:byte(h,0),g:byte(h,2),b:byte(h,4),a:1};if(h.length===8){let a=byte(h,0);return{r:byte(h,2),g:byte(h,4),b:byte(h,6),a:a/255}}return null}function fromRgbFunc(input){let open=input.indexOf("("),close=input.indexOf(")");if(open<0||close<0||close<open)return null;let parts=input.slice(open+1,close).split(",").map(p=>p.trim());if(parts.length<3)return null;let r=clampByte(Number(parts[0])),g=clampByte(Number(parts[1])),b=clampByte(Number(parts[2]));if(r===null||g===null||b===null)return null;let a=1;if(parts.length>=4){let alpha=Number(parts[3]);if(!Number.isFinite(alpha))return null;a=Math.min(1,Math.max(0,alpha))}return{r:r,g:g,b:b,a:a}}function argbIntToRgba(n){if(!Number.isFinite(n))return null;let int2=Math.trunc(n)>>>0,a=int2>>>24&255;return{r:int2>>>16&255,g:int2>>>8&255,b:int2&255,a:a===0?1:a/255}}function byte(hex,at){return Number.parseInt(hex.slice(at,at+2),16)}function dup(nibble){return Number.parseInt(`${nibble??"0"}${nibble??"0"}`,16)}function clampByte(n){return Number.isFinite(n)?Math.min(255,Math.max(0,Math.round(n))):null}function rgbToHex(r,g,b){return`#${hex2(r)}${hex2(g)}${hex2(b)}`.toUpperCase()}function hex2(n){return n.toString(16).padStart(2,"0")}var NEAR_BLACK="#111111",WHITE="#FFFFFF",BLACK="#000000";function readableOn(background){let rgba=toRgba(background);if(rgba===null)return WHITE;let bg=relativeLuminance(rgba),black=relativeLuminance({r:17,g:17,b:17}),white=relativeLuminance({r:255,g:255,b:255});return luminanceContrast(bg,white)>=luminanceContrast(bg,black)?WHITE:NEAR_BLACK}function legibleOn(background,target){let first=readableOn(background);return contrastRatio(first,background)>=target?first:contrastRatio(WHITE,background)>=contrastRatio(BLACK,background)?WHITE:BLACK}function poleForGrounds(grounds){let worst=ink=>grounds.reduce((low,ground)=>Math.min(low,contrastRatio(ink,ground)),Number.POSITIVE_INFINITY);return worst(WHITE)>=worst(BLACK)?WHITE:BLACK}function relativeLuminance(rgba){let r=linearize(rgba.r/255),g=linearize(rgba.g/255),b=linearize(rgba.b/255);return.2126*r+.7152*g+.0722*b}function linearize(channel){return channel<=.03928?channel/12.92:Math.pow((channel+.055)/1.055,2.4)}function luminanceContrast(l1,l2){let lighter=Math.max(l1,l2),darker=Math.min(l1,l2);return(lighter+.05)/(darker+.05)}function contrastRatio(a,b){let fg=toRgba(a),bg=toRgba(b);if(fg===null||bg===null)return 1;let ground=bg.a>=1?bg:{...bg},fore=fg.a>=1?fg:composite(fg,ground);return luminanceContrast(relativeLuminance(fore),relativeLuminance(ground))}function composite(fg,bg){let a=fg.a,mix=(f,g)=>Math.round(f*a+g*(1-a));return{r:mix(fg.r,bg.r),g:mix(fg.g,bg.g),b:mix(fg.b,bg.b),a:1}}function flattenOnto(color,background){let fg=toRgba(color),bg=toRgba(background);if(fg===null||bg===null)return null;let out=fg.a>=1?fg:composite(fg,{...bg});return rgbToHex(out.r,out.g,out.b)}var PUSH_STEP=.05;function pushToContrast(color,grounds,pole,target){let first=grounds[0];if(first===void 0)return pole;let reads=candidate=>grounds.every(ground=>contrastRatio(candidate,ground)>=target);if(toRgba(color)===null)return pole;if(reads(color))return color;let flat=flattenOnto(color,first),from=flat===null?null:toRgba(flat),to=toRgba(pole);if(from===null||to===null)return pole;for(let step=1;step<1/PUSH_STEP;step+=1){let t=step*PUSH_STEP,mix=(a,b)=>Math.round(a+(b-a)*t),candidate=rgbToHex(mix(from.r,to.r),mix(from.g,to.g),mix(from.b,to.b));if(reads(candidate))return candidate}return pole}var RAPH_V3_LIGHT=/* @__PURE__ */Object.freeze({ink:"#262523",ink2:"#4A4845",ink3:"#6B6863",paper:"#F8F7F4",card:"#FFFFFF",line:"#E7E6E2",tile:"#F2F1EE",shadow:"rgba(38, 37, 35, .07)",riskBg:"#FFE3E1",riskInk:"#B0231B",riskDot:"#E5372B",clearBg:"#E6F4D3",clearInk:"#2F6A12",clearDot:"#5FA82B",watchDot:"#E5A000"}),cache2=/* @__PURE__ */new WeakMap;function v3Palette(theme){let hit=cache2.get(theme);if(hit!==void 0)return hit;let c=theme.color,dark=theme.brightness==="dark",neutrals=dark?{dark:dark,ink:c.text.primary,ink2:c.text.secondary,ink3:c.text.muted,paper:c.background,card:c.surface,line:c.borderRingCream,tile:c.surfaceSubtle,shadow:c.shadow,riskBg:c.badgeBgCritical,riskInk:c.danger,riskDot:c.danger,clearBg:c.badgeBgPositive,clearInk:c.success,clearDot:c.success,watchDot:c.warningStrong}:{dark:dark,...RAPH_V3_LIGHT},textOn=(ink,grounds)=>pushToContrast(ink,grounds,poleForGrounds(grounds),V3_TEXT_CONTRAST),labelOn=(ink,fill)=>contrastRatio(ink,fill)>=V3_TEXT_CONTRAST?ink:legibleOn(fill,V3_TEXT_CONTRAST),badgeGrounds=[neutrals.card,neutrals.paper].map(under=>flattenOnto(c.brandSoft,under)??under),brand={primary:c.primary,onPrimary:labelOn(c.onPrimary,c.primary),accent:c.accent,onAccent:labelOn(c.onAccent,c.accent),link:textOn(c.linkInk,[neutrals.card,neutrals.paper,neutrals.tile]),badge:c.brandSoft,onBadge:textOn(c.brandInk,badgeGrounds)},palette=/* @__PURE__ */Object.freeze({...neutrals,...brand});return cache2.set(theme,palette),palette}var V3_TEXT_CONTRAST=4.5;var PLAN_LIGHT=/* @__PURE__ */Object.freeze({black:"#000000",onInk:"#FFFFFF",wash:"rgba(38, 37, 35, 0.06)",scrim:"rgba(38, 37, 35, 0.38)",riskChip:"#FFD8D6",clearChip:"#DDEFC4"});function rgb(color){let c=color.trim(),h=/^#([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(c);if(h!==null){let x=h[1].length===3?h[1].split("").map(d=>d+d).join(""):h[1];return[0,2,4].map(k=>parseInt(x.slice(k,k+2),16))}let r=/^rgba?\(\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)/i.exec(c);return r===null?null:[Number(r[1]),Number(r[2]),Number(r[3])]}function mixPlanColor(color,share,ground){let a=rgb(color),b=rgb(ground);if(a===null||b===null)return ground;let to=k=>Math.round(a[k]*share+b[k]*(1-share)).toString(16).padStart(2,"0");return`#${to(0)}${to(1)}${to(2)}`.toUpperCase()}function clearOf(color){let c=rgb(color);return c===null?"transparent":`rgba(${c[0]}, ${c[1]}, ${c[2]}, 0)`}function planRoles(theme){let c=theme.color,v=v3Palette(theme),card=v.card,link=v.link;return{ink:v.ink,ink2:v.ink2,ink3:v.ink3,paper:v.paper,tile:v.tile,line:v.line,card:card,riskBg:v.riskBg,riskInk:v.riskInk,riskDot:v.riskDot,clearBg:v.clearBg,clearInk:v.clearInk,clearDot:v.clearDot,watchDot:v.watchDot,...v.dark?{black:c.text.primary,onInk:c.background,wash:mixPlanColor(c.text.primary,.08,c.surface),scrim:"rgba(0, 0, 0, 0.6)",riskChip:c.badgeBgCritical,clearChip:c.badgeBgPositive}:PLAN_LIGHT,primary:v.primary,onPrimary:v.onPrimary,accent:v.accent,accent4:mixPlanColor(c.accent,.17,card),accent3:mixPlanColor(c.accent,.25,card),accentChip:mixPlanColor(c.accent,.47,card),link:link,linkWash:(v.dark?void 0:theme.slots.planWash?.backgroundColor)??mixPlanColor(link,.12,card),linkChip:(v.dark?void 0:theme.slots.planChip?.backgroundColor)??mixPlanColor(link,.2,card)}}var TEXT_KEYS=/* @__PURE__ */new Set(["fontSize","fontWeight","fontFamily","fontStyle","letterSpacing","lineHeight","textTransform","color","textAlign","textDecorationLine","fontVariant"]),DROP=/* @__PURE__ */new Set(["justifyItems"]);function font(theme,family,weight){let w=Number(weight??400);if(family==="serif"){let h=headingFace(theme,"bold");return h.fontWeight===void 0?{fontFamily:h.fontFamily}:{fontFamily:h.fontFamily,fontWeight:String(w)}}let mono=family==="mono",key=w>=650?mono?"monoBold":"bold":w>=450?mono?"monoMedium":"medium":mono?"mono":"regular",f=face(theme,key);return theme.type.namedFaces[key]?{fontFamily:f.fontFamily}:{fontFamily:f.fontFamily,fontWeight:String(w)}}function paintPart(theme,roles,part,dark,line){let box={},text2={},colour=v=>{if(!v.startsWith("$"))return v;let name=v.slice(1);return name.startsWith("n_")?dark?line:`#${name.slice(2)}`:roles[name]??v},rings=[],inner;for(let[key,value]of Object.entries(part))if(!(value===void 0||DROP.has(key)||key==="grid"||key==="fontWeight"))if(key==="fontFamily")Object.assign(text2,font(theme,String(value),part.fontWeight));else if(key==="shadow"){if(value===null)Object.assign(box,{shadowOpacity:0,elevation:0});else if(!dark){let s=value;Object.assign(box,{shadowColor:colour(s.color),shadowOpacity:s.opacity,shadowRadius:s.blur,shadowOffset:{width:s.x,height:s.y},elevation:Math.max(1,Math.round(s.blur/2))})}}else if(key==="inner"){let r=value;inner=r===null?null:{position:"absolute",top:0,right:0,bottom:0,left:0,borderWidth:r.width,borderColor:colour(r.color),pointerEvents:"none"}}else if(key==="ring"){let list=value,radius=typeof part.borderRadius=="number"?part.borderRadius:0;rings=list.map((r,i)=>({borderWidth:r.width-(list[i-1]?.width??0),borderColor:colour(r.color),borderRadius:radius+r.width})).reverse()}else key==="color"||key.endsWith("Color")?(key==="color"?text2:box)[key]=colour(String(value)):(TEXT_KEYS.has(key)?text2:box)[key]=value;part.fontWeight!==void 0&&part.fontFamily===void 0&&Object.assign(text2,font(theme,"sans",part.fontWeight));let outer=rings[0];if(outer!==void 0){let w=part.ring.reduce((m,r)=>Math.max(m,r.width),0),place2={...outer};if(box.position==="absolute"){for(let k of["position","zIndex"])box[k]!==void 0&&(place2[k]=box[k]);for(let k of["top","right","bottom","left"])typeof box[k]=="number"&&(place2[k]=box[k]-w);for(let k of["position","zIndex","top","right","bottom","left"])delete box[k]}else{for(let k of["marginTop","marginRight","marginBottom","marginLeft"])place2[k]=(typeof box[k]=="number"?box[k]:0)-w,delete box[k];box.alignSelf!==void 0&&(place2.alignSelf=box.alignSelf,delete box.alignSelf)}rings[0]=place2}return{box:box,text:text2,rings:rings,...inner===void 0?{}:{inner:inner},grid:part.grid??[]}}var cache3=/* @__PURE__ */new WeakMap;function planPaint(theme){let hit=cache3.get(theme);if(hit!==void 0)return hit;let roles=planRoles(theme),dark=theme.brightness==="dark",out={roles:roles};for(let[name,part]of Object.entries(RAPH_RN_PLAN))out[name]=paintPart(theme,roles,part,dark,roles.line);let painted=out;return cache3.set(theme,painted),painted}function gridCell(p,i){let t=p.grid[i];return t===void 0?{}:t==="fr"?{flexGrow:1,flexShrink:1,flexBasis:0,minWidth:0}:t==="auto"?{flexShrink:0}:typeof t=="number"?{width:t,flexShrink:0}:{}}var RADII=["borderRadius","borderTopLeftRadius","borderTopRightRadius","borderBottomRightRadius","borderBottomLeftRadius"],MARGINS=["margin","marginTop","marginRight","marginBottom","marginLeft","marginHorizontal","marginVertical"],draws=/* @__PURE__ */new WeakMap;function planDraw(X){let hit=draws.get(X);if(hit!==void 0)return hit;let list=names=>names.filter(n=>typeof n=="string"),draw={bx:(...names)=>list(names).map(n=>X[n].box),im:(...names)=>list(names).map(n=>X[n].box),tx:(...names)=>list(names).map(n=>X[n].text),tb:(...names)=>list(names).flatMap(n=>[X[n].box,X[n].text]),ring:(name,node,place2)=>{let rings=X[name].rings;return rings.length===0?node:rings.reduceRight((child,style,i)=>createElement(View,{key:i,style:i===0&&place2!==void 0?[style,place2]:style},child),node)},inner:(...names)=>{let ring=null,radius={};for(let n of list(names)){let p=X[n];p.inner!==void 0&&(ring=p.inner);for(let k of RADII)p.box[k]!==void 0&&(radius={...radius,[k]:p.box[k]})}return ring===null?null:createElement(View,{style:[ring,radius]})},ink:(name,fallback)=>typeof X[name].text.color=="string"?X[name].text.color:fallback,side:(name,fallback)=>typeof X[name].box.width=="number"?X[name].box.width:fallback,mod:(base3,kind)=>{if(kind===void 0||kind==="")return null;let name=`${base3}${kind.charAt(0).toUpperCase()}${kind.slice(1)}`;return name!=="roles"&&name in X?name:null},scroll:name=>{let place2={},content={};for(let[k,v]of Object.entries(X[name].box))(MARGINS.includes(k)?place2:content)[k]=v;return{place:place2,content:content}},swipe:(name,inner)=>{let b=X[name].box,share=typeof b.flexBasis=="string"&&b.flexBasis.endsWith("%")?Number(b.flexBasis.slice(0,-1))/100:1,max=typeof b.maxWidth=="number"?b.maxWidth:1/0;return Math.round(Math.min(max,inner*share)*100)/100}};return draws.set(X,draw),draw}var PLAN_PRESS_SCALE=/* @__PURE__ */Object.freeze({button:.97,onButton:.96,jump:.98,opt:.98,add:.98,extraGo:.96,every:.96,askRow:.98,stepper:.9,mode:.98,order:.98,subCard:.96});function pressScale(style,scale,off){return off?style:({pressed:pressed})=>pressed?[style,{transform:[{scale:scale}]}]:style}function focusPalette(theme){let c=theme.color;if(theme.brightness==="dark")return{ink:c.text.primary,ink2:c.text.secondary,ink3:c.text.muted,paper:c.surfaceSubtle,tile:c.badgeBgNeutral,line:c.brandBorder,card:c.surface,teal:c.brandInk,cyan:c.brandSofter,yellow:c.accent,riskDot:c.errorRed,riskBg:c.badgeBgCritical,riskInk:c.text.primary,clearDot:c.success,clearBg:c.badgeBgPositive,clearInk:c.text.primary,star:c.accent,button:c.primary,onButton:c.onPrimary,jump:c.surfaceSubtle,onJump:c.text.primary,jumpSmall:c.accent,tints:{y:c.badgeBgCaution,c:c.brandSofter,g:c.badgeBgPositive,r:c.badgeBgCritical},scrim:"rgba(0,0,0,0.6)"};let v=v3Palette(theme);return{ink:v.ink,ink2:v.ink2,ink3:v.ink3,paper:v.paper,tile:v.tile,line:v.line,card:v.card,teal:c.brandInk,cyan:c.brandSofter,yellow:v.accent,riskDot:v.riskDot,riskBg:v.riskBg,riskInk:v.riskInk,clearDot:v.clearDot,clearBg:v.clearBg,clearInk:v.clearInk,star:v.watchDot,button:v.primary,onButton:v.onPrimary,jump:v.ink,onJump:v.card,jumpSmall:v.accent,tints:{y:"#FFE7A1",c:"#C8F4F8",g:"#DDEFC4",r:"#FFD8D6"},scrim:"rgba(38,37,35,0.45)"}}function makeFocusStyles(theme){let P=focusPalette(theme),{space:space}=theme,t=(size,ink,weight="regular",ratio=1.35)=>({...face(theme,weight),fontSize:size,lineHeight:Math.round(size*ratio),color:ink}),s=StyleSheet.create({shrink:{flexShrink:1,minWidth:0},toolLabel:t(14,P.ink,"bold"),mini:{...t(10.5,P.ink3,"mono"),textTransform:"uppercase",letterSpacing:.9},h3:{...t(19,P.ink,"bold",1.2),marginTop:space.sm},bold:face(theme,"bold"),noPick:{...t(15,P.ink2,"regular",1.45),marginTop:14},small:t(13,P.ink3,"regular",1.35),smallInk:t(13,P.ink2,"regular",1.35),buttonGhost:{minHeight:48,borderRadius:999,alignItems:"center",justifyContent:"center",paddingHorizontal:space.lg,borderWidth:2,borderColor:P.ink,marginTop:space.sm},buttonGhostText:{...t(15,P.ink,"bold",1.2),textAlign:"center"},disabled:{opacity:.5},fine:{...t(13,P.ink3,"regular",1.4),marginTop:space.sm},scrim:{flex:1,justifyContent:"flex-end",backgroundColor:P.scrim},sheet:{maxHeight:"92%",paddingHorizontal:space.lg,paddingTop:space.sm,paddingBottom:space.xl,borderTopLeftRadius:22,borderTopRightRadius:22,backgroundColor:P.card},sheetGrab:{alignSelf:"center",width:40,height:4,borderRadius:2,backgroundColor:P.line,marginBottom:space.sm},sheetTop:{flexDirection:"row",alignItems:"center",justifyContent:"space-between"},close:{width:44,height:44,alignItems:"center",justifyContent:"center"},screen:{paddingHorizontal:space.lg,paddingBottom:space.xl,gap:space.sm},back:{flexDirection:"row",alignItems:"center",gap:space.xs,minHeight:44,alignSelf:"flex-start"}}),X=planPaint(theme);return{...s,palette:P,X:X,D:planDraw(X)}}var SHEET_MOTION={in:320,out:220,inCurve:"drawer",outCurve:"out"},SCRIM_MOTION={in:240,out:200,inCurve:"ease",outCurve:"ease"},PUSH_MOTION={in:300,out:220,inCurve:"drawer",outCurve:"out"},TOAST_MOTION={in:220,out:160,inCurve:"out",outCurve:"out"},FADE_MOTION={in:160,out:160,inCurve:"ease",outCurve:"ease"},curves={};function curve(name){let made=curves[name];if(made!==void 0)return made;let[a,b,c,d]=name==="drawer"?[.32,.72,0,1]:name==="out"?[.23,1,.32,1]:[.25,.1,.25,1],built=Easing.bezier(a,b,c,d);return curves[name]=built,built}function run(values,motions,open,done){let left=motions.length,drivers=motions.map((m,i)=>Animated.timing(values[i],{toValue:open?1:0,duration:open?m.in:m.out,easing:curve(open?m.inCurve:m.outCurve),useNativeDriver:true}));for(let d of drivers)d.start(({finished:finished})=>{left-=1,finished&&left===0&&done()});return()=>{for(let d of drivers)d.stop()}}function PlanLinger({draw:draw,motions:motions}){let open=draw!==null,[kept,setKept]=useState(null);open&&kept?.draw!==draw&&setKept({draw:draw});let a=useRef(new Animated.Value(0)).current,b=useRef(new Animated.Value(0)).current,values=[a,b];useEffect(()=>{if(!(!open&&kept===null))return run(values,motions,open,()=>{open||setKept(null)})},[open]);let current=draw??kept?.draw;return current===void 0?null:current(values)}function PlanPushes({id:id,depth:depth,node:node,width:width,paper:paper,still:still}){let[at,setAt]=useState({id:id,depth:depth,node:node,leaving:null}),moved=id!==at.id;(moved||node!==at.node)&&setAt({id:id,depth:depth,node:node,leaving:moved?depth<at.depth?at.node:null:at.leaving});let enter=useRef(new Animated.Value(1)).current,exit=useRef(new Animated.Value(1)).current,motion=still?FADE_MOTION:PUSH_MOTION,last=useRef(depth);useLayoutEffect(()=>{let from=last.current;if(last.current=depth,depth>from)return enter.setValue(0),run([enter],[motion],true,()=>{});if(depth!==from)return exit.setValue(1),run([exit],[motion],false,()=>setAt(s=>({...s,leaving:null})))},[id]);let look=v=>still?{opacity:v}:{transform:[{translateX:v.interpolate({inputRange:[0,1],outputRange:[width,0]})}]};/* @__PURE__ */
|
|
127
127
|
return jsxs(View,{children:[
|
|
128
128
|
/* @__PURE__ */jsx(Animated.View,{style:look(enter),children:node}),at.leaving===null?null:/* @__PURE__ */jsx(Animated.View,{pointerEvents:"none",style:[{position:"absolute",top:0,left:0,right:0,bottom:0,backgroundColor:paper},look(exit)],children:at.leaving})]})}var FLASH_MS=900,FLASH_STEP_MS=80,FLASH_HOLD=.4,easeOut=()=>Easing.bezier(0,0,.58,1),SHRINK={flexShrink:1},LINE={flexDirection:"row",flexWrap:"wrap",alignItems:"center"},HOLDS_VALUE={height:void 0,paddingLeft:3,paddingRight:3};function HealthPlanBlanks(props){let{phase:phase,rows:rows,flashKey:flashKey}=props,theme=useEverfurTheme(),still=theme.motion.reducedMotion,X=planPaint(theme),{bx:bx,tx:tx,tb:tb,inner:inner}=planDraw(X),flash=X.roles.accent??"",flashClear=clearOf(flash),blankGround=X.roles.accent4??"",all=rows.every(r=>r.value!==null),filledLook=phase==="filled"&&all,progress=useRef([]);for(;progress.current.length<rows.length;)progress.current.push(new Animated.Value(1));let flashed=useRef(null);return useEffect(()=>{if(flashKey==null||flashed.current===flashKey||phase!=="filled"||(flashed.current=flashKey,still))return;let easing=easeOut(),runs=rows.flatMap((r,i)=>{let v=progress.current[i];return r.value===null||v===void 0?[]:(v.setValue(0),[Animated.sequence([Animated.delay(i*FLASH_STEP_MS),Animated.timing(v,{toValue:1,duration:FLASH_MS,easing:easing,useNativeDriver:false})])])});for(let run2 of runs)run2.start();return()=>{for(let run2 of runs)run2.stop()}},[flashKey,phase,still]),/* @__PURE__ */jsxs(View,{style:bx("blanksWrap","blanksCard"),accessibilityLabel:props.label,testID:"health-plan-blanks",children:[
|
|
129
129
|
/* @__PURE__ */jsxs(View,{style:bx("blanksHead"),children:[
|
|
@@ -133,24 +133,18 @@ return jsxs(View,{style:bx("blanksRow"),testID:`health-plan-blank-${r.key}`,chil
|
|
|
133
133
|
/* @__PURE__ */jsx(View,{style:[...bx("blanksNum"),gridCell(X.blanksRow,0)],accessibilityElementsHidden:true,importantForAccessibility:"no-hide-descendants",children:/* @__PURE__ */jsx(Text,{style:tx("blanksNum"),children:String(i+1)})}),
|
|
134
134
|
/* @__PURE__ */jsxs(View,{style:gridCell(X.blanksRow,1),children:[
|
|
135
135
|
/* @__PURE__ */jsxs(View,{style:LINE,children:[r.lead===""?null:/* @__PURE__ */jsx(Text,{style:tx("blanksText"),children:r.lead}),
|
|
136
|
-
/* @__PURE__ */jsxs(Animated.View,{style:[...bx("blank",width,filledLook&&"blankFilled"),!filledLook&&value!==null?HOLDS_VALUE:null,flashBg===null?null:{backgroundColor:flashBg}],...value===null?{accessible:true,accessibilityLabel:props.blankLabel}:{},testID:value===null?`health-plan-blank-${r.key}-empty`:`health-plan-blank-${r.key}-value`,children:[inner("blank",filledLook&&"blankFilled"),value===null?null:/* @__PURE__ */jsx(Text,{style:tx("blank"),children:value})]}),r.trail===""?null:/* @__PURE__ */jsx(Text,{style:tx("blanksText"),children:r.trail})]}),r.source===""?null:/* @__PURE__ */jsx(Text,{style:tb("blanksSource"),children:r.source})]})]},r.key)})})]})}var WAITING=/* @__PURE__ */new Set(["requested","awaiting_clinic","awaiting_upload","received","parsing","in_review"]),VACCINE=/vaccin|rabies|dhpp|booster|bordetella|lepto|lyme|parvo|distemper/i,LB_PER_KG=2.20462262;function dayMs(value){if(value==null||value.length===0)return null;let ms=Date.parse(/^\d{4}-\d{2}-\d{2}$/.test(value)?`${value}T00:00:00Z`:value);return Number.isNaN(ms)?null:ms}function kilograms(value,unit){return value===null||!Number.isFinite(value)||value<=0||unit===null?null:/^\s*kg|kilo/i.test(unit)?value:/^\s*(lb|lbs|pound)/i.test(unit)?value/LB_PER_KG:null}function healthPlanRecordsWeightKg(record){if(record===null||record.isEmpty||record.withheld)return null;let readings=[];for(let series of record.entitySeries)if(series.key.startsWith("body_weight"))for(let point of series.points){if(point.origin==="owner_reported")continue;let at=dayMs(point.at),unit=point.display?.replace(/^[\d.,\s]+/,"")??null,kg=kilograms(point.value,unit);at!==null&&kg!==null&&readings.push({at:at,kg:kg})}for(let entity of record.entities){if(entity.category!=="body_weight"||entity.origin==="owner_reported")continue;let at=dayMs(entity.observedAt),kg=kilograms(entity.value===null?null:Number.parseFloat(entity.value),entity.unit);at!==null&&kg!==null&&readings.push({at:at,kg:kg})}return readings.length===0?null:(readings.sort((a,b)=>b.at-a.at),readings[0]?.kg??null)}function healthPlanNextShotsAt(record,today){if(record===null||record.isEmpty||record.withheld)return null;let next=null;for(let item of record.forwardLooking){if(!VACCINE.test(item.title))continue;let due=dayMs(item.dueAt);due===null||due<today||(next===null||due<next)&&(next=due)}return next}function latestClinicRequest(requests){return requests.filter(r=>r.source==="clinic_request").slice().sort((a,b)=>(dayMs(b.createdAt)??0)-(dayMs(a.createdAt)??0))[0]}function healthPlanRecordsHoldNoBlanks(input,now){let asked=latestClinicRequest(input.requests);if(asked===void 0||asked.status!=="published"||input.record===null||input.record.withheld)return false;let today=Math.floor(now/864e5)*864e5;return healthPlanRecordsWeightKg(input.record)===null&&healthPlanNextShotsAt(input.record,today)===null}function healthPlanBlanksFacts(input,now){let asked=latestClinicRequest(input.requests);if(asked===void 0)return null;let clinicName=asked.clinicName?.trim()?asked.clinicName.trim():null;if(WAITING.has(asked.status))return{phase:"wait",requestId:String(asked.id),clinicName:clinicName,weightKg:null,nextShotsAt:null};if(asked.status!=="published"||input.record===null||input.record.isEmpty||input.record.withheld)return null;let today=Math.floor(now/864e5)*864e5,weightKg=healthPlanRecordsWeightKg(input.record),nextShotsAt=healthPlanNextShotsAt(input.record,today);return weightKg===null&&nextShotsAt===null?null:{phase:"filled",requestId:String(asked.id),clinicName:clinicName,weightKg:weightKg,nextShotsAt:nextShotsAt}}var COARSE_NOW_TICK_MS=3600*1e3;function useCoarseNow(fixed,shown=true){let[now,setNow]=useState(()=>Date.now()),first=useRef(true);return useEffect(()=>{if(first.current){first.current=false;return}shown&&setNow(Date.now())},[fixed,shown]),useEffect(()=>{if(!shown)return;let tick=setInterval(()=>setNow(Date.now()),COARSE_NOW_TICK_MS),onVisible=()=>{document.visibilityState==="visible"&&setNow(Date.now())},doc=typeof document<"u"&&typeof document.addEventListener=="function"?document:null;return doc?.addEventListener("visibilitychange",onVisible),()=>{clearInterval(tick),doc?.removeEventListener("visibilitychange",onVisible)}},[fixed,shown]),now}function RecordsProbe(props){let{status:status,requests:requests,record:record,refresh:refresh}=useEverfurRecords({petRef:props.petRef}),{onRead:onRead,petRef:petRef}=props,now=useCoarseNow(),blanks=useMemo(()=>healthPlanBlanksFacts({requests:requests,record:record},now),[requests,record,now]),heldNone=useMemo(()=>healthPlanRecordsHoldNoBlanks({requests:requests,record:record},now),[requests,record,now]);useEffect(()=>{onRead({missing:status==="empty"||heldNone,blanks:blanks})},[status,heldNone,blanks,onRead]);let reread=useRef(refresh);return reread.current=refresh,useEffect(()=>onHealthPlanRecordsLanded((pet,source)=>{pet===petRef&&source==="host"&&reread.current()}),[petRef]),null}var LB_PER_KG2=2.20462262,ORDER_STEPS=["ordered","shipped","out_for_delivery","delivered"],TRACK_STEP={ordered:0,shipped:1,delivered:3};function hostOrderView(o){let step=Math.max(0,ORDER_STEPS.indexOf(o.status));return{key:o.key,number:o.number??null,step:step,dates:o.dates??[],everfur:false,steps:step===2?[0,1,2,3]:[0,1,3],productId:null,items:o.items.map(x=>({title:x.title,quantity:x.quantity,price:x.price,imageUrl:x.imageUrl??null,icon:x.icon??null})),total:Math.round(o.items.reduce((n,x)=>n+x.price,0)*100)/100,currency:o.currency,subscriptionBox:o.subscriptionBox===true,carrier:o.carrier??null,trackingNumber:o.trackingNumber??null,trackingTag:o.trackingTag??null,trackingUrl:o.trackingUrl??null}}function everfurOrderView(o,items){let it=items.find(x=>x.productId===o.productId),t=o.tracking,quantity=o.quantity??1,total=o.total??Math.round(o.price*quantity*100)/100,step=t===void 0?0:TRACK_STEP[t.status];return{key:o.orderId,number:t?.orderNumber??null,step:step,dates:t===void 0?[o.createdAt??null]:[o.createdAt??null,t.shippedAt,null,step===3?null:t.estimatedDelivery],steps:t===void 0?[0]:[0,1,3],everfur:true,productId:o.productId,items:[{title:o.title??it?.title??"",quantity:quantity,price:total,imageUrl:it?.imageUrl??null,icon:null}],total:total,currency:o.currency,subscriptionBox:false,carrier:t?.carrier??null,trackingNumber:t?.trackingNumber??null,trackingTag:null,trackingUrl:t?.trackingUrl??null}}function formatShopDay(iso,locale,now=/* @__PURE__ */new Date){if(iso==null)return null;let dateOnly=/^\d{4}-\d{2}-\d{2}$/.test(iso),d=new Date(dateOnly?`${iso}T00:00:00Z`:iso);if(Number.isNaN(d.getTime()))return null;let tz=dateOnly?"UTC":void 0,year=Number(new Intl.DateTimeFormat("en-US",{year:"numeric",...tz?{timeZone:tz}:{}}).format(d));try{return new Intl.DateTimeFormat(locale??"en-US",year!==now.getFullYear()?{month:"short",day:"numeric",year:"numeric",...tz?{timeZone:tz}:{}}:{weekday:"short",month:"short",day:"numeric",...tz?{timeZone:tz}:{}}).format(d)}catch{return iso}}function andList(names){return names.length<=1?names[0]??"":`${names.slice(0,-1).join(", ")} and ${names[names.length-1]??""}`}async function readOrders(repo,petRef,cursor){if(repo.listOneBoxOrderPage!==void 0)return repo.listOneBoxOrderPage(petRef,{limit:20,...cursor===null?{}:{cursor:cursor}});if(cursor!==null||repo.listOneBoxOrders===void 0)return{ok:true,value:{orders:[],nextCursor:null}};let res=await repo.listOneBoxOrders(petRef);return res.ok?{ok:true,value:{orders:res.value,nextCursor:null}}:res}function invalidCursor(error){if(error.httpStatus!==422)return false;let raw=error.raw!==null&&typeof error.raw=="object"?error.raw:null;return[error.reasonCode,error.wireMessage,raw?.detail,raw?.message].some(x=>x==="invalid_cursor")}var CHECKOUT_PARAM="everfur_checkout",CHECKOUT_CANCEL_PARAM="everfur_checkout_cancel",STRIPE_SESSION_ID="{CHECKOUT_SESSION_ID}",CHECKOUT_POLL_MS=2e3,CHECKOUT_POLL_TRIES=30;function validReturnUrl(url){return typeof url!="string"?false:/^https:\/\/[^/?#\s]+[^\s]*$/i.test(url.trim())}var PARAM_RE=new RegExp(`([?&])(?:${CHECKOUT_PARAM}|${CHECKOUT_CANCEL_PARAM})=[^&#]*&?`,"g");function checkoutReturnUrl(base3,name,value){let hashAt=base3.indexOf("#"),hash=hashAt===-1?"":base3.slice(hashAt),head=hashAt===-1?base3:base3.slice(0,hashAt);head=head.replace(PARAM_RE,"$1").replace(/[?&]$/,"");let sep=head.includes("?")?"&":"?";return`${head}${sep}${name}=${value}${hash}`}function readCheckoutReturn(url,base3){let strip=u=>u.split(/[?#]/)[0]?.replace(/\/+$/,"").toLowerCase()??"";if(strip(url)!==strip(base3))return null;let query=url.split("#")[0]?.split("?")[1]??"",params=/* @__PURE__ */new Map;for(let pair of query.split("&")){if(pair==="")continue;let at=pair.indexOf("="),key=at===-1?pair:pair.slice(0,at),value=at===-1?"":pair.slice(at+1);try{value=decodeURIComponent(value)}catch{}params.set(key,value)}if(params.has(CHECKOUT_CANCEL_PARAM))return{kind:"cancel"};let id=params.get(CHECKOUT_PARAM);return id===void 0?null:{kind:"return",sessionId:id===""||id===STRIPE_SESSION_ID?null:id}}function mintTapKey(){let c=globalThis.crypto;return c?.randomUUID?c.randomUUID():`tap-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,12)}`}var checkouts=/* @__PURE__ */new Map,carts=/* @__PURE__ */new Map;function rememberCheckout(petRef,checkoutId){checkouts.set(petRef,checkoutId)}function recallCheckout(petRef){return checkouts.get(petRef)??null}function forgetCheckout(petRef){checkouts.delete(petRef)}function readCart(petRef){return carts.get(petRef)??[]}function writeCart(petRef,lines){lines.length===0?carts.delete(petRef):carts.set(petRef,lines)}var CENTER={justifyContent:"center"},SHRINK2={flexShrink:1},thumb=(k,src,fallback="box")=>src?/* @__PURE__ */jsx(Image,{source:{uri:src},style:k.S.shopImage,accessibilityIgnoresInvertColors:true}):/* @__PURE__ */jsx(View,{style:k.S.shopImage,children:k.icon(fallback)}),inlineTag=(k,label,part)=>/* @__PURE__ */jsxs(Fragment$1,{children:[" ",
|
|
136
|
+
/* @__PURE__ */jsxs(Animated.View,{style:[...bx("blank",width,filledLook&&"blankFilled"),!filledLook&&value!==null?HOLDS_VALUE:null,flashBg===null?null:{backgroundColor:flashBg}],...value===null?{accessible:true,accessibilityLabel:props.blankLabel}:{},testID:value===null?`health-plan-blank-${r.key}-empty`:`health-plan-blank-${r.key}-value`,children:[inner("blank",filledLook&&"blankFilled"),value===null?null:/* @__PURE__ */jsx(Text,{style:tx("blank"),children:value})]}),r.trail===""?null:/* @__PURE__ */jsx(Text,{style:tx("blanksText"),children:r.trail})]}),r.source===""?null:/* @__PURE__ */jsx(Text,{style:tb("blanksSource"),children:r.source})]})]},r.key)})})]})}var WAITING=/* @__PURE__ */new Set(["requested","awaiting_clinic","awaiting_upload","received","parsing","in_review"]),VACCINE=/vaccin|rabies|dhpp|booster|bordetella|lepto|lyme|parvo|distemper/i,LB_PER_KG2=2.20462262;function dayMs(value){if(value==null||value.length===0)return null;let ms=Date.parse(/^\d{4}-\d{2}-\d{2}$/.test(value)?`${value}T00:00:00Z`:value);return Number.isNaN(ms)?null:ms}function kilograms(value,unit){return value===null||!Number.isFinite(value)||value<=0||unit===null?null:/^\s*kg|kilo/i.test(unit)?value:/^\s*(lb|lbs|pound)/i.test(unit)?value/LB_PER_KG2:null}function healthPlanRecordsWeightKg(record){if(record===null||record.isEmpty||record.withheld)return null;let readings=[];for(let series of record.entitySeries)if(series.key.startsWith("body_weight"))for(let point of series.points){if(point.origin==="owner_reported")continue;let at=dayMs(point.at),unit=point.display?.replace(/^[\d.,\s]+/,"")??null,kg=kilograms(point.value,unit);at!==null&&kg!==null&&readings.push({at:at,kg:kg})}for(let entity of record.entities){if(entity.category!=="body_weight"||entity.origin==="owner_reported")continue;let at=dayMs(entity.observedAt),kg=kilograms(entity.value===null?null:Number.parseFloat(entity.value),entity.unit);at!==null&&kg!==null&&readings.push({at:at,kg:kg})}return readings.length===0?null:(readings.sort((a,b)=>b.at-a.at),readings[0]?.kg??null)}function healthPlanNextShotsAt(record,today){if(record===null||record.isEmpty||record.withheld)return null;let next=null;for(let item of record.forwardLooking){if(!VACCINE.test(item.title))continue;let due=dayMs(item.dueAt);due===null||due<today||(next===null||due<next)&&(next=due)}return next}function latestClinicRequest(requests){return requests.filter(r=>r.source==="clinic_request").slice().sort((a,b)=>(dayMs(b.createdAt)??0)-(dayMs(a.createdAt)??0))[0]}function healthPlanRecordsHoldNoBlanks(input,now){let asked=latestClinicRequest(input.requests);if(asked===void 0||asked.status!=="published"||input.record===null||input.record.withheld)return false;let today=Math.floor(now/864e5)*864e5;return healthPlanRecordsWeightKg(input.record)===null&&healthPlanNextShotsAt(input.record,today)===null}function healthPlanBlanksFacts(input,now){let asked=latestClinicRequest(input.requests);if(asked===void 0)return null;let clinicName=asked.clinicName?.trim()?asked.clinicName.trim():null;if(WAITING.has(asked.status))return{phase:"wait",requestId:String(asked.id),clinicName:clinicName,weightKg:null,nextShotsAt:null};if(asked.status!=="published"||input.record===null||input.record.isEmpty||input.record.withheld)return null;let today=Math.floor(now/864e5)*864e5,weightKg=healthPlanRecordsWeightKg(input.record),nextShotsAt=healthPlanNextShotsAt(input.record,today);return weightKg===null&&nextShotsAt===null?null:{phase:"filled",requestId:String(asked.id),clinicName:clinicName,weightKg:weightKg,nextShotsAt:nextShotsAt}}var COARSE_NOW_TICK_MS=3600*1e3;function useCoarseNow(fixed,shown=true){let[now,setNow]=useState(()=>Date.now()),first=useRef(true);return useEffect(()=>{if(first.current){first.current=false;return}shown&&setNow(Date.now())},[fixed,shown]),useEffect(()=>{if(!shown)return;let tick=setInterval(()=>setNow(Date.now()),COARSE_NOW_TICK_MS),onVisible=()=>{document.visibilityState==="visible"&&setNow(Date.now())},doc=typeof document<"u"&&typeof document.addEventListener=="function"?document:null;return doc?.addEventListener("visibilitychange",onVisible),()=>{clearInterval(tick),doc?.removeEventListener("visibilitychange",onVisible)}},[fixed,shown]),now}function RecordsProbe(props){let{status:status,requests:requests,record:record,refresh:refresh}=useEverfurRecords({petRef:props.petRef}),{onRead:onRead,petRef:petRef}=props,now=useCoarseNow(),blanks=useMemo(()=>healthPlanBlanksFacts({requests:requests,record:record},now),[requests,record,now]),heldNone=useMemo(()=>healthPlanRecordsHoldNoBlanks({requests:requests,record:record},now),[requests,record,now]);useEffect(()=>{onRead({missing:status==="empty"||heldNone,blanks:blanks})},[status,heldNone,blanks,onRead]);let reread=useRef(refresh);return reread.current=refresh,useEffect(()=>onHealthPlanRecordsLanded((pet,source)=>{pet===petRef&&source==="host"&&reread.current()}),[petRef]),null}var MAX_QUANTITY=5,MAX_CART_LINES=10,ORDERS_PAGE=20,ORDER_STEPS=["ordered","shipped","out_for_delivery","delivered"],TRACK_STEP={ordered:0,shipped:1,delivered:3};function hostOrderView(o){let step=Math.max(0,ORDER_STEPS.indexOf(o.status));return{key:o.key,number:o.number??null,step:step,dates:o.dates??[],everfur:false,steps:[0,1,2,3],productId:null,items:o.items.map(x=>({title:x.title,quantity:x.quantity,price:x.price,imageUrl:x.imageUrl??null,icon:x.icon??null})),total:Math.round(o.items.reduce((n,x)=>n+x.price,0)*100)/100,currency:o.currency,subscriptionBox:o.subscriptionBox===true,carrier:o.carrier??null,trackingNumber:o.trackingNumber??null,trackingTag:o.trackingTag??null,trackingUrl:o.trackingUrl??null}}function everfurOrderView(o,items){let it=items.find(x=>x.productId===o.productId),t=o.tracking,quantity=o.quantity??1,total=o.total??Math.round(o.price*quantity*100)/100,step=t===void 0?0:TRACK_STEP[t.status];return{key:o.orderId,number:t?.orderNumber??null,step:step,dates:t===void 0?[o.createdAt??null]:[o.createdAt??null,t.shippedAt,null,step===3?null:t.estimatedDelivery],steps:t===void 0?[0]:[0,1,3],everfur:true,productId:o.productId,items:[{title:o.title??it?.title??"",quantity:quantity,price:total,imageUrl:it?.imageUrl??null,icon:null}],total:total,currency:o.currency,subscriptionBox:false,carrier:t?.carrier??null,trackingNumber:t?.trackingNumber??null,trackingTag:null,trackingUrl:t?.trackingUrl??null}}function formatShopDay(iso,locale,now=/* @__PURE__ */new Date){if(iso==null)return null;let dateOnly=/^\d{4}-\d{2}-\d{2}$/.test(iso),d=new Date(dateOnly?`${iso}T00:00:00Z`:iso);if(Number.isNaN(d.getTime()))return null;let tz=dateOnly?"UTC":void 0,year=Number(new Intl.DateTimeFormat("en-US",{year:"numeric",...tz?{timeZone:tz}:{}}).format(d));try{return new Intl.DateTimeFormat(locale??"en-US",year!==now.getFullYear()?{month:"short",day:"numeric",year:"numeric",...tz?{timeZone:tz}:{}}:{weekday:"short",month:"short",day:"numeric",...tz?{timeZone:tz}:{}}).format(d)}catch{return iso}}function andList(names){return names.length<=1?names[0]??"":`${names.slice(0,-1).join(", ")} and ${names[names.length-1]??""}`}async function readOrders(repo,petRef,cursor){if(repo.listOneBoxOrderPage!==void 0)return repo.listOneBoxOrderPage(petRef,{limit:ORDERS_PAGE,...cursor===null?{}:{cursor:cursor}});if(cursor!==null||repo.listOneBoxOrders===void 0)return{ok:true,value:{orders:[],nextCursor:null}};let res=await repo.listOneBoxOrders(petRef);return res.ok?{ok:true,value:{orders:res.value,nextCursor:null}}:res}function invalidCursor(error){if(error.httpStatus!==422)return false;let raw=error.raw!==null&&typeof error.raw=="object"?error.raw:null;return[error.reasonCode,error.wireMessage,raw?.detail,raw?.message].some(x=>x==="invalid_cursor")}var CHECKOUT_PARAM="everfur_checkout",CHECKOUT_CANCEL_PARAM="everfur_checkout_cancel",STRIPE_SESSION_ID="{CHECKOUT_SESSION_ID}",CHECKOUT_POLL_MS=2e3,CHECKOUT_POLL_TRIES=30;function validReturnUrl(url){return typeof url!="string"?false:/^https:\/\/[^/?#\s]+[^\s]*$/i.test(url.trim())}var PARAM_RE=new RegExp(`([?&])(?:${CHECKOUT_PARAM}|${CHECKOUT_CANCEL_PARAM})=[^&#]*&?`,"g");function checkoutReturnUrl(base3,name,value){let hashAt=base3.indexOf("#"),hash=hashAt===-1?"":base3.slice(hashAt),head=hashAt===-1?base3:base3.slice(0,hashAt);head=head.replace(PARAM_RE,"$1").replace(/[?&]$/,"");let sep=head.includes("?")?"&":"?";return`${head}${sep}${name}=${value}${hash}`}function readCheckoutReturn(url,base3){let strip=u=>u.split(/[?#]/)[0]?.replace(/\/+$/,"").toLowerCase()??"";if(strip(url)!==strip(base3))return null;let query=url.split("#")[0]?.split("?")[1]??"",params=/* @__PURE__ */new Map;for(let pair of query.split("&")){if(pair==="")continue;let at=pair.indexOf("="),key=at===-1?pair:pair.slice(0,at),value=at===-1?"":pair.slice(at+1);try{value=decodeURIComponent(value)}catch{}params.set(key,value)}if(params.has(CHECKOUT_CANCEL_PARAM))return{kind:"cancel"};let id=params.get(CHECKOUT_PARAM);return id===void 0?null:{kind:"return",sessionId:id===""||id===STRIPE_SESSION_ID?null:id}}function mintTapKey(){let c=globalThis.crypto;return c?.randomUUID?c.randomUUID():`tap-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,12)}`}var SHOP_CART_KV_PREFIX="everfur.healthPlan.cart",SHOP_CHECKOUT_KV_PREFIX="everfur.healthPlan.checkout",checkouts=/* @__PURE__ */new Map,carts=/* @__PURE__ */new Map,checkoutTouched=/* @__PURE__ */new Set,cartTouched=/* @__PURE__ */new Set,loads2=/* @__PURE__ */new WeakMap,DONE=Promise.resolve();function parseCart(raw){if(raw===null)return[];try{let o=JSON.parse(raw);return Array.isArray(o)?o.flatMap(x=>{if(x===null||typeof x!="object")return[];let r=x,productId=r.productId,mode=r.mode,every=r.every,qty=r.qty;return typeof productId!="string"||mode!=="sub"&&mode!=="once"||typeof every!="number"||typeof qty!="number"?[]:[{productId:productId,mode:mode,every:every,qty:Math.max(1,Math.min(mode==="sub"?1:MAX_QUANTITY,Math.round(qty)))}]}):[]}catch{return[]}}function write(kv,key,value){if(kv)try{(value===null?kv.removeItem(key):kv.setItem(key,value)).catch(()=>{})}catch{}}function loadShopMemory(kv,petRef){if(!kv)return DONE;let perPet=loads2.get(kv);perPet===void 0&&(perPet=/* @__PURE__ */new Map,loads2.set(kv,perPet));let load=perPet.get(petRef);return load===void 0&&(load=(async()=>{let cart=[],checkout=null;try{let[rawCart,rawCheckout]=await Promise.all([kv.getItem(`${SHOP_CART_KV_PREFIX}:${petRef}`),kv.getItem(`${SHOP_CHECKOUT_KV_PREFIX}:${petRef}`)]);cart=parseCart(rawCart),checkout=typeof rawCheckout=="string"&&rawCheckout!==""?rawCheckout:null}catch{}!cartTouched.has(petRef)&&cart.length>0&&carts.set(petRef,cart),!checkoutTouched.has(petRef)&&checkout!==null&&checkouts.set(petRef,checkout)})(),perPet.set(petRef,load)),load}function rememberCheckout(petRef,checkoutId,kv){checkoutTouched.add(petRef),checkouts.set(petRef,checkoutId),write(kv,`${SHOP_CHECKOUT_KV_PREFIX}:${petRef}`,checkoutId)}function recallCheckout(petRef){return checkouts.get(petRef)??null}function forgetCheckout(petRef,kv){checkoutTouched.add(petRef),checkouts.delete(petRef),write(kv,`${SHOP_CHECKOUT_KV_PREFIX}:${petRef}`,null)}function readCart(petRef){return carts.get(petRef)??[]}function writeCart(petRef,lines,kv){cartTouched.add(petRef),lines.length===0?carts.delete(petRef):carts.set(petRef,lines),write(kv,`${SHOP_CART_KV_PREFIX}:${petRef}`,lines.length===0?null:JSON.stringify(lines))}var CENTER={justifyContent:"center"},SHRINK2={flexShrink:1},FILL={width:"100%",height:"100%"},WRAP={flexWrap:"wrap"},FULL_ROW={width:"100%",alignSelf:"stretch"},HIT_44={top:2,bottom:2,left:2,right:2},IN_ROW={alignSelf:"auto"},SR_ONLY={position:"absolute",width:1,height:1,margin:-1,padding:0,overflow:"hidden",borderWidth:0},inlineTag=(k,label,part)=>/* @__PURE__ */jsxs(Fragment$1,{children:[" ",
|
|
137
137
|
/* @__PURE__ */jsx(View,{style:k.S.D.bx(part),children:/* @__PURE__ */jsx(Text,{style:k.S.D.tx(part),children:label})})]});function shopButton(k,label,onPress,opts={}){let{S:S}=k,{bx:bx,tx:tx}=S.D,disabled=opts.disabled===true,part=opts.part??"button";/* @__PURE__ */
|
|
138
138
|
return jsx(Pressable,{onPress:disabled?void 0:onPress,disabled:disabled,accessibilityRole:"button",accessibilityLabel:label,accessibilityState:{disabled:disabled},style:pressScale(opts.ghost?[S.buttonGhost,disabled?S.disabled:null]:bx(part,disabled&&"buttonDisabled"),PLAN_PRESS_SCALE.button,disabled),...opts.testID?{testID:opts.testID}:{},children:/* @__PURE__ */jsx(Text,{tier:"control",style:opts.ghost?S.buttonGhostText:tx(part),children:label})})}function shopLink(k,label,onPress,testID){let{bx:bx,tx:tx}=k.S.D;/* @__PURE__ */
|
|
139
|
-
return jsx(Pressable,{onPress:onPress,accessibilityRole:"button",accessibilityLabel:label,style:[...bx("shopLink"),CENTER],...testID?{testID:testID}:{},children:/* @__PURE__ */jsx(Text,{tier:"control",style:tx("shopLink"),children:label})})}function shopRows(k,rows){
|
|
140
|
-
|
|
141
|
-
/* @__PURE__ */jsx(
|
|
142
|
-
/* @__PURE__ */jsx(Text,{style:[
|
|
143
|
-
|
|
144
|
-
/* @__PURE__ */jsxs(View,{style:
|
|
145
|
-
/* @__PURE__ */jsx(Text,{style:
|
|
146
|
-
/* @__PURE__ */jsx(Text,{style:
|
|
147
|
-
|
|
148
|
-
/* @__PURE__ */jsx(Text,{style:S.smallInk,children:copy.shippingValue})]}),
|
|
149
|
-
/* @__PURE__ */jsxs(View,{style:S.summaryRow,children:[
|
|
150
|
-
/* @__PURE__ */jsx(Text,{style:S.summaryTotal,children:renew===null?copy.total:copy.dueToday}),
|
|
151
|
-
/* @__PURE__ */jsx(Text,{style:S.summaryTotal,children:total})]}),renew===null?null:/* @__PURE__ */jsxs(View,{style:S.summaryRow,children:[
|
|
152
|
-
/* @__PURE__ */jsx(Text,{style:[S.small,S.shrink],children:copy.thenRenews(renew)}),
|
|
153
|
-
/* @__PURE__ */jsx(Text,{style:S.small,children:copy.renewsEvery(renew)})]})]})}function shopTrack(k,steps,label){let{S:S}=k,{bx:bx,tx:tx,tb:tb,inner:inner,ink:ink,side:side}=S.D;/* @__PURE__ */
|
|
139
|
+
return jsx(Pressable,{onPress:onPress,accessibilityRole:"button",accessibilityLabel:label,style:[...bx("shopLink"),CENTER],...testID?{testID:testID}:{},children:/* @__PURE__ */jsx(Text,{tier:"control",style:tx("shopLink"),children:label})})}function shopRows(k,rows,inShop=false){if(rows.length===0)return null;let{bx:bx,tx:tx,ink:ink,side:side}=k.S.D,X=k.S.X;/* @__PURE__ */
|
|
140
|
+
return jsx(View,{style:bx("coRows",inShop&&"coRowsShop"),testID:"health-plan-checkout-rows",children:rows.map(r=>/* @__PURE__ */jsxs(View,{style:bx("coRow"),children:[
|
|
141
|
+
/* @__PURE__ */jsx(View,{style:gridCell(X.coRow,0),children:k.icon(r.icon,ink("coRowSvg",X.roles.ink2??""),side("coRowSvg",20))}),
|
|
142
|
+
/* @__PURE__ */jsx(Text,{style:[...tx("coRowLabel"),gridCell(X.coRow,1)],children:r.label}),
|
|
143
|
+
/* @__PURE__ */jsx(Text,{style:[...tx("coRow","coRowValue"),gridCell(X.coRow,2)],children:r.value})]},r.label))})}function shopSummary(k,total,opts={}){let{S:S,copy:copy}=k,{bx:bx,tx:tx}=S.D,renew=opts.renew??null,row=(label,value,mod,tag)=>/* @__PURE__ */jsxs(View,{style:bx("summaryRow",mod),children:[
|
|
144
|
+
/* @__PURE__ */jsxs(View,{style:[...bx("summaryLabel"),SHRINK2,IN_ROW],children:[
|
|
145
|
+
/* @__PURE__ */jsx(Text,{style:[...tx("summaryRow",mod,mod==="summaryTotal"?"summaryTotalLabel":"summaryLabel"),SHRINK2],children:label}),tag===void 0?null:/* @__PURE__ */jsx(View,{style:bx("summaryTag"),testID:"health-plan-summary-tag",children:/* @__PURE__ */jsx(Text,{style:tx("summaryTag"),children:tag})})]}),
|
|
146
|
+
/* @__PURE__ */jsx(Text,{style:tx("summaryRow",mod),children:value})]});/* @__PURE__ */
|
|
147
|
+
return jsxs(View,{style:bx(opts.inCheckout?"coSummary":"summary"),children:[row(copy.subtotal,total),copy.shippingValue===""?null:row(copy.shipping,copy.shippingValue,void 0,opts.tag&©.shippingTag!==""?copy.shippingTag:void 0),row(renew===null?copy.total:copy.dueToday,total,"summaryTotal"),renew===null?null:row(copy.thenRenews(renew),copy.renewsEvery(renew),"summaryRenew")]})}function shopTrack(k,steps,label){let{S:S}=k,{bx:bx,tx:tx,tb:tb,inner:inner,ink:ink,side:side}=S.D;/* @__PURE__ */
|
|
154
148
|
return jsx(View,{style:bx("track"),accessibilityLabel:label,testID:"health-plan-track",children:steps.map((s,i)=>{let done=s.state==="done",now=s.state==="now",last=i===steps.length-1;/* @__PURE__ */
|
|
155
149
|
return jsxs(View,{style:bx("trackStep",last&&"trackStepLast"),children:[last?null:/* @__PURE__ */jsx(View,{style:bx("trackLine",done&&steps[i+1]?.state==="done"&&"trackLineDone")}),
|
|
156
150
|
/* @__PURE__ */jsxs(View,{style:[...bx("trackDot",done&&"trackDotDone",now&&"trackDotNow"),gridCell(S.X.trackStep,0)],children:[inner("trackDot",done&&"trackDotDone",now&&"trackDotNow"),done?k.icon("check",ink("trackDotSvg",S.X.roles.card??""),side("trackDotSvg",13)):null]}),
|
|
@@ -175,55 +169,68 @@ return jsxs(View,{style:bx("wait"),testID:"health-plan-wait",children:[
|
|
|
175
169
|
return jsxs(View,{style:bx("shopEmpty"),children:[
|
|
176
170
|
/* @__PURE__ */jsx(View,{style:bx("shopEmptyTile"),children:k.icon(iconName,ink("shopEmptyTile",k.S.X.roles.link??""),side("shopEmptyTileSvg",34))}),
|
|
177
171
|
/* @__PURE__ */jsx(Text,{style:tb("shopEmptyTitle"),accessibilityRole:"header",children:title}),
|
|
178
|
-
/* @__PURE__ */jsx(Text,{style:tb("shopEmptyText"),children:body}),control]})}
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
/* @__PURE__ */
|
|
183
|
-
/* @__PURE__ */jsx(
|
|
184
|
-
|
|
185
|
-
/* @__PURE__ */
|
|
186
|
-
/* @__PURE__ */
|
|
187
|
-
/* @__PURE__ */jsx(Text,{style:
|
|
188
|
-
|
|
189
|
-
/* @__PURE__ */
|
|
190
|
-
|
|
191
|
-
/* @__PURE__ */jsx(
|
|
192
|
-
/* @__PURE__ */
|
|
193
|
-
|
|
194
|
-
/* @__PURE__ */jsx(Text,{style:
|
|
195
|
-
/* @__PURE__ */jsx(
|
|
172
|
+
/* @__PURE__ */jsx(Text,{style:tb("shopEmptyText"),children:body}),control]})}var tile=(k,src,part,svg,fallback="box")=>{let{bx:bx,ink:ink}=k.S.D;/* @__PURE__ */
|
|
173
|
+
return jsx(View,{style:bx(part),children:src?/* @__PURE__ */jsx(Image,{source:{uri:src},style:FILL,accessibilityIgnoresInvertColors:true}):k.icon(fallback,ink(part,k.S.X.roles.link??""),svg)})};function shopCartBody(k,lines,subtotal,renew,petPrices,h){let{S:S,copy:copy}=k,{bx:bx,tx:tx,tb:tb,inner:inner,side:side}=S.D,X=S.X;if(lines.length===0)/* @__PURE__ */
|
|
174
|
+
return jsx(View,{style:bx("shop"),testID:"health-plan-cart-empty",children:shopEmpty(k,"cart",copy.cartEmptyTitle,copy.cartEmptyBody(petPrices),shopLink(k,copy.seeOrders,h.onOrders,"health-plan-cart-orders"))});let step=(label,iconName,off,onPress,testID,cell)=>/* @__PURE__ */jsx(Pressable,{onPress:off?void 0:onPress,disabled:off,accessibilityRole:"button",accessibilityLabel:label,accessibilityState:{disabled:off},hitSlop:HIT_44,style:pressScale([...bx("stepperButton",off&&"stepperButtonDisabled"),gridCell(X.stepper,cell)],PLAN_PRESS_SCALE.stepper,off),testID:testID,children:k.icon(iconName,void 0,side("stepperButtonSvg",16))});/* @__PURE__ */
|
|
175
|
+
return jsxs(View,{style:bx("shop"),testID:"health-plan-cart",children:[
|
|
176
|
+
/* @__PURE__ */jsx(View,{style:bx("shopCard"),children:/* @__PURE__ */jsx(View,{style:bx("cartItems"),children:lines.map(x=>/* @__PURE__ */jsxs(View,{style:bx("cartItem"),testID:`health-plan-cart-line-${x.key}`,children:[
|
|
177
|
+
/* @__PURE__ */jsx(View,{style:gridCell(X.cartItem,0),children:tile(k,x.imageUrl,"cartItemImage",side("cartItemImageSvg",28))}),
|
|
178
|
+
/* @__PURE__ */jsxs(View,{style:gridCell(X.cartItem,1),children:[
|
|
179
|
+
/* @__PURE__ */jsx(Text,{style:tb("cartItemTitle"),children:x.name}),
|
|
180
|
+
/* @__PURE__ */jsxs(View,{style:bx("cartItemPrice"),children:[x.price===null?null:/* @__PURE__ */jsx(Text,{style:tx("cartItemPriceValue"),children:x.price}),x.was===null?null:/* @__PURE__ */jsx(Text,{style:tx("cartItemPriceWas"),children:x.was}),x.note===null?null:/* @__PURE__ */jsx(Text,{style:tx("cartItemPriceNote"),children:x.note})]}),x.modes===null?null:/* @__PURE__ */jsx(View,{style:bx("mode"),accessibilityRole:"radiogroup",accessibilityLabel:x.modes.label,children:["sub","once"].map(m=>{let mode=m==="sub"?x.modes?.sub:x.modes?.once,on=m==="sub"?x.subscription:!x.subscription;return mode===void 0?null:/* @__PURE__ */jsxs(Pressable,{onPress:()=>h.onMode(x.key,m),accessibilityRole:"radio",accessibilityLabel:mode.label,accessibilityState:{checked:on},style:pressScale(bx("modeButton",on&&"modeButtonOn"),PLAN_PRESS_SCALE.mode,false),children:[inner("modeButton",on&&"modeButtonOn"),
|
|
181
|
+
/* @__PURE__ */jsx(Text,{style:[...tx("modeButton"),SHRINK2],children:mode.label}),mode.price===null?null:/* @__PURE__ */jsx(Text,{style:tx("modeButton","modePrice"),children:mode.price})]},m)})}),x.every===null?null:/* @__PURE__ */jsxs(View,{style:bx("every"),accessibilityRole:"radiogroup",accessibilityLabel:copy.shipsEvery,children:[inner("every"),x.every.options.map((d,i)=>{let on=x.every?.selected===d;/* @__PURE__ */
|
|
182
|
+
return jsx(Pressable,{onPress:()=>h.onEvery(x.key,d),accessibilityRole:"radio",accessibilityState:{checked:on},accessibilityLabel:copy.days(d),style:pressScale([...bx("everyButton",on&&"everyButtonOn"),gridCell(X.every,i),CENTER],PLAN_PRESS_SCALE.every,false),children:/* @__PURE__ */jsx(Text,{style:tx("everyButton",on&&"everyButtonOn"),children:copy.days(d)})},d)})]}),
|
|
183
|
+
/* @__PURE__ */jsxs(View,{style:bx("cartItemActions"),children:[x.subscription?null:/* @__PURE__ */jsxs(View,{style:bx("stepper"),accessibilityLabel:copy.quantityLabel(x.name),children:[inner("stepper"),step(copy.fewer,"minus",x.quantity<=1,()=>h.onQuantity(x.key,-1),`health-plan-fewer-${x.key}`,0),
|
|
184
|
+
/* @__PURE__ */jsx(Text,{style:[...tx("stepperValue"),gridCell(X.stepper,1)],accessibilityLiveRegion:"polite",children:String(x.quantity)}),step(copy.more,"plus",x.quantity>=x.maxQuantity,()=>h.onQuantity(x.key,1),`health-plan-more-${x.key}`,2)]}),
|
|
185
|
+
/* @__PURE__ */jsx(Pressable,{onPress:()=>h.onRemove(x.key),accessibilityRole:"button",accessibilityLabel:copy.remove,hitSlop:HIT_44,style:[...bx("remove"),CENTER],testID:`health-plan-remove-${x.key}`,children:/* @__PURE__ */jsx(Text,{tier:"control",style:tx("remove"),children:copy.remove})})]})]})]},x.key))})}),shopSummary(k,subtotal,{tag:true,renew:renew}),
|
|
186
|
+
/* @__PURE__ */jsx(View,{style:bx("shopActions"),children:shopLink(k,copy.seeOrders,h.onOrders,"health-plan-cart-orders")})]})}function shopCartCheckout(k,lines,lineTotal,rows,subtotal,renew,go,fine2){let{S:S,copy:copy}=k,{bx:bx,tx:tx,tb:tb}=S.D,X=S.X;/* @__PURE__ */
|
|
187
|
+
return jsxs(View,{style:bx("co"),testID:"health-plan-cart-checkout-sheet",children:[
|
|
188
|
+
/* @__PURE__ */jsx(Text,{style:SR_ONLY,accessibilityRole:"header",testID:"health-plan-cart-checkout-title",children:copy.cartCheckoutTitle}),
|
|
189
|
+
/* @__PURE__ */jsx(View,{style:bx("coItems"),children:lines.map(x=>/* @__PURE__ */jsxs(View,{style:bx("coItem"),children:[
|
|
190
|
+
/* @__PURE__ */jsx(View,{style:gridCell(X.coItem,0),children:tile(k,x.imageUrl,"coItemPic",20)}),
|
|
191
|
+
/* @__PURE__ */jsxs(View,{style:gridCell(X.coItem,1),children:[
|
|
192
|
+
/* @__PURE__ */jsx(Text,{style:tx("coItemStrong"),children:x.name}),
|
|
193
|
+
/* @__PURE__ */jsx(Text,{style:tx("coItemSmall"),children:x.subscription?copy.cartItemSubscription(x.lp):copy.cartItemQuantity(x.quantity)})]}),
|
|
194
|
+
/* @__PURE__ */jsx(Text,{style:[...tx("coItem","coItemValue"),gridCell(X.coItem,2)],children:lineTotal(x)??""})]},x.key))}),shopRows(k,rows),shopSummary(k,subtotal,{renew:renew,inCheckout:true}),shopButton(k,go.label,go.onPress,{disabled:go.disabled,testID:"health-plan-place-order"}),fine2===""?null:/* @__PURE__ */jsx(Text,{style:tb("coFine"),children:fine2})]})}function orderRow(k,o,fmt,day,onOpen){let{S:S,copy:copy}=k,{bx:bx,im:im,tx:tx,tb:tb,ink:ink,side:side}=S.D,X=S.X,done=o.step===3,last=o.dates[3]??null,lastDay=day(last),when=done?lastDay===null?null:copy.deliveredOn(lastDay):lastDay===null?null:copy.arrivesBy(lastDay),total=fmt(o.total,o.currency),what=andList(o.items.map(x=>x.title));/* @__PURE__ */
|
|
196
195
|
return jsxs(Pressable,{onPress:()=>onOpen(o.key),accessibilityRole:"button",accessibilityLabel:what,style:pressScale(bx("order"),PLAN_PRESS_SCALE.order,false),testID:`health-plan-order-${o.key}`,children:[
|
|
197
196
|
/* @__PURE__ */jsxs(View,{style:gridCell(X.order,0),children:[
|
|
198
197
|
/* @__PURE__ */jsxs(View,{style:bx("orderTop"),children:[
|
|
199
198
|
/* @__PURE__ */jsx(View,{style:bx("pill",done&&"pillDone"),children:/* @__PURE__ */jsx(Text,{style:tx("pill",done&&"pillDone"),children:copy.orderSteps[o.step]??""})}),o.subscriptionBox?/* @__PURE__ */jsx(View,{style:bx("pill","pillSub"),children:/* @__PURE__ */jsx(Text,{style:tx("pill","pillSub"),children:copy.subscriptionBox})}):null,o.number===null?null:/* @__PURE__ */jsx(Text,{style:tx("orderNo"),children:o.number})]}),
|
|
200
199
|
/* @__PURE__ */jsx(Text,{style:tb("orderWhat"),children:what}),
|
|
201
200
|
/* @__PURE__ */jsx(Text,{style:tb("orderMeta"),children:[when,total].filter(x=>x!==null).join(" · ")}),o.items.length===0?null:/* @__PURE__ */jsx(View,{style:bx("orderPics"),children:o.items.map(x=>/* @__PURE__ */jsx(View,{style:bx("orderPic"),children:x.imageUrl?/* @__PURE__ */jsx(Image,{source:{uri:x.imageUrl},style:im("orderPicImage"),accessibilityIgnoresInvertColors:true}):k.icon(x.icon??"box",ink("orderPic",X.roles.link??""),side("orderPicSvg",20))},x.title))})]}),
|
|
202
|
-
/* @__PURE__ */jsx(View,{style:gridCell(X.order,1),children:k.icon("chev",ink("orderChev",X.roles.ink3??""),side("orderChev",18))})]},o.key)}function shopOrdersBody(k,a){let{S:S,copy:copy}=k,{bx:bx,tb:tb}=S.D,s=a.subscription;return!a.loaded&&s===null?/* @__PURE__ */jsx(View,{style:bx("shop"),testID:"health-plan-orders-loading"}):a.loaded&&a.orders.length===0&&s===null?/* @__PURE__ */jsx(View,{style:bx("shop"),testID:"health-plan-orders-empty",children:shopEmpty(k,"box",copy.ordersEmptyTitle,copy.ordersEmptyBody(a.petPrices),shopButton(k,copy.startedDone,a.onBack,{part:"shopEmptyButton"}))}):/* @__PURE__ */jsxs(View,{style:bx("shop"),testID:"health-plan-orders",children:[s===null?null:/* @__PURE__ */jsxs(Fragment$1,{children:[
|
|
201
|
+
/* @__PURE__ */jsx(View,{style:gridCell(X.order,1),children:k.icon("chev",ink("orderChev",X.roles.ink3??""),side("orderChev",18))})]},o.key)}function shopOrdersBody(k,a){let{S:S,copy:copy}=k,{bx:bx,im:im,tx:tx,tb:tb,inner:inner,ink:ink}=S.D,X=S.X,s=a.subscription;return!a.loaded&&s===null?/* @__PURE__ */jsx(View,{style:bx("shop"),testID:"health-plan-orders-loading"}):a.loaded&&a.orders.length===0&&s===null?/* @__PURE__ */jsx(View,{style:bx("shop"),testID:"health-plan-orders-empty",children:shopEmpty(k,"box",copy.ordersEmptyTitle,copy.ordersEmptyBody(a.petPrices),shopButton(k,copy.startedDone,a.onBack,{part:"shopEmptyButton"}))}):/* @__PURE__ */jsxs(View,{style:bx("shop"),testID:"health-plan-orders",children:[s===null?null:/* @__PURE__ */jsxs(Fragment$1,{children:[
|
|
203
202
|
/* @__PURE__ */jsx(Text,{style:tb("shopKey"),children:copy.herSubscription}),
|
|
204
|
-
/* @__PURE__ */jsxs(View,{style:[...bx("
|
|
205
|
-
/* @__PURE__ */jsxs(View,{style:
|
|
206
|
-
/* @__PURE__ */jsx(Text,{style:
|
|
207
|
-
/* @__PURE__ */jsx(Text,{style:
|
|
203
|
+
/* @__PURE__ */jsxs(View,{style:bx("subCard"),testID:"health-plan-orders-subscription",children:[s.imageUrl?/* @__PURE__ */jsx(Image,{source:{uri:s.imageUrl},style:[...im("subCardImage"),{flexShrink:0}],accessibilityIgnoresInvertColors:true}):/* @__PURE__ */jsx(View,{style:[...bx("subCardImage"),gridCell(X.subCard,0),CENTER,{alignItems:"center"}],children:k.icon("box",ink("subCardImage",X.roles.link??""))}),
|
|
204
|
+
/* @__PURE__ */jsxs(View,{style:gridCell(X.subCard,1),children:[
|
|
205
|
+
/* @__PURE__ */jsx(Text,{style:tb("subCardStrong"),children:s.name}),s.next===null?null:/* @__PURE__ */jsx(Text,{style:tb("subCardSmall"),children:copy.nextBox(s.next)}),
|
|
206
|
+
/* @__PURE__ */jsx(Text,{style:tb("subCardSmall"),children:copy.everyDays(s.every)})]}),
|
|
207
|
+
/* @__PURE__ */jsxs(Pressable,{onPress:s.onManage,accessibilityRole:"button",accessibilityLabel:copy.manage,hitSlop:HIT_44,style:pressScale([...bx("subCardButton"),gridCell(X.subCard,2),CENTER],PLAN_PRESS_SCALE.subCard,false),testID:"health-plan-orders-manage",children:[inner("subCardButton"),
|
|
208
|
+
/* @__PURE__ */jsx(Text,{tier:"control",style:tx("subCardButton"),children:copy.manage})]})]})]}),a.orders.length>0?/* @__PURE__ */jsxs(Fragment$1,{children:[
|
|
208
209
|
/* @__PURE__ */jsx(Text,{style:tb("shopKey"),children:copy.ordersHeading(s!==null)}),
|
|
209
|
-
/* @__PURE__ */jsx(View,{style:bx("orderList"),children:a.orders.map(o=>orderRow(k,o,a.fmt,a.day,a.onOpen))}),a.more&©.moreOrders!==""?shopButton(k,copy.moreOrders,a.more.onMore,{ghost:true,disabled:a.more.loading,testID:"health-plan-orders-more"}):null,copy.ordersFine===""?null:/* @__PURE__ */jsx(Text,{style:tb("shopFine"),children:copy.ordersFine})]}):null]})}function shopOrderBody(k,a){let{S:S,copy:copy}=k,{bx:bx,tb:tb}=S.D,o=a.order,done=o.step===3,last=o.dates[3]??null,lastDay=a.day(last),sub2=done?lastDay===null?null:copy.deliveredOn(lastDay):lastDay===null?null:copy.arrivesBy(lastDay),steps=o.steps.flatMap(i=>{let title=copy.orderSteps[i];if(title===void 0)return[];let d=a.day(o.dates[i]??null);return[i<=o.step?{title:title,state:"done",...d===null?{}:{detail:d}}:{title:title,state:"next",...d===null?{}:{detail:copy.expected(d)}}]}),httpsLink=o.trackingUrl!==null&&/^https:\/\//i.test(o.trackingUrl)?o.trackingUrl:null,linkLabel=httpsLink===null?"":o.carrier!==null?copy.trackOn(o.carrier):copy.trackLink,total=a.fmt(o.total,o.currency)??"",fine2=[copy.ordersFine,o.everfur?copy.orderNote:""].filter(x=>x!=="").join(" ");/* @__PURE__ */
|
|
210
|
+
/* @__PURE__ */jsx(View,{style:bx("orderList"),children:a.orders.map(o=>orderRow(k,o,a.fmt,a.day,a.onOpen))}),a.more&©.moreOrders!==""?shopButton(k,copy.moreOrders,a.more.onMore,{ghost:true,disabled:a.more.loading,testID:"health-plan-orders-more"}):null,copy.ordersFine===""?null:/* @__PURE__ */jsx(Text,{style:tb("shopFine"),children:copy.ordersFine})]}):null]})}function shopOrderBody(k,a){let{S:S,copy:copy}=k,{bx:bx,tx:tx,tb:tb,inner:inner,ink:ink,side:side}=S.D,X=S.X,o=a.order,done=o.step===3,last=o.dates[3]??null,lastDay=a.day(last),sub2=done?lastDay===null?null:copy.deliveredOn(lastDay):lastDay===null?null:copy.arrivesBy(lastDay),steps=o.steps.flatMap(i=>{let title=copy.orderSteps[i];if(title===void 0)return[];let d=a.day(o.dates[i]??null);return[i<=o.step?{title:title,state:"done",...d===null?{}:{detail:d}}:{title:title,state:"next",...d===null?{}:{detail:copy.expected(d)}}]}),httpsLink=o.trackingUrl!==null&&/^https:\/\//i.test(o.trackingUrl)?o.trackingUrl:null,linkLabel=httpsLink===null?"":o.carrier!==null?copy.trackOn(o.carrier):copy.trackLink,total=a.fmt(o.total,o.currency)??"",fine2=[copy.ordersFine,o.everfur?copy.orderNote:""].filter(x=>x!=="").join(" ");/* @__PURE__ */
|
|
210
211
|
return jsxs(View,{style:bx("shop"),testID:"health-plan-order",children:[
|
|
211
212
|
/* @__PURE__ */jsx(Text,{style:tb("shopTitle"),accessibilityRole:"header",children:done?copy.orderSteps[3]:copy.orderSteps[0]}),sub2===null?null:/* @__PURE__ */jsx(Text,{style:tb("shopSub"),children:sub2}),
|
|
212
|
-
/* @__PURE__ */jsx(View,{style:bx("shopCard"),children:shopTrack(k,steps,copy.tracking)}),o.carrier===null&&o.trackingNumber===null?null:/* @__PURE__ */
|
|
213
|
-
/* @__PURE__ */jsx(View,{style:
|
|
214
|
-
/* @__PURE__ */jsxs(View,{style:
|
|
213
|
+
/* @__PURE__ */jsx(View,{style:bx("shopCard"),children:shopTrack(k,steps,copy.tracking)}),o.carrier===null&&o.trackingNumber===null?null:/* @__PURE__ */jsx(View,{style:bx("shopCard"),testID:"health-plan-carrier",children:/* @__PURE__ */jsxs(View,{style:[...bx("carrier"),WRAP],children:[
|
|
214
|
+
/* @__PURE__ */jsx(View,{style:[...bx("carrierIcon"),gridCell(X.carrier,0)],children:k.icon("truck",ink("carrierIcon",X.roles.link??""),side("carrierIconSvg",21))}),
|
|
215
|
+
/* @__PURE__ */jsxs(View,{style:gridCell(X.carrier,1),children:[o.carrier===null?null:/* @__PURE__ */jsx(Text,{style:tb("carrierStrong"),children:o.carrier}),o.trackingNumber===null?null:
|
|
216
|
+
/* @__PURE__ */jsxs(View,{style:[...bx("carrierSmall"),WRAP],children:[
|
|
217
|
+
/* @__PURE__ */jsx(Text,{style:tx("carrierSmall"),selectable:true,children:o.trackingNumber}),o.trackingTag===null?null:/* @__PURE__ */jsx(View,{style:bx("carrierTag"),testID:"health-plan-tracking-tag",children:/* @__PURE__ */jsx(Text,{style:tx("carrierTag"),children:o.trackingTag})})]}),o.trackingNumber===null&©.trackingByText!==""?/* @__PURE__ */jsx(Text,{style:tb("carrierWait"),children:copy.trackingByText}):null]}),httpsLink===null||linkLabel===""||o.trackingNumber===null?null:/* @__PURE__ */jsxs(Pressable,{onPress:()=>{Linking.openURL(httpsLink).catch(()=>{})},accessibilityRole:"button",accessibilityLabel:linkLabel,hitSlop:HIT_44,style:pressScale([...bx("carrierButton"),FULL_ROW],PLAN_PRESS_SCALE.button,false),testID:"health-plan-track-link",children:[inner("carrierButton"),
|
|
218
|
+
/* @__PURE__ */jsx(Text,{tier:"control",style:tx("carrierButton"),children:linkLabel})]})]})}),
|
|
215
219
|
/* @__PURE__ */jsx(Text,{style:tb("shopKey"),children:copy.inThisOrder}),
|
|
216
|
-
/* @__PURE__ */jsx(View,{style:bx("shopCard"),children
|
|
217
|
-
/* @__PURE__ */
|
|
218
|
-
/* @__PURE__ */
|
|
219
|
-
/* @__PURE__ */jsx(Text,{style:
|
|
220
|
-
/* @__PURE__ */jsx(Text,{style:S.small,children:copy.orderItemLine(x.quantity,o.subscriptionBox)})]})]},x.title))}),shopSummary(k,total),shopRows(k,a.rows),a.onBuyAgain===null?null:shopButton(k,copy.buyAgain,a.onBuyAgain,{ghost:true,testID:"health-plan-buy-again"}),a.onHelp===null?null:shopLink(k,copy.orderHelp,a.onHelp),fine2===""?null:/* @__PURE__ */jsx(Text,{style:tb("shopFine"),children:fine2})]})}var initialRead=/* @__PURE__ */new Set;function useCheckoutReturn(options){let{enabled:enabled,petRef:petRef,pages:pages,returnUrl:returnUrl,lifecycle:lifecycle}=options,handlers=useRef(options);handlers.current=options,useEffect(()=>{if(!enabled||returnUrl===null)return;let live=true,polling=false,timer=null,poll=async(checkoutId,tries)=>{let res=await pages.getCheckout(petRef,checkoutId);if(live){if(res.ok&&res.value.status==="paid"){polling=false,forgetCheckout(petRef),handlers.current.onPaid(res.value);return}if(res.ok&&(res.value.status==="failed"||res.value.status==="expired")){polling=false,forgetCheckout(petRef),handlers.current.onFailed();return}if(!res.ok&&!res.error.retryable){polling=false,forgetCheckout(petRef),handlers.current.onError(res.error);return}if(tries<=1){polling=false,forgetCheckout(petRef),handlers.current.onTimeout();return}timer=setTimeout(()=>{poll(checkoutId,tries-1)},CHECKOUT_POLL_MS)}},start=checkoutId=>{polling||(polling=true,poll(checkoutId,CHECKOUT_POLL_TRIES))},onUrl=url=>{let back=readCheckoutReturn(url,returnUrl);if(back===null)return;if(back.kind==="cancel"){forgetCheckout(petRef),handlers.current.onCancel();return}let id=recallCheckout(petRef)??back.sessionId;id!==null&&start(id)},resume=()=>{let id=recallCheckout(petRef);id!==null&&start(id)},sub=Linking.addEventListener("url",event=>onUrl(event.url));Linking.getInitialURL().then(url=>{!live||url===null||url===void 0||initialRead.has(url)||readCheckoutReturn(url,returnUrl)!==null&&(initialRead.add(url),onUrl(url))}).catch(()=>{});let offForeground;if(lifecycle)offForeground=lifecycle.onForeground(resume);else{let app=AppState.addEventListener("change",next=>{next==="active"&&resume()});offForeground=()=>app.remove()}return()=>{live=false,timer!==null&&clearTimeout(timer),sub.remove(),offForeground()}},[enabled,petRef,pages,returnUrl,lifecycle])}var PAY_WITH="Pay with",KG_MIN=.5,KG_MAX=90.7,SHRINK3={flexShrink:1},CART_BUMP_MS=320,IN_PLACE={position:"relative",top:0,right:0},FR={flexGrow:1,flexShrink:1,flexBasis:0,minWidth:0},KEEP={flexShrink:0},START={alignSelf:"flex-start"},CENTER2={justifyContent:"center"},COLUMN={flexDirection:"column"},ROW_CENTER={flexDirection:"row",alignItems:"center"},STACK_END={flexDirection:"column",alignItems:"flex-end"},ON_BASELINE={alignSelf:"baseline"},FILL={width:"100%",height:"100%"},MARKER={position:"absolute",right:"100%",textAlign:"right"},isDogSpecies=s=>s!=null&&/^(dog|canine)$/i.test(s.trim());function HealthPlanFocus(props){let{design:design,item:item,petRef:petRef,locale:locale}=props,petName=props.petName?.trim()?props.petName.trim():null,theme=useEverfurTheme(),S=useMemo(()=>makeFocusStyles(theme),[theme]),P=S.palette,telemetry=useHealthPlanTelemetry(),{runtime:runtime}=useEverfurContext(),window=useWindowDimensions(),[pageWidth,setPageWidth]=useState(null),sex=props.petSex??null,trackingTexts=props.trackingTexts===true,copy=useMemo(()=>({...HEALTH_PLAN_FOCUS_RN_COPY,...healthPlanPetCopy({name:petName,sex:sex,trackingTexts:trackingTexts}),...design.copy,...props.fromBackend===true?HEALTH_PLAN_NO_SHIP_DAY_COPY:{},...props.copy}),[petName,sex,trackingTexts,design.copy,props.copy,props.fromBackend]),sub=useHealthPlanSubscription({petRef:petRef,productId:item.productId,enabled:props.subscriptions!==false&&design.pick.none!==true,...props.subscriptionRepository?{repository:props.subscriptionRepository}:{},...props.lifecycle!==void 0?{lifecycle:props.lifecycle}:{},...props.refreshKey!==void 0?{refreshKey:props.refreshKey}:{}}),renderIcon=props.renderIcon,icon=useCallback((name,color,size)=>(renderIcon?callHost(renderIcon,name):void 0)??/* @__PURE__ */jsx(FocusIcon,{name:name,color:color??P.ink,...size===void 0?{}:{size:size}}),[renderIcon,P.ink]),still=theme.motion.reducedMotion,kit={S:S,icon:icon,copy:copy},[mode,setMode]=useState("sub"),[added,setAdded]=useState(false),[extras,setExtras]=useState(()=>/* @__PURE__ */new Set),[sheet,setSheet]=useState(null),[started,setStarted]=useState(null),tapKey=useRef(null),[toast,setToast]=useState(null),toastTimer=useRef(null);useEffect(()=>()=>{toastTimer.current!==null&&clearTimeout(toastTimer.current)},[]);let say=line=>{line!==""&&(setToast(line),toastTimer.current!==null&&clearTimeout(toastTimer.current),toastTimer.current=setTimeout(()=>setToast(null),2600))},returnUrl=validReturnUrl(props.checkoutReturnUrl)?props.checkoutReturnUrl.trim():null,everfur=props.checkout==="everfur_stripe"&&returnUrl!==null,ownPages=useHealthPlanPageRepository(),pages=props.pageRepository??ownPages,checkoutTap=useRef(null),[redirecting,setRedirecting]=useState(false),shop=props.shop??everfur,[cart,setCartState]=useState(()=>shop?readCart(petRef):[]),setCart=useCallback(f2=>{setCartState(prev=>{let next=f2(prev);return writeCart(petRef,next),next})},[petRef]),[screens,setScreens]=useState([]),[cartNotice,setCartNotice]=useState(null),ownSubs=useHealthPlanSubscriptionRepository(),subsRepo=props.subscriptionRepository??ownSubs,[everfurOrders,setEverfurOrders]=useState({loaded:false,orders:[],next:null,loading:false}),[cartOff,setCartOff]=useState(false),[weightSaved,setWeightSaved]=useState(false),[recent,setRecent]=useState([]),others=props.others??[],planItems=[item,...others],seen=/* @__PURE__ */new Set,allOrders=[...[...recent,...everfurOrders.orders].filter(o=>seen.has(o.orderId)?false:(seen.add(o.orderId),true)).map(o=>everfurOrderView(o,planItems)),...(props.shopOrders??[]).map(hostOrderView)],push=useCallback(screen=>{setSheet(null),setScreens(prev=>[...prev.filter(x=>x.kind!==screen.kind),screen])},[]),top=screens.length>0?screens[screens.length-1]:void 0,overlay=sheet!==null?sheet.kind:started!==null?"started":top!==void 0?top.kind:null,under=started!==null?"started":top!==void 0?top.kind:null,closeOverlays=useCallback(()=>{setSheet(null),setStarted(null),setScreens([]),setCartNotice(null)},[]),back=useCallback(()=>{sheet!==null?setSheet(null):started!==null?setStarted(null):setScreens(prev=>prev.slice(0,-1))},[sheet,started]),orderNumber=key=>allOrders.find(o=>o.key===key)?.number??null,title=(o=>{switch(o){case"started":return started?.kind==="once"?copy.placedHeader:copy.startedHeader;case"cart":return copy.cartTitle;case"placed":return copy.placedHeader;case"orders":return copy.orders;case"order":return copy.orderTitle(top?.kind==="order"?orderNumber(top.key):null);default:return}})(under),full=under==="started"||under==="cart"||under==="placed",onOverlayChange=props.onOverlayChange;useEffect(()=>{onOverlayChange!==void 0&&callHost(onOverlayChange,overlay,{close:closeOverlays,back:back,...title===void 0?{}:{title:title},...full?{full:full}:{}})},[overlay,onOverlayChange,closeOverlays,back,title,full]);let quote=sub.phase==="ready"?sub.quote:null,subscription=sub.subscription,active=subscription?.status==="active",canSubscribe=quote!==null,offer=canSubscribe&"e.offerApplies&&subscription===null,every=active?subscription.intervalDays:canSubscribe?quote.defaultIntervalDays:0,fmt=(n2,currency2)=>formatHealthPlanPriceWith(n2,currency2,{dropZeroCents:false,...props.priceFormat,...locale?{locale:locale}:{}}),fmtWhole=(n2,currency2)=>formatHealthPlanPriceWith(n2,currency2,{dropZeroCents:true,...props.priceFormat,...locale?{locale:locale}:{}}),currency=quote?.currency??item.currency,boxPrice=quote?.boxPrice??item.price,oneBox=quote?.oneBox??null,prices=(days,productName=item.title)=>({petName:petName,productName:productName,first:fmt(offer&"e?quote.firstBoxPrice:boxPrice,currency),box:fmt(boxPrice,currency),once:fmt(oneBox?.price??boxPrice,currency),onceDiscountPercent:oneBox?.discountPercent??0,intervalDays:days,discountPercent:offer&"e?quote.firstBoxDiscountPercent:0,offer:offer}),pr=prices(every),priced=pr.box!==null,buyMode=canSubscribe?mode:"once",day=iso=>formatHealthPlanDay(iso,locale),nextBoxDay=s=>day(s.timeline.find(step=>step.step==="next_box_ships")?.on??s.nextBoxDate),buyOnce=(target=item)=>{props.onBuy?callHost(props.onBuy,target):props.onCheckout&&callHost(props.onCheckout,[target])},partnerBuys=props.onBuy!==void 0||props.onCheckout!==void 0,settle=res=>res.ok?(props.onSubscriptionChange&&callHost(props.onSubscriptionChange,res.value),res.value):(say(res.error.displayMessage),null),leave=url=>{props.navigate?callHost(props.navigate,url):Linking.openURL(url).catch(()=>{})},returnUrls=()=>returnUrl===null?null:{successUrl:checkoutReturnUrl(returnUrl,CHECKOUT_PARAM,STRIPE_SESSION_ID),cancelUrl:checkoutReturnUrl(returnUrl,CHECKOUT_CANCEL_PARAM,"1")},redirect=async(purchase,intervalDays,target=item)=>{let urls=returnUrls();if(urls===null||redirecting)return;let sig=`${target.productId}:${purchase}:${intervalDays??""}`;checkoutTap.current?.sig!==sig&&(checkoutTap.current={sig:sig,key:mintTapKey()}),setRedirecting(true);let res=await pages.startCheckout(petRef,{productId:target.productId,purchase:purchase,...intervalDays===null?{}:{intervalDays:intervalDays},...urls},checkoutTap.current.key);if(setRedirecting(false),!res.ok){say(res.error.displayMessage);return}rememberCheckout(petRef,res.value.checkoutId),leave(res.value.url)},itemOf2=productId=>planItems.find(x=>x.productId===productId),inCart=productId=>cart.find(x=>x.productId===productId),isPick=productId=>productId===item.productId,lineSub=x=>isPick(x.productId)&&canSubscribe&&!active&&x.mode==="sub",unitOf=x=>isPick(x.productId)?lineSub(x)?offer&"e?quote.firstBoxPrice:boxPrice:oneBox?.price??boxPrice:itemOf2(x.productId)?.price??null,lines=cart.filter(x=>itemOf2(x.productId)!==void 0),lineCount=lines.reduce((n2,x)=>n2+x.qty,0),cartBump=useRef(new Animated.Value(1)).current,lastCount=useRef(lineCount);useEffect(()=>{let grew=lineCount>lastCount.current;if(lastCount.current=lineCount,!grew||theme.motion.reducedMotion)return;let easing=Easing.bezier(.23,1,.32,1),run2=Animated.sequence([Animated.timing(cartBump,{toValue:1.25,duration:CART_BUMP_MS*.4,easing:easing,useNativeDriver:false}),Animated.timing(cartBump,{toValue:1,duration:CART_BUMP_MS*.6,easing:easing,useNativeDriver:false})]);return run2.start(),()=>run2.stop()},[lineCount,theme.motion.reducedMotion,cartBump]);let cartTotal=Math.round(lines.reduce((n2,x)=>n2+(unitOf(x)??0)*x.qty,0)*100)/100,subLine=lines.find(lineSub)??null,cartOn=everfur&&!cartOff&&pages.startCartCheckout!==void 0,lineView=x=>{let it=itemOf2(x.productId)??item,subbed=lineSub(x),pick2=isPick(x.productId),lp=pick2?prices(x.every,it.title):{...prices(0,it.title),offer:false};return{key:x.productId,name:it.title,imageUrl:it.imageUrl??null,quantity:x.qty,subscription:subbed,price:fmt(unitOf(x),pick2?currency:it.currency),was:pick2?subbed?offer?lp.box:null:oneBox!==null&&boxPrice!==null&&oneBox.price<boxPrice?lp.box:null:null,note:pick2?subbed?copy.cartSubLine(lp):copy.cartOnceLine(lp,active):null,modes:pick2&&canSubscribe&&!active?{label:copy.cartModeLabel(it.title),sub:{label:copy.cartModeSubscribe(lp),price:lp.first},once:{label:copy.cartModeOnce(lp),price:lp.once}}:null,every:subbed&"e!==null?{options:quote.intervalOptions,selected:x.every}:null,maxQuantity:cartOn&&!subbed?5:1,lp:lp}},views=lines.map(lineView),renewPrices=subLine===null?null:prices(subLine.every),addToCart=(target,m)=>{if(inCart(target.productId)){push({kind:"cart"});return}let subbing=isPick(target.productId)&&canSubscribe&&!active&&m==="sub";setCart(prev=>[...prev,{productId:target.productId,mode:subbing?"sub":"once",every:quote?.defaultIntervalDays??0,qty:1}]),say(copy.addedToCart(isPick(target.productId)?pr:{...prices(0,target.title),offer:false},subbing))},editLine=(productId,f2)=>setCart(prev=>prev.flatMap(x=>x.productId!==productId?[x]:f2(x)??[])),apart=cartOn&&subLine!==null&&lines.length>1,batch=apart?lines.filter(x=>!lineSub(x)):lines,batchTotal=Math.round(batch.reduce((n2,x)=>n2+(unitOf(x)??0)*x.qty,0)*100)/100,batchSub=batch.find(lineSub)??null,batchRenew=batchSub===null?null:prices(batchSub.every),cartReady=lines.length>0&&lines.every(x=>unitOf(x)!==null)&&(lines.length===1&&(lines[0]?.qty??0)===1?true:cartOn?batch.length>0&&batch.length<=10:!everfur&&props.onCheckout!==void 0&&lines.every(x=>!lineSub(x))),redirectCart=async batchLines=>{let urls=returnUrls();if(urls===null||redirecting||pages.startCartCheckout===void 0)return;let sig=`cart:${batchLines.map(x=>`${x.productId}:${x.qty}:${lineSub(x)?x.every:""}`).join("|")}`;checkoutTap.current?.sig!==sig&&(checkoutTap.current={sig:sig,key:mintTapKey()}),setRedirecting(true);let res=await pages.startCartCheckout(petRef,{items:batchLines.map(x=>{let subbing=lineSub(x);return{productId:x.productId,purchase:subbing?"subscription":"one_box",...subbing?{intervalDays:x.every}:{},quantity:subbing?1:x.qty}}),...urls},checkoutTap.current.key);if(setRedirecting(false),!res.ok){let why=healthPlanCheckoutRefusal(res.error);if(why==="cart_disabled"){setCartOff(true),setSheet(null),say(copy.cartOneAtATime===""?res.error.displayMessage:copy.cartOneAtATime);return}if(why==="cart_has_subscription"){setSheet(null),say(copy.cartSubscriptionApart===""?res.error.displayMessage:copy.cartSubscriptionApart);return}say(res.error.displayMessage);return}rememberCheckout(petRef,res.value.checkoutId),leave(res.value.url)},placeCart=async()=>{if(!cartReady)return;if(setCartNotice(null),everfur&&cartOn&&!(batch.length===1&&(batch[0]?.qty??0)===1)){batch.map(x=>itemOf2(x.productId)).filter(x=>x!==void 0);trackCheckoutStarted(telemetry,petRef,{count:batch.reduce((n2,x)=>n2+x.qty,0),subtotal:batchTotal,currency:currency}),await redirectCart(batch);return}let only=batch.length===1?batch[0]:lines.length===1?lines[0]:void 0;if(only===void 0){props.onCheckout&&callHost(props.onCheckout,lines.map(x=>itemOf2(x.productId)).filter(x=>x!==void 0));return}let target=itemOf2(only.productId)??item,subbing=lineSub(only);if(trackCheckoutStarted(telemetry,petRef,{count:1,subtotal:unitOf(only),currency:isPick(only.productId)?currency:target.currency}),everfur){await redirect(subbing?"subscription":"one_box",subbing?only.every:null,target);return}if(subbing){let s=settle(await sub.subscribe(only.every));if(s===null)return;bought([s.productId]),setSheet(null),setScreens([]),setStarted({kind:"sub",sub:s});return}if(!isPick(only.productId)||oneBox===null){setSheet(null),buyOnce(target);return}tapKey.current===null&&(tapKey.current=mintTapKey());let res=await sub.buyOneBox(tapKey.current);if(!res.ok){say(res.error.displayMessage);return}tapKey.current=null,props.onOneBoxOrder&&callHost(props.onOneBoxOrder,res.value),bought([res.value.productId]),placed([res.value])},ordersOpen=screens.some(x=>x.kind==="orders"||x.kind==="order"),ordersLive=useRef(false),loadingMore=useRef(false),sayRef=useRef(say);sayRef.current=say,useEffect(()=>{if(!shop||!ordersOpen)return;let live=true;return ordersLive.current=true,readOrders(subsRepo,petRef,null).then(res=>{live&&(res.ok?setEverfurOrders({loaded:true,orders:res.value.orders,next:res.value.nextCursor,loading:false}):(setEverfurOrders(prev=>({...prev,loaded:true,loading:false})),sayRef.current(res.error.displayMessage)))}),()=>{live=false,ordersLive.current=false}},[shop,ordersOpen,petRef,subsRepo]);let moreOrders=()=>{let cursor=everfurOrders.next;cursor===null||loadingMore.current||(loadingMore.current=true,setEverfurOrders(prev=>({...prev,loading:true})),readOrders(subsRepo,petRef,cursor).then(async res=>{let again=!res.ok&&invalidCursor(res.error)?await readOrders(subsRepo,petRef,null):null;if(loadingMore.current=false,!!ordersLive.current){if(again!==null){again.ok?setEverfurOrders({loaded:true,orders:again.value.orders,next:again.value.nextCursor,loading:false}):(setEverfurOrders(prev=>({...prev,next:null,loading:false})),sayRef.current(again.error.displayMessage));return}if(res.ok){let page=res.value;setEverfurOrders(prev=>({loaded:true,orders:[...prev.orders,...page.orders.filter(o=>!prev.orders.some(x=>x.orderId===o.orderId))],next:page.nextCursor,loading:false}))}else setEverfurOrders(prev=>({...prev,loading:false})),sayRef.current(res.error.displayMessage)}}))},species=props.species??null,isDog=isDogSpecies(species),otherSpecies=species!==null&&species.trim()!==""&&!isDog,weightKnown=props.weightKnown!==false||weightSaved,askWeight=!weightKnown&&isDog,kg=props.weightUnit==="kg",[weightInput,setWeightInput]=useState(""),[weightError,setWeightError]=useState(""),[savingWeight,setSavingWeight]=useState(false),saveWeight=async()=>{let n2=Math.round(Number.parseFloat(weightInput.replace(",","."))*10)/10;if(!(kg?n2>=KG_MIN&&n2<=KG_MAX:n2>=1&&n2<=200)){setWeightError(kg?copy.weightErrorKg:copy.weightError);return}let weightKg=kg?Math.round(n2*100)/100:Math.round(n2/LB_PER_KG2*100)/100,lb=kg?Math.round(n2*LB_PER_KG2*10)/10:n2;setSavingWeight(true);let res=props.onSaveWeight?await props.onSaveWeight(weightKg,lb):await runtime.updatePet(petRef,{weightKg:weightKg});if(setSavingWeight(false),!res.ok){setWeightError(res.error.displayMessage);return}setWeightError(""),setWeightSaved(true),setSheet(null),say(kg?copy.weightSavedKg(String(n2)):copy.weightSaved(String(lb))),props.onWeightSaved&&callHost(props.onWeightSaved,weightKg)},recordsReader=props.recordsRepository,[recordsEmpty,setRecordsEmpty]=useState(null),readEmpty=recordsReader!==void 0&&props.recordsMissing===void 0&&props.onConnectRecords!==void 0;useEffect(()=>{if(!readEmpty||recordsReader===void 0)return;let live=true;return recordsReader.getRecord(petRef).then(res=>{live&&setRecordsEmpty(res.ok?res.value.withheld!==true&&res.value.is_empty===true:null)}).catch(()=>{}),()=>{live=false}},[readEmpty,recordsReader,petRef]);let probeRecords=recordsReader===void 0&&props.onConnectRecords!==void 0&&props.recordsMissing===void 0&&props.recordsBlanks===void 0,[recordsRead,setRecordsRead]=useState(null),onRecordsRead=useCallback(read=>setRecordsRead({pet:petRef,read:read}),[petRef]),probed=probeRecords&&recordsRead!==null&&recordsRead.pet===petRef?recordsRead.read:null,recordsProbe=probeRecords?/* @__PURE__ */jsx(RecordsProbe,{petRef:petRef,onRead:onRecordsRead},petRef):null,recordsMissing=props.recordsMissing??(recordsReader!==void 0?recordsEmpty===true:probed?.missing===true),[storeNoVet,setStoreNoVet]=useState(()=>healthPlanNoVet(petRef));useEffect(()=>(setStoreNoVet(healthPlanNoVet(petRef)),onHealthPlanNoVet((pet,none)=>{pet===petRef&&setStoreNoVet(none)})),[petRef]);let noVet=props.noVet??storeNoVet,blanksFacts=props.recordsBlanks!==void 0?props.recordsBlanks:probed?.blanks??null,kv=runtime.registry.services.kv,[flashKey,setFlashKey]=useState(null),hostSaid=useRef(false);useEffect(()=>(hostSaid.current=false,onHealthPlanRecordsLanded((pet,source)=>{pet===petRef&&source==="host"&&(hostSaid.current=true)})),[petRef]);let blanksPhase=blanksFacts?.phase??null,blanksId=blanksFacts?.requestId??null,landed=useRef({say:say,line:copy.recordsLanded});landed.current={say:say,line:copy.recordsLanded},useEffect(()=>{if(blanksId===null)return;let live=true;return loadBlanksMemo(kv,petRef).then(()=>{let memo=blanksMemo(petRef);if(blanksPhase==="wait"){memo.waited!==blanksId&&setBlanksMemo(kv,petRef,{...memo,waited:blanksId});return}!live||memo.flashed===blanksId||(setBlanksMemo(kv,petRef,{...memo,flashed:blanksId}),!(memo.waited!==blanksId&&!hostSaid.current)&&(hostSaid.current=false,setFlashKey(blanksId),landed.current.say(landed.current.line),notifyHealthPlanRecordsLanded(petRef,"plan")))}),()=>{live=false}},[blanksPhase,blanksId,petRef,kv]);let placed=orders=>{let first=orders[0];if(first!==void 0){if(!shop){setStarted({kind:"once",order:first});return}setRecent(prev=>[...orders,...prev.filter(o=>!orders.some(x=>x.orderId===o.orderId))]),setSheet(null),setScreens([{kind:"placed",orders:orders}])}},bought=productIds=>{let gone=new Set(productIds.filter(x=>x!==null));gone.size>0&&setCart(prev=>prev.filter(x=>!gone.has(x.productId)))};useCheckoutReturn({enabled:everfur,petRef:petRef,pages:pages,returnUrl:returnUrl,lifecycle:props.lifecycle??null,onPaid:state2=>{let run2=state2.subscription,orders=state2.orders??(state2.order===null?[]:[state2.order]);if(setCartNotice(null),run2!==null)props.onSubscriptionChange&&callHost(props.onSubscriptionChange,run2),setSheet(null),setScreens([]),setStarted({kind:"sub",sub:run2});else if(orders.length>0){for(let o of orders)props.onOneBoxOrder&&callHost(props.onOneBoxOrder,o);placed(orders)}bought([run2?.productId??null,...orders.map(o=>o.productId)]),sub.refresh()},onFailed:()=>{setSheet(null),setStarted(null),setScreens([{kind:"cart"}]),setCartNotice(copy.checkoutFailed)},onCancel:()=>{setRedirecting(false)},onTimeout:()=>{setSheet(null),setStarted(null),setScreens([{kind:"orders"}])},onError:error=>say(error.displayMessage)});let X=S.X,{bx:bx,im:im,tx:tx,tb:tb,ring:ring,inner:inner,ink:ink,side:side,mod:mod,scroll:scroll,swipe:swipe}=S.D,badgeOuter=X.cartCount.rings[0]??X.cartCount.box,badgePlace={position:"absolute",top:badgeOuter.top,right:badgeOuter.right},img=(src,style)=>src?/* @__PURE__ */jsx(Image,{source:{uri:src},style:style,accessibilityIgnoresInvertColors:true}):null,tag=(label,part)=>label===void 0||label===""?null:/* @__PURE__ */jsx(View,{style:bx("tag",part),children:/* @__PURE__ */jsx(Text,{tier:"compact",style:tx("tag",part),children:label})}),sec=1,n=(k,part)=>/* @__PURE__ */jsx(View,{style:bx(part),accessibilityElementsHidden:true,importantForAccessibility:"no-hide-descendants",children:/* @__PURE__ */jsx(Text,{tier:"badge",style:tx(part),children:String(k)})}),secHead=label=>/* @__PURE__ */jsxs(View,{style:bx("secTitle"),children:[n(sec++,"secN"),
|
|
220
|
+
/* @__PURE__ */jsx(View,{style:bx("shopCard"),children:/* @__PURE__ */jsx(View,{style:bx("cartItems"),children:o.items.map(x=>/* @__PURE__ */jsxs(View,{style:bx("cartItem"),testID:"health-plan-order-line",children:[
|
|
221
|
+
/* @__PURE__ */jsx(View,{style:gridCell(X.cartItem,0),children:tile(k,x.imageUrl,"cartItemImage",side("cartItemImageSvg",28),x.icon??"box")}),
|
|
222
|
+
/* @__PURE__ */jsxs(View,{style:gridCell(X.cartItem,1),children:[
|
|
223
|
+
/* @__PURE__ */jsx(Text,{style:tb("cartItemTitle"),children:x.title}),
|
|
224
|
+
/* @__PURE__ */jsxs(View,{style:bx("cartItemPrice"),children:[
|
|
225
|
+
/* @__PURE__ */jsx(Text,{style:tx("cartItemPriceValue"),children:a.fmt(x.price,o.currency)??""}),
|
|
226
|
+
/* @__PURE__ */jsx(Text,{style:tx("cartItemPriceNote"),children:copy.orderItemLine(x.quantity,o.subscriptionBox)})]})]})]},x.title))})}),shopSummary(k,total),shopRows(k,a.rows,true),a.onBuyAgain===null?null:shopButton(k,copy.buyAgain,a.onBuyAgain,{ghost:true,testID:"health-plan-buy-again"}),a.onHelp===null?null:shopLink(k,copy.orderHelp,a.onHelp),fine2===""?null:/* @__PURE__ */jsx(Text,{style:tb("shopFine"),children:fine2})]})}var initialRead=/* @__PURE__ */new Set;function useCheckoutReturn(options){let{enabled:enabled,petRef:petRef,pages:pages,returnUrl:returnUrl,lifecycle:lifecycle,kv:kv}=options,handlers=useRef(options);handlers.current=options,useEffect(()=>{if(!enabled||returnUrl===null)return;let live=true,polling=false,run2=0,timer=null,poll=async(checkoutId,tries,mine)=>{let res=await pages.getCheckout(petRef,checkoutId);if(!(!live||mine!==run2)){if(res.ok&&res.value.status==="paid"){polling=false,forgetCheckout(petRef,kv),handlers.current.onPaid(res.value);return}if(res.ok&&(res.value.status==="failed"||res.value.status==="expired")){polling=false,forgetCheckout(petRef,kv),handlers.current.onFailed();return}if(!res.ok&&!res.error.retryable){polling=false,forgetCheckout(petRef,kv),handlers.current.onError(res.error);return}if(tries<=1){polling=false,forgetCheckout(petRef,kv),handlers.current.onTimeout();return}timer=setTimeout(()=>{poll(checkoutId,tries-1,mine)},CHECKOUT_POLL_MS)}},start=checkoutId=>{polling||(polling=true,poll(checkoutId,CHECKOUT_POLL_TRIES,run2))},loaded=loadShopMemory(kv,petRef),onUrl=url=>{let back=readCheckoutReturn(url,returnUrl);if(back!==null){if(back.kind==="cancel"){run2+=1,polling=false,timer!==null&&clearTimeout(timer),timer=null,forgetCheckout(petRef,kv),handlers.current.onCancel();return}loaded.then(()=>{if(!live)return;let id=recallCheckout(petRef)??back.sessionId;id!==null&&start(id)})}},resume=()=>{loaded.then(()=>{if(!live)return;let id=recallCheckout(petRef);id!==null&&start(id)})},sub=Linking.addEventListener("url",event=>onUrl(event.url));Linking.getInitialURL().then(url=>{!live||url===null||url===void 0||initialRead.has(url)||readCheckoutReturn(url,returnUrl)!==null&&(initialRead.add(url),onUrl(url))}).catch(()=>{}).then(resume);let offForeground;if(lifecycle)offForeground=lifecycle.onForeground(resume);else{let app=AppState.addEventListener("change",next=>{next==="active"&&resume()});offForeground=()=>app.remove()}return()=>{live=false,timer!==null&&clearTimeout(timer),sub.remove(),offForeground()}},[enabled,petRef,pages,returnUrl,lifecycle,kv])}var HealthPlanScrollContext=createContext(null),HealthPlanViewportContext=createContext(null);function HealthPlanScrollScope({scrollRef:scrollRef,children:children,style:style}){let origin=useRef(null),still=useEverfurTheme().motion.reducedMotion,scrollTo=useCallback(node=>{let from=origin.current,scroller=scrollRef.current;if(!(node===null||from===null||scroller===null))try{node.measureLayout(from,(_x,y)=>scroller.scrollTo({y:Math.max(0,y),animated:!still}),()=>{})}catch{}},[scrollRef,still]),value=useMemo(()=>scrollTo,[scrollTo]),viewport=useMemo(()=>({measure:onFrame=>{let scroller=scrollRef.current;if(typeof scroller?.measureInWindow=="function")try{scroller.measureInWindow((_x,y,_w,height)=>{height>0&&onFrame({y:y,height:height})})}catch{}},top:node=>{let from=origin.current,scroller=scrollRef.current;if(!(node===null||from===null||scroller===null))try{node.measureLayout(from,(_x,y)=>scroller.scrollTo({y:Math.max(0,y),animated:!1}),()=>{})}catch{}}}),[scrollRef]);/* @__PURE__ */
|
|
227
|
+
return jsx(HealthPlanScrollContext.Provider,{value:value,children:/* @__PURE__ */jsx(HealthPlanViewportContext.Provider,{value:viewport,children:/* @__PURE__ */jsx(View,{ref:origin,style:style,collapsable:false,children:children})})})}function useHealthPlanScroll(){return useContext(HealthPlanScrollContext)}function useHealthPlanViewport(){return useContext(HealthPlanViewportContext)}var warnedNoReturnUrl=false;function warnNoReturnUrl(){if(globalThis.__DEV__===false||warnedNoReturnUrl)return;warnedNoReturnUrl=true;let globalConsole=globalThis.console;try{globalConsole?.warn?.("[everfur] The Health Plan shop is on with Everfur checkout, but `focus.checkoutReturnUrl` is missing or not an https URL, so the member is never sent to Stripe: checkout keeps the in-app path (your onBuy / onCheckout). Pass the https App Link (Universal Link) your app opens as `checkoutReturnUrl`.")}catch{}}var PAY_WITH="Pay with",KG_MIN=.5,KG_MAX=90,SHRINK3={flexShrink:1},CART_BUMP_MS=320,PUSH_FOOT_MIN_BOTTOM=12,IN_PLACE={position:"relative",top:0,right:0},FR={flexGrow:1,flexShrink:1,flexBasis:0,minWidth:0},KEEP={flexShrink:0},START={alignSelf:"flex-start"},CENTER2={justifyContent:"center"},COLUMN={flexDirection:"column"},ROW_CENTER={flexDirection:"row",alignItems:"center"},STACK_END={flexDirection:"column",alignItems:"flex-end"},ON_BASELINE={alignSelf:"baseline"},FILL2={width:"100%",height:"100%"},MARKER={position:"absolute",right:"100%",textAlign:"right"},isDogSpecies=s=>s!=null&&/^(dog|canine)$/i.test(s.trim());function HealthPlanFocus(props){let{design:design,item:item,petRef:petRef,locale:locale}=props,petName=props.petName?.trim()?props.petName.trim():null,theme=useEverfurTheme(),S=useMemo(()=>makeFocusStyles(theme),[theme]),P=S.palette,telemetry=useHealthPlanTelemetry(),{runtime:runtime}=useEverfurContext(),window=useWindowDimensions(),[pageWidth,setPageWidth]=useState(null),sex=props.petSex??null,trackingTexts=props.trackingTexts===true,copy=useMemo(()=>({...HEALTH_PLAN_FOCUS_RN_COPY,...healthPlanPetCopy({name:petName,sex:sex,trackingTexts:trackingTexts}),...design.copy,...props.fromBackend===true?HEALTH_PLAN_NO_SHIP_DAY_COPY:{},...props.copy}),[petName,sex,trackingTexts,design.copy,props.copy,props.fromBackend]),sub=useHealthPlanSubscription({petRef:petRef,productId:item.productId,enabled:props.subscriptions!==false&&design.pick.none!==true,...props.subscriptionRepository?{repository:props.subscriptionRepository}:{},...props.lifecycle!==void 0?{lifecycle:props.lifecycle}:{},...props.refreshKey!==void 0?{refreshKey:props.refreshKey}:{}}),renderIcon=props.renderIcon,icon=useCallback((name,color,size)=>(renderIcon?callHost(renderIcon,name):void 0)??/* @__PURE__ */jsx(FocusIcon,{name:name,color:color??P.ink,...size===void 0?{}:{size:size}}),[renderIcon,P.ink]),still=theme.motion.reducedMotion,kit={S:S,icon:icon,copy:copy},[mode,setMode]=useState("sub"),[added,setAdded]=useState(false),[extras,setExtras]=useState(()=>/* @__PURE__ */new Set),[sheet,setSheet]=useState(null),[started,setStarted]=useState(null),tapKey=useRef(null),[toast,setToast]=useState(null),toastTimer=useRef(null);useEffect(()=>()=>{toastTimer.current!==null&&clearTimeout(toastTimer.current)},[]);let withTracking=line=>[line,copy.trackingComesByText].filter(x=>x!=="").join(" "),say=line=>{line!==""&&(setToast(line),toastTimer.current!==null&&clearTimeout(toastTimer.current),toastTimer.current=setTimeout(()=>setToast(null),2600))},returnUrl=validReturnUrl(props.checkoutReturnUrl)?props.checkoutReturnUrl.trim():null,everfur=props.checkout==="everfur_stripe"&&returnUrl!==null,ownPages=useHealthPlanPageRepository(),pages=props.pageRepository??ownPages,checkoutTap=useRef(null),[redirecting,setRedirecting]=useState(false),scrollScope=useHealthPlanScroll(),pickRef=useRef(null),shop=props.shop??everfur;useEffect(()=>{props.shop===true&&props.checkout==="everfur_stripe"&&returnUrl===null&&warnNoReturnUrl()},[props.shop,props.checkout,returnUrl]);let kv=runtime.registry.services.kv,[cart,setCartState]=useState(()=>shop?readCart(petRef):[]),cartRef=useRef(cart);useEffect(()=>{if(!shop)return;let live=true;return loadShopMemory(kv,petRef).then(()=>{if(!live)return;let kept=readCart(petRef);cartRef.current.length===0&&kept.length>0&&(cartRef.current=kept,setCartState(kept))}),()=>{live=false}},[shop,kv,petRef]);let setCart=useCallback(f2=>{let next=f2(cartRef.current);cartRef.current=next,writeCart(petRef,next,kv),setCartState(next)},[petRef,kv]),[screens,setScreens]=useState([]),ownSubs=useHealthPlanSubscriptionRepository(),subsRepo=props.subscriptionRepository??ownSubs,[everfurOrders,setEverfurOrders]=useState({loaded:false,orders:[],next:null,loading:false}),[cartOff,setCartOff]=useState(false),[weightSaved,setWeightSaved]=useState(false),[recent,setRecent]=useState([]),others=props.others??[],planItems=[item,...others],seen=/* @__PURE__ */new Set,allOrders=[...[...recent,...everfurOrders.orders].filter(o=>seen.has(o.orderId)?false:(seen.add(o.orderId),true)).map(o=>everfurOrderView(o,planItems)),...(props.shopOrders??[]).map(hostOrderView)],push=useCallback(screen=>{setSheet(null),setScreens(prev=>[...prev.filter(x=>x.kind!==screen.kind),screen])},[]),top=screens.length>0?screens[screens.length-1]:void 0,overlay=sheet!==null?sheet.kind:started!==null?"started":top!==void 0?top.kind:null,under=started!==null?"started":top!==void 0?top.kind:null,closeOverlays=useCallback(()=>{setSheet(null),setStarted(null),setScreens([])},[]),back=useCallback(()=>{sheet!==null?setSheet(null):started!==null?setStarted(null):setScreens(prev=>prev.slice(0,-1))},[sheet,started]),orderNumber=key=>allOrders.find(o=>o.key===key)?.number??null,title=(o=>{switch(o){case"started":return started?.kind==="once"?copy.placedHeader:copy.startedHeader;case"cart":return copy.cartTitle;case"placed":return copy.placedHeader;case"orders":return copy.orders;case"order":return copy.orderTitle(top?.kind==="order"?orderNumber(top.key):null);default:return}})(under),full=under==="started"||under==="cart"||under==="placed",onOverlayChange=props.onOverlayChange;useEffect(()=>{onOverlayChange!==void 0&&callHost(onOverlayChange,overlay,{close:closeOverlays,back:back,...title===void 0?{}:{title:title},...full?{full:full}:{}})},[overlay,onOverlayChange,closeOverlays,back,title,full]);let viewport=useHealthPlanViewport(),insets=useSafeAreaInsets(),pushedRef=useRef(null),[pane,setPane]=useState(null),pushedId=started!==null?"started":top===void 0?null:top.kind==="order"?`order:${top.key}`:top.kind,pushedOpen=pushedId!==null;useEffect(()=>{if(!pushedOpen||viewport===null){setPane(null);return}viewport.measure(({y:y,height:height})=>{let below=Math.max(0,window.height-(y+height)),under2=Math.max(0,insets.bottom-below);setPane(was=>was!==null&&was.height===height&&was.under===under2?was:{height:height,under:under2})})},[pushedOpen,viewport,window.height,insets.bottom]),useEffect(()=>{pane!==null&&pushedId!==null&&viewport?.top(pushedRef.current)},[pane===null,pushedId,viewport]);let quote=sub.phase==="ready"?sub.quote:null,subscription=sub.subscription,active=subscription?.status==="active",canSubscribe=quote!==null,offer=canSubscribe&"e.offerApplies&&subscription===null,every=active?subscription.intervalDays:canSubscribe?quote.defaultIntervalDays:0,fmt=(n2,currency2)=>formatHealthPlanPriceWith(n2,currency2,{dropZeroCents:false,...props.priceFormat,...locale?{locale:locale}:{}}),fmtWhole=(n2,currency2)=>formatHealthPlanPriceWith(n2,currency2,{dropZeroCents:true,...props.priceFormat,...locale?{locale:locale}:{}}),currency=quote?.currency??item.currency,boxPrice=quote?.boxPrice??item.price,oneBox=quote?.oneBox??null,prices=(days,productName=item.title)=>({petName:petName,productName:productName,first:fmt(offer&"e?quote.firstBoxPrice:boxPrice,currency),box:fmt(boxPrice,currency),once:fmt(oneBox?.price??boxPrice,currency),onceDiscountPercent:oneBox?.discountPercent??0,intervalDays:days,discountPercent:offer&"e?quote.firstBoxDiscountPercent:0,offer:offer}),pr=prices(every),priced=pr.box!==null,buyMode=canSubscribe?mode:"once",day=iso=>formatHealthPlanDay(iso,locale),nextBoxDay=s=>day(s.timeline.find(step=>step.step==="next_box_ships")?.on??s.nextBoxDate),buyOnce=(target=item)=>{props.onBuy?callHost(props.onBuy,target):props.onCheckout&&callHost(props.onCheckout,[target])},partnerBuys=props.onBuy!==void 0||props.onCheckout!==void 0,settle=res=>res.ok?(props.onSubscriptionChange&&callHost(props.onSubscriptionChange,res.value),res.value):(say(res.error.displayMessage),null),leave=url=>{props.navigate?callHost(props.navigate,url):Linking.openURL(url).catch(()=>{})},returnUrls=()=>returnUrl===null?null:{successUrl:checkoutReturnUrl(returnUrl,CHECKOUT_PARAM,STRIPE_SESSION_ID),cancelUrl:checkoutReturnUrl(returnUrl,CHECKOUT_CANCEL_PARAM,"1")},redirect=async(purchase,intervalDays,target=item)=>{let urls=returnUrls();if(urls===null||redirecting)return;let sig=`${target.productId}:${purchase}:${intervalDays??""}`;checkoutTap.current?.sig!==sig&&(checkoutTap.current={sig:sig,key:mintTapKey()}),setRedirecting(true);let res=await pages.startCheckout(petRef,{productId:target.productId,purchase:purchase,...intervalDays===null?{}:{intervalDays:intervalDays},...urls},checkoutTap.current.key);if(setRedirecting(false),!res.ok){say(res.error.displayMessage);return}rememberCheckout(petRef,res.value.checkoutId,kv),leave(res.value.url)},itemOf2=productId=>planItems.find(x=>x.productId===productId),inCart=productId=>cart.find(x=>x.productId===productId),isPick=productId=>productId===item.productId,lineSub=x=>isPick(x.productId)&&canSubscribe&&!active&&x.mode==="sub",unitOf=x=>isPick(x.productId)?lineSub(x)?offer&"e?quote.firstBoxPrice:boxPrice:oneBox?.price??boxPrice:itemOf2(x.productId)?.price??null,lines=cart.filter(x=>itemOf2(x.productId)!==void 0),lineCount=lines.reduce((n2,x)=>n2+x.qty,0),cartBump=useRef(new Animated.Value(1)).current,lastCount=useRef(lineCount);useEffect(()=>{let grew=lineCount>lastCount.current;if(lastCount.current=lineCount,!grew||theme.motion.reducedMotion)return;let easing=Easing.bezier(.23,1,.32,1),run2=Animated.sequence([Animated.timing(cartBump,{toValue:1.25,duration:CART_BUMP_MS*.4,easing:easing,useNativeDriver:false}),Animated.timing(cartBump,{toValue:1,duration:CART_BUMP_MS*.6,easing:easing,useNativeDriver:false})]);return run2.start(),()=>run2.stop()},[lineCount,theme.motion.reducedMotion,cartBump]);let cartTotal=Math.round(lines.reduce((n2,x)=>n2+(unitOf(x)??0)*x.qty,0)*100)/100,subLine=lines.find(lineSub)??null,cartOn=everfur&&!cartOff&&pages.startCartCheckout!==void 0,lineView=x=>{let it=itemOf2(x.productId)??item,subbed=lineSub(x),pick2=isPick(x.productId),lp=pick2?prices(x.every,it.title):{...prices(0,it.title),offer:false};return{key:x.productId,name:it.title,imageUrl:it.imageUrl??null,quantity:x.qty,subscription:subbed,price:fmt(unitOf(x),pick2?currency:it.currency),was:pick2?subbed?offer?lp.box:null:oneBox!==null&&boxPrice!==null&&oneBox.price<boxPrice?lp.box:null:null,note:pick2?subbed?copy.cartSubLine(lp):copy.cartOnceLine(lp,active):null,modes:pick2&&canSubscribe&&!active?{label:copy.cartModeLabel(it.title),sub:{label:copy.cartModeSubscribe(lp),price:lp.first},once:{label:copy.cartModeOnce(lp),price:lp.once}}:null,every:subbed&"e!==null?{options:quote.intervalOptions,selected:x.every}:null,maxQuantity:cartOn&&!subbed?MAX_QUANTITY:1,lp:lp}},views=lines.map(lineView),renewPrices=subLine===null?null:prices(subLine.every),addToCart=(target,m)=>{if(inCart(target.productId)){push({kind:"cart"});return}let subbing=isPick(target.productId)&&canSubscribe&&!active&&m==="sub";setCart(prev=>[...prev,{productId:target.productId,mode:subbing?"sub":"once",every:quote?.defaultIntervalDays??0,qty:1}]),say(copy.addedToCart(isPick(target.productId)?pr:{...prices(0,target.title),offer:false},subbing))},editLine=(productId,f2)=>setCart(prev=>prev.flatMap(x=>x.productId!==productId?[x]:f2(x)??[])),apart=cartOn&&subLine!==null&&lines.length>1,batch=apart?lines.filter(x=>!lineSub(x)):lines,batchTotal=Math.round(batch.reduce((n2,x)=>n2+(unitOf(x)??0)*x.qty,0)*100)/100,batchSub=batch.find(lineSub)??null,batchRenew=batchSub===null?null:prices(batchSub.every),cartReady=lines.length>0&&lines.every(x=>unitOf(x)!==null)&&(lines.length===1&&(lines[0]?.qty??0)===1?true:cartOn?batch.length>0&&batch.length<=MAX_CART_LINES:!everfur&&props.onCheckout!==void 0&&lines.every(x=>!lineSub(x))),redirectCart=async batchLines=>{let urls=returnUrls();if(urls===null||redirecting||pages.startCartCheckout===void 0)return;let sig=`cart:${batchLines.map(x=>`${x.productId}:${x.qty}:${lineSub(x)?x.every:""}`).join("|")}`;checkoutTap.current?.sig!==sig&&(checkoutTap.current={sig:sig,key:mintTapKey()}),setRedirecting(true);let res=await pages.startCartCheckout(petRef,{items:batchLines.map(x=>{let subbing=lineSub(x);return{productId:x.productId,purchase:subbing?"subscription":"one_box",...subbing?{intervalDays:x.every}:{},quantity:subbing?1:x.qty}}),...urls},checkoutTap.current.key);if(setRedirecting(false),!res.ok){let why=healthPlanCheckoutRefusal(res.error);if(why==="cart_disabled"){setCartOff(true),setSheet(null),say(copy.cartOneAtATime===""?res.error.displayMessage:copy.cartOneAtATime);return}if(why==="cart_has_subscription"){setSheet(null),say(copy.cartSubscriptionApart===""?res.error.displayMessage:copy.cartSubscriptionApart);return}say(res.error.displayMessage);return}rememberCheckout(petRef,res.value.checkoutId,kv),leave(res.value.url)},placeCart=async()=>{if(!cartReady)return;if(everfur&&cartOn&&!(batch.length===1&&(batch[0]?.qty??0)===1)){batch.map(x=>itemOf2(x.productId)).filter(x=>x!==void 0);trackCheckoutStarted(telemetry,petRef,{count:batch.reduce((n2,x)=>n2+x.qty,0),subtotal:batchTotal,currency:currency}),await redirectCart(batch);return}let only=batch.length===1?batch[0]:lines.length===1?lines[0]:void 0;if(only===void 0){props.onCheckout&&callHost(props.onCheckout,lines.map(x=>itemOf2(x.productId)).filter(x=>x!==void 0));return}let target=itemOf2(only.productId)??item,subbing=lineSub(only);if(trackCheckoutStarted(telemetry,petRef,{count:1,subtotal:unitOf(only),currency:isPick(only.productId)?currency:target.currency}),everfur){await redirect(subbing?"subscription":"one_box",subbing?only.every:null,target);return}if(subbing){let s=settle(await sub.subscribe(only.every));if(s===null)return;bought([s.productId]),setSheet(null),setScreens([]),setStarted({kind:"sub",sub:s});return}if(!isPick(only.productId)||oneBox===null){setSheet(null),buyOnce(target);return}tapKey.current===null&&(tapKey.current=mintTapKey());let res=await sub.buyOneBox(tapKey.current);if(!res.ok){say(res.error.displayMessage);return}tapKey.current=null,props.onOneBoxOrder&&callHost(props.onOneBoxOrder,res.value),bought([res.value.productId]),placed([res.value])},ordersOpen=screens.some(x=>x.kind==="orders"||x.kind==="order"),ordersLive=useRef(false),loadingMore=useRef(false),sayRef=useRef(say);sayRef.current=say,useEffect(()=>{if(!shop||!ordersOpen)return;let live=true;return ordersLive.current=true,readOrders(subsRepo,petRef,null).then(res=>{live&&(res.ok?setEverfurOrders({loaded:true,orders:res.value.orders,next:res.value.nextCursor,loading:false}):(setEverfurOrders(prev=>({...prev,loaded:true,loading:false})),sayRef.current(res.error.displayMessage)))}),()=>{live=false,ordersLive.current=false}},[shop,ordersOpen,petRef,subsRepo]);let moreOrders=()=>{let cursor=everfurOrders.next;cursor===null||loadingMore.current||(loadingMore.current=true,setEverfurOrders(prev=>({...prev,loading:true})),readOrders(subsRepo,petRef,cursor).then(async res=>{let again=!res.ok&&invalidCursor(res.error)?await readOrders(subsRepo,petRef,null):null;if(loadingMore.current=false,!!ordersLive.current){if(again!==null){again.ok?setEverfurOrders({loaded:true,orders:again.value.orders,next:again.value.nextCursor,loading:false}):(setEverfurOrders(prev=>({...prev,next:null,loading:false})),sayRef.current(again.error.displayMessage));return}if(res.ok){let page=res.value;setEverfurOrders(prev=>({loaded:true,orders:[...prev.orders,...page.orders.filter(o=>!prev.orders.some(x=>x.orderId===o.orderId))],next:page.nextCursor,loading:false}))}else setEverfurOrders(prev=>({...prev,loading:false})),sayRef.current(res.error.displayMessage)}}))},species=props.species??null,isDog=isDogSpecies(species),otherSpecies=species!==null&&species.trim()!==""&&!isDog,weightKnown=props.weightKnown!==false||weightSaved,askWeight=!weightKnown&&isDog,kg=props.weightUnit==="kg",[weightInput,setWeightInput]=useState(""),[weightFocused,setWeightFocused]=useState(false),[weightError,setWeightError]=useState(""),[savingWeight,setSavingWeight]=useState(false),saveWeight=async()=>{let n2=Math.round(Number.parseFloat(weightInput.replace(",","."))*10)/10;if(!(kg?n2>=KG_MIN&&n2<=KG_MAX:n2>=1&&n2<=200)){setWeightError(kg?copy.weightErrorKg:copy.weightError);return}let{weightKg:weightKg,pounds:lb}=healthPlanWeightForSave(n2,kg);setSavingWeight(true);let res=props.onSaveWeight?await props.onSaveWeight(weightKg,lb):await runtime.updatePet(petRef,{weightKg:weightKg});if(setSavingWeight(false),!res.ok){setWeightError(res.error.displayMessage);return}setWeightError(""),setWeightSaved(true),setSheet(null),say(kg?copy.weightSavedKg(String(n2)):copy.weightSaved(String(lb))),props.onWeightSaved&&callHost(props.onWeightSaved,weightKg)},recordsReader=props.recordsRepository,[recordsEmpty,setRecordsEmpty]=useState(null),readEmpty=recordsReader!==void 0&&props.recordsMissing===void 0&&props.onConnectRecords!==void 0;useEffect(()=>{if(!readEmpty||recordsReader===void 0)return;let live=true;return recordsReader.getRecord(petRef).then(res=>{live&&setRecordsEmpty(res.ok?res.value.withheld!==true&&res.value.is_empty===true:null)}).catch(()=>{}),()=>{live=false}},[readEmpty,recordsReader,petRef]);let probeRecords=recordsReader===void 0&&props.onConnectRecords!==void 0&&props.recordsMissing===void 0&&props.recordsBlanks===void 0,[recordsRead,setRecordsRead]=useState(null),onRecordsRead=useCallback(read=>setRecordsRead({pet:petRef,read:read}),[petRef]),probed=probeRecords&&recordsRead!==null&&recordsRead.pet===petRef?recordsRead.read:null,recordsProbe=probeRecords?/* @__PURE__ */jsx(RecordsProbe,{petRef:petRef,onRead:onRecordsRead},petRef):null,recordsMissing=props.recordsMissing??(recordsReader!==void 0?recordsEmpty===true:probed?.missing===true),[storeNoVet,setStoreNoVet]=useState(()=>healthPlanNoVet(petRef));useEffect(()=>(setStoreNoVet(healthPlanNoVet(petRef)),onHealthPlanNoVet((pet,none)=>{pet===petRef&&setStoreNoVet(none)})),[petRef]);let noVet=props.noVet??storeNoVet,blanksFacts=props.recordsBlanks!==void 0?props.recordsBlanks:probed?.blanks??null,[flashKey,setFlashKey]=useState(null),hostSaid=useRef(false);useEffect(()=>(hostSaid.current=false,onHealthPlanRecordsLanded((pet,source)=>{pet===petRef&&source==="host"&&(hostSaid.current=true)})),[petRef]);let blanksPhase=blanksFacts?.phase??null,blanksId=blanksFacts?.requestId??null,landed=useRef({say:say,line:copy.recordsLanded});landed.current={say:say,line:copy.recordsLanded},useEffect(()=>{if(blanksId===null)return;let live=true;return loadBlanksMemo(kv,petRef).then(()=>{let memo=blanksMemo(petRef);if(blanksPhase==="wait"){memo.waited!==blanksId&&setBlanksMemo(kv,petRef,{...memo,waited:blanksId});return}!live||memo.flashed===blanksId||(setBlanksMemo(kv,petRef,{...memo,flashed:blanksId}),!(memo.waited!==blanksId&&!hostSaid.current)&&(hostSaid.current=false,setFlashKey(blanksId),landed.current.say(landed.current.line),notifyHealthPlanRecordsLanded(petRef,"plan")))}),()=>{live=false}},[blanksPhase,blanksId,petRef,kv]);let placed=orders=>{let first=orders[0];if(first!==void 0){if(!shop){setStarted({kind:"once",order:first});return}setRecent(prev=>[...orders,...prev.filter(o=>!orders.some(x=>x.orderId===o.orderId))]),setSheet(null),setScreens([{kind:"placed",orders:orders}])}},bought=productIds=>{let gone=new Set(productIds.filter(x=>x!==null));gone.size>0&&setCart(prev=>prev.filter(x=>!gone.has(x.productId)))};useCheckoutReturn({enabled:everfur,petRef:petRef,pages:pages,returnUrl:returnUrl,lifecycle:props.lifecycle??null,kv:kv,onPaid:state2=>{let run2=state2.subscription,orders=state2.orders??(state2.order===null?[]:[state2.order]);if(run2!==null)props.onSubscriptionChange&&callHost(props.onSubscriptionChange,run2),setSheet(null),setScreens([]),setStarted({kind:"sub",sub:run2});else if(orders.length>0){for(let o of orders)props.onOneBoxOrder&&callHost(props.onOneBoxOrder,o);placed(orders)}bought([run2?.productId??null,...orders.map(o=>o.productId)]),sub.refresh()},onFailed:()=>{setSheet(null),shop&&(setStarted(null),setScreens([{kind:"cart"}])),say(copy.checkoutFailed)},onCancel:()=>{setRedirecting(false)},onTimeout:()=>{shop&&(setSheet(null),setStarted(null),setScreens([{kind:"orders"}]))},onError:error=>say(error.displayMessage)});let X=S.X,{bx:bx,im:im,tx:tx,tb:tb,ring:ring,inner:inner,ink:ink,side:side,mod:mod,scroll:scroll,swipe:swipe}=S.D,badgeOuter=X.cartCount.rings[0]??X.cartCount.box,badgePlace={position:"absolute",top:badgeOuter.top,right:badgeOuter.right},img=(src,style)=>src?/* @__PURE__ */jsx(Image,{source:{uri:src},style:style,accessibilityIgnoresInvertColors:true}):null,tag=(label,part)=>label===void 0||label===""?null:/* @__PURE__ */jsx(View,{style:bx("tag",part),children:/* @__PURE__ */jsx(Text,{tier:"compact",style:tx("tag",part),children:label})}),sec=1,n=(k,part)=>/* @__PURE__ */jsx(View,{style:bx(part),accessibilityElementsHidden:true,importantForAccessibility:"no-hide-descendants",children:/* @__PURE__ */jsx(Text,{tier:"badge",style:tx(part),children:String(k)})}),secHead=label=>/* @__PURE__ */jsxs(View,{style:bx("secTitle"),children:[n(sec++,"secN"),
|
|
221
228
|
/* @__PURE__ */jsx(Text,{style:[...tx("secTitle"),SHRINK3],accessibilityRole:"header",children:label})]}),toastNode=/* @__PURE__ */jsx(PlanLinger,{motions:[TOAST_MOTION],draw:toast===null?null:([on])=>/* @__PURE__ */jsx(Animated.View,{style:[...bx("toast"),{opacity:on},still||on===void 0?null:{transform:[{translateY:on.interpolate({inputRange:[0,1],outputRange:[-8,0]})}]}],accessibilityLiveRegion:"polite",accessibilityRole:"alert",testID:"health-plan-toast",children:/* @__PURE__ */jsx(Text,{style:tx("toast"),children:toast})})}),f=design.focus,pk=design.pick,waitNode=props.renderWait?callHost(props.renderWait)??null:null,waiting=waitNode!==null||design.wait!==void 0,rows=props.checkoutRows??(props.fromBackend?[]:design.checkoutRows??[]),trust=props.trust??(props.fromBackend?[]:pk.trust??[]),byline=design.byline!==void 0&&(props.fromBackend!==true||props.vetReviewed===true)?design.byline:void 0,vet=byline??null,noPick=pk.none===true,pickHidden=noPick&&pk.hidden===true,curated=design.extras?.items.some(x=>x.productId!==void 0)===true,noRecords=recordsMissing,vetSignTitle=title2=>noVet?copy.callAVet:noRecords?copy.callYourVet:title2,pageW=pageWidth??window.width,padX=name=>Number(X[name].box.paddingLeft??0)+Number(X[name].box.paddingRight??0),tipWidth=swipe("tip",pageW-padX("root")-padX("steps")),reviewWidth=swipe("review",pageW-padX("root")-padX("sec")-padX("pick")),checkupBody=as=>{let c=design.checkup;if(c===void 0)return null;let addLabel=noRecords||noVet?added?copy.savedForCheckup:copy.saveForCheckup:added?c.added:c.add;/* @__PURE__ */
|
|
222
229
|
return jsxs(Fragment$1,{children:[as==="kicker"?/* @__PURE__ */jsx(Text,{style:tb("questionsKicker"),accessibilityRole:"header",children:c.title}):secHead(c.title),
|
|
223
230
|
/* @__PURE__ */jsx(View,{style:bx("questions",as==="kicker"&&"questionsAfterKicker"),children:c.questions.map((q,i)=>/* @__PURE__ */jsxs(View,{children:[
|
|
224
231
|
/* @__PURE__ */jsx(Text,{style:[...tx("questions"),MARKER],accessibilityElementsHidden:true,importantForAccessibility:"no",children:`${i+1}. `}),
|
|
225
|
-
/* @__PURE__ */jsx(Text,{style:tx("questions"),children:q})]},q))}),
|
|
226
|
-
/* @__PURE__ */jsx(Text,{tier:"control",style:tx("add",added&&"addOn"),children:addLabel})]})]})},blanksShown=blanksFacts!==null&&!waiting,blanksCard=null;if(blanksShown){let filled=blanksFacts.phase==="filled",weightKg=blanksFacts.weightKg,marked=pk.dose?.stats.some(x=>x.kind!==void 0)===true,daily=(noPick?void 0:marked?pk.dose?.stats.find(x=>x.kind==="dose"):pk.dose?.stats[0])??(noPick||pk.doseLabel===void 0?void 0:{value:null,label:pk.doseLabel}),blankRows=[{key:"weight",lead:copy.blanksWeight,value:!filled||weightKg===null?null:String(kg?Math.round(weightKg*10)/10:Math.round(weightKg*
|
|
232
|
+
/* @__PURE__ */jsx(Text,{style:tx("questions"),children:q})]},q))}),addLabel===""?null:/* @__PURE__ */jsxs(Pressable,{onPress:()=>{let next=!added;setAdded(next),props.onAddToVisit&&callHost(props.onAddToVisit,next,c.questions)},accessibilityRole:"button",accessibilityState:{selected:added},accessibilityLabel:addLabel,style:pressScale(bx("add",added&&"addOn"),PLAN_PRESS_SCALE.add,false),testID:"health-plan-add-to-visit",children:[inner("add",added&&"addOn"),
|
|
233
|
+
/* @__PURE__ */jsx(Text,{tier:"control",style:tx("add",added&&"addOn"),children:addLabel})]})]})},blanksShown=blanksFacts!==null&&!waiting,blanksCard=null;if(blanksShown){let filled=blanksFacts.phase==="filled",weightKg=blanksFacts.weightKg,marked=pk.dose?.stats.some(x=>x.kind!==void 0)===true,daily=(noPick?void 0:marked?pk.dose?.stats.find(x=>x.kind==="dose"):pk.dose?.stats[0])??(noPick||pk.doseLabel===void 0?void 0:{value:null,label:pk.doseLabel}),blankRows=[{key:"weight",lead:copy.blanksWeight,value:!filled||weightKg===null?null:String(kg?Math.round(weightKg*10)/10:Math.round(weightKg*LB_PER_KG)),trail:` ${kg?copy.weightUnitKg:copy.weightUnit}`,source:copy.blanksWeightSource},...daily===void 0?[]:[{key:"dose",lead:"",value:filled&&weightKnown?daily.value:null,trail:` ${copy.blanksDose(daily.label,item.title)}`,source:copy.blanksDoseSource,width:"s"}],{key:"shots",lead:copy.blanksShots,value:filled&&blanksFacts.nextShotsAt!==null?blanksDay(blanksFacts.nextShotsAt,locale):null,trail:"",source:copy.blanksShotsSource,width:"l"}],count=blankRows.filter(r=>r.value!==null).length;blanksCard=/* @__PURE__ */jsx(HealthPlanBlanks,{phase:blanksFacts.phase,kicker:filled?copy.blanksFilledKicker:blanksFacts.clinicName!==null?copy.blanksAsked(blanksFacts.clinicName):copy.blanksAskedNoClinic,pill:filled?copy.blanksFilled(count,blankRows.length):copy.blanksWaitPill,rows:blankRows,blankLabel:copy.blankEmpty,label:copy.blanksLabel,flashKey:flashKey})}let connectRow=inSec=>(noRecords||noVet)&&props.onConnectRecords&&!blanksShown?shopAskRow(kit,"file",copy.connectRecordsTitle,copy.connectRecordsBody,()=>props.onConnectRecords&&callHost(props.onConnectRecords),"health-plan-connect-records",inSec):null,extraItems=(design.extras?.items??[]).filter(x=>x.owned!==true),extraProduct=x=>x.productId!==void 0&&(shop||everfur||partnerBuys)?itemOf2(x.productId):void 0,extrasShown=extraItems.some(x=>extraProduct(x)!==void 0||props.onExtra!==void 0),pickInCart=shop&&inCart(item.productId)!==void 0,onJump=props.onJump,jump=onJump?()=>{callHost(onJump)}:scrollScope?()=>scrollScope(pickRef.current):void 0,tools=shop?/* @__PURE__ */jsxs(View,{style:bx("tools"),children:[design.eyebrow?/* @__PURE__ */jsx(Text,{style:[...tb("toolsEyebrow"),SHRINK3],children:design.eyebrow}):/* @__PURE__ */jsx(View,{}),
|
|
227
234
|
/* @__PURE__ */jsxs(View,{style:bx("toolsEnd"),children:[
|
|
228
235
|
/* @__PURE__ */jsxs(Pressable,{onPress:()=>push({kind:"orders"}),accessibilityRole:"button",accessibilityLabel:copy.orders,style:bx("orders"),testID:"health-plan-orders-button",children:[icon("box",ink("orders",P.ink),side("ordersIcon",21)),
|
|
229
236
|
/* @__PURE__ */jsx(Text,{tier:"control",style:tx("orders"),children:copy.orders})]}),
|
|
@@ -247,19 +254,19 @@ return jsxs(Fragment$1,{children:[as==="kicker"?/* @__PURE__ */jsx(Text,{style:t
|
|
|
247
254
|
/* @__PURE__ */jsx(Text,{style:tx("oddsFrom"),children:f.odds.from}),icon("arrow",ink("oddsIcon",P.ink3),side("oddsIcon",16)),
|
|
248
255
|
/* @__PURE__ */jsx(Text,{style:tx("oddsTo"),children:f.odds.to})]}),f.odds.toLabel?/* @__PURE__ */jsx(Text,{style:tb("oddsLabel"),children:f.odds.toLabel}):null]})]}):null,f.quote&&vet!==null&&vet.imageUrl?/* @__PURE__ */jsxs(View,{style:bx("says"),testID:"health-plan-quote",children:[img(vet.imageUrl,im("saysImage")),
|
|
249
256
|
/* @__PURE__ */jsxs(Text,{style:[...tb("saysText"),gridCell(X.says,1)],children:[vet.shortName?/* @__PURE__ */jsx(Text,{style:tb("saysBy"),children:vet.shortName}):null,vet.shortName?" ":null,f.quote.text,f.quote.tag?" ":null,tag(f.quote.tag)]})]}):f.quote&&vet!==null?/* @__PURE__ */jsxs(View,{style:[...bx("says"),COLUMN],testID:"health-plan-quote",children:[vet.shortName||f.quote.tag?/* @__PURE__ */jsxs(Text,{style:tx("says"),children:[vet.shortName,vet.shortName&&f.quote.tag?" ":null,tag(f.quote.tag)]}):null,
|
|
250
|
-
/* @__PURE__ */jsx(Text,{style:tb("saysSerif"),children:f.quote.text})]}):null,f.jump&&!noPick?/* @__PURE__ */jsxs(Pressable,{onPress:
|
|
257
|
+
/* @__PURE__ */jsx(Text,{style:tb("saysSerif"),children:f.quote.text})]}):null,f.jump&&!noPick?/* @__PURE__ */jsxs(Pressable,{onPress:jump,disabled:jump===void 0,accessibilityRole:jump?"button":"text",style:pressScale(bx("jump",!item.imageUrl&&"jumpNoImage"),PLAN_PRESS_SCALE.jump,jump===void 0),testID:"health-plan-jump",children:[img(item.imageUrl,im("jumpImage")),
|
|
251
258
|
/* @__PURE__ */jsxs(View,{style:FR,children:[pr.box===null&&!canSubscribe?null:/* @__PURE__ */jsx(Text,{style:tx("jumpSmall"),children:copy.jumpKicker(pr,active)}),
|
|
252
|
-
/* @__PURE__ */jsx(Text,{style:tx("jumpStrong"),children:f.jump.title})]}),
|
|
259
|
+
/* @__PURE__ */jsx(Text,{style:tx("jumpStrong"),children:f.jump.title})]}),jump?/* @__PURE__ */jsx(Text,{style:tx("jumpGo"),children:f.jump.go}):null]}):null]}):null,design.routine&&!waiting?/* @__PURE__ */jsxs(View,{style:bx("steps"),testID:"health-plan-routine",children:[
|
|
253
260
|
/* @__PURE__ */jsxs(View,{style:bx("stepsHead"),children:[
|
|
254
261
|
/* @__PURE__ */jsxs(View,{style:[...bx("stepsTitle"),SHRINK3],children:[n(sec++,"n"),
|
|
255
262
|
/* @__PURE__ */jsx(Text,{style:[...tx("stepsTitle"),SHRINK3],accessibilityRole:"header",children:design.routine.title})]}),design.routine.label?/* @__PURE__ */jsx(Text,{style:tb("stepsLabel"),children:design.routine.label}):null]}),
|
|
256
263
|
/* @__PURE__ */jsx(ScrollView,{horizontal:true,showsHorizontalScrollIndicator:false,style:scroll("tips").place,contentContainerStyle:scroll("tips").content,children:design.routine.steps.map((s,i)=>/* @__PURE__ */jsxs(View,{style:[...bx("tip",mod("tip",s.tone??"y")),{width:tipWidth,flexBasis:"auto"}],children:[
|
|
257
264
|
/* @__PURE__ */jsxs(View,{style:bx("tipTop"),children:[
|
|
258
265
|
/* @__PURE__ */jsx(Text,{style:tx("tipN"),accessibilityElementsHidden:true,importantForAccessibility:"no",children:String(i+1)}),s.icon?icon(s.icon,ink("tipIcon",P.ink),side("tipIcon",26)):null]}),
|
|
259
|
-
/* @__PURE__ */jsx(Text,{style:tb("tipStrong"),children:s.title}),s.body?/* @__PURE__ */jsx(Text,{style:tb("tipSmall"),children:s.body}):null,s.fromVet?vet?.shortName?/* @__PURE__ */jsx(Text,{style:tb("tipEm"),children:copy.fromVet(vet.shortName)}):null:s.source?/* @__PURE__ */jsx(Text,{style:tb("tipEm"),children:s.source}):null]},s.title))})]}):null,waiting||pickHidden?null:noPick?copy.noPick===""?null:/* @__PURE__ */jsx(Text,{style:S.noPick,testID:"health-plan-no-pick",children:copy.noPick}):/* @__PURE__ */jsxs(View,{style:bx("sec"),testID:"health-plan-pick",children:[secHead(pk.title),
|
|
266
|
+
/* @__PURE__ */jsx(Text,{style:tb("tipStrong"),children:s.title}),s.body?/* @__PURE__ */jsx(Text,{style:tb("tipSmall"),children:s.body}):null,s.fromVet?vet?.shortName?/* @__PURE__ */jsx(Text,{style:tb("tipEm"),children:copy.fromVet(vet.shortName)}):null:s.source?/* @__PURE__ */jsx(Text,{style:tb("tipEm"),children:s.source}):null]},s.title))})]}):null,waiting||pickHidden?null:noPick?copy.noPick===""?null:/* @__PURE__ */jsx(Text,{style:S.noPick,testID:"health-plan-no-pick",children:copy.noPick}):/* @__PURE__ */jsxs(View,{ref:pickRef,style:bx("sec"),testID:"health-plan-pick",children:[secHead(pk.title),
|
|
260
267
|
/* @__PURE__ */jsxs(View,{style:bx("pick"),children:[
|
|
261
268
|
/* @__PURE__ */jsxs(View,{style:bx("pickTop"),children:[
|
|
262
|
-
/* @__PURE__ */jsx(View,{style:bx("pickImage"),children:img(item.imageUrl,
|
|
269
|
+
/* @__PURE__ */jsx(View,{style:bx("pickImage"),children:img(item.imageUrl,FILL2)}),
|
|
263
270
|
/* @__PURE__ */jsxs(View,{style:gridCell(X.pickTop,1),children:[
|
|
264
271
|
/* @__PURE__ */jsx(Text,{style:tb("pickTitle"),testID:"health-plan-pick-title",children:item.title}),pk.rating?/* @__PURE__ */jsxs(View,{style:bx("stars"),accessibilityLabel:[pk.rating.value,pk.rating.label].filter(Boolean).join(" "),children:[icon("star",ink("starsIcon",P.star),side("starsIcon",14)),
|
|
265
272
|
/* @__PURE__ */jsx(Text,{style:tx("stars"),children:pk.rating.value}),pk.rating.label?/* @__PURE__ */jsx(Text,{style:tx("starsLabel"),children:pk.rating.label}):null]}):null,pk.line??item.description?/* @__PURE__ */jsx(Text,{style:tb("pickLine"),children:pk.line??item.description}):null]})]}),pk.reviews&&pk.reviews.items.length>0?/* @__PURE__ */jsx(ScrollView,{horizontal:true,showsHorizontalScrollIndicator:false,style:scroll("reviews").place,contentContainerStyle:scroll("reviews").content,accessibilityLabel:pk.reviews.label,testID:"health-plan-reviews",children:pk.reviews.items.map(r=>{let stars=Math.max(1,Math.min(5,Math.round(r.stars)));/* @__PURE__ */
|
|
@@ -288,7 +295,8 @@ return jsxs(View,{style:[...bx("review"),{width:reviewWidth,flexBasis:"auto"}],c
|
|
|
288
295
|
/* @__PURE__ */jsxs(View,{style:[...bx("optText"),FR],children:[
|
|
289
296
|
/* @__PURE__ */jsx(Text,{style:tx("optStrong","optOnceStrong"),children:copy.once}),
|
|
290
297
|
/* @__PURE__ */jsx(Text,{style:tx("optSmall","optOnceSmall"),children:copy.onceLine(pr)})]}),
|
|
291
|
-
/* @__PURE__ */jsx(Text,{style:tx("optPrice","optOncePrice"),children:pr.once})]})]}):null,
|
|
298
|
+
/* @__PURE__ */jsx(Text,{style:tx("optPrice","optOncePrice"),children:pr.once})]})]}):null,
|
|
299
|
+
/* @__PURE__ */jsx(View,{style:bx("buy"),children:shop?shopButton(kit,pickInCart?copy.viewCart:priced?copy.addToCart((buyMode==="sub"?pr.first:pr.once)??""):HEALTH_PLAN_COPY.addToCart,()=>addToCart(item,buyMode),{disabled:sub.phase==="loading"&&props.subscriptions!==false||!priced&&!pickInCart,testID:"health-plan-buy"}):shopButton(kit,buyMode==="sub"?copy.subscribe:priced?copy.buyOnce(pr):copy.buyOnceOption,press,{disabled:sub.phase==="loading"&&props.subscriptions!==false||redirecting||everfur&&!priced||!everfur&&!canSubscribe&&!partnerBuys,testID:"health-plan-buy"})}),pk.proof&&!active?/* @__PURE__ */jsxs(View,{style:bx("proof"),children:[
|
|
292
300
|
/* @__PURE__ */jsx(View,{style:bx("proofIcon"),children:icon("flame",ink("proof",P.riskInk),side("proofIcon",21))}),
|
|
293
301
|
/* @__PURE__ */jsx(Text,{style:[...tx("proof"),SHRINK3],children:pk.proof})]}):null,trust.length>0?/* @__PURE__ */jsx(View,{style:bx("trust"),testID:"health-plan-trust",children:trust.map((t,i)=>/* @__PURE__ */jsxs(View,{style:[...bx("trustItem"),gridCell(X.trust,i)],children:[icon(t.icon,ink("trustIcon",P.teal),side("trustIcon",20)),
|
|
294
302
|
/* @__PURE__ */jsx(Text,{style:tx("trustItem"),children:t.label})]},t.label))}):null,active&&subscription!==null?/* @__PURE__ */jsxs(View,{style:bx("on"),testID:"health-plan-subscribed",children:[
|
|
@@ -297,12 +305,13 @@ return jsxs(View,{style:[...bx("review"),{width:reviewWidth,flexBasis:"auto"}],c
|
|
|
297
305
|
/* @__PURE__ */jsx(Text,{style:tb("onStrong"),children:copy.subscribed}),
|
|
298
306
|
/* @__PURE__ */jsx(Text,{style:tb("onSmall"),children:copy.subscribedLine(pr,nextBoxDay(subscription))})]}),
|
|
299
307
|
/* @__PURE__ */jsxs(Pressable,{onPress:()=>setSheet({kind:"manage"}),accessibilityRole:"button",accessibilityLabel:copy.manage,style:pressScale([...bx("onButton"),CENTER2],PLAN_PRESS_SCALE.onButton,false),testID:"health-plan-manage",children:[inner("onButton"),
|
|
300
|
-
/* @__PURE__ */jsx(Text,{tier:"control",style:tx("onButton"),children:copy.manage})]})]}):null,pk.more&&props.onMore?/* @__PURE__ */jsx(View,{style:bx("more"),children:/* @__PURE__ */jsx(Pressable,{onPress:()=>props.onMore&&callHost(props.onMore,item),accessibilityRole:"link",accessibilityLabel:pk.more,style:[...bx("moreButton"),CENTER2],children:/* @__PURE__ */jsx(Text,{tier:"control",style:tx("moreButton"),children:pk.more})})}):null,pk.fine?/* @__PURE__ */jsx(Text,{style:tb("fine"),children:pk.fine}):null]})]}),others.length>0&&!waiting&&!noPick&&!curated?/* @__PURE__ */jsx(View,{style:bx("others"),testID:"health-plan-others",children:others.map(o=>{let once=fmt(o.price,o.currency),op={petName:petName,productName:o.title,first:once,box:once,once:once,onceDiscountPercent:0,intervalDays:0,discountPercent:0,offer:false}
|
|
308
|
+
/* @__PURE__ */jsx(Text,{tier:"control",style:tx("onButton"),children:copy.manage})]})]}):null,pk.more&&props.onMore?/* @__PURE__ */jsx(View,{style:bx("more"),children:/* @__PURE__ */jsx(Pressable,{onPress:()=>props.onMore&&callHost(props.onMore,item),accessibilityRole:"link",accessibilityLabel:pk.more,style:[...bx("moreButton"),CENTER2],children:/* @__PURE__ */jsx(Text,{tier:"control",style:tx("moreButton"),children:pk.more})})}):null,pk.fine?/* @__PURE__ */jsx(Text,{style:tb("fine"),children:pk.fine}):null]})]}),others.length>0&&!waiting&&!noPick&&!curated?/* @__PURE__ */jsx(View,{style:bx("others"),testID:"health-plan-others",children:others.map(o=>{let once=fmt(o.price,o.currency),op={petName:petName,productName:o.title,first:once,box:once,once:once,onceDiscountPercent:0,intervalDays:0,discountPercent:0,offer:false};/* @__PURE__ */
|
|
301
309
|
return jsxs(View,{style:bx("pick"),testID:`health-plan-other-${o.productId}`,children:[
|
|
302
310
|
/* @__PURE__ */jsxs(View,{style:bx("pickTop"),children:[
|
|
303
|
-
/* @__PURE__ */jsx(View,{style:bx("pickImage"),children:img(o.imageUrl,
|
|
311
|
+
/* @__PURE__ */jsx(View,{style:bx("pickImage"),children:img(o.imageUrl,FILL2)}),
|
|
304
312
|
/* @__PURE__ */jsxs(View,{style:gridCell(X.pickTop,1),children:[props.showCategory===true&&o.category!==null?/* @__PURE__ */jsx(Text,{style:S.mini,children:o.category}):null,
|
|
305
|
-
/* @__PURE__ */jsx(Text,{style:tb("pickTitle"),children:o.title}),o.sample?/* @__PURE__ */jsx(View,{style:START,children:tag(HEALTH_PLAN_COPY.sample)}):null,o.description?/* @__PURE__ */jsx(Text,{style:tb("pickLine"),children:o.description}):null]})]}),
|
|
313
|
+
/* @__PURE__ */jsx(Text,{style:tb("pickTitle"),children:o.title}),o.sample?/* @__PURE__ */jsx(View,{style:START,children:tag(HEALTH_PLAN_COPY.sample)}):null,o.description?/* @__PURE__ */jsx(Text,{style:tb("pickLine"),children:o.description}):null]})]}),
|
|
314
|
+
/* @__PURE__ */jsx(View,{style:bx("buy"),children:shop?shopButton(kit,inCart(o.productId)?copy.viewCart:once===null?HEALTH_PLAN_COPY.addToCart:copy.addToCart(once),()=>addToCart(o,"once"),{disabled:once===null,testID:`health-plan-other-buy-${o.productId}`}):shopButton(kit,once===null?copy.buyOnceOption:copy.buyOnce(op),()=>pressOther(o),{disabled:redirecting||everfur&&once===null||!everfur&&!partnerBuys,testID:`health-plan-other-buy-${o.productId}`})})]},o.productId)})}):null,waiting?null:design.signs?/* @__PURE__ */jsxs(View,{style:bx("sec"),testID:"health-plan-signs",children:[secHead(design.signs.title),design.signs.items.map(s=>/* @__PURE__ */jsxs(View,{style:bx("sign",s.urgent===true&&"signUrgent"),children:[inner("sign",s.urgent===true&&"signUrgent"),
|
|
306
315
|
/* @__PURE__ */jsxs(View,{style:bx("signTitle"),children:[s.urgent?icon("alert",ink("signUrgentTitle",P.riskInk),side("signUrgentIcon",20)):null,
|
|
307
316
|
/* @__PURE__ */jsx(Text,{style:[...tx("signTitle",s.urgent===true&&"signUrgentTitle"),SHRINK3],children:s.callVet===true&&s.urgent!==true?vetSignTitle(s.title):s.title})]}),
|
|
308
317
|
/* @__PURE__ */jsx(Text,{style:tb("signBody",s.urgent===true&&"signUrgentBody"),children:s.body})]},s.title)),checkupBody("kicker"),connectRow(true)]}):design.checkup?/* @__PURE__ */jsxs(View,{style:bx("sec"),testID:"health-plan-checkup",children:[checkupBody("section"),connectRow(true)]}):connectRow(false),design.extras&&extrasShown?/* @__PURE__ */jsxs(View,{style:bx("extras"),testID:"health-plan-extras",children:[
|
|
@@ -312,31 +321,30 @@ return jsxs(View,{style:bx("extra",kind),children:[x.imageUrl?img(x.imageUrl,im(
|
|
|
312
321
|
/* @__PURE__ */jsxs(View,{style:{minHeight:x.imageUrl||x.icon?Number(X.extraImage.box.height??0):0},children:[
|
|
313
322
|
/* @__PURE__ */jsx(Text,{style:tb("extraTitle",x.kind==="kit"&&"extraTitleSerif"),children:x.title}),x.body?/* @__PURE__ */jsx(Text,{style:tb("extraBody"),children:x.body}):null,price?/* @__PURE__ */jsxs(View,{style:bx("extraPrice"),children:[
|
|
314
323
|
/* @__PURE__ */jsx(Text,{style:tx("extraPriceValue"),children:price}),x.was?/* @__PURE__ */jsx(Text,{style:tx("extraPriceWas"),children:x.was}):null,tag(x.tag)]}):null]}),
|
|
315
|
-
/* @__PURE__ */jsx(Pressable,{onPress:()=>{if(product!==void 0){shop?addToCart(product,"once"):pressOther(product);return}let next=!on;setExtras(prev=>{let out=new Set(prev);return next?out.add(x.key):out.delete(x.key),out}),props.onExtra&&callHost(props.onExtra,x.key,next)},accessibilityRole:"button",accessibilityState:{selected:on},accessibilityLabel:label,style:pressScale([...bx("extraGo",on&&"extraGoOn"),{marginTop:Number(X.extraGo.box.marginTop??0)+Number(X.extra.box.rowGap??0)},START,CENTER2],PLAN_PRESS_SCALE.extraGo,false),children:/* @__PURE__ */jsx(Text,{tier:"control",style:tx("extraGo",on&&"extraGoOn"),children:label})})]})]},x.key)})]}):null,design.fine?/* @__PURE__ */jsx(Text,{style:tb("pageFine"),children:design.fine}):null]});function press(){if(trackCheckoutStarted(telemetry,petRef,{count:1,subtotal:item.price,currency:item.price===null?null:item.currency}),!canSubscribe){everfur?redirect("one_box",null):buyOnce();return}tapKey.current=null,setSheet({kind:"checkout",mode:buyMode,every:quote.defaultIntervalDays})}function pressOther(target){trackCheckoutStarted(telemetry,petRef,{count:1,subtotal:target.price,currency:target.price===null?null:target.currency}),everfur?redirect("one_box",null,target):buyOnce(target)}let close=()=>setSheet(null),productBlock=line=>/* @__PURE__ */jsxs(View,{style:
|
|
316
|
-
/* @__PURE__ */
|
|
317
|
-
/* @__PURE__ */
|
|
324
|
+
/* @__PURE__ */jsx(Pressable,{onPress:()=>{if(product!==void 0){shop?addToCart(product,"once"):pressOther(product);return}let next=!on;setExtras(prev=>{let out=new Set(prev);return next?out.add(x.key):out.delete(x.key),out}),props.onExtra&&callHost(props.onExtra,x.key,next)},accessibilityRole:"button",accessibilityState:{selected:on},accessibilityLabel:label,style:pressScale([...bx("extraGo",on&&"extraGoOn"),{marginTop:Number(X.extraGo.box.marginTop??0)+Number(X.extra.box.rowGap??0)},START,CENTER2],PLAN_PRESS_SCALE.extraGo,false),children:/* @__PURE__ */jsx(Text,{tier:"control",style:tx("extraGo",on&&"extraGoOn"),children:label})})]})]},x.key)})]}):null,design.fine?/* @__PURE__ */jsx(Text,{style:tb("pageFine"),children:design.fine}):null]});function press(){if(trackCheckoutStarted(telemetry,petRef,{count:1,subtotal:item.price,currency:item.price===null?null:item.currency}),!canSubscribe){everfur?redirect("one_box",null):buyOnce();return}tapKey.current=null,setSheet({kind:"checkout",mode:buyMode,every:quote.defaultIntervalDays})}function pressOther(target){trackCheckoutStarted(telemetry,petRef,{count:1,subtotal:target.price,currency:target.price===null?null:target.currency}),everfur?redirect("one_box",null,target):buyOnce(target)}let close=()=>setSheet(null),productBlock=line=>/* @__PURE__ */jsxs(View,{style:bx("coProduct"),children:[
|
|
325
|
+
/* @__PURE__ */jsx(View,{style:[...bx("coProductImage"),gridCell(S.X.coProduct,0)],children:item.imageUrl?img(item.imageUrl,FILL2):null}),
|
|
326
|
+
/* @__PURE__ */jsxs(View,{style:gridCell(S.X.coProduct,1),children:[
|
|
327
|
+
/* @__PURE__ */jsx(Text,{style:tb("coProductTitle"),children:item.title}),line===""?null:/* @__PURE__ */jsx(Text,{style:tb("coProductLine"),children:line})]})]}),intervals=(selected,pick2)=>/* @__PURE__ */jsxs(View,{style:bx("every"),accessibilityRole:"radiogroup",accessibilityLabel:copy.shipsEvery,children:[inner("every"),(quote?.intervalOptions??subscription?.intervalOptions??[]).map((d,i)=>/* @__PURE__ */jsx(Pressable,{onPress:sub.busy?void 0:()=>pick2(d),disabled:sub.busy,accessibilityRole:"radio",accessibilityState:{checked:selected===d,disabled:sub.busy},accessibilityLabel:copy.days(d),style:[...bx("everyButton",selected===d&&"everyButtonOn"),gridCell(S.X.every,i),{justifyContent:"center"}],testID:`health-plan-every-${d}`,children:/* @__PURE__ */jsx(Text,{style:tx("everyButton",selected===d&&"everyButtonOn"),children:copy.days(d)})},d))]}),coOption=o=>{let X2=S.X,first=X2.coOptionHit.grid[0],coIndent=(typeof first=="number"?first:0)+(typeof X2.coOptionHit.box.columnGap=="number"?X2.coOptionHit.box.columnGap:0);/* @__PURE__ */
|
|
328
|
+
return jsxs(View,{style:bx("coOption",o.on&&"coOptionOn"),children:[inner("coOption",o.on&&"coOptionOn"),
|
|
329
|
+
/* @__PURE__ */jsxs(Pressable,{onPress:o.onPress,accessibilityRole:"radio",accessibilityState:{checked:o.on},accessibilityLabel:o.label,style:[...bx("coOptionHit"),{flexWrap:"wrap"}],testID:o.testID,children:[
|
|
330
|
+
/* @__PURE__ */jsx(View,{style:[...bx("coRadio"),gridCell(X2.coOptionHit,0)],children:inner("coRadio",o.on&&"coRadioOn")}),
|
|
331
|
+
/* @__PURE__ */jsx(Text,{style:[...tx("coOptionStrong"),gridCell(X2.coOptionHit,1)],children:o.label}),
|
|
332
|
+
/* @__PURE__ */jsxs(View,{style:gridCell(X2.coOptionHit,2),children:[
|
|
333
|
+
/* @__PURE__ */jsx(Text,{style:tx("coOptionPrice"),children:o.price??""}),o.was===null?null:/* @__PURE__ */jsx(Text,{style:tx("coOptionPriceWas"),children:o.was})]}),o.line===null?null:/* @__PURE__ */jsx(Text,{style:[...tx("coOptionSmall"),{width:"100%",paddingLeft:coIndent}],children:o.line})]}),o.after]})},sheetBody=null,kicker="";if(sheet?.kind==="checkout"&"e!==null){kicker=copy.checkoutKicker;let isSub=sheet.mode==="sub",cp=prices(sheet.every),today=isSub?cp.first:cp.once,coFine=[isSub?copy.renews(cp):copy.onceFine,copy.checkoutNote].filter(x=>x!=="").join(" ");sheetBody=/* @__PURE__ */jsxs(View,{style:bx("co"),testID:"health-plan-checkout-sheet",children:[
|
|
318
334
|
/* @__PURE__ */jsx(Text,{style:S.h3,accessibilityRole:"header",children:copy.checkoutTitle(cp)}),productBlock(pk.checkoutLine??pk.line??item.description??""),
|
|
319
|
-
/* @__PURE__ */jsxs(View,{style:
|
|
320
|
-
/* @__PURE__ */
|
|
321
|
-
/* @__PURE__ */jsxs(View,{style:[S.row,{justifyContent:"space-between",alignSelf:"stretch"}],children:[
|
|
322
|
-
/* @__PURE__ */jsx(Text,{style:S.h4,children:copy.subscribe}),
|
|
323
|
-
/* @__PURE__ */jsxs(View,{style:S.row,children:[
|
|
324
|
-
/* @__PURE__ */jsx(Text,{style:S.priceText,children:cp.first}),offer?/* @__PURE__ */jsx(Text,{style:S.strike,children:cp.box}):null]})]}),offer?/* @__PURE__ */jsx(Text,{style:S.small,children:copy.checkoutOffer(cp)}):null]}),isSub?/* @__PURE__ */jsxs(View,{children:[
|
|
325
|
-
/* @__PURE__ */jsx(Text,{style:S.mini,children:copy.shipsEvery}),intervals(sheet.every,d=>setSheet({...sheet,every:d}))]}):null,
|
|
326
|
-
/* @__PURE__ */jsxs(Pressable,{onPress:()=>setSheet({...sheet,mode:"once"}),accessibilityRole:"radio",accessibilityState:{checked:!isSub},accessibilityLabel:copy.buyOnceOption,style:[S.opt,{flexDirection:"column"},isSub?null:S.optOn],children:[
|
|
327
|
-
/* @__PURE__ */jsxs(View,{style:[S.row,{justifyContent:"space-between",alignSelf:"stretch"}],children:[
|
|
328
|
-
/* @__PURE__ */jsx(Text,{style:S.h4,children:copy.buyOnceOption}),
|
|
329
|
-
/* @__PURE__ */jsxs(View,{style:S.row,children:[
|
|
330
|
-
/* @__PURE__ */jsx(Text,{style:S.priceText,children:cp.once}),cp.onceDiscountPercent>0?/* @__PURE__ */jsx(Text,{style:S.strike,children:cp.box}):null]})]}),oneBox!==null?/* @__PURE__ */jsx(Text,{style:S.small,children:copy.onceOffer(cp)}):null]})]}),shopRows(kit,rows),shopButton(kit,copy.checkoutGo(cp,isSub,today??""),()=>{(async()=>{if(everfur){await redirect(isSub?"subscription":"one_box",isSub?sheet.every:null);return}if(!isSub){if(oneBox===null){close(),buyOnce();return}tapKey.current===null&&(tapKey.current=mintTapKey());let res=await sub.buyOneBox(tapKey.current);if(!res.ok){say(res.error.displayMessage);return}tapKey.current=null,props.onOneBoxOrder&&callHost(props.onOneBoxOrder,res.value),setSheet(null),placed([res.value]);return}let s=settle(await sub.subscribe(sheet.every));s!==null&&(setSheet(null),setStarted({kind:"sub",sub:s}))})()},{disabled:sub.busy||redirecting,testID:"health-plan-checkout-go"}),coFine===""?null:/* @__PURE__ */jsx(Text,{style:S.fine,children:coFine})]})}else if(sheet?.kind==="manage"&&subscription!==null&&active){kicker=copy.manageKicker;let mp=prices(subscription.intervalDays);sheetBody=/* @__PURE__ */jsxs(View,{style:{gap:12},testID:"health-plan-manage-sheet",children:[
|
|
335
|
+
/* @__PURE__ */jsxs(View,{style:bx("coOptions"),accessibilityRole:"radiogroup",accessibilityLabel:copy.optionsLabel,children:[coOption({on:isSub,label:copy.subscribe,price:cp.first,was:offer?cp.box:null,line:offer?copy.checkoutOffer(cp):null,onPress:()=>setSheet({...sheet,mode:"sub"}),testID:"health-plan-co-sub",after:isSub?/* @__PURE__ */jsxs(View,{style:bx("coWhen"),children:[
|
|
336
|
+
/* @__PURE__ */jsx(Text,{style:tb("coKicker"),children:copy.shipsEvery}),intervals(sheet.every,d=>setSheet({...sheet,every:d}))]}):null}),coOption({on:!isSub,label:copy.buyOnceOption,price:cp.once,was:cp.onceDiscountPercent>0?cp.box:null,line:oneBox!==null?copy.onceOffer(cp):null,onPress:()=>setSheet({...sheet,mode:"once"}),testID:"health-plan-co-once"})]}),shopRows(kit,rows),shopButton(kit,copy.checkoutGo(cp,isSub,today??""),()=>{(async()=>{if(everfur){await redirect(isSub?"subscription":"one_box",isSub?sheet.every:null);return}if(!isSub){if(oneBox===null){close(),buyOnce();return}tapKey.current===null&&(tapKey.current=mintTapKey());let res=await sub.buyOneBox(tapKey.current);if(!res.ok){say(res.error.displayMessage);return}tapKey.current=null,props.onOneBoxOrder&&callHost(props.onOneBoxOrder,res.value),setSheet(null),placed([res.value]);return}let s=settle(await sub.subscribe(sheet.every));s!==null&&(setSheet(null),setStarted({kind:"sub",sub:s}))})()},{disabled:sub.busy||redirecting,testID:"health-plan-checkout-go"}),coFine===""?null:/* @__PURE__ */jsx(Text,{style:tb("coFine"),children:coFine})]})}else if(sheet?.kind==="manage"&&subscription!==null&&active){kicker=copy.manageKicker;let mp=prices(subscription.intervalDays);sheetBody=/* @__PURE__ */jsxs(View,{style:bx("co"),testID:"health-plan-manage-sheet",children:[
|
|
331
337
|
/* @__PURE__ */jsx(Text,{style:S.h3,accessibilityRole:"header",children:copy.manageTitle(mp)}),productBlock(copy.subscribedLine(mp,nextBoxDay(subscription))),
|
|
332
338
|
/* @__PURE__ */jsxs(View,{children:[
|
|
333
|
-
/* @__PURE__ */jsx(Text,{style:
|
|
339
|
+
/* @__PURE__ */jsx(Text,{style:tb("coKicker"),children:copy.shipsEvery}),intervals(subscription.intervalDays,d=>{d!==subscription.intervalDays&&sub.changeInterval(d).then(settle)})]}),shopButton(kit,copy.skip,()=>{sub.skip().then(res=>{let s=settle(res);s!==null&&say(copy.skipped(prices(s.intervalDays),nextBoxDay(s)))})},{ghost:true,disabled:sub.busy,testID:"health-plan-skip"}),shopLink(kit,copy.cancel,()=>{sub.cancel().then(res=>{settle(res)!==null&&(setSheet(null),setMode("sub"),say(copy.cancelled(mp)))})},"health-plan-cancel"),shop?shopLink(kit,copy.seeOrders,()=>{setSheet(null),top?.kind!=="orders"&&push({kind:"orders"})},"health-plan-manage-orders"):null]})}else if(sheet?.kind==="cartCheckout"&&batch.length>0){kicker=copy.checkoutKicker;let total=fmt(batchTotal,currency)??"";sheetBody=shopCartCheckout(kit,batch.map(lineView),x=>{let line=lines.find(l=>l.productId===x.key),unit=line===void 0?null:unitOf(line);return unit===null||line===void 0?null:fmt(Math.round(unit*line.qty*100)/100,isPick(line.productId)?currency:itemOf2(line.productId)?.currency??currency)},rows,total,batchRenew,{label:copy.placeOrder(total,batchSub!==null),disabled:!cartReady||sub.busy||redirecting,onPress:()=>{placeCart()}},[copy.cartFine(batchRenew),apart?copy.cartSubscriptionApart:"",copy.checkoutNote].filter(x=>x!=="").join(" "))}else sheet?.kind==="weight"&&(kicker=copy.weightKicker,sheetBody=/* @__PURE__ */jsxs(View,{style:{gap:12},testID:"health-plan-weight-sheet",children:[
|
|
334
340
|
/* @__PURE__ */jsx(Text,{style:S.h3,accessibilityRole:"header",children:copy.weightTitle(pr)}),
|
|
335
|
-
/* @__PURE__ */jsx(Text,{style:
|
|
336
|
-
/* @__PURE__ */
|
|
337
|
-
/* @__PURE__ */
|
|
338
|
-
/* @__PURE__ */
|
|
339
|
-
/* @__PURE__ */jsx(
|
|
341
|
+
/* @__PURE__ */jsx(Text,{style:tb("sheetBody"),children:copy.weightBody}),
|
|
342
|
+
/* @__PURE__ */jsxs(View,{style:bx("weightField"),children:[
|
|
343
|
+
/* @__PURE__ */jsx(Text,{style:tx("weightField"),children:copy.weightField}),
|
|
344
|
+
/* @__PURE__ */jsxs(View,{style:bx("weightInputWrap"),children:[
|
|
345
|
+
/* @__PURE__ */jsx(TextInput,{value:weightInput,onChangeText:setWeightInput,keyboardType:"decimal-pad",placeholder:"0.0",accessibilityLabel:copy.weightField,onSubmitEditing:()=>{saveWeight()},onFocus:()=>setWeightFocused(true),onBlur:()=>setWeightFocused(false),style:[...bx("weightInput"),...tx("weightInput")],testID:"health-plan-weight-input"}),inner("weightInput",weightFocused&&"weightInputFocus"),
|
|
346
|
+
/* @__PURE__ */jsx(View,{pointerEvents:"none",style:[...bx("weightUnit"),{top:0,bottom:0,justifyContent:"center"}],children:/* @__PURE__ */jsx(Text,{style:tx("weightUnit"),children:kg?copy.weightUnitKg:copy.weightUnit})})]})]}),weightError===""?null:/* @__PURE__ */jsx(Text,{style:tb("weightError"),accessibilityLiveRegion:"polite",testID:"health-plan-weight-error",children:weightError}),
|
|
347
|
+
/* @__PURE__ */jsx(View,{style:bx("weightActions"),children:shopButton(kit,copy.weightSave,()=>{saveWeight()},{disabled:savingWeight,testID:"health-plan-weight-save"})})]}));let sheetNode=/* @__PURE__ */jsx(PlanLinger,{motions:[SCRIM_MOTION,still?FADE_MOTION:SHEET_MOTION],draw:sheetBody===null?null:([scrimOn,sheetOn])=>/* @__PURE__ */jsx(Modal,{visible:true,transparent:true,animationType:"none",onRequestClose:close,testID:"health-plan-sheet",children:/* @__PURE__ */jsx(KeyboardAvoidingView,{behavior:Platform.OS==="ios"?"padding":void 0,style:{flex:1},testID:"health-plan-sheet-keyboard",children:/* @__PURE__ */jsxs(View,{style:[S.scrim,{backgroundColor:"transparent"}],children:[
|
|
340
348
|
/* @__PURE__ */jsx(Animated.View,{pointerEvents:"none",style:{position:"absolute",top:0,left:0,right:0,bottom:0,backgroundColor:P.scrim,opacity:scrimOn}}),
|
|
341
349
|
/* @__PURE__ */jsx(Pressable,{style:{flex:1},onPress:close,accessibilityRole:"button",accessibilityLabel:copy.close}),
|
|
342
350
|
/* @__PURE__ */jsxs(Animated.View,{style:[S.sheet,still||sheetOn===void 0?{opacity:sheetOn}:{transform:[{translateY:sheetOn.interpolate({inputRange:[0,1],outputRange:[window.height,0]})}]}],accessibilityViewIsModal:true,children:[
|
|
@@ -344,47 +352,42 @@ return jsxs(View,{style:bx("extra",kind),children:[x.imageUrl?img(x.imageUrl,im(
|
|
|
344
352
|
/* @__PURE__ */jsxs(View,{style:S.sheetTop,children:[
|
|
345
353
|
/* @__PURE__ */jsx(Text,{style:S.mini,children:kicker}),
|
|
346
354
|
/* @__PURE__ */jsx(Pressable,{onPress:close,accessibilityRole:"button",accessibilityLabel:copy.close,style:S.close,testID:"health-plan-sheet-close",children:icon("x")})]}),
|
|
347
|
-
/* @__PURE__ */jsx(ScrollView,{keyboardShouldPersistTaps:"handled",children:sheetBody})]})]})})}),backRow=onOverlayChange===void 0?/* @__PURE__ */jsxs(Pressable,{onPress:back,accessibilityRole:"button",accessibilityLabel:copy.back,style:S.back,testID:"health-plan-back",children:[
|
|
355
|
+
/* @__PURE__ */jsx(ScrollView,{keyboardShouldPersistTaps:"handled",children:sheetBody})]})]})})})}),backRow=onOverlayChange===void 0?/* @__PURE__ */jsxs(Pressable,{onPress:back,accessibilityRole:"button",accessibilityLabel:copy.back,style:S.back,testID:"health-plan-back",children:[
|
|
348
356
|
/* @__PURE__ */jsx(View,{style:{transform:[{scaleX:-1}]},children:icon("chev")}),
|
|
349
|
-
/* @__PURE__ */jsx(Text,{tier:"control",style:S.toolLabel,children:copy.back})]}):null,
|
|
350
|
-
/* @__PURE__ */
|
|
351
|
-
/* @__PURE__ */jsx(View,{style:
|
|
352
|
-
/* @__PURE__ */
|
|
353
|
-
/* @__PURE__ */jsx(
|
|
354
|
-
/* @__PURE__ */jsx(
|
|
355
|
-
/* @__PURE__ */jsxs(View,{style:
|
|
356
|
-
/* @__PURE__ */jsx(Text,{style:
|
|
357
|
-
/* @__PURE__ */jsx(
|
|
358
|
-
/* @__PURE__ */jsx(
|
|
359
|
-
/* @__PURE__ */
|
|
360
|
-
/* @__PURE__ */
|
|
361
|
-
return jsxs(View,{style:S.nextRow,children:[
|
|
362
|
-
/* @__PURE__ */jsx(View,{style:S.nextIcon,children:icon("box")}),
|
|
363
|
-
/* @__PURE__ */jsxs(View,{style:[S.shrink,{flex:1}],children:[
|
|
364
|
-
/* @__PURE__ */jsx(Text,{style:S.small,children:copy.cartItemQuantity(o.quantity??1)}),
|
|
365
|
-
/* @__PURE__ */jsx(Text,{style:S.smallInk,children:o.title??it?.title??""})]})]},o.orderId)}),
|
|
366
|
-
/* @__PURE__ */jsxs(View,{style:S.nextRow,children:[
|
|
367
|
-
/* @__PURE__ */jsx(View,{style:S.nextIcon,children:icon("truck")}),
|
|
368
|
-
/* @__PURE__ */jsxs(View,{style:[S.shrink,{flex:1}],children:[
|
|
369
|
-
/* @__PURE__ */jsx(Text,{style:S.small,children:copy.tomorrow}),
|
|
370
|
-
/* @__PURE__ */jsx(Text,{style:S.smallInk,children:copy.placedShips})]})]}),arrivesDay===null?null:/* @__PURE__ */jsxs(View,{style:S.nextRow,children:[
|
|
371
|
-
/* @__PURE__ */jsx(View,{style:S.nextIcon,children:icon("calendar")}),
|
|
372
|
-
/* @__PURE__ */jsxs(View,{style:[S.shrink,{flex:1}],children:[
|
|
373
|
-
/* @__PURE__ */jsx(Text,{style:S.small,children:arrivesDay}),
|
|
374
|
-
/* @__PURE__ */jsx(Text,{style:S.smallInk,children:copy.placedArrives})]})]})]}),placedOrders.length>1&&placedTotal!==null?/* @__PURE__ */jsx(View,{style:{alignSelf:"stretch"},children:shopSummary(kit,placedTotal)}):null,copy.startedNote?/* @__PURE__ */jsx(Text,{style:S.fine,children:copy.startedNote}):null]}),foot=/* @__PURE__ */jsxs(Fragment$1,{children:[shopButton(kit,placedOrders.length===1?copy.viewOrder:copy.seeOrders,()=>setScreens(placedOrders.length===1&&first!==void 0?[{kind:"order",key:first.orderId}]:[{kind:"orders"}]),{testID:"health-plan-placed-view"}),shopButton(kit,copy.startedDone,closeOverlays,{ghost:true})]})}let notice=top.kind==="cart"&&cartNotice!==null&&cartNotice!==""?/* @__PURE__ */jsx(View,{style:S.notice,accessibilityLiveRegion:"polite",testID:"health-plan-cart-notice",children:/* @__PURE__ */jsx(Text,{style:S.noticeText,children:cartNotice})}):null,heading=onOverlayChange===void 0&&title!==void 0?/* @__PURE__ */jsx(Text,{style:S.h3,accessibilityRole:"header",children:title}):null;screenNode=/* @__PURE__ */jsxs(View,{testID:`health-plan-screen-${top.kind}`,children:[backRow===null&&heading===null&&toast===null&¬ice===null?null:/* @__PURE__ */jsxs(View,{style:S.screen,children:[backRow,heading,toastNode,notice]}),
|
|
375
|
-
/* @__PURE__ */jsx(View,{testID:"health-plan-screen-body",children:top.kind==="placed"?/* @__PURE__ */jsx(View,{style:bx("shop"),children:body}):body}),foot===null?null:/* @__PURE__ */jsx(View,{style:S.screen,children:foot})]})}/* @__PURE__ */
|
|
357
|
+
/* @__PURE__ */jsx(Text,{tier:"control",style:S.toolLabel,children:copy.back})]}):null,pushedFrame=(testID,head,body,foot,footPart=null)=>{let footNode=foot===null?null:/* @__PURE__ */jsx(View,{style:[...bx("pushFoot",footPart),{paddingBottom:Math.max(PUSH_FOOT_MIN_BOTTOM,pane?.under??0)}],testID:"health-plan-push-foot",children:foot}),content=/* @__PURE__ */jsxs(Fragment$1,{children:[head===null?null:/* @__PURE__ */jsx(View,{style:S.screen,children:head}),body]});return pane===null?/* @__PURE__ */jsxs(View,{ref:pushedRef,testID:testID,collapsable:false,children:[content,footNode]}):/* @__PURE__ */jsxs(View,{ref:pushedRef,testID:testID,style:{height:pane.height},collapsable:false,children:[
|
|
358
|
+
/* @__PURE__ */jsx(ScrollView,{style:{flex:1},keyboardShouldPersistTaps:"handled",testID:"health-plan-push-scroll",children:content}),footNode]})},screenNode=null,nextIcon=name=>icon(name,ink("nextIcon",X.roles.link??""),side("nextIconSvg",19)),doneCheck=/* @__PURE__ */jsx(View,{style:bx("doneCheck"),children:icon("check",ink("doneCheck",P.ink),side("doneCheckSvg",38))}),nextRow=(key,tile2,when,what,photo=false)=>/* @__PURE__ */jsxs(View,{style:bx("nextRow"),children:[
|
|
359
|
+
/* @__PURE__ */jsx(View,{style:[...bx("nextIcon"),gridCell(X.nextRow,0),photo?{overflow:"hidden"}:null],children:tile2}),
|
|
360
|
+
/* @__PURE__ */jsxs(View,{style:gridCell(X.nextRow,1),children:[
|
|
361
|
+
/* @__PURE__ */jsx(Text,{style:tx("nextLabel"),children:when}),
|
|
362
|
+
/* @__PURE__ */jsx(Text,{style:tb("nextText"),children:what})]})]},key);if(started!==null){let run2=started.kind==="sub"?started.sub:null,boughtId=started.kind==="sub"?started.sub.productId:started.order.productId,boughtItem=planItems.find(x=>x.productId===boughtId)??item,sp=prices(run2?.intervalDays??every,boughtItem.title),label=(step,first)=>step.step==="first_box_ships"&&first?copy.tomorrow:day(step.on)??step.on,steps=run2===null?[{icon:"truck",when:copy.tomorrow,what:copy.firstBoxShips}]:run2.timeline.map((step,i)=>{switch(step.step){case"first_box_ships":return{icon:"truck",when:label(step,i===0),what:copy.firstBoxShips};case"checkin":return{icon:"chat",when:label(step,false),what:copy.checkin(pk.checkin??null)};case"refill_reminder":return{icon:"repeat",when:label(step,false),what:copy.refill};default:return{icon:"calendar",when:label(step,false),what:copy.nextBoxShips(sp)}}}),doneTitle=run2===null?copy.orderedTitle(sp):copy.startedTitle(sp);screenNode=pushedFrame("health-plan-started",backRow,
|
|
363
|
+
/* @__PURE__ */jsxs(View,{style:bx("done"),children:[doneCheck,
|
|
364
|
+
/* @__PURE__ */jsx(Text,{style:tb("doneTitle"),accessibilityRole:"header",children:doneTitle}),copy.startedWhat(sp).trim()===""?null:/* @__PURE__ */jsx(Text,{style:tb("doneWhen"),children:copy.startedWhat(sp)}),copy.startedNote?/* @__PURE__ */jsx(Text,{style:tb("doneWho"),children:copy.startedNote}):null,
|
|
365
|
+
/* @__PURE__ */jsx(View,{style:bx("next"),accessibilityLabel:copy.startedSteps,children:steps.map(r=>nextRow(`${r.icon}${r.when}`,nextIcon(r.icon),r.when,r.what))})]}),shopButton(kit,copy.startedDone,()=>setStarted(null),{testID:"health-plan-started-done"}))}else if(top!==void 0){let shopDay=iso=>formatShopDay(iso,locale),money2=(amount,cur)=>fmt(amount,cur),toOrders=()=>push({kind:"orders"}),body=null,foot=null,footPart=null;if(top.kind==="cart")body=shopCartBody(kit,views,fmt(cartTotal,currency)??"",renewPrices,pr,{onQuantity:(key,by)=>editLine(key,x=>({...x,qty:Math.max(1,Math.min(cartOn&&!lineSub(x)?MAX_QUANTITY:1,x.qty+by))})),onRemove:key=>{editLine(key,()=>null),say(copy.removedFromCart(itemOf2(key)?.title??""))},onMode:(key,m)=>editLine(key,x=>({...x,mode:m,qty:1})),onEvery:(key,d)=>editLine(key,x=>({...x,every:d})),onOrders:toOrders}),footPart=views.length===0?null:"foot",foot=views.length===0?shopButton(kit,copy.startedDone,closeOverlays):/* @__PURE__ */jsxs(Fragment$1,{children:[shopButton(kit,copy.checkoutCart(fmt(cartTotal,currency)??""),()=>setSheet({kind:"cartCheckout"}),{disabled:!cartReady,testID:"health-plan-cart-checkout"}),!cartReady&©.cartOneAtATime!==""?/* @__PURE__ */jsx(Text,{style:tb("shopFine","shopFineCenter"),children:copy.cartOneAtATime}):null]});else if(top.kind==="orders"||top.kind==="order"){let subCard=subscription!==null&&active?{name:subscription.title??item.title,imageUrl:item.imageUrl??null,next:nextBoxDay(subscription),every:subscription.intervalDays,onManage:()=>setSheet({kind:"manage"})}:null;if(top.kind==="orders")body=shopOrdersBody(kit,{subscription:subCard,orders:allOrders,loaded:everfurOrders.loaded,fmt:money2,day:shopDay,onOpen:key=>push({kind:"order",key:key}),onBack:closeOverlays,petPrices:pr,more:everfurOrders.next===null?null:{onMore:moreOrders,loading:everfurOrders.loading}});else{let order=allOrders.find(o=>o.key===top.key),again=order?.everfur===true&&order.productId!==null?itemOf2(order.productId):void 0;body=order===void 0?null:shopOrderBody(kit,{order:order,fmt:money2,day:shopDay,rows:rows.map(r=>r.label===PAY_WITH?{...r,label:copy.paidWith}:r),onBuyAgain:again===void 0?null:()=>addToCart(again,"once"),onHelp:props.onOrderHelp?()=>props.onOrderHelp&&callHost(props.onOrderHelp,order.key):null})}}else{let placedOrders=top.orders,first=placedOrders[0],op=prices(every,first?.title??(first?itemOf2(first.productId)?.title:void 0)??item.title),one=xs=>{let known=[...new Set(xs.filter(x=>x!=null))];return known.length===1?known[0]??null:null},placedNo=one(placedOrders.map(o=>o.tracking?.orderNumber)),arrives=placedOrders.length>0&&placedOrders.every(o=>o.tracking?.estimatedDelivery)?one(placedOrders.map(o=>o.tracking?.estimatedDelivery)):null,arrivesDay=day(arrives),placedCurrency=one(placedOrders.map(o=>o.currency)),placedTotal=placedCurrency===null?null:fmt(Math.round(placedOrders.reduce((sum,o)=>sum+(o.total??o.price),0)*100)/100,placedCurrency);body=/* @__PURE__ */jsxs(View,{style:bx("done"),testID:"health-plan-placed",children:[doneCheck,
|
|
366
|
+
/* @__PURE__ */jsx(Text,{style:tb("doneTitle"),accessibilityRole:"header",children:copy.orderedTitle(op)}),arrivesDay===null?null:/* @__PURE__ */jsx(Text,{style:tb("doneWhen"),children:copy.arrivesBy(arrivesDay)}),placedNo===null?null:/* @__PURE__ */jsx(Text,{style:tb("doneWho"),children:copy.orderTitle(placedNo)}),
|
|
367
|
+
/* @__PURE__ */jsxs(View,{style:bx("next"),accessibilityLabel:copy.placedSteps,children:[placedOrders.map(o=>{let it=itemOf2(o.productId);return nextRow(o.orderId,it?.imageUrl?img(it.imageUrl,im("nextIconImage")):nextIcon("box"),copy.cartItemQuantity(o.quantity??1),o.title??it?.title??"",true)}),nextRow("ships",nextIcon("truck"),copy.tomorrow,withTracking(copy.placedShips)),arrivesDay===null?null:nextRow("arrives",nextIcon("calendar"),arrivesDay,copy.placedArrives)]}),placedOrders.length>1&&placedTotal!==null?shopSummary(kit,placedTotal):null,copy.startedNote?/* @__PURE__ */jsx(Text,{style:tb("shopFine","shopFineCenter"),children:copy.startedNote}):null]}),footPart="pushFootStack",foot=/* @__PURE__ */jsxs(Fragment$1,{children:[shopButton(kit,placedOrders.length===1?copy.viewOrder:copy.seeOrders,()=>setScreens(placedOrders.length===1&&first!==void 0?[{kind:"order",key:first.orderId}]:[{kind:"orders"}]),{testID:"health-plan-placed-view"}),shopButton(kit,copy.startedDone,closeOverlays,{ghost:true})]})}let heading=onOverlayChange===void 0&&title!==void 0?/* @__PURE__ */jsx(Text,{style:S.h3,accessibilityRole:"header",children:title}):null;screenNode=pushedFrame(`health-plan-screen-${top.kind}`,backRow===null&&heading===null&&toast===null?null:/* @__PURE__ */jsxs(Fragment$1,{children:[backRow,heading,toastNode]}),
|
|
368
|
+
/* @__PURE__ */jsx(View,{testID:"health-plan-screen-body",children:body}),foot,footPart)}/* @__PURE__ */
|
|
376
369
|
return jsxs(Fragment$1,{children:[
|
|
377
|
-
/* @__PURE__ */jsx(PlanPushes,{id:started!==null?"started":top===void 0?"page":top.kind==="order"?`order:${top.key}`:top.kind,depth:screens.length+(started!==null?1:0),node:screenNode??pageNode,width:window.width,paper:P.paper,still:still}),sheetNode,recordsProbe]})}function blanksDay(ms,locale){let d=new Date(ms);try{return new Intl.DateTimeFormat(locale??"en-US",{month:"short",day:"numeric",year:"numeric",timeZone:"UTC"}).format(d)}catch{return d.toISOString().slice(0,10)}}function HealthPlanItemCard(props){let{item:item,onToggle:onToggle,pending:pending=false,error:error=null,imageVariant:imageVariant=HEALTH_PLAN_LAYOUT_DEFAULTS.imageVariant,reasonVariant:reasonVariant=HEALTH_PLAN_LAYOUT_DEFAULTS.reasonVariant,priceFormat:priceFormat,renderFooter:renderFooter,showCategory:showCategory=HEALTH_PLAN_LAYOUT_DEFAULTS.showCategory,cardShadow:cardShadow=HEALTH_PLAN_LAYOUT_DEFAULTS.cardShadow,cardBorder:cardBorder=HEALTH_PLAN_LAYOUT_DEFAULTS.cardBorder,addButtonSize:addButtonSize=HEALTH_PLAN_LAYOUT_DEFAULTS.addButtonSize,addButtonFontSize:addButtonFontSize,addedVariant:addedVariant=HEALTH_PLAN_LAYOUT_DEFAULTS.addedVariant,categoryVariant:categoryVariant=HEALTH_PLAN_LAYOUT_DEFAULTS.categoryVariant,cardPadding:cardPadding,itemTitleSize:itemTitleSize,itemTitleWeight:itemTitleWeight,priceSize:priceSize,priceWeight:priceWeight,reasonTextSize:reasonTextSize,reasonLabelWidth:reasonLabelWidth,reasonGap:reasonGap,style:style}=guardHostProps(props,["onToggle"]),theme=useEverfurTheme(),
|
|
378
|
-
/* @__PURE__ */jsx(Pressable,{onPress:()=>onToggle?.(false),disabled:pending,accessibilityRole:"button",accessibilityLabel:HEALTH_PLAN_COPY.added,accessibilityState:{disabled:pending,busy:pending,selected:true},style:[pillStyle,
|
|
379
|
-
/* @__PURE__ */jsx(Text,{style:
|
|
380
|
-
/* @__PURE__ */jsx(Pressable,{onPress:()=>onToggle?.(false),disabled:pending,accessibilityRole:"button",accessibilityLabel:HEALTH_PLAN_COPY.remove,accessibilityState:{disabled:pending,busy:pending},style:
|
|
381
|
-
return jsxs(View,{style:[
|
|
382
|
-
/* @__PURE__ */jsxs(View,{style:
|
|
383
|
-
/* @__PURE__ */jsxs(View,{style:
|
|
384
|
-
/* @__PURE__ */jsx(Text,{tier:"compact",style:[rows?
|
|
385
|
-
/* @__PURE__ */jsx(Text,{style:[rows?
|
|
386
|
-
return jsx(View,{style:style,children:/* @__PURE__ */jsxs(View,{style:
|
|
387
|
-
return
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
/* @__PURE__ */jsx(
|
|
370
|
+
/* @__PURE__ */jsx(PlanPushes,{id:started!==null?"started":top===void 0?"page":top.kind==="order"?`order:${top.key}`:top.kind,depth:screens.length+(started!==null?1:0),node:screenNode??pageNode,width:window.width,paper:P.paper,still:still}),sheetNode,recordsProbe]})}function blanksDay(ms,locale){let d=new Date(ms);try{return new Intl.DateTimeFormat(locale??"en-US",{month:"short",day:"numeric",year:"numeric",timeZone:"UTC"}).format(d)}catch{return d.toISOString().slice(0,10)}}function HealthPlanItemCard(props){let{item:item,onToggle:onToggle,pending:pending=false,error:error=null,imageVariant:imageVariant=HEALTH_PLAN_LAYOUT_DEFAULTS.imageVariant,reasonVariant:reasonVariant=HEALTH_PLAN_LAYOUT_DEFAULTS.reasonVariant,priceFormat:priceFormat,renderFooter:renderFooter,showCategory:showCategory=HEALTH_PLAN_LAYOUT_DEFAULTS.showCategory,cardShadow:cardShadow=HEALTH_PLAN_LAYOUT_DEFAULTS.cardShadow,cardBorder:cardBorder=HEALTH_PLAN_LAYOUT_DEFAULTS.cardBorder,addButtonSize:addButtonSize=HEALTH_PLAN_LAYOUT_DEFAULTS.addButtonSize,addButtonFontSize:addButtonFontSize,addedVariant:addedVariant=HEALTH_PLAN_LAYOUT_DEFAULTS.addedVariant,categoryVariant:categoryVariant=HEALTH_PLAN_LAYOUT_DEFAULTS.categoryVariant,cardPadding:cardPadding,itemTitleSize:itemTitleSize,itemTitleWeight:itemTitleWeight,priceSize:priceSize,priceWeight:priceWeight,reasonTextSize:reasonTextSize,reasonLabelWidth:reasonLabelWidth,reasonGap:reasonGap,style:style}=guardHostProps(props,["onToggle"]),theme=useEverfurTheme(),styles2=useMemo(()=>makeStyles3(theme),[theme]),sized=(size,weight)=>{let px=healthPlanLength(size),fontSize=px===null||px===0?null:{fontSize:px,lineHeight:Math.round(px*theme.type.lineHeight.snug)};return fontSize===null&&weight===void 0?null:{...fontSize,...weight===void 0?null:{fontWeight:String(weight)}}},titleSized=sized(itemTitleSize,itemTitleWeight),priceSized=sized(priceSize,priceWeight),reasonSized=sized(reasonTextSize),labelWidth=healthPlanLength(reasonLabelWidth),labelGap=healthPlanLength(reasonGap),padding=healthPlanLength(cardPadding),shadow=useMemo(()=>cardShadowStyle(cardShadow,styles2.cardShadow,theme),[cardShadow,styles2,theme]),price=formatHealthPlanPriceWith(item.price,item.currency,priceFormat),thumbnail=imageVariant==="thumbnail",rows=reasonVariant==="rows",priceNode=price===null?null:/* @__PURE__ */jsx(Text,{style:[styles2.price,priceSized],children:price}),category=showCategory&&item.category!==null?/* @__PURE__ */jsx(Text,{...categoryVariant==="label"?{tier:"compact"}:{},style:categoryVariant==="label"?styles2.categoryLabel:styles2.category,testID:`health-plan-category-${item.productId}`,children:item.category}):null,full=addButtonSize==="full",{height:height,hit:hit}=healthPlanAddButtonHeight(addButtonSize),slop=(hit-height)/2,fontPx=healthPlanLength(addButtonFontSize),pillStyle=full?styles2.add:[styles2.addCompact,{minHeight:height,paddingHorizontal:height>=40?theme.space.lg:theme.space.md}],pillLabel=pressed=>[full||height>=40?styles2.addLabel:styles2.addCompactLabel,pressed?styles2.addPressedLabel:null,fontPx===null||fontPx===0?null:{fontSize:fontPx,lineHeight:Math.round(fontPx*theme.type.lineHeight.snug)}],hitSlop=slop>0?{top:slop,bottom:slop,left:0,right:0}:void 0,title=/* @__PURE__ */jsx(Text,{style:[thumbnail?styles2.thumbTitle:styles2.title,titleSized],accessibilityRole:"header",children:item.title}),sample=item.sample?/* @__PURE__ */jsx(View,{style:styles2.sample,children:/* @__PURE__ */jsx(Text,{tier:"badge",style:styles2.sampleLabel,children:HEALTH_PLAN_COPY.sample})}):null,description=item.description===null?null:/* @__PURE__ */jsx(Text,{style:styles2.body,children:item.description}),control=item.inPlan&&addedVariant==="pressed"?
|
|
371
|
+
/* @__PURE__ */jsx(Pressable,{onPress:()=>onToggle?.(false),disabled:pending,accessibilityRole:"button",accessibilityLabel:HEALTH_PLAN_COPY.added,accessibilityState:{disabled:pending,busy:pending,selected:true},style:[pillStyle,styles2.addPressed,pending?styles2.dimmed:null],...hitSlop?{hitSlop:hitSlop}:{},testID:`health-plan-added-${item.productId}`,children:/* @__PURE__ */jsx(Text,{tier:"control",style:pillLabel(true),children:HEALTH_PLAN_COPY.added})}):item.inPlan?/* @__PURE__ */jsxs(View,{style:styles2.row,children:[
|
|
372
|
+
/* @__PURE__ */jsx(Text,{style:styles2.added,children:HEALTH_PLAN_COPY.added}),
|
|
373
|
+
/* @__PURE__ */jsx(Pressable,{onPress:()=>onToggle?.(false),disabled:pending,accessibilityRole:"button",accessibilityLabel:HEALTH_PLAN_COPY.remove,accessibilityState:{disabled:pending,busy:pending},style:styles2.remove,testID:`health-plan-remove-${item.productId}`,children:/* @__PURE__ */jsx(Text,{tier:"control",style:styles2.removeLabel,children:HEALTH_PLAN_COPY.remove})})]}):/* @__PURE__ */jsx(Pressable,{onPress:()=>onToggle?.(true),disabled:pending,accessibilityRole:"button",accessibilityLabel:HEALTH_PLAN_COPY.addToCart,accessibilityState:{disabled:pending,busy:pending,...addedVariant==="pressed"?{selected:false}:{}},style:[pillStyle,pending?styles2.dimmed:null],...hitSlop?{hitSlop:hitSlop}:{},testID:`health-plan-add-${item.productId}`,children:/* @__PURE__ */jsx(Text,{tier:"control",style:pillLabel(false),children:HEALTH_PLAN_COPY.addToCart})});/* @__PURE__ */
|
|
374
|
+
return jsxs(View,{style:[styles2.card,shadow,cardBorder?null:styles2.cardNoBorder,padding===null?null:{padding:padding},style],accessibilityState:{busy:pending},testID:`health-plan-item-${item.productId}`,children:[thumbnail?/* @__PURE__ */jsxs(View,{style:styles2.thumbHead,testID:`health-plan-thumb-head-${item.productId}`,children:[item.imageUrl===null?null:/* @__PURE__ */jsx(Image,{source:{uri:item.imageUrl},style:styles2.thumb,resizeMode:"cover",accessibilityIgnoresInvertColors:true}),
|
|
375
|
+
/* @__PURE__ */jsxs(View,{style:styles2.thumbCopy,children:[category,title,sample,description]})]}):/* @__PURE__ */jsxs(Fragment$1,{children:[item.imageUrl===null?null:/* @__PURE__ */jsx(Image,{source:{uri:item.imageUrl},style:styles2.image,resizeMode:"cover",accessibilityIgnoresInvertColors:true}),category,
|
|
376
|
+
/* @__PURE__ */jsxs(View,{style:styles2.head,children:[title,priceNode]}),sample,description]}),item.reasons.map((reason,index)=>/* @__PURE__ */jsxs(View,{style:[rows?styles2.reasonRow:styles2.reason,labelGap===null?null:{gap:labelGap}],testID:`health-plan-reason-${rows?"row":"pill"}`,children:[
|
|
377
|
+
/* @__PURE__ */jsx(Text,{tier:"compact",style:[rows?styles2.reasonRowKind:styles2.reasonKind,rows&&labelWidth!==null?{width:labelWidth}:null],children:HEALTH_PLAN_REASON_LABELS[reason.kind]}),
|
|
378
|
+
/* @__PURE__ */jsx(Text,{style:[rows?styles2.reasonRowText:styles2.reasonText,reasonSized],children:reason.text})]},`${reason.kind}-${index}`)),renderFooter===void 0?null:/* @__PURE__ */jsx(HostRender,{resetKey:item,render:()=>renderFooter(item),fallback:null}),thumbnail?/* @__PURE__ */jsxs(View,{style:styles2.actionRow,children:[priceNode,control]}):control,error===null?null:/* @__PURE__ */jsx(Text,{style:styles2.error,accessibilityLiveRegion:"polite",children:error.displayMessage})]})}var THUMB_SIZE=64,COMPACT_HEIGHT=32,REASON_LABEL_WIDTH=72;function cardShadowStyle(shadow,soft,theme){if(shadow===true)return soft;if(shadow===void 0||shadow===false)return null;let spec=typeof shadow=="string"?parseHealthPlanShadow(shadow):shadow;if(spec===null)return null;let rgba=toRgba(spec.color);if(rgba===null)return null;let blur=Math.max(0,spec.blur);return{shadowColor:`rgb(${rgba.r}, ${rgba.g}, ${rgba.b})`,shadowOffset:{width:spec.offsetX??0,height:spec.offsetY},shadowRadius:blur/2,shadowOpacity:Math.min(1,Math.max(0,rgba.a*(spec.opacity??1))),elevation:Math.max(0,Math.min(theme.space.lg,Math.round(blur/2)))}}function makeStyles3(theme){let{color:color,radius:radius,space:space,type:type,slots:slots}=theme,text2=(size,ink,weight)=>({...face(theme,weight),fontSize:size,lineHeight:Math.round(size*type.lineHeight.snug),color:ink}),cardInk=slots.planCard?.textColor??slots.card?.textColor,reasonLabelInk=slots.planReasonLabel?.textColor??slots.chip?.textColor??color.brandInk;return StyleSheet.create({card:{gap:space.sm,padding:space.lg,borderRadius:radius.lg,borderWidth:1,borderColor:color.brandBorder,backgroundColor:color.surface,...slotBox(slots.card,1),...slotBox(slots.planCard,1)},cardShadow:{shadowColor:color.shadow,shadowOffset:{width:0,height:space.xs},shadowRadius:space.md,shadowOpacity:.08,elevation:space.xs},cardNoBorder:{borderWidth:0},category:text2(type.size.caption,cardInk??color.text.secondary,"regular"),categoryLabel:{...face(theme,"monoMedium"),fontSize:type.size.micro,lineHeight:Math.round(type.size.micro*type.lineHeight.snug),letterSpacing:type.letterSpacing.monoWide,textTransform:"uppercase",color:reasonLabelInk},image:{width:"100%",aspectRatio:4/3,borderRadius:radius.md,backgroundColor:color.surfaceSubtle},thumbHead:{flexDirection:"row",alignItems:"flex-start",gap:space.md},thumb:{width:THUMB_SIZE,height:THUMB_SIZE,borderRadius:radius.md,backgroundColor:color.surfaceSubtle},thumbCopy:{flex:1,gap:space.xs},thumbTitle:text2(type.size.body,cardInk??color.text.primary,"bold"),actionRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",gap:space.sm},reasonRow:{flexDirection:"row",alignItems:"flex-start",gap:space.lg},reasonRowKind:{width:REASON_LABEL_WIDTH,paddingTop:2,...face(theme,"monoMedium"),fontSize:type.size.micro,lineHeight:Math.round(type.size.micro*type.lineHeight.snug),letterSpacing:type.letterSpacing.monoWide,textTransform:"uppercase",color:reasonLabelInk},reasonRowText:{flex:1,...text2(type.size.caption,cardInk??color.text.secondary,"regular")},head:{flexDirection:"row",alignItems:"baseline",justifyContent:"space-between",gap:space.sm},title:{flex:1,...text2(type.size.body,cardInk??color.text.primary,"bold")},price:text2(type.size.body,cardInk??color.text.primary,"bold"),sample:{alignSelf:"flex-start",paddingHorizontal:space.sm,paddingVertical:2,borderRadius:radius.pill,backgroundColor:color.badgeBgNeutral},sampleLabel:text2(type.size.caption,color.text.secondary,"bold"),body:text2(type.size.caption,cardInk??color.text.secondary,"regular"),reason:{flexDirection:"row",alignItems:"baseline",gap:space.sm,paddingHorizontal:space.sm,paddingVertical:space.xs,borderRadius:radius.md,backgroundColor:color.brandSofter,...slotBox(slots.chip,1)},reasonKind:{...text2(type.size.caption,color.brandInk,"bold"),textTransform:"uppercase",letterSpacing:.4,...slotText(slots.chip)},reasonText:{flex:1,...text2(type.size.caption,color.text.secondary,"regular"),...slotText(slots.chip)},row:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",gap:space.sm},added:text2(type.size.caption,color.brandInk,"bold"),add:{minHeight:44,paddingHorizontal:space.lg,borderRadius:radius.pill,alignItems:"center",justifyContent:"center",backgroundColor:color.brand,...slotBox(slots.primaryButton)},addLabel:{...text2(type.size.body,color.text.onBrand,"bold"),...slotText(slots.primaryButton)},addCompact:{minHeight:COMPACT_HEIGHT,alignSelf:"flex-start",paddingHorizontal:space.md,borderRadius:radius.pill,alignItems:"center",justifyContent:"center",backgroundColor:color.brand,...slotBox(slots.primaryButton)},addCompactLabel:{...text2(type.size.caption,color.text.onBrand,"bold"),...slotText(slots.primaryButton)},addPressed:{backgroundColor:color.brandInk,borderWidth:0},addPressedLabel:{color:readableOn(color.brandInk)},remove:{minHeight:44,justifyContent:"center"},removeLabel:{...text2(type.size.caption,color.linkInk,"bold"),...slotText(slots.link)},dimmed:{opacity:.5},error:text2(type.size.caption,color.errorRed,"regular")})}var FOCUS_CALLBACKS=["onBuy","onMore","onExtra","onAddToVisit","onOverlayChange","onSubscriptionChange","onOneBoxOrder","onJump","onOrderHelp","onWeightSaved","onConnectRecords","onWaitAction","navigate"];function EverfurHealthPlan(props){let guarded=guardHostProps(props,["onCheckout","onAvailability","onAvailabilityChange","onAsk"]),theme=useEverfurTheme(),styles2=useMemo(()=>makeStyles4(theme),[theme]),rawFocus=props.focus,focus=useMemo(()=>rawFocus===void 0?void 0:guardHostProps(rawFocus,FOCUS_CALLBACKS),[rawFocus]),{lifecycle:lifecycle,refreshKey:refreshKey,presentation:presentation,onAvailability:onAvailability,onAvailabilityChange:onAvailabilityChange,...bodyProps}=guarded,availabilityRef=useRef({onAvailability:onAvailability,onAvailabilityChange:onAvailabilityChange});availabilityRef.current={onAvailability:onAvailability,onAvailabilityChange:onAvailabilityChange};let report=useMemo(()=>(available,petRef)=>{let{onAvailability:next,onAvailabilityChange:old}=availabilityRef.current;next?.(available,petRef),old?.(available)},[]),layout=useEverfurPresentation(presentation?.healthPlanLayout===void 0?void 0:{healthPlanLayout:presentation.healthPlanLayout}).healthPlanLayout,plan=useEverfurHealthPlan({...guarded.petRef===void 0?{}:{petRef:guarded.petRef},...lifecycle===void 0?{}:{lifecycle:lifecycle},...refreshKey===void 0?{}:{refreshKey:refreshKey}});return plan.status==="signedOut"?/* @__PURE__ */jsx(View,{style:[styles2.page,guarded.style],children:/* @__PURE__ */jsx(Text,{style:styles2.body,children:HEALTH_PLAN_COPY.signedOut})}):/* @__PURE__ */jsx(CapabilityGate,{capability:"healthPlan",...guarded.renderDisabled?{renderDisabled:guarded.renderDisabled}:{},style:guarded.style,children:/* @__PURE__ */jsx(PlanBody,{...bodyProps,plan:plan,styles:styles2,focusLayout:layout==="focus_plan",...focus===void 0?{}:{focus:focus},onReport:report,...lifecycle===void 0?{}:{lifecycle:lifecycle},...refreshKey===void 0?{}:{refreshKey:refreshKey}})})}function useAvailability(available,petRef,report){useEffect(()=>{available!==null&&report(available,petRef)},[available,petRef,report])}function Refused({error:error,retry:retry,renderNotice:renderNotice,styles:styles2,style:style}){let signIn=isHealthPlanSessionRequired(error),line=signIn?HEALTH_PLAN_COPY.signedOut:error?.displayMessage??"";/* @__PURE__ */
|
|
379
|
+
return jsx(View,{style:style,children:/* @__PURE__ */jsxs(View,{style:styles2.notice,accessibilityLiveRegion:"polite",children:[error===null?null:/* @__PURE__ */jsx(HostRender,{resetKey:error,render:()=>renderNotice?renderNotice(error):/* @__PURE__ */jsx(Text,{style:styles2.noticeText,children:line}),fallback:/* @__PURE__ */jsx(Text,{style:styles2.noticeText,children:line})}),signIn?null:/* @__PURE__ */jsx(Pressable,{onPress:retry,accessibilityRole:"button",accessibilityLabel:HEALTH_PLAN_COPY.retry,style:styles2.retry,testID:"health-plan-retry",children:/* @__PURE__ */jsx(Text,{tier:"control",style:styles2.retryLabel,children:HEALTH_PLAN_COPY.retry})})]})})}function Loading({styles:styles2,style:style}){/* @__PURE__ */
|
|
380
|
+
return jsxs(View,{style:[styles2.page,style],accessible:true,accessibilityRole:"progressbar",accessibilityLabel:HEALTH_PLAN_COPY.loading,accessibilityState:{busy:true},testID:"health-plan-loading",children:[
|
|
381
|
+
/* @__PURE__ */jsx(View,{style:styles2.skeletonTitle}),
|
|
382
|
+
/* @__PURE__ */jsx(View,{style:styles2.skeletonCard}),
|
|
383
|
+
/* @__PURE__ */jsx(View,{style:styles2.skeletonCard})]})}function Empty({emptyCopy:emptyCopy,onAsk:onAsk,heading:heading,header:header,styles:styles2,style:style}){let words2={emptyTitle:emptyCopy?.emptyTitle??HEALTH_PLAN_COPY.emptyTitle,emptyBody:emptyCopy?.emptyBody??HEALTH_PLAN_COPY.emptyBody,emptyAsk:emptyCopy?.emptyAsk??HEALTH_PLAN_COPY.emptyAsk};return words2.emptyTitle.trim()===""&&words2.emptyBody.trim()===""?null:/* @__PURE__ */jsxs(View,{style:style,testID:"health-plan-empty",children:[heading,header,
|
|
384
|
+
/* @__PURE__ */jsxs(View,{style:styles2.empty,children:[words2.emptyTitle.trim()===""?null:/* @__PURE__ */jsx(Text,{style:styles2.subtitle,children:words2.emptyTitle}),words2.emptyBody.trim()===""?null:/* @__PURE__ */jsx(Text,{style:styles2.body,children:words2.emptyBody}),words2.emptyAsk.trim()===""||onAsk===void 0?null:/* @__PURE__ */jsx(Pressable,{onPress:()=>onAsk(),accessibilityRole:"button",style:styles2.retry,testID:"health-plan-empty-ask",children:/* @__PURE__ */jsx(Text,{tier:"control",style:styles2.retryLabel,children:words2.emptyAsk})})]})]})}function FocusBody({plan:plan,focus:focus,styles:styles2,style:style,petName:petName,petSpecies:petSpecies,onCheckout:onCheckout,renderNotice:renderNotice,priceFormat:priceFormat,showCategory:showCategory,lifecycle:lifecycle,refreshKey:refreshKey,onAvailable:onAvailable,list:list,empty:empty}){let fromBackend=focus.design===void 0,page=useHealthPlanPage({petRef:plan.petRef,enabled:fromBackend,...focus.pageRepository?{repository:focus.pageRepository}:{},...lifecycle===void 0?{}:{lifecycle:lifecycle},...refreshKey===void 0?{}:{refreshKey:refreshKey}}),design=focus.design,checkout,weightKnown=focus.weightKnown,name=petName,sex=focus.petSex??null,species=petSpecies,vetReviewed=false,pageTexts=false,state2="ready";fromBackend&&(page.phase==="failed"?state2=isHealthPlanSessionRequired(page.error)?"failed":"list":page.missing?state2="list":page.page===null?state2="loading":page.page.page===null?state2="list":(design=page.page.page,checkout=page.page.checkout,weightKnown??=page.page.pet.weightKg!==null,name=page.page.pet.name??petName,sex=page.page.pet.sex??sex,species=page.page.pet.species??petSpecies,vetReviewed=page.page.vetReviewed===true,pageTexts=page.page.trackingTextsEnabled===true));let itemless=plan.status==="empty";itemless&&state2!=="loading"&&(state2=state2==="ready"&&healthPlanPageDrawsWithoutItems(design)?"ready":"hidden"),itemless&&state2==="ready"&&design!==void 0&&(design=withoutProductPart(design));let items=plan.plan?.items??[],pick2=design?.pick,picked=pick2===void 0?void 0:items.find(item=>pick2.productId!==void 0&&item.productId===pick2.productId)??items.find(item=>pick2.partnerSku!==void 0&&item.partnerSku===pick2.partnerSku)??items[0]??(itemless?NO_PLAN_ITEM:void 0);if(state2==="ready"&&(design===void 0||picked===void 0||plan.petRef===null)&&(state2="hidden"),useEffect(()=>{onAvailable(state2==="ready"||state2==="list"?true:state2==="hidden"?false:null)},[state2,onAvailable]),state2==="list")return list;if(state2==="failed")/* @__PURE__ */return jsx(Refused,{error:page.error,retry:()=>{page.refresh()},renderNotice:renderNotice,styles:styles2,style:[styles2.page,style]});if(state2==="loading")/* @__PURE__ */return jsx(Loading,{styles:styles2,style:style});if(state2==="hidden"&&itemless)return empty;if(state2==="hidden"||design===void 0||picked===void 0||plan.petRef===null)return null;let onWeightSaved=focus.onWeightSaved,pageRefresh=page.refresh;/* @__PURE__ */
|
|
385
|
+
return jsx(HealthPlanFocus,{...focus,design:design,...checkout?{checkout:checkout}:{},...weightKnown===void 0?{}:{weightKnown:weightKnown},...fromBackend?{onWeightSaved:kg=>{onWeightSaved&&callHost(onWeightSaved,kg),pageRefresh()}}:{},item:picked,others:items.filter(item=>item!==picked),...showCategory!==void 0?{showCategory:showCategory}:{},...lifecycle===void 0?{}:{lifecycle:lifecycle},...refreshKey===void 0?{}:{refreshKey:refreshKey},petRef:plan.petRef,petName:name,petSex:sex,species:species,fromBackend:fromBackend,vetReviewed:vetReviewed,trackingTexts:fromBackend?pageTexts:focus.trackingTexts??plan.plan?.trackingTextsEnabled===true,...onCheckout?{onCheckout:onCheckout}:{},...priceFormat?{priceFormat:priceFormat}:{},style:style},plan.petRef)}function PlanBody({plan:plan,styles:styles2,onCheckout:onCheckout,renderNotice:renderNotice,style:style,imageVariant:imageVariant,reasonVariant:reasonVariant,cartBarVisibility:cartBarVisibility,priceFormat:priceFormat,renderHeader:renderHeader,renderItemFooter:renderItemFooter,renderFooter:renderFooter,titleSize:titleSize,titleGap:titleGap,sectionGap:sectionGap,cartBarPlacement:cartBarPlacement,titleLineHeight:titleLineHeight,renderBetweenItems:renderBetweenItems,focusLayout:focusLayout,focus:focus,onReport:onReport,onAsk:onAsk,emptyCopy:emptyCopy,lifecycle:lifecycle,refreshKey:refreshKey,...cardProps}){let theme=useEverfurTheme(),{pets:pets}=useEverfurPets(),pet=pets.find(p=>p.petRef===plan.petRef),petName=pet?.name??null,[focusAvailable,setFocusAvailable]=useState(null);useAvailability(plan.status==="empty"?focusLayout?focusAvailable:false:plan.status==="ready"?focusLayout?focusAvailable:true:null,plan.petRef,onReport);let title=plan.plan?.headline??(petName===null?null:HEALTH_PLAN_TEMPLATES.planTitle(petName)),docked=cartBarPlacement==="none";usePublishHealthPlanCart(docked&&plan.status==="ready",plan.cart,plan.pending.length>0,plan.petRef,plan.plan,plan.setInPlan);let telemetry=useHealthPlanTelemetry();useHealthPlanOpened(plan.status==="ready"||plan.status==="empty",plan.petRef,plan.plan);let gap=healthPlanLength(sectionGap),pageStyle=gap===null?styles2.page:[styles2.page,{gap:gap}],size=healthPlanLength(titleSize),ratio=healthPlanLength(titleLineHeight),titleStyle=[styles2.title,size===null||size===0?null:{fontSize:size,lineHeight:Math.round(size*theme.type.lineHeight.snug)},ratio===null||ratio===0?null:{lineHeight:Math.round((size===null||size===0?theme.type.size.heading:size)*ratio)},{marginBottom:healthPlanTitleOffset(titleGap,gap??theme.space.lg)}],heading=title===null?null:/* @__PURE__ */jsx(Text,{style:titleStyle,accessibilityRole:"header",children:title}),writes=useMemo(()=>healthPlanWrites(plan.plan,plan.setInPlan),[plan.plan,plan.setInPlan]),context={petRef:plan.petRef,plan:plan.plan,cart:plan.cart,...writes},cardOptions=pickHealthPlanCardOptions(cardProps),between=(index,item)=>renderBetweenItems===void 0||index===0?null:/* @__PURE__ */jsx(HostRender,{resetKey:item,render:()=>renderBetweenItems(index,item),fallback:null}),header=renderHeader===void 0?null:/* @__PURE__ */jsx(HostRender,{resetKey:plan.plan,render:()=>renderHeader(context),fallback:null});if(plan.status==="noPet")/* @__PURE__ */
|
|
386
|
+
return jsx(View,{style:[pageStyle,style],children:/* @__PURE__ */jsx(Text,{style:styles2.body,children:HEALTH_PLAN_COPY.choosePet})});if(plan.status==="loading")/* @__PURE__ */return jsx(Loading,{styles:styles2,style:[gap===null?null:{gap:gap},style]});if(plan.status==="failed")/* @__PURE__ */return jsx(Refused,{error:plan.error,retry:()=>{plan.refresh()},renderNotice:renderNotice,styles:styles2,style:[pageStyle,style]});let empty=/* @__PURE__ */jsx(Empty,{emptyCopy:emptyCopy,onAsk:onAsk,heading:heading,header:header,styles:styles2,style:[pageStyle,style]});if(plan.status==="empty"&&!focusLayout)return empty;let items=plan.plan?.items??[],list=/* @__PURE__ */jsxs(View,{style:[pageStyle,style],children:[heading,header,items.map((item,index)=>/* @__PURE__ */jsxs(Fragment,{children:[between(index,item),
|
|
387
|
+
/* @__PURE__ */jsx(HealthPlanItemCard,{item:item,pending:plan.pending.includes(item.productId),error:plan.itemErrors[item.productId]??null,onToggle:inPlan=>{trackProductClicked(telemetry,plan.petRef,item.productId,inPlan),plan.setInPlan(item.productId,inPlan)},...imageVariant?{imageVariant:imageVariant}:{},...reasonVariant?{reasonVariant:reasonVariant}:{},...priceFormat?{priceFormat:priceFormat}:{},...renderItemFooter?{renderFooter:renderItemFooter}:{},...cardOptions})]},item.productId)),renderFooter===void 0?null:/* @__PURE__ */jsx(HostRender,{resetKey:plan.plan,render:()=>renderFooter(context),fallback:null}),!docked&&showHealthPlanCartBar(cartBarVisibility,plan.cart.count)?/* @__PURE__ */jsx(HealthPlanPetScope,{petRef:plan.petRef,children:/* @__PURE__ */jsx(HealthPlanCartBar,{cart:plan.cart,busy:plan.pending.length>0,...onCheckout?{onCheckout:onCheckout}:{},...priceFormat?{priceFormat:priceFormat}:{}})}):null]});return focusLayout?/* @__PURE__ */jsx(FocusBody,{plan:plan,focus:focus??{},styles:styles2,style:style,petName:petName,petSpecies:pet?.species??null,onCheckout:onCheckout,renderNotice:renderNotice,priceFormat:priceFormat,showCategory:cardOptions.showCategory,lifecycle:lifecycle,refreshKey:refreshKey,onAvailable:setFocusAvailable,list:list,empty:empty}):list}function makeStyles4(theme){let{color:color,radius:radius,space:space,type:type}=theme,text2=(size,ink,weight)=>({...face(theme,weight),fontSize:size,lineHeight:Math.round(size*type.lineHeight.snug),color:ink});return StyleSheet.create({page:{gap:space.lg,padding:space.lg},title:{...text2(type.size.heading,color.text.primary,"bold"),...headingFace(theme,"bold")},subtitle:text2(type.size.body,color.text.primary,"bold"),body:text2(type.size.body,color.text.secondary,"regular"),notice:{gap:space.xs},noticeText:text2(type.size.caption,color.errorRed,"regular"),retry:{minHeight:44,justifyContent:"center",alignSelf:"flex-start"},retryLabel:text2(type.size.caption,color.linkInk,"bold"),empty:{gap:space.xs,padding:space.lg,borderRadius:radius.lg,backgroundColor:color.surfaceSubtle},skeletonTitle:{height:28,width:"50%",borderRadius:radius.sm,backgroundColor:color.skeleton},skeletonCard:{height:160,borderRadius:radius.lg,backgroundColor:color.skeleton}})}function HealthPlanTopRisk(props){let guarded=guardHostProps(props,["onOpenPlan"]),theme=useEverfurTheme(),S=useMemo(()=>styles(theme),[theme]);/* @__PURE__ */
|
|
388
|
+
return jsxs(View,{style:[S.card,guarded.style],testID:"health-plan-top-risk",children:[
|
|
389
|
+
/* @__PURE__ */jsxs(View,{style:S.kickerRow,children:[
|
|
390
|
+
/* @__PURE__ */jsx(View,{style:S.dot}),
|
|
391
|
+
/* @__PURE__ */jsx(Text,{style:S.kicker,children:guarded.kicker})]}),
|
|
392
|
+
/* @__PURE__ */jsx(Text,{style:S.sentence,children:guarded.sentence}),
|
|
393
|
+
/* @__PURE__ */jsx(Pressable,{onPress:()=>guarded.onOpenPlan(),accessibilityRole:"button",accessibilityLabel:guarded.action,style:S.button,testID:"health-plan-top-risk-open",children:/* @__PURE__ */jsx(Text,{tier:"control",style:S.buttonLabel,children:guarded.action})})]})}function styles(theme){let{color:color,radius:radius,space:space,type:type}=theme;return StyleSheet.create({card:{gap:space.xs,alignItems:"flex-start",padding:space.md,borderRadius:radius.lg,backgroundColor:color.brandSofter},kickerRow:{flexDirection:"row",alignItems:"center",gap:space.xs},kicker:{...face(theme,"bold"),fontSize:type.size.caption,lineHeight:Math.round(type.size.caption*type.lineHeight.snug),color:color.text.secondary,textTransform:"uppercase",letterSpacing:type.size.caption*.06},dot:{width:8,height:8,borderRadius:4,backgroundColor:color.errorRed},sentence:{...face(theme,"bold"),fontSize:type.size.subtitle,lineHeight:Math.round(type.size.subtitle*type.lineHeight.snug),color:color.text.primary},button:{minHeight:40,justifyContent:"center",paddingHorizontal:space.md,borderRadius:999,backgroundColor:color.primary},buttonLabel:{...face(theme,"bold"),fontSize:type.size.caption,color:color.onPrimary}})}function useHealthPlanTopCard(options){let{petRef:petRef,enabled:enabled,onOpenPlan:onOpenPlan,copy:copy,renderIcon:renderIcon}=options,{page:page}=useHealthPlanPage({petRef:petRef,...enabled===void 0?{}:{enabled:enabled}});return useMemo(()=>healthPlanTopCard(page,{onOpenPlan:onOpenPlan,...copy===void 0?{}:{copy:copy},...renderIcon===void 0?{}:{renderIcon:renderIcon}}),[page,onOpenPlan,copy,renderIcon])}export{EverfurHealthPlan,HEALTH_PLAN_COPY,HEALTH_PLAN_COPY_PLACEHOLDERS,HEALTH_PLAN_FOCUS_COPY,HEALTH_PLAN_FOCUS_RN_COPY,HEALTH_PLAN_LAYOUT_DEFAULTS,HEALTH_PLAN_REASON_KINDS,HEALTH_PLAN_REASON_LABELS,HEALTH_PLAN_TEMPLATES,HEALTH_PLAN_TOP_CARD_COPY,HealthPlanBlanks,HealthPlanCartBar,HealthPlanCartScope,HealthPlanController,HealthPlanFocus,HealthPlanItemCard,HealthPlanScrollScope,HealthPlanTopRisk,createHealthPlanPageRepository,createHealthPlanPageRepositoryOver,createHealthPlanRepository,createHealthPlanRepositoryOver,createHealthPlanSubscriptionRepository,createHealthPlanSubscriptionRepositoryOver,formatHealthPlanDay,formatHealthPlanPrice,formatHealthPlanPriceWith,healthPlanBlanksFacts,healthPlanCart,healthPlanCheckoutRefusal,healthPlanCheckoutSessionFromWire,healthPlanCheckoutStateFromWire,healthPlanFocusCopyFor,healthPlanFocusDesignFromWire,healthPlanFromWire,healthPlanNextShotsAt,healthPlanNoVet,healthPlanOneBoxOrderFromWire,healthPlanOneBoxOrderPageFromWire,healthPlanOrderTrackingFromWire,healthPlanPageFromWire,healthPlanPetCopy,healthPlanPetWords,healthPlanPossessive,healthPlanRecordsWeightKg,healthPlanSubscriptionFromWire,healthPlanSubscriptionQuoteFromWire,healthPlanTopCard,isHealthPlanSessionRequired,isHealthPlanSubscriptionUnavailable,notifyHealthPlanRecordsLanded,onHealthPlanNoVet,onHealthPlanRecordsLanded,setHealthPlanNoVet,showHealthPlanCartBar,useEverfurHealthPlan,useEverfurHealthPlanRepository,useEverfurPresentation,useHealthPlanCartDock,useHealthPlanPage,useHealthPlanPageRepository,useHealthPlanSubscription,useHealthPlanSubscriptionRepository,useHealthPlanTopCard};
|