@everfur/sdk 1.4.0 → 1.4.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/dist/{Chat.d-D9n8tSDD.d.cts → Chat.d-Bl-_TsvQ.d.cts} +1 -1
- package/dist/{Chat.d-BXuEjJsg.d.ts → Chat.d-qQVN6VLp.d.ts} +1 -1
- package/dist/animations/index.cjs +1 -1
- package/dist/animations/index.js +1 -1
- package/dist/{attachments.d-Bsg6duaq.d.cts → attachments.d-DBlHzWYy.d.cts} +1 -1
- package/dist/{attachments.d-DjWUR-h9.d.ts → attachments.d-DOmkQ_8O.d.ts} +1 -1
- package/dist/{branding.d-Bzs4HJoN.d.cts → branding.d-CqDLKj1U.d.cts} +1 -1
- package/dist/{branding.d-CiC6xfGT.d.ts → branding.d-XrZYClN4.d.ts} +1 -1
- package/dist/chat/index.cjs +194 -194
- package/dist/chat/index.d.cts +7 -7
- package/dist/chat/index.d.ts +7 -7
- package/dist/chat/index.js +202 -202
- package/dist/chat/lite/index.cjs +205 -205
- package/dist/chat/lite/index.d.cts +7 -7
- package/dist/chat/lite/index.d.ts +7 -7
- package/dist/chat/lite/index.js +205 -205
- package/dist/{chatHandoffToken.d-sbumx0He.d.cts → chatHandoffToken.d-B4-iQ35P.d.cts} +3 -3
- package/dist/{chatHandoffToken.d-YJY6TZbj.d.ts → chatHandoffToken.d-Br3Gw3w-.d.ts} +3 -3
- package/dist/{checkin.d-DxpoRutq.d.cts → checkin.d-CAKQydg8.d.cts} +14 -2
- package/dist/{checkin.d-C6vh9KVr.d.ts → checkin.d-qvYXugN3.d.ts} +14 -2
- package/dist/{chunk-AJEELSFO.js → chunk-5OK2AF63.js} +14 -14
- package/dist/{chunk-II4QDD6F.js → chunk-6I4REU4U.js} +1 -1
- package/dist/{chunk-ZPIOCHKW.js → chunk-7MMJ7CYN.js} +1 -1
- package/dist/{chunk-FZ6DAQFH.js → chunk-PJHMKQ5C.js} +19 -19
- package/dist/client/index.cjs +2 -2
- package/dist/client/index.d.cts +7 -7
- package/dist/client/index.d.ts +7 -7
- package/dist/client/index.js +2 -2
- package/dist/consent/index.cjs +1 -1
- package/dist/consent/index.js +2 -2
- package/dist/{context.d-Cq2C4vdh.d.cts → context.d-DZfxKxNi.d.cts} +3 -3
- package/dist/{context.d-D1l56nFr.d.ts → context.d-FjU7dQP7.d.ts} +3 -3
- package/dist/core/index.cjs +21 -21
- package/dist/core/index.d.cts +10 -10
- package/dist/core/index.d.ts +10 -10
- package/dist/core/index.js +21 -21
- package/dist/{entitlementRepository.d-x2YFdgYD.d.ts → entitlementRepository.d-BltqS1W8.d.ts} +1 -1
- package/dist/{entitlementRepository.d-CEDU1gZE.d.cts → entitlementRepository.d-wfqpUIKN.d.cts} +1 -1
- package/dist/health-plan/index.cjs +1 -1
- package/dist/health-plan/index.d.cts +4 -4
- package/dist/health-plan/index.d.ts +4 -4
- package/dist/health-plan/index.js +1 -1
- package/dist/index.cjs +221 -221
- package/dist/index.d.cts +13 -13
- package/dist/index.d.ts +13 -13
- package/dist/index.js +221 -221
- package/dist/notifications/inbox/index.cjs +9 -9
- package/dist/notifications/inbox/index.js +9 -9
- package/dist/notifications/index.cjs +3 -3
- package/dist/notifications/index.d.cts +3 -3
- package/dist/notifications/index.d.ts +3 -3
- package/dist/notifications/index.js +6 -6
- package/dist/photo/index.cjs +1 -1
- package/dist/photo/index.js +23 -23
- package/dist/{presentation.d-CWGjwq8Z.d.cts → presentation.d-BkIvMtIl.d.cts} +3 -3
- package/dist/{presentation.d-CWGjwq8Z.d.ts → presentation.d-BkIvMtIl.d.ts} +3 -3
- package/dist/records/depth/index.cjs +1 -1
- package/dist/records/depth/index.js +1 -1
- package/dist/records/index.cjs +2 -2
- package/dist/records/index.d.cts +2 -2
- package/dist/records/index.d.ts +2 -2
- package/dist/records/index.js +71 -71
- package/dist/{route.d-IP_gkOWL.d.ts → route.d-B395-hNX.d.ts} +1 -1
- package/dist/{route.d-9wclfD-y.d.cts → route.d-DSSSpSB-.d.cts} +1 -1
- package/dist/{runtimeTypes.d-BdUe3tYs.d.ts → runtimeTypes.d-DAz0Tgw5.d.ts} +5 -5
- package/dist/{runtimeTypes.d-_UZ6rMUY.d.cts → runtimeTypes.d-DPh1Wh15.d.cts} +5 -5
- package/dist/server/events/index.cjs +3 -3
- package/dist/server/events/index.js +3 -3
- package/dist/server/index.cjs +8 -8
- package/dist/server/index.d.cts +15 -1
- package/dist/server/index.d.ts +15 -1
- package/dist/server/index.js +8 -8
- package/dist/slots/index.cjs +1 -1
- package/dist/slots/index.js +1 -1
- package/dist/tabs/index.cjs +2 -2
- package/dist/tabs/index.js +24 -24
- package/dist/televet/booking/index.cjs +51 -51
- package/dist/televet/booking/index.js +1 -1
- package/dist/televet/index.cjs +1 -1
- package/dist/televet/index.js +1 -1
- package/dist/testing/index.cjs +1 -1
- package/dist/testing/index.js +1 -1
- package/dist/testing/rn/index.cjs +8 -8
- package/dist/testing/rn/index.d.cts +5 -5
- package/dist/testing/rn/index.d.ts +5 -5
- package/dist/testing/rn/index.js +9 -9
- package/dist/testing/web/index.cjs +3 -3
- package/dist/testing/web/index.d.cts +5 -5
- package/dist/testing/web/index.d.ts +5 -5
- package/dist/testing/web/index.js +1 -1
- package/dist/texting/index.cjs +1 -1
- package/dist/texting/index.js +26 -26
- package/dist/{threadOptions.d-BW0rePcs.d.cts → threadOptions.d-DUQxxHyM.d.cts} +3 -3
- package/dist/{threadOptions.d-CrAb71J2.d.ts → threadOptions.d-DnM9UcMx.d.ts} +3 -3
- package/dist/{typeStyle.d-rzVzCfLz.d.ts → typeStyle.d-8mcLhtbH.d.ts} +1 -1
- package/dist/{typeStyle.d-B-YgiWcS.d.cts → typeStyle.d-CLrQZW-r.d.cts} +1 -1
- package/dist/{unreadStore.d-gCsleb6l.d.ts → unreadStore.d-CLnChKca.d.ts} +17 -9
- package/dist/{unreadStore.d-w5x6lEpR.d.cts → unreadStore.d-Donv4bcF.d.cts} +17 -9
- package/dist/{usePresentation.d-w5_oWKmh.d.ts → usePresentation.d-Buxz2Jkt.d.ts} +1 -1
- package/dist/{usePresentation.d-DefUwatV.d.cts → usePresentation.d-DUYzYXgA.d.cts} +1 -1
- package/dist/{useUnread.d-DeRDFtTb.d.cts → useUnread.d-7-cuCooM.d.cts} +3 -3
- package/dist/{useUnread.d-xDOpYyqx.d.ts → useUnread.d-B6Ehu0ao.d.ts} +3 -3
- package/dist/video/index.cjs +1 -1
- package/dist/video/index.js +1 -1
- package/dist/web/consent/index.cjs +3 -3
- package/dist/web/consent/index.js +5 -5
- package/dist/web/health-plan/index.cjs +2 -2
- package/dist/web/health-plan/index.d.cts +5 -5
- package/dist/web/health-plan/index.d.ts +5 -5
- package/dist/web/health-plan/index.js +1 -1
- package/dist/web/inbox/index.cjs +5 -5
- package/dist/web/inbox/index.js +5 -5
- package/dist/web/index.cjs +176 -176
- package/dist/web/index.d.cts +18 -18
- package/dist/web/index.d.ts +18 -18
- package/dist/web/index.js +181 -181
- package/dist/web/intro/index.cjs +10 -10
- package/dist/web/intro/index.js +6 -6
- package/dist/web/notifications/index.cjs +5 -5
- package/dist/web/notifications/index.d.cts +2 -2
- package/dist/web/notifications/index.d.ts +2 -2
- package/dist/web/notifications/index.js +1 -1
- package/dist/web/records/depth/index.cjs +1 -1
- package/dist/web/records/depth/index.js +1 -1
- package/dist/web/records/index.cjs +1 -1
- package/dist/web/records/index.js +1 -1
- package/dist/web/records-sheet/index.cjs +2 -2
- package/dist/web/records-sheet/index.js +2 -2
- package/dist/web/shop/index.cjs +1 -1
- package/dist/web/shop/index.js +15 -15
- package/dist/web/televet/booking/index.cjs +2 -2
- package/dist/web/televet/booking/index.js +64 -64
- package/dist/web/televet/call/index.cjs +1 -1
- package/dist/web/televet/call/index.js +1 -1
- package/dist/web/televet/index.cjs +6 -6
- package/dist/web/televet/index.js +1 -1
- package/dist/web/texting/index.cjs +1 -1
- package/dist/web/texting/index.js +1 -1
- package/dist/web/ui/index.cjs +1 -1
- package/dist/web/ui/index.js +33 -33
- package/package.json +1 -1
package/dist/slots/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import{createContext,forwardRef as e,createElement as t,useMemo as i,useContext as r,useState as n,useEffect as l,useSyncExternalStore as o,useRef as a,useCallback as s,Component as c,Fragment as d}from"react";import{StyleSheet as u,TextInput as p,View as h,Pressable as g,Text as f,Linking as m,useWindowDimensions as b,ScrollView as y,Platform as w,AccessibilityInfo as v,I18nManager as k,Animated as x,Easing as T,Image as I,ActivityIndicator as S}from"react-native";import{jsx as z,jsxs as D,Fragment as C}from"react/jsx-runtime";var H=/* @__PURE__ */Object.freeze({"plan.needs":"list","plan.tips":"list","plan.items":"list","cart.lines":"list","cart.summary":"item","orders.recent":"list"});function F(e){return Object.prototype.hasOwnProperty.call(H,e)}function _(e){if(e===void 0)return null;let t=e.indexOf(":");if(t<=0)return null;let i=e.slice(0,t),r=e.slice(t+1);return r===""?null:i==="data"?F(r)?{kind:i,name:r}:null:i==="item"||i==="copy"?{kind:i,name:r}:null}function O(e){let t=/* @__PURE__ */new Set,i=e=>{let i=_(e);i?.kind==="data"&&t.add(i.name)};for(let t of e){i(t.repeat),i(t.visibleIf?.source);for(let e of Object.values(t.bind))i(e)}return t}function ok(e,t){/* @__PURE__ */
|
|
3
3
|
return Object.freeze({ok:true,value:e})}function err(e){/* @__PURE__ */
|
|
4
4
|
return Object.freeze({ok:false,error:e})}var E=class _EverfurConfigError extends Error{constructor(e,t){super(t),this.name="EverfurConfigError",this.kind=e,Object.setPrototypeOf(this,_EverfurConfigError.prototype)}};var P=/* @__PURE__ */Symbol.for("@everfur/sdk#EverfurContext@v1"),L=globalThis,B=L[P]??(L[P]=createContext(null));B.displayName??="EverfurContext";function A(){let e=r(B);if(e===null)throw new E("not-initialized","Everfur hooks must be called inside <EverfurProvider>. Wrap your tree once, high.");return e}var R=()=>()=>{},j=()=>null;function $(e,t){return o(t?.subscribe??R,t?.get??j,t?.get??j)??e}var W=/* @__PURE__ */Object.freeze({chatAnswerStyle:"cards",chatHistoryStyle:"sheet",chatTopCard:"focus",chatFollowUpCount:3,chatFollowUpsExcludeTelevet:false,chatComposerMic:true,chatComposerUpload:true,safetyDisclaimerPlacement:"composer",healthPlanLayout:"focus_plan",recordsTopRiskLine:true,recordsClearResultsFilter:true,chatComposerStyle:"compact",chatComposerPlaceholder:"pet_name",chatHistoryBar:"scroll",chatGeneralBanner:true,chatSendButton:"always_dark",chatTextingAsk:true,serverSlots:false}),M=/* @__PURE__ */Object.freeze({chatAnswerStyle:"chat_answer_style",chatHistoryStyle:"chat_history_style",chatTopCard:"chat_top_card",chatFollowUpCount:"chat_follow_up_count",chatFollowUpsExcludeTelevet:"chat_follow_ups_exclude_televet",chatComposerMic:"chat_composer_mic",chatComposerUpload:"chat_composer_upload",safetyDisclaimerPlacement:"safety_disclaimer_placement",healthPlanLayout:"health_plan_layout",recordsTopRiskLine:"records_top_risk_line",recordsClearResultsFilter:"records_clear_results_filter",chatComposerStyle:"chat_composer_style",chatComposerPlaceholder:"chat_composer_placeholder",chatHistoryBar:"chat_history_bar",chatGeneralBanner:"chat_general_banner",chatSendButton:"chat_send_button",chatTextingAsk:"chat_texting_ask",serverSlots:"server_slots"}),N=Object.keys(M),G="presentation",q="presentation.";var U={chatAnswerStyle:["bubbles","cards"],chatHistoryStyle:["drawer","sheet"],chatTopCard:["none","focus"],safetyDisclaimerPlacement:["composer","answer_footer","none"],healthPlanLayout:["standard","focus_plan"],chatComposerStyle:["standard","compact"],chatComposerPlaceholder:["generic","pet_name"],chatHistoryBar:["pinned","scroll"],chatSendButton:["always_dark","dim_when_empty"]},V=/* @__PURE__ */new Set(["chatFollowUpsExcludeTelevet","chatComposerMic","chatComposerUpload","recordsTopRiskLine","recordsClearResultsFilter","chatGeneralBanner","chatTextingAsk","serverSlots"]);function Y(e,t){if(t==null)return;let i=U[e];return i!==void 0?typeof t=="string"&&i.includes(t)?t:void 0:V.has(e)?typeof t=="boolean"?t:void 0:typeof t=="number"&&Number.isInteger(t)&&t>=0&&t<=3?t:void 0}function parsePresentation(e){if(e===null||typeof e!="object"||Array.isArray(e))return null;let t=e,i={};for(let e of N){let r=M[e],n=Object.prototype.hasOwnProperty.call(t,r)?t[r]:t[e],l=Y(e,n);l!==void 0&&(i[e]=l)}return Object.keys(i).length===0?null:/* @__PURE__ */Object.freeze(i)}function isPresentationFieldLocked(e,t){if(t==null)return false;let i=`${q}${M[e]}`;for(let e of t)if(e===G||e===i)return true;return false}function resolvePresentation(e){let t=parsePresentation(e?.server??null)??{},{safetyDisclaimerPlacement:i,...r}=t,n=i==="none"||i===void 0?r:{...r,safetyDisclaimerPlacement:i},l=parsePresentation(e?.client??null)??{},o=e?.locked?[...e.locked]:null,a={};for(let e of N){let t=n[e],i=isPresentationFieldLocked(e,o)?void 0:l[e];a[e]=i??t??W[e]}/* @__PURE__ */
|
|
5
|
-
return Object.freeze(a)}var X=/* @__PURE__ */Object.freeze({branding:null}),K=/* @__PURE__ */Object.freeze({subscribe:()=>()=>{},getSnapshot:()=>X});function Q(e){return e?Object.keys(e).sort().map(t=>`${t}=${String(e[t])}`).join("&"):""}function useEverfurPresentation(e){return J(e).presentation}function J(e){let{runtime:t}=A(),r=t?.entitlements??K,n=s(()=>r.getSnapshot()?.branding??null,[r]),l=$(o(r.subscribe,n,n),t?.sdkConfigHost?.branding),a=Q(e);return i(()=>{let t=l?.lockedFields??null;return{presentation:resolvePresentation({server:l?.presentation??null,locked:t,client:e??null}),isLocked:e=>isPresentationFieldLocked(e,t)}},[l,a])}var Z=/* @__PURE__ */Symbol.for("@everfur/sdk#SlotSwitchContext@v1"),ee=globalThis,te=ee[Z]??(ee[Z]=createContext(null));te.displayName??="EverfurSlotSwitch";function ie(e){let t=r(te),i=useEverfurPresentation(e===void 0?void 0:{serverSlots:e}).serverSlots;return e!==void 0||t===null?i:t}var re=[{wireCode:"AccessDeniedException",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"AuthorizationException",envelope:"http_envelope",httpStatus:401,retryable:false},{wireCode:"ConflictException",envelope:"http_envelope",httpStatus:409,retryable:true},{wireCode:"DAILY_QUOTA_EXCEEDED",envelope:"http_envelope",httpStatus:429,retryable:true},{wireCode:"FILE_TOO_LARGE",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"IDEMPOTENCY_KEY_IN_FLIGHT",envelope:"http_envelope",httpStatus:409,retryable:true},{wireCode:"IDEMPOTENCY_KEY_REUSED_DIFFERENT_REQUEST",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"INVALID_CONTENT_TYPE",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"InternalFailureException",envelope:"http_envelope",httpStatus:500,retryable:true},{wireCode:"MethodNotAllowedException",envelope:"http_envelope",httpStatus:405,retryable:false},{wireCode:"NotImplementedException",envelope:"http_envelope",httpStatus:501,retryable:false},{wireCode:"PaymentRequiredException",envelope:"http_envelope",httpStatus:402,retryable:false},{wireCode:"ResourceNotFoundException",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"ServiceUnavailableException",envelope:"http_envelope",httpStatus:503,retryable:true},{wireCode:"TIER_UPGRADE_REQUIRED",envelope:"http_envelope",httpStatus:402,retryable:false},{wireCode:"ThrottlingException",envelope:"http_envelope",httpStatus:429,retryable:true},{wireCode:"ValidationException",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"accessDenied",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"access_denied",envelope:"oauth_error",httpStatus:302,retryable:false},{wireCode:"anchor_not_found",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"anchor_ref_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"anonTokenInvalid",envelope:"http_envelope",httpStatus:401,retryable:false},{wireCode:"attachment_unreadable",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"authExpired",envelope:"http_envelope",httpStatus:401,retryable:true},{wireCode:"authRejected",envelope:"http_envelope",httpStatus:401,retryable:false},{wireCode:"before_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"bundle_mismatch",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"bundle_not_uploaded",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"bundles_unavailable",envelope:"http_envelope",httpStatus:503,retryable:true},{wireCode:"catalog_empty_refused",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"catalog_shrink_refused",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"consent_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"consent_required",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"consent_scope_wrong_route",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"device_cipher_unavailable",envelope:"http_envelope",httpStatus:503,retryable:true},{wireCode:"email_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"endpoint_not_allowed",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"environment_mismatch",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"event_cursor_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"event_filter_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"event_id_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"event_payload_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"event_type_not_available",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"event_type_unknown",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"idempotency_key_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"idempotency_key_required",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"idempotency_key_reused",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"inbox_cursor_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"insufficientCapability",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"insufficient_scope",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"internal_error",envelope:"sse_frame",httpStatus:200,retryable:false},{wireCode:"invalidRequest",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"invalid_client",envelope:"oauth_error",httpStatus:401,retryable:false},{wireCode:"invalid_client_metadata",envelope:"oauth_error",httpStatus:400,retryable:false},{wireCode:"invalid_grant",envelope:"oauth_error",httpStatus:400,retryable:false},{wireCode:"invalid_redirect_uri",envelope:"oauth_error",httpStatus:400,retryable:false},{wireCode:"invalid_request",envelope:"oauth_error",httpStatus:400,retryable:false},{wireCode:"invalid_scope",envelope:"oauth_error",httpStatus:400,retryable:false},{wireCode:"invalid_target",envelope:"oauth_error",httpStatus:400,retryable:false},{wireCode:"item_id_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"linked_account_read_only",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"mcp_connection_not_found",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"mcp_request_conflict",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"mcp_request_gone",envelope:"http_envelope",httpStatus:410,retryable:false},{wireCode:"mcp_request_not_found",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"not_found",envelope:"sse_frame",httpStatus:200,retryable:false},{wireCode:"not_found",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"open_url_not_allowed",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"partner_visit_link_conflict",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"partner_visit_owner_only",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"partner_visit_pet_already_mapped",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"payload_too_large",envelope:"http_envelope",httpStatus:413,retryable:false},{wireCode:"petRefInUse",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"pet_health_list_removals_unconfirmed",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"pet_health_species_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"pet_not_registered",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"provider_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"rateLimited",envelope:"http_envelope",httpStatus:429,retryable:true},{wireCode:"read_target_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"record_species_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"record_subject_not_found",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"record_upload_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"records_consent_required",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"restricted_key",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"sandbox_only",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"session_required",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"session_revoked",envelope:"http_envelope",httpStatus:401,retryable:false},{wireCode:"share_limit_reached",envelope:"http_envelope",httpStatus:429,retryable:false},{wireCode:"slow_down",envelope:"oauth_error",httpStatus:429,retryable:true},{wireCode:"species_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"subscription_keys_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"tenant_filter_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"tenant_has_no_capabilities",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"tenant_resource_not_found",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"tenant_surface_not_enabled",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"ticket_not_resolved",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"tickets_disabled",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"timeout",envelope:"sse_frame",httpStatus:200,retryable:true},{wireCode:"token_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"unavailable",envelope:"sse_frame",httpStatus:200,retryable:true},{wireCode:"unavailable",envelope:"http_envelope",httpStatus:503,retryable:true},{wireCode:"unrestrictedKeyRequired",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"unsupported_grant_type",envelope:"oauth_error",httpStatus:400,retryable:false},{wireCode:"unsupported_response_type",envelope:"oauth_error",httpStatus:302,retryable:false},{wireCode:"user_ref_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"verify_mint_rate_limited",envelope:"http_envelope",httpStatus:429,retryable:true},{wireCode:"verify_mint_refused",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"verify_mint_unavailable",envelope:"http_envelope",httpStatus:503,retryable:true},{wireCode:"verify_user_ref_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"web_push_unavailable",envelope:"http_envelope",httpStatus:503,retryable:true},{wireCode:"webhook_endpoint_update_empty",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"webhook_endpoint_update_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"webhook_url_rejected",envelope:"http_envelope",httpStatus:400,retryable:false}],ne=/* @__PURE__ */Object.freeze(re.map(e=>/* @__PURE__ */Object.freeze(e)));/* @__PURE__ */Object.freeze(ne.map(e=>e.wireCode));var le=/* @__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",anonTokenInvalid:"authRejected",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",endpoint_not_allowed:"validationFailed",event_id_invalid:"validationFailed",inbox_cursor_invalid:"validationFailed",item_id_invalid:"validationFailed",open_url_not_allowed:"validationFailed",read_target_invalid:"validationFailed",subscription_keys_invalid:"validationFailed",web_push_unavailable:"serviceUnavailable",anchor_not_found:"resourceNotFound",anchor_ref_invalid:"validationFailed",before_invalid:"validationFailed",bundle_mismatch:"validationFailed",bundle_not_uploaded:"validationFailed",bundles_unavailable:"serviceUnavailable",environment_mismatch:"validationFailed",restricted_key:"accessDenied",ticket_not_resolved:"conflict",tickets_disabled:"resourceNotFound"}),oe=/* @__PURE__ */Object.freeze(ne.map(e=>/* @__PURE__ */Object.freeze({wireCode:e.wireCode,envelope:e.envelope,retryable:e.retryable,normalized:le[e.wireCode]}))),ae=new Map(oe.map(e=>[e.envelope+e.wireCode.toUpperCase(),e])),se=/* @__PURE__ */Object.freeze(["http_envelope",...[...new Set(oe.map(e=>e.envelope))].filter(e=>e!=="http_envelope").sort()]);function contractErrorFor(e,t){if(typeof e!="string")return;let i=e.trim().toUpperCase();if(i.length!==0)for(let e of[t??"http_envelope",...se]){let t=ae.get(e+i);if(t)return t}}var ce=/* @__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(e){return ce[e]}function fromWire(e){let t=contractErrorFor(e);if(t)return t.normalized;let i=(e??"").trim().toUpperCase(),r=i.replace(/[^A-Z0-9]/g,"");if(r==="AUTHREJECTED")return"authRejected";if(i.startsWith("AUTH"))return"authExpired";switch(r){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"FREECAPREACHED":return"paymentRequired";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 de=/* @__PURE__ */new Set(["streamTimeout","rateLimited","internalError","upstreamLlmTimeout","streamIncomplete"]);function isAutoRetryable(e){return de.has(e)}var ue=/* @__PURE__ */new Set(["serviceUnavailable","conflict","idempotencyInFlight"]);function isRetryableCode(e){return isAutoRetryable(e)||ue.has(e)}var pe=500,he=8e3,ge=4;function backoffDelayMs(e,t=Math.random){let i=Math.max(0,e),r=Math.min(pe*2**i,he);return Math.floor(t()*r)}var fe="This feature isn't available on your account right now.",me="Something in that request was not right. Check the details and try again.",be=/* @__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:fe,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:me,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:fe,runtimeDisposed:me,unknown:"Something went wrong. Please try again."}),ye="This session has ended. Please sign in again.",we="linked_account_read_only";function ve(e,t,i){return e==="conflict"&&i===we?fe:(e==="authRejected"||e==="authExpired")&&typeof t=="string"&&t.trim().toLowerCase()==="session_revoked"?ye:userFacingError(e)}function userFacingError(e){return be[e]}function ke(e,t,i){Object.defineProperty(e,t,{value:i,enumerable:false,writable:false,configurable:false})}var xe=/^[a-z][a-z0-9_]{0,63}$/;function makeEverfurError(e,t){let i=contractErrorFor(t?.wireCode,t?.wireEnvelope),r=e==="conflict"&&t?.reasonCode===we,n={code:e,category:categoryFor(e),retryable:t?.retryable??(r?false:isRetryableCode(e)),displayMessage:ve(e,t?.wireCode,r?we:null)};t?.httpStatus!==void 0&&(n.httpStatus=t.httpStatus),t?.requestId&&(n.requestId=t.requestId),typeof t?.reasonCode=="string"&&xe.test(t.reasonCode)&&(n.reasonCode=t.reasonCode);let l=t?.retryAfterSeconds;if(typeof l=="number"&&Number.isFinite(l)&&l>=0&&(n.retryAfterSeconds=Math.round(l)),i);return t?.wireMessage&&ke(n,"wireMessage",t.wireMessage),t?.raw!==void 0&&t.raw!==null&&ke(n,"raw",t.raw),/* @__PURE__ */Object.freeze(n)}function Te(e){return e!=null&&(e.httpStatus===404||e.category==="notFound")}function Ie(e){return e.code!=="conversationNotFound"?e:makeEverfurError("resourceNotFound",{retryable:false,...e.httpStatus===void 0?{}:{httpStatus:e.httpStatus},...e.requestId===void 0?{}:{requestId:e.requestId},...e.reasonCode===void 0?{}:{reasonCode:e.reasonCode},...e.wireMessage===void 0?{}:{wireMessage:e.wireMessage},...e.raw===void 0?{}:{raw:e.raw}})}function Se(e){return e.ok?e:err(Ie(e.error))}function ze(e){return{send:async(...t)=>Se(await e.send(...t)),authorize:t=>e.authorize(t),stream:(t,i,r)=>e.stream(t,i,r)}}var De=/* @__PURE__ */Object.freeze({phase:"idle",petRef:null,plan:null,pending:/* @__PURE__ */Object.freeze([]),itemErrors:/* @__PURE__ */Object.freeze({}),error:null});function Ce(e,t,i){let r=e.items.map(e=>e.productId===t?/* @__PURE__ */Object.freeze({...e,inPlan:i}):e);/* @__PURE__ */
|
|
5
|
+
return Object.freeze(a)}var X=/* @__PURE__ */Object.freeze({branding:null}),K=/* @__PURE__ */Object.freeze({subscribe:()=>()=>{},getSnapshot:()=>X});function Q(e){return e?Object.keys(e).sort().map(t=>`${t}=${String(e[t])}`).join("&"):""}function useEverfurPresentation(e){return J(e).presentation}function J(e){let{runtime:t}=A(),r=t?.entitlements??K,n=s(()=>r.getSnapshot()?.branding??null,[r]),l=$(o(r.subscribe,n,n),t?.sdkConfigHost?.branding),a=Q(e);return i(()=>{let t=l?.lockedFields??null;return{presentation:resolvePresentation({server:l?.presentation??null,locked:t,client:e??null}),isLocked:e=>isPresentationFieldLocked(e,t)}},[l,a])}var Z=/* @__PURE__ */Symbol.for("@everfur/sdk#SlotSwitchContext@v1"),ee=globalThis,te=ee[Z]??(ee[Z]=createContext(null));te.displayName??="EverfurSlotSwitch";function ie(e){let t=r(te),i=useEverfurPresentation(e===void 0?void 0:{serverSlots:e}).serverSlots;return e!==void 0||t===null?i:t}var re=[{wireCode:"AccessDeniedException",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"AuthorizationException",envelope:"http_envelope",httpStatus:401,retryable:false},{wireCode:"ConflictException",envelope:"http_envelope",httpStatus:409,retryable:true},{wireCode:"DAILY_QUOTA_EXCEEDED",envelope:"http_envelope",httpStatus:429,retryable:true},{wireCode:"FILE_TOO_LARGE",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"IDEMPOTENCY_KEY_IN_FLIGHT",envelope:"http_envelope",httpStatus:409,retryable:true},{wireCode:"IDEMPOTENCY_KEY_REUSED_DIFFERENT_REQUEST",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"INVALID_CONTENT_TYPE",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"InternalFailureException",envelope:"http_envelope",httpStatus:500,retryable:true},{wireCode:"MethodNotAllowedException",envelope:"http_envelope",httpStatus:405,retryable:false},{wireCode:"NotImplementedException",envelope:"http_envelope",httpStatus:501,retryable:false},{wireCode:"PaymentRequiredException",envelope:"http_envelope",httpStatus:402,retryable:false},{wireCode:"ResourceNotFoundException",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"ServiceUnavailableException",envelope:"http_envelope",httpStatus:503,retryable:true},{wireCode:"TIER_UPGRADE_REQUIRED",envelope:"http_envelope",httpStatus:402,retryable:false},{wireCode:"ThrottlingException",envelope:"http_envelope",httpStatus:429,retryable:true},{wireCode:"ValidationException",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"accessDenied",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"access_denied",envelope:"oauth_error",httpStatus:302,retryable:false},{wireCode:"anchor_not_found",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"anchor_ref_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"anonTokenInvalid",envelope:"http_envelope",httpStatus:401,retryable:false},{wireCode:"attachment_unreadable",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"authExpired",envelope:"http_envelope",httpStatus:401,retryable:true},{wireCode:"authRejected",envelope:"http_envelope",httpStatus:401,retryable:false},{wireCode:"before_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"bundle_mismatch",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"bundle_not_uploaded",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"bundles_unavailable",envelope:"http_envelope",httpStatus:503,retryable:true},{wireCode:"catalog_empty_refused",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"catalog_shrink_refused",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"consent_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"consent_required",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"consent_scope_wrong_route",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"device_cipher_unavailable",envelope:"http_envelope",httpStatus:503,retryable:true},{wireCode:"email_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"endpoint_not_allowed",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"environment_mismatch",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"event_cursor_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"event_filter_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"event_id_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"event_payload_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"event_type_not_available",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"event_type_unknown",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"idempotency_key_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"idempotency_key_required",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"idempotency_key_reused",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"inbox_cursor_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"insufficientCapability",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"insufficient_scope",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"internal_error",envelope:"sse_frame",httpStatus:200,retryable:false},{wireCode:"invalidRequest",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"invalid_client",envelope:"oauth_error",httpStatus:401,retryable:false},{wireCode:"invalid_client_metadata",envelope:"oauth_error",httpStatus:400,retryable:false},{wireCode:"invalid_grant",envelope:"oauth_error",httpStatus:400,retryable:false},{wireCode:"invalid_redirect_uri",envelope:"oauth_error",httpStatus:400,retryable:false},{wireCode:"invalid_request",envelope:"oauth_error",httpStatus:400,retryable:false},{wireCode:"invalid_scope",envelope:"oauth_error",httpStatus:400,retryable:false},{wireCode:"invalid_target",envelope:"oauth_error",httpStatus:400,retryable:false},{wireCode:"item_id_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"linked_account_read_only",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"mcp_connection_not_found",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"mcp_request_conflict",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"mcp_request_gone",envelope:"http_envelope",httpStatus:410,retryable:false},{wireCode:"mcp_request_not_found",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"not_found",envelope:"sse_frame",httpStatus:200,retryable:false},{wireCode:"not_found",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"open_url_not_allowed",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"partner_visit_link_conflict",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"partner_visit_owner_only",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"partner_visit_pet_already_mapped",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"payload_too_large",envelope:"http_envelope",httpStatus:413,retryable:false},{wireCode:"petRefInUse",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"pet_health_list_removals_unconfirmed",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"pet_health_species_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"pet_not_registered",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"provider_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"rateLimited",envelope:"http_envelope",httpStatus:429,retryable:true},{wireCode:"read_target_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"record_species_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"record_subject_not_found",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"record_upload_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"records_consent_required",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"restricted_key",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"sandbox_only",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"session_required",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"session_revoked",envelope:"http_envelope",httpStatus:401,retryable:false},{wireCode:"share_limit_reached",envelope:"http_envelope",httpStatus:429,retryable:false},{wireCode:"slow_down",envelope:"oauth_error",httpStatus:429,retryable:true},{wireCode:"species_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"subscription_keys_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"tenant_filter_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"tenant_has_no_capabilities",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"tenant_resource_not_found",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"tenant_surface_not_enabled",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"ticket_not_resolved",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"tickets_disabled",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"timeout",envelope:"sse_frame",httpStatus:200,retryable:true},{wireCode:"timezone_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"token_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"unavailable",envelope:"sse_frame",httpStatus:200,retryable:true},{wireCode:"unavailable",envelope:"http_envelope",httpStatus:503,retryable:true},{wireCode:"unrestrictedKeyRequired",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"unsupported_grant_type",envelope:"oauth_error",httpStatus:400,retryable:false},{wireCode:"unsupported_response_type",envelope:"oauth_error",httpStatus:302,retryable:false},{wireCode:"user_ref_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"verify_mint_rate_limited",envelope:"http_envelope",httpStatus:429,retryable:true},{wireCode:"verify_mint_refused",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"verify_mint_unavailable",envelope:"http_envelope",httpStatus:503,retryable:true},{wireCode:"verify_user_ref_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"web_push_unavailable",envelope:"http_envelope",httpStatus:503,retryable:true},{wireCode:"webhook_endpoint_update_empty",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"webhook_endpoint_update_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"webhook_url_rejected",envelope:"http_envelope",httpStatus:400,retryable:false}],ne=/* @__PURE__ */Object.freeze(re.map(e=>/* @__PURE__ */Object.freeze(e)));/* @__PURE__ */Object.freeze(ne.map(e=>e.wireCode));var le=/* @__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",anonTokenInvalid:"authRejected",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",endpoint_not_allowed:"validationFailed",event_id_invalid:"validationFailed",inbox_cursor_invalid:"validationFailed",item_id_invalid:"validationFailed",open_url_not_allowed:"validationFailed",read_target_invalid:"validationFailed",subscription_keys_invalid:"validationFailed",web_push_unavailable:"serviceUnavailable",anchor_not_found:"resourceNotFound",anchor_ref_invalid:"validationFailed",before_invalid:"validationFailed",bundle_mismatch:"validationFailed",bundle_not_uploaded:"validationFailed",bundles_unavailable:"serviceUnavailable",environment_mismatch:"validationFailed",restricted_key:"accessDenied",ticket_not_resolved:"conflict",tickets_disabled:"resourceNotFound",timezone_invalid:"validationFailed"}),oe=/* @__PURE__ */Object.freeze(ne.map(e=>/* @__PURE__ */Object.freeze({wireCode:e.wireCode,envelope:e.envelope,retryable:e.retryable,normalized:le[e.wireCode]}))),ae=new Map(oe.map(e=>[e.envelope+e.wireCode.toUpperCase(),e])),se=/* @__PURE__ */Object.freeze(["http_envelope",...[...new Set(oe.map(e=>e.envelope))].filter(e=>e!=="http_envelope").sort()]);function contractErrorFor(e,t){if(typeof e!="string")return;let i=e.trim().toUpperCase();if(i.length!==0)for(let e of[t??"http_envelope",...se]){let t=ae.get(e+i);if(t)return t}}var ce=/* @__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(e){return ce[e]}function fromWire(e){let t=contractErrorFor(e);if(t)return t.normalized;let i=(e??"").trim().toUpperCase(),r=i.replace(/[^A-Z0-9]/g,"");if(r==="AUTHREJECTED")return"authRejected";if(i.startsWith("AUTH"))return"authExpired";switch(r){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"FREECAPREACHED":return"paymentRequired";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 de=/* @__PURE__ */new Set(["streamTimeout","rateLimited","internalError","upstreamLlmTimeout","streamIncomplete"]);function isAutoRetryable(e){return de.has(e)}var ue=/* @__PURE__ */new Set(["serviceUnavailable","conflict","idempotencyInFlight"]);function isRetryableCode(e){return isAutoRetryable(e)||ue.has(e)}var pe=500,he=8e3,ge=4;function backoffDelayMs(e,t=Math.random){let i=Math.max(0,e),r=Math.min(pe*2**i,he);return Math.floor(t()*r)}var fe="This feature isn't available on your account right now.",me="Something in that request was not right. Check the details and try again.",be=/* @__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:fe,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:me,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:fe,runtimeDisposed:me,unknown:"Something went wrong. Please try again."}),ye="This session has ended. Please sign in again.",we="linked_account_read_only";function ve(e,t,i){return e==="conflict"&&i===we?fe:(e==="authRejected"||e==="authExpired")&&typeof t=="string"&&t.trim().toLowerCase()==="session_revoked"?ye:userFacingError(e)}function userFacingError(e){return be[e]}function ke(e,t,i){Object.defineProperty(e,t,{value:i,enumerable:false,writable:false,configurable:false})}var xe=/^[a-z][a-z0-9_]{0,63}$/;function makeEverfurError(e,t){let i=contractErrorFor(t?.wireCode,t?.wireEnvelope),r=e==="conflict"&&t?.reasonCode===we,n={code:e,category:categoryFor(e),retryable:t?.retryable??(r?false:isRetryableCode(e)),displayMessage:ve(e,t?.wireCode,r?we:null)};t?.httpStatus!==void 0&&(n.httpStatus=t.httpStatus),t?.requestId&&(n.requestId=t.requestId),typeof t?.reasonCode=="string"&&xe.test(t.reasonCode)&&(n.reasonCode=t.reasonCode);let l=t?.retryAfterSeconds;if(typeof l=="number"&&Number.isFinite(l)&&l>=0&&(n.retryAfterSeconds=Math.round(l)),i);return t?.wireMessage&&ke(n,"wireMessage",t.wireMessage),t?.raw!==void 0&&t.raw!==null&&ke(n,"raw",t.raw),/* @__PURE__ */Object.freeze(n)}function Te(e){return e!=null&&(e.httpStatus===404||e.category==="notFound")}function Ie(e){return e.code!=="conversationNotFound"?e:makeEverfurError("resourceNotFound",{retryable:false,...e.httpStatus===void 0?{}:{httpStatus:e.httpStatus},...e.requestId===void 0?{}:{requestId:e.requestId},...e.reasonCode===void 0?{}:{reasonCode:e.reasonCode},...e.wireMessage===void 0?{}:{wireMessage:e.wireMessage},...e.raw===void 0?{}:{raw:e.raw}})}function Se(e){return e.ok?e:err(Ie(e.error))}function ze(e){return{send:async(...t)=>Se(await e.send(...t)),authorize:t=>e.authorize(t),stream:(t,i,r)=>e.stream(t,i,r)}}var De=/* @__PURE__ */Object.freeze({phase:"idle",petRef:null,plan:null,pending:/* @__PURE__ */Object.freeze([]),itemErrors:/* @__PURE__ */Object.freeze({}),error:null});function Ce(e,t,i){let r=e.items.map(e=>e.productId===t?/* @__PURE__ */Object.freeze({...e,inPlan:i}):e);/* @__PURE__ */
|
|
6
6
|
return Object.freeze({...e,items:/* @__PURE__ */Object.freeze(r)})}var He=class{constructor(e){this.repository=e;this.snapshot=De;this.listeners=/* @__PURE__ */new Set;this.generation=0;this.writes=0;this.revalidations=0;this.refreshAfterWrites=false;this.disposed=false;this.subscribe=e=>(this.listeners.add(e),()=>{this.listeners.delete(e)});this.getSnapshot=()=>this.snapshot}set(e){if(!this.disposed){this.snapshot=/* @__PURE__ */Object.freeze({...this.snapshot,...e});for(let e of this.listeners)e()}}async load(petRef){let e=++this.generation;if(this.refreshAfterWrites=false,petRef===null){this.set({...De});return}let t=this.snapshot.petRef===petRef;this.set({phase:"loading",petRef:petRef,plan:t?this.snapshot.plan:null,pending:/* @__PURE__ */Object.freeze([]),itemErrors:t?this.snapshot.itemErrors:/* @__PURE__ */Object.freeze({}),error:null});let i=await this.repository.read(petRef);if(e===this.generation){if(!i.ok){this.set({phase:"failed",error:i.error});return}this.set({phase:"ready",plan:i.value,error:null,itemErrors:/* @__PURE__ */Object.freeze({})})}}async revalidate(){let{phase:e,petRef:petRef,pending:t}=this.snapshot;if(e!=="ready"||petRef===null||t.length>0)return;let i=this.generation,r=this.writes,n=++this.revalidations,l=await this.repository.read(petRef);i!==this.generation||r!==this.writes||n!==this.revalidations||this.snapshot.pending.length>0||this.snapshot.petRef!==petRef||l.ok&&this.set({plan:l.value,itemErrors:/* @__PURE__ */Object.freeze({})})}async refresh(){let{phase:e,petRef:petRef,pending:t}=this.snapshot;if(!(petRef===null||e==="idle")){if(e!=="ready")return this.load(petRef);if(t.length>0){this.refreshAfterWrites=true;return}return this.revalidate()}}settleWrite(){!this.refreshAfterWrites||this.snapshot.pending.length>0||(this.refreshAfterWrites=false,this.revalidate())}async setInPlan(e,t){let{plan:i,petRef:petRef,pending:r}=this.snapshot;if(this.snapshot.phase!=="ready"||i===null||petRef===null||r.includes(e))return false;let n=i.items.find(t=>t.productId===e);if(n===void 0||n.inPlan===t)return false;this.writes+=1;let l=this.generation,o=Object.fromEntries(Object.entries(this.snapshot.itemErrors).filter(([t])=>t!==e));this.set({plan:Ce(i,e,t),pending:/* @__PURE__ */Object.freeze([...r,e]),itemErrors:/* @__PURE__ */Object.freeze(o)});let a=t?await this.repository.addItem(petRef,e):await this.repository.removeItem(petRef,e);if(l!==this.generation)return a.ok;let s=this.snapshot.plan??i,c=/* @__PURE__ */Object.freeze(this.snapshot.pending.filter(t=>t!==e));if(!a.ok)return this.set({plan:Ce(s,e,n.inPlan),pending:c,itemErrors:/* @__PURE__ */Object.freeze({...this.snapshot.itemErrors,[e]:a.error})}),this.settleWrite(),false;let d=a.value??s;for(let e of c){let t=s.items.find(t=>t.productId===e);t!==void 0&&(d=Ce(d,e,t.inPlan))}return this.set({plan:d,pending:c}),this.settleWrite(),true}dispose(){this.generation+=1,this.disposed=true,this.listeners.clear()}};async function Fe(e,petRef,t){if(e.listOneBoxOrderPage!==void 0)return e.listOneBoxOrderPage(petRef,{limit:20,...{}});if(e.listOneBoxOrders===void 0)return{ok:true,value:{orders:[],nextCursor:null}};let i=await e.listOneBoxOrders(petRef);return i.ok?{ok:true,value:{orders:i.value,nextCursor:null}}:i}function errorFrame(e){/* @__PURE__ */
|
|
7
7
|
return Object.freeze({kind:"error",terminal:true,code:e.code,retryable:e.retryable,wireMessage:e.wireMessage,synthesized:e.synthesized,lastEventId:e.lastEventId,serverRequestId:null,...e.freeCap?{freeCap:/* @__PURE__ */Object.freeze({...e.freeCap})}:{}})}var _e="x-everfur-anon-token",Oe="anonTokenInvalid";async function Ee(e){if(e.userRef!==null||e.anonIdentity===void 0)return null;try{return await e.anonIdentity.token()}catch{return null}}function Pe(e,t){let i=e instanceof Error?e.message:typeof e=="string"?e:null;return makeEverfurError("authRejected",{retryable:false,...t?.wireCode?{wireCode:t.wireCode}:{},...t?.requestId?{requestId:t.requestId}:{},...i?{wireMessage:i}:{},...e!=null?{raw:e}:{}})}function authHeaders(e){let t={};return e.mode==="personalized"?t.authorization=`Bearer ${e.token}`:(t["x-everfur-partner-key"]=e.publishableKey,e.anonToken&&(t[_e]=e.anonToken)),e.userRef&&(t["x-everfur-user-ref"]=e.userRef),e.sessionId&&(t["x-everfur-session-id"]=e.sessionId),t}function withAuthHeaders(e,t){return{...e,headers:{...Le(e.headers),...authHeaders(t)}}}function Le(e){if(!e)return{};let t={};for(let[i,r]of Object.entries(e)){let e=i.toLowerCase();e==="authorization"||e==="x-everfur-partner-key"||e===_e||(t[i]=r)}return t}async function authedSend(e,t){if(t.mode==="anonymous"){let i=await Ee(t),r=await t.transport.request(withAuthHeaders(e,Be(t,i)));if(r.ok||Re(r.error.raw)!==Oe||t.anonIdentity===void 0||t.userRef!==null)return r;let n=await t.anonIdentity.token({forceRefresh:true});return n===null||n===i?r:t.transport.request(withAuthHeaders(e,Be(t,n)))}let i;try{i=await t.identity.currentToken()}catch(e){return t.identity.reportRejected?.(),err(Pe(e))}let r=await t.transport.request(withAuthHeaders(e,{mode:"personalized",token:i,userRef:t.userRef,...t.sessionId?{sessionId:t.sessionId}:{}}));if(r.ok||r.error.httpStatus!==401)return r;let n;try{n=await t.identity.currentToken({forceRefresh:!0})}catch(e){return t.identity.reportRejected?.(),err(Pe(e,{wireCode:Re(r.error.raw),requestId:r.error.requestId}))}let l=await t.transport.request(withAuthHeaders(e,{mode:"personalized",token:n,userRef:t.userRef,...t.sessionId?{sessionId:t.sessionId}:{}}));return!l.ok&&l.error.httpStatus===401?(t.identity.reportRejected?.(),err(Ae(l.error))):l}function Be(e,t){return{mode:"anonymous",publishableKey:e.publishableKey,userRef:e.userRef,...e.sessionId?{sessionId:e.sessionId}:{},...t!==null?{anonToken:t}:{}}}function Ae(e){let t=e.raw,i=Re(t);return makeEverfurError("authRejected",{retryable:false,...e.httpStatus!==void 0?{httpStatus:e.httpStatus}:{},...e.requestId?{requestId:e.requestId}:{},...i?{wireCode:i}:{},...e.reasonCode?{reasonCode:e.reasonCode}:{},...e.wireMessage?{wireMessage:e.wireMessage}:{},...t!=null?{raw:t}:{}})}function Re(e){if(typeof e!="object"||e===null)return null;let t=e,i=(typeof t.error=="object"&&t.error!==null?t.error.code:void 0)??t.code;return typeof i=="string"&&i.length>0?i:null}function je(e,t){let i=globalThis.URL;if(typeof i=="function"){let r;try{r=t===void 0?new i(e):new i(e,t)}catch{return null}try{if(r.protocol)return r}catch{}}return Ne(e)}var $e=/^([a-z][a-z0-9+.-]*):\/\/(?:([^:@/?#]*)(?::([^@/?#]*))?@)?(\[[0-9a-f:.]+\]|[\w.~-]+)(?::(\d*))?(\/[^?#]*)?(\?[^#]*)?(#.*)?$/i,We=/[\s\u0000-\u001f\u007f\\]/,Me={"http:":"80","https:":"443"};function Ne(e,t){let i=e.trim();let r=We.test(i)?null:$e.exec(i);if(r===null)return null;let[,n="",l="",o="",a="",s="",c="",d="",u=""]=r,p=`${n.toLowerCase()}:`,h=Number(s);if(h>65535)return null;let g=s===""||String(h)===Me[p]?"":String(h),f=Me[p]!==void 0,m=a.toLowerCase()+(g&&`:${g}`),b=c||(f?"/":""),y=l||o?`${l}${o&&`:${o}`}@`:"";return{href:`${p}//${y}${m}${b}${d}${u}`,protocol:p,username:l,password:o,hostname:a.toLowerCase(),port:g,origin:f?`${p}//${m}`:"null",pathname:b,search:d==="?"?"":d,hash:u==="#"?"":u}}function networkError(e){return makeEverfurError("internalError",{retryable:true,wireMessage:Ge(e)})}function Ge(e){return e instanceof Error?e.message:typeof e=="string"?e:"network request failed"}var qe=3e4,Ue=he*2,Ve="idempotency-key",Ye=/* @__PURE__ */new Set(["POST","PUT","PATCH","DELETE"]),Xe=/* @__PURE__ */Object.freeze({onEvent(){}}),Ke=/* @__PURE__ */Object.freeze({setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),now:()=>Date.now()});function Qe(e){let t=e.trim().replace(/[^A-Za-z0-9_.:-]/g,"-");return t.length===0?null:`efs_${t}`.slice(0,128)}function createRequestFunnel(e){let t=e.observer??Xe,i=e.timers??Ke,r=e.rng??Math.random,n=e.sleep??((e,t)=>ht(e,i,t)),l=e.maxAttempts??ge,o=e.unaryTimeoutMs??qe,a=e.newIdempotencyKey??Ze(),s=e=>{try{t.onEvent(e)}catch{}};async function c(t,c,d){let u=d?.maxAttempts,p=Math.max(1,u??l),h=d?.idempotent??Ye.has(c.method),g=d?.idempotencyKey===void 0?null:Qe(d.idempotencyKey),f=h?g??a():null,m=Je(c,f),b=0;for(;;){let l=e=>/* @__PURE__ */Object.freeze({call:t,method:c.method,path:c.path,attempt:b,...f?{idempotencyKey:f}:{},...e});s(l({phase:"attempt"}));let a=ut(o,i),d=pt(a.signal,c.signal),h;try{h=await authedSend({...m,signal:d.signal},e.auth)}catch(e){h=err(networkError(e))}finally{d.dispose(),a.cancel()}if(h.ok)return s(l({phase:"settled",ok:true,reason:"ok"})),h;let g=h.error,y=tt(g,b,{maxAttempts:p,rng:r,now:i.now(),aborted:c.signal?.aborted===true,...u!==void 0?{perCallMaxAttempts:u}:{},...e.errorPolicy!==void 0?{policy:e.errorPolicy}:{}}),w={ok:false,code:g.code,reason:y.reason,...g.httpStatus!==void 0?{httpStatus:g.httpStatus}:{},...g.requestId!==void 0?{requestId:g.requestId}:{}};if(!y.retry)return s(l({phase:"settled",...w})),err(g);if(s(l({phase:"retry",...w,delayMs:y.delayMs})),await n(y.delayMs,c.signal),c.signal?.aborted===true)return s(l({phase:"settled",...w,reason:"aborted"})),err(g);b+=1}}async function d(t){return withAuthHeaders(t,await dt(e.auth))}async function*u(t,i,r){s(
|
|
8
8
|
/* @__PURE__ */Object.freeze({call:t,phase:"stream.open",method:i.method,path:i.path,attempt:0}));try{yield*e.auth.transport.stream(i,r)}catch{yield errorFrame({code:"internal_error",retryable:true,wireMessage:null,synthesized:true,lastEventId:null})}}/* @__PURE__ */
|
package/dist/tabs/index.cjs
CHANGED
|
@@ -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
|
-
"use strict";var e=require("@everfur/sdk/chat"),t=require("@everfur/sdk/health-plan"),n=require("@everfur/sdk/records"),r=require("react"),o=require("react-native"),i=require("react/jsx-runtime"),a=require("@everfur/sdk/notifications/inbox"),l=require("@everfur/sdk/televet");var s=/* @__PURE__ */Symbol.for("@everfur/sdk#HealthPlanSignals@v1"),d=globalThis;function c(e){if(typeof e!="object"||e===null)return false;let t=e;return t.landed instanceof Set&&t.noVet instanceof Set&&t.noVetByPet instanceof Map}var u=d[s],p=()=>({landed:/* @__PURE__ */new Set,noVet:/* @__PURE__ */new Set,noVetByPet:/* @__PURE__ */new Map}),f=c(u)?u:d[s]=p(),h=f.landed,g=f.noVet,b=f.noVetByPet;function notifyHealthPlanRecordsLanded(petRef,e="host"){for(let t of[...h])try{t(petRef,e)}catch{}}function onHealthPlanRecordsLanded(e){return h.add(e),()=>{h.delete(e)}}function setHealthPlanNoVet(petRef,e){if((b.get(petRef)??false)!==e){e?b.set(petRef,true):b.delete(petRef);for(let t of[...g])try{t(petRef,e)}catch{}}}function healthPlanNoVet(petRef){return b.get(petRef)??false}function onHealthPlanNoVet(e){return g.add(e),()=>{g.delete(e)}}var m=[{wireCode:"AccessDeniedException",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"AuthorizationException",envelope:"http_envelope",httpStatus:401,retryable:false},{wireCode:"ConflictException",envelope:"http_envelope",httpStatus:409,retryable:true},{wireCode:"DAILY_QUOTA_EXCEEDED",envelope:"http_envelope",httpStatus:429,retryable:true},{wireCode:"FILE_TOO_LARGE",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"IDEMPOTENCY_KEY_IN_FLIGHT",envelope:"http_envelope",httpStatus:409,retryable:true},{wireCode:"IDEMPOTENCY_KEY_REUSED_DIFFERENT_REQUEST",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"INVALID_CONTENT_TYPE",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"InternalFailureException",envelope:"http_envelope",httpStatus:500,retryable:true},{wireCode:"MethodNotAllowedException",envelope:"http_envelope",httpStatus:405,retryable:false},{wireCode:"NotImplementedException",envelope:"http_envelope",httpStatus:501,retryable:false},{wireCode:"PaymentRequiredException",envelope:"http_envelope",httpStatus:402,retryable:false},{wireCode:"ResourceNotFoundException",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"ServiceUnavailableException",envelope:"http_envelope",httpStatus:503,retryable:true},{wireCode:"TIER_UPGRADE_REQUIRED",envelope:"http_envelope",httpStatus:402,retryable:false},{wireCode:"ThrottlingException",envelope:"http_envelope",httpStatus:429,retryable:true},{wireCode:"ValidationException",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"accessDenied",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"access_denied",envelope:"oauth_error",httpStatus:302,retryable:false},{wireCode:"anchor_not_found",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"anchor_ref_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"anonTokenInvalid",envelope:"http_envelope",httpStatus:401,retryable:false},{wireCode:"attachment_unreadable",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"authExpired",envelope:"http_envelope",httpStatus:401,retryable:true},{wireCode:"authRejected",envelope:"http_envelope",httpStatus:401,retryable:false},{wireCode:"before_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"bundle_mismatch",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"bundle_not_uploaded",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"bundles_unavailable",envelope:"http_envelope",httpStatus:503,retryable:true},{wireCode:"catalog_empty_refused",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"catalog_shrink_refused",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"consent_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"consent_required",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"consent_scope_wrong_route",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"device_cipher_unavailable",envelope:"http_envelope",httpStatus:503,retryable:true},{wireCode:"email_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"endpoint_not_allowed",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"environment_mismatch",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"event_cursor_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"event_filter_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"event_id_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"event_payload_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"event_type_not_available",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"event_type_unknown",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"idempotency_key_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"idempotency_key_required",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"idempotency_key_reused",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"inbox_cursor_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"insufficientCapability",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"insufficient_scope",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"internal_error",envelope:"sse_frame",httpStatus:200,retryable:false},{wireCode:"invalidRequest",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"invalid_client",envelope:"oauth_error",httpStatus:401,retryable:false},{wireCode:"invalid_client_metadata",envelope:"oauth_error",httpStatus:400,retryable:false},{wireCode:"invalid_grant",envelope:"oauth_error",httpStatus:400,retryable:false},{wireCode:"invalid_redirect_uri",envelope:"oauth_error",httpStatus:400,retryable:false},{wireCode:"invalid_request",envelope:"oauth_error",httpStatus:400,retryable:false},{wireCode:"invalid_scope",envelope:"oauth_error",httpStatus:400,retryable:false},{wireCode:"invalid_target",envelope:"oauth_error",httpStatus:400,retryable:false},{wireCode:"item_id_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"linked_account_read_only",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"mcp_connection_not_found",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"mcp_request_conflict",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"mcp_request_gone",envelope:"http_envelope",httpStatus:410,retryable:false},{wireCode:"mcp_request_not_found",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"not_found",envelope:"sse_frame",httpStatus:200,retryable:false},{wireCode:"not_found",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"open_url_not_allowed",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"partner_visit_link_conflict",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"partner_visit_owner_only",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"partner_visit_pet_already_mapped",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"payload_too_large",envelope:"http_envelope",httpStatus:413,retryable:false},{wireCode:"petRefInUse",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"pet_health_list_removals_unconfirmed",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"pet_health_species_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"pet_not_registered",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"provider_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"rateLimited",envelope:"http_envelope",httpStatus:429,retryable:true},{wireCode:"read_target_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"record_species_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"record_subject_not_found",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"record_upload_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"records_consent_required",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"restricted_key",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"sandbox_only",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"session_required",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"session_revoked",envelope:"http_envelope",httpStatus:401,retryable:false},{wireCode:"share_limit_reached",envelope:"http_envelope",httpStatus:429,retryable:false},{wireCode:"slow_down",envelope:"oauth_error",httpStatus:429,retryable:true},{wireCode:"species_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"subscription_keys_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"tenant_filter_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"tenant_has_no_capabilities",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"tenant_resource_not_found",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"tenant_surface_not_enabled",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"ticket_not_resolved",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"tickets_disabled",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"timeout",envelope:"sse_frame",httpStatus:200,retryable:true},{wireCode:"token_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"unavailable",envelope:"sse_frame",httpStatus:200,retryable:true},{wireCode:"unavailable",envelope:"http_envelope",httpStatus:503,retryable:true},{wireCode:"unrestrictedKeyRequired",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"unsupported_grant_type",envelope:"oauth_error",httpStatus:400,retryable:false},{wireCode:"unsupported_response_type",envelope:"oauth_error",httpStatus:302,retryable:false},{wireCode:"user_ref_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"verify_mint_rate_limited",envelope:"http_envelope",httpStatus:429,retryable:true},{wireCode:"verify_mint_refused",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"verify_mint_unavailable",envelope:"http_envelope",httpStatus:503,retryable:true},{wireCode:"verify_user_ref_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"web_push_unavailable",envelope:"http_envelope",httpStatus:503,retryable:true},{wireCode:"webhook_endpoint_update_empty",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"webhook_endpoint_update_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"webhook_url_rejected",envelope:"http_envelope",httpStatus:400,retryable:false}],y=/* @__PURE__ */Object.freeze(m.map(e=>/* @__PURE__ */Object.freeze(e)));/* @__PURE__ */Object.freeze(y.map(e=>e.wireCode));var k=/* @__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",anonTokenInvalid:"authRejected",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",endpoint_not_allowed:"validationFailed",event_id_invalid:"validationFailed",inbox_cursor_invalid:"validationFailed",item_id_invalid:"validationFailed",open_url_not_allowed:"validationFailed",read_target_invalid:"validationFailed",subscription_keys_invalid:"validationFailed",web_push_unavailable:"serviceUnavailable",anchor_not_found:"resourceNotFound",anchor_ref_invalid:"validationFailed",before_invalid:"validationFailed",bundle_mismatch:"validationFailed",bundle_not_uploaded:"validationFailed",bundles_unavailable:"serviceUnavailable",environment_mismatch:"validationFailed",restricted_key:"accessDenied",ticket_not_resolved:"conflict",tickets_disabled:"resourceNotFound"}),v=/* @__PURE__ */Object.freeze(y.map(e=>/* @__PURE__ */Object.freeze({wireCode:e.wireCode,envelope:e.envelope,retryable:e.retryable,normalized:k[e.wireCode]}))),w=new Map(v.map(e=>[e.envelope+e.wireCode.toUpperCase(),e])),x=/* @__PURE__ */Object.freeze(["http_envelope",...[...new Set(v.map(e=>e.envelope))].filter(e=>e!=="http_envelope").sort()]);function contractErrorFor(e,t){if(typeof e!="string")return;let n=e.trim().toUpperCase();if(n.length!==0)for(let e of[t??"http_envelope",...x]){let t=w.get(e+n);if(t)return t}}var _=/* @__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(e){return _[e]}function fromWire(e){let t=contractErrorFor(e);if(t)return t.normalized;let n=(e??"").trim().toUpperCase(),r=n.replace(/[^A-Z0-9]/g,"");if(r==="AUTHREJECTED")return"authRejected";if(n.startsWith("AUTH"))return"authExpired";switch(r){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"FREECAPREACHED":return"paymentRequired";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 S=/* @__PURE__ */new Set(["streamTimeout","rateLimited","internalError","upstreamLlmTimeout","streamIncomplete"]);function isAutoRetryable(e){return S.has(e)}var C=/* @__PURE__ */new Set(["serviceUnavailable","conflict","idempotencyInFlight"]);function isRetryableCode(e){return isAutoRetryable(e)||C.has(e)}var R=500,j=8e3,A=4;function backoffDelayMs(e,t=Math.random){let n=Math.max(0,e),r=Math.min(R*2**n,j);return Math.floor(t()*r)}var F="This feature isn't available on your account right now.",E="Something in that request was not right. Check the details and try again.",I=/* @__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:F,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:E,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:F,runtimeDisposed:E,unknown:"Something went wrong. Please try again."}),T="This session has ended. Please sign in again.",D="linked_account_read_only";function P(e,t,n){return e==="conflict"&&n===D?F:(e==="authRejected"||e==="authExpired")&&typeof t=="string"&&t.trim().toLowerCase()==="session_revoked"?T:userFacingError(e)}function userFacingError(e){return I[e]}function O(e,t,n){Object.defineProperty(e,t,{value:n,enumerable:false,writable:false,configurable:false})}var z=/^[a-z][a-z0-9_]{0,63}$/;function makeEverfurError(e,t){let n=contractErrorFor(t?.wireCode,t?.wireEnvelope),r=e==="conflict"&&t?.reasonCode===D,o={code:e,category:categoryFor(e),retryable:t?.retryable??(r?false:isRetryableCode(e)),displayMessage:P(e,t?.wireCode,r?D:null)};t?.httpStatus!==void 0&&(o.httpStatus=t.httpStatus),t?.requestId&&(o.requestId=t.requestId),typeof t?.reasonCode=="string"&&z.test(t.reasonCode)&&(o.reasonCode=t.reasonCode);let i=t?.retryAfterSeconds;if(typeof i=="number"&&Number.isFinite(i)&&i>=0&&(o.retryAfterSeconds=Math.round(i)),n);return t?.wireMessage&&O(o,"wireMessage",t.wireMessage),t?.raw!==void 0&&t.raw!==null&&O(o,"raw",t.raw),/* @__PURE__ */Object.freeze(o)}function ok(e,t){/* @__PURE__ */
|
|
2
|
+
"use strict";var e=require("@everfur/sdk/chat"),t=require("@everfur/sdk/health-plan"),n=require("@everfur/sdk/records"),r=require("react"),o=require("react-native"),i=require("react/jsx-runtime"),a=require("@everfur/sdk/notifications/inbox"),l=require("@everfur/sdk/televet");var s=/* @__PURE__ */Symbol.for("@everfur/sdk#HealthPlanSignals@v1"),d=globalThis;function c(e){if(typeof e!="object"||e===null)return false;let t=e;return t.landed instanceof Set&&t.noVet instanceof Set&&t.noVetByPet instanceof Map}var u=d[s],p=()=>({landed:/* @__PURE__ */new Set,noVet:/* @__PURE__ */new Set,noVetByPet:/* @__PURE__ */new Map}),f=c(u)?u:d[s]=p(),h=f.landed,g=f.noVet,b=f.noVetByPet;function notifyHealthPlanRecordsLanded(petRef,e="host"){for(let t of[...h])try{t(petRef,e)}catch{}}function onHealthPlanRecordsLanded(e){return h.add(e),()=>{h.delete(e)}}function setHealthPlanNoVet(petRef,e){if((b.get(petRef)??false)!==e){e?b.set(petRef,true):b.delete(petRef);for(let t of[...g])try{t(petRef,e)}catch{}}}function healthPlanNoVet(petRef){return b.get(petRef)??false}function onHealthPlanNoVet(e){return g.add(e),()=>{g.delete(e)}}var m=[{wireCode:"AccessDeniedException",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"AuthorizationException",envelope:"http_envelope",httpStatus:401,retryable:false},{wireCode:"ConflictException",envelope:"http_envelope",httpStatus:409,retryable:true},{wireCode:"DAILY_QUOTA_EXCEEDED",envelope:"http_envelope",httpStatus:429,retryable:true},{wireCode:"FILE_TOO_LARGE",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"IDEMPOTENCY_KEY_IN_FLIGHT",envelope:"http_envelope",httpStatus:409,retryable:true},{wireCode:"IDEMPOTENCY_KEY_REUSED_DIFFERENT_REQUEST",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"INVALID_CONTENT_TYPE",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"InternalFailureException",envelope:"http_envelope",httpStatus:500,retryable:true},{wireCode:"MethodNotAllowedException",envelope:"http_envelope",httpStatus:405,retryable:false},{wireCode:"NotImplementedException",envelope:"http_envelope",httpStatus:501,retryable:false},{wireCode:"PaymentRequiredException",envelope:"http_envelope",httpStatus:402,retryable:false},{wireCode:"ResourceNotFoundException",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"ServiceUnavailableException",envelope:"http_envelope",httpStatus:503,retryable:true},{wireCode:"TIER_UPGRADE_REQUIRED",envelope:"http_envelope",httpStatus:402,retryable:false},{wireCode:"ThrottlingException",envelope:"http_envelope",httpStatus:429,retryable:true},{wireCode:"ValidationException",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"accessDenied",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"access_denied",envelope:"oauth_error",httpStatus:302,retryable:false},{wireCode:"anchor_not_found",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"anchor_ref_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"anonTokenInvalid",envelope:"http_envelope",httpStatus:401,retryable:false},{wireCode:"attachment_unreadable",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"authExpired",envelope:"http_envelope",httpStatus:401,retryable:true},{wireCode:"authRejected",envelope:"http_envelope",httpStatus:401,retryable:false},{wireCode:"before_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"bundle_mismatch",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"bundle_not_uploaded",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"bundles_unavailable",envelope:"http_envelope",httpStatus:503,retryable:true},{wireCode:"catalog_empty_refused",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"catalog_shrink_refused",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"consent_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"consent_required",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"consent_scope_wrong_route",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"device_cipher_unavailable",envelope:"http_envelope",httpStatus:503,retryable:true},{wireCode:"email_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"endpoint_not_allowed",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"environment_mismatch",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"event_cursor_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"event_filter_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"event_id_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"event_payload_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"event_type_not_available",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"event_type_unknown",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"idempotency_key_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"idempotency_key_required",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"idempotency_key_reused",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"inbox_cursor_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"insufficientCapability",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"insufficient_scope",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"internal_error",envelope:"sse_frame",httpStatus:200,retryable:false},{wireCode:"invalidRequest",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"invalid_client",envelope:"oauth_error",httpStatus:401,retryable:false},{wireCode:"invalid_client_metadata",envelope:"oauth_error",httpStatus:400,retryable:false},{wireCode:"invalid_grant",envelope:"oauth_error",httpStatus:400,retryable:false},{wireCode:"invalid_redirect_uri",envelope:"oauth_error",httpStatus:400,retryable:false},{wireCode:"invalid_request",envelope:"oauth_error",httpStatus:400,retryable:false},{wireCode:"invalid_scope",envelope:"oauth_error",httpStatus:400,retryable:false},{wireCode:"invalid_target",envelope:"oauth_error",httpStatus:400,retryable:false},{wireCode:"item_id_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"linked_account_read_only",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"mcp_connection_not_found",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"mcp_request_conflict",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"mcp_request_gone",envelope:"http_envelope",httpStatus:410,retryable:false},{wireCode:"mcp_request_not_found",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"not_found",envelope:"sse_frame",httpStatus:200,retryable:false},{wireCode:"not_found",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"open_url_not_allowed",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"partner_visit_link_conflict",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"partner_visit_owner_only",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"partner_visit_pet_already_mapped",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"payload_too_large",envelope:"http_envelope",httpStatus:413,retryable:false},{wireCode:"petRefInUse",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"pet_health_list_removals_unconfirmed",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"pet_health_species_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"pet_not_registered",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"provider_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"rateLimited",envelope:"http_envelope",httpStatus:429,retryable:true},{wireCode:"read_target_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"record_species_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"record_subject_not_found",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"record_upload_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"records_consent_required",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"restricted_key",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"sandbox_only",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"session_required",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"session_revoked",envelope:"http_envelope",httpStatus:401,retryable:false},{wireCode:"share_limit_reached",envelope:"http_envelope",httpStatus:429,retryable:false},{wireCode:"slow_down",envelope:"oauth_error",httpStatus:429,retryable:true},{wireCode:"species_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"subscription_keys_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"tenant_filter_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"tenant_has_no_capabilities",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"tenant_resource_not_found",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"tenant_surface_not_enabled",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"ticket_not_resolved",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"tickets_disabled",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"timeout",envelope:"sse_frame",httpStatus:200,retryable:true},{wireCode:"timezone_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"token_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"unavailable",envelope:"sse_frame",httpStatus:200,retryable:true},{wireCode:"unavailable",envelope:"http_envelope",httpStatus:503,retryable:true},{wireCode:"unrestrictedKeyRequired",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"unsupported_grant_type",envelope:"oauth_error",httpStatus:400,retryable:false},{wireCode:"unsupported_response_type",envelope:"oauth_error",httpStatus:302,retryable:false},{wireCode:"user_ref_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"verify_mint_rate_limited",envelope:"http_envelope",httpStatus:429,retryable:true},{wireCode:"verify_mint_refused",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"verify_mint_unavailable",envelope:"http_envelope",httpStatus:503,retryable:true},{wireCode:"verify_user_ref_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"web_push_unavailable",envelope:"http_envelope",httpStatus:503,retryable:true},{wireCode:"webhook_endpoint_update_empty",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"webhook_endpoint_update_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"webhook_url_rejected",envelope:"http_envelope",httpStatus:400,retryable:false}],y=/* @__PURE__ */Object.freeze(m.map(e=>/* @__PURE__ */Object.freeze(e)));/* @__PURE__ */Object.freeze(y.map(e=>e.wireCode));var k=/* @__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",anonTokenInvalid:"authRejected",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",endpoint_not_allowed:"validationFailed",event_id_invalid:"validationFailed",inbox_cursor_invalid:"validationFailed",item_id_invalid:"validationFailed",open_url_not_allowed:"validationFailed",read_target_invalid:"validationFailed",subscription_keys_invalid:"validationFailed",web_push_unavailable:"serviceUnavailable",anchor_not_found:"resourceNotFound",anchor_ref_invalid:"validationFailed",before_invalid:"validationFailed",bundle_mismatch:"validationFailed",bundle_not_uploaded:"validationFailed",bundles_unavailable:"serviceUnavailable",environment_mismatch:"validationFailed",restricted_key:"accessDenied",ticket_not_resolved:"conflict",tickets_disabled:"resourceNotFound",timezone_invalid:"validationFailed"}),v=/* @__PURE__ */Object.freeze(y.map(e=>/* @__PURE__ */Object.freeze({wireCode:e.wireCode,envelope:e.envelope,retryable:e.retryable,normalized:k[e.wireCode]}))),w=new Map(v.map(e=>[e.envelope+e.wireCode.toUpperCase(),e])),x=/* @__PURE__ */Object.freeze(["http_envelope",...[...new Set(v.map(e=>e.envelope))].filter(e=>e!=="http_envelope").sort()]);function contractErrorFor(e,t){if(typeof e!="string")return;let n=e.trim().toUpperCase();if(n.length!==0)for(let e of[t??"http_envelope",...x]){let t=w.get(e+n);if(t)return t}}var _=/* @__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(e){return _[e]}function fromWire(e){let t=contractErrorFor(e);if(t)return t.normalized;let n=(e??"").trim().toUpperCase(),r=n.replace(/[^A-Z0-9]/g,"");if(r==="AUTHREJECTED")return"authRejected";if(n.startsWith("AUTH"))return"authExpired";switch(r){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"FREECAPREACHED":return"paymentRequired";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 S=/* @__PURE__ */new Set(["streamTimeout","rateLimited","internalError","upstreamLlmTimeout","streamIncomplete"]);function isAutoRetryable(e){return S.has(e)}var C=/* @__PURE__ */new Set(["serviceUnavailable","conflict","idempotencyInFlight"]);function isRetryableCode(e){return isAutoRetryable(e)||C.has(e)}var R=500,j=8e3,A=4;function backoffDelayMs(e,t=Math.random){let n=Math.max(0,e),r=Math.min(R*2**n,j);return Math.floor(t()*r)}var F="This feature isn't available on your account right now.",E="Something in that request was not right. Check the details and try again.",I=/* @__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:F,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:E,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:F,runtimeDisposed:E,unknown:"Something went wrong. Please try again."}),T="This session has ended. Please sign in again.",D="linked_account_read_only";function P(e,t,n){return e==="conflict"&&n===D?F:(e==="authRejected"||e==="authExpired")&&typeof t=="string"&&t.trim().toLowerCase()==="session_revoked"?T:userFacingError(e)}function userFacingError(e){return I[e]}function O(e,t,n){Object.defineProperty(e,t,{value:n,enumerable:false,writable:false,configurable:false})}var z=/^[a-z][a-z0-9_]{0,63}$/;function makeEverfurError(e,t){let n=contractErrorFor(t?.wireCode,t?.wireEnvelope),r=e==="conflict"&&t?.reasonCode===D,o={code:e,category:categoryFor(e),retryable:t?.retryable??(r?false:isRetryableCode(e)),displayMessage:P(e,t?.wireCode,r?D:null)};t?.httpStatus!==void 0&&(o.httpStatus=t.httpStatus),t?.requestId&&(o.requestId=t.requestId),typeof t?.reasonCode=="string"&&z.test(t.reasonCode)&&(o.reasonCode=t.reasonCode);let i=t?.retryAfterSeconds;if(typeof i=="number"&&Number.isFinite(i)&&i>=0&&(o.retryAfterSeconds=Math.round(i)),n);return t?.wireMessage&&O(o,"wireMessage",t.wireMessage),t?.raw!==void 0&&t.raw!==null&&O(o,"raw",t.raw),/* @__PURE__ */Object.freeze(o)}function ok(e,t){/* @__PURE__ */
|
|
3
3
|
return Object.freeze({ok:true,value:e})}function err(e){/* @__PURE__ */
|
|
4
4
|
return Object.freeze({ok:false,error:e})}var B=class _EverfurConfigError extends Error{constructor(e,t){super(t),this.name="EverfurConfigError",this.kind=e,Object.setPrototypeOf(this,_EverfurConfigError.prototype)}};function errorFrame(e){/* @__PURE__ */
|
|
5
5
|
return Object.freeze({kind:"error",terminal:true,code:e.code,retryable:e.retryable,wireMessage:e.wireMessage,synthesized:e.synthesized,lastEventId:e.lastEventId,serverRequestId:null,...e.freeCap?{freeCap:/* @__PURE__ */Object.freeze({...e.freeCap})}:{}})}var V="x-everfur-anon-token",N="anonTokenInvalid";async function $(e){if(e.userRef!==null||e.anonIdentity===void 0)return null;try{return await e.anonIdentity.token()}catch{return null}}function L(e,t){let n=e instanceof Error?e.message:typeof e=="string"?e:null;return makeEverfurError("authRejected",{retryable:false,...t?.wireCode?{wireCode:t.wireCode}:{},...t?.requestId?{requestId:t.requestId}:{},...n?{wireMessage:n}:{},...e!=null?{raw:e}:{}})}function authHeaders(e){let t={};return e.mode==="personalized"?t.authorization=`Bearer ${e.token}`:(t["x-everfur-partner-key"]=e.publishableKey,e.anonToken&&(t[V]=e.anonToken)),e.userRef&&(t["x-everfur-user-ref"]=e.userRef),e.sessionId&&(t["x-everfur-session-id"]=e.sessionId),t}function withAuthHeaders(e,t){return{...e,headers:{...W(e.headers),...authHeaders(t)}}}function W(e){if(!e)return{};let t={};for(let[n,r]of Object.entries(e)){let e=n.toLowerCase();e==="authorization"||e==="x-everfur-partner-key"||e===V||(t[n]=r)}return t}async function authedSend(e,t){if(t.mode==="anonymous"){let n=await $(t),r=await t.transport.request(withAuthHeaders(e,M(t,n)));if(r.ok||q(r.error.raw)!==N||t.anonIdentity===void 0||t.userRef!==null)return r;let o=await t.anonIdentity.token({forceRefresh:true});return o===null||o===n?r:t.transport.request(withAuthHeaders(e,M(t,o)))}let n;try{n=await t.identity.currentToken()}catch(e){return t.identity.reportRejected?.(),err(L(e))}let r=await t.transport.request(withAuthHeaders(e,{mode:"personalized",token:n,userRef:t.userRef,...t.sessionId?{sessionId:t.sessionId}:{}}));if(r.ok||r.error.httpStatus!==401)return r;let o;try{o=await t.identity.currentToken({forceRefresh:!0})}catch(e){return t.identity.reportRejected?.(),err(L(e,{wireCode:q(r.error.raw),requestId:r.error.requestId}))}let i=await t.transport.request(withAuthHeaders(e,{mode:"personalized",token:o,userRef:t.userRef,...t.sessionId?{sessionId:t.sessionId}:{}}));return!i.ok&&i.error.httpStatus===401?(t.identity.reportRejected?.(),err(U(i.error))):i}function M(e,t){return{mode:"anonymous",publishableKey:e.publishableKey,userRef:e.userRef,...e.sessionId?{sessionId:e.sessionId}:{},...t!==null?{anonToken:t}:{}}}function U(e){let t=e.raw,n=q(t);return makeEverfurError("authRejected",{retryable:false,...e.httpStatus!==void 0?{httpStatus:e.httpStatus}:{},...e.requestId?{requestId:e.requestId}:{},...n?{wireCode:n}:{},...e.reasonCode?{reasonCode:e.reasonCode}:{},...e.wireMessage?{wireMessage:e.wireMessage}:{},...t!=null?{raw:t}:{}})}function q(e){if(typeof e!="object"||e===null)return null;let t=e,n=(typeof t.error=="object"&&t.error!==null?t.error.code:void 0)??t.code;return typeof n=="string"&&n.length>0?n:null}function networkError(e){return makeEverfurError("internalError",{retryable:true,wireMessage:H(e)})}function H(e){return e instanceof Error?e.message:typeof e=="string"?e:"network request failed"}var K=3e4,Y=j*2,G="idempotency-key",J=/* @__PURE__ */new Set(["POST","PUT","PATCH","DELETE"]),Q=/* @__PURE__ */Object.freeze({onEvent(){}}),Z=/* @__PURE__ */Object.freeze({setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),now:()=>Date.now()});function X(e){let t=e.trim().replace(/[^A-Za-z0-9_.:-]/g,"-");return t.length===0?null:`efs_${t}`.slice(0,128)}function createRequestFunnel(e){let t=e.observer??Q,n=e.timers??Z,r=e.rng??Math.random,o=e.sleep??((e,t)=>ge(e,n,t)),i=e.maxAttempts??A,a=e.unaryTimeoutMs??K,l=e.newIdempotencyKey??te(),s=e=>{try{t.onEvent(e)}catch{}};async function d(t,d,c){let u=c?.maxAttempts,p=Math.max(1,u??i),f=c?.idempotent??J.has(d.method),h=c?.idempotencyKey===void 0?null:X(c.idempotencyKey),g=f?h??l():null,b=ee(d,g),m=0;for(;;){let i=e=>/* @__PURE__ */Object.freeze({call:t,method:d.method,path:d.path,attempt:m,...g?{idempotencyKey:g}:{},...e});s(i({phase:"attempt"}));let l=fe(a,n),c=he(l.signal,d.signal),f;try{f=await authedSend({...b,signal:c.signal},e.auth)}catch(e){f=err(networkError(e))}finally{c.dispose(),l.cancel()}if(f.ok)return s(i({phase:"settled",ok:true,reason:"ok"})),f;let h=f.error,y=re(h,m,{maxAttempts:p,rng:r,now:n.now(),aborted:d.signal?.aborted===true,...u!==void 0?{perCallMaxAttempts:u}:{},...e.errorPolicy!==void 0?{policy:e.errorPolicy}:{}}),k={ok:false,code:h.code,reason:y.reason,...h.httpStatus!==void 0?{httpStatus:h.httpStatus}:{},...h.requestId!==void 0?{requestId:h.requestId}:{}};if(!y.retry)return s(i({phase:"settled",...k})),err(h);if(s(i({phase:"retry",...k,delayMs:y.delayMs})),await o(y.delayMs,d.signal),d.signal?.aborted===true)return s(i({phase:"settled",...k,reason:"aborted"})),err(h);m+=1}}async function c(t){return withAuthHeaders(t,await pe(e.auth))}async function*u(t,n,r){s(
|
|
@@ -142,7 +142,7 @@ return Object.freeze({videoAndRx:gi(t.video_and_rx),adviceOnly:gi(t.advice_only)
|
|
|
142
142
|
return Object.freeze({schemaVersion:o,partner:typeof t.partner=="string"?t.partner:"",revision:n,settings:resolveSettings(r).settings,fixedStrings:resolveFixedStrings(t.fixed_strings),stateGate:parseStateGate(t.state_gate)})}function serializeSdkConfig(e){return JSON.stringify({schema_version:e.schemaVersion,partner:e.partner,revision:e.revision,settings:e.settings,fixed_strings:e.fixedStrings,state_gate:{video_and_rx:e.stateGate.videoAndRx,advice_only:e.stateGate.adviceOnly}})}var bi=/* @__PURE__ */Object.freeze(["composerInput","sendButton","userBubble","assistantBubble","vetBubble","recordCard","vetVisitButton","primaryButton","link","header","banner","chip","card","input","tab","bookingStep","dialog","cartBar","planCard","planReasonLabel","planWash","planChip"]);var mi="presentation";var yi=/* @__PURE__ */Object.freeze(["display_name","logo_url","logo_url_dark","primary_color","accent_color","primary_color_dark","accent_color_dark","brightness","color_scheme","font_family","font_url","fonts","font_urls","chat_placeholder","surface_style","radius_scale","accessibility_max_font_scale","slots","background_color","background_color_dark","text_color","text_color_dark","danger_color","danger_color_dark","font_size_base","border_radius","spacing_unit","success_color","success_color_dark","warning_color","warning_color_dark","info_color","info_color_dark","heading_font_family","font_weight_body","font_weight_heading","line_height","assistant_avatar_url","font_sources"]);function hardenHttpsUrl(e){if(e===null)return null;let t=e.trim();return t.length===0?null:/^https:\/\/\S+$/i.test(t)?t:null}var ki=/* @__PURE__ */new RegExp(`^${li}\\/brand\\/[0-9a-f]{16}\\.(png|jpg|webp)$`);function hardenBrandAssetUrl(e){let t=hardenHttpsUrl(e);return t!==null&&ki.test(t)?t:null}var vi="everfur-ask";function wi(e){let t=e.weight.trim().split(/\s+/).map(Number).filter(e=>Number.isFinite(e)),n=t[0]??400,r=t[1]??n,o=[];for(let e=Math.ceil(n/100)*100;e<=r;e+=100)e>=100&&e<=900&&o.push(String(e));return o.length===0?["400"]:o}function fontSourcesOf(e){let t=[];for(let n of e["look.font.files"])for(let e of wi(n))t.push(/* @__PURE__ */Object.freeze({family:n.family,src:n.url,weight:e}));/* @__PURE__ */
|
|
143
143
|
return Object.freeze(t)}function slotsOf(e){let t=buttonFill(e),n=e["look.color.heading"],r=e["look.color.bubble"],o=e["look.color.chips"][0]??e["look.color.tint"],i=e["look.radius.card"];/* @__PURE__ */
|
|
144
144
|
return Object.freeze({primaryButton:{backgroundColor:t.fill,textColor:t.ink},sendButton:{backgroundColor:t.fill,textColor:t.ink},vetVisitButton:{backgroundColor:t.fill,textColor:t.ink},userBubble:r==="none"?{backgroundColor:e["look.color.surface"],textColor:e["look.color.ink"]}:{backgroundColor:r,textColor:bubbleInk(r,e["look.color.ink"])},composerInput:{borderColor:n,backgroundColor:"#FFFFFF",textColor:e["look.color.ink"]},chip:{backgroundColor:o,textColor:chipInk(o,n)},card:{backgroundColor:"#FFFFFF",borderColor:e["look.color.line"],borderRadius:i,textColor:e["look.color.ink"]},recordCard:{backgroundColor:"#FFFFFF",borderColor:e["look.color.line"],borderRadius:i},dialog:{borderRadius:e["look.radius.sheet"]},header:{backgroundColor:e["look.color.surface"],textColor:n},tab:{textColor:n,borderColor:e["look.color.primary"]},link:{textColor:e["look.color.accent"]}})}var xi=/* @__PURE__ */Object.freeze([...yi,...bi.map(e=>`slots.${e}`),"hide_powered_by",mi]);function sdkConfigBranding(e){let t=e.settings,n=t["look.ask_icon"],r=t["look.font.heading_weight"];/* @__PURE__ */
|
|
145
|
-
return Object.freeze({schemaVersion:2,displayName:t["text.partner_name"],logoUrl:t["look.logo.mark"],primaryColor:t["look.color.primary"],accentColor:t["look.color.accent"],brightness:"light",fontFamily:t["look.font.body"],fontUrl:null,headingFontFamily:t["look.font.heading"],fontWeightHeading:String(r),fontSources:fontSourcesOf(t),placeholder:t["text.ask.placeholder"],placeholderFillsPet:true,hidePoweredBy:false,backgroundColor:t["look.color.surface"],textColor:t["look.color.ink"],borderRadius:t["look.radius.card"],assistantAvatarUrl:n===vi?null:n,slots:slotsOf(t),presentation:{chatComposerMic:true,chatComposerUpload:true,chatComposerStyle:"compact",chatComposerPlaceholder:"generic",safetyDisclaimerPlacement:"composer",chatGeneralBanner:t["layout.severity"]!=="off"},lockedFields:xi})}var _i="/widget/v1/sdk-config",Si="x-everfur-sdk-config-schema";function sdkConfigRequest(e){let t={[Si]:String(3)};return typeof e=="number"&&Number.isFinite(e)&&(t["if-none-match"]=`"r${e}.s${3}"`),{method:"GET",path:_i,headers:t}}async function fetchSdkConfig(e,t){let n=await e.send("sdkConfig.fetch",sdkConfigRequest(t));if(!n.ok)return n.error.httpStatus===304?{kind:"notModified"}:n.error.httpStatus===404?{kind:"notEnabled"}:{kind:"failed",error:n.error};let r=parseSdkConfig(n.value);return r===null?{kind:"failed",error:makeEverfurError("internalError",{retryable:true,wireMessage:"malformed sdk-config response"})}:{kind:"updated",config:r}}function Ci(e){let t=[];for(let n of e){let e=n.codePointAt(0);e<128?t.push(e):e<2048?t.push(192|e>>6,128|e&63):e<65536?t.push(224|e>>12,128|e>>6&63,128|e&63):t.push(240|e>>18,128|e>>12&63,128|e>>6&63,128|e&63)}return t}function Ri(e){let t=3421674724,n=2216829733;for(let r of Ci(e)){n=(n^r)>>>0;let e=n*435,o=Math.floor(e/4294967296),i=e>>>0;t=t*435+o+n*256>>>0,n=i}return t.toString(16).padStart(8,"0")+n.toString(16).padStart(8,"0")}var ji="everfur.sdkconfig.v3.";function Ai(e){return`${ji}${Ri(e)}`}function Fi(e,t,n){return`everfur.sdkconfig.freecap.v1.${Ri(`${e}|${t}|${n}`)}`}var Ei=300*1e3,Ii=/* @__PURE__ */Object.freeze({status:"idle",active:null,pending:null});async function Ti(e,t){try{let n=await e.getItem(Ai(t));return n===null?null:parseSdkConfig(JSON.parse(n))}catch{return null}}async function Di(e,t,n){try{n===null?await e.removeItem(Ai(t)):await e.setItem(Ai(t),serializeSdkConfig(n))}catch{}}function Pi(e){let t=Ii,n=false,r=null,o=false,i=null,a=false,l=e.now??Date.now,s=/* @__PURE__ */new Set,d=/* @__PURE__ */new Map,c=/* @__PURE__ */new Map,u=Promise.resolve(),p=e=>{if(!n){t=/* @__PURE__ */Object.freeze({...t,...e});for(let e of[...s])try{e()}catch{}}},f=t=>{if(d.has(t))return Promise.resolve();let n=c.get(t);return n===void 0&&(n=(async()=>{let n=0;try{let r=await e.kv.getItem(t),o=r===null?0:Number.parseInt(r,10);n=Number.isFinite(o)&&o>0?o:0}catch{n=0}d.has(t)||d.set(t,n)})(),c.set(t,n)),n},h=()=>t.pending??t.active,g=async()=>{let r;try{r=await e.fetch(h()?.revision??null)}catch(e){r={kind:"failed",error:e}}if(!n)switch(i=l(),r.kind){case"updated":{Di(e.kv,e.scope,r.config),a=false,t.status==="legacy"?p({pending:r.config}):t.active===null?p({status:"ready",active:r.config,pending:null}):r.config.revision===t.active.revision?p({status:"ready",pending:null}):p({status:"ready",pending:r.config});return}case"notModified":t.pending===null&&(a=false),p({status:t.active===null?"failed":"ready"});return;case"notEnabled":if(Di(e.kv,e.scope,null),t.active===null){p({status:"legacy",pending:null});return}a=true,p({status:"ready",pending:null});return;default:p({status:t.active===null?"failed":"ready"})}},b=()=>(r!==null||(r=(async()=>{if(t.active===null&&t.status!=="legacy"&&p({status:"loading"}),!o){o=true;let n=await Ti(e.kv,e.scope);n!==null&&t.active===null&&p({status:"ready",active:n})}await g()})().finally(()=>{r=null})),r);return{subscribe(e){return s.add(e),()=>{s.delete(e)}},getSnapshot:()=>t,load(){if(r!==null)return r;let e=i===null||l()-i>=Ei;return t.status==="idle"||t.status==="failed"||e?b():Promise.resolve()},retry:b,readFreeUsed(t,n){let r=Fi(e.scope,t,n);return f(r).then(()=>d.get(r)??0)},peekFreeUsed(t,n){return d.get(Fi(e.scope,t,n))??null},addFreeUsed(t,n){let r=Fi(e.scope,t,n);return f(r).then(()=>{let t=(d.get(r)??0)+1;return d.set(r,t),u=u.then(async()=>{try{await e.kv.setItem(r,String(d.get(r)??t))}catch{}}),t})},setFreeUsed(t,n,r){let o=Fi(e.scope,t,n),i=Number.isInteger(r)&&r>0?r:0;return f(o).then(()=>(d.set(o,i),u=u.then(async()=>{try{await e.kv.setItem(o,String(d.get(o)??i))}catch{}}),i))},adoptLatest(){if(a){a=false,p({status:"legacy",active:null,pending:null});return}t.pending!==null&&p({status:"ready",active:t.pending,pending:null})},dispose(){n=true,s.clear()}}}function Oi(e,t){e.store=t;let n=null,r=()=>{let r=t.getSnapshot().active;r!==n&&(n=r,e.branding.set(r===null?null:sdkConfigBranding(r)))};return t.subscribe(r),r(),t}function zi(e){return e==null||e.disposed?null:e.store!==null?e.store:Oi(e,Pi({kv:e.kv,scope:e.scope,fetch:t=>fetchSdkConfig(e.funnel(),t)}))}var Bi=/* @__PURE__ */Object.freeze({status:"legacy",active:null,pending:null}),Vi=()=>()=>{},Ni=()=>Bi;function $i(){return zi(r.useContext(Ee)?.runtime?.sdkConfigHost)}function useEverfurSdkConfig(){return Li($i())}function Li(e){return r.useSyncExternalStore(e?.subscribe??Vi,e?.getSnapshot??Ni,e?.getSnapshot??Ni)}function useLoadEverfurSdkConfig(){let e=$i();return r.useEffect(()=>{e!==null&&(e.adoptLatest(),e.load())},[e]),useEverfurSdkConfig()}function Wi(){let e=/* @__PURE__ */Symbol.for("@everfur/sdk#SdkSurfaceHooks@v1"),t=globalThis;return t[e]??(t[e]=r.createContext(null))}var Mi=/* @__PURE__ */Wi();var Ui="Go to the nearest emergency vet now.";var qi=/* @__PURE__ */Object.freeze({placeholder:"Ask anything about {petName}…",placeholderFollowUpWeb:"Ask a follow-up…",placeholderUrgentWeb:"Tell us what’s happening…",composerLabel:"Message",attachPhotoOrFileNative:"Add a photo or file",footnoteNative:"Educational, not a diagnosis. Emergency? Call a vet.",footnoteWeb:"Everfur’s assistant isn’t a vet and doesn’t diagnose. Your vet makes the calls. Not for emergencies: if {petName} is in distress, go to the nearest emergency animal hospital now.",suggestions:"Suggestions",reading:"Reading {petName}’s records…",answered:"Everfur answered.",assistantName:"Everfur",followUpsHeadingNative:"Follow-up questions",turnFailedTitleWeb:"Everfur couldn’t answer that just now.",send:"Send",stop:"Stop",retry:"Try again",poweredBy:"powered by everfur",senderUser:"You",senderAssistant:"Assistant",senderVet:"Your vet",loading:"Loading",empty:"No messages yet",transcript:"Chat with Everfur",emptyTitle:"What can we help {petName} with today?",emptyTitlePetFallback:"your pet",copied:"Copied",copyUserMessage:"Copy your message",copyAssistantMessage:"Copy assistant message",feedbackHelpful:"Helpful",feedbackNeutral:"Neutral",feedbackNotHelpful:"Not helpful",feedbackTitle:"What went wrong?",feedbackSubtitle:"Your feedback helps make answers more reliable.",feedbackReasonInaccurate:"Inaccurate",feedbackReasonOutdated:"Out of date",feedbackReasonUnsafe:"Unsafe advice",feedbackReasonUnclear:"Confusing or unclear",feedbackReasonOther:"Something else",feedbackNotesPlaceholder:"Add details (optional)",feedbackSubmit:"Submit feedback",feedbackSkip:"Skip",feedbackSkipA11y:"Skip feedback",feedbackThanks:"Thanks for the feedback",feedbackFailed:"Couldn't send feedback. Please try again.",turnFailedTitle:"Message failed",turnRetry:"Retry",turnUnreachableTitle:"Couldn't reach this chat",turnStartNewChat:"Start a new chat",reconnecting:"Reconnecting…",turnStoppedTitle:"Response stopped",turnStoppedBody:"You stopped this response before it finished. Tap retry to try again.",sourceSingular:"source",sourcePlural:"sources",showSources:"Show",hideSources:"Hide",sourcesHeading:"Sources",openSource:"Open source",urgencyGeneralReason:"Just general info about {petName}. Nothing here needs action right now.",findVet:"Find a vet",findVetA11y:"Find a vet near you",nearestEmergencyVet:"Nearest emergency vet",goToNearestEmergencyVet:Ui,poisonControlWeb:"ASPCA Poison Control",poisonControlNative:"ASPCA Animal Poison Control, (888) 426-4435",showLatestVetAlert:"Show latest vet alert",dismissBanner:"Dismiss {label} banner",openHistoryNative:"Chats and vet messages",openHistoryWeb:"Chats",showChatsWeb:"Show chats",hideChatsWeb:"Hide chats",newReplySuffix:", a new reply",yourPets:"Your pets",yourPet:"Your pet",switchActivePet:"{name}. Switch pet",petCurrentlyActive:"{name}, currently active",switchToPet:"Switch to {name}",activePrefix:"Active · ",close:"Close",addAnotherPet:"Add a pet",addPet:"Add a pet",capReached:"You've used your {cap} free messages this month.",attachmentPhoto:"Photo",attachmentCamera:"Camera",closeAttachmentPicker:"Close attachment picker",addAttachment:"Add attachment, {used} of {total} used",attachmentsFull:"Attachments full, {used} of {total} used",retryUpload:"Retry uploading {filename}",removeAttachment:"Remove {filename}",previewAttachment:"Preview {filename}",closePreview:"Close preview",attachedImage:"Attached image: {filename}, opens a full-screen preview",attachmentTooLarge:"Files must be under {max}. {filename} is {size}.",attachmentTooMany:"You can attach up to {max} files per message.",attachmentUnsupported:"{filename} isn't a supported file type yet.",attachmentNetwork:"Couldn't reach the server. Check your connection and try again.",attachmentServer:"Upload failed{status}. Please try again.",attachmentCancelled:"Upload cancelled.",attachmentRateLimited:"Slow down. Please wait a moment and try again.",attachmentQuota:"Daily image limit reached. Try again tomorrow.",attachmentConflict:"Something went wrong. Tap to retry.",attachmentUnknown:"Something went wrong. Please try again.",attachmentsFailedBlocked:"Some attachments failed to upload. Remove or retry them before sending.",dictate:"Dictate a message",stopDictation:"Stop dictation",listening:"Listening",micBlocked:"Microphone access is blocked. Allow it in your browser settings to dictate.",noSpeech:"We didn't catch that. Tap the mic and try again.",dictationUnavailable:"Voice typing isn't available right now."});var Hi=/* @__PURE__ */Symbol.for("everfur.sdk.rn.poweredBy");function Ki(){let e=globalThis,t=e[Hi];if(t!==void 0)return t;let n={count:0,listeners:/* @__PURE__ */new Set};return e[Hi]=n,n}function EverfurPoweredBy2({children:e,style:t}){let n=useEverfurTheme().meta.hidePoweredBy;return r.useEffect(()=>{if(n)return;let e=Ki();return e.count+=1,e.listeners.forEach(e=>e()),()=>{e.count-=1,e.listeners.forEach(e=>e())}},[n]),n?null:e??/* @__PURE__ */i.jsx(Text,{tier:"compact",style:t,accessibilityRole:"text",children:qi.poweredBy})}function optionalModule(e,t,n){let r;try{r=t()}catch(t){return Gi(`optional peer '${e}' is not installed: ${Ji(t)}`)}let o=Yi(r);return o==null?Gi(`optional peer '${e}' resolved to no module`):n&&!n(o)?Gi(`optional peer '${e}' is present but failed its shape check`):/* @__PURE__ */Object.freeze({available:true,module:o})}function Yi(e){return typeof e=="object"&&e!==null&&"default"in e&&Object.keys(e).length<=2?e.default:e}function Gi(e){/* @__PURE__ */
|
|
145
|
+
return Object.freeze({schemaVersion:2,displayName:t["text.partner_name"],logoUrl:t["look.logo.mark"],primaryColor:t["look.color.primary"],accentColor:t["look.color.accent"],brightness:"light",fontFamily:t["look.font.body"],fontUrl:null,headingFontFamily:t["look.font.heading"],fontWeightHeading:String(r),fontSources:fontSourcesOf(t),placeholder:t["text.ask.placeholder"],placeholderFillsPet:true,hidePoweredBy:false,backgroundColor:t["look.color.surface"],textColor:t["look.color.ink"],borderRadius:t["look.radius.card"],assistantAvatarUrl:n===vi?null:n,slots:slotsOf(t),presentation:{chatComposerMic:true,chatComposerUpload:true,chatComposerStyle:"compact",chatComposerPlaceholder:"generic",safetyDisclaimerPlacement:"composer",chatGeneralBanner:t["layout.severity"]!=="off"},lockedFields:xi})}var _i="/widget/v1/sdk-config",Si="x-everfur-sdk-config-schema";function sdkConfigRequest(e){let t={[Si]:String(3)};return typeof e=="number"&&Number.isFinite(e)&&(t["if-none-match"]=`"r${e}.s${3}"`),{method:"GET",path:_i,headers:t}}async function fetchSdkConfig(e,t){let n=await e.send("sdkConfig.fetch",sdkConfigRequest(t));if(!n.ok)return n.error.httpStatus===304?{kind:"notModified"}:n.error.httpStatus===404?{kind:"notEnabled"}:{kind:"failed",error:n.error};let r=parseSdkConfig(n.value);return r===null?{kind:"failed",error:makeEverfurError("internalError",{retryable:true,wireMessage:"malformed sdk-config response"})}:{kind:"updated",config:r}}function Ci(e){let t=[];for(let n of e){let e=n.codePointAt(0);e<128?t.push(e):e<2048?t.push(192|e>>6,128|e&63):e<65536?t.push(224|e>>12,128|e>>6&63,128|e&63):t.push(240|e>>18,128|e>>12&63,128|e>>6&63,128|e&63)}return t}function Ri(e){let t=3421674724,n=2216829733;for(let r of Ci(e)){n=(n^r)>>>0;let e=n*435,o=Math.floor(e/4294967296),i=e>>>0;t=t*435+o+n*256>>>0,n=i}return t.toString(16).padStart(8,"0")+n.toString(16).padStart(8,"0")}var ji="everfur.sdkconfig.v3.";function Ai(e){return`${ji}${Ri(e)}`}function Fi(e,t,n){return`everfur.sdkconfig.freecap.v1.${Ri(`${e}|${t}|${n}`)}`}var Ei=300*1e3,Ii=/* @__PURE__ */Object.freeze({status:"idle",active:null,pending:null});async function Ti(e,t){try{let n=await e.getItem(Ai(t));return n===null?null:parseSdkConfig(JSON.parse(n))}catch{return null}}async function Di(e,t,n){try{n===null?await e.removeItem(Ai(t)):await e.setItem(Ai(t),serializeSdkConfig(n))}catch{}}function Pi(e){let t=Ii,n=false,r=null,o=false,i=null,a=false,l=e.now??Date.now,s=/* @__PURE__ */new Set,d=/* @__PURE__ */new Map,c=/* @__PURE__ */new Map,u=Promise.resolve(),p=e=>{if(!n){t=/* @__PURE__ */Object.freeze({...t,...e});for(let e of[...s])try{e()}catch{}}},f=t=>{if(d.has(t))return Promise.resolve();let n=c.get(t);return n===void 0&&(n=(async()=>{let n=0;try{let r=await e.kv.getItem(t),o=r===null?0:Number.parseInt(r,10);n=Number.isFinite(o)&&o>0?o:0}catch{n=0}d.has(t)||d.set(t,n)})(),c.set(t,n)),n},h=()=>t.pending??t.active,g=async()=>{let r;try{r=await e.fetch(h()?.revision??null)}catch(e){r={kind:"failed",error:e}}if(!n)switch(i=l(),r.kind){case"updated":{Di(e.kv,e.scope,r.config),a=false,t.status==="legacy"?p({pending:r.config}):t.active===null?p({status:"ready",active:r.config,pending:null}):r.config.revision===t.active.revision?p({status:"ready",pending:null}):p({status:"ready",pending:r.config});return}case"notModified":t.pending===null&&(a=false),p({status:t.active===null?"failed":"ready"});return;case"notEnabled":if(Di(e.kv,e.scope,null),t.active===null){p({status:"legacy",pending:null});return}a=true,p({status:"ready",pending:null});return;default:p({status:t.active===null?"failed":"ready"})}},b=()=>(r!==null||(r=(async()=>{if(t.active===null&&t.status!=="legacy"&&p({status:"loading"}),!o){o=true;let n=await Ti(e.kv,e.scope);n!==null&&t.active===null&&p({status:"ready",active:n})}await g()})().finally(()=>{r=null})),r);return{subscribe(e){return s.add(e),()=>{s.delete(e)}},getSnapshot:()=>t,load(){if(r!==null)return r;let e=i===null||l()-i>=Ei;return t.status==="idle"||t.status==="failed"||e?b():Promise.resolve()},retry:b,readFreeUsed(t,n){let r=Fi(e.scope,t,n);return f(r).then(()=>d.get(r)??0)},peekFreeUsed(t,n){return d.get(Fi(e.scope,t,n))??null},addFreeUsed(t,n){let r=Fi(e.scope,t,n);return f(r).then(()=>{let t=(d.get(r)??0)+1;return d.set(r,t),u=u.then(async()=>{try{await e.kv.setItem(r,String(d.get(r)??t))}catch{}}),t})},setFreeUsed(t,n,r){let o=Fi(e.scope,t,n),i=Number.isInteger(r)&&r>0?r:0;return f(o).then(()=>(d.set(o,i),u=u.then(async()=>{try{await e.kv.setItem(o,String(d.get(o)??i))}catch{}}),i))},adoptLatest(){if(a){a=false,p({status:"legacy",active:null,pending:null});return}t.pending!==null&&p({status:"ready",active:t.pending,pending:null})},dispose(){n=true,s.clear()}}}function Oi(e,t){e.store=t;let n=null,r=()=>{let r=t.getSnapshot().active;r!==n&&(n=r,e.branding.set(r===null?null:sdkConfigBranding(r)))};return t.subscribe(r),r(),t}function zi(e){return e==null||e.disposed?null:e.store!==null?e.store:Oi(e,Pi({kv:e.kv,scope:e.scope,fetch:t=>fetchSdkConfig(e.funnel(),t)}))}var Bi=/* @__PURE__ */Object.freeze({status:"legacy",active:null,pending:null}),Vi=()=>()=>{},Ni=()=>Bi;function $i(){return zi(r.useContext(Ee)?.runtime?.sdkConfigHost)}function useEverfurSdkConfig(){return Li($i())}function Li(e){return r.useSyncExternalStore(e?.subscribe??Vi,e?.getSnapshot??Ni,e?.getSnapshot??Ni)}function useLoadEverfurSdkConfig(){let e=$i();return r.useEffect(()=>{e!==null&&(e.adoptLatest(),e.load())},[e]),useEverfurSdkConfig()}function Wi(){let e=/* @__PURE__ */Symbol.for("@everfur/sdk#SdkSurfaceHooks@v1"),t=globalThis;return t[e]??(t[e]=r.createContext(null))}var Mi=/* @__PURE__ */Wi();var Ui="Go to the nearest emergency vet now.";var qi=/* @__PURE__ */Object.freeze({placeholder:"Ask anything about {petName}…",placeholderFollowUpWeb:"Ask a follow-up…",placeholderUrgentWeb:"Tell us what’s happening…",composerLabel:"Message",attachPhotoOrFileNative:"Add a photo or file",suggestions:"Suggestions",reading:"Reading {petName}’s records…",answered:"Everfur answered.",assistantName:"Everfur",followUpsHeadingNative:"Follow-up questions",turnFailedTitleWeb:"Everfur couldn’t answer that just now.",send:"Send",stop:"Stop",retry:"Try again",poweredBy:"powered by everfur",senderUser:"You",senderAssistant:"Assistant",senderVet:"Your vet",loading:"Loading",empty:"No messages yet",transcript:"Chat with Everfur",emptyTitle:"What can we help {petName} with today?",emptyTitlePetFallback:"your pet",copied:"Copied",copyUserMessage:"Copy your message",copyAssistantMessage:"Copy assistant message",feedbackHelpful:"Helpful",feedbackNeutral:"Neutral",feedbackNotHelpful:"Not helpful",feedbackTitle:"What went wrong?",feedbackSubtitle:"Your feedback helps make answers more reliable.",feedbackReasonInaccurate:"Inaccurate",feedbackReasonOutdated:"Out of date",feedbackReasonUnsafe:"Unsafe advice",feedbackReasonUnclear:"Confusing or unclear",feedbackReasonOther:"Something else",feedbackNotesPlaceholder:"Add details (optional)",feedbackSubmit:"Submit feedback",feedbackSkip:"Skip",feedbackSkipA11y:"Skip feedback",feedbackThanks:"Thanks for the feedback",feedbackFailed:"Couldn't send feedback. Please try again.",turnFailedTitle:"Message failed",turnRetry:"Retry",turnUnreachableTitle:"Couldn't reach this chat",turnStartNewChat:"Start a new chat",reconnecting:"Reconnecting…",turnStoppedTitle:"Response stopped",turnStoppedBody:"You stopped this response before it finished. Tap retry to try again.",sourceSingular:"source",sourcePlural:"sources",showSources:"Show",hideSources:"Hide",sourcesHeading:"Sources",openSource:"Open source",urgencyGeneralReason:"Just general info about {petName}. Nothing here needs action right now.",findVet:"Find a vet",findVetA11y:"Find a vet near you",nearestEmergencyVet:"Nearest emergency vet",goToNearestEmergencyVet:Ui,poisonControlWeb:"ASPCA Poison Control",poisonControlNative:"ASPCA Animal Poison Control, (888) 426-4435",showLatestVetAlert:"Show latest vet alert",dismissBanner:"Dismiss {label} banner",openHistoryNative:"Chats and vet messages",openHistoryWeb:"Chats",showChatsWeb:"Show chats",hideChatsWeb:"Hide chats",newReplySuffix:", a new reply",yourPets:"Your pets",yourPet:"Your pet",switchActivePet:"{name}. Switch pet",petCurrentlyActive:"{name}, currently active",switchToPet:"Switch to {name}",activePrefix:"Active · ",close:"Close",addAnotherPet:"Add a pet",addPet:"Add a pet",capReached:"You've used your {cap} free messages this month.",attachmentPhoto:"Photo",attachmentCamera:"Camera",closeAttachmentPicker:"Close attachment picker",addAttachment:"Add attachment, {used} of {total} used",attachmentsFull:"Attachments full, {used} of {total} used",retryUpload:"Retry uploading {filename}",removeAttachment:"Remove {filename}",previewAttachment:"Preview {filename}",closePreview:"Close preview",attachedImage:"Attached image: {filename}, opens a full-screen preview",attachmentTooLarge:"Files must be under {max}. {filename} is {size}.",attachmentTooMany:"You can attach up to {max} files per message.",attachmentUnsupported:"{filename} isn't a supported file type yet.",attachmentNetwork:"Couldn't reach the server. Check your connection and try again.",attachmentServer:"Upload failed{status}. Please try again.",attachmentCancelled:"Upload cancelled.",attachmentRateLimited:"Slow down. Please wait a moment and try again.",attachmentQuota:"Daily image limit reached. Try again tomorrow.",attachmentConflict:"Something went wrong. Tap to retry.",attachmentUnknown:"Something went wrong. Please try again.",attachmentsFailedBlocked:"Some attachments failed to upload. Remove or retry them before sending.",dictate:"Dictate a message",stopDictation:"Stop dictation",listening:"Listening",micBlocked:"Microphone access is blocked. Allow it in your browser settings to dictate.",noSpeech:"We didn't catch that. Tap the mic and try again.",dictationUnavailable:"Voice typing isn't available right now."});var Hi=/* @__PURE__ */Symbol.for("everfur.sdk.rn.poweredBy");function Ki(){let e=globalThis,t=e[Hi];if(t!==void 0)return t;let n={count:0,listeners:/* @__PURE__ */new Set};return e[Hi]=n,n}function EverfurPoweredBy2({children:e,style:t}){let n=useEverfurTheme().meta.hidePoweredBy;return r.useEffect(()=>{if(n)return;let e=Ki();return e.count+=1,e.listeners.forEach(e=>e()),()=>{e.count-=1,e.listeners.forEach(e=>e())}},[n]),n?null:e??/* @__PURE__ */i.jsx(Text,{tier:"compact",style:t,accessibilityRole:"text",children:qi.poweredBy})}function optionalModule(e,t,n){let r;try{r=t()}catch(t){return Gi(`optional peer '${e}' is not installed: ${Ji(t)}`)}let o=Yi(r);return o==null?Gi(`optional peer '${e}' resolved to no module`):n&&!n(o)?Gi(`optional peer '${e}' is present but failed its shape check`):/* @__PURE__ */Object.freeze({available:true,module:o})}function Yi(e){return typeof e=="object"&&e!==null&&"default"in e&&Object.keys(e).length<=2?e.default:e}function Gi(e){/* @__PURE__ */
|
|
146
146
|
return Object.freeze({available:false,module:null,reason:e})}function Ji(e){return e instanceof Error?e.message:typeof e=="string"?e:"unknown load error"}var Qi=/* @__PURE__ */new RegExp(`^${li}\\/brand\\/[0-9a-f]{16}\\.svg$`);function Zi(e){if(typeof e!="object"||e===null)return false;let t=e.SvgUri;return typeof t=="function"||typeof t=="object"&&t!==null}var Xi=null;function registerEverfurSvg(e){if(e===null)return Xi=null,false;let t=optionalModule("react-native-svg",e,Zi);return Xi=t.available?t.module:null,t.available}function ea(e){let t=hardenHttpsUrl(e);return t!==null&&Qi.test(t)?t:null}function ta(e){let t=o.StyleSheet.flatten(e),n=t?.width,r=t?.height;return typeof n=="number"&&typeof r=="number"?{width:n,height:r}:null}function SdkBrandArt({url:e,style:t,fallback:n=null,testID:a}){let[l,s]=r.useState(false),d=ea(e);if(d!==null){let e=ta(t),r=Xi?.SvgUri;return r===void 0||e===null||l?n:/* @__PURE__ */i.jsx(o.View,{style:t,accessible:false,accessibilityElementsHidden:true,importantForAccessibility:"no-hide-descendants",testID:a??"everfur-sdk-svg",children:/* @__PURE__ */i.jsx(r,{uri:d,width:e.width,height:e.height,onError:()=>s(true)})})}let c=e.trim()===""?null:hardenBrandAssetUrl(e);/* @__PURE__ */
|
|
147
147
|
return i.jsx(BrandImage,{uri:c,decorative:true,style:t,fallback:n,...a===void 0?{}:{testID:a}})}var na="#10462E",ra=640,oa=600,ia="#FFFFFF",aa="#8A8A8A";function la(){let{width:e}=o.useWindowDimensions(),t=e>=oa;return{tablet:t,column:t?{width:"100%",maxWidth:ra,alignSelf:"center",flex:1}:{flex:1}}}function SdkNeutralScreen({failed:e,onRetry:t}){/* @__PURE__ */
|
|
148
148
|
return i.jsx(o.View,{style:{flex:1,backgroundColor:ia,alignItems:"center",justifyContent:"center",padding:24},testID:e?"everfur-sdk-error":"everfur-sdk-loading",children:e?/* @__PURE__ */i.jsxs(i.Fragment,{children:[
|