@everfur/sdk 1.4.0 → 1.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/{Chat.d-BXuEjJsg.d.ts → Chat.d-BCfyvzX8.d.ts} +1 -1
- package/dist/{Chat.d-D9n8tSDD.d.cts → Chat.d-Od44h51D.d.cts} +1 -1
- package/dist/{DepthViews.d-PmjccZLr.d.cts → DepthViews.d-BGspxovy.d.cts} +1 -1
- package/dist/{DepthViews.d-aOChkwU2.d.ts → DepthViews.d-BIHVrf9r.d.ts} +1 -1
- package/dist/{DepthViews.d-ktxIIsnb.d.cts → DepthViews.d-BaLh7Lsi.d.cts} +1 -1
- package/dist/{DepthViews.d-CpF_Y_z9.d.ts → DepthViews.d-CEVk9poG.d.ts} +1 -1
- package/dist/ErrorPolicyPort.d-BIdmYQnk.d.cts +43 -0
- package/dist/ErrorPolicyPort.d-BnI5qWg4.d.ts +43 -0
- package/dist/{RecordsPage.d-BfMSOsg_.d.ts → RecordsPage.d-D10RIgdc.d.ts} +1 -1
- package/dist/{RecordsPage.d-DWjFpZs1.d.cts → RecordsPage.d-DbhYNSbq.d.cts} +1 -1
- package/dist/animations/index.cjs +1 -1
- package/dist/animations/index.d.cts +3 -3
- package/dist/animations/index.d.ts +3 -3
- package/dist/animations/index.js +1 -1
- package/dist/{attachments.d-DjWUR-h9.d.ts → attachments.d-BlukNfIf.d.ts} +2 -2
- package/dist/{attachments.d-Bsg6duaq.d.cts → attachments.d-CF4lLuGK.d.cts} +2 -2
- package/dist/{bookingCopy.d-ITpabqPr.d.ts → bookingCopy.d-BuDv16WP.d.ts} +12 -12
- package/dist/{bookingCopy.d-B39JAmIZ.d.cts → bookingCopy.d-rnBSqOSN.d.cts} +12 -12
- 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/{callCopy.d-Bw6oZT54.d.cts → callCopy.d-BQxpwXqT.d.cts} +3 -3
- package/dist/{callCopy.d-Bw6oZT54.d.ts → callCopy.d-BQxpwXqT.d.ts} +3 -3
- package/dist/{callRoom.d-B1DoYdJe.d.cts → callRoom.d-9Dm7XnUr.d.cts} +1 -1
- package/dist/{callRoom.d-Dqm1rUqT.d.ts → callRoom.d-t-khijDv.d.ts} +1 -1
- package/dist/{casesRepository.d-De4ZtgJ_.d.cts → casesRepository.d-CVuKTkJo.d.cts} +1 -1
- package/dist/{casesRepository.d-DsEeFd0F.d.ts → casesRepository.d-Dn1fK1b2.d.ts} +1 -1
- package/dist/chat/index.cjs +195 -195
- package/dist/chat/index.d.cts +14 -14
- package/dist/chat/index.d.ts +14 -14
- package/dist/chat/index.js +203 -203
- package/dist/chat/lite/index.cjs +206 -206
- package/dist/chat/lite/index.d.cts +14 -14
- package/dist/chat/lite/index.d.ts +14 -14
- package/dist/chat/lite/index.js +206 -206
- package/dist/{chatHandoffToken.d-sbumx0He.d.cts → chatHandoffToken.d-BjfmIxXk.d.cts} +7 -7
- package/dist/{chatHandoffToken.d-YJY6TZbj.d.ts → chatHandoffToken.d-CFiI6IMc.d.ts} +7 -7
- package/dist/{checkin.d-DxpoRutq.d.cts → checkin.d-BP3ZWBfX.d.cts} +19 -7
- package/dist/{checkin.d-C6vh9KVr.d.ts → checkin.d-CokpahFL.d.ts} +19 -7
- package/dist/{chunk-FZ6DAQFH.js → chunk-4KFFE42Z.js} +20 -20
- package/dist/{chunk-ZPIOCHKW.js → chunk-6IHY7HS7.js} +1 -1
- package/dist/{chunk-II4QDD6F.js → chunk-BMYNDBUR.js} +1 -1
- package/dist/{chunk-AJEELSFO.js → chunk-HHCGXQJR.js} +13 -13
- package/dist/client/index.cjs +31 -31
- package/dist/client/index.d.cts +24 -21
- package/dist/client/index.d.ts +24 -21
- package/dist/client/index.js +31 -31
- package/dist/{clinicBatch.d-B3YJc8IO.d.cts → clinicBatch.d-C0xx5L4j.d.cts} +3 -3
- package/dist/{clinicBatch.d-DhvQuPHV.d.ts → clinicBatch.d-DNi4UURs.d.ts} +3 -3
- package/dist/{config.d-DRoQ2lAx.d.ts → config.d-B7Z-KTGq.d.ts} +10 -2
- package/dist/{config.d-BiVy0fLx.d.cts → config.d-ClAI2RZ6.d.cts} +10 -2
- package/dist/consent/index.cjs +1 -1
- package/dist/consent/index.d.cts +6 -6
- package/dist/consent/index.d.ts +6 -6
- package/dist/consent/index.js +2 -2
- package/dist/{context.d-Cq2C4vdh.d.cts → context.d-Bj6-xYPA.d.cts} +13 -7
- package/dist/{context.d-D1l56nFr.d.ts → context.d-DS1GXUEY.d.ts} +13 -7
- package/dist/{copy.d-Ce_8KuZg.d.cts → copy.d--F5A9cXK.d.cts} +3 -3
- package/dist/{copy.d-BP36f_63.d.ts → copy.d-DmxuFJFe.d.ts} +3 -3
- package/dist/core/index.cjs +42 -41
- package/dist/core/index.d.cts +20 -20
- package/dist/core/index.d.ts +20 -20
- package/dist/core/index.js +42 -41
- package/dist/{depth.d-DzMMmRN4.d.ts → depth.d-CgzYE6_n.d.ts} +3 -3
- package/dist/{depth.d-BtlcIqPJ.d.cts → depth.d-DLaP0o8Y.d.cts} +3 -3
- package/dist/{entitlementRepository.d-x2YFdgYD.d.ts → entitlementRepository.d-CkUTlVAb.d.ts} +3 -3
- package/dist/{entitlementRepository.d-CEDU1gZE.d.cts → entitlementRepository.d-DVTp-BB9.d.cts} +3 -3
- package/dist/{focus.d-BX7oahFk.d.cts → focus.d-CLTjm6In.d.cts} +1 -1
- package/dist/{focus.d-armXecf0.d.ts → focus.d-u-HYvim0.d.ts} +1 -1
- package/dist/health-plan/index.cjs +1 -1
- package/dist/health-plan/index.d.cts +17 -17
- package/dist/health-plan/index.d.ts +17 -17
- package/dist/health-plan/index.js +1 -1
- package/dist/{healthPlanRepository.d-DBx7-NLE.d.cts → healthPlanRepository.d-B22kjrYa.d.cts} +3 -3
- package/dist/{healthPlanRepository.d-C7K9dJK5.d.ts → healthPlanRepository.d-CwRXeoM7.d.ts} +3 -3
- package/dist/{idempotency.d-Dak2-pON.d.cts → idempotency.d-CFVMhWcv.d.cts} +1 -1
- package/dist/{idempotency.d-symqJ8Tt.d.ts → idempotency.d-dOFfV91-.d.ts} +1 -1
- package/dist/{identity.d-DOKJFaiz.d.ts → identity.d-D4VtpqRr.d.ts} +1 -1
- package/dist/{identity.d-DIH9h3Le.d.cts → identity.d-DDpXOtas.d.cts} +1 -1
- package/dist/{inbox.d-AuGKeaZv.d.cts → inbox.d-CPcMMz-Y.d.cts} +2 -2
- package/dist/{inbox.d-B5b57OXc.d.ts → inbox.d-DJ9xgU1Z.d.ts} +2 -2
- package/dist/index.cjs +248 -247
- package/dist/index.d.cts +22 -22
- package/dist/index.d.ts +22 -22
- package/dist/index.js +247 -246
- package/dist/{introEvents.d-ehik7PEn.d.cts → introEvents.d-B7acmGwf.d.cts} +1 -1
- package/dist/{introEvents.d-S4Q4BOSt.d.ts → introEvents.d-DW3gLljE.d.ts} +1 -1
- package/dist/{layout.d-Bm2_1wa4.d.ts → layout.d-C8y_ki1V.d.ts} +1 -1
- package/dist/{layout.d-CFF-nBXf.d.cts → layout.d-DfaFM_lp.d.cts} +1 -1
- package/dist/{models.d-DOwpK1ZF.d.ts → models.d-BKmOfoqV.d.cts} +2 -2
- package/dist/{models.d-Su_BBBTW.d.cts → models.d-BULqCO2R.d.ts} +2 -2
- package/dist/notifications/inbox/index.cjs +9 -9
- package/dist/notifications/inbox/index.d.cts +7 -7
- package/dist/notifications/inbox/index.d.ts +7 -7
- package/dist/notifications/inbox/index.js +9 -9
- package/dist/notifications/index.cjs +3 -3
- package/dist/notifications/index.d.cts +8 -8
- package/dist/notifications/index.d.ts +8 -8
- package/dist/notifications/index.js +6 -6
- package/dist/{optInView.d-DbGx1A9R.d.cts → optInView.d-ByDJMrMv.d.cts} +13 -13
- package/dist/{optInView.d-xnIxCLlH.d.ts → optInView.d-DVshLxbD.d.ts} +13 -13
- package/dist/{parse.d-DtHmpAMT.d.cts → parse.d-BDZ7ffgj.d.cts} +4 -1
- package/dist/{parse.d-DtHmpAMT.d.ts → parse.d-BDZ7ffgj.d.ts} +4 -1
- package/dist/{pets.d-BEqKykpu.d.ts → pets.d-BpLObpfM.d.ts} +1 -1
- package/dist/{pets.d-BS6sLxY-.d.cts → pets.d-DXhzTNuI.d.cts} +1 -1
- package/dist/{petsRepository.d-iHrHkXM2.d.ts → petsRepository.d-_QfM7F6T.d.ts} +1 -1
- package/dist/{petsRepository.d-DB5CNKsK.d.cts → petsRepository.d-ai_tZ3lu.d.cts} +1 -1
- 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.d.cts +10 -10
- package/dist/records/depth/index.d.ts +10 -10
- package/dist/records/depth/index.js +1 -1
- package/dist/records/index.cjs +2 -2
- package/dist/records/index.d.cts +13 -13
- package/dist/records/index.d.ts +13 -13
- package/dist/records/index.js +71 -71
- package/dist/{requestFunnel.d-SySe6xHp.d.cts → requestFunnel.d-BwZDfWVD.d.cts} +3 -3
- package/dist/{requestFunnel.d-CehftayS.d.ts → requestFunnel.d-DKBPTpsy.d.ts} +3 -3
- package/dist/{route.d-9wclfD-y.d.cts → route.d-DCzQh4ix.d.cts} +3 -3
- package/dist/{route.d-IP_gkOWL.d.ts → route.d-DSYEd2MR.d.ts} +3 -3
- package/dist/{runtimeTypes.d-BdUe3tYs.d.ts → runtimeTypes.d-BzUig75K.d.ts} +15 -11
- package/dist/{runtimeTypes.d-_UZ6rMUY.d.cts → runtimeTypes.d-CL4l7ta4.d.cts} +15 -11
- package/dist/{screenProps.d-Bd2yphad.d.cts → screenProps.d-6xmE1C-V.d.cts} +2 -2
- package/dist/{screenProps.d-D9Vi-Afl.d.ts → screenProps.d-fHBKArt_.d.ts} +2 -2
- package/dist/{sdkConfigStore.d-VPvsIL8E.d.ts → sdkConfigStore.d-BNCVVEWC.d.ts} +1 -1
- package/dist/{sdkConfigStore.d-BHrzkVpP.d.cts → sdkConfigStore.d-C2BAr9kI.d.cts} +1 -1
- package/dist/server/events/index.cjs +4 -4
- package/dist/server/events/index.d.cts +2 -2
- package/dist/server/events/index.d.ts +2 -2
- package/dist/server/events/index.js +4 -4
- package/dist/server/index.cjs +9 -9
- package/dist/server/index.d.cts +18 -4
- package/dist/server/index.d.ts +18 -4
- package/dist/server/index.js +9 -9
- package/dist/shop/index.d.cts +3 -3
- package/dist/shop/index.d.ts +3 -3
- package/dist/slots/index.cjs +1 -1
- package/dist/slots/index.d.cts +6 -6
- package/dist/slots/index.d.ts +6 -6
- package/dist/slots/index.js +1 -1
- package/dist/tabs/index.cjs +88 -85
- package/dist/tabs/index.d.cts +15 -15
- package/dist/tabs/index.d.ts +15 -15
- package/dist/tabs/index.js +87 -84
- package/dist/televet/booking/index.cjs +41 -41
- package/dist/televet/booking/index.d.cts +8 -8
- package/dist/televet/booking/index.d.ts +8 -8
- package/dist/televet/booking/index.js +4 -4
- package/dist/televet/call/index.d.cts +2 -2
- package/dist/televet/call/index.d.ts +2 -2
- 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.d.cts +1 -1
- package/dist/testing/index.d.ts +1 -1
- package/dist/testing/index.js +1 -1
- package/dist/testing/rn/index.cjs +8 -8
- package/dist/testing/rn/index.d.cts +13 -13
- package/dist/testing/rn/index.d.ts +13 -13
- package/dist/testing/rn/index.js +9 -9
- package/dist/testing/web/index.cjs +3 -3
- package/dist/testing/web/index.d.cts +13 -13
- package/dist/testing/web/index.d.ts +13 -13
- package/dist/testing/web/index.js +1 -1
- package/dist/texting/index.cjs +1 -1
- package/dist/texting/index.d.cts +6 -6
- package/dist/texting/index.d.ts +6 -6
- package/dist/texting/index.js +26 -26
- package/dist/{threadOptions.d-bEAFkIsC.d.cts → threadOptions.d-Bqy5d5Fx.d.cts} +1 -1
- package/dist/{threadOptions.d-U5YBUKM-.d.ts → threadOptions.d-DOEIpk1t.d.ts} +1 -1
- package/dist/{threadOptions.d-BW0rePcs.d.cts → threadOptions.d-Dc57dm7h.d.cts} +7 -7
- package/dist/{threadOptions.d-CrAb71J2.d.ts → threadOptions.d-NSlFx-Lp.d.ts} +7 -7
- package/dist/{timelineRows.d-DXppCSCg.d.cts → timelineRows.d-7w8NsNi4.d.cts} +1 -1
- package/dist/{timelineRows.d-9Uhf4q5d.d.ts → timelineRows.d-CthNM5hV.d.ts} +1 -1
- 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/{useHealthPlanSubscription.d-CRBPMlsc.d.ts → useHealthPlanSubscription.d-CV7M21HS.d.ts} +3 -3
- package/dist/{useHealthPlanSubscription.d-DfjTYv1u.d.cts → useHealthPlanSubscription.d-SA9-SuKe.d.cts} +3 -3
- package/dist/{useInboxUnread.d-CP3KwSkn.d.ts → useInboxUnread.d-CXiaR3BZ.d.ts} +1 -1
- package/dist/{useInboxUnread.d-DiE_NbtS.d.cts → useInboxUnread.d-DERpMelw.d.cts} +1 -1
- package/dist/{usePresentation.d-DefUwatV.d.cts → usePresentation.d-BJzFicRQ.d.cts} +3 -3
- package/dist/{usePresentation.d-w5_oWKmh.d.ts → usePresentation.d-DgSGIWS-.d.ts} +3 -3
- package/dist/{useRecordsDepth.d-l6D0ZS4l.d.cts → useRecordsDepth.d-C9W45gwS.d.cts} +1 -1
- package/dist/{useRecordsDepth.d-DG2GiAyt.d.ts → useRecordsDepth.d-ZX2rhcUx.d.ts} +1 -1
- package/dist/{useUnread.d-xDOpYyqx.d.ts → useUnread.d-CedFK4k6.d.ts} +5 -5
- package/dist/{useUnread.d-DeRDFtTb.d.cts → useUnread.d-DST1GMmL.d.cts} +5 -5
- package/dist/video/index.cjs +1 -1
- package/dist/video/index.js +1 -1
- package/dist/{view.d-ufGX_MKK.d.cts → view.d-3lxzyJlL.d.cts} +6 -6
- package/dist/{view.d-iTInze7B.d.ts → view.d-DRiYNQJ8.d.ts} +6 -6
- package/dist/web/consent/index.cjs +3 -3
- package/dist/web/consent/index.d.cts +6 -6
- package/dist/web/consent/index.d.ts +6 -6
- 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 +17 -17
- package/dist/web/health-plan/index.d.ts +17 -17
- package/dist/web/health-plan/index.js +1 -1
- package/dist/web/inbox/index.cjs +5 -5
- package/dist/web/inbox/index.d.cts +9 -8
- package/dist/web/inbox/index.d.ts +9 -8
- package/dist/web/inbox/index.js +5 -5
- package/dist/web/index.cjs +196 -195
- package/dist/web/index.d.cts +34 -34
- package/dist/web/index.d.ts +34 -34
- package/dist/web/index.js +196 -195
- package/dist/web/intro/index.cjs +10 -10
- package/dist/web/intro/index.d.cts +8 -8
- package/dist/web/intro/index.d.ts +8 -8
- package/dist/web/intro/index.js +6 -6
- package/dist/web/notifications/index.cjs +5 -5
- package/dist/web/notifications/index.d.cts +7 -7
- package/dist/web/notifications/index.d.ts +7 -7
- package/dist/web/notifications/index.js +1 -1
- package/dist/web/records/depth/index.cjs +1 -1
- package/dist/web/records/depth/index.d.cts +10 -10
- package/dist/web/records/depth/index.d.ts +10 -10
- package/dist/web/records/depth/index.js +1 -1
- package/dist/web/records/index.cjs +1 -1
- package/dist/web/records/index.d.cts +13 -13
- package/dist/web/records/index.d.ts +13 -13
- 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.d.cts +3 -3
- package/dist/web/shop/index.d.ts +3 -3
- package/dist/web/shop/index.js +15 -15
- package/dist/web/televet/booking/index.cjs +7 -7
- package/dist/web/televet/booking/index.d.cts +9 -9
- package/dist/web/televet/booking/index.d.ts +9 -9
- package/dist/web/televet/booking/index.js +69 -69
- package/dist/web/televet/call/index.cjs +1 -1
- package/dist/web/televet/call/index.d.cts +2 -2
- package/dist/web/televet/call/index.d.ts +2 -2
- 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.d.cts +6 -6
- package/dist/web/texting/index.d.ts +6 -6
- package/dist/web/texting/index.js +1 -1
- package/dist/web/ui/index.cjs +1 -1
- package/dist/web/ui/index.js +32 -32
- package/package.json +1 -32
- package/dist/ErrorPolicyPort.d-68yrE3BE.d.ts +0 -23
- package/dist/ErrorPolicyPort.d-DirW9hgO.d.cts +0 -23
package/dist/server/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
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
2
|
function ok(e,t){/* @__PURE__ */
|
|
3
3
|
return Object.freeze({ok:true,value:e})}function err(e){/* @__PURE__ */
|
|
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 t=/^([A-Za-z][A-Za-z0-9+.-]*):\/\/([^/?#]*)/;var r="1.
|
|
5
|
-
return Object.freeze({ok:false,failure:/* @__PURE__ */Object.freeze({reason:e,message:t})})}function tryResolveApiBaseUrl(e){let t=e?.trim(),r=t&&t.length>0?t:
|
|
6
|
-
return Object.freeze({ok:true,value:p})}function c(e){let t=e.toLowerCase();return t==="localhost"||t==="127.0.0.1"||t==="[::1]"||t==="::1"}function f(e){let t=globalThis.process?.env?.[e];return typeof t=="string"&&t.trim().length>0?t.trim():void 0}var v="DAILY_QUOTA_EXCEEDED",_=/* @__PURE__ */new Set(["THROTTLINGEXCEPTION","RATELIMITED","TOOMANYREQUESTS"]);function h(e,t){if(!_.has(e.toUpperCase().replace(/[^A-Z0-9]/g,"")))return e;let r=t,n=r?.daily_limit??r?.error?.daily_limit;return typeof n=="number"&&Number.isFinite(n)?v: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 b=/* @__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"}),g=/* @__PURE__ */Object.freeze(y.map(e=>/* @__PURE__ */Object.freeze({wireCode:e.wireCode,envelope:e.envelope,retryable:e.retryable,normalized:b[e.wireCode]}))),w=new Map(g.map(e=>[e.envelope+e.wireCode.toUpperCase(),e])),S=/* @__PURE__ */Object.freeze(["http_envelope",...[...new Set(g.map(e=>e.envelope))].filter(e=>e!=="http_envelope").sort()]);function contractErrorFor(e,t){if(typeof e!="string")return;let r=e.trim().toUpperCase();if(r.length!==0)for(let e of[t??"http_envelope",...S]){let t=w.get(e+r);if(t)return t}}var C=/* @__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 C[e]}function fromWire(e){let t=contractErrorFor(e);if(t)return t.normalized;let r=(e??"").trim().toUpperCase(),n=r.replace(/[^A-Z0-9]/g,"");if(n==="AUTHREJECTED")return"authRejected";if(r.startsWith("AUTH"))return"authExpired";switch(n){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"}}function fromHttpStatus(e){return e===401?"authExpired":e===403?"accessDenied":e===404?"conversationNotFound":e===409?"idempotencyConflict":e===421?"unknown":e===429?"rateLimited":e===400||e===422?"unknown":e>=500?"internalError":"unknown"}var E=/* @__PURE__ */new Set(["streamTimeout","rateLimited","internalError","upstreamLlmTimeout","streamIncomplete"]);function isAutoRetryable(e){return E.has(e)}var T=/* @__PURE__ */new Set(["serviceUnavailable","conflict","idempotencyInFlight"]);function isRetryableCode(e){return isAutoRetryable(e)||T.has(e)}var $="This feature isn't available on your account right now.",R="Something in that request was not right. Check the details and try again.",k=/* @__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:$,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:R,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:$,runtimeDisposed:R,unknown:"Something went wrong. Please try again."}),A="This session has ended. Please sign in again.",I="linked_account_read_only";function D(e,t,r){return e==="conflict"&&r===I?$:(e==="authRejected"||e==="authExpired")&&typeof t=="string"&&t.trim().toLowerCase()==="session_revoked"?A:userFacingError(e)}function userFacingError(e){return k[e]}function O(e,t,r){Object.defineProperty(e,t,{value:r,enumerable:false,writable:false,configurable:false})}var F=/^[a-z][a-z0-9_]{0,63}$/;function makeEverfurError(e,t){let r=contractErrorFor(t?.wireCode,t?.wireEnvelope),n=e==="conflict"&&t?.reasonCode===I,a={code:e,category:categoryFor(e),retryable:t?.retryable??(n?false:isRetryableCode(e)),displayMessage:D(e,t?.wireCode,n?I:null)};t?.httpStatus!==void 0&&(a.httpStatus=t.httpStatus),t?.requestId&&(a.requestId=t.requestId),typeof t?.reasonCode=="string"&&F.test(t.reasonCode)&&(a.reasonCode=t.reasonCode);let i=t?.retryAfterSeconds;if(typeof i=="number"&&Number.isFinite(i)&&i>=0&&(a.retryAfterSeconds=Math.round(i)),r);return t?.wireMessage&&O(a,"wireMessage",t.wireMessage),t?.raw!==void 0&&t.raw!==null&&O(a,"raw",t.raw),/* @__PURE__ */Object.freeze(a)}var j="free_cap_reached";function N(e){return typeof e=="number"&&Number.isInteger(e)&&e>=0?e:null}function x(e){if(typeof e!="object"||e===null)return null;let t=e,r=t.detail,n=typeof r=="object"&&r!==null?r:t;if(n.error!==j&&n.code!==j)return null;let a=N(n.limit),i=N(n.used);if(a===null||i===null)return null;let o=n.resets_at,l=n.emergency_guidance;/* @__PURE__ */
|
|
7
|
-
return Object.freeze({limit:a,used:i,resetsAt:typeof o=="string"&&o.length>0?o:null,...typeof l=="string"&&l.trim().length>0?{emergencyGuidance:l}:{}})}function U(e,t){if(e.status!==429&&e.status!==503)return t;let r=L(e.headers.get(q),Date.now());if(r===null)return t;let n=t!==null&&typeof t=="object"&&!Array.isArray(t)?t:null;return n!==null&&z(n)?t:{...n??{},retry_after_seconds:r}}var q="retry-after";function L(e,t){if(e===null)return null;let r=e.trim();if(/^\d+$/.test(r))return Number(r);let n=Date.parse(r);return Number.isFinite(n)?Math.max(0,Math.ceil((n-t)/1e3)):null}function z(e){return[e,e.error,e.detail].some(e=>e!==null&&typeof e=="object"&&("retry_after_seconds"in e||"resets_at"in e))}var P="x-request-id";function errorFromResponse(e,t,r){let n=V(t),a=n?fromWire(n):fromHttpStatus(e),i=B(t);return makeEverfurError(a,{httpStatus:e,...Y(t)?{retryable:true}:{},...r?{requestId:r}:{},...n?{wireCode:n}:{},...K(t)?{reasonCode:K(t)}:{},...M(t)!==null?{retryAfterSeconds:M(t)}:{},...i?{wireMessage:i}:{},...t!=null?{raw:t}:{}})}function M(e){let t=e,r=t?.retry_after_seconds??t?.error?.retry_after_seconds;return typeof r=="number"&&Number.isFinite(r)&&r>=0?r:null}function networkError(e){return makeEverfurError("internalError",{retryable:true,wireMessage:W(e)})}function requestIdOf(e){let t=e.headers.get(P);return typeof t=="string"&&t.length>0?t:null}function getGlobalFetch(){let t=globalThis.fetch;if(typeof t!="function")throw new e("missing-peer-dependency","global fetch is unavailable; provide config.transport or an injected fetch implementation");return t}function K(e){let t=e,r=t?.error?.reason_code??t?.reason_code;return typeof r=="string"&&r.length>0?r:null}function V(e){let t=e,r=t?.error?.code??t?.code;return typeof r=="string"&&r.length>0?h(r,e):x(e)!==null?j:null}function B(e){let t=e,r=t?.error?.message??t?.message;return typeof r=="string"&&r.length>0?r:null}function Y(e){let t=e;return t?.error?.retryable===true||t?.retryable===true}function W(e){return e instanceof Error?e.message:typeof e=="string"?e:"network request failed"}var Z=["sk_partner_","rk_partner_"];function G(t,r){if(typeof t!="string"||t.length===0)throw new e("invalid-argument","partnerSecretKey is required");if(t.startsWith("pk_"))throw new e("invalid-argument",`partnerSecretKey is a publishable key (pk_...): ${r} needs your secret key, server side only`);if(!Z.some(e=>t.startsWith(e)))throw new e("invalid-argument","partnerSecretKey must be an sk_partner_ secret key or an rk_partner_ restricted key")}var Q=128;function assertValidUserRef(t){let r=typeof t=="string"?[...t].length:0;if(typeof t!="string"||r<1||r>Q)throw new e("invalid-argument",`user_ref must be 1..${Q} characters`);if(t.trim().length===0)throw new e("invalid-argument","user_ref must not be blank: the server strips surrounding whitespace before validating, so a whitespace-only value arrives empty and is rejected as required.");if(t!==t.trim())throw new e("invalid-argument","user_ref must not have leading or trailing whitespace: the server strips it, so padded and unpadded forms of the same id resolve to ONE user. Pass the exact id you want to key on.");if(t.includes("@"))throw new e("invalid-argument","user_ref must not contain '@'");if(!X(t))throw new e("invalid-argument","user_ref must be printable (no control characters)");return t}function X(e){return!H.test(e)}var H=/[\p{Cc}\p{Cf}\p{Cs}\p{Co}\p{Cn}\p{Zl}\p{Zp}]|(?!\u0020)[\p{Zs}]/u,J="user_ref_invalid";function ee(e){let t=e.raw,r=typeof t=="object"&&t!==null?t:null,n=(r!==null&&typeof r.error=="object"&&r.error!==null?r.error.code:void 0)??r?.code;return n!==J&&e.reasonCode!==J?e:makeEverfurError("validationFailed",{retryable:false,...e.httpStatus!==void 0?{httpStatus:e.httpStatus}:{},...e.requestId!==void 0?{requestId:e.requestId}:{},...typeof n=="string"?{wireCode:n}:{},reasonCode:J,...e.wireMessage!==void 0?{wireMessage:e.wireMessage}:{},...t!==void 0?{raw:t}:{}})}function te(e){for(let t=0;t<e.length;t+=1){let r=e.charCodeAt(t);if(r>=55296&&r<=56319){let r=e.charCodeAt(t+1);if(!(r>=56320&&r<=57343))return true;t+=1}else if(r>=56320&&r<=57343)return true}return false}function re(e){return[...e].length}var ne=/* @__PURE__ */Object.freeze({dog:"dog",canine:"dog",k9:"dog",puppy:"dog",cat:"cat",feline:"cat",kitten:"cat"});function canonicalPetSpecies(e){if(typeof e!="string")return null;let t=e.trim().toLowerCase();return Object.prototype.hasOwnProperty.call(ne,t)?ne[t]:null}var ae=50,ie=128,oe=120,le=120,se=2e3,ue=120,de=80,pe=/* @__PURE__ */new Set(["male","female","unknown"]),ce=/* @__PURE__ */new Set(["day","month","year"]),fe=/* @__PURE__ */new Set(["low","medium","high","athletic"]),ve=/* @__PURE__ */new Set(["indoor","outdoor","both"]),_e=/* @__PURE__ */new Set(["mild","moderate","severe"]),he=/^(\d{4})-(\d{2})-(\d{2})$/,me=[["sex","sex"],["spayedNeutered","spayed_neutered"],["birthDate","birth_date"],["birthDatePrecision","birth_date_precision"],["activityLevel","activity_level"],["indoorOutdoor","indoor_outdoor"],["foodBrand","food_brand"],["foodType","food_type"],["microchipId","microchip_id"]],ye=[["allergies","allergies"],["medications","medications"],["supplements","supplements"],["conditions","conditions"]];/* @__PURE__ */Object.freeze([...me,...ye].map(([e])=>e));function be(e){let t=he.exec(e);if(t===null)return false;let[r,n,a]=[Number(t[1]),Number(t[2]),Number(t[3])],i=new Date(Date.UTC(r,n-1,a));return i.getUTCFullYear()===r&&i.getUTCMonth()===n-1&&i.getUTCDate()===a}var ge=e=>(t,r)=>typeof r=="string"&&e.has(r)?null:`${t} must be one of ${[...e].join(", ")}`,we=(e,t)=>typeof t=="boolean"?null:`${e} must be true or false`,Se=(e,t)=>typeof t=="string"&&be(t)?null:`${e} must be a real date written YYYY-MM-DD`,Ce=(e,t={})=>(r,n)=>{if(typeof n!="string")return`${r} must be a string`;if(te(n))return`${r} contains an unpaired surrogate and cannot be encoded`;let a=t.trimmed?n.trim():n;if(t.required&&a.length===0)return`${r} is required and must not be blank`;let i=re(a);return i<=e?null:`${r} is ${i} characters; the server accepts at most ${e}`},Ee={sex:ge(pe),spayedNeutered:we,birthDate:Se,birthDatePrecision:ge(ce),activityLevel:ge(fe),indoorOutdoor:ge(ve),foodBrand:Ce(ue),foodType:Ce(ue),microchipId:Ce(de)},Te=["ref","ref",false,Ce(ie,{required:true,trimmed:true})],$e=["notes","notes",false,Ce(se,{trimmed:true})],Re=[Te,["name","name",true,Ce(oe,{required:true,trimmed:true})],["dose","dose",false,Ce(le,{trimmed:true})],["frequency","frequency",false,Ce(le,{trimmed:true})],["startDate","start_date",false,Se],["endDate","end_date",false,Se],$e],ke={allergies:[Te,["allergen","allergen",true,Ce(oe,{required:true,trimmed:true})],["severity","severity",false,ge(_e)],$e],medications:Re,supplements:Re,conditions:[Te,["conditionName","condition_name",true,Ce(oe,{required:true,trimmed:true})],["diagnosedDate","diagnosed_date",false,Se],$e]};function Ae(e,t,r){let n=`${e}[${t}]`;if(typeof r!="object"||r===null||Array.isArray(r))return{error:`${n} must be an object`};let a=r,i={};for(let[t,r,o,l]of ke[e]){let e=a[t];if(e==null){if(o)return{error:`${n}.${t} is required`};e===null&&(i[r]=null);continue}let s=l(`${n}.${t}`,e);if(s!==null)return{error:s};i[r]=e}let o=i.start_date,l=i.end_date;return typeof o=="string"&&typeof l=="string"&&l<o?{error:`${n}.endDate must not be before startDate`}:{item:i}}function Ie(e,t){if(!Array.isArray(t))return{error:`${e} must be an array (send [] to clear it)`};if(t.length>ae)return{error:`${e} has ${t.length} items; the server accepts at most ${ae}`};let r=[],n=/* @__PURE__ */new Set;for(let a=0;a<t.length;a+=1){let i=Ae(e,a,t[a]);if("error"in i)return i;let o=i.item.ref;if(typeof o=="string"){let t=o.trim();if(n.has(t))return{error:`${e}: ref ${JSON.stringify(t)} is used twice; a ref names one item`};n.add(t)}r.push(i.item)}return{items:r}}function De(e,t){let r=e,n={};for(let[e,t]of me){let a=r[e];if(a!==void 0){if(a!==null){let t=Ee[e](e,a);if(t!==null)return{error:t}}n[t]=a}}let a=r.birthDate!==void 0,i=r.birthDatePrecision!==void 0;if(a!==i||a&&r.birthDate===null!=(r.birthDatePrecision===null))return{error:"birthDate and birthDatePrecision must be sent together, both set or both null"};for(let[e,t]of ye){let a=r[e];if(a===void 0)continue;let i=Ie(e,a);if("error"in i)return i;n[t]=i.items}return Object.keys(n).length>0&&t!==void 0&&canonicalPetSpecies(t)===null?{error:"health fields need a pet Everfur reads as a dog or a cat (dog, canine, k9, puppy, cat, feline, kitten)"}:{body:n}}var Oe=e=>typeof e=="string"?e:null,Fe=(e,t)=>typeof t=="string"&&e.has(t)?t:null,je=e=>typeof e=="boolean"?e:null;function Ne(e,t){return Array.isArray(e)?/* @__PURE__ */Object.freeze(e.flatMap(e=>{if(typeof e!="object"||e===null||Array.isArray(e))return[];let r=t(e);return r===null?[]:[r]})):/* @__PURE__ */Object.freeze([])}function xe(e){let t=Oe(e.name);return t===null||t.length===0?null:/* @__PURE__ */Object.freeze({ref:Oe(e.ref),name:t,dose:Oe(e.dose),frequency:Oe(e.frequency),startDate:Oe(e.start_date),endDate:Oe(e.end_date),notes:Oe(e.notes)})}function Ue(e){let t=e.profile_version;/* @__PURE__ */
|
|
8
|
-
return Object.freeze({profileVersion:typeof t=="number"&&Number.isInteger(t)&&t>=0?t:0,sex:
|
|
9
|
-
return Object.freeze({givenAt:t.given_at,method:t.method,version:t.version})}function
|
|
10
|
-
return Object.freeze({textId:typeof r=="string"&&r.length>0?r:null,status:typeof t.status=="string"?t.status:null,duplicate:typeof t.duplicate=="boolean"?t.duplicate:null})}var
|
|
11
|
-
return Object.freeze({active:
|
|
12
|
-
return Object.freeze({sessionToken:t.session_token,expiresAt:t.expires_at,capabilities:/* @__PURE__ */Object.freeze(r)})}async function
|
|
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 t=/^([A-Za-z][A-Za-z0-9+.-]*):\/\/([^/?#]*)/;var r="1.5.0";var n="2026-09-19",a="EVERFUR_API_BASE_URL";function i(e,t){/* @__PURE__ */
|
|
5
|
+
return Object.freeze({ok:false,failure:/* @__PURE__ */Object.freeze({reason:e,message:t})})}function tryResolveApiBaseUrl(e){let t=e?.trim(),r=t&&t.length>0?t:c(a);return r?d(r):i("missing-api-base-url",`apiBaseUrl is required: pass config.apiBaseUrl or set ${a}. The SDK never ships a hardcoded host.`)}function resolveApiBaseUrl(t){let r=tryResolveApiBaseUrl(t);if(!r.ok)throw new e("invalid-argument",r.failure.message);return r.value}function o(e){return e.slice(e.lastIndexOf("@")+1).replace(/:\d+$/,"").toLowerCase()}function l(e){return e.length===0||e.includes("@")?false:e.startsWith("[")&&e.endsWith("]")?true:!e.includes(":")}function s(e,t){let r=e.indexOf("://");return r<0||e.slice(r+3).includes("@")?false:l(t)}function u(e,t){return`${e}://${t}`}function d(e){let r=e.trim(),n=t.exec(r);if(n===null||n[2]===void 0||n[2].length===0)return i("malformed-api-base-url","apiBaseUrl is not a valid absolute URL");let a=(n[1]??"").toLowerCase(),l=o(n[2]);if(l.length===0)return i("malformed-api-base-url","apiBaseUrl is not a valid absolute URL");let d=s(r,l)?`: ${u(a,l)}`:"";if(a!=="https"){if(!(a==="http"&&p(l)))return a==="http"?i("insecure-api-base-url",`apiBaseUrl must use https (cleartext http is only allowed for localhost)${d}`):i("unsupported-api-base-url-scheme",`apiBaseUrl must be http(s)${d}`)}let c=r.endsWith("/")?r.slice(0,-1):r;/* @__PURE__ */
|
|
6
|
+
return Object.freeze({ok:true,value:c})}function p(e){let t=e.toLowerCase();return t==="localhost"||t==="127.0.0.1"||t==="[::1]"||t==="::1"}function c(e){let t=globalThis.process?.env?.[e];return typeof t=="string"&&t.trim().length>0?t.trim():void 0}var f="server";function v(e){return{"X-Everfur-SDK-Version":r,"X-Everfur-SDK-Platform":f,"X-Everfur-Contract":e}}var _="DAILY_QUOTA_EXCEEDED",h=/* @__PURE__ */new Set(["THROTTLINGEXCEPTION","RATELIMITED","TOOMANYREQUESTS"]);function m(e,t){if(!h.has(e.toUpperCase().replace(/[^A-Z0-9]/g,"")))return e;let r=t,n=r?.daily_limit??r?.error?.daily_limit;return typeof n=="number"&&Number.isFinite(n)?_:e}var y=[{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}],b=/* @__PURE__ */Object.freeze(y.map(e=>/* @__PURE__ */Object.freeze(e)));/* @__PURE__ */Object.freeze(b.map(e=>e.wireCode));var g=/* @__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"}),w=/* @__PURE__ */Object.freeze(b.map(e=>/* @__PURE__ */Object.freeze({wireCode:e.wireCode,envelope:e.envelope,retryable:e.retryable,normalized:g[e.wireCode]}))),S=new Map(w.map(e=>[e.envelope+e.wireCode.toUpperCase(),e])),C=/* @__PURE__ */Object.freeze(["http_envelope",...[...new Set(w.map(e=>e.envelope))].filter(e=>e!=="http_envelope").sort()]);function contractErrorFor(e,t){if(typeof e!="string")return;let r=e.trim().toUpperCase();if(r.length!==0)for(let e of[t??"http_envelope",...C]){let t=S.get(e+r);if(t)return t}}var E=/* @__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[e]}function fromWire(e){let t=contractErrorFor(e);if(t)return t.normalized;let r=(e??"").trim().toUpperCase(),n=r.replace(/[^A-Z0-9]/g,"");if(n==="AUTHREJECTED")return"authRejected";if(r.startsWith("AUTH"))return"authExpired";switch(n){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"}}function fromHttpStatus(e){return e===401?"authExpired":e===403?"accessDenied":e===404?"conversationNotFound":e===409?"idempotencyConflict":e===421?"unknown":e===429?"rateLimited":e===400||e===422?"unknown":e>=500?"internalError":"unknown"}var $=/* @__PURE__ */new Set(["streamTimeout","rateLimited","internalError","upstreamLlmTimeout","streamIncomplete"]);function isAutoRetryable(e){return $.has(e)}var T=/* @__PURE__ */new Set(["serviceUnavailable","conflict","idempotencyInFlight"]);function isRetryableCode(e){return isAutoRetryable(e)||T.has(e)}var R="This feature isn't available on your account right now.",A="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:R,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:A,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:R,runtimeDisposed:A,unknown:"Something went wrong. Please try again."}),k="This session has ended. Please sign in again.",D="linked_account_read_only";function F(e,t,r){return e==="conflict"&&r===D?R:(e==="authRejected"||e==="authExpired")&&typeof t=="string"&&t.trim().toLowerCase()==="session_revoked"?k:userFacingError(e)}function userFacingError(e){return I[e]}function O(e,t,r){Object.defineProperty(e,t,{value:r,enumerable:false,writable:false,configurable:false})}var j=/^[a-z][a-z0-9_]{0,63}$/;function makeEverfurError(e,t){let r=contractErrorFor(t?.wireCode,t?.wireEnvelope),n=e==="conflict"&&t?.reasonCode===D,a={code:e,category:categoryFor(e),retryable:t?.retryable??(n?false:isRetryableCode(e)),displayMessage:F(e,t?.wireCode,n?D:null)};t?.httpStatus!==void 0&&(a.httpStatus=t.httpStatus),t?.requestId&&(a.requestId=t.requestId),typeof t?.reasonCode=="string"&&j.test(t.reasonCode)&&(a.reasonCode=t.reasonCode);let i=t?.retryAfterSeconds;if(typeof i=="number"&&Number.isFinite(i)&&i>=0&&(a.retryAfterSeconds=Math.round(i)),r);return t?.wireMessage&&O(a,"wireMessage",t.wireMessage),t?.raw!==void 0&&t.raw!==null&&O(a,"raw",t.raw),/* @__PURE__ */Object.freeze(a)}var N="free_cap_reached";function x(e){return typeof e=="number"&&Number.isInteger(e)&&e>=0?e:null}function U(e){if(typeof e!="object"||e===null)return null;let t=e,r=t.detail,n=typeof r=="object"&&r!==null?r:t;if(n.error!==N&&n.code!==N)return null;let a=x(n.limit),i=x(n.used);if(a===null||i===null)return null;let o=n.resets_at,l=n.emergency_guidance;/* @__PURE__ */
|
|
7
|
+
return Object.freeze({limit:a,used:i,resetsAt:typeof o=="string"&&o.length>0?o:null,...typeof l=="string"&&l.trim().length>0?{emergencyGuidance:l}:{}})}function q(e,t){if(e.status!==429&&e.status!==503)return t;let r=z(e.headers.get(L),Date.now());if(r===null)return t;let n=t!==null&&typeof t=="object"&&!Array.isArray(t)?t:null;return n!==null&&P(n)?t:{...n??{},retry_after_seconds:r}}var L="retry-after";function z(e,t){if(e===null)return null;let r=e.trim();if(/^\d+$/.test(r))return Number(r);let n=Date.parse(r);return Number.isFinite(n)?Math.max(0,Math.ceil((n-t)/1e3)):null}function P(e){return[e,e.error,e.detail].some(e=>e!==null&&typeof e=="object"&&("retry_after_seconds"in e||"resets_at"in e))}var M="x-request-id";function errorFromResponse(e,t,r){let n=Y(t),a=n?fromWire(n):fromHttpStatus(e),i=V(t);return makeEverfurError(a,{httpStatus:e,...W(t)?{retryable:true}:{},...r?{requestId:r}:{},...n?{wireCode:n}:{},...B(t)?{reasonCode:B(t)}:{},...K(t)!==null?{retryAfterSeconds:K(t)}:{},...i?{wireMessage:i}:{},...t!=null?{raw:t}:{}})}function K(e){let t=e,r=t?.retry_after_seconds??t?.error?.retry_after_seconds;return typeof r=="number"&&Number.isFinite(r)&&r>=0?r:null}function networkError(e){return makeEverfurError("internalError",{retryable:true,wireMessage:Z(e)})}function requestIdOf(e){let t=e.headers.get(M);return typeof t=="string"&&t.length>0?t:null}function getGlobalFetch(){let t=globalThis.fetch;if(typeof t!="function")throw new e("missing-peer-dependency","global fetch is unavailable; provide config.transport or an injected fetch implementation");return t}function B(e){let t=e,r=t?.error?.reason_code??t?.reason_code;return typeof r=="string"&&r.length>0?r:null}function Y(e){let t=e,r=t?.error?.code??t?.code;return typeof r=="string"&&r.length>0?m(r,e):U(e)!==null?N:null}function V(e){let t=e,r=t?.error?.message??t?.message;return typeof r=="string"&&r.length>0?r:null}function W(e){let t=e;return t?.error?.retryable===true||t?.retryable===true}function Z(e){return e instanceof Error?e.message:typeof e=="string"?e:"network request failed"}var G=["sk_partner_","rk_partner_"];function Q(t,r){if(typeof t!="string"||t.length===0)throw new e("invalid-argument","partnerSecretKey is required");if(t.startsWith("pk_"))throw new e("invalid-argument",`partnerSecretKey is a publishable key (pk_...): ${r} needs your secret key, server side only`);if(!G.some(e=>t.startsWith(e)))throw new e("invalid-argument","partnerSecretKey must be an sk_partner_ secret key or an rk_partner_ restricted key")}var X=128;function assertValidUserRef(t){let r=typeof t=="string"?[...t].length:0;if(typeof t!="string"||r<1||r>X)throw new e("invalid-argument",`user_ref must be 1..${X} characters`);if(t.trim().length===0)throw new e("invalid-argument","user_ref must not be blank: the server strips surrounding whitespace before validating, so a whitespace-only value arrives empty and is rejected as required.");if(t!==t.trim())throw new e("invalid-argument","user_ref must not have leading or trailing whitespace: the server strips it, so padded and unpadded forms of the same id resolve to ONE user. Pass the exact id you want to key on.");if(t.includes("@"))throw new e("invalid-argument","user_ref must not contain '@'");if(!H(t))throw new e("invalid-argument","user_ref must be printable (no control characters)");return t}function H(e){return!J.test(e)}var J=/[\p{Cc}\p{Cf}\p{Cs}\p{Co}\p{Cn}\p{Zl}\p{Zp}]|(?!\u0020)[\p{Zs}]/u,ee="user_ref_invalid";function te(e){let t=e.raw,r=typeof t=="object"&&t!==null?t:null,n=(r!==null&&typeof r.error=="object"&&r.error!==null?r.error.code:void 0)??r?.code;return n!==ee&&e.reasonCode!==ee?e:makeEverfurError("validationFailed",{retryable:false,...e.httpStatus!==void 0?{httpStatus:e.httpStatus}:{},...e.requestId!==void 0?{requestId:e.requestId}:{},...typeof n=="string"?{wireCode:n}:{},reasonCode:ee,...e.wireMessage!==void 0?{wireMessage:e.wireMessage}:{},...t!==void 0?{raw:t}:{}})}function re(e){let t=e.raw;if(typeof t!="object"||t===null)return null;let r=t.code;return typeof r=="string"&&r.length>0?r:null}function ne(e,t){let r=re(e);if(r===null)return e;let n=t[r];return n===void 0?e:makeEverfurError(n.code,{retryable:n.retryable,...e.httpStatus!==void 0?{httpStatus:e.httpStatus}:{},...e.requestId!==void 0?{requestId:e.requestId}:{},wireCode:r,reasonCode:r,...e.wireMessage!==void 0?{wireMessage:e.wireMessage}:{},raw:e.raw})}function ae(e,t){let r=ne(e,t);if(r!==e||re(e)!==null)return r;let n=e.reasonCode;if(typeof n!="string")return e;let a=t[n];return a===void 0?e:makeEverfurError(a.code,{retryable:a.retryable,...e.httpStatus!==void 0?{httpStatus:e.httpStatus}:{},...e.requestId!==void 0?{requestId:e.requestId}:{},wireCode:n,reasonCode:n,...e.wireMessage!==void 0?{wireMessage:e.wireMessage}:{},raw:e.raw})}var ie=64;function oe(t){if(t!=null){if(typeof t!="string"||t.length===0||t.length>ie||/\s/.test(t))throw new e("invalid-argument",`timezone must be an IANA zone name such as 'America/Chicago' (at most ${ie} characters)`);return t}}function le(e){for(let t=0;t<e.length;t+=1){let r=e.charCodeAt(t);if(r>=55296&&r<=56319){let r=e.charCodeAt(t+1);if(!(r>=56320&&r<=57343))return true;t+=1}else if(r>=56320&&r<=57343)return true}return false}function se(e){return[...e].length}var ue=/* @__PURE__ */Object.freeze({dog:"dog",canine:"dog",k9:"dog",puppy:"dog",cat:"cat",feline:"cat",kitten:"cat"});function canonicalPetSpecies(e){if(typeof e!="string")return null;let t=e.trim().toLowerCase();return Object.prototype.hasOwnProperty.call(ue,t)?ue[t]:null}var de=50,pe=128,ce=120,fe=120,ve=2e3,_e=120,he=80,me=/* @__PURE__ */new Set(["male","female","unknown"]),ye=/* @__PURE__ */new Set(["day","month","year"]),be=/* @__PURE__ */new Set(["low","medium","high","athletic"]),ge=/* @__PURE__ */new Set(["indoor","outdoor","both"]),we=/* @__PURE__ */new Set(["mild","moderate","severe"]),Se=/^(\d{4})-(\d{2})-(\d{2})$/,Ce=[["sex","sex"],["spayedNeutered","spayed_neutered"],["birthDate","birth_date"],["birthDatePrecision","birth_date_precision"],["activityLevel","activity_level"],["indoorOutdoor","indoor_outdoor"],["foodBrand","food_brand"],["foodType","food_type"],["microchipId","microchip_id"]],Ee=[["allergies","allergies"],["medications","medications"],["supplements","supplements"],["conditions","conditions"]];/* @__PURE__ */Object.freeze([...Ce,...Ee].map(([e])=>e));function $e(e){let t=Se.exec(e);if(t===null)return false;let[r,n,a]=[Number(t[1]),Number(t[2]),Number(t[3])],i=new Date(Date.UTC(r,n-1,a));return i.getUTCFullYear()===r&&i.getUTCMonth()===n-1&&i.getUTCDate()===a}var Te=e=>(t,r)=>typeof r=="string"&&e.has(r)?null:`${t} must be one of ${[...e].join(", ")}`,Re=(e,t)=>typeof t=="boolean"?null:`${e} must be true or false`,Ae=(e,t)=>typeof t=="string"&&$e(t)?null:`${e} must be a real date written YYYY-MM-DD`,Ie=(e,t={})=>(r,n)=>{if(typeof n!="string")return`${r} must be a string`;if(le(n))return`${r} contains an unpaired surrogate and cannot be encoded`;let a=t.trimmed?n.trim():n;if(t.required&&a.length===0)return`${r} is required and must not be blank`;let i=se(a);return i<=e?null:`${r} is ${i} characters; the server accepts at most ${e}`},ke={sex:Te(me),spayedNeutered:Re,birthDate:Ae,birthDatePrecision:Te(ye),activityLevel:Te(be),indoorOutdoor:Te(ge),foodBrand:Ie(_e),foodType:Ie(_e),microchipId:Ie(he)},De=["ref","ref",false,Ie(pe,{required:true,trimmed:true})],Fe=["notes","notes",false,Ie(ve,{trimmed:true})],Oe=[De,["name","name",true,Ie(ce,{required:true,trimmed:true})],["dose","dose",false,Ie(fe,{trimmed:true})],["frequency","frequency",false,Ie(fe,{trimmed:true})],["startDate","start_date",false,Ae],["endDate","end_date",false,Ae],Fe],je={allergies:[De,["allergen","allergen",true,Ie(ce,{required:true,trimmed:true})],["severity","severity",false,Te(we)],Fe],medications:Oe,supplements:Oe,conditions:[De,["conditionName","condition_name",true,Ie(ce,{required:true,trimmed:true})],["diagnosedDate","diagnosed_date",false,Ae],Fe]};function Ne(e,t,r){let n=`${e}[${t}]`;if(typeof r!="object"||r===null||Array.isArray(r))return{error:`${n} must be an object`};let a=r,i={};for(let[t,r,o,l]of je[e]){let e=a[t];if(e==null){if(o)return{error:`${n}.${t} is required`};e===null&&(i[r]=null);continue}let s=l(`${n}.${t}`,e);if(s!==null)return{error:s};i[r]=e}let o=i.start_date,l=i.end_date;return typeof o=="string"&&typeof l=="string"&&l<o?{error:`${n}.endDate must not be before startDate`}:{item:i}}function xe(e,t){if(!Array.isArray(t))return{error:`${e} must be an array (send [] to clear it)`};if(t.length>de)return{error:`${e} has ${t.length} items; the server accepts at most ${de}`};let r=[],n=/* @__PURE__ */new Set;for(let a=0;a<t.length;a+=1){let i=Ne(e,a,t[a]);if("error"in i)return i;let o=i.item.ref;if(typeof o=="string"){let t=o.trim();if(n.has(t))return{error:`${e}: ref ${JSON.stringify(t)} is used twice; a ref names one item`};n.add(t)}r.push(i.item)}return{items:r}}function Ue(e,t){let r=e,n={};for(let[e,t]of Ce){let a=r[e];if(a!==void 0){if(a!==null){let t=ke[e](e,a);if(t!==null)return{error:t}}n[t]=a}}let a=r.birthDate!==void 0,i=r.birthDatePrecision!==void 0;if(a!==i||a&&r.birthDate===null!=(r.birthDatePrecision===null))return{error:"birthDate and birthDatePrecision must be sent together, both set or both null"};for(let[e,t]of Ee){let a=r[e];if(a===void 0)continue;let i=xe(e,a);if("error"in i)return i;n[t]=i.items}return Object.keys(n).length>0&&t!==void 0&&canonicalPetSpecies(t)===null?{error:"health fields need a pet Everfur reads as a dog or a cat (dog, canine, k9, puppy, cat, feline, kitten)"}:{body:n}}var qe=e=>typeof e=="string"?e:null,Le=(e,t)=>typeof t=="string"&&e.has(t)?t:null,ze=e=>typeof e=="boolean"?e:null;function Pe(e,t){return Array.isArray(e)?/* @__PURE__ */Object.freeze(e.flatMap(e=>{if(typeof e!="object"||e===null||Array.isArray(e))return[];let r=t(e);return r===null?[]:[r]})):/* @__PURE__ */Object.freeze([])}function Me(e){let t=qe(e.name);return t===null||t.length===0?null:/* @__PURE__ */Object.freeze({ref:qe(e.ref),name:t,dose:qe(e.dose),frequency:qe(e.frequency),startDate:qe(e.start_date),endDate:qe(e.end_date),notes:qe(e.notes)})}function Ke(e){let t=e.profile_version;/* @__PURE__ */
|
|
8
|
+
return Object.freeze({profileVersion:typeof t=="number"&&Number.isInteger(t)&&t>=0?t:0,sex:Le(me,e.sex),spayedNeutered:ze(e.spayed_neutered),birthDate:qe(e.birth_date),birthDatePrecision:Le(ye,e.birth_date_precision),activityLevel:Le(be,e.activity_level),indoorOutdoor:Le(ge,e.indoor_outdoor),foodBrand:qe(e.food_brand),foodType:qe(e.food_type),microchipId:qe(e.microchip_id),allergies:Pe(e.allergies,e=>{let t=qe(e.allergen);return t===null||t.length===0?null:/* @__PURE__ */Object.freeze({ref:qe(e.ref),allergen:t,severity:Le(we,e.severity),notes:qe(e.notes)})}),medications:Pe(e.medications,Me),supplements:Pe(e.supplements,Me),conditions:Pe(e.conditions,e=>{let t=qe(e.condition_name);return t===null||t.length===0?null:/* @__PURE__ */Object.freeze({ref:qe(e.ref),conditionName:t,diagnosedDate:qe(e.diagnosed_date),notes:qe(e.notes)})})})}var Be=128,Ye=3e4;async function upsertPartnerPet(e,t,r){return Ve(e,"PUT",t,Xe(r,false))}async function updatePartnerPet(e,t,r){return Ve(e,"PATCH",t,Xe(r,true))}async function getPartnerPet(e,t){let r=await We(e,"GET",t,void 0);if(!("status"in r))return r;let n=await rt(r),a=requestIdOf(r);if(!r.ok)return err(errorFromResponse(r.status,q(r,n),a));let i=tt(n);return i?ok(/* @__PURE__ */Object.freeze({...i,...Ke(n)})):err(errorFromResponse(502,{error:{code:"INTERNAL_ERROR"}},a))}async function deletePartnerPet(e,t){let r=await We(e,"DELETE",t,void 0);return"status"in r?r.ok?ok(void 0):err(errorFromResponse(r.status,q(r,await rt(r)),requestIdOf(r))):r}async function Ve(e,t,r,n){let a=await We(e,t,r,n);if(!("status"in a))return a;let i=await rt(a),o=requestIdOf(a);if(!a.ok)return err(errorFromResponse(a.status,q(a,i),o));let l=tt(i);return l?ok(l):err(errorFromResponse(502,{error:{code:"INTERNAL_ERROR"}},o))}async function We(e,t,r,a){Q(e.partnerSecretKey,"writing pets");let i=Ze(r),o=e.fetchImpl??getGlobalFetch(),l=`${resolveApiBaseUrl(e.apiBaseUrl)}${i}`,s={...v(e.contractVersion??n),accept:"application/json","x-everfur-partner-secret-key":e.partnerSecretKey};a!==void 0&&(s["content-type"]="application/json");let u=new AbortController,d=setTimeout(()=>u.abort(),Ye);try{return await o(l,{method:t,headers:s,...a!==void 0?{body:a}:{},signal:u.signal})}catch(e){return err(networkError(e))}finally{clearTimeout(d)}}function Ze(t){if(typeof t!="object"||t===null)throw new e("invalid-argument","target is required");let userRef=assertValidUserRef(t.userRef);Ge("userRef",userRef);let petRef=t.petRef,r=typeof petRef=="string"?[...petRef].length:0;if(typeof petRef!="string"||r<1||r>Be)throw new e("invalid-argument",`petRef must be 1..${Be} characters`);return Ge("petRef",petRef),`/partners/members/${encodeURIComponent(userRef)}/pets/${encodeURIComponent(petRef)}`}function Ge(t,r){if(r.includes("/")||r==="."||r==="..")throw new e("invalid-argument",`${t} cannot contain '/' or be '.' or '..': it is sent as a URL path segment`)}var Qe=[["name","name"],["species","species"],["breed","breed"],["ageYears","age_years"],["weightKg","weight_kg"],["partnerLabelInstructions","partner_label_instructions"]];function Xe(t,r){let n=He(t);if(r&&Object.keys(n).length===0)throw new e("invalid-argument","updatePartnerPet needs at least one field to change");return JSON.stringify(n)}function He(t){if(typeof t!="object"||t===null||Array.isArray(t))throw new e("invalid-argument","the pet profile must be an object");let r={};for(let[e,n]of Qe)t[e]!==void 0&&(r[n]=t[e]);let n=Ue(t,t.species);if("error"in n)throw new e("invalid-argument",n.error);return Object.assign(r,n.body)}function Je(e){return e==null?null:typeof e=="string"?e:void 0}function et(e){return e==null?null:typeof e=="number"?e:void 0}function tt(e){if(typeof e!="object"||e===null)return null;let t=e;if(typeof t.pet_id!="string"||typeof t.pet_ref!="string"||typeof t.updated_at!="string")return null;let r=Je(t.name),n=Je(t.species),a=Je(t.breed),i=et(t.age_years),o=et(t.weight_kg);return r===void 0||n===void 0||a===void 0||i===void 0||o===void 0?null:/* @__PURE__ */Object.freeze({petId:t.pet_id,petRef:t.pet_ref,name:r,species:n,breed:a,ageYears:i,weightKg:o,updatedAt:t.updated_at})}async function rt(e){try{return await e.json()}catch{return null}}var nt=3e4;async function revokePartnerMemberSessions(t,r){if(Q(t.partnerSecretKey,"revoking member sessions"),t.partnerSecretKey.startsWith("rk_partner_"))throw new e("invalid-argument","revoking member sessions needs your unrestricted sk_partner_ secret key; an rk_partner_ restricted key is refused (unrestrictedKeyRequired)");if(typeof r!="object"||r===null)throw new e("invalid-argument","input is required");let userRef=assertValidUserRef(r.userRef),a=t.fetchImpl??getGlobalFetch(),i=`${resolveApiBaseUrl(t.apiBaseUrl)}/widget/v1/sessions/revoke`,o={...v(t.contractVersion??n),accept:"application/json","content-type":"application/json","x-everfur-partner-secret-key":t.partnerSecretKey},l=new AbortController,s=setTimeout(()=>l.abort(),nt),u;try{u=await a(i,{method:"POST",headers:o,body:JSON.stringify({user_ref:userRef}),signal:l.signal})}catch(e){return err(networkError(e))}finally{clearTimeout(s)}let d=await it(u),p=requestIdOf(u);if(!u.ok)return err(te(errorFromResponse(u.status,q(u,d),p)));let c=at(d);return c?ok(c):err(errorFromResponse(502,{error:{code:"INTERNAL_ERROR"}},p))}function at(e){if(typeof e!="object"||e===null)return null;let t=e;return t.revoked!==true||typeof t.sessions_valid_after!="number"||!Number.isFinite(t.sessions_valid_after)?null:/* @__PURE__ */Object.freeze({revoked:true,sessionsValidAfter:t.sessions_valid_after})}async function it(e){try{return await e.json()}catch{return null}}var ot=254,lt=64,st=/^[^@\s]+@[^@\s]+\.[^@\s]+$/,ut=3e4,dt=/* @__PURE__ */Object.freeze({consent_required:{code:"validationFailed",retryable:false},email_invalid:{code:"validationFailed",retryable:false},consent_invalid:{code:"validationFailed",retryable:false},timezone_invalid:{code:"validationFailed",retryable:false}});async function setPartnerMemberNotificationProfile(e,t){Q(e.partnerSecretKey,"writing a member notification profile");let r=pt(t),a=oe(t.timezone),i=JSON.stringify({email:t.email,consent:ct(t.consent),...a!==void 0?{timezone:a}:{}}),o=e.fetchImpl??getGlobalFetch(),l=`${resolveApiBaseUrl(e.apiBaseUrl)}${r}`,s={...v(e.contractVersion??n),accept:"application/json","content-type":"application/json","x-everfur-partner-secret-key":e.partnerSecretKey},u=new AbortController,d=setTimeout(()=>u.abort(),ut),p;try{p=await o(l,{method:"PUT",headers:s,body:i,signal:u.signal})}catch(e){return err(networkError(e))}finally{clearTimeout(d)}let c=await ht(p),f=requestIdOf(p);if(!p.ok)return err(ne(errorFromResponse(p.status,q(p,c),f),dt));let _=_t(c);return _?ok(_):err(errorFromResponse(502,{error:{code:"INTERNAL_ERROR"}},f))}function pt(t){if(typeof t!="object"||t===null)throw new e("invalid-argument","input is required");let userRef=assertValidUserRef(t.userRef);if(userRef.includes("/")||userRef==="."||userRef==="..")throw new e("invalid-argument","userRef cannot contain '/' or be '.' or '..': it is sent as a URL path segment");let r=t.email;if(typeof r!="string"||r.trim().length<3||r.trim().length>ot||!st.test(r.trim()))throw new e("invalid-argument",`email must be an address of at most ${ot} characters`);return`/partners/members/${encodeURIComponent(userRef)}/notification-profile`}function ct(t){if(typeof t!="object"||t===null)throw new e("invalid-argument","consent is required: an address is stored only with the stamp of the consent you collected");if(t.method!=="partner_attested")throw new e("invalid-argument","consent.method must be 'partner_attested' in this version");let r=t.version;if(typeof r!="string"||r.length===0||r.length>lt)throw new e("invalid-argument",`consent.version must be 1..${lt} characters`);let n=t.givenAt instanceof Date?t.givenAt.toISOString():t.givenAt;if(typeof n!="string"||!Number.isFinite(Date.parse(n)))throw new e("invalid-argument","consent.givenAt must be an ISO 8601 instant or a Date");return{given_at:n,method:"partner_attested",version:r}}function ft(e){return e==null?null:typeof e=="string"?e:void 0}function vt(e){if(e==null)return null;if(typeof e!="object")return;let t=e;if(!(typeof t.given_at!="string"||typeof t.method!="string"||typeof t.version!="string"))/* @__PURE__ */
|
|
9
|
+
return Object.freeze({givenAt:t.given_at,method:t.method,version:t.version})}function _t(e){if(typeof e!="object"||e===null)return null;let t=e;if(typeof t.user_ref!="string"||typeof t.updated_at!="string"||typeof t.push_enabled!="boolean"||typeof t.email_enabled!="boolean"||typeof t.active_devices!="number"||!Number.isFinite(t.active_devices))return null;let r=ft(t.email),n=ft(t.email_verified_at),a=ft(t.unsubscribed_at),i=vt(t.consent);return r===void 0||n===void 0||a===void 0||i===void 0?null:/* @__PURE__ */Object.freeze({userRef:t.user_ref,emailMasked:r,consent:i,emailVerifiedAt:n,pushEnabled:t.push_enabled,emailEnabled:t.email_enabled,unsubscribedAt:a,activeDevices:t.active_devices,updatedAt:t.updated_at})}async function ht(e){try{return await e.json()}catch{return null}}var mt=3e4;async function yt(e,t,r,a,i,o){let l=e.fetchImpl??getGlobalFetch(),s=`${resolveApiBaseUrl(e.apiBaseUrl)}${r}`,u={...v(e.contractVersion??n),accept:"application/json","content-type":"application/json","x-everfur-partner-secret-key":e.partnerSecretKey},d=new AbortController,p=setTimeout(()=>d.abort(),mt),c;try{c=await l(s,{method:t,headers:u,body:JSON.stringify(a),signal:d.signal})}catch(e){return err(networkError(e))}finally{clearTimeout(p)}let f=null;try{f=await c.json()}catch{f=null}let _=requestIdOf(c);if(!c.ok)return err(ae(errorFromResponse(c.status,q(c,f),_),i));let h=o(f);return h===null?err(errorFromResponse(502,{error:{code:"INTERNAL_ERROR"}},_)):ok(h)}var bt=/^[a-z][a-z0-9_.]{0,63}$/,gt=/^[a-z_]{1,32}$/,wt=500,St=20,Ct=/^[A-Za-z0-9._:-]{1,120}$/,Et=/* @__PURE__ */new Set(["brand_name","app_link"]),$t=/* @__PURE__ */Object.freeze({sms_not_live:{code:"accessDenied",retryable:false},not_live:{code:"accessDenied",retryable:false},profile_missing:{code:"accessDenied",retryable:false},profile_suspended:{code:"accessDenied",retryable:false},identity_missing:{code:"accessDenied",retryable:false},identity_ambiguous:{code:"accessDenied",retryable:false},consent_not_partner:{code:"accessDenied",retryable:false},consent_version_mismatch:{code:"accessDenied",retryable:false},channel_opted_out:{code:"accessDenied",retryable:false},destination_not_allowed:{code:"accessDenied",retryable:false},template_not_found:{code:"validationFailed",retryable:false},template_not_approved:{code:"validationFailed",retryable:false},daily_cap:{code:"rateLimited",retryable:false},template_vars_missing:{code:"validationFailed",retryable:false},template_var_unexpected:{code:"validationFailed",retryable:false},template_var_invalid:{code:"validationFailed",retryable:false},template_var_reserved:{code:"validationFailed",retryable:false},member_not_found:{code:"resourceNotFound",retryable:false},idempotency_key_required:{code:"validationFailed",retryable:false},idempotency_key_reused:{code:"conflict",retryable:false}});function sendMemberText(t,r){if(Q(t.partnerSecretKey,"sending a member text"),typeof r!="object"||r===null)throw new e("invalid-argument","input is required");let userRef=assertValidUserRef(r.userRef);if(userRef.includes("/")||userRef==="."||userRef==="..")throw new e("invalid-argument","userRef cannot contain '/' or be '.' or '..': it is sent as a URL path segment");if(typeof r.templateKey!="string"||!bt.test(r.templateKey))throw new e("invalid-argument","templateKey must start with a letter and be 1 to 64 of a-z, 0-9, _ and .");let n=Tt(r.vars??{}),a=r.idempotencyKey;if(typeof a!="string"||!Ct.test(a))throw new e("invalid-argument","idempotencyKey is required: 1 to 120 of A-Z, a-z, 0-9, ., _, : and -");return yt(t,"POST",`/partners/members/${encodeURIComponent(userRef)}/texts`,{template_key:r.templateKey,vars:n,idempotency_key:a},$t,Rt)}function Tt(t){if(typeof t!="object"||t===null||Array.isArray(t))throw new e("invalid-argument","vars must be an object of strings");let r=Object.entries(t);if(r.length>St)throw new e("invalid-argument",`vars carries at most ${St} values`);let n={};for(let[t,a]of r){if(!gt.test(t))throw new e("invalid-argument",`vars.${t}: a name is 1 to 32 of a-z and _`);if(Et.has(t))throw new e("invalid-argument",`vars.${t} is filled by Everfur from your texting profile`);if(typeof a!="string"||a.length>wt||a.includes(`\n`))throw new e("invalid-argument",`vars.${t} must be one line of at most ${wt} characters`);n[t]=a}return n}function Rt(e){if(e==null)/* @__PURE__ */return Object.freeze({textId:null,status:null,duplicate:null});if(typeof e!="object"||Array.isArray(e))return null;let t=e,r=t.text_id??t.message_id??t.id;/* @__PURE__ */
|
|
10
|
+
return Object.freeze({textId:typeof r=="string"&&r.length>0?r:null,status:typeof t.status=="string"?t.status:null,duplicate:typeof t.duplicate=="boolean"?t.duplicate:null})}var At=2e3,It=120,kt=200,Dt=600,Ft=60,Ot=1e3,jt=1e6,Nt=20,xt=120,Ut=1e4,qt=30,Lt=/^[A-Za-z][A-Za-z -]*$/,zt=10,Pt=200,Mt=50,Kt=90,Bt=5,Yt=1e8,Vt=5,Wt=300,Zt=80,Gt=12,Qt=60,Xt=/^[A-Za-z0-9._-]+$/,Ht=/^[A-Z]{3}$/,Jt=/^https:\/\/\S+$/,er=/^(species|life_stage|size|breed):[a-z0-9_-]{1,40}$/,tr=/* @__PURE__ */Object.freeze({species:["dog","cat"],life_stage:["young","adult","senior"],size:["small","medium","large"]}),rr=/* @__PURE__ */Object.freeze({catalog_empty_refused:{code:"conflict",retryable:false},catalog_shrink_refused:{code:"conflict",retryable:false}});function nr(e){let t=e.reasonCode,r=typeof t=="string"?rr[t]:void 0;if(r===void 0||e.code===r.code&&e.retryable===r.retryable)return e;let n=re(e);return makeEverfurError(r.code,{retryable:r.retryable,...e.httpStatus!==void 0?{httpStatus:e.httpStatus}:{},...e.requestId!==void 0?{requestId:e.requestId}:{},...n!==null?{wireCode:n}:{},reasonCode:t??null,...e.wireMessage!==void 0?{wireMessage:e.wireMessage}:{},raw:e.raw})}function ar(e,t){return yt(e,"PUT","/partners/catalog/products",t,rr,mr).then(e=>e.ok?e:err(nr(e.error)))}function replaceCatalog(t,r){if(Q(t.partnerSecretKey,"replacing the product catalog"),typeof r!="object"||r===null||!Array.isArray(r.products))throw new e("invalid-argument","input.products must be an array");if(r.products.length>At)throw new e("invalid-argument",`a catalog carries at most ${At} products`);let n=ir(r.confirmEmpty,"confirmEmpty"),a=ir(r.confirmShrink,"confirmShrink"),i=/* @__PURE__ */new Set,o=r.products.map((e,t)=>_r(e,t,i,"replace"));return ar(t,{products:o,...n?{confirm_empty:true}:{},...a?{confirm_shrink:true}:{}})}function mergeCatalog(t,r){if(Q(t.partnerSecretKey,"merging into the product catalog"),typeof r!="object"||r===null)throw new e("invalid-argument","input must be an object");let n=r.products??[],a=r.remove??[];if(!Array.isArray(n))throw new e("invalid-argument","input.products must be an array");if(!Array.isArray(a))throw new e("invalid-argument","input.remove must be an array");if(n.length===0&&a.length===0)throw new e("invalid-argument","a merge needs at least one product or one remove entry");if(n.length+a.length>At)throw new e("invalid-argument",`a merge names at most ${At} SKUs in products and remove together`);let i=/* @__PURE__ */new Set,o=n.map((e,t)=>_r(e,t,i,"merge")),l=/* @__PURE__ */new Set,s=a.map((t,r)=>{let n=`remove[${r}]`;if(typeof t!="string"||t.length===0||t.length>It||!Xt.test(t))throw new e("invalid-argument",`${n} must be a partnerSku of 1 to ${It} of A-Z a-z 0-9 . _ -`);let a=t.toLowerCase();if(l.has(a))throw new e("invalid-argument",`${n} '${t}' appears twice`);if(i.has(a))throw new e("invalid-argument",`${n} '${t}' is also in products`);return l.add(a),t});return ar(t,{mode:"merge",products:o,...s.length===0?{}:{remove:s}})}function ir(t,r){if(t===void 0)return false;if(typeof t!="boolean")throw new e("invalid-argument",`${r} must be a boolean`);return t}function or(t,r,n){if(t==null)return null;if(typeof t!="string"||t.length===0||t.length>n)throw new e("invalid-argument",`${r} must be a string of 1 to ${n} characters`);return t}function lr(t,r){if(t===void 0)return[];if(!Array.isArray(t)||t.length>2||t.some(e=>e!=="dog"&&e!=="cat"))throw new e("invalid-argument",`${r} must list at most 'dog' and 'cat'`);return[...t]}function sr(t,r){if(t===void 0)return[];if(!Array.isArray(t)||t.length>Nt)throw new e("invalid-argument",`${r} must be a list of at most ${Nt} reasons`);return t.map((t,n)=>{let a=`${r}[${n}]`,i=typeof t=="object"&&t!==null?t:{},o=i.tag,l=i.text;if(typeof o!="string"||!er.test(o))throw new e("invalid-argument",`${a}.tag must be species:, life_stage:, size: or breed: and a value`);let[s="",u=""]=o.split(":",2),d=tr[s];if(d!==void 0&&!d.includes(u))throw new e("invalid-argument",`${a}.tag: ${s} must be one of ${d.join(", ")}`);if(typeof l!="string"||l.length===0||l.length>xt)throw new e("invalid-argument",`${a}.text must be 1 to ${xt} characters`);return{tag:o,text:l}})}function ur(t,r){let n=or(t,r,Ot+8);if(n!==null&&(!Jt.test(n)||n.length-8>Ot))throw new e("invalid-argument",`${r} must be an https URL`);return n}function dr(t,r,n,a){if(typeof t!="number"||!Number.isInteger(t)||t<n||t>a)throw new e("invalid-argument",`${r} must be a whole number from ${n} to ${a}`);return t}function pr(t,r,n){if(typeof t!="number"||!Number.isFinite(t)||t<=0||t>n)throw new e("invalid-argument",`${r} must be a number above 0 and at most ${n}`);return t}function cr(t,r){if(typeof t!="object"||t===null)throw new e("invalid-argument",`${r} must be an object`);let n=dr(t.unitsPerBox,`${r}.unitsPerBox`,1,Ut),a=t.unitLabel;if(typeof a!="string"||a.length>qt||!Lt.test(a))throw new e("invalid-argument",`${r}.unitLabel must be 1 to ${qt} letters, spaces or hyphens, starting with a letter`);let i=t.doseBands;if(!Array.isArray(i)||i.length===0||i.length>zt)throw new e("invalid-argument",`${r}.doseBands must list 1 to ${zt} bands`);let o=0,l=i.map((t,n)=>{let a=`${r}.doseBands[${n}]`,l=typeof t=="object"&&t!==null?t:{},s=l.maxWeightKg??null,u=pr(l.unitsPerDay,`${a}.unitsPerDay`,Mt);if(s===null){if(n!==i.length-1)throw new e("invalid-argument",`${a}: only the last dose band may leave out maxWeightKg`);return{max_weight_kg:null,units_per_day:u}}let d=pr(s,`${a}.maxWeightKg`,Pt);if(d<=o)throw new e("invalid-argument",`${a}.maxWeightKg must be above the band before it`);return o=d,{max_weight_kg:d,units_per_day:u}});return{units_per_box:n,unit_label:a,dose_bands:l,...t.firstBoxDiscountPercent===void 0?{}:{first_box_discount_percent:dr(t.firstBoxDiscountPercent,`${r}.firstBoxDiscountPercent`,0,Kt)},...t.oneBoxDiscountPercent===void 0?{}:{one_box_discount_percent:dr(t.oneBoxDiscountPercent,`${r}.oneBoxDiscountPercent`,0,Kt)}}}function fr(t,r){if(!Array.isArray(t)||t.length>Vt)throw new e("invalid-argument",`${r} must be a list of at most ${Vt} reviews`);return t.map((t,n)=>{let a=`${r}[${n}]`,i=typeof t=="object"&&t!==null?t:{},o=i.text,l=i.by,s=dr(i.stars,`${a}.stars`,1,5);if(typeof o!="string"||o.length===0||o.length>Wt)throw new e("invalid-argument",`${a}.text must be 1 to ${Wt} characters`);if(typeof l!="string"||l.length===0||l.length>Zt)throw new e("invalid-argument",`${a}.by must be 1 to ${Zt} characters`);return{stars:s,text:o,by:l}})}function vr(t,r){if(!Array.isArray(t)||t.length>Gt)throw new e("invalid-argument",`${r} must be a list of at most ${Gt} ingredients`);return t.map((t,n)=>{let a=typeof t=="string"?t.trim():"";if(a.length===0||a.length>Qt)throw new e("invalid-argument",`${r}[${n}] must be 1 to ${Qt} characters`);return a})}function _r(t,r,n,a){let i=`products[${r}]`;if(typeof t!="object"||t===null)throw new e("invalid-argument",`${i} must be an object`);let o=t.partnerSku;if(typeof o!="string"||o.trim().length===0||o.length>It)throw new e("invalid-argument",`${i}.partnerSku must be 1 to ${It} characters`);let l=o.trim().toLowerCase();if(n.has(l))throw new e("invalid-argument",`${i}.partnerSku '${o}' appears twice`);if(n.add(l),typeof t.title!="string"||t.title.trim().length===0||t.title.length>kt)throw new e("invalid-argument",`${i}.title must be 1 to ${kt} characters`);let s=t.price??null;if(s!==null&&(typeof s!="number"||!Number.isFinite(s)||s<0||s>jt))throw new e("invalid-argument",`${i}.price must be a number from 0 to ${jt}`);let u=t.currency??null;if(u!==null&&(typeof u!="string"||!Ht.test(u)))throw new e("invalid-argument",`${i}.currency must be an ISO 4217 code such as USD`);let d=t.subscription??null;if(d!==null&&(s===null||s<=0))throw new e("invalid-argument",`${i}.subscription needs a price above 0 on the same product`);if(a==="merge"&&t.price!==void 0&&(s===null||s<=0)&&t.subscription===void 0)throw new e("invalid-argument",`${i}: a merge that clears a price or sets it to 0 must also send subscription (null to end it)`);let p=t.rating??null;if(p!==null&&(typeof p!="number"||!Number.isFinite(p)||p<0||p>Bt))throw new e("invalid-argument",`${i}.rating must be a number from 0 to ${Bt}`);let c=t.reviewCount??null;c!==null&&dr(c,`${i}.reviewCount`,0,Yt);let f=e=>a==="replace"||t[e]!==void 0,v=e=>a==="replace"?t[e]!==void 0&&t[e]!==null:t[e]!==void 0;return{partner_sku:o,title:t.title,...f("description")?{description:or(t.description,`${i}.description`,Dt)}:{},...f("form")?{form:or(t.form,`${i}.form`,Ft)}:{},...f("species")?{species:lr(t.species,`${i}.species`)}:{},...f("price")?{price:s}:{},...u===null?{}:{currency:u},...f("url")?{url:ur(t.url,`${i}.url`)}:{},...f("imageUrl")?{image_url:ur(t.imageUrl,`${i}.imageUrl`)}:{},...f("category")?{category:or(t.category,`${i}.category`,Ft)}:{},...f("reasonTags")?{reason_tags:sr(t.reasonTags,`${i}.reasonTags`)}:{},...f("sample")?{is_sample:t.sample===true}:{},...v("subscription")?{subscription:d===null?null:cr(d,`${i}.subscription`)}:{},...v("rating")?{rating:p}:{},...v("reviewCount")?{review_count:c}:{},...v("reviews")?{reviews:fr(t.reviews,`${i}.reviews`)}:{},...v("ingredients")?{ingredients:vr(t.ingredients,`${i}.ingredients`)}:{}}}function hr(e){return typeof e=="number"&&Number.isInteger(e)&&e>=0?e:null}function mr(e){if(e==null)/* @__PURE__ */return Object.freeze({active:null,deactivated:null,syncRunId:null,deactivatedSkus:null});if(typeof e!="object"||Array.isArray(e))return null;let t=e,r=t.sync_run_id,n=t.deactivated_skus;/* @__PURE__ */
|
|
11
|
+
return Object.freeze({active:hr(t.upserted??t.active),deactivated:hr(t.deactivated),syncRunId:typeof r=="string"&&r.length>0?r:null,deactivatedSkus:Array.isArray(n)&&n.every(e=>typeof e=="string")?/* @__PURE__ */Object.freeze([...n]):null})}var yr=60,br=3600,gr=3e4;async function mintPartnerSession(e){Q(e.partnerSecretKey,"minting a session");let t=assertValidUserRef(e.userRef),r=Cr(e.ttlSeconds),a=Sr(e.membership),i=oe(e.timezone),o=e.fetchImpl??getGlobalFetch(),l=`${resolveApiBaseUrl(e.apiBaseUrl)}/widget/v1/sessions`,s={...v(e.contractVersion??n),accept:"application/json","content-type":"application/json","x-everfur-partner-secret-key":e.partnerSecretKey,"x-everfur-partner-key":e.publishableKey},u={user_ref:t};r!==void 0&&(u.ttl_seconds=r),a!==void 0&&(u.membership=a),i!==void 0&&(u.timezone=i);let d=Tr(gr),p=Rr(d.signal,e.signal),c={method:"POST",headers:s,body:JSON.stringify(u),signal:p},f;try{f=await o(l,c)}catch(e){return err(networkError(e))}finally{d.cancel()}let _=await $r(f),h=requestIdOf(f);if(!f.ok)return err(ne(te(errorFromResponse(f.status,q(f,_),h)),wr));let m=Er(_);return m?ok(m):err(errorFromResponse(502,{error:{code:"INTERNAL_ERROR"}},h))}var wr=/* @__PURE__ */Object.freeze({timezone_invalid:{code:"validationFailed",retryable:false}});function Sr(t){if(t!=null){if(t!=="member"&&t!=="free")throw new e("invalid-argument","membership must be 'member' or 'free'");return t}}function Cr(t){if(t!=null){if(!Number.isInteger(t))throw new e("invalid-argument","ttl_seconds must be an integer");return Math.min(br,Math.max(yr,t))}}function Er(e){if(typeof e!="object"||e===null)return null;let t=e;if(typeof t.session_token!="string"||t.session_token.length===0||typeof t.expires_at!="number")return null;let r=Array.isArray(t.capabilities)?t.capabilities.filter(e=>typeof e=="string"):[];/* @__PURE__ */
|
|
12
|
+
return Object.freeze({sessionToken:t.session_token,expiresAt:t.expires_at,capabilities:/* @__PURE__ */Object.freeze(r)})}async function $r(e){try{return await e.json()}catch{return null}}function Tr(e){let t=new AbortController,r=setTimeout(()=>t.abort(),e);return{signal:t.signal,cancel:()=>clearTimeout(r)}}function Rr(e,t){if(!t)return e;let r=new AbortController;if(e.aborted||t.aborted)return r.abort(),r.signal;let n=()=>r.abort();return e.addEventListener("abort",n,{once:true}),t.addEventListener("abort",n,{once:true}),r.signal}export{assertValidUserRef,canonicalPetSpecies,deletePartnerPet,getPartnerPet,mergeCatalog,mintPartnerSession,replaceCatalog,revokePartnerMemberSessions,sendMemberText,setPartnerMemberNotificationProfile,updatePartnerPet,upsertPartnerPet};
|
package/dist/shop/index.d.cts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
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
2
|
import { ReactNode } from 'react';
|
|
3
3
|
import { ImageSourcePropType } from 'react-native';
|
|
4
|
-
import { O as OmsClient, S as ShopPet, b as ShopPackageSource, c as ShopCopy, d as ShopV3Copy, e as ShopRoute, f as ShopCardHandoff, a as ShopPaymentsPort, h as ShopProfileName, i as ShopOrdersV2Copy } from '../idempotency.d-
|
|
5
|
-
export { j as OmsClientConfig, k as OmsConsumerAuth, l as OmsGetToken, m as SHOP_COPY, n as SHOP_COPY_PLACEHOLDERS, o as SHOP_ORDERS_V2_COPY, p as SHOP_V3_COPY, q as SHOP_V3_COPY_PLACEHOLDERS, r as ShopPackage, s as ShopPackageLine, E as ShopPayerActionContext, t as ShopPaymentStepResult, u as ShopTabName, U as UNAVAILABLE_PACKAGE_SOURCE, x as createOmsClient, y as createOmsPackageSource, A as newIdempotencyKey, B as shopCopy, C as shopOrdersV2Copy, D as shopV3Copy } from '../idempotency.d-
|
|
4
|
+
import { O as OmsClient, S as ShopPet, b as ShopPackageSource, c as ShopCopy, d as ShopV3Copy, e as ShopRoute, f as ShopCardHandoff, a as ShopPaymentsPort, h as ShopProfileName, i as ShopOrdersV2Copy } from '../idempotency.d-CFVMhWcv.cjs';
|
|
5
|
+
export { j as OmsClientConfig, k as OmsConsumerAuth, l as OmsGetToken, m as SHOP_COPY, n as SHOP_COPY_PLACEHOLDERS, o as SHOP_ORDERS_V2_COPY, p as SHOP_V3_COPY, q as SHOP_V3_COPY_PLACEHOLDERS, r as ShopPackage, s as ShopPackageLine, E as ShopPayerActionContext, t as ShopPaymentStepResult, u as ShopTabName, U as UNAVAILABLE_PACKAGE_SOURCE, x as createOmsClient, y as createOmsPackageSource, A as newIdempotencyKey, B as shopCopy, C as shopOrdersV2Copy, D as shopV3Copy } from '../idempotency.d-CFVMhWcv.cjs';
|
|
6
6
|
import { E as EverfurShopOrdersV2Screen } from '../view.d-CbcJKNJj.cjs';
|
|
7
7
|
export { o as OmsAddress, a as OmsBuyAgainItem, F as OmsCardActionLink, G as OmsCardSetupLink, p as OmsCartLine, q as OmsCents, j as OmsError, r as OmsOffer, b as OmsOrder, c as OmsOrderSummary, f as OmsPlan, s as OmsPlanChangeOption, t as OmsPlanOperation, m as OmsPlanSkipWarning, u as OmsPlanSkipWarningKey, n as OmsPrescription, g as OmsQuote, v as OmsQuoteLine, h as OmsReceipt, w as OmsReceiptCard, x as OmsReceiptLine, y as OmsResult, i as OmsShopConfig, z as OmsSupply, A as isOmsRefusal, B as isOmsRetryable, C as isOmsUnavailable } from '../omsErrors.d-VF5tnr20.cjs';
|
|
8
|
-
import '../config.d-
|
|
8
|
+
import '../config.d-ClAI2RZ6.cjs';
|
|
9
9
|
import '../EverfurError.d-8NHtlgzA.cjs';
|
|
10
10
|
import '../EverfurResult.d-BFH-3s6E.cjs';
|
|
11
11
|
|
package/dist/shop/index.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
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
2
|
import { ReactNode } from 'react';
|
|
3
3
|
import { ImageSourcePropType } from 'react-native';
|
|
4
|
-
import { O as OmsClient, S as ShopPet, b as ShopPackageSource, c as ShopCopy, d as ShopV3Copy, e as ShopRoute, f as ShopCardHandoff, a as ShopPaymentsPort, h as ShopProfileName, i as ShopOrdersV2Copy } from '../idempotency.d-
|
|
5
|
-
export { j as OmsClientConfig, k as OmsConsumerAuth, l as OmsGetToken, m as SHOP_COPY, n as SHOP_COPY_PLACEHOLDERS, o as SHOP_ORDERS_V2_COPY, p as SHOP_V3_COPY, q as SHOP_V3_COPY_PLACEHOLDERS, r as ShopPackage, s as ShopPackageLine, E as ShopPayerActionContext, t as ShopPaymentStepResult, u as ShopTabName, U as UNAVAILABLE_PACKAGE_SOURCE, x as createOmsClient, y as createOmsPackageSource, A as newIdempotencyKey, B as shopCopy, C as shopOrdersV2Copy, D as shopV3Copy } from '../idempotency.d-
|
|
4
|
+
import { O as OmsClient, S as ShopPet, b as ShopPackageSource, c as ShopCopy, d as ShopV3Copy, e as ShopRoute, f as ShopCardHandoff, a as ShopPaymentsPort, h as ShopProfileName, i as ShopOrdersV2Copy } from '../idempotency.d-dOFfV91-.js';
|
|
5
|
+
export { j as OmsClientConfig, k as OmsConsumerAuth, l as OmsGetToken, m as SHOP_COPY, n as SHOP_COPY_PLACEHOLDERS, o as SHOP_ORDERS_V2_COPY, p as SHOP_V3_COPY, q as SHOP_V3_COPY_PLACEHOLDERS, r as ShopPackage, s as ShopPackageLine, E as ShopPayerActionContext, t as ShopPaymentStepResult, u as ShopTabName, U as UNAVAILABLE_PACKAGE_SOURCE, x as createOmsClient, y as createOmsPackageSource, A as newIdempotencyKey, B as shopCopy, C as shopOrdersV2Copy, D as shopV3Copy } from '../idempotency.d-dOFfV91-.js';
|
|
6
6
|
import { E as EverfurShopOrdersV2Screen } from '../view.d-CbcJKNJj.js';
|
|
7
7
|
export { o as OmsAddress, a as OmsBuyAgainItem, F as OmsCardActionLink, G as OmsCardSetupLink, p as OmsCartLine, q as OmsCents, j as OmsError, r as OmsOffer, b as OmsOrder, c as OmsOrderSummary, f as OmsPlan, s as OmsPlanChangeOption, t as OmsPlanOperation, m as OmsPlanSkipWarning, u as OmsPlanSkipWarningKey, n as OmsPrescription, g as OmsQuote, v as OmsQuoteLine, h as OmsReceipt, w as OmsReceiptCard, x as OmsReceiptLine, y as OmsResult, i as OmsShopConfig, z as OmsSupply, A as isOmsRefusal, B as isOmsRetryable, C as isOmsUnavailable } from '../omsErrors.d-VF5tnr20.js';
|
|
8
|
-
import '../config.d-
|
|
8
|
+
import '../config.d-B7Z-KTGq.js';
|
|
9
9
|
import '../EverfurError.d-8NHtlgzA.js';
|
|
10
10
|
import '../EverfurResult.d-D_-254ZY.js';
|
|
11
11
|
|
package/dist/slots/index.cjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"use strict";var e=require("react"),t=require("react-native"),i=require("react/jsx-runtime");var r=/* @__PURE__ */Object.freeze({"plan.needs":"list","plan.tips":"list","plan.items":"list","cart.lines":"list","cart.summary":"item","orders.recent":"list"});function n(e){return Object.prototype.hasOwnProperty.call(r,e)}function l(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"?n(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=l(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 a=class _EverfurConfigError extends Error{constructor(e,t){super(t),this.name="EverfurConfigError",this.kind=e,Object.setPrototypeOf(this,_EverfurConfigError.prototype)}};var s=/* @__PURE__ */Symbol.for("@everfur/sdk#EverfurContext@v1"),c=globalThis,d=c[s]??(c[s]=e.createContext(null));d.displayName??="EverfurContext";function u(){let t=e.useContext(d);if(t===null)throw new a("not-initialized","Everfur hooks must be called inside <EverfurProvider>. Wrap your tree once, high.");return t}var p=()=>()=>{},h=()=>null;function g(t,i){return e.useSyncExternalStore(i?.subscribe??p,i?.get??h,i?.get??h)??t}var f=/* @__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"}),b=Object.keys(m),w="presentation",y="presentation.";var x={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 k(e,t){if(t==null)return;let i=x[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 b){let r=m[e],n=Object.prototype.hasOwnProperty.call(t,r)?t[r]:t[e],l=k(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=`${y}${m[e]}`;for(let e of t)if(e===w||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 b){let t=n[e],i=isPresentationFieldLocked(e,o)?void 0:l[e];a[e]=i??t??f[e]}/* @__PURE__ */
|
|
5
|
-
return Object.freeze(a)}var T=/* @__PURE__ */Object.freeze({branding:null}),j=/* @__PURE__ */Object.freeze({subscribe:()=>()=>{},getSnapshot:()=>T});function S(e){return e?Object.keys(e).sort().map(t=>`${t}=${String(e[t])}`).join("&"):""}function useEverfurPresentation(e){return I(e).presentation}function I(t){let{runtime:i}=u(),r=i?.entitlements??j,n=e.useCallback(()=>r.getSnapshot()?.branding??null,[r]),l=g(e.useSyncExternalStore(r.subscribe,n,n),i?.sdkConfigHost?.branding),o=S(t);return e.useMemo(()=>{let e=l?.lockedFields??null;return{presentation:resolvePresentation({server:l?.presentation??null,locked:e,client:t??null}),isLocked:t=>isPresentationFieldLocked(t,e)}},[l,o])}var z=/* @__PURE__ */Symbol.for("@everfur/sdk#SlotSwitchContext@v1"),D=globalThis,C=D[z]??(D[z]=e.createContext(null));C.displayName??="EverfurSlotSwitch";function H(t){let i=e.useContext(C),r=useEverfurPresentation(t===void 0?void 0:{serverSlots:t}).serverSlots;return t!==void 0||i===null?r:i}var F=[{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}],_=/* @__PURE__ */Object.freeze(F.map(e=>/* @__PURE__ */Object.freeze(e)));/* @__PURE__ */Object.freeze(_.map(e=>e.wireCode));var O=/* @__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"}),E=/* @__PURE__ */Object.freeze(_.map(e=>/* @__PURE__ */Object.freeze({wireCode:e.wireCode,envelope:e.envelope,retryable:e.retryable,normalized:O[e.wireCode]}))),P=new Map(E.map(e=>[e.envelope+e.wireCode.toUpperCase(),e])),L=/* @__PURE__ */Object.freeze(["http_envelope",...[...new Set(E.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",...L]){let t=P.get(e+i);if(t)return t}}var A=/* @__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 A[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 B=/* @__PURE__ */new Set(["streamTimeout","rateLimited","internalError","upstreamLlmTimeout","streamIncomplete"]);function isAutoRetryable(e){return B.has(e)}var R=/* @__PURE__ */new Set(["serviceUnavailable","conflict","idempotencyInFlight"]);function isRetryableCode(e){return isAutoRetryable(e)||R.has(e)}var V=500,$=8e3,W=4;function backoffDelayMs(e,t=Math.random){let i=Math.max(0,e),r=Math.min(V*2**i,$);return Math.floor(t()*r)}var M="This feature isn't available on your account right now.",N="Something in that request was not right. Check the details and try again.",G=/* @__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:M,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:N,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:M,runtimeDisposed:N,unknown:"Something went wrong. Please try again."}),q="This session has ended. Please sign in again.",U="linked_account_read_only";function Y(e,t,i){return e==="conflict"&&i===U?M:(e==="authRejected"||e==="authExpired")&&typeof t=="string"&&t.trim().toLowerCase()==="session_revoked"?q:userFacingError(e)}function userFacingError(e){return G[e]}function X(e,t,i){Object.defineProperty(e,t,{value:i,enumerable:false,writable:false,configurable:false})}var K=/^[a-z][a-z0-9_]{0,63}$/;function makeEverfurError(e,t){let i=contractErrorFor(t?.wireCode,t?.wireEnvelope),r=e==="conflict"&&t?.reasonCode===U,n={code:e,category:categoryFor(e),retryable:t?.retryable??(r?false:isRetryableCode(e)),displayMessage:Y(e,t?.wireCode,r?U:null)};t?.httpStatus!==void 0&&(n.httpStatus=t.httpStatus),t?.requestId&&(n.requestId=t.requestId),typeof t?.reasonCode=="string"&&K.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&&X(n,"wireMessage",t.wireMessage),t?.raw!==void 0&&t.raw!==null&&X(n,"raw",t.raw),/* @__PURE__ */Object.freeze(n)}function Q(e){return e!=null&&(e.httpStatus===404||e.category==="notFound")}function J(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 Z(e){return e.ok?e:err(J(e.error))}function ee(e){return{send:async(...t)=>Z(await e.send(...t)),authorize:t=>e.authorize(t),stream:(t,i,r)=>e.stream(t,i,r)}}var te=/* @__PURE__ */Object.freeze({phase:"idle",petRef:null,plan:null,pending:/* @__PURE__ */Object.freeze([]),itemErrors:/* @__PURE__ */Object.freeze({}),error:null});function ie(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 T=/* @__PURE__ */Object.freeze({branding:null}),j=/* @__PURE__ */Object.freeze({subscribe:()=>()=>{},getSnapshot:()=>T});function S(e){return e?Object.keys(e).sort().map(t=>`${t}=${String(e[t])}`).join("&"):""}function useEverfurPresentation(e){return I(e).presentation}function I(t){let{runtime:i}=u(),r=i?.entitlements??j,n=e.useCallback(()=>r.getSnapshot()?.branding??null,[r]),l=g(e.useSyncExternalStore(r.subscribe,n,n),i?.sdkConfigHost?.branding),o=S(t);return e.useMemo(()=>{let e=l?.lockedFields??null;return{presentation:resolvePresentation({server:l?.presentation??null,locked:e,client:t??null}),isLocked:t=>isPresentationFieldLocked(t,e)}},[l,o])}var z=/* @__PURE__ */Symbol.for("@everfur/sdk#SlotSwitchContext@v1"),D=globalThis,C=D[z]??(D[z]=e.createContext(null));C.displayName??="EverfurSlotSwitch";function H(t){let i=e.useContext(C),r=useEverfurPresentation(t===void 0?void 0:{serverSlots:t}).serverSlots;return t!==void 0||i===null?r:i}var F=[{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}],_=/* @__PURE__ */Object.freeze(F.map(e=>/* @__PURE__ */Object.freeze(e)));/* @__PURE__ */Object.freeze(_.map(e=>e.wireCode));var O=/* @__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"}),E=/* @__PURE__ */Object.freeze(_.map(e=>/* @__PURE__ */Object.freeze({wireCode:e.wireCode,envelope:e.envelope,retryable:e.retryable,normalized:O[e.wireCode]}))),P=new Map(E.map(e=>[e.envelope+e.wireCode.toUpperCase(),e])),L=/* @__PURE__ */Object.freeze(["http_envelope",...[...new Set(E.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",...L]){let t=P.get(e+i);if(t)return t}}var A=/* @__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 A[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 B=/* @__PURE__ */new Set(["streamTimeout","rateLimited","internalError","upstreamLlmTimeout","streamIncomplete"]);function isAutoRetryable(e){return B.has(e)}var R=/* @__PURE__ */new Set(["serviceUnavailable","conflict","idempotencyInFlight"]);function isRetryableCode(e){return isAutoRetryable(e)||R.has(e)}var V=500,$=8e3,W=4;function backoffDelayMs(e,t=Math.random){let i=Math.max(0,e),r=Math.min(V*2**i,$);return Math.floor(t()*r)}var M="This feature isn't available on your account right now.",N="Something in that request was not right. Check the details and try again.",G=/* @__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:M,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:N,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:M,runtimeDisposed:N,unknown:"Something went wrong. Please try again."}),q="This session has ended. Please sign in again.",U="linked_account_read_only";function Y(e,t,i){return e==="conflict"&&i===U?M:(e==="authRejected"||e==="authExpired")&&typeof t=="string"&&t.trim().toLowerCase()==="session_revoked"?q:userFacingError(e)}function userFacingError(e){return G[e]}function X(e,t,i){Object.defineProperty(e,t,{value:i,enumerable:false,writable:false,configurable:false})}var K=/^[a-z][a-z0-9_]{0,63}$/;function makeEverfurError(e,t){let i=contractErrorFor(t?.wireCode,t?.wireEnvelope),r=e==="conflict"&&t?.reasonCode===U,n={code:e,category:categoryFor(e),retryable:t?.retryable??(r?false:isRetryableCode(e)),displayMessage:Y(e,t?.wireCode,r?U:null)};t?.httpStatus!==void 0&&(n.httpStatus=t.httpStatus),t?.requestId&&(n.requestId=t.requestId),typeof t?.reasonCode=="string"&&K.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&&X(n,"wireMessage",t.wireMessage),t?.raw!==void 0&&t.raw!==null&&X(n,"raw",t.raw),/* @__PURE__ */Object.freeze(n)}function Q(e){return e!=null&&(e.httpStatus===404||e.category==="notFound")}function J(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 Z(e){return e.ok?e:err(J(e.error))}function ee(e){return{send:async(...t)=>Z(await e.send(...t)),authorize:t=>e.authorize(t),stream:(t,i,r)=>e.stream(t,i,r)}}var te=/* @__PURE__ */Object.freeze({phase:"idle",petRef:null,plan:null,pending:/* @__PURE__ */Object.freeze([]),itemErrors:/* @__PURE__ */Object.freeze({}),error:null});function ie(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 re=class{constructor(e){this.repository=e;this.snapshot=te;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({...te});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:ie(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:ie(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=ie(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 ne(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 le="x-everfur-anon-token",oe="anonTokenInvalid";async function ae(e){if(e.userRef!==null||e.anonIdentity===void 0)return null;try{return await e.anonIdentity.token()}catch{return null}}function se(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[le]=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:{...ce(e.headers),...authHeaders(t)}}}function ce(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===le||(t[i]=r)}return t}async function authedSend(e,t){if(t.mode==="anonymous"){let i=await ae(t),r=await t.transport.request(withAuthHeaders(e,de(t,i)));if(r.ok||pe(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,de(t,n)))}let i;try{i=await t.identity.currentToken()}catch(e){return t.identity.reportRejected?.(),err(se(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(se(e,{wireCode:pe(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(ue(l.error))):l}function de(e,t){return{mode:"anonymous",publishableKey:e.publishableKey,userRef:e.userRef,...e.sessionId?{sessionId:e.sessionId}:{},...t!==null?{anonToken:t}:{}}}function ue(e){let t=e.raw,i=pe(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 pe(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 he(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 be(e)}var ge=/^([a-z][a-z0-9+.-]*):\/\/(?:([^:@/?#]*)(?::([^@/?#]*))?@)?(\[[0-9a-f:.]+\]|[\w.~-]+)(?::(\d*))?(\/[^?#]*)?(\?[^#]*)?(#.*)?$/i,fe=/[\s\u0000-\u001f\u007f\\]/,me={"http:":"80","https:":"443"};function be(e,t){let i=e.trim();let r=fe.test(i)?null:ge.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?"/":""),w=l||o?`${l}${o&&`:${o}`}@`:"";return{href:`${p}//${w}${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:we(e)})}function we(e){return e instanceof Error?e.message:typeof e=="string"?e:"network request failed"}var ye=3e4,xe=$*2,ve="idempotency-key",ke=/* @__PURE__ */new Set(["POST","PUT","PATCH","DELETE"]),Te=/* @__PURE__ */Object.freeze({onEvent(){}}),je=/* @__PURE__ */Object.freeze({setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),now:()=>Date.now()});function Se(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??Te,i=e.timers??je,r=e.rng??Math.random,n=e.sleep??((e,t)=>$e(e,i,t)),l=e.maxAttempts??W,o=e.unaryTimeoutMs??ye,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??ke.has(c.method),g=d?.idempotencyKey===void 0?null:Se(d.idempotencyKey),f=h?g??a():null,m=Ie(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=Re(o,i),d=Ve(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,w=Ce(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}:{}}),y={ok:false,code:g.code,reason:w.reason,...g.httpStatus!==void 0?{httpStatus:g.httpStatus}:{},...g.requestId!==void 0?{requestId:g.requestId}:{}};if(!w.retry)return s(l({phase:"settled",...y})),err(g);if(s(l({phase:"retry",...y,delayMs:w.delayMs})),await n(w.delayMs,c.signal),c.signal?.aborted===true)return s(l({phase:"settled",...y,reason:"aborted"})),err(g);b+=1}}async function d(t){return withAuthHeaders(t,await Be(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/slots/index.d.cts
CHANGED
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
3
|
import { P as PetRef } from '../ids.d-B2GAAifq.cjs';
|
|
4
4
|
import { StyleProp, ViewStyle } from 'react-native';
|
|
5
|
-
import { H as HealthPlanItem } from '../healthPlanRepository.d-
|
|
6
|
-
import { H as HealthPlanPriceFormat } from '../layout.d-
|
|
5
|
+
import { H as HealthPlanItem } from '../healthPlanRepository.d-B22kjrYa.cjs';
|
|
6
|
+
import { H as HealthPlanPriceFormat } from '../layout.d-DfaFM_lp.cjs';
|
|
7
7
|
import '../EverfurResult.d-BFH-3s6E.cjs';
|
|
8
8
|
import '../EverfurError.d-8NHtlgzA.cjs';
|
|
9
|
-
import '../requestFunnel.d-
|
|
10
|
-
import '../ErrorPolicyPort.d-
|
|
11
|
-
import '../config.d-
|
|
12
|
-
import '../identity.d-
|
|
9
|
+
import '../requestFunnel.d-BwZDfWVD.cjs';
|
|
10
|
+
import '../ErrorPolicyPort.d-BIdmYQnk.cjs';
|
|
11
|
+
import '../config.d-ClAI2RZ6.cjs';
|
|
12
|
+
import '../identity.d-DDpXOtas.cjs';
|
|
13
13
|
import '../LifecyclePort.d-Cb9NtmP-.cjs';
|
|
14
14
|
|
|
15
15
|
/**
|