@happyvertical/smrt-planner 0.57.3 → 0.57.5
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/agents/assistant.md +8 -1
- package/agents/cookbook.md +8 -2
- package/app/404.html +21 -21
- package/app/_app/immutable/assets/2.CdEXvRg0.css +1 -0
- package/app/_app/immutable/assets/{feedback.DePeap37.css → feedback.qFktqYFY.css} +1 -1
- package/app/_app/immutable/chunks/{DveAWx7t.js → 5ukUzDcw.js} +1 -1
- package/app/_app/immutable/chunks/{DR_9YSDq.js → BDbFl7UA.js} +1 -1
- package/app/_app/immutable/chunks/{rkUL-DlL.js → BG9Gz_25.js} +25 -25
- package/app/_app/immutable/chunks/{BfPYbnRI.js → Bal1oPZu.js} +1 -1
- package/app/_app/immutable/chunks/BhU_yBI_.js +1 -0
- package/app/_app/immutable/chunks/{CZwkvsZI.js → BiEOJeYb.js} +1 -1
- package/app/_app/immutable/chunks/{DsY7g8iJ.js → Bsn3IIve.js} +3 -3
- package/app/_app/immutable/chunks/{PJY04JNF.js → BybfWt-B.js} +1 -1
- package/app/_app/immutable/chunks/{CF503c7E.js → C1VofLtR.js} +1 -1
- package/app/_app/immutable/chunks/{2l76O8yg.js → C3sRGrYK.js} +1 -1
- package/app/_app/immutable/chunks/{Bz0ybtg3.js → CTlMHIE6.js} +1 -1
- package/app/_app/immutable/chunks/C_3CJO_1.js +1 -0
- package/app/_app/immutable/chunks/Cga8zF3r.js +1 -0
- package/app/_app/immutable/chunks/Cr4byQts.js +24 -0
- package/app/_app/immutable/chunks/{U6_OBRq_.js → CtjBwCj8.js} +1 -1
- package/app/_app/immutable/chunks/CyUSxz1P.js +4 -0
- package/app/_app/immutable/chunks/{BAeyjCL_.js → DTWraE40.js} +1 -1
- package/app/_app/immutable/chunks/{Cfd9dmBM.js → DjJovMrk.js} +1 -1
- package/app/_app/immutable/chunks/{BJKoxDbG.js → DuZeZzOA.js} +1 -1
- package/app/_app/immutable/chunks/{C-DLpfU4.js → J9kOiFLO.js} +1 -1
- package/app/_app/immutable/chunks/NppCG--v.js +1 -0
- package/app/_app/immutable/chunks/{EZsakmZX.js → O8DAZ_le.js} +1 -1
- package/app/_app/immutable/chunks/{Dq8aYheE.js → YGONf0jr.js} +1 -1
- package/app/_app/immutable/chunks/d_dqmeIr.js +1 -0
- package/app/_app/immutable/chunks/{Bb0f-PWY.js → gCpxN2IC.js} +1 -1
- package/app/_app/immutable/chunks/nphy1MQF.js +1 -0
- package/app/_app/immutable/entry/{app.BOdcGXnx.js → app.B4gMiHwR.js} +2 -2
- package/app/_app/immutable/entry/start.BXkBl20Z.js +1 -0
- package/app/_app/immutable/nodes/0.2MYMg80l.js +9 -0
- package/app/_app/immutable/nodes/{1.CULLAAlp.js → 1.DKP901Gn.js} +1 -1
- package/app/_app/immutable/nodes/{10.D3aS_KZl.js → 10.DNN0cVai.js} +1 -1
- package/app/_app/immutable/nodes/{11.C92xaiTE.js → 11.DgbmegX3.js} +1 -1
- package/app/_app/immutable/nodes/{12.D1Lzt56L.js → 12.D5MtnJoE.js} +1 -1
- package/app/_app/immutable/nodes/{13.Bx4rov-F.js → 13._rY66Xa_.js} +1 -1
- package/app/_app/immutable/nodes/{14.CEBy0En2.js → 14.B6TD25VU.js} +1 -1
- package/app/_app/immutable/nodes/2.x9WyxQ1S.js +24 -0
- package/app/_app/immutable/nodes/{3.C8f09BsJ.js → 3.V5uGCpGb.js} +1 -1
- package/app/_app/immutable/nodes/{4.Z1MwZ_rU.js → 4.CCwzLrgu.js} +1 -1
- package/app/_app/immutable/nodes/{5.BnknP-NB.js → 5.CgHzwpns.js} +1 -1
- package/app/_app/immutable/nodes/{6.B0InO4bR.js → 6.CvQHLh_u.js} +1 -1
- package/app/_app/immutable/nodes/{7.CLnj1BGB.js → 7.7EIrly34.js} +1 -1
- package/app/_app/immutable/nodes/{8.BmZYIUmz.js → 8.DyyRBuTw.js} +1 -1
- package/app/_app/immutable/nodes/{9.BKWSHjz-.js → 9.DcURs0gN.js} +1 -1
- package/app/_app/version.json +1 -1
- package/app/advanced-styles/index.html +24 -24
- package/app/ai/index.html +28 -33
- package/app/blueprint/index.html +22 -22
- package/app/cookbook/index.html +22 -22
- package/app/index.html +38 -38
- package/app/m/ads/AdDeliveryTier/index.html +25 -25
- package/app/m/ads/AdEvent/index.html +25 -25
- package/app/m/ads/AdFormat/index.html +25 -25
- package/app/m/ads/AdGroup/index.html +25 -25
- package/app/m/ads/AdVariation/index.html +25 -25
- package/app/m/analytics/AnalyticsDataStream/index.html +25 -25
- package/app/m/analytics/AnalyticsEvent/index.html +25 -25
- package/app/m/analytics/AnalyticsProperty/index.html +25 -25
- package/app/m/analytics/AnalyticsReport/index.html +25 -25
- package/app/m/approvals/ApprovalEvent/index.html +25 -25
- package/app/m/approvals/ApprovalPolicy/index.html +25 -25
- package/app/m/approvals/ApprovalRequest/index.html +25 -25
- package/app/m/assets/Asset/attachments/index.html +26 -26
- package/app/m/assets/Asset/index.html +25 -25
- package/app/m/assets/AssetAssociation/index.html +25 -25
- package/app/m/assets/AssetMetafield/index.html +25 -25
- package/app/m/assets/AssetStatus/index.html +25 -25
- package/app/m/assets/AssetType/index.html +25 -25
- package/app/m/assets/Folder/index.html +25 -25
- package/app/m/chat/AgentSession/index.html +25 -25
- package/app/m/chat/ChatMessage/index.html +25 -25
- package/app/m/chat/ChatParticipant/index.html +25 -25
- package/app/m/chat/ChatReaction/index.html +25 -25
- package/app/m/chat/ChatRoom/index.html +25 -25
- package/app/m/chat/ChatThread/index.html +25 -25
- package/app/m/chat/VoiceGatewayTurn/index.html +25 -25
- package/app/m/chat/VoiceSession/index.html +25 -25
- package/app/m/commerce/Agreement/index.html +25 -25
- package/app/m/commerce/Cart/index.html +25 -25
- package/app/m/commerce/Contract/index.html +25 -25
- package/app/m/commerce/ContractLineItem/index.html +26 -26
- package/app/m/commerce/Customer/index.html +25 -25
- package/app/m/commerce/DocumentTax/index.html +25 -25
- package/app/m/commerce/Estimate/index.html +25 -25
- package/app/m/commerce/Fulfillment/index.html +25 -25
- package/app/m/commerce/FulfillmentLineItem/index.html +25 -25
- package/app/m/commerce/HistoricalCustomerFunds/index.html +89 -0
- package/app/m/commerce/HistoricalCustomerFundsAllocation/index.html +89 -0
- package/app/m/commerce/HistoricalSalesLine/index.html +89 -0
- package/app/m/commerce/Invoice/index.html +25 -25
- package/app/m/commerce/InvoiceLineItem/index.html +25 -25
- package/app/m/commerce/Lease/index.html +25 -25
- package/app/m/commerce/LicenseSale/index.html +25 -25
- package/app/m/commerce/Order/index.html +25 -25
- package/app/m/commerce/Payment/index.html +25 -25
- package/app/m/commerce/PaymentAllocation/index.html +25 -25
- package/app/m/commerce/PaymentInstrument/index.html +25 -25
- package/app/m/commerce/PaymentIntent/index.html +25 -25
- package/app/m/commerce/Payout/index.html +25 -25
- package/app/m/commerce/ProductionOrder/index.html +25 -25
- package/app/m/commerce/PurchaseContract/index.html +25 -25
- package/app/m/commerce/PurchaseOrder/index.html +25 -25
- package/app/m/commerce/SalesContract/index.html +25 -25
- package/app/m/commerce/SupplierQuote/index.html +25 -25
- package/app/m/commerce/TaxCode/index.html +25 -25
- package/app/m/commerce/TaxComponent/index.html +25 -25
- package/app/m/commerce/TaxSettings/index.html +25 -25
- package/app/m/commerce/TaxSummaryReport/index.html +25 -25
- package/app/m/commerce/Vendor/index.html +25 -25
- package/app/m/commerce/WholesaleOrder/index.html +25 -25
- package/app/m/content/Content/index.html +25 -25
- package/app/m/content/ContentContribution/index.html +25 -25
- package/app/m/content/ContentContributionAttachment/index.html +25 -25
- package/app/m/content/ContentContributionRevision/index.html +25 -25
- package/app/m/content/ContentContributionType/index.html +25 -25
- package/app/m/content/ContentContributor/index.html +25 -25
- package/app/m/content/ContentCorrection/index.html +25 -25
- package/app/m/content/ContentFeedSource/index.html +25 -25
- package/app/m/content/ContentGovernanceAssignment/index.html +25 -25
- package/app/m/content/ContentGovernancePolicy/index.html +25 -25
- package/app/m/content/ContentGovernanceProfile/index.html +25 -25
- package/app/m/content/ContentReference/index.html +25 -25
- package/app/m/content/ContentReview/index.html +25 -25
- package/app/m/content/ContentVersion/index.html +25 -25
- package/app/m/events/Event/index.html +25 -25
- package/app/m/events/EventParticipant/index.html +25 -25
- package/app/m/events/EventSeries/index.html +26 -26
- package/app/m/events/EventType/index.html +25 -25
- package/app/m/expenses/Expense/index.html +25 -25
- package/app/m/facts/Fact/index.html +25 -25
- package/app/m/facts/FactContent/index.html +25 -25
- package/app/m/facts/FactEvidence/index.html +25 -25
- package/app/m/facts/FactSource/index.html +25 -25
- package/app/m/facts/FactSubject/index.html +25 -25
- package/app/m/facts/FactTag/index.html +25 -25
- package/app/m/fields/FieldPolicy/index.html +25 -25
- package/app/m/fields/FieldPolicySuggestion/index.html +25 -25
- package/app/m/fields/FieldUsageCounter/index.html +25 -25
- package/app/m/images/Image/index.html +25 -25
- package/app/m/inventory/InventoryLocation/index.html +25 -25
- package/app/m/inventory/StockLevel/index.html +25 -25
- package/app/m/inventory/StockMovement/index.html +25 -25
- package/app/m/ledgers/Account/index.html +25 -25
- package/app/m/ledgers/Journal/index.html +25 -25
- package/app/m/ledgers/JournalEntry/index.html +25 -25
- package/app/m/ledgers/Ledger/index.html +25 -25
- package/app/m/manufacturing/Assembly/index.html +25 -25
- package/app/m/manufacturing/BillOfMaterials/index.html +25 -25
- package/app/m/manufacturing/BomLine/index.html +25 -25
- package/app/m/manufacturing/Operation/index.html +25 -25
- package/app/m/manufacturing/ProductionRun/index.html +25 -25
- package/app/m/manufacturing/ProductionRunCompletion/index.html +25 -25
- package/app/m/manufacturing/RoutingStep/index.html +25 -25
- package/app/m/marketing/Campaign/index.html +25 -25
- package/app/m/marketing/CampaignChannel/index.html +25 -25
- package/app/m/marketing/CampaignMetricSnapshot/index.html +25 -25
- package/app/m/messages/Account/index.html +25 -25
- package/app/m/messages/Attachment/index.html +25 -25
- package/app/m/messages/Blacklist/index.html +25 -25
- package/app/m/messages/Email/failed-sends/index.html +26 -26
- package/app/m/messages/Email/index.html +25 -25
- package/app/m/messages/Email/mailbox/index.html +26 -26
- package/app/m/messages/EmailAccount/index.html +25 -25
- package/app/m/messages/EmailAttachment/index.html +25 -25
- package/app/m/messages/EmailFolder/index.html +25 -25
- package/app/m/messages/Message/index.html +25 -25
- package/app/m/messages/MessagingEndpoint/index.html +25 -25
- package/app/m/messages/PersonaMessageRoute/index.html +25 -25
- package/app/m/messages/SlackAccount/index.html +25 -25
- package/app/m/messages/SlackMessage/index.html +25 -25
- package/app/m/messages/TelegramAccount/index.html +25 -25
- package/app/m/messages/Tweet/index.html +25 -25
- package/app/m/messages/TwitterAccount/index.html +25 -25
- package/app/m/messages/Whitelist/index.html +25 -25
- package/app/m/messages/ZulipAccount/index.html +25 -25
- package/app/m/places/Place/index.html +25 -25
- package/app/m/places/PlaceType/index.html +25 -25
- package/app/m/products/Category/index.html +25 -25
- package/app/m/products/Material/index.html +25 -25
- package/app/m/products/Product/index.html +25 -25
- package/app/m/products/Product/ingredients/index.html +26 -26
- package/app/m/products/ProductVariant/index.html +25 -25
- package/app/m/products/Sku/index.html +25 -25
- package/app/m/profiles/ApiKey/index.html +25 -25
- package/app/m/profiles/Bot/index.html +25 -25
- package/app/m/profiles/MagicLinkToken/index.html +25 -25
- package/app/m/profiles/NostrIdentity/index.html +25 -25
- package/app/m/profiles/OidcIdentity/index.html +25 -25
- package/app/m/profiles/Organization/index.html +25 -25
- package/app/m/profiles/Person/index.html +25 -25
- package/app/m/profiles/Profile/index.html +25 -25
- package/app/m/profiles/ProfileMetadata/index.html +25 -25
- package/app/m/profiles/ProfileMetafield/index.html +25 -25
- package/app/m/profiles/ProfileRelationship/index.html +25 -25
- package/app/m/profiles/ProfileRelationshipTerm/index.html +25 -25
- package/app/m/profiles/ProfileRelationshipType/index.html +25 -25
- package/app/m/profiles/ProfileType/index.html +25 -25
- package/app/m/projects/Comment/index.html +25 -25
- package/app/m/projects/Issue/index.html +25 -25
- package/app/m/projects/Label/index.html +25 -25
- package/app/m/projects/Project/index.html +25 -25
- package/app/m/projects/ProjectIntegration/index.html +25 -25
- package/app/m/projects/PullRequest/index.html +25 -25
- package/app/m/projects/Repository/index.html +25 -25
- package/app/m/properties/Property/index.html +25 -25
- package/app/m/properties/Zone/index.html +25 -25
- package/app/m/reports/RuntimeReport/index.html +25 -25
- package/app/m/reports/SmrtPrincipalReportRefreshTask/index.html +26 -26
- package/app/m/reports/SmrtReportLock/index.html +26 -26
- package/app/m/reports/SmrtReportRefreshTask/index.html +26 -26
- package/app/m/reports/SmrtReportRun/index.html +26 -26
- package/app/m/reports/SmrtReportSchedule/index.html +26 -26
- package/app/m/reports/SmrtReportWatermark/index.html +26 -26
- package/app/m/sales/Agreement/index.html +25 -25
- package/app/m/sales/AttributionException/index.html +25 -25
- package/app/m/sales/AttributionPolicy/index.html +25 -25
- package/app/m/sales/Commission/index.html +25 -25
- package/app/m/sales/CommissionAdjustment/index.html +25 -25
- package/app/m/sales/CommissionPayout/index.html +25 -25
- package/app/m/sales/CommissionPlan/index.html +25 -25
- package/app/m/sales/Earner/index.html +25 -25
- package/app/m/sales/EarnerSourceAttribution/index.html +25 -25
- package/app/m/sales/EarningEvent/index.html +25 -25
- package/app/m/sales/ExecutedAgreement/index.html +25 -25
- package/app/m/sales/Lead/index.html +25 -25
- package/app/m/sales/Opportunity/index.html +25 -25
- package/app/m/sales/OpportunityConversion/index.html +25 -25
- package/app/m/sales/PipelineDefinition/index.html +25 -25
- package/app/m/sales/PipelineStage/index.html +25 -25
- package/app/m/sales/Referral/index.html +25 -25
- package/app/m/sales/ReferralAgreement/index.html +25 -25
- package/app/m/sales/ReferralLink/index.html +25 -25
- package/app/m/sales/ReferralProgram/index.html +25 -25
- package/app/m/sales/ReferralTermSnapshot/index.html +25 -25
- package/app/m/sales/ReferralTouch/index.html +25 -25
- package/app/m/sales/Referrer/index.html +25 -25
- package/app/m/sales/SalesActivity/index.html +25 -25
- package/app/m/sales/SalesRepresentative/index.html +25 -25
- package/app/m/sites/Site/index.html +25 -25
- package/app/m/sites/SiteAgentBinding/index.html +25 -25
- package/app/m/social/OAuthState/index.html +25 -25
- package/app/m/social/SocialAccount/index.html +25 -25
- package/app/m/social/SocialPost/index.html +25 -25
- package/app/m/social/SocialPostAnalyticsSnapshot/index.html +25 -25
- package/app/m/subscriptions/BillingAdjustment/index.html +25 -25
- package/app/m/subscriptions/ClientCharge/index.html +25 -25
- package/app/m/subscriptions/CreditGrant/index.html +25 -25
- package/app/m/subscriptions/PricingRule/index.html +25 -25
- package/app/m/subscriptions/RetailCharge/index.html +25 -25
- package/app/m/subscriptions/SpendingPolicy/index.html +25 -25
- package/app/m/subscriptions/SubscriptionPlan/index.html +25 -25
- package/app/m/subscriptions/TenantSubscription/index.html +25 -25
- package/app/m/subscriptions/TenantUsageMetric/index.html +25 -25
- package/app/m/support/ServiceTimeEntry/index.html +25 -25
- package/app/m/support/SupportAiRun/index.html +25 -25
- package/app/m/support/SupportAvailability/index.html +25 -25
- package/app/m/support/SupportCase/index.html +25 -25
- package/app/m/support/SupportCaseEvent/index.html +25 -25
- package/app/m/support/SupportChannelBinding/index.html +25 -25
- package/app/m/support/SupportCharge/index.html +25 -25
- package/app/m/support/SupportCompensation/index.html +25 -25
- package/app/m/support/SupportCompensationPlan/index.html +25 -25
- package/app/m/support/SupportEscalation/index.html +25 -25
- package/app/m/support/SupportInteraction/index.html +25 -25
- package/app/m/support/SupportPlan/index.html +25 -25
- package/app/m/support/SupportPolicy/index.html +25 -25
- package/app/m/support/SupportQualification/index.html +25 -25
- package/app/m/support/SupportServiceTarget/index.html +25 -25
- package/app/m/support/SupportSpecialist/index.html +25 -25
- package/app/m/support/SupportWorkLink/index.html +25 -25
- package/app/m/tags/Tag/index.html +25 -25
- package/app/m/tags/TagAlias/index.html +25 -25
- package/app/m/timesheets/AttendanceBreak/index.html +25 -25
- package/app/m/timesheets/AttendancePunch/index.html +25 -25
- package/app/m/timesheets/AttendanceSegment/index.html +25 -25
- package/app/m/timesheets/ServiceChargeSnapshot/index.html +25 -25
- package/app/m/timesheets/ServiceCompensationSnapshot/index.html +25 -25
- package/app/m/timesheets/ServiceTimeEntry/index.html +25 -25
- package/app/m/users/Group/index.html +25 -25
- package/app/m/users/GroupMember/index.html +25 -25
- package/app/m/users/GroupRole/index.html +25 -25
- package/app/m/users/Membership/index.html +25 -25
- package/app/m/users/MembershipOverride/index.html +25 -25
- package/app/m/users/Permission/index.html +25 -25
- package/app/m/users/Role/index.html +25 -25
- package/app/m/users/RolePermission/index.html +25 -25
- package/app/m/users/Session/index.html +25 -25
- package/app/m/users/Tenant/index.html +25 -25
- package/app/m/users/TenantIntegration/index.html +25 -25
- package/app/m/users/TenantPermissionOverride/index.html +25 -25
- package/app/m/users/User/index.html +25 -25
- package/app/m/video/Character/index.html +25 -25
- package/app/m/video/CharacterAsset/index.html +25 -25
- package/app/m/video/CompositeJob/index.html +25 -25
- package/app/m/video/Performer/index.html +25 -25
- package/app/m/video/PerformerAsset/index.html +25 -25
- package/app/m/video/Scene/index.html +25 -25
- package/app/m/video/SceneAsset/index.html +25 -25
- package/app/m/video/VideoComposition/index.html +25 -25
- package/app/m/video/VideoCompositionAsset/index.html +25 -25
- package/app/m/video/VideoSequence/index.html +25 -25
- package/app/m/video/VideoSequenceAsset/index.html +25 -25
- package/app/m/video/VideoShot/index.html +25 -25
- package/app/m/video/VideoShotAsset/index.html +25 -25
- package/app/m/video/VideoShotCharacter/index.html +25 -25
- package/app/m/video/VideoWorkflow/index.html +25 -25
- package/app/m/voice/VoiceOutput/index.html +25 -25
- package/app/m/voice/VoiceProfile/index.html +25 -25
- package/app/m/voice/VoiceSample/index.html +25 -25
- package/app/mcp.html +2 -2
- package/app/packages/ads/index.html +24 -24
- package/app/packages/analytics/index.html +24 -24
- package/app/packages/approvals/index.html +24 -24
- package/app/packages/assets/index.html +24 -24
- package/app/packages/chat/index.html +24 -24
- package/app/packages/comments/index.html +24 -24
- package/app/packages/commerce/index.html +25 -25
- package/app/packages/content/index.html +24 -24
- package/app/packages/events/index.html +24 -24
- package/app/packages/expenses/index.html +25 -25
- package/app/packages/facts/index.html +24 -24
- package/app/packages/fields/index.html +24 -24
- package/app/packages/human-resources/index.html +24 -24
- package/app/packages/images/index.html +24 -24
- package/app/packages/index.html +24 -24
- package/app/packages/ingestion/index.html +24 -24
- package/app/packages/inventory/index.html +24 -24
- package/app/packages/ledgers/index.html +24 -24
- package/app/packages/manufacturing/index.html +24 -24
- package/app/packages/marketing/index.html +24 -24
- package/app/packages/messages/index.html +24 -24
- package/app/packages/places/index.html +24 -24
- package/app/packages/preferences/index.html +24 -24
- package/app/packages/products/index.html +24 -24
- package/app/packages/profiles/index.html +24 -24
- package/app/packages/projects/index.html +24 -24
- package/app/packages/properties/index.html +24 -24
- package/app/packages/reports/index.html +24 -24
- package/app/packages/sales/index.html +24 -24
- package/app/packages/sites/index.html +24 -24
- package/app/packages/social/index.html +24 -24
- package/app/packages/subscriptions/index.html +24 -24
- package/app/packages/support/index.html +24 -24
- package/app/packages/tags/index.html +24 -24
- package/app/packages/timesheets/index.html +24 -24
- package/app/packages/users/index.html +24 -24
- package/app/packages/video/index.html +24 -24
- package/app/packages/voice/index.html +24 -24
- package/app/packages/webhooks/index.html +24 -24
- package/app/recipes/account-access/help/index.html +24 -24
- package/app/recipes/account-access/index.html +26 -26
- package/app/recipes/activity/help/index.html +24 -24
- package/app/recipes/activity/index.html +26 -26
- package/app/recipes/agreements/help/index.html +26 -26
- package/app/recipes/agreements/index.html +27 -27
- package/app/recipes/analytics.reports/help/index.html +24 -24
- package/app/recipes/analytics.reports/index.html +26 -26
- package/app/recipes/assets/help/index.html +24 -24
- package/app/recipes/assets/index.html +27 -27
- package/app/recipes/billing/help/index.html +26 -26
- package/app/recipes/billing/index.html +26 -26
- package/app/recipes/chat.assistant/help/index.html +24 -24
- package/app/recipes/chat.assistant/index.html +26 -26
- package/app/recipes/comments/help/index.html +24 -24
- package/app/recipes/comments/index.html +26 -26
- package/app/recipes/commerce.customers/help/index.html +24 -24
- package/app/recipes/commerce.customers/index.html +26 -26
- package/app/recipes/commerce.estimates/help/index.html +26 -26
- package/app/recipes/commerce.estimates/index.html +26 -26
- package/app/recipes/commerce.purchases/help/index.html +26 -26
- package/app/recipes/commerce.purchases/index.html +26 -26
- package/app/recipes/commerce.sales/help/index.html +26 -26
- package/app/recipes/commerce.sales/index.html +26 -26
- package/app/recipes/commerce.vendors/help/index.html +24 -24
- package/app/recipes/commerce.vendors/index.html +26 -26
- package/app/recipes/commerce.wholesale/help/index.html +26 -26
- package/app/recipes/commerce.wholesale/index.html +26 -26
- package/app/recipes/events.calendar/help/index.html +24 -24
- package/app/recipes/events.calendar/index.html +26 -26
- package/app/recipes/expenses.tracking/help/index.html +26 -26
- package/app/recipes/expenses.tracking/index.html +26 -26
- package/app/recipes/fields.form-customization/help/index.html +24 -24
- package/app/recipes/fields.form-customization/index.html +26 -26
- package/app/recipes/ingestion/help/index.html +24 -24
- package/app/recipes/ingestion/index.html +26 -26
- package/app/recipes/integrations/help/index.html +24 -24
- package/app/recipes/integrations/index.html +26 -26
- package/app/recipes/inventory.stock/help/index.html +24 -24
- package/app/recipes/inventory.stock/index.html +26 -26
- package/app/recipes/ledgers.bookkeeping/help/index.html +24 -24
- package/app/recipes/ledgers.bookkeeping/index.html +26 -26
- package/app/recipes/messages/help/index.html +24 -24
- package/app/recipes/messages/index.html +26 -26
- package/app/recipes/products/help/index.html +24 -24
- package/app/recipes/products/index.html +26 -26
- package/app/recipes/projects.tracker/help/index.html +24 -24
- package/app/recipes/projects.tracker/index.html +27 -27
- package/app/recipes/reports.materialized/help/index.html +26 -26
- package/app/recipes/reports.materialized/index.html +29 -29
- package/app/recipes/reports.runtime/help/index.html +24 -24
- package/app/recipes/reports.runtime/index.html +27 -27
- package/app/recipes/sales.pipeline/help/index.html +24 -24
- package/app/recipes/sales.pipeline/index.html +26 -26
- package/app/recipes/tags.taxonomy/help/index.html +24 -24
- package/app/recipes/tags.taxonomy/index.html +26 -26
- package/app/recipes/team-collaboration/help/index.html +24 -24
- package/app/recipes/team-collaboration/index.html +26 -26
- package/app/recipes/timesheets.time-entries/help/index.html +24 -24
- package/app/recipes/timesheets.time-entries/index.html +26 -26
- package/app/s/custom-accounts/index.html +22 -22
- package/app/s/custom-appointments/index.html +22 -22
- package/app/s/custom-billing/index.html +22 -22
- package/app/s/custom-buying/index.html +22 -22
- package/app/s/custom-checkout/index.html +22 -22
- package/app/s/custom-classes/index.html +22 -22
- package/app/s/custom-clients/index.html +22 -22
- package/app/s/custom-events/index.html +22 -22
- package/app/s/custom-fleet/index.html +22 -22
- package/app/s/custom-giving/index.html +22 -22
- package/app/s/custom-jobs/index.html +22 -22
- package/app/s/custom-kitchen/index.html +22 -22
- package/app/s/custom-material/index.html +22 -22
- package/app/s/custom-meetings/index.html +22 -22
- package/app/s/custom-members/index.html +22 -22
- package/app/s/custom-paint/index.html +82 -0
- package/app/s/custom-parts/index.html +22 -22
- package/app/s/custom-rentals/index.html +22 -22
- package/app/s/custom-roastery/index.html +22 -22
- package/app/s/custom-schedule/index.html +22 -22
- package/app/s/custom-shelf/index.html +22 -22
- package/app/s/custom-shop/index.html +22 -22
- package/app/s/custom-wholesale/index.html +22 -22
- package/app/s/custom-work/index.html +22 -22
- package/app/s/custom-yard/index.html +22 -22
- package/app/s/section-access-control/index.html +22 -22
- package/app/s/section-account-security/index.html +22 -22
- package/app/s/section-accounting/index.html +22 -22
- package/app/s/section-activity/index.html +22 -22
- package/app/s/section-agreements/index.html +22 -22
- package/app/s/section-analytics/index.html +22 -22
- package/app/s/section-assets/index.html +22 -22
- package/app/s/section-billing/index.html +22 -22
- package/app/s/section-calendar/index.html +22 -22
- package/app/s/section-catalog/index.html +22 -22
- package/app/s/section-chat.assistant/index.html +22 -22
- package/app/s/section-comments/index.html +22 -22
- package/app/s/section-fields.form-customization/index.html +22 -22
- package/app/s/section-ingestion/index.html +22 -22
- package/app/s/section-integrations/index.html +22 -22
- package/app/s/section-messages/index.html +22 -22
- package/app/s/section-more/index.html +22 -22
- package/app/s/section-operations/index.html +22 -22
- package/app/s/section-projects/index.html +22 -22
- package/app/s/section-purchasing/index.html +22 -22
- package/app/s/section-reports.materialized/index.html +22 -22
- package/app/s/section-reports.runtime/index.html +22 -22
- package/app/s/section-sales/index.html +22 -22
- package/app/s/section-taxonomy/index.html +22 -22
- package/app/s/section-team/index.html +22 -22
- package/app/s/section-work/index.html +22 -22
- package/dist/ai/instance.d.ts.map +1 -1
- package/dist/ai/instance.js +9 -1
- package/dist/assistant/change.d.ts +13 -3
- package/dist/assistant/change.d.ts.map +1 -1
- package/dist/assistant/change.js +18 -3
- package/dist/assistant/prompt.d.ts +6 -1
- package/dist/assistant/prompt.d.ts.map +1 -1
- package/dist/assistant/prompt.js +13 -1
- package/dist/assistant/session.svelte.d.ts +5 -0
- package/dist/assistant/session.svelte.d.ts.map +1 -1
- package/dist/assistant/session.svelte.js +1 -0
- package/dist/assistant/transport.d.ts +24 -1
- package/dist/assistant/transport.d.ts.map +1 -1
- package/dist/assistant/transport.js +57 -8
- package/dist/catalog/catalog.json +1366 -51
- package/dist/components/BrowserAssistant.svelte +0 -2
- package/dist/components/BrowserAssistant.svelte.d.ts.map +1 -1
- package/dist/components/CookbooksPanel.svelte +101 -21
- package/dist/components/CookbooksPanel.svelte.d.ts.map +1 -1
- package/dist/data/format.d.ts.map +1 -1
- package/dist/data/format.js +3 -0
- package/dist/data/money.d.ts +1 -1
- package/dist/data/money.js +2 -2
- package/dist/data/packs.d.ts +0 -1
- package/dist/data/packs.d.ts.map +1 -1
- package/dist/data/packs.js +835 -1
- package/dist/library/apply.d.ts +7 -3
- package/dist/library/apply.d.ts.map +1 -1
- package/dist/library/apply.js +19 -6
- package/dist/library/document.d.ts +9 -0
- package/dist/library/document.d.ts.map +1 -1
- package/dist/library/document.js +29 -0
- package/dist/library/icons.d.ts.map +1 -1
- package/dist/library/icons.js +15 -0
- package/dist/library/index.d.ts +4 -1
- package/dist/library/index.d.ts.map +1 -1
- package/dist/library/index.js +9 -2
- package/dist/library/library.json +919 -14
- package/dist/library/state.svelte.d.ts +5 -1
- package/dist/library/state.svelte.d.ts.map +1 -1
- package/dist/library/state.svelte.js +12 -1
- package/dist/library/view.svelte.d.ts +41 -0
- package/dist/library/view.svelte.d.ts.map +1 -0
- package/dist/library/view.svelte.js +67 -0
- package/dist/planner/Planner.svelte +79 -2
- package/dist/planner/Planner.svelte.d.ts.map +1 -1
- package/dist/planner/PlannerControls.svelte +21 -2
- package/dist/planner/PlannerControls.svelte.d.ts.map +1 -1
- package/dist/planner/assistant.d.ts.map +1 -1
- package/dist/planner/assistant.js +9 -0
- package/dist/planner/commands/adapter.d.ts.map +1 -1
- package/dist/planner/commands/adapter.js +10 -3
- package/dist/planner/commands/controller.svelte.d.ts.map +1 -1
- package/dist/planner/commands/controller.svelte.js +2 -1
- package/dist/recipes/scope.d.ts +23 -0
- package/dist/recipes/scope.d.ts.map +1 -1
- package/dist/recipes/scope.js +20 -0
- package/dist/smrt-version.d.ts +1 -1
- package/dist/smrt-version.js +1 -1
- package/package.json +56 -56
- package/app/_app/immutable/assets/2.Djk1H2wk.css +0 -1
- package/app/_app/immutable/chunks/BV_A2GBw.js +0 -24
- package/app/_app/immutable/chunks/CbCYY1ps.js +0 -1
- package/app/_app/immutable/chunks/DD4mX3od.js +0 -1
- package/app/_app/immutable/chunks/DgkBKeKW.js +0 -4
- package/app/_app/immutable/chunks/DvUWb_GS.js +0 -1
- package/app/_app/immutable/chunks/M81UeXT1.js +0 -1
- package/app/_app/immutable/chunks/g7M7feZg.js +0 -1
- package/app/_app/immutable/chunks/r7IFcw-O.js +0 -1
- package/app/_app/immutable/entry/start.BixveMT0.js +0 -1
- package/app/_app/immutable/nodes/0._WFh95JB.js +0 -9
- package/app/_app/immutable/nodes/2.D3Lg90Nn.js +0 -24
- /package/app/_app/immutable/chunks/{DVQPWAnI.js → Bv5jGtB8.js} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
import{$ as e,B as t,Ct as n,Dt as r,E as i,Et as a,F as o,Ft as s,G as c,H as l,K as u,L as d,Lt as f,Ot as p,Pt as m,U as h,W as g,X as _,Y as v,a as y,bt as b,ct as ee,d as x,ft as S,gt as C,ht as w,k as te,mt as T,pt as E,q as ne,st as D,v as O,vt as k}from"./DG3qFFTE.js";import"./xihTtKlq.js";import{a as re}from"./DVQPWAnI.js";import"./YUSKx8_q.js";import{ft as A,lt as ie,p as j,u as M,ut as N}from"./rkUL-DlL.js";import"./DK8Blf1Y.js";import"./M-CuJzQN.js";import"./DD4mX3od.js";v([`click`]),v([`click`,`keydown`]),v([`click`]);var P=new Map(Object.entries({menu:`M3 18h18v-2H3v2zm0-5h18v-2H3v2zm0-7v2h18V6H3z`,search:`M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z`,close:`M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z`,"chevron-right":`M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6-6-6z`,"chevron-left":`M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12l4.58-4.59z`,"chevron-down":`M7.41 8.59L12 13.17l4.59-4.58L18 10l-6 6-6-6 1.41-1.41z`,check:`M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41L9 16.17z`,add:`M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z`,mic:`M12 14c1.66 0 3-1.34 3-3V5c0-1.66-1.34-3-3-3S9 3.34 9 5v6c0 1.66 1.34 3 3 3z M17 11c0 2.76-2.24 5-5 5s-5-2.24-5-5H5c0 3.53 2.04 6.43 5 7.07V21h4v-2.93c2.96-.64 5-3.54 5-7.07h-2z`,alert:`M12 2a10 10 0 1 0 0 20 10 10 0 0 0 0-20zm-1 5h2v6h-2zm0 8h2v2h-2z`,warning:`M1 21h22L12 2 1 21zm12-3h-2v-2h2zm0-4h-2v-4h2z`,info:`M12 2a10 10 0 1 0 0 20 10 10 0 0 0 0-20zm1 15h-2v-6h2zm0-8h-2V7h2z`,home:`M3 10 12 2 21 10v11h-6v-7H9v7H3z`,user:`M12 3a4 4 0 1 0 0 8 4 4 0 0 0 0-8zM4 21v-2c0-4 16-4 16 0v2H4z`,settings:`M10 2h4l1 3 3-1 3 3-1 3 3 1v4l-3 1 1 3-3 3-3-1-1 3h-4l-1-3-3 1-3-3 1-3-3-1v-4l3-1-1-3 3-3 3 1 1-3zm2 6a4 4 0 1 0 0 8 4 4 0 0 0 0-8z`,trash:`M7 3h10v2h4v2H3V5h4V3zm-2 6h14v12H5V9zm4 2v8h2v-8H9zm4 0v8h2v-8h-2z`,edit:`M3 17.25V21h3.75L17.81 9.94l-3.75-3.75L3 17.25zM20.71 7.04a1 1 0 0 0 0-1.41l-2.34-2.34a1 1 0 0 0-1.41 0l-1.83 1.83 3.75 3.75 1.83-1.83z`,calendar:`M7 2h2v2h6V2h2v2h4v18H3V4h4V2zm-2 8v10h14V10H5zm2 2h4v4H7v-4z`,clock:`M12 2a10 10 0 1 0 0 20 10 10 0 0 0 0-20zm0 2a8 8 0 1 1 0 16 8 8 0 0 1 0-16zm-1 2h2v5.5l4 2.5-1 1.5-5-3V6z`,camera:`M9 3h6l2 3h4v15H3V6h4l2-3zm3 5a5 5 0 1 0 0 10 5 5 0 0 0 0-10zm0 2a3 3 0 1 1 0 6 3 3 0 0 1 0-6z`,upload:`M11 16V7l-4 4-1.5-1.5L12 3l6.5 6.5L17 11l-4-4v9h-2zM3 18h18v3H3v-3z`,download:`M11 3h2v9l4-4 1.5 1.5L12 16l-6.5-6.5L7 8l4 4V3zM3 18h18v3H3v-3z`})),F=b([]);function I(t){for(let n=e(F).length-1;n>=0;n--){let r=e(F)[n].paths.get(t);if(r!==void 0)return r}return P.get(t)}var L=u(`<svg xmlns="http://www.w3.org/2000/svg" data-smrt-component="Icon" class="svelte-em2a54"><path></path></svg>`);function R(t,i){p(i,!0);let a=y(i,`size`,3,24),o=y(i,`color`,3,`currentColor`),s=y(i,`viewBox`,3,`0 0 24 24`),c=n(()=>!!i[`aria-label`]),l=n(()=>i.path??(i.name?I(i.name):``)),u=n(()=>typeof a()==`number`?`${a()}px`:a());var d=L(),f=T(d);D(()=>{O(d,`width`,e(u)),O(d,`height`,e(u)),O(d,`viewBox`,s()),O(d,`fill`,o()),O(d,`aria-hidden`,!e(c)),O(d,`aria-label`,i[`aria-label`]),O(d,`role`,e(c)?`img`:void 0),O(f,`d`,e(l))}),h(t,d),r()}v([`click`]);var z=Symbol.for(`smrt-ui.page-header`);function ae(){return a(z)??null}var oe=c(`<li class="svelte-1f2td7n"><a class="svelte-1f2td7n"> </a></li>`),B=c(`<nav class="page-crumbs svelte-1f2td7n" data-shell-breadcrumbs=""><ol class="svelte-1f2td7n"></ol></nav>`),se=c(`<a class="back-link svelte-1f2td7n"><!> <span> </span></a>`),ce=c(`<h1 class="page-title page-title-field svelte-1f2td7n" data-page-title-field=""><!></h1>`),le=c(`<h1 class="page-title svelte-1f2td7n" data-shell-page-title=""> </h1>`),ue=c(`<p class="page-subtitle svelte-1f2td7n"> </p>`),de=c(`<div class="page-meta svelte-1f2td7n"><!></div>`),fe=c(`<div class="header-actions svelte-1f2td7n"><!></div>`),pe=c(`<div class="header-extra svelte-1f2td7n" data-page-header-extra=""><!></div>`),me=c(`<header class="page-header svelte-1f2td7n" data-page-header="" data-smrt-component="PageHeader"><!> <div class="header-main svelte-1f2td7n"><div class="header-content svelte-1f2td7n"><!> <!> <!> <!></div> <!></div> <!></header>`);function he(i,a){p(a,!0);let c=y(a,`parents`,19,()=>[]),u=y(a,`crumbsLabel`,3,`Breadcrumb`),f=y(a,`backLabel`,3,`Back`),m=ae(),g=n(()=>a.crumbs??(m?m.crumbs(c()):c()));ee(()=>m?.report?.({title:a.shortTitle??a.title,parents:c()}));var _=me(),v=S(_),b=t=>{var n=B(),r=S(n);d(r,23,()=>e(g),(e,t)=>`${t}:${e.href}`,(t,n)=>{var r=oe(),i=S(r),a=T(i,!0);s(r),D(()=>{O(i,`href`,e(n).href),l(a,e(n).label)}),h(t,r)}),s(r),s(n),D(()=>O(n,`aria-label`,u())),h(t,n)};t(v,t=>{e(g).length>0&&t(b)});var x=w(v,2),C=S(x),E=S(C),ne=e=>{var t=se(),n=S(t);R(n,{name:`chevron-left`,size:20});var r=w(n,2),i=T(r,!0);s(t),te(t,e=>re?.(e)),D(()=>{O(t,`href`,a.backHref),l(i,f())}),h(e,t)};t(E,e=>{a.backHref&&e(ne)});var k=w(E,2),A=e=>{var t=ce(),n=S(t);o(n,()=>a.titleField),s(t),h(e,t)},ie=e=>{var t=le(),n=T(t,!0);D(()=>l(n,a.title)),h(e,t)};t(k,e=>{a.titleField?e(A):e(ie,-1)});var j=w(k,2),M=e=>{var t=ue(),n=T(t,!0);D(()=>l(n,a.subtitle)),h(e,t)};t(j,e=>{a.subtitle&&e(M)});var N=w(j,2),P=e=>{var t=de(),n=S(t);o(n,()=>a.meta),s(t),h(e,t)};t(N,e=>{a.meta&&e(P)}),s(C);var F=w(C,2),I=e=>{var t=fe(),n=S(t);o(n,()=>a.actions),s(t),h(e,t)};t(F,e=>{a.actions&&e(I)}),s(x);var L=w(x,2),z=e=>{var t=pe(),n=S(t);o(n,()=>a.children),s(t),h(e,t)};t(L,e=>{a.children&&e(z)}),s(_),h(i,_),r()}v([`click`]),v([`click`]);function ge(e,t,n){if(!n||n<1||e.length<=n)return{visible:[...e],overflow:[]};let r=e.slice(0,n-1),i=e.slice(n-1),a=i.find(e=>e.id===t)??i[0];return{visible:a?[...r,a]:r,overflow:i.filter(e=>e!==a)}}var _e=c(`<span class="smrt-tabs__tab-count svelte-19k21oo" data-smrt-part="count"> </span>`),ve=c(`<span class="smrt-tabs__tab-badge svelte-19k21oo" data-smrt-part="badge"> </span>`),ye=c(`<a data-smrt-part="tab"><span data-smrt-part="label"> </span> <!> <!></a>`),be=c(`<span class="smrt-tabs__tab-dot svelte-19k21oo" data-smrt-part="marker" aria-hidden="true"></span> <span class="smrt-tabs__visually-hidden svelte-19k21oo" data-smrt-part="description"> </span>`,1),xe=c(`<details class="smrt-tabs__more svelte-19k21oo" data-smrt-part="overflow"><summary class="smrt-tabs__tab-link svelte-19k21oo" data-smrt-part="trigger"><span data-smrt-part="label"> </span> <!></summary> <div class="smrt-tabs__more-menu svelte-19k21oo" data-smrt-part="menu"></div></details>`),Se=c(`<div class="smrt-tabs__tab-panel svelte-19k21oo" data-smrt-part="panel"><!></div>`),Ce=c(`<div class="smrt-tabs__container svelte-19k21oo" data-smrt-component="Tabs"><nav data-smrt-part="list" data-shell-tabs=""><div class="smrt-tabs__links-row svelte-19k21oo" data-smrt-part="row"></div> <!></nav> <!></div>`),we=c(`<button type="button" data-smrt-part="tab" role="tab"><span class="smrt-tabs__tab-content-wrapper svelte-19k21oo" data-smrt-part="body"><span data-smrt-part="label"> </span> <!> <!></span> <div class="smrt-tabs__active-indicator svelte-19k21oo" data-smrt-part="indicator"></div></button>`),Te=c(`<div class="smrt-tabs__tab-panel svelte-19k21oo" data-smrt-part="panel" role="tabpanel"><!></div>`),Ee=c(`<div class="smrt-tabs__container svelte-19k21oo" data-smrt-component="Tabs"><div data-smrt-part="list" role="tablist"></div> <!></div>`);function De(a,c){let u=ne();p(c,!0);let v=(r,a=f)=>{var o=ye();let u;var d=S(o),p=T(d,!0),m=w(d,2),g=e=>{var t=_e(),n=T(t,!0);D(()=>l(n,a().count)),h(e,t)};t(m,e=>{a().count!==void 0&&e(g)});var v=w(m,2),y=e=>{var t=ve(),n=T(t,!0);D(()=>l(n,a().badge)),h(e,t)},b=n(()=>L(a()));t(v,t=>{e(b)&&t(y)}),s(o),D(()=>{u=i(o,1,`smrt-tabs__tab-link svelte-19k21oo`,null,u,{"smrt-tabs__active":a().id===c.active}),O(o,`href`,a().disabled?void 0:a().href),O(o,`aria-current`,a().id===c.active?`page`:void 0),O(o,`aria-disabled`,a().disabled?`true`:void 0),O(o,`data-tab-id`,a().id),l(p,a().label)}),_(`click`,o,e=>{a().disabled?e.preventDefault():ae(a().id)}),h(r,o)},C=y(c,`size`,3,`md`),A=y(c,`variant`,3,`primary`),ie=y(c,`moreLabel`,3,`More`),j=y(c,`moreBadgeLabel`,3,`has updates`),M=n(()=>c.tabs.length>0&&c.tabs.every(e=>!!e.href)),N=n(()=>e(M)?ge(c.tabs,c.active,c.maxVisible):{visible:c.tabs,overflow:[]}),P=n(()=>e(N).overflow.some(e=>L(e))),F=b(null),I=b(null);ee(()=>{let t=c.active;e(M)&&e(I)&&(e(F)&&(e(F).open=!1),e(I).querySelector(`[data-tab-id="${CSS.escape(t)}"]`)?.scrollIntoView?.({block:`nearest`,inline:`nearest`}))});function L(e){return e.badge!==void 0&&e.badge!==null&&e.badge!==``}let R=n(()=>c.tabs.filter(e=>!e.disabled)),z=b(null);function ae(e){c.tabs.find(t=>t.id===e)?.disabled||e!==c.active&&c.onchange?.(e)}function oe(t,n){let r=e(R).findIndex(e=>e.id===n),i=null;switch(t.key){case`ArrowRight`:t.preventDefault(),i=(r+1)%e(R).length;break;case`ArrowLeft`:t.preventDefault(),i=(r-1+e(R).length)%e(R).length;break;case`Home`:t.preventDefault(),i=0;break;case`End`:t.preventDefault(),i=e(R).length-1}if(i!==null&&i!==r){let t=e(R)[i];t&&(c.onchange?.(t.id),requestAnimationFrame(()=>{(e(z)?.querySelector(`[data-tab-id="${CSS.escape(t.id)}"]`))?.focus()}))}}var B=g(),se=E(B),ce=n=>{var r=Ce(),a=S(r);let u;var f=S(a);d(f,21,()=>e(N).visible,e=>e.id,(t,n)=>{v(t,()=>e(n))}),s(f),x(f,e=>k(I,e),()=>e(I));var p=w(f,2),m=n=>{var r=xe(),i=S(r),a=S(i),o=T(a,!0),c=w(a,2),u=e=>{var t=be(),n=w(E(t),2),r=T(n);D(()=>l(r,`(${j()??``})`)),h(e,t)};t(c,t=>{e(P)&&t(u)}),s(i);var f=w(i,2);d(f,21,()=>e(N).overflow,e=>e.id,(t,n)=>{v(t,()=>e(n))}),s(f),s(r),x(r,e=>k(F,e),()=>e(F)),D(()=>l(o,ie())),h(n,r)};t(p,t=>{e(N).overflow.length>0&&t(m)}),s(a);var g=w(a,2),_=e=>{var t=Se(),n=S(t);o(n,()=>c.children),s(t),h(e,t)};t(g,e=>{c.children&&e(_)}),s(r),D(()=>{u=i(a,1,`smrt-tabs__links svelte-19k21oo`,null,u,{"smrt-tabs__sm":C()===`sm`,"smrt-tabs__lg":C()===`lg`}),O(a,`aria-label`,c[`aria-label`])}),h(n,r)},le=r=>{var a=Ee(),f=S(a);let p;d(f,21,()=>c.tabs,e=>e.id,(r,a)=>{var o=we();let d;var f=S(o),p=S(f),g=T(p,!0),v=w(p,2),y=t=>{var n=_e(),r=T(n,!0);D(()=>l(r,e(a).count)),h(t,n)};t(v,t=>{e(a).count!==void 0&&t(y)});var b=w(v,2),ee=t=>{var n=ve(),r=T(n,!0);D(()=>l(r,e(a).badge)),h(t,n)},x=n(()=>L(e(a)));t(b,t=>{e(x)&&t(ee)}),s(f),m(2),s(o),te(o,e=>re?.(e)),D(()=>{d=i(o,1,`smrt-tabs__tab-button svelte-19k21oo`,null,d,{"smrt-tabs__active":e(a).id===c.active}),o.disabled=e(a).disabled,O(o,`id`,`tab-${u}-${e(a).id??``}`),O(o,`aria-selected`,e(a).id===c.active),O(o,`aria-controls`,`tab-panel-${u}`),O(o,`tabindex`,e(a).id===c.active?0:-1),O(o,`data-tab-id`,e(a).id),l(g,e(a).label)}),_(`click`,o,()=>ae(e(a).id)),_(`keydown`,o,t=>oe(t,e(a).id)),h(r,o)}),s(f),x(f,e=>k(z,e),()=>e(z));var g=w(f,2),v=e=>{var t=Te(),n=S(t);o(n,()=>c.children),s(t),D(()=>{O(t,`id`,`tab-panel-${u}`),O(t,`aria-labelledby`,`tab-${u}-${c.active??``}`)}),h(e,t)};t(g,e=>{c.children&&e(v)}),s(a),D(()=>{p=i(f,1,`smrt-tabs__nav svelte-19k21oo`,null,p,{"smrt-tabs__sm":C()===`sm`,"smrt-tabs__lg":C()===`lg`,"smrt-tabs__secondary":A()===`secondary`}),O(f,`aria-label`,c[`aria-label`])}),h(r,a)};t(se,t=>{e(M)?t(ce):t(le,-1)}),h(a,B),r()}v([`click`,`keydown`]),v([`click`,`keydown`]);function Oe(){let e=new Map,t=new Map,n=(e,t)=>`${e}:${t}`;return{register(t,r,i){e.set(n(t,r),i)},get(t,r){return e.get(n(t,r))},has(t,r){return e.has(n(t,r))},getSlots(t){let n=`${t}:`;return Array.from(e.keys()).filter(e=>e.startsWith(n)).map(e=>e.slice(n.length))},getModules(){return Array.from(t.keys())},getModuleMeta(e){return t.get(e)},registerModule(e){t.set(e.name,e)},unregister(t,r){return e.delete(n(t,r))},clear(){e.clear(),t.clear()}}}var ke=Oe(),Ae=[`SmrtJunction`,`SmrtJunctionBase`,`SmrtPolymorphicAssociation`],je=[`Metafield`,`Metadata`,`Association`,`LineItem`,`Allocation`,`Revision`,`Attachment`,`Snapshot`,`Completion`,`Override`,`Alias`],Me=[`Status`,`Type`],Ne={"@happyvertical/smrt-commerce:TaxComponent":`lookup`,"@happyvertical/smrt-commerce:TaxSettings":`settings`,"@happyvertical/smrt-commerce:DocumentTax":`snapshot`,"@happyvertical/smrt-commerce:TaxSummaryReport":`report`},V=new Set([`foreignKey`,`crossPackageRef`]);function Pe(e){let t=e.id?Ne[e.id]:void 0;if(t)return t;let n=e.extends?.split(`:`).pop();if(n&&Ae.includes(n))return`junction`;let r=e.fields.filter(e=>!e.system),i=r.filter(e=>V.has(e.type)).length;return i>=2&&r.length-i<=1?`link`:je.some(t=>e.name.endsWith(t))?`child`:r.length<=3&&Me.some(t=>e.name.endsWith(t))?`lookup`:null}function Fe(e){return Pe(e)!==null}var Ie=new Set([`junction`,`link`,`child`]);function H(e,t){return e.includes(`:`)?e:`${t.slice(0,t.lastIndexOf(`:`))}:${e}`}function U(e,t){let n=[],r=e.get(t);for(;r&&!n.includes(r.id);)n.push(r.id),r=r.extends?e.get(H(r.extends,r.id)):void 0;return n}function Le(e,t){let n=e.packages.flatMap(e=>e.models),r=new Map(n.map(e=>[e.id,e])),i=new Set(U(r,t));return i.size?n.filter(e=>{if(i.has(e.id))return!1;let t=Pe(e);return!t||!Ie.has(t)?!1:e.fields.some(t=>V.has(t.type)&&t.related&&i.has(H(t.related,e.id)))}):[]}function Re(e,t){let n=e.fields.find(n=>V.has(n.type)&&n.related&&t.has(H(n.related,e.id)));return n?{model:e,fk:n.name}:void 0}function ze(e,t,n){let r=e.packages.flatMap(e=>e.models),i=new Map(r.map(e=>[e.id,e])),a=new Set(U(i,n));if(!a.size)return[];let o=t.filter(e=>e.models.includes(n));if(!o.length)return Le(e,n).flatMap(e=>{let t=Re(e,a);return t?[t]:[]});let s=new Map;for(let e of o){let t=new Set(e.nav.map(e=>e.model));for(let n of e.models){let e=i.get(n);if(!e||t.has(n)||a.has(n)||s.has(n))continue;let r=Re(e,a);r&&s.set(n,r)}}return[...s.values()]}function Be(e,t){let n=e.packages.flatMap(e=>e.models),r=new Map(n.map(e=>[e.id,e])),i=new Set(U(r,t));if(!i.size)return[];let a=[];for(let e of n)if(!i.has(e.id))for(let t of e.fields)V.has(t.type)&&t.related&&i.has(H(t.related,e.id))&&a.push({model:e,fk:t.name});return a}function Ve(e,t){let n=e.packages.flatMap(e=>e.models),r=new Map(n.map(e=>[e.id,e])),i=r.get(t);return i?i.fields.flatMap(e=>{if(!V.has(e.type)||!e.related)return[];let t=r.get(H(e.related,i.id));return t?[{model:t,fk:e.name}]:[]}):[]}function He(e,t){return e.some(e=>e.nav.some(e=>e.model===t))}function Ue(e,t){let n=e;for(let e of t)if(n.length>e.length&&n.startsWith(e)){n=n.slice(e.length);break}let r=n.replace(/([a-z0-9])([A-Z])/g,`$1 $2`).toLowerCase(),i=/[^aeiou]y$/.test(r)?`${r.slice(0,-1)}ies`:/(s|x|ch|sh)$/.test(r)?`${r}es`:`${r}s`;return i.charAt(0).toUpperCase()+i.slice(1)}function We(e,t){let n=e.packages.flatMap(e=>e.models),r=new Map(n.map(e=>[e.id,e]));return U(r,t).flatMap(e=>{let t=r.get(e);return t?[t.name]:[]})}function Ge(e,t,n){let r=We(e,t);return Le(e,t).filter(e=>n(e)&&r.some(t=>e.name.startsWith(t)))}function W(e){return e.group?.id??e.id}function Ke(e){let t=new Map;for(let n of e){let e=W(n),r=t.get(e);r?r.recipes.push(n):t.set(e,{id:e,label:n.group?.label??n.label,recipes:[n]})}return[...t.values()]}function G(e){return e.section??{id:W(e),label:e.group?.label??e.label}}function qe(e){let t=new Map;for(let n of e){let e=G(n),r=t.get(e.id);r?r.recipes.push(n):t.set(e.id,{...e,recipes:[n]})}return[...t.values()]}function Je(e){let t=new Set(e.map(e=>G(e).id)),n={};for(let r of e){let e=W(r),i=G(r).id;e!==i&&!t.has(e)&&(n[e]=i)}return n}function Ye(e,t,n){return`item:${e}:${t}${n?`:${n}`:``}`}function Xe(e,t){return e?.trim()||t.description?.trim()||`Your ${Ze(t.name)} records, all in one place.`}function Ze(e){return e.replace(/([a-z0-9])([A-Z])/g,`$1 $2`).toLowerCase()}var Qe={id:`more`,label:`More`,icon:`layers`,description:`Extra records you added one at a time.`},$e=`fileText`;function et(e){let t=e.description?.trim();if(t)return t.split(/(?<=[.!?])\s/)[0]??t;let n=e.fields.filter(e=>!e.system).length;return`${n} ${n===1?`field`:`fields`}`}function tt(e,t){let n=new Set(t.flatMap(e=>e.models));return e.packages.flatMap(t=>N(t).filter(e=>!n.has(e.id)).map(n=>({id:n.id,name:n.name,label:j(n.name),packageId:t.id,description:et(n),described:!!n.description?.trim(),plumbing:Fe(n),fieldNames:n.fields.map(e=>e.name),includes:Le(e,n.id).map(e=>j(e.name))})))}function nt(e){return e.described?e.description:`${j(e.packageId)} · ${e.description}`}function rt(e,t){return t?[...e]:e.filter(e=>!e.plumbing)}function it(e){return[...new Set(e.map(e=>e.packageId))]}function at(e,t,n){let r=t.toLowerCase().split(/\s+/).filter(Boolean);return e.filter(e=>{if(n&&e.packageId!==n)return!1;if(!r.length)return!0;let t=[e.name,e.label,e.description,e.packageId,...e.fieldNames].join(` `).toLowerCase();return r.every(e=>t.includes(e))})}function ot(e){return e.flatMap(e=>{let t=A(e);return t?.model.exposed?[{id:Ye(t.pkg.id,t.model.name),packageId:t.pkg.id,modelName:t.model.name,label:j(t.model.name),icon:$e,description:Xe(void 0,t.model)}]:[]})}var st={"@happyvertical/smrt-commerce:Customer":{profileId:`Links this customer to their profile record, where their name and contact details are kept.`,creditLimit:`The most this customer may owe you at one time. Leave it empty or at zero if you do not set limits.`,paymentTerms:`How long the customer has to pay, written the way you would say it, for example "Net 30".`,taxExempt:`Turn this on if you do not charge this customer sales tax.`,taxId:`The customer's tax or VAT number, kept on file for tax-exempt sales.`,defaultShippingAddress:`Where you usually send this customer's goods, so you do not retype it on every order.`,defaultBillingAddress:`Where you send this customer's invoices.`,status:`Whether this is a current customer, for example active or inactive.`,customerType:`The kind of customer, for example an individual or a business.`,notes:`Anything worth remembering about this customer.`},"@happyvertical/smrt-commerce:Vendor":{profileId:`Links this vendor to their profile record, where their name and contact details are kept.`,leadTimeDays:`How many days the vendor usually takes between your order and delivery.`,minimumOrderAmount:`The smallest order the vendor will accept.`,paymentTerms:`How long you have to pay this vendor, written the way you would say it, for example "Net 30".`,currency:`The currency this vendor bills you in.`,defaultContactEmail:`The email address you normally use to reach this vendor.`,defaultContactPhone:`The phone number you normally use to reach this vendor.`,status:`Whether you still buy from this vendor, for example active or inactive.`,notes:`Anything worth remembering about this vendor.`,payoutAddresses:`Where payments to this vendor should be sent.`},"@happyvertical/smrt-commerce:Order":{status:`Where the order stands, for example draft, accepted or completed.`,customerId:`The customer this order is for.`,subtotal:`The order amount before tax.`,taxAmount:`The tax charged on the order.`,totalAmount:`What the customer pays in all, tax included.`,currency:`The currency of the order's amounts.`,issueDate:`The date the order was placed.`,dueDate:`The date payment is expected. An order still open after this date counts as overdue.`,expiryDate:`The last day the order's price or offer is good for.`,reference:`Your own number or note for finding this order later, such as the customer's purchase order number.`,notes:`Anything worth remembering about this order.`,terms:`The conditions agreed with the customer, such as deposits, delivery or payment conditions.`,channelId:`Where the order came from, for example your shop or a marketplace.`},"@happyvertical/smrt-commerce:PurchaseOrder":{status:`Where the purchase stands, for example draft, accepted or completed.`,vendorId:`The vendor you are buying from.`,subtotal:`The order amount before tax.`,taxAmount:`The tax charged on the order.`,totalAmount:`What you pay in all, tax included.`,currency:`The currency of the order's amounts.`,issueDate:`The date you placed the order.`,dueDate:`The date the goods or the payment are due.`,expiryDate:`The last day the vendor's offer is good for.`,reference:`Your own number or note for finding this order later, such as the vendor's quote number.`,notes:`Anything worth remembering about this purchase.`,terms:`The conditions agreed with the vendor, such as payment or delivery conditions.`,channelId:`Where the order was placed, for example a vendor's website or a phone call.`},"@happyvertical/smrt-products:Product":{name:`What you call the product, as customers will see it.`,price:`What one costs, in dollars and cents.`,description:`A few words on what the product is and who it is for.`},"@happyvertical/smrt-products:ProductVariant":{productId:`The product this choice belongs to. Set for you when you save the product.`,axisName:`What the product varies by, for example size or color.`,allowedValues:`The values on offer for it, for example S, M and L.`},"@happyvertical/smrt-products:Sku":{productId:`The product this item is a version of. Set for you when you save the product.`,code:`The short code that identifies this exact size and color. Made for you from the product name.`,attributes:`Which size and color this item is. Set for you from the grid.`},"@happyvertical/smrt-inventory:StockLevel":{skuId:`The item being counted. Set for you when you save the product.`,locationId:`Where it is kept. New stock goes to the main warehouse.`,state:`Whether the count is available to sell. New stock starts as available.`,qty:`How many you have on hand.`},"@happyvertical/smrt-inventory:InventoryLocation":{code:`A short code for the place stock is kept, for example MAIN.`,name:`What you call the place, for example Main warehouse.`,kind:`What sort of place it is, for example a warehouse or a shop floor.`},"@happyvertical/smrt-commerce:Estimate":{status:`Where the estimate stands, for example draft, sent, accepted or completed.`,customerId:`The customer this estimate is for.`,subtotal:`The estimate amount before tax.`,taxAmount:`The tax charged on the estimate.`,totalAmount:`What the customer pays in all, tax included.`,currency:`The currency of the estimate's amounts.`,issueDate:`The date the estimate was issued or starts.`,dueDate:`The date payment is expected.`,expiryDate:`The last day the estimate is good for, or the day it ends.`,reference:`Your own number or note for finding this estimate later.`,notes:`Anything worth remembering about this estimate.`,terms:`The conditions agreed with the customer, such as deposits, delivery or payment conditions.`,channelId:`Where the estimate came from, for example your shop or a marketplace.`},"@happyvertical/smrt-commerce:WholesaleOrder":{status:`Where the wholesale order stands, for example draft, sent, accepted or completed.`,customerId:`The customer this wholesale order is for.`,subtotal:`The wholesale order amount before tax.`,taxAmount:`The tax charged on the wholesale order.`,totalAmount:`What the customer pays in all, tax included.`,currency:`The currency of the wholesale order's amounts.`,issueDate:`The date the wholesale order was issued or starts.`,dueDate:`The date payment is expected.`,expiryDate:`The last day the wholesale order is good for, or the day it ends.`,reference:`Your own number or note for finding this wholesale order later.`,notes:`Anything worth remembering about this wholesale order.`,terms:`The conditions agreed with the customer, such as deposits, delivery or payment conditions.`,channelId:`Where the wholesale order came from, for example your shop or a marketplace.`},"@happyvertical/smrt-commerce:Agreement":{status:`Where the agreement stands, for example draft, sent, accepted or completed.`,customerId:`The customer this agreement is for.`,subtotal:`The agreement amount before tax.`,taxAmount:`The tax charged on the agreement.`,totalAmount:`What the customer pays in all, tax included.`,currency:`The currency of the agreement's amounts.`,issueDate:`The date the agreement was issued or starts.`,dueDate:`The date payment is expected.`,expiryDate:`The last day the agreement is good for, or the day it ends.`,reference:`Your own number or note for finding this agreement later.`,notes:`Anything worth remembering about this agreement.`,terms:`The conditions agreed with the customer, such as deposits, delivery or payment conditions.`,channelId:`Where the agreement came from, for example your shop or a marketplace.`},"@happyvertical/smrt-commerce:Lease":{status:`Where the lease stands, for example draft, sent, accepted or completed.`,customerId:`The customer this lease is for.`,subtotal:`The lease amount before tax.`,taxAmount:`The tax charged on the lease.`,totalAmount:`What the customer pays in all, tax included.`,currency:`The currency of the lease's amounts.`,issueDate:`The date the lease was issued or starts.`,dueDate:`The date payment is expected.`,expiryDate:`The last day the lease is good for, or the day it ends.`,reference:`Your own number or note for finding this lease later.`,notes:`Anything worth remembering about this lease.`,terms:`The conditions agreed with the customer, such as deposits, delivery or payment conditions.`,channelId:`Where the lease came from, for example your shop or a marketplace.`},"@happyvertical/smrt-commerce:LicenseSale":{status:`Where the licence sale stands, for example draft, sent, accepted or completed.`,customerId:`The customer this licence sale is for.`,subtotal:`The licence sale amount before tax.`,taxAmount:`The tax charged on the licence sale.`,totalAmount:`What the customer pays in all, tax included.`,currency:`The currency of the licence sale's amounts.`,issueDate:`The date the licence sale was issued or starts.`,dueDate:`The date payment is expected.`,expiryDate:`The last day the licence sale is good for, or the day it ends.`,reference:`Your own number or note for finding this licence sale later.`,notes:`Anything worth remembering about this licence sale.`,terms:`The conditions agreed with the customer, such as deposits, delivery or payment conditions.`,channelId:`Where the licence sale came from, for example your shop or a marketplace.`},"@happyvertical/smrt-commerce:Contract":{status:`Where the contract stands, for example draft, sent, accepted or completed.`,subtotal:`The contract amount before tax.`,taxAmount:`The tax charged on the contract.`,totalAmount:`What the customer pays in all, tax included.`,currency:`The currency of the contract's amounts.`,issueDate:`The date the contract was issued or starts.`,dueDate:`The date payment is expected.`,expiryDate:`The last day the contract is good for, or the day it ends.`,reference:`Your own number or note for finding this contract later.`,notes:`Anything worth remembering about this contract.`,terms:`The conditions agreed with the customer, such as deposits, delivery or payment conditions.`,channelId:`Where the contract came from, for example your shop or a marketplace.`,contractType:`The kind of contract: order, estimate, lease, agreement and so on.`},"@happyvertical/smrt-commerce:ContractLineItem":{contractId:`The order, quote or agreement this line belongs to.`,description:`What is being sold or bought on this line.`,quantity:`How many.`,unitPrice:`The price of one, before tax.`,taxRate:`The tax rate for this line, as a percentage (5 means 5%).`,amount:`The line total.`,productId:`The product this line is for, if it is one you list.`},"@happyvertical/smrt-inventory:StockMovement":{skuId:`The item that moved.`,locationId:`The place it moved at.`,fromState:`What it was before, for example available or damaged.`,toState:`What it became.`,qty:`How many moved.`,reasonCode:`Why it moved, for example adjustment, sale or return.`,note:`Anything worth remembering about this movement.`,occurredAt:`When it happened.`},"@happyvertical/smrt-commerce:Invoice":{customerId:`The customer being billed.`,contractId:`The order or agreement this invoice bills for, if any.`,invoiceNumber:`The number printed on the invoice.`,issueDate:`The date the invoice was issued.`,dueDate:`The date payment is expected.`,paidDate:`The date it was paid in full.`,subtotal:`The amount before tax.`,taxAmount:`The tax charged.`,totalAmount:`What the customer owes in all, tax included.`,amountPaid:`How much of the total has been paid so far.`,currency:`The currency of the invoice.`,status:`Where the invoice stands: draft, sent, viewed, paid, overdue or cancelled.`,notes:`Private notes, not shown to the customer.`,customerNotes:`A message shown to the customer on the invoice.`,terms:`The payment conditions, such as Net 30.`},"@happyvertical/smrt-commerce:InvoiceLineItem":{invoiceId:`The invoice this line belongs to.`,description:`What is being billed on this line.`,quantity:`How many.`,unitPrice:`The price of one, before tax.`,taxRate:`The tax rate for this line, as a percentage (5 means 5%).`,amount:`The line total.`},"@happyvertical/smrt-commerce:Payment":{contractId:`The order or agreement this payment is for, if any.`,customerId:`The customer who paid.`,amount:`How much was paid.`,currency:`The currency of the payment.`,method:`How it was paid: cash, check, card, bank transfer or other.`,status:`Whether the payment is pending, completed, failed or refunded.`,reference:`Your own note, such as a check number.`,paidAt:`When the money was received.`,notes:`Anything worth remembering about this payment.`},"@happyvertical/smrt-commerce:PaymentAllocation":{paymentId:`The payment being applied.`,invoiceId:`The invoice it settles.`,amount:`How much of the payment goes to this invoice.`,allocatedAt:`When it was applied.`,notes:`Anything worth remembering about this allocation.`},"@happyvertical/smrt-commerce:Fulfillment":{contractId:`The order being fulfilled.`,fulfillmentType:`How it gets to the customer: shipment, delivery, pickup, digital or service.`,status:`Where it stands: pending, processing, shipped, delivered or cancelled.`,trackingNumber:`The carrier's tracking number.`,carrier:`The company carrying it.`,shippedAt:`When it left you.`,deliveredAt:`When it arrived.`,notes:`Anything worth remembering about this shipment.`},"@happyvertical/smrt-commerce:FulfillmentLineItem":{fulfillmentId:`The shipment this line belongs to.`,contractLineItemId:`The order line being sent.`,quantityFulfilled:`How many of that line are in this shipment.`},"@happyvertical/smrt-ledgers:Account":{number:`The account number in your chart of accounts.`,name:`What the account is called.`,description:`What the account is used for.`,type:`asset, liability, equity, revenue or expense.`,active:`Turn this off to stop using the account without deleting it.`},"@happyvertical/smrt-ledgers:Journal":{number:`The journal's reference number.`,date:`The date of the transaction.`,description:`What the transaction was.`,status:`draft while you work on it, posted once final, or voided.`,postedAt:`When it was posted.`},"@happyvertical/smrt-ledgers:JournalEntry":{journalId:`The journal this entry belongs to.`,accountId:`The account this entry changes.`,debit:`The amount debited. Leave zero on a credit.`,credit:`The amount credited. Leave zero on a debit.`,currency:`The currency of the amounts.`,memo:`A note on this entry.`},"@happyvertical/smrt-projects:Project":{title:`The project's name.`,description:`What the project is about.`,owner:`Who owns or runs the project.`,url:`A link to the project elsewhere.`},"@happyvertical/smrt-projects:Issue":{projectId:`The project this issue belongs to.`,title:`A short summary of the issue.`,body:`The full description.`,state:`open or closed.`,author:`Who raised the issue.`,labels:`The labels attached to the issue.`,assignees:`The people working on it.`},"@happyvertical/smrt-projects:Label":{projectId:`The project this label belongs to.`,name:`The label's name, for example bug.`,color:`The label's colour.`,description:`What the label means.`},"@happyvertical/smrt-projects:Comment":{issueId:`The issue this comment is on.`,body:`The comment text.`,author:`Who wrote it.`},"@happyvertical/smrt-events:Event":{name:`What the event is called.`,seriesId:`The series this event is part of, if any.`,typeId:`The kind of event.`,placeId:`Where it takes place.`,description:`What the event is about.`,startDate:`When it starts.`,endDate:`When it ends.`,allDay:`Turn this on for an event that lasts all day.`,status:`scheduled, in progress, completed, cancelled or postponed.`},"@happyvertical/smrt-events:EventType":{name:`What this kind of event is called, for example workshop.`,description:`What this kind of event is for.`},"@happyvertical/smrt-events:EventSeries":{name:`What the series is called.`,typeId:`The kind of event in this series.`,organizerId:`Who runs the series.`,description:`What the series is about.`,startDate:`When the series begins.`,endDate:`When the series ends.`,recurrence:`How often it repeats.`},"@happyvertical/smrt-events:EventParticipant":{eventId:`The event the person takes part in.`,profileId:`The person taking part.`,role:`What they do there, for example speaker or attendee.`},"@happyvertical/smrt-sales:Lead":{name:`What you call this lead.`,contactName:`The person to talk to.`,email:`Their email address.`,phone:`Their phone number.`,organizationName:`The company they are with.`,ownerRepId:`The sales representative who owns this lead.`,status:`Where the lead stands, for example new or qualified.`},"@happyvertical/smrt-sales:Opportunity":{name:`What you call this deal.`,leadId:`The lead it came from.`,ownerRepId:`The sales representative who owns this deal.`,pipelineId:`The pipeline it moves through.`,stageId:`The stage it is at now.`,expectedValueCents:`What you expect the deal to be worth, in cents.`,currency:`The currency of that value.`,probability:`How likely it is to close, as a decimal (0.5 is 50%).`,expectedCloseAt:`When you expect it to close.`,status:`open, won or lost.`},"@happyvertical/smrt-sales:PipelineDefinition":{key:`A short code for the pipeline.`,name:`What the pipeline is called.`,isDefault:`Turn this on to use it for new deals.`,status:`Whether the pipeline is in use.`,metadata:`Extra details kept with the pipeline.`},"@happyvertical/smrt-sales:PipelineStage":{pipelineId:`The pipeline this stage belongs to.`,key:`A short code for the stage.`,name:`What the stage is called.`,sortOrder:`Where it comes in the pipeline.`,probability:`How likely a deal at this stage is to close, as a decimal.`,isWon:`Turn this on for the stage that means the deal is won.`,isLost:`Turn this on for the stage that means the deal is lost.`},"@happyvertical/smrt-sales:SalesActivity":{subjectKind:`What the activity is about: a lead or an opportunity.`,subjectId:`The lead or opportunity it is about.`,activityKind:`The kind of activity, for example call, note or email.`,summary:`What happened or what needs doing.`,dueAt:`When it is due.`,completedAt:`When it was done.`}};function ct(e,t){let n=new Map(e.map(e=>[e.id,e])),r=[...Object.keys(t.recipes),...t.order].filter(e=>!n.has(e));if(r.length>0)throw Error(`Recipes only declared locally, not in a smrt package: ${[...new Set(r)].join(`, `)}`);let i=[...t.order,...e.map(e=>e.id).filter(e=>!t.order.includes(e))];return[...new Set(i)].map(e=>{let r=n.get(e),i=t.recipes[e];return i?{...r,...i}:r})}var lt={order:[`commerce.customers`,`commerce.purchases`,`commerce.sales`,`commerce.vendors`,`inventory.stock`,`products.simple`,`products.clothing`,`products.ingredients`,`commerce.estimates`,`commerce.wholesale`,`commerce.invoicing`,`commerce.fulfillment`,`commerce.agreements`,`commerce.leases`,`commerce.licenses`,`ledgers.bookkeeping`,`projects.tracker`,`events.calendar`,`sales.pipeline`],recipes:{"commerce.customers":{forms:[{id:`customer.default`,kind:`field-map`,label:`Customer`,kindLabel:`Customer`,model:`@happyvertical/smrt-commerce:Customer`,records:[{as:`profileType`,model:`@happyvertical/smrt-profiles:ProfileType`,match:{name:`Customer`}},{as:`profile`,model:`@happyvertical/smrt-profiles:Profile`,match:{id:{ref:`customer`,field:`profileId`}},values:{typeId:{ref:`profileType`}}},{as:`customer`,model:`@happyvertical/smrt-commerce:Customer`,values:{profileId:{ref:`profile`}}}],fields:[{id:`name`,label:`Name`,to:`profile.name`,required:!0},{id:`email`,label:`Email`,to:`profile.email`},{id:`status`,label:`Status`,to:`customer.status`,default:`active`},{id:`customerType`,label:`Customer type`,to:`customer.customerType`,default:`dtc`},{id:`paymentTerms`,label:`Payment terms`,to:`customer.paymentTerms`},{id:`creditLimit`,label:`Credit limit`,to:`customer.creditLimit`},{id:`taxExempt`,label:`Tax exempt`,to:`customer.taxExempt`},{id:`taxId`,label:`Tax ID`,to:`customer.taxId`},{id:`shippingAddress`,label:`Shipping address`,to:`customer.defaultShippingAddress`},{id:`billingAddress`,label:`Billing address`,to:`customer.defaultBillingAddress`},{id:`notes`,label:`Notes`,to:`customer.notes`}]}]},"commerce.vendors":{forms:[{id:`vendor.default`,kind:`field-map`,label:`Vendor`,kindLabel:`Vendor`,model:`@happyvertical/smrt-commerce:Vendor`,records:[{as:`profileType`,model:`@happyvertical/smrt-profiles:ProfileType`,match:{name:`Vendor`}},{as:`profile`,model:`@happyvertical/smrt-profiles:Profile`,match:{id:{ref:`vendor`,field:`profileId`}},values:{typeId:{ref:`profileType`}}},{as:`vendor`,model:`@happyvertical/smrt-commerce:Vendor`,values:{profileId:{ref:`profile`}}}],fields:[{id:`name`,label:`Name`,to:`profile.name`,required:!0},{id:`email`,label:`Email`,to:`profile.email`},{id:`status`,label:`Status`,to:`vendor.status`,default:`active`},{id:`currency`,label:`Currency`,to:`vendor.currency`,default:`USD`},{id:`paymentTerms`,label:`Payment terms`,to:`vendor.paymentTerms`},{id:`leadTimeDays`,label:`Lead time (days)`,to:`vendor.leadTimeDays`},{id:`minimumOrderAmount`,label:`Minimum order`,to:`vendor.minimumOrderAmount`},{id:`contactEmail`,label:`Contact email`,to:`vendor.defaultContactEmail`},{id:`contactPhone`,label:`Contact phone`,to:`vendor.defaultContactPhone`},{id:`notes`,label:`Notes`,to:`vendor.notes`},{id:`payoutAddresses`,label:`Payout addresses`,to:`vendor.payoutAddresses`}]}]},"inventory.stock":{extends:[{form:`product.simple`,records:[{as:`sku`,model:`@happyvertical/smrt-products:Sku`,match:{productId:{ref:`product`}},values:{code:`{product.name|slug}`,name:`{product.name}`,attributes:`{}`,active:!0}},{as:`location`,model:`@happyvertical/smrt-inventory:InventoryLocation`,match:{code:`MAIN`},values:{name:`Main warehouse`,kind:`warehouse`}},{as:`stock`,model:`@happyvertical/smrt-inventory:StockLevel`,match:{skuId:{ref:`sku`},locationId:{ref:`location`},state:`available`}}],fields:[{id:`quantity`,label:`Quantity`,to:`stock.qty`,default:0}]},{form:`product.clothing`,records:[{as:`location`,model:`@happyvertical/smrt-inventory:InventoryLocation`,match:{code:`MAIN`},values:{name:`Main warehouse`,kind:`warehouse`}},{as:`stock`,model:`@happyvertical/smrt-inventory:StockLevel`,match:{skuId:{ref:`sku`},locationId:{ref:`location`},state:`available`}}],fields:[{id:`quantity`,label:`Quantity`,to:`stock.qty`,default:0}]}]},"products.simple":{forms:[{id:`product.simple`,kind:`field-map`,label:`Simple product`,kindLabel:`Simple`,model:`@happyvertical/smrt-products:Product`,records:[{as:`product`,model:`@happyvertical/smrt-products:Product`}],fields:[{id:`name`,label:`Name`,to:`product.name`,required:!0},{id:`price`,label:`Price`,to:`product.price`},{id:`description`,label:`Description`,to:`product.description`}]}]},"products.clothing":{forms:[{id:`product.clothing`,kind:`variant-grid`,label:`Clothing item`,kindLabel:`Clothing`,model:`@happyvertical/smrt-products:Product`,product:{as:`product`,model:`@happyvertical/smrt-products:Product`},fields:[{id:`name`,label:`Name`,to:`product.name`,required:!0},{id:`price`,label:`Price`,to:`product.price`}],axes:[{name:`size`,label:`Sizes`,values:[`XS`,`S`,`M`,`L`,`XL`]},{name:`color`,label:`Colors`,values:[]}],variants:`@happyvertical/smrt-products:ProductVariant`,skus:`@happyvertical/smrt-products:Sku`}]}}};function ut(e){return e.fields.filter(e=>!e.system)}var dt=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1_$2`).toLowerCase();function ft(e,t){return/Type$/.test(t.name)&&Array.isArray(t.enum)&&t.enum.length>0&&!!e.extends&&t.enum.includes(dt(e.name))}function pt(e){return e.some(e=>e.ui?.basic===!0)}function mt(e){return e!=null&&e!==``}function ht(e){if(e==null)return null;try{return{value:JSON.parse(e)}}catch{return null}}function K(e,t,n=[]){let r=ut(e),i=pt(r),a=new Map(n.filter(t=>t.objectRef===e.id).map(e=>[e.fieldName,e]));return r.map((n,r)=>{let o=t?.fields?.[n.name]??{},s=ft(e,n),c=o.visibility??(s?`hidden`:!i||n.ui?.basic===!0?`basic`:`advanced`),l=o.label??M(n),u=o.help??null,d=o.order??n.ui?.order??r,f=o.locked??n.ui?.locked??s,p=dt(e.name),m=n.default===void 0?s&&n.enum?.includes(p)?p:void 0:n.default,h=`default`in o||m!==void 0,g=`default`in o?o.default:m,_=a.get(n.name);if(_&&(!f||_.locked===!1)){_.visibility&&(c=_.visibility),_.label&&(l=_.label),_.help!==void 0&&(u=_.help||null),typeof _.displayOrder==`number`&&(d=_.displayOrder);let e=ht(_.defaultValue);e&&(h=!0,g=e.value),typeof _.locked==`boolean`&&(f=_.locked)}let v,y=o.required??n.required;return y&&c!==`basic`&&!(h&&mt(g))&&(c=`basic`,v=!0),{field:n,visibility:c,label:l,help:u,order:d,group:n.ui?.group??null,locked:f,required:y,hasDefault:h,default:g,...v?{visibilityForced:v}:{}}}).map((e,t)=>({entry:e,index:t})).sort((e,t)=>e.entry.order-t.entry.order||e.index-t.index).map(({entry:e})=>e)}function gt(e){return typeof e==`string`||typeof e==`number`||typeof e==`boolean`||e===null?e:void 0}function _t(e){return e.filter(e=>e.visibility===`basic`).map(e=>{let{default:t,...n}=e.field,r=e.hasDefault?gt(e.default):void 0;return{...n,required:e.required,...r===void 0?{}:{default:r},label:e.label,...e.help?{help:e.help}:{}}})}function vt(e){let t={};for(let n of e)n.visibility!==`basic`&&n.hasDefault&&n.default!==void 0&&(t[n.field.name]=n.default);return t}var yt=[`api`,`mcp`,`cli`],bt={api:`REST`,mcp:`MCP`,cli:`CLI`};function xt(e,t){return(t===`api`?e.rest.length:t===`mcp`?e.mcp.length:e.cli.length)>0}function q(e,t,n=[]){let r={};for(let i of yt){let a=xt(e,i),o=t?.exposure?.[i]===!1;r[i]={available:a,on:a&&!o&&!n.includes(i),locked:!a||o}}return r}function St(e,t){let n=t.mcp.on;return{...e,rest:t.api.on?e.rest:[],mcp:n?e.mcp:[],cli:t.cli.on?e.cli:[],methods:e.methods.map(e=>({...e,aiCallable:e.aiCallable&&n}))}}function Ct(e,t,n=[]){return K(e,t,n).filter(e=>t?.fields?.[e.field.name]?.visibility!==`hidden`)}function wt(e){return e.required||e.locked}function Tt(e,t,n,r){let i={};for(let r of Ct(e,t,n))i[r.field.name]={use:r.visibility===`basic`,label:r.label,help:r.help??``,default:r.hasDefault?r.default:null,order:r.order};let a=q(e,t,r);return{fields:i,exposure:{api:a.api.on,mcp:a.mcp.on,cli:a.cli.on}}}var Et=(e,t)=>JSON.stringify(e??null)===JSON.stringify(t??null);function Dt(e,t,n){let r=Ct(e,t),i=[];for(let t of r){let r=n.fields[t.field.name];if(!r||t.locked)continue;let a={objectRef:e.id,fieldName:t.field.name,scopeType:`app`},o=wt(t)?!0:r.use;o!==(t.visibility===`basic`)&&(a.visibility=o?`basic`:`hidden`),r.label.trim()&&r.label!==t.label&&(a.label=r.label.trim()),r.help!==(t.help??``)&&(a.help=r.help||null),Et(r.default,t.hasDefault?t.default:null)||(a.defaultValue=JSON.stringify(r.default??null)),r.order!==t.order&&(a.displayOrder=r.order),Object.keys(a).length>3&&i.push(a)}return i}function Ot(e,t,n){let r=q(e,t);return yt.filter(e=>r[e].on&&!n.exposure[e])}var kt=st,J=ct(ie.packages.flatMap(e=>e.recipes??[]),lt),At=new Map(J.map(e=>[e.id,e]));function jt(e){return At.get(e)}var Y=At,Mt=Ke(J);function Nt(e){return Mt.find(t=>t.id===e)}function Pt(e){let t=e.models[0];return t?A(t)?.pkg:void 0}function Ft(e){return e.nav.flatMap(e=>{let t=A(e.model);return t?[{label:e.label,icon:e.icon??`fileText`,description:Xe(e.description,t.model),...e.key?{key:e.key}:{},...e.noun?{noun:e.noun}:{},...e.filter?{filter:e.filter}:{},model:t.model,packageId:t.pkg.id}]:[]})}function It(e,t,n){return J.some(r=>Ft(r).some(r=>r.key===n&&r.packageId===e&&r.model.name===t))}function Lt(e){return`/m/${e.packageId}/${e.model.name}/${e.key?`${e.key}/`:``}`}function Rt(e){return e.models.flatMap(e=>{let t=A(e);return t?[{model:t.model,packageId:t.pkg.id}]:[]})}function zt(e,t=[]){let n=e.nav.length>0;return Rt(e).map(({model:r})=>({id:r.id,name:r.name,...n?{}:{glossary:!1},descriptions:{...Object.fromEntries(r.fields.flatMap(e=>e.description?[[e.name,e.description]]:[])),...kt[r.id]},fields:K(r,e.options?.[r.id],t).map(e=>({name:e.field.name,label:e.label,help:e.help,visibility:e.visibility}))}))}function Bt(e){return[...new Set(e)].sort()}function X(e,t){let n=new Set,r=e=>{let i=t.get(e);if(i&&!n.has(e)){n.add(e);for(let e of i.requires)r(e)}};for(let t of e)r(t);let i=!0;for(;i;){i=!1;for(let e of[...n])for(let a of t.get(e)?.requiresAny??[]){if(a.some(e=>n.has(e)))continue;let e=a.find(e=>t.has(e));e&&(r(e),i=!0)}}return Bt(n)}function Vt(e,t,n){let r=new Set(e),i=t.filter(e=>!r.has(e)),a=new Set(i);return i.filter(e=>{let t=n.get(e);return t?t.requires.some(e=>r.has(e))?!0:(t.requiresAny??[]).some(e=>e.some(e=>r.has(e))&&!e.some(e=>a.has(e))):!1})}function Ht(e,t,n){return Vt([e],t,n)}function Ut(e,t){return Bt([...e].filter(e=>t.has(e)))}var Wt={currency:`USD`,taxRate:0,paymentTerms:``,pricesIncludeTax:!1,taxRounding:`line`},Z=`@happyvertical/smrt-commerce:`,Q={currency:[`Order`,`PurchaseOrder`,`WholesaleOrder`,`Estimate`,`Invoice`,`Agreement`,`Lease`].map(e=>({model:`${Z}${e}`,field:`currency`})),taxRate:[`InvoiceLineItem`,`ContractLineItem`].map(e=>({model:`${Z}${e}`,field:`taxRate`})),paymentTerms:[...[`Order`,`WholesaleOrder`,`Estimate`,`Invoice`,`Agreement`,`Lease`].map(e=>({model:`${Z}${e}`,field:`terms`})),{model:`${Z}Customer`,field:`paymentTerms`}],pricesIncludeTax:[`Invoice`,`Contract`].map(e=>({model:`${Z}${e}`,field:`lineAmountType`})),taxRounding:[`Invoice`,`Contract`].map(e=>({model:`${Z}${e}`,field:`taxRoundingScope`}))};function Gt(e){return Object.values(Q).some(t=>t.some(t=>t.model===e.objectRef&&t.field===e.fieldName))}var Kt=Object.keys(Q);function qt(e){if(e?.defaultValue!==void 0&&e.defaultValue!==null)try{return JSON.parse(e.defaultValue)}catch{return}}function Jt(e,t,n){return e.find(e=>e.scopeType===`app`&&e.objectRef===t&&e.fieldName===n)}function Yt(e){let t={...Wt},n=(t,n)=>{for(let{model:r,field:i}of Q[t]){let t=qt(Jt(e.policies,r,i));if(typeof t===n)return t}},r=n(`currency`,`string`),i=n(`taxRate`,`number`),a=n(`paymentTerms`,`string`),o=n(`pricesIncludeTax`,`string`),s=n(`taxRounding`,`string`);return typeof r==`string`&&(t.currency=r),typeof i==`number`&&(t.taxRate=i),typeof a==`string`&&(t.paymentTerms=a),(o===`inclusive`||o===`exclusive`)&&(t.pricesIncludeTax=o===`inclusive`),(s===`line`||s===`document`)&&(t.taxRounding=s),t}function Xt(e){return Q.taxRate.some(({model:t,field:n})=>typeof qt(Jt(e.policies,t,n))==`number`)}function Zt(e,t,n){let r=A(t)?.model;if(!r)return;let i=K(r,e.recipes.map(e=>Y.get(e)?.options?.[t]).find(Boolean),[]).find(e=>e.field.name===n);return i?.hasDefault?i.default:void 0}var Qt=e=>e==null||e===``;function $t(e,t){let n=e.policies.map(e=>({...e}));for(let r of Kt){let i=t[r],a=r===`paymentTerms`?String(i).trim():r===`currency`?String(i).trim().toUpperCase():r===`pricesIncludeTax`?i?`inclusive`:`exclusive`:i;for(let{model:t,field:i}of Q[r]){let o=Zt(e,t,i),s=!Qt(a)&&!(!Qt(o)&&o===a)&&!(Qt(o)&&r===`taxRate`&&a===0),c=Jt(n,t,i);if(s){let e=JSON.stringify(a);c?c.defaultValue=e:n.push({objectRef:t,fieldName:i,scopeType:`app`,defaultValue:e})}else c&&(delete c.defaultValue,Object.keys(c).length<=3&&(n=n.filter(e=>e!==c)))}}return{...e,policies:n}}function en(e){return{...Wt,...e}}var tn=()=>({ids:[],rows:[],narrowed:{},features:[],unavailableRecipes:[],unavailableFeatures:[]});function $(e){let t=new Set([...e.ids.flatMap(e=>Y.get(e)?.models??[]),...e.features]);return{...e,rows:e.rows.filter(e=>t.has(e.objectRef)||Gt(e)),narrowed:Object.fromEntries(Object.entries(e.narrowed).filter(([e])=>t.has(e)))}}var nn=(e,t)=>({...e,ids:X([...e.ids,...t],Y)});function rn(e,t){let n=new Set(t),r=e.ids.filter(e=>!n.has(e));return $({...e,ids:X(r,Y)})}var an=(e,t)=>e.features.includes(t)?e:{...e,features:[...e.features,t].sort()},on=(e,t)=>$({...e,features:e.features.filter(e=>e!==t)}),sn=(e,t)=>Ht(t,e.ids,Y);function cn(e,t){for(let n of e.ids){let e=Y.get(n)?.options?.[t];if(e)return e}}function ln(e,t,n,r){let i={...e.narrowed};return r.length?i[t]=[...r]:delete i[t],{...e,rows:[...e.rows.filter(e=>e.objectRef!==t),...n],narrowed:i}}function un(e){let t=[...e.rows].sort((e,t)=>e.objectRef.localeCompare(t.objectRef)||e.fieldName.localeCompare(t.fieldName)),n=Object.fromEntries(Object.keys(e.narrowed).sort().filter(t=>e.narrowed[t].length).map(t=>[t,[...e.narrowed[t]].sort()])),r={recipes:[...e.ids,...e.unavailableRecipes].sort(),features:[...e.features,...e.unavailableFeatures].sort(),policies:t.map(e=>({...e}))};return Object.keys(n).length&&(r.exposure=n),r}function dn(e){let t=[...new Set(e.features)],n=e=>!!A(e)?.model.exposed;return $({ids:X(e.recipes,Y),rows:e.policies.map(e=>({...e})),narrowed:Object.fromEntries(Object.entries(e.exposure??{}).map(([e,t])=>[e,[...t]])),features:t.filter(n).sort(),unavailableRecipes:[...new Set(e.recipes.filter(e=>!Y.has(e)))].sort(),unavailableFeatures:t.filter(e=>!n(e)).sort()})}var fn=new class{#e=b(C([]));get ids(){return e(this.#e)}set ids(e){k(this.#e,e,!0)}#t=b(C([]));get rows(){return e(this.#t)}set rows(e){k(this.#t,e,!0)}#n=b(C({}));get narrowed(){return e(this.#n)}set narrowed(e){k(this.#n,e,!0)}#r=b(C([]));get features(){return e(this.#r)}set features(e){k(this.#r,e,!0)}#i=b(C([]));get unavailableRecipes(){return e(this.#i)}set unavailableRecipes(e){k(this.#i,e,!0)}#a=b(C([]));get unavailableFeatures(){return e(this.#a)}set unavailableFeatures(e){k(this.#a,e,!0)}get data(){return{ids:this.ids,rows:this.rows,narrowed:this.narrowed,features:this.features,unavailableRecipes:this.unavailableRecipes,unavailableFeatures:this.unavailableFeatures}}set(e){this.ids=e.ids,this.rows=e.rows,this.narrowed=e.narrowed,this.features=e.features,this.unavailableRecipes=e.unavailableRecipes,this.unavailableFeatures=e.unavailableFeatures}removeUnavailable(){this.unavailableRecipes=[],this.unavailableFeatures=[]}hasFeature(e){return this.features.includes(e)}addFeature(e){this.set(an(this.data,e))}removeFeature(e){this.set(on(this.data,e))}has(e){return this.ids.includes(e)}requiredBy(e){return sn(this.data,e)}add(...e){this.set(nn(this.data,e))}remove(...e){this.set(rn(this.data,e))}toggle(e){this.has(e)?this.remove(e):this.add(e)}clear(){this.set(tn())}hintsFor(e){return cn(this,e)}apply(e){let t=this.hintsFor(e.id),n=K(e,t,this.rows);return{model:St(e,q(e,t,this.narrowed[e.id]??[])),resolved:n,fields:_t(n),background:vt(n)}}save(e,t,n){this.set(ln(this.data,e,t,n))}reset(e){this.save(e,[],[])}snapshot(){return un(this.data)}load(e){this.set(dn(e))}};export{he as $,Dt as A,Ye as B,yt as C,wt as D,Ct as E,nt as F,Ve as G,W as H,at as I,Ge as J,He as K,rt as L,tt as M,ot as N,Ot as O,it as P,De as Q,qe as R,Mt as S,Tt as T,ze as U,G as V,Ue as W,Be as X,We as Y,ke as Z,Rt as _,Gt as a,J as b,$t as c,X as d,R as et,jt as f,Lt as g,zt as h,Xt as i,Qe as j,q as k,Ut as l,It as m,un as n,Yt as o,Nt as p,Fe as q,Q as r,en as s,fn as t,Vt as u,Ft as v,bt as w,Y as x,Pt as y,Je as z};
|
|
1
|
+
import{$ as e,B as t,Ct as n,Dt as r,E as i,Et as a,F as o,Ft as s,G as c,H as l,K as u,L as d,Lt as f,Ot as p,Pt as m,U as h,W as g,X as _,Y as v,a as y,bt as b,ct as ee,d as x,ft as S,gt as C,ht as w,k as te,mt as T,pt as E,q as ne,st as D,v as O,vt as k}from"./DG3qFFTE.js";import"./xihTtKlq.js";import{a as re}from"./Bv5jGtB8.js";import"./YUSKx8_q.js";import{ft as A,lt as ie,p as j,u as M,ut as N}from"./BG9Gz_25.js";import"./DK8Blf1Y.js";import"./M-CuJzQN.js";import"./Cga8zF3r.js";v([`click`]),v([`click`,`keydown`]),v([`click`]);var P=new Map(Object.entries({menu:`M3 18h18v-2H3v2zm0-5h18v-2H3v2zm0-7v2h18V6H3z`,search:`M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z`,close:`M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z`,"chevron-right":`M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6-6-6z`,"chevron-left":`M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12l4.58-4.59z`,"chevron-down":`M7.41 8.59L12 13.17l4.59-4.58L18 10l-6 6-6-6 1.41-1.41z`,check:`M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41L9 16.17z`,add:`M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z`,mic:`M12 14c1.66 0 3-1.34 3-3V5c0-1.66-1.34-3-3-3S9 3.34 9 5v6c0 1.66 1.34 3 3 3z M17 11c0 2.76-2.24 5-5 5s-5-2.24-5-5H5c0 3.53 2.04 6.43 5 7.07V21h4v-2.93c2.96-.64 5-3.54 5-7.07h-2z`,alert:`M12 2a10 10 0 1 0 0 20 10 10 0 0 0 0-20zm-1 5h2v6h-2zm0 8h2v2h-2z`,warning:`M1 21h22L12 2 1 21zm12-3h-2v-2h2zm0-4h-2v-4h2z`,info:`M12 2a10 10 0 1 0 0 20 10 10 0 0 0 0-20zm1 15h-2v-6h2zm0-8h-2V7h2z`,home:`M3 10 12 2 21 10v11h-6v-7H9v7H3z`,user:`M12 3a4 4 0 1 0 0 8 4 4 0 0 0 0-8zM4 21v-2c0-4 16-4 16 0v2H4z`,settings:`M10 2h4l1 3 3-1 3 3-1 3 3 1v4l-3 1 1 3-3 3-3-1-1 3h-4l-1-3-3 1-3-3 1-3-3-1v-4l3-1-1-3 3-3 3 1 1-3zm2 6a4 4 0 1 0 0 8 4 4 0 0 0 0-8z`,trash:`M7 3h10v2h4v2H3V5h4V3zm-2 6h14v12H5V9zm4 2v8h2v-8H9zm4 0v8h2v-8h-2z`,edit:`M3 17.25V21h3.75L17.81 9.94l-3.75-3.75L3 17.25zM20.71 7.04a1 1 0 0 0 0-1.41l-2.34-2.34a1 1 0 0 0-1.41 0l-1.83 1.83 3.75 3.75 1.83-1.83z`,calendar:`M7 2h2v2h6V2h2v2h4v18H3V4h4V2zm-2 8v10h14V10H5zm2 2h4v4H7v-4z`,clock:`M12 2a10 10 0 1 0 0 20 10 10 0 0 0 0-20zm0 2a8 8 0 1 1 0 16 8 8 0 0 1 0-16zm-1 2h2v5.5l4 2.5-1 1.5-5-3V6z`,camera:`M9 3h6l2 3h4v15H3V6h4l2-3zm3 5a5 5 0 1 0 0 10 5 5 0 0 0 0-10zm0 2a3 3 0 1 1 0 6 3 3 0 0 1 0-6z`,upload:`M11 16V7l-4 4-1.5-1.5L12 3l6.5 6.5L17 11l-4-4v9h-2zM3 18h18v3H3v-3z`,download:`M11 3h2v9l4-4 1.5 1.5L12 16l-6.5-6.5L7 8l4 4V3zM3 18h18v3H3v-3z`})),F=b([]);function I(t){for(let n=e(F).length-1;n>=0;n--){let r=e(F)[n].paths.get(t);if(r!==void 0)return r}return P.get(t)}var L=u(`<svg xmlns="http://www.w3.org/2000/svg" data-smrt-component="Icon" class="svelte-em2a54"><path></path></svg>`);function R(t,i){p(i,!0);let a=y(i,`size`,3,24),o=y(i,`color`,3,`currentColor`),s=y(i,`viewBox`,3,`0 0 24 24`),c=n(()=>!!i[`aria-label`]),l=n(()=>i.path??(i.name?I(i.name):``)),u=n(()=>typeof a()==`number`?`${a()}px`:a());var d=L(),f=T(d);D(()=>{O(d,`width`,e(u)),O(d,`height`,e(u)),O(d,`viewBox`,s()),O(d,`fill`,o()),O(d,`aria-hidden`,!e(c)),O(d,`aria-label`,i[`aria-label`]),O(d,`role`,e(c)?`img`:void 0),O(f,`d`,e(l))}),h(t,d),r()}v([`click`]);var z=Symbol.for(`smrt-ui.page-header`);function ae(){return a(z)??null}var oe=c(`<li class="svelte-1f2td7n"><a class="svelte-1f2td7n"> </a></li>`),B=c(`<nav class="page-crumbs svelte-1f2td7n" data-shell-breadcrumbs=""><ol class="svelte-1f2td7n"></ol></nav>`),se=c(`<a class="back-link svelte-1f2td7n"><!> <span> </span></a>`),ce=c(`<h1 class="page-title page-title-field svelte-1f2td7n" data-page-title-field=""><!></h1>`),le=c(`<h1 class="page-title svelte-1f2td7n" data-shell-page-title=""> </h1>`),ue=c(`<p class="page-subtitle svelte-1f2td7n"> </p>`),de=c(`<div class="page-meta svelte-1f2td7n"><!></div>`),fe=c(`<div class="header-actions svelte-1f2td7n"><!></div>`),pe=c(`<div class="header-extra svelte-1f2td7n" data-page-header-extra=""><!></div>`),me=c(`<header class="page-header svelte-1f2td7n" data-page-header="" data-smrt-component="PageHeader"><!> <div class="header-main svelte-1f2td7n"><div class="header-content svelte-1f2td7n"><!> <!> <!> <!></div> <!></div> <!></header>`);function he(i,a){p(a,!0);let c=y(a,`parents`,19,()=>[]),u=y(a,`crumbsLabel`,3,`Breadcrumb`),f=y(a,`backLabel`,3,`Back`),m=ae(),g=n(()=>a.crumbs??(m?m.crumbs(c()):c()));ee(()=>m?.report?.({title:a.shortTitle??a.title,parents:c()}));var _=me(),v=S(_),b=t=>{var n=B(),r=S(n);d(r,23,()=>e(g),(e,t)=>`${t}:${e.href}`,(t,n)=>{var r=oe(),i=S(r),a=T(i,!0);s(r),D(()=>{O(i,`href`,e(n).href),l(a,e(n).label)}),h(t,r)}),s(r),s(n),D(()=>O(n,`aria-label`,u())),h(t,n)};t(v,t=>{e(g).length>0&&t(b)});var x=w(v,2),C=S(x),E=S(C),ne=e=>{var t=se(),n=S(t);R(n,{name:`chevron-left`,size:20});var r=w(n,2),i=T(r,!0);s(t),te(t,e=>re?.(e)),D(()=>{O(t,`href`,a.backHref),l(i,f())}),h(e,t)};t(E,e=>{a.backHref&&e(ne)});var k=w(E,2),A=e=>{var t=ce(),n=S(t);o(n,()=>a.titleField),s(t),h(e,t)},ie=e=>{var t=le(),n=T(t,!0);D(()=>l(n,a.title)),h(e,t)};t(k,e=>{a.titleField?e(A):e(ie,-1)});var j=w(k,2),M=e=>{var t=ue(),n=T(t,!0);D(()=>l(n,a.subtitle)),h(e,t)};t(j,e=>{a.subtitle&&e(M)});var N=w(j,2),P=e=>{var t=de(),n=S(t);o(n,()=>a.meta),s(t),h(e,t)};t(N,e=>{a.meta&&e(P)}),s(C);var F=w(C,2),I=e=>{var t=fe(),n=S(t);o(n,()=>a.actions),s(t),h(e,t)};t(F,e=>{a.actions&&e(I)}),s(x);var L=w(x,2),z=e=>{var t=pe(),n=S(t);o(n,()=>a.children),s(t),h(e,t)};t(L,e=>{a.children&&e(z)}),s(_),h(i,_),r()}v([`click`]),v([`click`]);function ge(e,t,n){if(!n||n<1||e.length<=n)return{visible:[...e],overflow:[]};let r=e.slice(0,n-1),i=e.slice(n-1),a=i.find(e=>e.id===t)??i[0];return{visible:a?[...r,a]:r,overflow:i.filter(e=>e!==a)}}var _e=c(`<span class="smrt-tabs__tab-count svelte-19k21oo" data-smrt-part="count"> </span>`),ve=c(`<span class="smrt-tabs__tab-badge svelte-19k21oo" data-smrt-part="badge"> </span>`),ye=c(`<a data-smrt-part="tab"><span data-smrt-part="label"> </span> <!> <!></a>`),be=c(`<span class="smrt-tabs__tab-dot svelte-19k21oo" data-smrt-part="marker" aria-hidden="true"></span> <span class="smrt-tabs__visually-hidden svelte-19k21oo" data-smrt-part="description"> </span>`,1),xe=c(`<details class="smrt-tabs__more svelte-19k21oo" data-smrt-part="overflow"><summary class="smrt-tabs__tab-link svelte-19k21oo" data-smrt-part="trigger"><span data-smrt-part="label"> </span> <!></summary> <div class="smrt-tabs__more-menu svelte-19k21oo" data-smrt-part="menu"></div></details>`),Se=c(`<div class="smrt-tabs__tab-panel svelte-19k21oo" data-smrt-part="panel"><!></div>`),Ce=c(`<div class="smrt-tabs__container svelte-19k21oo" data-smrt-component="Tabs"><nav data-smrt-part="list" data-shell-tabs=""><div class="smrt-tabs__links-row svelte-19k21oo" data-smrt-part="row"></div> <!></nav> <!></div>`),we=c(`<button type="button" data-smrt-part="tab" role="tab"><span class="smrt-tabs__tab-content-wrapper svelte-19k21oo" data-smrt-part="body"><span data-smrt-part="label"> </span> <!> <!></span> <div class="smrt-tabs__active-indicator svelte-19k21oo" data-smrt-part="indicator"></div></button>`),Te=c(`<div class="smrt-tabs__tab-panel svelte-19k21oo" data-smrt-part="panel" role="tabpanel"><!></div>`),Ee=c(`<div class="smrt-tabs__container svelte-19k21oo" data-smrt-component="Tabs"><div data-smrt-part="list" role="tablist"></div> <!></div>`);function De(a,c){let u=ne();p(c,!0);let v=(r,a=f)=>{var o=ye();let u;var d=S(o),p=T(d,!0),m=w(d,2),g=e=>{var t=_e(),n=T(t,!0);D(()=>l(n,a().count)),h(e,t)};t(m,e=>{a().count!==void 0&&e(g)});var v=w(m,2),y=e=>{var t=ve(),n=T(t,!0);D(()=>l(n,a().badge)),h(e,t)},b=n(()=>L(a()));t(v,t=>{e(b)&&t(y)}),s(o),D(()=>{u=i(o,1,`smrt-tabs__tab-link svelte-19k21oo`,null,u,{"smrt-tabs__active":a().id===c.active}),O(o,`href`,a().disabled?void 0:a().href),O(o,`aria-current`,a().id===c.active?`page`:void 0),O(o,`aria-disabled`,a().disabled?`true`:void 0),O(o,`data-tab-id`,a().id),l(p,a().label)}),_(`click`,o,e=>{a().disabled?e.preventDefault():ae(a().id)}),h(r,o)},C=y(c,`size`,3,`md`),A=y(c,`variant`,3,`primary`),ie=y(c,`moreLabel`,3,`More`),j=y(c,`moreBadgeLabel`,3,`has updates`),M=n(()=>c.tabs.length>0&&c.tabs.every(e=>!!e.href)),N=n(()=>e(M)?ge(c.tabs,c.active,c.maxVisible):{visible:c.tabs,overflow:[]}),P=n(()=>e(N).overflow.some(e=>L(e))),F=b(null),I=b(null);ee(()=>{let t=c.active;e(M)&&e(I)&&(e(F)&&(e(F).open=!1),e(I).querySelector(`[data-tab-id="${CSS.escape(t)}"]`)?.scrollIntoView?.({block:`nearest`,inline:`nearest`}))});function L(e){return e.badge!==void 0&&e.badge!==null&&e.badge!==``}let R=n(()=>c.tabs.filter(e=>!e.disabled)),z=b(null);function ae(e){c.tabs.find(t=>t.id===e)?.disabled||e!==c.active&&c.onchange?.(e)}function oe(t,n){let r=e(R).findIndex(e=>e.id===n),i=null;switch(t.key){case`ArrowRight`:t.preventDefault(),i=(r+1)%e(R).length;break;case`ArrowLeft`:t.preventDefault(),i=(r-1+e(R).length)%e(R).length;break;case`Home`:t.preventDefault(),i=0;break;case`End`:t.preventDefault(),i=e(R).length-1}if(i!==null&&i!==r){let t=e(R)[i];t&&(c.onchange?.(t.id),requestAnimationFrame(()=>{(e(z)?.querySelector(`[data-tab-id="${CSS.escape(t.id)}"]`))?.focus()}))}}var B=g(),se=E(B),ce=n=>{var r=Ce(),a=S(r);let u;var f=S(a);d(f,21,()=>e(N).visible,e=>e.id,(t,n)=>{v(t,()=>e(n))}),s(f),x(f,e=>k(I,e),()=>e(I));var p=w(f,2),m=n=>{var r=xe(),i=S(r),a=S(i),o=T(a,!0),c=w(a,2),u=e=>{var t=be(),n=w(E(t),2),r=T(n);D(()=>l(r,`(${j()??``})`)),h(e,t)};t(c,t=>{e(P)&&t(u)}),s(i);var f=w(i,2);d(f,21,()=>e(N).overflow,e=>e.id,(t,n)=>{v(t,()=>e(n))}),s(f),s(r),x(r,e=>k(F,e),()=>e(F)),D(()=>l(o,ie())),h(n,r)};t(p,t=>{e(N).overflow.length>0&&t(m)}),s(a);var g=w(a,2),_=e=>{var t=Se(),n=S(t);o(n,()=>c.children),s(t),h(e,t)};t(g,e=>{c.children&&e(_)}),s(r),D(()=>{u=i(a,1,`smrt-tabs__links svelte-19k21oo`,null,u,{"smrt-tabs__sm":C()===`sm`,"smrt-tabs__lg":C()===`lg`}),O(a,`aria-label`,c[`aria-label`])}),h(n,r)},le=r=>{var a=Ee(),f=S(a);let p;d(f,21,()=>c.tabs,e=>e.id,(r,a)=>{var o=we();let d;var f=S(o),p=S(f),g=T(p,!0),v=w(p,2),y=t=>{var n=_e(),r=T(n,!0);D(()=>l(r,e(a).count)),h(t,n)};t(v,t=>{e(a).count!==void 0&&t(y)});var b=w(v,2),ee=t=>{var n=ve(),r=T(n,!0);D(()=>l(r,e(a).badge)),h(t,n)},x=n(()=>L(e(a)));t(b,t=>{e(x)&&t(ee)}),s(f),m(2),s(o),te(o,e=>re?.(e)),D(()=>{d=i(o,1,`smrt-tabs__tab-button svelte-19k21oo`,null,d,{"smrt-tabs__active":e(a).id===c.active}),o.disabled=e(a).disabled,O(o,`id`,`tab-${u}-${e(a).id??``}`),O(o,`aria-selected`,e(a).id===c.active),O(o,`aria-controls`,`tab-panel-${u}`),O(o,`tabindex`,e(a).id===c.active?0:-1),O(o,`data-tab-id`,e(a).id),l(g,e(a).label)}),_(`click`,o,()=>ae(e(a).id)),_(`keydown`,o,t=>oe(t,e(a).id)),h(r,o)}),s(f),x(f,e=>k(z,e),()=>e(z));var g=w(f,2),v=e=>{var t=Te(),n=S(t);o(n,()=>c.children),s(t),D(()=>{O(t,`id`,`tab-panel-${u}`),O(t,`aria-labelledby`,`tab-${u}-${c.active??``}`)}),h(e,t)};t(g,e=>{c.children&&e(v)}),s(a),D(()=>{p=i(f,1,`smrt-tabs__nav svelte-19k21oo`,null,p,{"smrt-tabs__sm":C()===`sm`,"smrt-tabs__lg":C()===`lg`,"smrt-tabs__secondary":A()===`secondary`}),O(f,`aria-label`,c[`aria-label`])}),h(r,a)};t(se,t=>{e(M)?t(ce):t(le,-1)}),h(a,B),r()}v([`click`,`keydown`]),v([`click`,`keydown`]);function Oe(){let e=new Map,t=new Map,n=(e,t)=>`${e}:${t}`;return{register(t,r,i){e.set(n(t,r),i)},get(t,r){return e.get(n(t,r))},has(t,r){return e.has(n(t,r))},getSlots(t){let n=`${t}:`;return Array.from(e.keys()).filter(e=>e.startsWith(n)).map(e=>e.slice(n.length))},getModules(){return Array.from(t.keys())},getModuleMeta(e){return t.get(e)},registerModule(e){t.set(e.name,e)},unregister(t,r){return e.delete(n(t,r))},clear(){e.clear(),t.clear()}}}var ke=Oe(),Ae=[`SmrtJunction`,`SmrtJunctionBase`,`SmrtPolymorphicAssociation`],je=[`Metafield`,`Metadata`,`Association`,`LineItem`,`Allocation`,`Revision`,`Attachment`,`Snapshot`,`Completion`,`Override`,`Alias`],Me=[`Status`,`Type`],Ne={"@happyvertical/smrt-commerce:TaxComponent":`lookup`,"@happyvertical/smrt-commerce:TaxSettings":`settings`,"@happyvertical/smrt-commerce:DocumentTax":`snapshot`,"@happyvertical/smrt-commerce:TaxSummaryReport":`report`},V=new Set([`foreignKey`,`crossPackageRef`]);function Pe(e){let t=e.id?Ne[e.id]:void 0;if(t)return t;let n=e.extends?.split(`:`).pop();if(n&&Ae.includes(n))return`junction`;let r=e.fields.filter(e=>!e.system),i=r.filter(e=>V.has(e.type)).length;return i>=2&&r.length-i<=1?`link`:je.some(t=>e.name.endsWith(t))?`child`:r.length<=3&&Me.some(t=>e.name.endsWith(t))?`lookup`:null}function Fe(e){return Pe(e)!==null}var Ie=new Set([`junction`,`link`,`child`]);function H(e,t){return e.includes(`:`)?e:`${t.slice(0,t.lastIndexOf(`:`))}:${e}`}function U(e,t){let n=[],r=e.get(t);for(;r&&!n.includes(r.id);)n.push(r.id),r=r.extends?e.get(H(r.extends,r.id)):void 0;return n}function Le(e,t){let n=e.packages.flatMap(e=>e.models),r=new Map(n.map(e=>[e.id,e])),i=new Set(U(r,t));return i.size?n.filter(e=>{if(i.has(e.id))return!1;let t=Pe(e);return!t||!Ie.has(t)?!1:e.fields.some(t=>V.has(t.type)&&t.related&&i.has(H(t.related,e.id)))}):[]}function Re(e,t){let n=e.fields.find(n=>V.has(n.type)&&n.related&&t.has(H(n.related,e.id)));return n?{model:e,fk:n.name}:void 0}function ze(e,t,n){let r=e.packages.flatMap(e=>e.models),i=new Map(r.map(e=>[e.id,e])),a=new Set(U(i,n));if(!a.size)return[];let o=t.filter(e=>e.models.includes(n));if(!o.length)return Le(e,n).flatMap(e=>{let t=Re(e,a);return t?[t]:[]});let s=new Map;for(let e of o){let t=new Set(e.nav.map(e=>e.model));for(let n of e.models){let e=i.get(n);if(!e||t.has(n)||a.has(n)||s.has(n))continue;let r=Re(e,a);r&&s.set(n,r)}}return[...s.values()]}function Be(e,t){let n=e.packages.flatMap(e=>e.models),r=new Map(n.map(e=>[e.id,e])),i=new Set(U(r,t));if(!i.size)return[];let a=[];for(let e of n)if(!i.has(e.id))for(let t of e.fields)V.has(t.type)&&t.related&&i.has(H(t.related,e.id))&&a.push({model:e,fk:t.name});return a}function Ve(e,t){let n=e.packages.flatMap(e=>e.models),r=new Map(n.map(e=>[e.id,e])),i=r.get(t);return i?i.fields.flatMap(e=>{if(!V.has(e.type)||!e.related)return[];let t=r.get(H(e.related,i.id));return t?[{model:t,fk:e.name}]:[]}):[]}function He(e,t){return e.some(e=>e.nav.some(e=>e.model===t))}function Ue(e,t){let n=e;for(let e of t)if(n.length>e.length&&n.startsWith(e)){n=n.slice(e.length);break}let r=n.replace(/([a-z0-9])([A-Z])/g,`$1 $2`).toLowerCase(),i=/[^aeiou]y$/.test(r)?`${r.slice(0,-1)}ies`:/(s|x|ch|sh)$/.test(r)?`${r}es`:`${r}s`;return i.charAt(0).toUpperCase()+i.slice(1)}function We(e,t){let n=e.packages.flatMap(e=>e.models),r=new Map(n.map(e=>[e.id,e]));return U(r,t).flatMap(e=>{let t=r.get(e);return t?[t.name]:[]})}function Ge(e,t,n){let r=We(e,t);return Le(e,t).filter(e=>n(e)&&r.some(t=>e.name.startsWith(t)))}function W(e){return e.group?.id??e.id}function Ke(e){let t=new Map;for(let n of e){let e=W(n),r=t.get(e);r?r.recipes.push(n):t.set(e,{id:e,label:n.group?.label??n.label,recipes:[n]})}return[...t.values()]}function G(e){return e.section??{id:W(e),label:e.group?.label??e.label}}function qe(e){let t=new Map;for(let n of e){let e=G(n),r=t.get(e.id);r?r.recipes.push(n):t.set(e.id,{...e,recipes:[n]})}return[...t.values()]}function Je(e){let t=new Set(e.map(e=>G(e).id)),n={};for(let r of e){let e=W(r),i=G(r).id;e!==i&&!t.has(e)&&(n[e]=i)}return n}function Ye(e,t,n){return`item:${e}:${t}${n?`:${n}`:``}`}function Xe(e,t){return e?.trim()||t.description?.trim()||`Your ${Ze(t.name)} records, all in one place.`}function Ze(e){return e.replace(/([a-z0-9])([A-Z])/g,`$1 $2`).toLowerCase()}var Qe={id:`more`,label:`More`,icon:`layers`,description:`Extra records you added one at a time.`},$e=`fileText`;function et(e){let t=e.description?.trim();if(t)return t.split(/(?<=[.!?])\s/)[0]??t;let n=e.fields.filter(e=>!e.system).length;return`${n} ${n===1?`field`:`fields`}`}function tt(e,t){let n=new Set(t.flatMap(e=>e.models));return e.packages.flatMap(t=>N(t).filter(e=>!n.has(e.id)).map(n=>({id:n.id,name:n.name,label:j(n.name),packageId:t.id,description:et(n),described:!!n.description?.trim(),plumbing:Fe(n),fieldNames:n.fields.map(e=>e.name),includes:Le(e,n.id).map(e=>j(e.name))})))}function nt(e){return e.described?e.description:`${j(e.packageId)} · ${e.description}`}function rt(e,t){return t?[...e]:e.filter(e=>!e.plumbing)}function it(e){return[...new Set(e.map(e=>e.packageId))]}function at(e,t,n){let r=t.toLowerCase().split(/\s+/).filter(Boolean);return e.filter(e=>{if(n&&e.packageId!==n)return!1;if(!r.length)return!0;let t=[e.name,e.label,e.description,e.packageId,...e.fieldNames].join(` `).toLowerCase();return r.every(e=>t.includes(e))})}function ot(e){return e.flatMap(e=>{let t=A(e);return t?.model.exposed?[{id:Ye(t.pkg.id,t.model.name),packageId:t.pkg.id,modelName:t.model.name,label:j(t.model.name),icon:$e,description:Xe(void 0,t.model)}]:[]})}var st={"@happyvertical/smrt-commerce:Customer":{profileId:`Links this customer to their profile record, where their name and contact details are kept.`,creditLimit:`The most this customer may owe you at one time. Leave it empty or at zero if you do not set limits.`,paymentTerms:`How long the customer has to pay, written the way you would say it, for example "Net 30".`,taxExempt:`Turn this on if you do not charge this customer sales tax.`,taxId:`The customer's tax or VAT number, kept on file for tax-exempt sales.`,defaultShippingAddress:`Where you usually send this customer's goods, so you do not retype it on every order.`,defaultBillingAddress:`Where you send this customer's invoices.`,status:`Whether this is a current customer, for example active or inactive.`,customerType:`The kind of customer, for example an individual or a business.`,notes:`Anything worth remembering about this customer.`},"@happyvertical/smrt-commerce:Vendor":{profileId:`Links this vendor to their profile record, where their name and contact details are kept.`,leadTimeDays:`How many days the vendor usually takes between your order and delivery.`,minimumOrderAmount:`The smallest order the vendor will accept.`,paymentTerms:`How long you have to pay this vendor, written the way you would say it, for example "Net 30".`,currency:`The currency this vendor bills you in.`,defaultContactEmail:`The email address you normally use to reach this vendor.`,defaultContactPhone:`The phone number you normally use to reach this vendor.`,status:`Whether you still buy from this vendor, for example active or inactive.`,notes:`Anything worth remembering about this vendor.`,payoutAddresses:`Where payments to this vendor should be sent.`},"@happyvertical/smrt-commerce:Order":{status:`Where the order stands, for example draft, accepted or completed.`,customerId:`The customer this order is for.`,subtotal:`The order amount before tax.`,taxAmount:`The tax charged on the order.`,totalAmount:`What the customer pays in all, tax included.`,currency:`The currency of the order's amounts.`,issueDate:`The date the order was placed.`,dueDate:`The date payment is expected. An order still open after this date counts as overdue.`,expiryDate:`The last day the order's price or offer is good for.`,reference:`Your own number or note for finding this order later, such as the customer's purchase order number.`,notes:`Anything worth remembering about this order.`,terms:`The conditions agreed with the customer, such as deposits, delivery or payment conditions.`,channelId:`Where the order came from, for example your shop or a marketplace.`},"@happyvertical/smrt-commerce:PurchaseOrder":{status:`Where the purchase stands, for example draft, accepted or completed.`,vendorId:`The vendor you are buying from.`,subtotal:`The order amount before tax.`,taxAmount:`The tax charged on the order.`,totalAmount:`What you pay in all, tax included.`,currency:`The currency of the order's amounts.`,issueDate:`The date you placed the order.`,dueDate:`The date the goods or the payment are due.`,expiryDate:`The last day the vendor's offer is good for.`,reference:`Your own number or note for finding this order later, such as the vendor's quote number.`,notes:`Anything worth remembering about this purchase.`,terms:`The conditions agreed with the vendor, such as payment or delivery conditions.`,channelId:`Where the order was placed, for example a vendor's website or a phone call.`},"@happyvertical/smrt-products:Product":{name:`What you call the product, as customers will see it.`,price:`What one costs, in dollars and cents.`,description:`A few words on what the product is and who it is for.`},"@happyvertical/smrt-products:ProductVariant":{productId:`The product this choice belongs to. Set for you when you save the product.`,axisName:`What the product varies by, for example size or color.`,allowedValues:`The values on offer for it, for example S, M and L.`},"@happyvertical/smrt-products:Sku":{productId:`The product this item is a version of. Set for you when you save the product.`,code:`The short code that identifies this exact size and color. Made for you from the product name.`,attributes:`Which size and color this item is. Set for you from the grid.`},"@happyvertical/smrt-inventory:StockLevel":{skuId:`The item being counted. Set for you when you save the product.`,locationId:`Where it is kept. New stock goes to the main warehouse.`,state:`Whether the count is available to sell. New stock starts as available.`,qty:`How many you have on hand.`},"@happyvertical/smrt-inventory:InventoryLocation":{code:`A short code for the place stock is kept, for example MAIN.`,name:`What you call the place, for example Main warehouse.`,kind:`What sort of place it is, for example a warehouse or a shop floor.`},"@happyvertical/smrt-commerce:Estimate":{status:`Where the estimate stands, for example draft, sent, accepted or completed.`,customerId:`The customer this estimate is for.`,subtotal:`The estimate amount before tax.`,taxAmount:`The tax charged on the estimate.`,totalAmount:`What the customer pays in all, tax included.`,currency:`The currency of the estimate's amounts.`,issueDate:`The date the estimate was issued or starts.`,dueDate:`The date payment is expected.`,expiryDate:`The last day the estimate is good for, or the day it ends.`,reference:`Your own number or note for finding this estimate later.`,notes:`Anything worth remembering about this estimate.`,terms:`The conditions agreed with the customer, such as deposits, delivery or payment conditions.`,channelId:`Where the estimate came from, for example your shop or a marketplace.`},"@happyvertical/smrt-commerce:WholesaleOrder":{status:`Where the wholesale order stands, for example draft, sent, accepted or completed.`,customerId:`The customer this wholesale order is for.`,subtotal:`The wholesale order amount before tax.`,taxAmount:`The tax charged on the wholesale order.`,totalAmount:`What the customer pays in all, tax included.`,currency:`The currency of the wholesale order's amounts.`,issueDate:`The date the wholesale order was issued or starts.`,dueDate:`The date payment is expected.`,expiryDate:`The last day the wholesale order is good for, or the day it ends.`,reference:`Your own number or note for finding this wholesale order later.`,notes:`Anything worth remembering about this wholesale order.`,terms:`The conditions agreed with the customer, such as deposits, delivery or payment conditions.`,channelId:`Where the wholesale order came from, for example your shop or a marketplace.`},"@happyvertical/smrt-commerce:Agreement":{status:`Where the agreement stands, for example draft, sent, accepted or completed.`,customerId:`The customer this agreement is for.`,subtotal:`The agreement amount before tax.`,taxAmount:`The tax charged on the agreement.`,totalAmount:`What the customer pays in all, tax included.`,currency:`The currency of the agreement's amounts.`,issueDate:`The date the agreement was issued or starts.`,dueDate:`The date payment is expected.`,expiryDate:`The last day the agreement is good for, or the day it ends.`,reference:`Your own number or note for finding this agreement later.`,notes:`Anything worth remembering about this agreement.`,terms:`The conditions agreed with the customer, such as deposits, delivery or payment conditions.`,channelId:`Where the agreement came from, for example your shop or a marketplace.`},"@happyvertical/smrt-commerce:Lease":{status:`Where the lease stands, for example draft, sent, accepted or completed.`,customerId:`The customer this lease is for.`,subtotal:`The lease amount before tax.`,taxAmount:`The tax charged on the lease.`,totalAmount:`What the customer pays in all, tax included.`,currency:`The currency of the lease's amounts.`,issueDate:`The date the lease was issued or starts.`,dueDate:`The date payment is expected.`,expiryDate:`The last day the lease is good for, or the day it ends.`,reference:`Your own number or note for finding this lease later.`,notes:`Anything worth remembering about this lease.`,terms:`The conditions agreed with the customer, such as deposits, delivery or payment conditions.`,channelId:`Where the lease came from, for example your shop or a marketplace.`},"@happyvertical/smrt-commerce:LicenseSale":{status:`Where the licence sale stands, for example draft, sent, accepted or completed.`,customerId:`The customer this licence sale is for.`,subtotal:`The licence sale amount before tax.`,taxAmount:`The tax charged on the licence sale.`,totalAmount:`What the customer pays in all, tax included.`,currency:`The currency of the licence sale's amounts.`,issueDate:`The date the licence sale was issued or starts.`,dueDate:`The date payment is expected.`,expiryDate:`The last day the licence sale is good for, or the day it ends.`,reference:`Your own number or note for finding this licence sale later.`,notes:`Anything worth remembering about this licence sale.`,terms:`The conditions agreed with the customer, such as deposits, delivery or payment conditions.`,channelId:`Where the licence sale came from, for example your shop or a marketplace.`},"@happyvertical/smrt-commerce:Contract":{status:`Where the contract stands, for example draft, sent, accepted or completed.`,subtotal:`The contract amount before tax.`,taxAmount:`The tax charged on the contract.`,totalAmount:`What the customer pays in all, tax included.`,currency:`The currency of the contract's amounts.`,issueDate:`The date the contract was issued or starts.`,dueDate:`The date payment is expected.`,expiryDate:`The last day the contract is good for, or the day it ends.`,reference:`Your own number or note for finding this contract later.`,notes:`Anything worth remembering about this contract.`,terms:`The conditions agreed with the customer, such as deposits, delivery or payment conditions.`,channelId:`Where the contract came from, for example your shop or a marketplace.`,contractType:`The kind of contract: order, estimate, lease, agreement and so on.`},"@happyvertical/smrt-commerce:ContractLineItem":{contractId:`The order, quote or agreement this line belongs to.`,description:`What is being sold or bought on this line.`,quantity:`How many.`,unitPrice:`The price of one, before tax.`,taxRate:`The tax rate for this line, as a percentage (5 means 5%).`,amount:`The line total.`,productId:`The product this line is for, if it is one you list.`},"@happyvertical/smrt-inventory:StockMovement":{skuId:`The item that moved.`,locationId:`The place it moved at.`,fromState:`What it was before, for example available or damaged.`,toState:`What it became.`,qty:`How many moved.`,reasonCode:`Why it moved, for example adjustment, sale or return.`,note:`Anything worth remembering about this movement.`,occurredAt:`When it happened.`},"@happyvertical/smrt-commerce:Invoice":{customerId:`The customer being billed.`,contractId:`The order or agreement this invoice bills for, if any.`,invoiceNumber:`The number printed on the invoice.`,issueDate:`The date the invoice was issued.`,dueDate:`The date payment is expected.`,paidDate:`The date it was paid in full.`,subtotal:`The amount before tax.`,taxAmount:`The tax charged.`,totalAmount:`What the customer owes in all, tax included.`,amountPaid:`How much of the total has been paid so far.`,currency:`The currency of the invoice.`,status:`Where the invoice stands: draft, sent, viewed, paid, overdue or cancelled.`,notes:`Private notes, not shown to the customer.`,customerNotes:`A message shown to the customer on the invoice.`,terms:`The payment conditions, such as Net 30.`},"@happyvertical/smrt-commerce:InvoiceLineItem":{invoiceId:`The invoice this line belongs to.`,description:`What is being billed on this line.`,quantity:`How many.`,unitPrice:`The price of one, before tax.`,taxRate:`The tax rate for this line, as a percentage (5 means 5%).`,amount:`The line total.`},"@happyvertical/smrt-commerce:Payment":{contractId:`The order or agreement this payment is for, if any.`,customerId:`The customer who paid.`,amount:`How much was paid.`,currency:`The currency of the payment.`,method:`How it was paid: cash, check, card, bank transfer or other.`,status:`Whether the payment is pending, completed, failed or refunded.`,reference:`Your own note, such as a check number.`,paidAt:`When the money was received.`,notes:`Anything worth remembering about this payment.`},"@happyvertical/smrt-commerce:PaymentAllocation":{paymentId:`The payment being applied.`,invoiceId:`The invoice it settles.`,amount:`How much of the payment goes to this invoice.`,allocatedAt:`When it was applied.`,notes:`Anything worth remembering about this allocation.`},"@happyvertical/smrt-commerce:Fulfillment":{contractId:`The order being fulfilled.`,fulfillmentType:`How it gets to the customer: shipment, delivery, pickup, digital or service.`,status:`Where it stands: pending, processing, shipped, delivered or cancelled.`,trackingNumber:`The carrier's tracking number.`,carrier:`The company carrying it.`,shippedAt:`When it left you.`,deliveredAt:`When it arrived.`,notes:`Anything worth remembering about this shipment.`},"@happyvertical/smrt-commerce:FulfillmentLineItem":{fulfillmentId:`The shipment this line belongs to.`,contractLineItemId:`The order line being sent.`,quantityFulfilled:`How many of that line are in this shipment.`},"@happyvertical/smrt-ledgers:Account":{number:`The account number in your chart of accounts.`,name:`What the account is called.`,description:`What the account is used for.`,type:`asset, liability, equity, revenue or expense.`,active:`Turn this off to stop using the account without deleting it.`},"@happyvertical/smrt-ledgers:Journal":{number:`The journal's reference number.`,date:`The date of the transaction.`,description:`What the transaction was.`,status:`draft while you work on it, posted once final, or voided.`,postedAt:`When it was posted.`},"@happyvertical/smrt-ledgers:JournalEntry":{journalId:`The journal this entry belongs to.`,accountId:`The account this entry changes.`,debit:`The amount debited. Leave zero on a credit.`,credit:`The amount credited. Leave zero on a debit.`,currency:`The currency of the amounts.`,memo:`A note on this entry.`},"@happyvertical/smrt-projects:Project":{title:`The project's name.`,description:`What the project is about.`,owner:`Who owns or runs the project.`,url:`A link to the project elsewhere.`},"@happyvertical/smrt-projects:Issue":{projectId:`The project this issue belongs to.`,title:`A short summary of the issue.`,body:`The full description.`,state:`open or closed.`,author:`Who raised the issue.`,labels:`The labels attached to the issue.`,assignees:`The people working on it.`},"@happyvertical/smrt-projects:Label":{projectId:`The project this label belongs to.`,name:`The label's name, for example bug.`,color:`The label's colour.`,description:`What the label means.`},"@happyvertical/smrt-projects:Comment":{issueId:`The issue this comment is on.`,body:`The comment text.`,author:`Who wrote it.`},"@happyvertical/smrt-events:Event":{name:`What the event is called.`,seriesId:`The series this event is part of, if any.`,typeId:`The kind of event.`,placeId:`Where it takes place.`,description:`What the event is about.`,startDate:`When it starts.`,endDate:`When it ends.`,allDay:`Turn this on for an event that lasts all day.`,status:`scheduled, in progress, completed, cancelled or postponed.`},"@happyvertical/smrt-events:EventType":{name:`What this kind of event is called, for example workshop.`,description:`What this kind of event is for.`},"@happyvertical/smrt-events:EventSeries":{name:`What the series is called.`,typeId:`The kind of event in this series.`,organizerId:`Who runs the series.`,description:`What the series is about.`,startDate:`When the series begins.`,endDate:`When the series ends.`,recurrence:`How often it repeats.`},"@happyvertical/smrt-events:EventParticipant":{eventId:`The event the person takes part in.`,profileId:`The person taking part.`,role:`What they do there, for example speaker or attendee.`},"@happyvertical/smrt-sales:Lead":{name:`What you call this lead.`,contactName:`The person to talk to.`,email:`Their email address.`,phone:`Their phone number.`,organizationName:`The company they are with.`,ownerRepId:`The sales representative who owns this lead.`,status:`Where the lead stands, for example new or qualified.`},"@happyvertical/smrt-sales:Opportunity":{name:`What you call this deal.`,leadId:`The lead it came from.`,ownerRepId:`The sales representative who owns this deal.`,pipelineId:`The pipeline it moves through.`,stageId:`The stage it is at now.`,expectedValueCents:`What you expect the deal to be worth, in cents.`,currency:`The currency of that value.`,probability:`How likely it is to close, as a decimal (0.5 is 50%).`,expectedCloseAt:`When you expect it to close.`,status:`open, won or lost.`},"@happyvertical/smrt-sales:PipelineDefinition":{key:`A short code for the pipeline.`,name:`What the pipeline is called.`,isDefault:`Turn this on to use it for new deals.`,status:`Whether the pipeline is in use.`,metadata:`Extra details kept with the pipeline.`},"@happyvertical/smrt-sales:PipelineStage":{pipelineId:`The pipeline this stage belongs to.`,key:`A short code for the stage.`,name:`What the stage is called.`,sortOrder:`Where it comes in the pipeline.`,probability:`How likely a deal at this stage is to close, as a decimal.`,isWon:`Turn this on for the stage that means the deal is won.`,isLost:`Turn this on for the stage that means the deal is lost.`},"@happyvertical/smrt-sales:SalesActivity":{subjectKind:`What the activity is about: a lead or an opportunity.`,subjectId:`The lead or opportunity it is about.`,activityKind:`The kind of activity, for example call, note or email.`,summary:`What happened or what needs doing.`,dueAt:`When it is due.`,completedAt:`When it was done.`}};function ct(e,t){let n=new Map(e.map(e=>[e.id,e])),r=[...Object.keys(t.recipes),...t.order].filter(e=>!n.has(e));if(r.length>0)throw Error(`Recipes only declared locally, not in a smrt package: ${[...new Set(r)].join(`, `)}`);let i=[...t.order,...e.map(e=>e.id).filter(e=>!t.order.includes(e))];return[...new Set(i)].map(e=>{let r=n.get(e),i=t.recipes[e];return i?{...r,...i}:r})}var lt={order:[`commerce.customers`,`commerce.purchases`,`commerce.sales`,`commerce.vendors`,`inventory.stock`,`products.simple`,`products.clothing`,`products.ingredients`,`commerce.estimates`,`commerce.wholesale`,`commerce.invoicing`,`commerce.fulfillment`,`commerce.agreements`,`commerce.leases`,`commerce.licenses`,`ledgers.bookkeeping`,`projects.tracker`,`events.calendar`,`sales.pipeline`],recipes:{"commerce.customers":{forms:[{id:`customer.default`,kind:`field-map`,label:`Customer`,kindLabel:`Customer`,model:`@happyvertical/smrt-commerce:Customer`,records:[{as:`profileType`,model:`@happyvertical/smrt-profiles:ProfileType`,match:{name:`Customer`}},{as:`profile`,model:`@happyvertical/smrt-profiles:Profile`,match:{id:{ref:`customer`,field:`profileId`}},values:{typeId:{ref:`profileType`}}},{as:`customer`,model:`@happyvertical/smrt-commerce:Customer`,values:{profileId:{ref:`profile`}}}],fields:[{id:`name`,label:`Name`,to:`profile.name`,required:!0},{id:`email`,label:`Email`,to:`profile.email`},{id:`status`,label:`Status`,to:`customer.status`,default:`active`},{id:`customerType`,label:`Customer type`,to:`customer.customerType`,default:`dtc`},{id:`paymentTerms`,label:`Payment terms`,to:`customer.paymentTerms`},{id:`creditLimit`,label:`Credit limit`,to:`customer.creditLimit`},{id:`taxExempt`,label:`Tax exempt`,to:`customer.taxExempt`},{id:`taxId`,label:`Tax ID`,to:`customer.taxId`},{id:`shippingAddress`,label:`Shipping address`,to:`customer.defaultShippingAddress`},{id:`billingAddress`,label:`Billing address`,to:`customer.defaultBillingAddress`},{id:`notes`,label:`Notes`,to:`customer.notes`}]}]},"commerce.vendors":{forms:[{id:`vendor.default`,kind:`field-map`,label:`Vendor`,kindLabel:`Vendor`,model:`@happyvertical/smrt-commerce:Vendor`,records:[{as:`profileType`,model:`@happyvertical/smrt-profiles:ProfileType`,match:{name:`Vendor`}},{as:`profile`,model:`@happyvertical/smrt-profiles:Profile`,match:{id:{ref:`vendor`,field:`profileId`}},values:{typeId:{ref:`profileType`}}},{as:`vendor`,model:`@happyvertical/smrt-commerce:Vendor`,values:{profileId:{ref:`profile`}}}],fields:[{id:`name`,label:`Name`,to:`profile.name`,required:!0},{id:`email`,label:`Email`,to:`profile.email`},{id:`status`,label:`Status`,to:`vendor.status`,default:`active`},{id:`currency`,label:`Currency`,to:`vendor.currency`,default:`USD`},{id:`paymentTerms`,label:`Payment terms`,to:`vendor.paymentTerms`},{id:`leadTimeDays`,label:`Lead time (days)`,to:`vendor.leadTimeDays`},{id:`minimumOrderAmount`,label:`Minimum order`,to:`vendor.minimumOrderAmount`},{id:`contactEmail`,label:`Contact email`,to:`vendor.defaultContactEmail`},{id:`contactPhone`,label:`Contact phone`,to:`vendor.defaultContactPhone`},{id:`notes`,label:`Notes`,to:`vendor.notes`},{id:`payoutAddresses`,label:`Payout addresses`,to:`vendor.payoutAddresses`}]}]},"inventory.stock":{extends:[{form:`product.simple`,records:[{as:`sku`,model:`@happyvertical/smrt-products:Sku`,match:{productId:{ref:`product`}},values:{code:`{product.name|slug}`,name:`{product.name}`,attributes:`{}`,active:!0}},{as:`location`,model:`@happyvertical/smrt-inventory:InventoryLocation`,match:{code:`MAIN`},values:{name:`Main warehouse`,kind:`warehouse`}},{as:`stock`,model:`@happyvertical/smrt-inventory:StockLevel`,match:{skuId:{ref:`sku`},locationId:{ref:`location`},state:`available`}}],fields:[{id:`quantity`,label:`Quantity`,to:`stock.qty`,default:0}]},{form:`product.clothing`,records:[{as:`location`,model:`@happyvertical/smrt-inventory:InventoryLocation`,match:{code:`MAIN`},values:{name:`Main warehouse`,kind:`warehouse`}},{as:`stock`,model:`@happyvertical/smrt-inventory:StockLevel`,match:{skuId:{ref:`sku`},locationId:{ref:`location`},state:`available`}}],fields:[{id:`quantity`,label:`Quantity`,to:`stock.qty`,default:0}]}]},"products.simple":{forms:[{id:`product.simple`,kind:`field-map`,label:`Simple product`,kindLabel:`Simple`,model:`@happyvertical/smrt-products:Product`,records:[{as:`product`,model:`@happyvertical/smrt-products:Product`}],fields:[{id:`name`,label:`Name`,to:`product.name`,required:!0},{id:`price`,label:`Price`,to:`product.price`},{id:`description`,label:`Description`,to:`product.description`}]}]},"products.clothing":{forms:[{id:`product.clothing`,kind:`variant-grid`,label:`Clothing item`,kindLabel:`Clothing`,model:`@happyvertical/smrt-products:Product`,product:{as:`product`,model:`@happyvertical/smrt-products:Product`},fields:[{id:`name`,label:`Name`,to:`product.name`,required:!0},{id:`price`,label:`Price`,to:`product.price`}],axes:[{name:`size`,label:`Sizes`,values:[`XS`,`S`,`M`,`L`,`XL`]},{name:`color`,label:`Colors`,values:[]}],variants:`@happyvertical/smrt-products:ProductVariant`,skus:`@happyvertical/smrt-products:Sku`}]}}};function ut(e){return e.fields.filter(e=>!e.system)}var dt=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1_$2`).toLowerCase();function ft(e,t){return/Type$/.test(t.name)&&Array.isArray(t.enum)&&t.enum.length>0&&!!e.extends&&t.enum.includes(dt(e.name))}function pt(e){return e.some(e=>e.ui?.basic===!0)}function mt(e){return e!=null&&e!==``}function ht(e){if(e==null)return null;try{return{value:JSON.parse(e)}}catch{return null}}function K(e,t,n=[]){let r=ut(e),i=pt(r),a=new Map(n.filter(t=>t.objectRef===e.id).map(e=>[e.fieldName,e]));return r.map((n,r)=>{let o=t?.fields?.[n.name]??{},s=ft(e,n),c=o.visibility??(s?`hidden`:!i||n.ui?.basic===!0?`basic`:`advanced`),l=o.label??M(n),u=o.help??null,d=o.order??n.ui?.order??r,f=o.locked??n.ui?.locked??s,p=dt(e.name),m=n.default===void 0?s&&n.enum?.includes(p)?p:void 0:n.default,h=`default`in o||m!==void 0,g=`default`in o?o.default:m,_=a.get(n.name);if(_&&(!f||_.locked===!1)){_.visibility&&(c=_.visibility),_.label&&(l=_.label),_.help!==void 0&&(u=_.help||null),typeof _.displayOrder==`number`&&(d=_.displayOrder);let e=ht(_.defaultValue);e&&(h=!0,g=e.value),typeof _.locked==`boolean`&&(f=_.locked)}let v,y=o.required??n.required;return y&&c!==`basic`&&!(h&&mt(g))&&(c=`basic`,v=!0),{field:n,visibility:c,label:l,help:u,order:d,group:n.ui?.group??null,locked:f,required:y,hasDefault:h,default:g,...v?{visibilityForced:v}:{}}}).map((e,t)=>({entry:e,index:t})).sort((e,t)=>e.entry.order-t.entry.order||e.index-t.index).map(({entry:e})=>e)}function gt(e){return typeof e==`string`||typeof e==`number`||typeof e==`boolean`||e===null?e:void 0}function _t(e){return e.filter(e=>e.visibility===`basic`).map(e=>{let{default:t,...n}=e.field,r=e.hasDefault?gt(e.default):void 0;return{...n,required:e.required,...r===void 0?{}:{default:r},label:e.label,...e.help?{help:e.help}:{}}})}function vt(e){let t={};for(let n of e)n.visibility!==`basic`&&n.hasDefault&&n.default!==void 0&&(t[n.field.name]=n.default);return t}var yt=[`api`,`mcp`,`cli`],bt={api:`REST`,mcp:`MCP`,cli:`CLI`};function xt(e,t){return(t===`api`?e.rest.length:t===`mcp`?e.mcp.length:e.cli.length)>0}function q(e,t,n=[]){let r={};for(let i of yt){let a=xt(e,i),o=t?.exposure?.[i]===!1;r[i]={available:a,on:a&&!o&&!n.includes(i),locked:!a||o}}return r}function St(e,t){let n=t.mcp.on;return{...e,rest:t.api.on?e.rest:[],mcp:n?e.mcp:[],cli:t.cli.on?e.cli:[],methods:e.methods.map(e=>({...e,aiCallable:e.aiCallable&&n}))}}function Ct(e,t,n=[]){return K(e,t,n).filter(e=>t?.fields?.[e.field.name]?.visibility!==`hidden`)}function wt(e){return e.required||e.locked}function Tt(e,t,n,r){let i={};for(let r of Ct(e,t,n))i[r.field.name]={use:r.visibility===`basic`,label:r.label,help:r.help??``,default:r.hasDefault?r.default:null,order:r.order};let a=q(e,t,r);return{fields:i,exposure:{api:a.api.on,mcp:a.mcp.on,cli:a.cli.on}}}var Et=(e,t)=>JSON.stringify(e??null)===JSON.stringify(t??null);function Dt(e,t,n){let r=Ct(e,t),i=[];for(let t of r){let r=n.fields[t.field.name];if(!r||t.locked)continue;let a={objectRef:e.id,fieldName:t.field.name,scopeType:`app`},o=wt(t)?!0:r.use;o!==(t.visibility===`basic`)&&(a.visibility=o?`basic`:`hidden`),r.label.trim()&&r.label!==t.label&&(a.label=r.label.trim()),r.help!==(t.help??``)&&(a.help=r.help||null),Et(r.default,t.hasDefault?t.default:null)||(a.defaultValue=JSON.stringify(r.default??null)),r.order!==t.order&&(a.displayOrder=r.order),Object.keys(a).length>3&&i.push(a)}return i}function Ot(e,t,n){let r=q(e,t);return yt.filter(e=>r[e].on&&!n.exposure[e])}var kt=st,J=ct(ie.packages.flatMap(e=>e.recipes??[]),lt),At=new Map(J.map(e=>[e.id,e]));function jt(e){return At.get(e)}var Y=At,Mt=Ke(J);function Nt(e){return Mt.find(t=>t.id===e)}function Pt(e){let t=e.models[0];return t?A(t)?.pkg:void 0}function Ft(e){return e.nav.flatMap(e=>{let t=A(e.model);return t?[{label:e.label,icon:e.icon??`fileText`,description:Xe(e.description,t.model),...e.key?{key:e.key}:{},...e.noun?{noun:e.noun}:{},...e.filter?{filter:e.filter}:{},model:t.model,packageId:t.pkg.id}]:[]})}function It(e,t,n){return J.some(r=>Ft(r).some(r=>r.key===n&&r.packageId===e&&r.model.name===t))}function Lt(e){return`/m/${e.packageId}/${e.model.name}/${e.key?`${e.key}/`:``}`}function Rt(e){return e.models.flatMap(e=>{let t=A(e);return t?[{model:t.model,packageId:t.pkg.id}]:[]})}function zt(e,t=[]){let n=e.nav.length>0;return Rt(e).map(({model:r})=>({id:r.id,name:r.name,...n?{}:{glossary:!1},descriptions:{...Object.fromEntries(r.fields.flatMap(e=>e.description?[[e.name,e.description]]:[])),...kt[r.id]},fields:K(r,e.options?.[r.id],t).map(e=>({name:e.field.name,label:e.label,help:e.help,visibility:e.visibility}))}))}function Bt(e){return[...new Set(e)].sort()}function X(e,t){let n=new Set,r=e=>{let i=t.get(e);if(i&&!n.has(e)){n.add(e);for(let e of i.requires)r(e)}};for(let t of e)r(t);let i=!0;for(;i;){i=!1;for(let e of[...n])for(let a of t.get(e)?.requiresAny??[]){if(a.some(e=>n.has(e)))continue;let e=a.find(e=>t.has(e));e&&(r(e),i=!0)}}return Bt(n)}function Vt(e,t,n){let r=new Set(e),i=t.filter(e=>!r.has(e)),a=new Set(i);return i.filter(e=>{let t=n.get(e);return t?t.requires.some(e=>r.has(e))?!0:(t.requiresAny??[]).some(e=>e.some(e=>r.has(e))&&!e.some(e=>a.has(e))):!1})}function Ht(e,t,n){return Vt([e],t,n)}function Ut(e,t){return Bt([...e].filter(e=>t.has(e)))}var Wt={currency:`USD`,taxRate:0,paymentTerms:``,pricesIncludeTax:!1,taxRounding:`line`},Z=`@happyvertical/smrt-commerce:`,Q={currency:[`Order`,`PurchaseOrder`,`WholesaleOrder`,`Estimate`,`Invoice`,`Agreement`,`Lease`].map(e=>({model:`${Z}${e}`,field:`currency`})),taxRate:[`InvoiceLineItem`,`ContractLineItem`].map(e=>({model:`${Z}${e}`,field:`taxRate`})),paymentTerms:[...[`Order`,`WholesaleOrder`,`Estimate`,`Invoice`,`Agreement`,`Lease`].map(e=>({model:`${Z}${e}`,field:`terms`})),{model:`${Z}Customer`,field:`paymentTerms`}],pricesIncludeTax:[`Invoice`,`Contract`].map(e=>({model:`${Z}${e}`,field:`lineAmountType`})),taxRounding:[`Invoice`,`Contract`].map(e=>({model:`${Z}${e}`,field:`taxRoundingScope`}))};function Gt(e){return Object.values(Q).some(t=>t.some(t=>t.model===e.objectRef&&t.field===e.fieldName))}var Kt=Object.keys(Q);function qt(e){if(e?.defaultValue!==void 0&&e.defaultValue!==null)try{return JSON.parse(e.defaultValue)}catch{return}}function Jt(e,t,n){return e.find(e=>e.scopeType===`app`&&e.objectRef===t&&e.fieldName===n)}function Yt(e){let t={...Wt},n=(t,n)=>{for(let{model:r,field:i}of Q[t]){let t=qt(Jt(e.policies,r,i));if(typeof t===n)return t}},r=n(`currency`,`string`),i=n(`taxRate`,`number`),a=n(`paymentTerms`,`string`),o=n(`pricesIncludeTax`,`string`),s=n(`taxRounding`,`string`);return typeof r==`string`&&(t.currency=r),typeof i==`number`&&(t.taxRate=i),typeof a==`string`&&(t.paymentTerms=a),(o===`inclusive`||o===`exclusive`)&&(t.pricesIncludeTax=o===`inclusive`),(s===`line`||s===`document`)&&(t.taxRounding=s),t}function Xt(e){return Q.taxRate.some(({model:t,field:n})=>typeof qt(Jt(e.policies,t,n))==`number`)}function Zt(e,t,n){let r=A(t)?.model;if(!r)return;let i=K(r,e.recipes.map(e=>Y.get(e)?.options?.[t]).find(Boolean),[]).find(e=>e.field.name===n);return i?.hasDefault?i.default:void 0}var Qt=e=>e==null||e===``;function $t(e,t){let n=e.policies.map(e=>({...e}));for(let r of Kt){let i=t[r],a=r===`paymentTerms`?String(i).trim():r===`currency`?String(i).trim().toUpperCase():r===`pricesIncludeTax`?i?`inclusive`:`exclusive`:i;for(let{model:t,field:i}of Q[r]){let o=Zt(e,t,i),s=!Qt(a)&&!(!Qt(o)&&o===a)&&!(Qt(o)&&r===`taxRate`&&a===0),c=Jt(n,t,i);if(s){let e=JSON.stringify(a);c?c.defaultValue=e:n.push({objectRef:t,fieldName:i,scopeType:`app`,defaultValue:e})}else c&&(delete c.defaultValue,Object.keys(c).length<=3&&(n=n.filter(e=>e!==c)))}}return{...e,policies:n}}function en(e){return{...Wt,...e}}var tn=()=>({ids:[],rows:[],narrowed:{},features:[],unavailableRecipes:[],unavailableFeatures:[]});function $(e){let t=new Set([...e.ids.flatMap(e=>Y.get(e)?.models??[]),...e.features]);return{...e,rows:e.rows.filter(e=>t.has(e.objectRef)||Gt(e)),narrowed:Object.fromEntries(Object.entries(e.narrowed).filter(([e])=>t.has(e)))}}var nn=(e,t)=>({...e,ids:X([...e.ids,...t],Y)});function rn(e,t){let n=new Set(t),r=e.ids.filter(e=>!n.has(e));return $({...e,ids:X(r,Y)})}var an=(e,t)=>e.features.includes(t)?e:{...e,features:[...e.features,t].sort()},on=(e,t)=>$({...e,features:e.features.filter(e=>e!==t)}),sn=(e,t)=>Ht(t,e.ids,Y);function cn(e,t){for(let n of e.ids){let e=Y.get(n)?.options?.[t];if(e)return e}}function ln(e,t,n,r){let i={...e.narrowed};return r.length?i[t]=[...r]:delete i[t],{...e,rows:[...e.rows.filter(e=>e.objectRef!==t),...n],narrowed:i}}function un(e){let t=[...e.rows].sort((e,t)=>e.objectRef.localeCompare(t.objectRef)||e.fieldName.localeCompare(t.fieldName)),n=Object.fromEntries(Object.keys(e.narrowed).sort().filter(t=>e.narrowed[t].length).map(t=>[t,[...e.narrowed[t]].sort()])),r={recipes:[...e.ids,...e.unavailableRecipes].sort(),features:[...e.features,...e.unavailableFeatures].sort(),policies:t.map(e=>({...e}))};return Object.keys(n).length&&(r.exposure=n),r}function dn(e){let t=[...new Set(e.features)],n=e=>!!A(e)?.model.exposed;return $({ids:X(e.recipes,Y),rows:e.policies.map(e=>({...e})),narrowed:Object.fromEntries(Object.entries(e.exposure??{}).map(([e,t])=>[e,[...t]])),features:t.filter(n).sort(),unavailableRecipes:[...new Set(e.recipes.filter(e=>!Y.has(e)))].sort(),unavailableFeatures:t.filter(e=>!n(e)).sort()})}var fn=new class{#e=b(C([]));get ids(){return e(this.#e)}set ids(e){k(this.#e,e,!0)}#t=b(C([]));get rows(){return e(this.#t)}set rows(e){k(this.#t,e,!0)}#n=b(C({}));get narrowed(){return e(this.#n)}set narrowed(e){k(this.#n,e,!0)}#r=b(C([]));get features(){return e(this.#r)}set features(e){k(this.#r,e,!0)}#i=b(C([]));get unavailableRecipes(){return e(this.#i)}set unavailableRecipes(e){k(this.#i,e,!0)}#a=b(C([]));get unavailableFeatures(){return e(this.#a)}set unavailableFeatures(e){k(this.#a,e,!0)}get data(){return{ids:this.ids,rows:this.rows,narrowed:this.narrowed,features:this.features,unavailableRecipes:this.unavailableRecipes,unavailableFeatures:this.unavailableFeatures}}set(e){this.ids=e.ids,this.rows=e.rows,this.narrowed=e.narrowed,this.features=e.features,this.unavailableRecipes=e.unavailableRecipes,this.unavailableFeatures=e.unavailableFeatures}removeUnavailable(){this.unavailableRecipes=[],this.unavailableFeatures=[]}hasFeature(e){return this.features.includes(e)}addFeature(e){this.set(an(this.data,e))}removeFeature(e){this.set(on(this.data,e))}has(e){return this.ids.includes(e)}requiredBy(e){return sn(this.data,e)}add(...e){this.set(nn(this.data,e))}remove(...e){this.set(rn(this.data,e))}toggle(e){this.has(e)?this.remove(e):this.add(e)}clear(){this.set(tn())}hintsFor(e){return cn(this,e)}apply(e){let t=this.hintsFor(e.id),n=K(e,t,this.rows);return{model:St(e,q(e,t,this.narrowed[e.id]??[])),resolved:n,fields:_t(n),background:vt(n)}}save(e,t,n){this.set(ln(this.data,e,t,n))}reset(e){this.save(e,[],[])}snapshot(){return un(this.data)}load(e){this.set(dn(e))}};export{he as $,Dt as A,Ye as B,yt as C,wt as D,Ct as E,nt as F,Ve as G,W as H,at as I,Ge as J,He as K,rt as L,tt as M,ot as N,Ot as O,it as P,De as Q,qe as R,Mt as S,Tt as T,ze as U,G as V,Ue as W,Be as X,We as Y,ke as Z,Rt as _,Gt as a,J as b,$t as c,X as d,R as et,jt as f,Lt as g,zt as h,Xt as i,Qe as j,q as k,Ut as l,It as m,un as n,Yt as o,Nt as p,Fe as q,Q as r,en as s,fn as t,Vt as u,Ft as v,bt as w,Y as x,Pt as y,Je as z};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{$ as e,B as t,Ct as n,D as r,Dt as i,E as a,F as o,Ft as s,G as c,H as l,J as u,K as d,L as f,Lt as p,M as m,Ot as h,P as g,Pt as _,R as v,Rt as y,T as b,U as x,W as S,X as C,Y as w,Z as T,a as E,bt as D,ct as O,d as k,ft as A,g as ee,gt as j,ht as M,j as te,mt as N,n as P,nt as F,pt as I,q as L,st as R,v as z,vt as B,z as V}from"./DG3qFFTE.js";import"./xihTtKlq.js";import{i as ne,o as H,r as U,t as re}from"./Bv5jGtB8.js";import{a as W,t as ie}from"./YUSKx8_q.js";import{_t as ae,d as oe,ft as G,h as K,xt as se,yt as q}from"./BG9Gz_25.js";import{n as ce,t as J}from"./DK8Blf1Y.js";import{n as Y,t as le}from"./M-CuJzQN.js";import{a as ue,d as de,l as fe,m as pe,o as me,s as he}from"./9pRTae44.js";import{t as X}from"./Cga8zF3r.js";import{c as ge,l as _e,n as ve,s as ye,v as be}from"./gMSmS-_y.js";import{$ as xe,Q as Se}from"./CtjBwCj8.js";var Ce=/^[A-Za-z][A-Za-z0-9]{0,31}$/,we=/^[A-Za-z_][A-Za-z0-9_.-]{0,63}$/,Te=/^(?:(?:@[a-z0-9][a-z0-9._-]*\/)?[a-z0-9][a-z0-9._-]*:)?[A-Za-z][A-Za-z0-9_]{0,63}$/,Ee=160,De=200,Oe=1e4;function ke(e){if(typeof e!=`object`||!e||Array.isArray(e))return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}function Ae(e,t){let n=new Set;for(let r of t){if(!Ce.test(r.key))throw Error(`widget "${e}": invalid option key "${r.key}"`);if(n.has(r.key))throw Error(`widget "${e}": duplicate option key "${r.key}"`);if(n.add(r.key),r.type===`enum`&&!r.choices?.length)throw Error(`widget "${e}": enum option "${r.key}" needs choices`);if(r.default!==void 0&&r.default!==null&&Me(r,r.default,void 0).issue)throw Error(`widget "${e}": default of option "${r.key}" is invalid`)}}function je(e,t){return{issue:{key:e,code:t}}}function Me(e,t,n){let{key:r}=e;switch(e.type){case`text`:case`markdown`:{if(typeof t!=`string`)return je(r,`invalid_type`);let n=e.maxLength??(e.type===`markdown`?Oe:De);return t.length>n?je(r,`too_long`):{value:t}}case`identifier`:return typeof t==`string`?we.test(t)?{value:t}:je(r,`invalid_format`):je(r,`invalid_type`);case`model`:return typeof t==`string`?t.length>Ee||!Te.test(t)?je(r,`invalid_format`):n?.models&&!n.models.includes(t)?je(r,`not_allowed`):{value:t}:je(r,`invalid_type`);case`enum`:return typeof t==`string`?e.choices?.some(e=>e.value===t)?{value:t}:je(r,`not_in_choices`):je(r,`invalid_type`);case`boolean`:return typeof t==`boolean`?{value:t}:je(r,`invalid_type`);case`integer`:case`number`:return typeof t!=`number`||!Number.isFinite(t)||e.type===`integer`&&!Number.isSafeInteger(t)?je(r,`invalid_type`):e.min!==void 0&&t<e.min||e.max!==void 0&&t>e.max?je(r,`out_of_range`):{value:t}}}function Ne(e){let t={};for(let n of e)n.default!==void 0&&n.default!==null&&(t[n.key]=n.default);return t}function Pe(e,t,n,r){if(e.default!==void 0&&e.default!==null){let i=Me(e,e.default,t);i.issue?r.push(i.issue):i.value!==void 0&&(n[e.key]=i.value)}else e.required&&r.push({key:e.key,code:`required`})}function Fe(e,t,n){let r=[],i=t==null?{}:ke(t)?t:{};if(t!=null&&!ke(t))return r.push({key:``,code:`invalid_type`}),{ok:!1,issues:r};let a=new Set(e.map(e=>e.key));for(let e of Object.keys(i))a.has(e)||r.push({key:e,code:`unknown_option`});let o={};for(let t of e){let e=Object.hasOwn(i,t.key)?i[t.key]:void 0;if(e==null||e===``&&t.type!==`text`&&t.type!==`markdown`){Pe(t,n,o,r);continue}let a=Me(t,e,n);a.issue?r.push(a.issue):a.value!==void 0&&(o[t.key]=a.value)}return r.length>0?{ok:!1,issues:r}:{ok:!0,options:o}}function Ie(e,t){let n=e??{},r=t??{},i=new Set([...Object.keys(n),...Object.keys(r)]);for(let e of i)if((n[e]??null)!==(r[e]??null))return!1;return!0}var Le=/^[A-Za-z0-9][A-Za-z0-9_-]{0,63}$/,Re=/^[A-Za-z0-9][A-Za-z0-9_.:-]{0,95}$/,ze=/^[a-z][a-z0-9-]{0,31}$/;function Be(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Ve(e){return typeof e==`number`&&Number.isInteger(e)&&e>=1&&e<=4}function He(e){if(e===void 0)return{};if(!Be(e))return null;let t={};for(let[n,r]of Object.entries(e))if(r===null||typeof r==`string`||typeof r==`boolean`||typeof r==`number`&&Number.isFinite(r))t[n]=r;else return null;return t}function Ue(e,t){let n=Be(e)&&typeof e.id==`string`?e.id:null,r=Be(e)&&typeof e.type==`string`?e.type:null,i=e=>(t.push({widgetId:n,type:r,code:`malformed`,message:e}),null);if(!Be(e))return i(`widget is not an object`);if(n===null||!Le.test(n))return i(`widget id is missing or invalid`);if(r===null)return i(`widget type is missing`);if(!Ve(e.span))return t.push({widgetId:n,type:r,code:`invalid_span`,message:`span must be an integer from 1 to 4`}),null;let a=He(e.options);if(a===null)return t.push({widgetId:n,type:r,code:`invalid_options`,message:`options must be an object of primitive values`}),null;let o={id:n,type:r,span:e.span,options:a};if(e.version!==void 0){if(typeof e.version!=`number`||!Number.isSafeInteger(e.version)||e.version<1)return i(`version must be a positive integer`);o.version=e.version}return o}function We(e){let t=[],n=[],r=Be(e)&&Array.isArray(e.widgets)?e.widgets:null;if(r===null)return e!=null&&t.push({widgetId:null,type:null,code:`malformed`,message:`overview must be an object with a widgets array`}),{document:{widgets:n},issues:t};let i=new Set;for(let e of r){let r=Ue(e,t);r&&(i.has(r.id)?t.push({widgetId:r.id,type:r.type,code:`duplicate_id`,message:`widget id appears more than once`}):(i.add(r.id),n.push(r)))}return{document:{widgets:n},issues:t}}function Ge(e){let t=[];if(e==null)return{override:null,issues:t};if(!Be(e)||e.version!==1)return t.push({widgetId:null,type:null,code:`malformed`,message:`override must be an object with version 1`}),{override:null,issues:t};let n={version:1},r=e=>{if(!Array.isArray(e))return;let t=e.filter(e=>typeof e==`string`&&Le.test(e));return[...new Set(t)]},i=r(e.order);i?.length&&(n.order=i);let a=r(e.removed);if(a?.length&&(n.removed=a),Array.isArray(e.added)){let{document:r}=We({widgets:e.added});r.widgets.length&&(n.added=r.widgets);let i=e.added.length-r.widgets.length;i>0&&t.push({widgetId:null,type:null,code:`malformed`,message:`${i} added widget(s) were malformed and dropped`})}if(Be(e.changed)){let t={};for(let[n,r]of Object.entries(e.changed)){if(!Le.test(n)||!Be(r))continue;let e={};Ve(r.span)&&(e.span=r.span);let i=r.options===void 0?void 0:He(r.options);i&&(e.options=i),typeof r.version==`number`&&Number.isSafeInteger(r.version)&&r.version>=1&&(e.version=r.version),Object.keys(e).length&&(t[n]=e)}Object.keys(t).length&&(n.changed=t)}return{override:Ke(n)?null:n,issues:t}}function Ke(e){return e===null||!e.order?.length&&!e.removed?.length&&!e.added?.length&&!Object.keys(e.changed??{}).length}function qe(e){let t={id:e.id,type:e.type,span:e.span,options:{...e.options}};return e.version!==void 0&&(t.version=e.version),t}function Je(e,t){if(Ke(t)||t===null)return{widgets:e.widgets.map(qe)};let n=new Set(t.removed??[]),r=new Set(e.widgets.map(e=>e.id)),i=[];for(let r of e.widgets){if(n.has(r.id))continue;let e=qe(r),a=t.changed?.[r.id];a&&(a.span!==void 0&&(e.span=a.span),a.options!==void 0&&(e.options={...a.options}),a.version!==void 0&&(e.version=a.version)),i.push(e)}for(let e of t.added??[])r.has(e.id)||i.push(qe(e));let a=t.order;if(a?.length){let e=new Map(i.map(e=>[e.id,e])),t=a.filter((t,n)=>e.has(t)&&a.indexOf(t)===n),n=new Set(t),r=t.map(t=>e.get(t)),o=0;return{widgets:i.map(e=>n.has(e.id)?r[o++]:e)}}return{widgets:i}}function Ye(e,t){let n=new Map(e.widgets.map(e=>[e.id,e])),r=new Set(t.widgets.map(e=>e.id)),i={version:1},a=e.widgets.filter(e=>!r.has(e.id)).map(e=>e.id);a.length&&(i.removed=a);let o=t.widgets.filter(e=>!n.has(e.id)).map(qe);o.length&&(i.added=o);let s={};for(let e of t.widgets){let t=n.get(e.id);if(!t)continue;let r={};e.span!==t.span&&(r.span=e.span);let i=(e.version??1)!==(t.version??1);(!Ie(e.options,t.options)||i)&&(r.options={...e.options},e.version!==void 0&&(r.version=e.version)),Object.keys(r).length&&(s[e.id]=r)}Object.keys(s).length&&(i.changed=s);let c=Je(e,i).widgets.map(e=>e.id),l=t.widgets.map(e=>e.id);return c.some((e,t)=>e!==l[t])&&(i.order=l),Ke(i)?null:i}function Xe(e){let t=new Set(e),n=1;for(let e of t){let t=/^w(\d+)$/.exec(e);if(!t)continue;let r=Number(t[1]);Number.isSafeInteger(r)&&r<2**53-1&&(n=Math.max(n,r+1))}for(;n<2**53-1&&t.has(`w${n}`);)n+=1;if(!t.has(`w${n}`))return`w${n}`;for(n=1;t.has(`w${n}`);n+=1);return`w${n}`}function Ze(e,{registry:t,definition:n}){let r=[],i=[],a=new Set,o=n.maxWidgets??24,s=(e,t,n,i={})=>{r.push({widgetId:e.id,type:e.type,code:t,message:n,...i})};for(let r of e.widgets){if(a.has(r.id)){s(r,`duplicate_id`,`widget id appears more than once`);continue}a.add(r.id);let e=t.get(r.type);if(!e){s(r,`unknown_type`,`widget type is not registered`);continue}if(n.allowed&&!n.allowed.includes(r.type)||e.allowedIn&&!e.allowedIn.includes(n.id)){s(r,`type_not_allowed`,`widget type is not allowed in this overview`);continue}if(i.length>=o){s(r,`too_many`,`an overview holds at most ${o} widgets`);continue}let c=r.version??1,l=r.options;if(c>e.version){s(r,`future_version`,`options were written by a newer widget version`);continue}if(c<e.version){let t=null;try{t=e.migrate?e.migrate({...r.options},c):null}catch{t=null}if(!t||!Be(t)){s(r,`migration_failed`,`no migration from version ${c}`);continue}l=t}let u=Fe(e.options,l,{models:n.models});u.ok?i.push({id:r.id,type:r.type,span:Math.min(e.maxSpan,Math.max(e.minSpan,r.span)),options:u.options,version:e.version}):s(r,`invalid_options`,`options do not match the widget schema`,{options:u.issues})}return{document:{widgets:i},issues:r}}function Qe(e,t,n){let r=Ze({widgets:[...e.defaults]},{registry:n,definition:e}),i=Ge(t),a=Ze(Je(r.document,i.override),{registry:n,definition:e});return{base:r.document,document:a.document,override:i.override,issues:[...r.issues,...i.issues,...a.issues],overrideIssues:[...i.issues,...a.issues]}}function $e(e,t,n){let r=Qe(e,t,n);return r.overrideIssues.length>0?{ok:!1,issues:r.overrideIssues}:{ok:!0,override:Ye(r.base,r.document)}}function et(e){if(!Re.test(e.id))throw Error(`defineOverview: invalid overview id "${e.id}"`);let t=new Set;for(let n of e.defaults){if(!Le.test(n.id)||t.has(n.id))throw Error(`defineOverview: invalid or duplicate widget id "${n.id}"`);t.add(n.id)}return Object.freeze({...e,defaults:Object.freeze([...e.defaults])})}function tt(e){if(!ze.test(e.type))throw Error(`registerWidget: invalid widget type "${e.type}"`);let t=e.version??1;if(!Number.isSafeInteger(t)||t<1)throw Error(`widget "${e.type}": version must be a positive integer`);let n=e.minSpan??1,r=e.maxSpan??4;if(!Number.isInteger(n)||!Number.isInteger(r)||n<1||r>4||n>r)throw Error(`widget "${e.type}": invalid span range`);let i=Math.min(r,Math.max(n,e.defaultSpan??n));for(let t of e.allowedIn??[])if(!Re.test(t))throw Error(`widget "${e.type}": invalid allowedIn id "${t}"`);return Ae(e.type,e.options),Object.freeze({...e,options:Object.freeze([...e.options]),version:t,defaultSpan:i,minSpan:n,maxSpan:r})}var nt=class{#e=new Map;register(e,t={}){let n=tt(e);if(this.#e.has(e.type)&&!t.replace)throw Error(`registerWidget: "${e.type}" is already registered`);return this.#e.set(e.type,n),()=>{this.#e.get(e.type)===n&&this.#e.delete(e.type)}}get(e){return this.#e.get(e)}has(e){return this.#e.has(e)}types(){return[...this.#e.keys()]}list(){return[...this.#e.values()]}};function rt(){return new nt}var it=rt();function at(e){return JSON.stringify([e.type,e.version??1,e.options])}var ot=class{#e;#t;#n=D(null);#r=D({});#i=new Map;#a=null;#o=n(()=>{let t=Qe(this.#e.definition,this.#e.override?this.#e.override():e(this.#n),this.#t);return this.#c(Ye(t.base,t.document)),t});constructor(e){this.#e=e,this.#t=e.registry??it;let t=typeof e.loaded==`function`?e.loaded():e.loaded;t&&this.#s(t)}#s(e){let t={};for(let n of e.widgets)t[n.id]={key:at(n),status:n.status,data:n.data,error:n.error?.code};B(this.#r,t)}get definition(){return this.#e.definition}get registry(){return this.#t}get document(){return e(this.#o).document}get base(){return e(this.#o).base}get override(){return Ye(e(this.#o).base,e(this.#o).document)}get committedOverride(){let e=this.override;this.#c(e);let t=this.#a;return t?t.values.at(-1):e}#c(e){let t=this.#a;if(!t||st(e,t.prior))return;let n=t.values.findIndex(t=>st(t,e));this.#a=n<0||n===t.values.length-1?null:{prior:e,values:t.values.slice(n+1)}}#l(e){if(this.#e.override){let t=this.override;this.#c(t);let n=this.#a;this.#a=n?{prior:n.prior,values:[...n.values,e]}:{prior:t,values:[e]}}else B(this.#n,e);this.#e.onchange?.(e)}get issues(){return e(this.#o).issues}get customized(){return!Ke(this.override)}get canCustomize(){return!this.#e.canCustomize||this.#e.canCustomize()}get full(){let e=this.#e.definition.maxWidgets??24;return this.document.widgets.length>=e}get addable(){let{allowed:e,id:t}=this.#e.definition;return this.#t.list().filter(n=>(!e||e.includes(n.type))&&(!n.allowedIn||n.allowedIn.includes(t)))}entry(t){let n=e(this.#r)[t.id];return n&&n.key===at(t)?n:{status:this.#e.loadWidget?`loading`:`ready`}}#u(){return this.#e.definition.models}#d(){return this.canCustomize?null:{ok:!1,reason:`not_allowed`}}#f(t,n){let r=Ze(t,{registry:this.#t,definition:this.#e.definition}),i=Ye(e(this.#o).base,r.document);return st(i,this.committedOverride)?{ok:!1,reason:`unchanged`}:(this.#l(i),this.#h(r.document.widgets),{ok:!0,id:n})}#p(){let t=this.override;return[...e(this.#o).base.widgets.map(e=>e.id),...this.document.widgets.map(e=>e.id),...t?.removed??[],...(t?.added??[]).map(e=>e.id)]}add(e,t={}){let n=this.#d();if(n)return n;let r=this.addable.find(t=>t.type===e);if(!r)return{ok:!1,reason:`unknown_type`};if(this.full)return{ok:!1,reason:`limit`};let i=Fe(r.options,{...Ne(r.options),...t},{models:this.#u()});if(!i.ok)return{ok:!1,reason:`invalid_options`,issues:i.issues};let a=Xe(this.#p());return this.#f({widgets:[...this.document.widgets,{id:a,type:e,span:r.defaultSpan,options:i.options,version:r.version}]},a)}#m(e){return this.document.widgets.find(t=>t.id===e)}remove(e){return this.#d()||(this.#m(e)?this.#f({widgets:this.document.widgets.filter(t=>t.id!==e)},e):{ok:!1,reason:`unknown_widget`})}move(e,t){let n=this.#d();if(n)return n;let r=this.#m(e);if(!r)return{ok:!1,reason:`unknown_widget`};let i=this.document.widgets.filter(t=>t.id!==e),a=Math.max(0,Math.min(t,i.length));return i.splice(a,0,r),this.#f({widgets:i},e)}resize(e,t){return this.#d()||(this.#m(e)?this.#f({widgets:this.document.widgets.map(n=>n.id===e?{...n,span:Math.round(t)}:n)},e):{ok:!1,reason:`unknown_widget`})}setOptions(e,t){let n=this.#d();if(n)return n;let r=this.#m(e),i=r?this.#t.get(r.type):void 0;if(!r||!i)return{ok:!1,reason:`unknown_widget`};let a=Fe(i.options,t,{models:this.#u()});return a.ok?this.#f({widgets:this.document.widgets.map(t=>t.id===e?{...t,options:a.options,version:i.version}:t)},e):{ok:!1,reason:`invalid_options`,issues:a.issues}}resetWidget(t){let n=this.#d();if(n)return n;let r=e(this.#o).base.widgets.find(e=>e.id===t);return r?this.#f({widgets:this.document.widgets.some(e=>e.id===t)?this.document.widgets.map(e=>e.id===t?{...r}:e):[...this.document.widgets,{...r}]},t):this.remove(t)}reset(){return this.#d()||(Ke(this.committedOverride)?{ok:!1,reason:`unchanged`}:(this.#l(null),this.#h(e(this.#o).base.widgets),{ok:!0,id:``}))}restore(e){let t=this.#d();if(t)return t;let{override:n}=Ge(e),r=Qe(this.#e.definition,n,this.#t),i=Ye(r.base,r.document);return st(i,this.committedOverride)?{ok:!1,reason:`unchanged`}:(this.#l(i),this.#h(r.document.widgets),{ok:!0,id:``})}reload(e){let t=this.#m(e);t&&this.#g(t)}sync(){this.#h(this.document.widgets)}#h(t){F(()=>{let n=new Set(t.map(e=>e.id)),r={};for(let[t,i]of Object.entries(e(this.#r)))n.has(t)&&(r[t]=i);for(let[e,t]of this.#i)n.has(e)||(t.abort(),this.#i.delete(e));if(B(this.#r,r),this.#e.loadWidget)for(let n of t){let t=e(this.#r)[n.id];(!t||t.key!==at(n))&&this.#g(n)}})}#g(t){let n=this.#e.loadWidget;if(!n)return;let r=at(t);this.#i.get(t.id)?.abort();let i=new AbortController;this.#i.set(t.id,i),B(this.#r,{...e(this.#r),[t.id]:{key:r,status:`loading`}});let a=n=>{i.signal.aborted||(this.#i.get(t.id)===i&&this.#i.delete(t.id),e(this.#r)[t.id]?.key===r&&B(this.#r,{...e(this.#r),[t.id]:{key:r,...n}}))};Promise.resolve().then(()=>i.signal.aborted?void 0:n(t,i.signal)).then(e=>a({status:`ready`,data:e}),()=>a({status:`error`,error:`load_failed`}))}destroy(){for(let e of this.#i.values())e.abort();this.#i.clear()}};function st(e,t){return JSON.stringify(e??null)===JSON.stringify(t??null)}function ct(e){return new ot(e)}function lt(e){return J.get(e.trim().toUpperCase())??2}var ut=`–`;function dt(e){try{return Intl.getCanonicalLocales(e)[0]??`en`}catch{return`en`}}function ft(e,{format:t=`integer`,currency:n=`USD`,locale:r}){if(typeof e!=`number`||!Number.isFinite(e))return ut;let i=dt(r);switch(t){case`money`:{let t=/^[A-Za-z]{3}$/.test(n)?n.toUpperCase():`USD`,r=lt(t);return new Intl.NumberFormat(i,{style:`currency`,currency:t}).format(e/10**r)}case`percent`:return new Intl.NumberFormat(i,{style:`percent`,maximumFractionDigits:1}).format(e);case`decimal`:return new Intl.NumberFormat(i,{maximumFractionDigits:2}).format(e);default:return new Intl.NumberFormat(i,{maximumFractionDigits:0}).format(e)}}var pt=200,mt=4,ht=2e4;function gt(e){let t=e.trim();if(!t||t.length>2048||/[\u0000-\u001f\u007f\s<>"'`\\]/.test(t))return null;if(/^https?:\/\//i.test(t))try{return new URL(t),t}catch{return null}return/^mailto:[^\s?]+(\?.*)?$/i.test(t)||t.startsWith(`#`)||t.startsWith(`/`)&&!t.startsWith(`//`)?t:null}var _t=e=>e!==void 0&&/[A-Za-z0-9]/.test(e);function vt(e,t){let n=[],r=``,i=()=>{r&&n.push({type:`text`,text:r}),r=``},a=0;for(;a<e.length;){let o=e[a];if(o===`\\`&&a+1<e.length&&/[\\`*_[\]()#>-]/.test(e[a+1]))r+=e[a+1],a+=2;else{if(o==="`"){let t=e.indexOf("`",a+1);if(t>a+1){i(),n.push({type:`code`,text:e.slice(a+1,t)}),a=t+1;continue}}if(t<mt&&e.startsWith(`**`,a)){let r=e.indexOf(`**`,a+2);if(r>a+2){i(),n.push({type:`strong`,children:vt(e.slice(a+2,r),t+1)}),a=r+2;continue}}if(t<mt&&(o===`*`||o===`_`)&&e[a+1]!==` `&&!(o===`_`&&_t(e[a-1]))){let r=e.indexOf(o,a+1);if(r>a+1&&e[r-1]!==` `&&!(o===`_`&&_t(e[r+1]))){i(),n.push({type:`em`,children:vt(e.slice(a+1,r),t+1)}),a=r+1;continue}}if(o===`[`&&t<mt){let r=e.indexOf(`](`,a+1),o=r>0?e.indexOf(`)`,r+2):-1;if(r>0&&o>0){let s=e.slice(a+1,r),c=gt(e.slice(r+2,o));i(),c?n.push({type:`link`,href:c,children:vt(s,t+1)}):n.push(...vt(s,t+1)),a=o+1;continue}}r+=o,a+=1}}return i(),n}function yt(e){let t=e.slice(0,ht).replace(/\r\n?/g,`
|
|
2
|
+
`).split(`
|
|
3
|
+
`),n=[],r=[],i=null,a=()=>{r.length&&n.push({type:`paragraph`,children:vt(r.join(` `),0)}),r=[]},o=()=>{i&&n.push({type:`list`,...i}),i=null};for(let e=0;e<t.length&&n.length<pt;e+=1){let s=t[e];if(/^\s*```/.test(s)){a(),o();let r=[];for(e+=1;e<t.length&&!/^\s*```/.test(t[e]);)r.push(t[e]),e+=1;n.push({type:`code`,text:r.join(`
|
|
4
|
+
`)});continue}if(s.trim()===``){a(),o();continue}let c=/^(#{1,3})\s+(.*\S)\s*$/.exec(s);if(c){a(),o(),n.push({type:`heading`,level:c[1].length,children:vt(c[2],0)});continue}let l=/^\s*[-*]\s+(.*\S)\s*$/.exec(s),u=/^\s*\d+[.)]\s+(.*\S)\s*$/.exec(s);if(l||u){a();let e=u!==null;i&&i.ordered!==e&&o(),i??={ordered:e,items:[]},i.items.push(vt((l??u)?.[1]??``,0));continue}let d=/^\s*>\s?(.*)$/.exec(s);d?(a(),o(),n.push({type:`quote`,children:vt(d[1],0)})):(o(),r.push(s.trim()))}return a(),o(),n.slice(0,pt)}var Z=W({"ui.overview.label":`Overview widgets`,"ui.overview.empty":`There are no widgets on this overview yet.`,"ui.overview.toolbar":`Customize overview`,"ui.overview.add":`Add widget`,"ui.overview.add_title":`Add a widget`,"ui.overview.add_none":`No more widgets can be added to this overview.`,"ui.overview.reset":`Reset overview to default`,"ui.overview.move":`Move {widget}`,"ui.overview.resize":`Resize {widget}`,"ui.overview.resize_value":`{span} of {max} columns`,"ui.overview.configure":`Configure {widget}`,"ui.overview.remove":`Remove {widget}`,"ui.overview.item":`{widget}, position {position} of {count}`,"ui.overview.announce_pickup":`Picked up {widget}. Use the arrow keys to choose a position, then Space or Enter to drop. Escape cancels.`,"ui.overview.announce_position":`{widget}, position {position} of {count}.`,"ui.overview.announce_drop":`Moved {widget} to position {position} of {count}.`,"ui.overview.announce_cancel":`Cancelled moving {widget}.`,"ui.overview.announce_failed":`Could not move {widget}. The order was restored.`,"ui.overview.announce_resized":`{widget} is now {span} of {max} columns wide.`,"ui.overview.announce_removed":`Removed {widget}.`,"ui.overview.announce_added":`Added {widget}.`,"ui.overview.announce_configured":`Updated {widget}.`,"ui.overview.announce_reset":`Overview reset to its default.`,"ui.overview.announce_denied":`You cannot change this overview.`,"ui.overview.assistant_applied":`The assistant updated this overview.`,"ui.overview.assistant_undo":`Undo`,"ui.overview.assistant_dismiss":`Dismiss`,"ui.overview.assistant_undone":`The assistant change was undone.`,"ui.overview.assistant_changed_since":`The overview changed after the assistant edit, so it was not undone.`,"ui.overview.assistant_undo_failed":`The assistant change could not be undone.`,"ui.overview.loading":`Loading`,"ui.overview.error":`This widget could not be loaded.`,"ui.overview.retry":`Try again`,"ui.overview.unavailable":`This widget is not available.`,"ui.overview.no_data":`Nothing to show yet.`,"ui.overview.options_title":`Configure {widget}`,"ui.overview.options_new_title":`Add {widget}`,"ui.overview.options_save":`Save`,"ui.overview.options_cancel":`Cancel`,"ui.overview.options_none":`This widget has no options.`,"ui.overview.options_choose":`Choose`,"ui.overview.options_failed":`Some options need attention.`,"ui.overview.issue_required":`This field is required.`,"ui.overview.issue_invalid_type":`This value is not valid.`,"ui.overview.issue_too_long":`This value is too long.`,"ui.overview.issue_out_of_range":`This value is out of range.`,"ui.overview.issue_not_in_choices":`Choose one of the listed values.`,"ui.overview.issue_invalid_format":`Use letters, digits and the simple separators only.`,"ui.overview.issue_not_allowed":`This is not available on this overview.`,"ui.overview.issue_unknown_option":`This option is not recognised.`,"ui.overview.widget.metric.title":`Metric`,"ui.overview.widget.metric.description":`One number, such as a count or a total.`,"ui.overview.widget.chart.title":`Chart`,"ui.overview.widget.chart.description":`Values grouped over a period, as bars or a line.`,"ui.overview.widget.records.title":`Record list`,"ui.overview.widget.records.description":`The latest or top records of a model.`,"ui.overview.widget.line_items.title":`Line items`,"ui.overview.widget.line_items.description":`A document's lines with their totals.`,"ui.overview.widget.related.title":`Related records`,"ui.overview.widget.related.description":`Records linked to this one, a tab per kind, with totals.`,"ui.overview.widget.shortcuts.title":`Shortcuts`,"ui.overview.widget.shortcuts.description":`Cards that link to a section’s pages.`,"ui.overview.widget.note.title":`Note`,"ui.overview.widget.note.description":`Text with simple formatting.`,"ui.overview.opt.title":`Title`,"ui.overview.opt.title_help":`Shown above the widget. Leave empty for the default.`,"ui.overview.opt.model":`Model`,"ui.overview.opt.model_help":`Which records the widget reads.`,"ui.overview.opt.measure":`Measure`,"ui.overview.opt.measure_count":`Count`,"ui.overview.opt.measure_sum":`Sum`,"ui.overview.opt.measure_avg":`Average`,"ui.overview.opt.measure_min":`Smallest`,"ui.overview.opt.measure_max":`Largest`,"ui.overview.opt.field":`Field`,"ui.overview.opt.field_help":`The field to sum or average.`,"ui.overview.opt.filter":`Filter`,"ui.overview.opt.filter_help":`A named filter the data source offers.`,"ui.overview.opt.group_by":`Group by`,"ui.overview.opt.period":`Period`,"ui.overview.opt.period_7d":`Last 7 days`,"ui.overview.opt.period_30d":`Last 30 days`,"ui.overview.opt.period_90d":`Last 90 days`,"ui.overview.opt.period_12m":`Last 12 months`,"ui.overview.opt.period_all":`All time`,"ui.overview.opt.style":`Style`,"ui.overview.opt.style_bar":`Bars`,"ui.overview.opt.style_line":`Line`,"ui.overview.opt.style_table":`Table`,"ui.overview.opt.style_pie":`Donut`,"ui.overview.opt.style_stat":`Headline number`,"ui.overview.opt.sort":`Sort by`,"ui.overview.opt.direction":`Direction`,"ui.overview.opt.direction_desc":`Newest or largest first`,"ui.overview.opt.direction_asc":`Oldest or smallest first`,"ui.overview.opt.limit":`Rows`,"ui.overview.opt.parent_field":`Link to this record`,"ui.overview.opt.parent_field_help":`With the parent filter: the field that points at this record, when Field is the one to measure.`,"ui.overview.opt.relation":`Relation`,"ui.overview.opt.relation_help":`The line-item relation to show, as its key (OrderLine-orderId). Leave empty for the first one.`,"ui.overview.opt.relations":`Relations`,"ui.overview.opt.relations_help":`Which related records get a tab, as relation keys separated by commas (Order-customerId). Leave empty for all of them.`,"ui.overview.opt.columns":`Columns`,"ui.overview.opt.columns_help":`Field names to show as columns, separated by commas. Leave empty for a plain list.`,"ui.overview.opt.summaries":`Totals row`,"ui.overview.opt.summaries_help":`Count the rows and add up money and quantity columns. On by default when there are such columns.`,"ui.overview.opt.section":`Section`,"ui.overview.opt.section_help":`The navigation section whose pages are shown.`,"ui.overview.opt.body":`Text`,"ui.overview.opt.body_help":`Supports headings, lists, bold, italic, code and links.`,"ui.overview.metric.change_up":`Up {value} from the previous period`,"ui.overview.metric.change_down":`Down {value} from the previous period`,"ui.overview.chart.summary":`Chart with {count} values`,"ui.overview.chart.table":`Chart data`,"ui.overview.chart.label_column":`Label`,"ui.overview.chart.value_column":`Value`,"ui.overview.records.empty":`No records to show.`,"ui.overview.records.view_all":`View all`,"ui.overview.records.total":`{count} in total`,"ui.overview.table.total":`Total`,"ui.overview.related.empty":`No related records yet.`,"ui.overview.line_items.empty":`No line items.`,"ui.overview.line_items.subtotal":`Subtotal`,"ui.overview.line_items.discount":`Discount`,"ui.overview.line_items.tax":`Tax`,"ui.overview.line_items.total":`Total`,"ui.overview.line_items.subtotal_excluding_tax":`Subtotal (excl. tax)`,"ui.overview.line_items.discount_included":`Includes discounts of`,"ui.overview.line_items.tax_on":`{label} on`,"ui.overview.line_items.tax_included":`Includes {label} of`,"ui.overview.line_items.rounded_document":`Rounded per document`,"ui.overview.line_items.computed":`(from the lines)`,"ui.overview.line_items.mismatch":`Lines add up to {amount}.`,"ui.overview.line_items.mismatch_subtotal":`The recorded subtotal is {amount}.`,"ui.overview.line_items.mismatch_total":`The recorded total is {amount}.`,"ui.overview.shortcuts.empty":`No pages to show.`,"ui.overview.shortcuts.records_one":`{count} record`,"ui.overview.shortcuts.records_other":`{count} records`,"ui.cookbook.menu_entries":`Menu entries`,"ui.cookbook.section_not_found":`Section not found`,"ui.cookbook.section_not_found_hint":`This section is not in your app.`});function bt(e){let{pointer:t,start:n,rtl:r,gridWidth:i,gap:a,min:o,max:s}=e,c=Math.max(1,Math.floor(e.columns)),l=r?n-t:t-n,u=(i-a*(c-1))/c,d=u+a>0?Math.round((l+a)/(u+a)):o;return Math.max(o,Math.min(s,c,d))}function xt(e,t,n,r,i){let a;switch(e){case`ArrowRight`:a=t+(i?-1:1);break;case`ArrowLeft`:a=t+(i?1:-1);break;case`ArrowUp`:a=t+1;break;case`ArrowDown`:a=t-1;break;case`Home`:a=n;break;case`End`:a=r;break;default:return null}return Math.max(n,Math.min(r,a))}var St=c(`<p class="smrt-widget-form__none svelte-1jw9hhr"> </p>`),Ct=c(`<small class="smrt-widget-form__hint svelte-1jw9hhr"> </small>`),wt=c(`<small class="smrt-widget-form__error svelte-1jw9hhr" role="alert"> </small>`),Tt=c(`<div class="smrt-widget-form__check svelte-1jw9hhr"><!> <!> <!></div>`),Et=c(`<option> </option>`),Dt=c(`<!> <!>`,1),Ot=c(`<option> </option> <!> <!>`,1),kt=c(`<!> <!> <!> <!>`,1);function At(r,a){h(a,!0);let{t:o}=ie(),c=n(()=>a.definition.options);function d(){let e={},t={};for(let n of a.definition.options){let r=a.initial[n.key];n.type===`boolean`?t[n.key]=r===!0:e[n.key]=r==null?``:String(r)}return{text:e,flags:t}}let p=F(d),m=j(p.text),v=j(p.flags),y=D(j({})),b=D(!1);function C(){let t={};for(let n of e(c)){if(n.type===`boolean`){t[n.key]=v[n.key]===!0;continue}let e=m[n.key]??``;n.type===`markdown`?t[n.key]=e:e.trim()===``||(n.type===`integer`||n.type===`number`?t[n.key]=Number(e):t[n.key]=e.trim())}return t}let w={required:Z[`ui.overview.issue_required`],invalid_type:Z[`ui.overview.issue_invalid_type`],too_long:Z[`ui.overview.issue_too_long`],out_of_range:Z[`ui.overview.issue_out_of_range`],not_in_choices:Z[`ui.overview.issue_not_in_choices`],invalid_format:Z[`ui.overview.issue_invalid_format`],not_allowed:Z[`ui.overview.issue_not_allowed`],unknown_option:Z[`ui.overview.issue_unknown_option`]};function T(e){return o(w[e]??Z[`ui.overview.issue_invalid_type`])}function E(){let e=C(),t=a.onsave(e);if(t===null)return;let n={};for(let e of t)n[e.key]??=T(e.code);B(y,n,!0),B(b,!0)}let O=e=>o(e.label),k=e=>e.help?o(e.help):void 0,ee=e=>!e.required&&(e.default===void 0||e.default===null),te=n(()=>new Set((a.models??[]).map(e=>e.value))),P=n(()=>a.optionsEditor??a.definition.optionsEditor);var L=S(),z=I(L),V=t=>{var n=S(),r=I(n);g(r,()=>e(P),(e,t)=>{t(e,{get definition(){return a.definition},get initial(){return a.initial},get models(){return a.models},get onsave(){return a.onsave},get oncancel(){return a.oncancel}})}),x(t,n)},ne=r=>{_e(r,{onsubmit:E,novalidate:!0,children:(r,i)=>{var d=kt(),p=I(d),h=e=>{H(e,{variant:`error`,children:(e,t)=>{_();var n=u();R(e=>l(n,e),[()=>o(Z[`ui.overview.options_failed`])]),x(e,n)},$$slots:{default:!0}})};t(p,t=>{e(b)&&t(h)});var g=M(p,2),C=e=>{var t=St(),n=N(t,!0);R(e=>l(n,e),[()=>o(Z[`ui.overview.options_none`])]),x(e,t)};t(g,t=>{e(c).length===0&&t(C)});var w=M(g,2);f(w,17,()=>e(c),e=>e.key,(r,i)=>{var c=S(),u=I(c),d=r=>{var a=Tt(),o=A(a),c=()=>v[e(i).key]===!0,u=t=>v[e(i).key]=t;{let t=n(()=>O(e(i)));Y(o,{get name(){return e(i).key},get label(){return e(t)},get checked(){return c()},set checked(e){u(e)}})}var d=M(o,2),f=t=>{var n=Ct(),r=N(n,!0);R(e=>l(r,e),[()=>k(e(i))]),x(t,n)},p=n(()=>k(e(i)));t(d,t=>{e(p)&&t(f)});var m=M(d,2),h=t=>{var n=wt(),r=N(n,!0);R(()=>l(r,e(y)[e(i).key])),x(t,n)};t(m,t=>{e(y)[e(i).key]&&t(h)}),s(a),x(r,a)},p=r=>{{let s=n(()=>O(e(i))),c=n(()=>k(e(i)));ye(r,{get label(){return e(s)},get hint(){return e(c)},get error(){return e(y)[e(i).key]},get required(){return e(i).required},children:(r,s)=>{var c=S(),u=I(c),d=t=>{var n=()=>m[e(i).key]??``,r=t=>m[e(i).key]=t;ve(t,{get name(){return e(i).key},rows:6,get value(){return n()},set value(e){r(e)}})},p=r=>{var a=()=>m[e(i).key]??``,s=t=>m[e(i).key]=t;be(r,{get name(){return e(i).key},get value(){return a()},set value(e){s(e)},children:(r,a)=>{var s=Dt(),c=I(s),u=e=>{var t=Et(),n=N(t,!0);t.value=t.__value=``,R(e=>l(n,e),[()=>o(Z[`ui.overview.options_choose`])]),x(e,t)},d=n(()=>ee(e(i)));t(c,t=>{e(d)&&t(u)});var p=M(c,2);f(p,17,()=>e(i).choices??[],e=>e.value,(t,n)=>{var r=Et(),i=N(r,!0),a={};R(t=>{l(i,t),a!==(a=e(n).value)&&(r.value=(r.__value=a)??``)},[()=>o(e(n).label)]),x(t,r)}),x(r,s)},$$slots:{default:!0}})},h=r=>{var s=()=>m[e(i).key]??``,c=t=>m[e(i).key]=t;be(r,{get name(){return e(i).key},get value(){return s()},set value(e){c(e)},children:(r,s)=>{var c=Ot(),u=I(c),d=N(u,!0);u.value=u.__value=``;var p=M(u,2),h=t=>{var n=Et(),r=N(n,!0),a={};R(()=>{l(r,m[e(i).key]),a!==(a=m[e(i).key])&&(n.value=(n.__value=a)??``)}),x(t,n)},g=n(()=>m[e(i).key]&&!e(te).has(m[e(i).key]));t(p,t=>{e(g)&&t(h)});var _=M(p,2);f(_,17,()=>a.models,e=>e.value,(t,n)=>{var r=Et(),i=N(r,!0),a={};R(()=>{l(i,e(n).label),a!==(a=e(n).value)&&(r.value=(r.__value=a)??``)}),x(t,r)}),R(e=>l(d,e),[()=>o(Z[`ui.overview.options_choose`])]),x(r,c)},$$slots:{default:!0}})},g=t=>{var r=()=>m[e(i).key]??``,a=t=>m[e(i).key]=String(t);{let o=n(()=>e(i).type===`integer`||e(i).type===`number`?`number`:`text`),s=n(()=>e(i).type===`integer`?`1`:e(i).type===`number`?`any`:void 0),c=n(()=>e(i).type===`text`?e(i).maxLength??200:void 0);le(t,{get name(){return e(i).key},get type(){return e(o)},get step(){return e(s)},get min(){return e(i).min},get max(){return e(i).max},get maxlength(){return e(c)},get value(){return r()},set value(e){a(e)}})}};t(u,t=>{e(i).type===`markdown`?t(d):e(i).type===`enum`?t(p,1):e(i).type===`model`&&a.models&&a.models.length>0?t(h,2):t(g,-1)}),x(r,c)},$$slots:{default:!0}})}};t(u,t=>{e(i).type===`boolean`?t(d):t(p,-1)}),x(r,c)});var T=M(w,2);ge(T,{children:(e,t)=>{var n=Dt(),r=I(n);ce(r,{type:`button`,variant:`ghost`,get onclick(){return a.oncancel},children:(e,t)=>{_();var n=u();R(e=>l(n,e),[()=>o(Z[`ui.overview.options_cancel`])]),x(e,n)},$$slots:{default:!0}});var i=M(r,2);ce(i,{type:`submit`,variant:`primary`,children:(e,t)=>{_();var n=u();R(e=>l(n,e),[()=>o(Z[`ui.overview.options_save`])]),x(e,n)},$$slots:{default:!0}}),x(e,n)},$$slots:{default:!0}}),x(r,d)},$$slots:{default:!0}})};t(z,t=>{e(P)?t(V):t(ne,-1)}),x(r,L),i()}var jt=c(`<p class="smrt-overview__state svelte-1liasmg"> </p>`),Mt=c(`<p class="smrt-overview__state svelte-1liasmg" role="status"> </p> <!>`,1),Nt=c(`<article class="smrt-overview__widget svelte-1liasmg"><!> <div class="smrt-overview__content"><!></div></article>`),Pt=c(`<div class="smrt-overview__toolbar svelte-1liasmg" role="toolbar"><!> <!></div>`),Ft=c(`<p class="smrt-overview__empty svelte-1liasmg"> </p>`),It=c(`<div class="smrt-overview__resize svelte-1liasmg" role="slider" tabindex="0" aria-orientation="horizontal"></div>`),Lt=c(`<div class="smrt-overview__chrome svelte-1liasmg"><button type="button" class="smrt-overview__handle svelte-1liasmg" data-smrt-overview-handle=""><span aria-hidden="true">⠿</span></button> <span class="smrt-overview__chrome-title svelte-1liasmg" aria-hidden="true"> </span> <!> <!></div> <div class="smrt-overview__inert" inert=""><!></div> <!>`,1),Rt=c(`<div role="listitem" class="smrt-overview__item svelte-1liasmg"><div class="smrt-overview__tile svelte-1liasmg"><!></div></div>`),zt=c(`<p> </p>`),Bt=c(`<small class="svelte-1liasmg"> </small>`),Vt=c(`<span class="smrt-overview__choice svelte-1liasmg"><!> <span class="smrt-overview__choice-text svelte-1liasmg"><strong> </strong> <!></span></span>`),Ht=c(`<li><!></li>`),Ut=c(`<ul class="smrt-overview__choices svelte-1liasmg"></ul>`),Wt=c(`<!> <!>`,1),Gt=c(`<div class="smrt-overview svelte-1liasmg" data-smrt-component="OverviewGrid"><!> <!> <div class="smrt-overview__list svelte-1liasmg" role="list"></div> <div class="smrt-overview__live svelte-1liasmg" role="status" aria-live="polite" aria-atomic="true"> </div></div> <!>`,1);function Kt(r,a){let c=L();h(a,!0);let d=(r,i=p)=>{let d=n(()=>a.components?.get(i().widget.type)??i().def?.component);var f=Nt(),m=A(f);te(m,()=>e(Ie),!1,(e,n)=>{ee(e,()=>({class:`smrt-overview__title`,id:`${c}-title-${i().widget.id??``}`}),void 0,void 0,void 0,`svelte-1liasmg`);var r=S(),s=I(r),d=e=>{var t=S(),n=I(t);o(n,()=>a.heading,()=>i().widget,()=>i().title),x(e,t)},f=e=>{var t=u();R(()=>l(t,i().title)),x(e,t)};t(s,e=>{a.heading?e(d):e(f,-1)}),x(n,r)});var h=M(m,2),v=A(h),b=e=>{var t=jt(),n=N(t,!0);R(e=>l(n,e),[()=>w(Z[`ui.overview.unavailable`])]),x(e,t)},C=e=>{var t=jt(),n=N(t,!0);R(e=>l(n,e),[()=>w(Z[`ui.overview.loading`])]),x(e,t)},T=e=>{var t=Mt(),n=I(t),r=N(n,!0),o=M(n,2);ce(o,{type:`button`,variant:`ghost`,size:`sm`,onclick:()=>a.controller.reload(i().widget.id),children:(e,t)=>{_();var n=u();R(e=>l(n,e),[()=>w(Z[`ui.overview.retry`])]),x(e,n)},$$slots:{default:!0}}),R(e=>l(r,e),[()=>w(Z[`ui.overview.error`])]),x(e,t)},E=t=>{var r=S(),o=I(r);{let t=n(()=>be(i())),r=n(()=>e(H)?`card`:y());g(o,()=>e(d),(n,o)=>{o(n,{get id(){return i().widget.id},get options(){return i().widget.options},get data(){return i().data},get span(){return e(t)},get title(){return i().title},get locale(){return j},get iconComponent(){return a.iconComponent},get presentation(){return e(r)}})})}x(t,r)},D=e=>{var t=jt(),n=N(t,!0);R(e=>l(n,e),[()=>w(Z[`ui.overview.unavailable`])]),x(e,t)};t(v,t=>{i().def?i().status===`loading`?t(C,1):i().status===`error`?t(T,2):e(d)?t(E,3):t(D,-1):t(b)}),s(h),s(f),R(()=>{z(f,`aria-labelledby`,`${c}-title-${i().widget.id??``}`),z(h,`aria-busy`,i().status===`loading`)}),x(r,f)},v=E(a,`headingLevel`,3,2),y=E(a,`presentation`,3,`card`),{t:w,locale:j}=ie(),P=`__smrt-overview__`,ne=fe(),H=n(()=>a.controller.canCustomize&&(a.editing??ne?.editing??!1)),re=n(()=>a.label??w(Z[`ui.overview.label`])),W=n(()=>a.controller.registry),ae=n(()=>a.controller.document.widgets.map(t=>{let n=e(W).get(t.type),r=typeof t.options.title==`string`?t.options.title.trim():``,i=a.controller.entry(t);return{widget:t,def:n,title:r||(n?w(n.title):t.type),status:i.status,data:i.data}})),oe=n(()=>new Map(e(ae).map(e=>[e.widget.id,e])));O(()=>{a.controller.document,F(()=>a.controller.sync())});let G=D(void 0),K=D(void 0),se=D(``),q=D(null),J=D(!1),Y=D(null);function le(e){B(se,e,!0)}function pe(e){switch(e.type){case`pickup`:return w(Z[`ui.overview.announce_pickup`],{widget:e.item});case`position`:return w(Z[`ui.overview.announce_position`],{widget:e.item,position:e.position,count:e.count});case`drop`:return w(Z[`ui.overview.announce_drop`],{widget:e.item,position:e.position,count:e.count});case`cancel`:return w(Z[`ui.overview.announce_cancel`],{widget:e.item});case`failed`:return w(Z[`ui.overview.announce_failed`],{widget:e.item});default:return``}}let X=ue({root:()=>e(G),selectors:{container:`[data-smrt-overview-list]`,containerKey:`smrtOverviewList`,item:`[data-smrt-overview-item]`,itemKey:`smrtOverviewItem`},containers:()=>[{id:P,label:e(re)}],itemIds:()=>e(ae).map(e=>e.widget.id),itemLabel:t=>e(oe).get(t)?.title,allowSameContainerReorder:()=>!0,enabled:()=>e(H),orientation:()=>`vertical`,flow:()=>!0,announce:pe,focusTarget:e=>e.querySelector(`[data-smrt-overview-handle]`),commit(e){let t=a.controller.move(e.itemId,e.target.index);if(!t.ok&&t.reason!==`unchanged`)throw Error(t.reason)}}),ge=n(()=>X.drag?.itemId),_e=n(()=>X.drag?.target.index),ve=n(()=>e(ae).filter(t=>t.widget.id!==e(ge)).length);function ye(t){if(e(_e)===void 0||e(ge)===void 0||e(ae)[t].widget.id===e(ge))return;let n=0;for(let r=0;r<t;r+=1)e(ae)[r].widget.id!==e(ge)&&(n+=1);if(n===e(_e))return`before`;if(e(_e)>=e(ve)&&n===e(ve)-1)return`after`}function be(t){return e(q)?.id===t.widget.id?e(q).span:t.widget.span}function xe(){return e(G)!==void 0&&getComputedStyle(e(G)).direction===`rtl`}function Se(e,t){let n=a.controller.resize(e.widget.id,t);n.ok?le(w(Z[`ui.overview.announce_resized`],{widget:e.title,span:t,max:e.def?.maxSpan??4})):n.reason===`not_allowed`&&le(w(Z[`ui.overview.announce_denied`]))}function Ce(e,t){if(!t.def)return;let n=xt(e.key,t.widget.span,t.def.minSpan,t.def.maxSpan,xe());n!==null&&(e.preventDefault(),n!==t.widget.span&&Se(t,n))}function we(e,t){e.button===0&&t.def&&(e.preventDefault(),e.currentTarget.setPointerCapture?.(e.pointerId),B(q,{id:t.widget.id,span:t.widget.span},!0))}function Te(t,n){if(e(q)?.id!==n.widget.id||!n.def||!e(K))return;let r=t.currentTarget.closest(`[data-smrt-overview-item]`);if(!r)return;let i=e(K).getBoundingClientRect(),a=r.getBoundingClientRect(),o=xe(),s=getComputedStyle(e(K)).gridTemplateColumns.split(` `).filter(Boolean).length,c=bt({pointer:t.clientX,start:o?a.right:a.left,rtl:o,gridWidth:i.width,columns:s||1,gap:0,min:n.def.minSpan,max:n.def.maxSpan});c!==e(q).span&&B(q,{id:n.widget.id,span:c},!0)}function Ee(t,n){if(e(q)?.id!==n.widget.id)return;let r=e(q).span;B(q,null);let i=t.currentTarget;i.hasPointerCapture?.(t.pointerId)&&i.releasePointerCapture(t.pointerId),r!==n.widget.span&&Se(n,r)}function De(e){a.controller.remove(e.widget.id).ok&&le(w(Z[`ui.overview.announce_removed`],{widget:e.title}))}function Oe(){a.controller.reset().ok&&le(w(Z[`ui.overview.announce_reset`]))}function ke(e){B(Y,{id:e.widget.id,type:e.widget.type,initial:e.widget.options},!0)}function Ae(t){let n=e(W).get(t);return n?w(n.title):t}function je(t){let n=a.controller.add(t);if(B(J,!1),n.ok)le(w(Z[`ui.overview.announce_added`],{widget:Ae(t)}));else if(n.reason===`invalid_options`){let n=e(W).get(t);B(Y,{id:null,type:t,initial:n?Ne(n.options):{}},!0)}}function Me(t){let n=e(Y);if(!n)return null;let r=n.id===null?a.controller.add(n.type,t):a.controller.setOptions(n.id,t);return r.ok?(le(w(Z[n.id===null?`ui.overview.announce_added`:`ui.overview.announce_configured`],{widget:Ae(n.type)})),B(Y,null),null):r.reason===`invalid_options`?r.issues??[]:(r.reason===`not_allowed`&&le(w(Z[`ui.overview.announce_denied`])),B(Y,null),null)}let Pe=n(()=>e(Y)?e(W).get(e(Y).type):void 0),Fe=n(()=>e(Y)?w(Z[e(Y).id===null?`ui.overview.options_new_title`:`ui.overview.options_title`],{widget:Ae(e(Y).type)}):``),Ie=n(()=>`h${v()}`);var Le=Gt(),Re=I(Le),ze=A(Re),Be=t=>{var r=Pt(),i=A(r);{let t=n(()=>w(Z[`ui.overview.add`])),r=n(()=>a.controller.full||a.controller.addable.length===0);me(i,{icon:`add`,get label(){return e(t)},get disabled(){return e(r)},onclick:()=>B(J,!0)})}var o=M(i,2);{let t=n(()=>w(Z[`ui.overview.reset`])),r=n(()=>!a.controller.customized);me(o,{icon:`undo`,get label(){return e(t)},get disabled(){return e(r)},onclick:Oe})}s(r),R(e=>z(r,`aria-label`,e),[()=>w(Z[`ui.overview.toolbar`])]),x(t,r)};t(ze,t=>{e(H)&&t(Be)});var Ve=M(ze,2),He=e=>{var t=Ft(),n=N(t,!0);R(e=>l(n,e),[()=>w(Z[`ui.overview.empty`])]),x(e,t)};t(Ve,t=>{e(ae).length===0&&t(He)});var Ue=M(Ve,2);z(Ue,`data-smrt-overview-list`,P),f(Ue,31,()=>e(ae),e=>e.widget.id,(r,i,a)=>{let o=n(()=>ye(e(a)));var c=Rt();let u;var f=A(c),p=A(f),h=r=>{var a=Lt(),o=I(a),c=A(o),u=M(c,2),f=N(u,!0),p=M(u,2),m=t=>{{let r=n(()=>w(Z[`ui.overview.configure`],{widget:e(i).title}));me(t,{icon:`settings`,get label(){return e(r)},onclick:()=>ke(e(i))})}};t(p,t=>{e(i).def&&e(i).def.options.length>0&&t(m)});var h=M(p,2);{let t=n(()=>w(Z[`ui.overview.remove`],{widget:e(i).title}));me(h,{icon:`trash`,get label(){return e(t)},onclick:()=>De(e(i))})}s(o);var g=M(o,2),_=A(g);d(_,()=>e(i)),s(g);var v=M(g,2),y=t=>{var n=It();R((t,r,a)=>{z(n,`aria-label`,t),z(n,`aria-valuemin`,e(i).def.minSpan),z(n,`aria-valuemax`,e(i).def.maxSpan),z(n,`aria-valuenow`,r),z(n,`aria-valuetext`,a)},[()=>w(Z[`ui.overview.resize`],{widget:e(i).title}),()=>be(e(i)),()=>w(Z[`ui.overview.resize_value`],{span:be(e(i)),max:e(i).def.maxSpan})]),C(`keydown`,n,t=>Ce(t,e(i))),C(`pointerdown`,n,t=>we(t,e(i))),C(`pointermove`,n,t=>Te(t,e(i))),C(`pointerup`,n,t=>Ee(t,e(i))),T(`pointercancel`,n,t=>Ee(t,e(i))),x(t,n)};t(v,t=>{e(i).def&&t(y)}),R(t=>{z(c,`draggable`,X.nativeDraggable),z(c,`aria-label`,t),z(c,`aria-pressed`,e(ge)===e(i).widget.id),l(f,e(i).title)},[()=>w(Z[`ui.overview.move`],{widget:e(i).title})]),C(`click`,c,()=>X.consumeClick(e(i).widget.id)),C(`keydown`,c,t=>X.keydown(t,e(i).widget.id)),T(`blur`,c,t=>X.blur(t,e(i).widget.id)),C(`pointerdown`,c,t=>X.pointerDown(t,e(i).widget.id)),C(`pointermove`,c,e=>X.pointerMove(e)),C(`pointerup`,c,e=>X.pointerUp(e)),T(`pointercancel`,c,e=>X.pointerCancel(e)),T(`dragstart`,c,t=>X.dragStart(t,e(i).widget.id)),T(`dragend`,c,()=>X.dragEnd()),x(r,a)},g=t=>{d(t,()=>e(i))};t(p,t=>{e(H)?t(h):t(g,-1)}),s(f),s(c),R((t,n)=>{z(c,`data-span`,t),z(c,`data-smrt-overview-item`,e(i).widget.id),z(c,`data-dragging`,e(ge)===e(i).widget.id?``:void 0),z(c,`data-drop`,e(o)),u=b(c,``,u,{"--smrt-overview-grid-span":n})},[()=>be(e(i)),()=>be(e(i))]),T(`dragover`,c,e=>e.preventDefault()),T(`drop`,c,t=>{X.drag&&(t.stopPropagation(),X.dropOnItem(t,P,e(a)))}),m(c,()=>de,null),x(r,c)}),s(Ue),k(Ue,e=>B(K,e),()=>e(K));var We=M(Ue,2),Ge=N(We);s(Re),k(Re,e=>B(G,e),()=>e(G));var Ke=M(Re,2),qe=r=>{var i=Wt(),o=I(i),c=()=>e(J),u=e=>B(J,e,!0);{let r=n(()=>w(Z[`ui.overview.add_title`]));U(o,{get open(){return c()},set open(e){u(e)},get title(){return e(r)},size:`sm`,children:(n,r)=>{var i=S(),o=I(i),c=e=>{var t=zt(),n=N(t,!0);R(e=>l(n,e),[()=>w(Z[`ui.overview.add_none`])]),x(e,t)},u=n=>{var r=Ut();f(r,21,()=>a.controller.addable,e=>e.type,(n,r)=>{var i=Ht(),o=A(i);ce(o,{type:`button`,variant:`ghost`,fullWidth:!0,onclick:()=>je(e(r).type),children:(n,i)=>{var o=Vt(),c=A(o),u=t=>{he(t,{get name(){return e(r).icon},get iconComponent(){return a.iconComponent}})};t(c,t=>{e(r).icon&&t(u)});var d=M(c,2),f=A(d),p=N(f,!0),m=M(f,2),h=t=>{var n=Bt(),i=N(n,!0);R(e=>l(i,e),[()=>w(e(r).description)]),x(t,n)};t(m,t=>{e(r).description&&t(h)}),s(d),s(o),R(e=>l(p,e),[()=>w(e(r).title)]),x(n,o)},$$slots:{default:!0}}),s(i),x(n,i)}),s(r),x(n,r)};t(o,e=>{a.controller.addable.length===0||a.controller.full?e(c):e(u,-1)}),x(n,i)},$$slots:{default:!0}})}var d=M(o,2),p=()=>e(Y)!==null,m=e=>{e||B(Y,null)};U(d,{get open(){return p()},set open(e){m(e)},get title(){return e(Fe)},size:`md`,children:(r,i)=>{var o=S(),s=I(o),c=t=>{var r=S(),i=I(r);V(i,()=>`${e(Y).id??`new`}:${e(Y).type}`,t=>{{let r=n(()=>a.optionEditors?.get(e(Y).type)??e(Pe).optionsEditor);At(t,{get definition(){return e(Pe)},get initial(){return e(Y).initial},get models(){return a.models},get optionsEditor(){return e(r)},onsave:Me,oncancel:()=>B(Y,null)})}}),x(t,r)};t(s,t=>{e(Y)&&e(Pe)&&t(c)}),x(r,o)},$$slots:{default:!0}}),x(r,i)};t(Ke,t=>{e(H)&&t(qe)}),R(()=>{z(Re,`data-editing`,e(H)?``:void 0),z(Re,`data-presentation`,y()),z(Ue,`aria-label`,e(re)),l(Ge,`${e(se)??``}${X.announcement?` ${X.announcement}`:``}`)}),T(`dragover`,Ue,e=>e.preventDefault()),T(`drop`,Ue,e=>{X.drag&&X.dropOnContainer(e,P)}),x(r,Le),i()}w([`click`,`keydown`,`pointerdown`,`pointermove`,`pointerup`]);var qt=[`title`,`identifier`,`status`,`money`,`quantity`,`date`,`party`,`subtotal`,`tax`,`discount`,`total`],Jt=new Set([`integer`,`decimal`]),Yt=new Set([`foreignKey`,`crossPackageRef`]),Xt=/(?:^|[a-z])(?:amount|total|price|cost)$|^(?:subtotal|tax|discount)$/i,Zt=/^subtotal(?:Amount)?$|[a-z]Subtotal(?:Amount)?$/,Qt=/^tax(?:Amount|Total)?$|[a-z]Tax(?:Amount|Total)?$/,$t=/^discount(?:Amount|Total)?$|[a-z]Discount(?:Amount|Total)?$/,en=/^(?:total|grandTotal)(?:Amount)?$|^amountTotal$/,tn=/(?:rate|percent|percentage|pct|ratio)$/i,nn=/^(?:status|state)$|[a-z](?:Status|State)$/,rn=/^(?:number|reference|code|ref)$|[a-z](?:Number|Reference|Code)$/,an=/^(?:phone|mobile|fax|postal|zip|country|currency|language|locale|tax|vat|account|routing|card|area|promo|coupon|discount|sort|tracking|billing|shipping|iban|swift|bank|unit|line|street|house|building)/i,on=/^date$|[a-z](?:At|Date|On|Until)$/,sn=/^(?:quantity|qty)|(?:Quantity|Qty)$/,cn=[`name`,`title`,`label`,`displayName`],ln=/customer|vendor|supplier|client|party|profile|contact|person|people|member|company|organi[sz]ation|payer|payee|buyer|seller|licensee|lessee/i;function un(e){let t=e.role;return t===void 0?null:(Array.isArray(t)?t:[t]).filter(e=>qt.includes(e))}function dn(e){return e.format??e.ui?.format}function fn(e){return dn(e)===`money`||e.type===`integer`&&e.ui?.widget===`currency`}function pn(e){return Array.isArray(e.enum)&&e.enum.length>0}function mn(e,t){return e?.find(e=>e.field===t)}function hn(e,t,n){let r=[],{type:i}=t,a=Jt.has(i),o=tn.test(e);if(i===`text`&&(pn(t)&&nn.test(e)&&r.push(`status`),rn.test(e)&&!an.test(e)&&t.ui?.widget!==`phone`&&r.push(`identifier`)),i===`integer`&&!o&&Xt.test(e)&&r.push(`money`),a&&sn.test(e)&&r.push(`quantity`),i===`datetime`&&on.test(e)&&r.push(`date`),Yt.has(i)){let t=n?.relatedCollection??``,i=e.replace(/Id$/,``);i!==`tenant`&&(ln.test(i)||ln.test(t))&&r.push(`party`)}return a&&!o&&(Zt.test(e)?r.push(`subtotal`):Qt.test(e)?r.push(`tax`):$t.test(e)?r.push(`discount`):en.test(e)&&r.push(`total`)),r}function gn(e){let t=new Set(e);return qt.filter(e=>t.has(e))}function _n(e){let t={},n=Object.entries(e.fields).filter(([e])=>!e.startsWith(`_`)&&!e.startsWith(`$`)),r=n.some(([,e])=>e.display===!0);for(let[r,i]of n){let n=new Set,a=un(i);if(a)for(let e of a)n.add(e);else for(let t of hn(r,i,mn(e.relationships,r)))n.add(t);fn(i)&&n.add(`money`);let o=dn(i);(o===`date`||o===`datetime`)&&i.type===`datetime`&&n.add(`date`),i.display===!0&&n.add(`title`),t[r]=gn(n)}if(!r&&!Object.values(t).some(e=>e.includes(`title`)))for(let n of cn){let r=e.fields[n];if(r?.type===`text`&&un(r)===null){t[n]=gn([...t[n]??[],`title`]);break}}return t}function vn(e,t){return Object.keys(e).find(n=>e[n]?.includes(t))}function yn(e){let t=Object.entries(e.fields);return t.find(([,e])=>e.type===`text`&&e.ui?.widget===`currency`)?.[0]??t.find(([e,t])=>t.type===`text`&&/^currency(?:Code)?$/.test(e))?.[0]}function bn(e){return vn(e,`identifier`)!==void 0&&(vn(e,`party`)!==void 0||vn(e,`total`)!==void 0)}var xn=new Set([`id`,`tenantId`,`createdAt`,`updatedAt`,`createdBy`,`updatedBy`]),Sn=[`createdAt`,`updatedAt`];function Cn(e){let t=e.replace(/([a-z0-9])([A-Z])/g,`$1 $2`).replace(/([A-Z]+)([A-Z][a-z])/g,`$1 $2`).replace(/[_-]+/g,` `).trim();if(t===``)return e;let n=t.toLowerCase();return n.charAt(0).toUpperCase()+n.slice(1)}function wn(e,t){return(t.type===`foreignKey`||t.type===`crossPackageRef`)&&/.[a-z]Id$/.test(e)?Cn(e.slice(0,-2)):Cn(e)}function Tn(e){let t=Cn(e.className),n=t.slice(-1);return{singular:t,plural:/(s|x|z|ch|sh)$/i.test(t)?`${t}es`:/[^aeiou]y$/i.test(t)?`${t.slice(0,-1)}ies`:n===``?t:`${t}s`}}function En(e,t){let n=e.ui?.widget;if(e.type===`text`)return Array.isArray(e.enum)&&e.enum.length>0?`select`:n===`textarea`?`textarea`:n===`email`?`email`:n===`url`?`url`:n===`phone`?`tel`:`text`;if(e.type===`integer`)return t?.includes(`money`)??(n===`currency`||(e.format??e.ui?.format)===`money`)?`money`:`integer`;switch(e.type){case`decimal`:return`decimal`;case`boolean`:return`boolean`;case`datetime`:return`datetime`;case`json`:return`json`;default:return`reference`}}function Dn(e,t){return t===void 0?e.required===!0&&e.nullable!==!0:t}function On(e,t){return t&&t.objectRef!==e.objectRef?`Field policy is for '${t.objectRef}', not '${e.objectRef}'.`:null}function kn(e){return!e.startsWith(`_`)&&!e.startsWith(`$`)}function An(e){let t=e.some(e=>e.definition.ui?.basic===!0),n=new Set;for(let r of e)(r.definition.ui?.basic===!0||r.definition.ui?.basic!==!1&&!t)&&n.add(r.name);return n}function jn(e,t){return(e.order??2**53-1)-(t.order??2**53-1)||e.index-t.index}function Mn(e,t,n){let{mode:r,include:i,exclude:a}=n,o=new Set(a??[]),s=Object.entries(e.fields).map(([e,t],n)=>({name:e,definition:t,index:n})).filter(t=>kn(t.name)&&!xn.has(t.name)&&t.name!==e.idField),c=t?null:An(s),l=_n(e),u=e=>{let n=t?.fields[e.name];if(t&&!n)return null;let r=n?n.visibility:c?.has(e.name)?`basic`:`advanced`;if(r===`hidden`)return null;let i=n?.label?.trim(),a=n?.help??e.definition.description??null,o=l[e.name]??[],s=En(e.definition,o);return{name:e.name,label:i||wn(e.name,e.definition),help:a&&a.trim()!==``?a:null,type:e.definition.type,kind:s,required:Dn(e.definition,n?.required),tier:r,group:n?.group??e.definition.ui?.group??null,order:n?.order??e.definition.ui?.order??null,definition:e.definition,roles:o,...s===`select`?{options:[...e.definition.enum??[]]}:{}}},d=s.map(e=>({c:e,field:u(e)})).filter(e=>e.field!==null).filter(e=>!o.has(e.c.name)),f=t=>{let n=e.fields[t];return!n||o.has(t)?null:{name:t,label:Cn(t),help:null,type:n.type,kind:`datetime`,required:!1,tier:`advanced`,group:null,order:null,definition:n,roles:l[t]??[]}};if(i){let e=new Map(d.map(e=>[e.c.name,e.field])),t=[];for(let n of i){if(o.has(n))continue;if(r!==`edit`&&Sn.includes(n)){let e=f(n);e&&t.push(e);continue}let i=e.get(n);i&&t.push(i)}return t}let p=d.map(e=>e.field).map((e,t)=>({field:e,order:e.order,index:t})).sort(jn).map(e=>e.field);if(r===`list`){let e=n.maxListColumns??6;return p.filter(e=>e.tier===`basic`&&e.kind!==`json`&&e.kind!==`textarea`&&e.kind!==`reference`).slice(0,Math.max(0,e))}if(r===`view`){let e=Sn.map(f).filter(e=>e!==null);return[...p,...e]}return p}function Nn(e){let t=new Map;for(let n of e){let e=t.get(n.group)??[];e.push(n),t.set(n.group,e)}return[...t.entries()]}function Pn(e){return`${e.model.split(/[:/]/).pop()??e.model}-${e.field}`.replace(/[^A-Za-z0-9_.-]+/g,`-`).slice(0,64)}function Fn(e){return J.get(e.trim().toUpperCase())??2}function In(e,t){if(typeof e!=`number`||!Number.isSafeInteger(e))return null;let n=e<0,r=String(Math.abs(e)),i;if(t<=0)i=r;else{let e=r.padStart(t+1,`0`);i=`${e.slice(0,-t)}.${e.slice(-t)}`}return n?`-${i}`:i}function Ln(e,t){let n=e.trim().replace(/[,\s]/g,``),r=(t>0?/^(-?)(\d+)(?:\.(\d*))?$/:/^(-?)(\d+)$/).exec(n);if(!r)return null;let[,i,a,o=``]=r;if(o.length>Math.max(0,t))return null;let s=Number(`${a}${o.padEnd(Math.max(0,t),`0`)}`);return Number.isSafeInteger(s)?i===`-`&&s!==0?-s:s:null}function Rn(e){return String(e).padStart(2,`0`)}function zn(e){if(e==null||e===``)return``;let t=e instanceof Date?e:new Date(e);return Number.isNaN(t.getTime())?``:`${t.getFullYear()}-${Rn(t.getMonth()+1)}-${Rn(t.getDate())}T${Rn(t.getHours())}:${Rn(t.getMinutes())}`}function Bn(e,t,n={}){if(e.kind===`boolean`)return t===!0||t===`true`;if(t==null)return``;switch(e.kind){case`money`:return In(t,Fn(n.currency??`USD`))??``;case`datetime`:return zn(t);case`json`:return typeof t==`string`?t:JSON.stringify(t,null,2);default:return String(t)}}function Vn(e,t,n={}){let r={};for(let i of e)r[i.name]=Bn(i,t[i.name],n);return r}function Hn(e,t,n={}){let r={};for(let i of e){let e=t?.fields[i.name],a=e?.hasDefault===!0?e.defaultValue:i.definition.default;r[i.name]=Bn(i,a,n)}return r}function Un(e,t,n={}){let r={},i={},a=Fn(n.currency??`USD`);for(let o of e){let e=t[o.name];if(o.kind===`boolean`){r[o.name]=e===!0||e===`true`;continue}let s=typeof e==`string`?e:``,c=s.trim();if(c===``)o.required?i[o.name]=`required`:(o.kind===`text`||o.kind===`textarea`||o.kind===`email`||o.kind===`url`||o.kind===`tel`||o.kind===`select`)&&o.definition.nullable!==!0?r[o.name]=``:r[o.name]=null;else switch(o.kind){case`integer`:{let e=/^-?\d+$/.test(c)?Number(c):NaN;Number.isSafeInteger(e)?r[o.name]=e:i[o.name]=`invalid_integer`;break}case`decimal`:{let e=Number(c);Number.isFinite(e)?r[o.name]=e:i[o.name]=`invalid_decimal`;break}case`money`:{let e=Ln(c,a);e===null?i[o.name]=`invalid_money`:r[o.name]=e;break}case`datetime`:{let e=n.record?.[o.name],t=e==null||e===``?null:e instanceof Date?e:new Date(e);if(t&&!Number.isNaN(t.getTime())&&c===zn(t)){r[o.name]=t.toISOString();break}let a=new Date(c);Number.isNaN(a.getTime())?i[o.name]=`invalid_datetime`:r[o.name]=a.toISOString();break}case`json`:try{r[o.name]=JSON.parse(c)}catch{i[o.name]=`invalid_json`}break;case`reference`:r[o.name]=c;break;default:r[o.name]=s}}return{values:r,errors:i}}function Wn(e,t,n={}){let r=e.definition?.format??e.definition?.ui?.format;if(e.kind===`boolean`)return t==null?``:t===!0||t===`true`?n.yes??`Yes`:n.no??`No`;if(t==null||t===``)return``;try{switch(e.kind){case`integer`:return typeof t==`number`?new Intl.NumberFormat(n.locale,{maximumFractionDigits:0}).format(t):String(t);case`decimal`:return r===`percent`&&typeof t==`number`?new Intl.NumberFormat(n.locale,{style:`percent`,maximumFractionDigits:4}).format(t):typeof t==`number`?new Intl.NumberFormat(n.locale,{maximumFractionDigits:6}).format(t):String(t);case`money`:{let e=(n.currency??`USD`).trim().toUpperCase(),r=Fn(e);return typeof t!=`number`||!Number.isSafeInteger(t)?String(t):new Intl.NumberFormat(n.locale,{style:`currency`,currency:e}).format(t/10**r)}case`datetime`:{let e=t instanceof Date?t:new Date(t);return Number.isNaN(e.getTime())?String(t):new Intl.DateTimeFormat(n.locale,{dateStyle:`medium`,...r===`date`?{}:{timeStyle:`short`},...n.timeZone?{timeZone:n.timeZone}:{}}).format(e)}case`json`:{let e=Gn(t);return Jn(e)?``:typeof e==`string`?e:JSON.stringify(e)}default:return String(t)}}catch{return String(t)}}function Gn(e){if(typeof e!=`string`)return e;let t=e.trim();if(!t.startsWith(`{`)&&!t.startsWith(`[`))return e;try{return JSON.parse(t)}catch{return e}}function Kn(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function qn(e){return e==null||e===``}function Jn(e){return qn(e)?!0:Array.isArray(e)?e.length===0:Kn(e)?Object.values(e).every(qn):!1}function Yn(e){let t=Gn(e);if(!Kn(t))return null;let n=[];for(let[e,r]of Object.entries(t))qn(r)||n.push({key:e,value:typeof r==`object`&&r?JSON.stringify(r):String(r)});return n.length>0?n:null}function Xn(e){return e.length>12?`${e.slice(0,8)}…`:e}function Zn(e,t){let n=[];for(let r of e)if(!(t&&r.id!==t))for(let e of r.items){if(e.hidden)continue;let t=gt(e.item.href);t&&n.push({id:e.id,label:e.label,href:t,...e.item.icon?{icon:e.item.icon}:{},...e.item.description?{description:e.item.description}:{}})}return{items:n}}function Q(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var Qn=/^[A-Za-z_][A-Za-z0-9_.-]{0,63}$/;function $n(e,t=6){if(typeof e!=`string`)return[];let n=[];for(let r of e.split(`,`)){let e=r.trim();if(Qn.test(e)&&!n.includes(e)&&(n.push(e),n.length===t))break}return n}function er(e){return e.join(`,`)}var tr={active:`success`,accepted:`success`,approved:`success`,completed:`success`,confirmed:`success`,delivered:`success`,fulfilled:`success`,paid:`success`,settled:`success`,shipped:`success`,open:`info`,pending:`info`,processing:`info`,sent:`info`,viewed:`info`,partial:`warning`,overdue:`warning`,on_hold:`warning`,suspended:`warning`,declined:`error`,failed:`error`,rejected:`error`,refunded:`default`,cancelled:`default`,canceled:`default`,draft:`default`,inactive:`default`,void:`default`,written_off:`default`};function nr(e,t){if(typeof e!=`string`)return`default`;let n=e.trim().toLowerCase().replace(/[\s-]+/g,`_`);return t?.[e]??t?.[n]??tr[n]??`default`}function rr(e){return typeof e!=`string`||e.trim()===``?``:Cn(e.trim())}function ir(e,t,n={}){if(t==null||t===``)return``;switch(e.role){case`money`:return Wn({kind:`money`},t,{currency:n.currency,locale:n.locale});case`date`:return typeof t==`string`&&!/^\d{4}-\d{2}-\d{2}/.test(t)?t:Wn({kind:`datetime`,definition:{format:`date`}},t,{locale:n.locale,timeZone:n.timeZone??`UTC`});case`quantity`:return Wn({kind:`decimal`},t,{locale:n.locale});case`status`:return rr(t);default:return typeof t==`number`?Wn({kind:`decimal`},t,{locale:n.locale}):typeof t==`boolean`?t?`✓`:``:typeof t==`string`?t:JSON.stringify(t)}}function ar(e){return e===`money`||e===`quantity`}function or(e){return e.summarize??ar(e.role)}function sr(e){if(!Q(e)||!Array.isArray(e.rows))return[];let t=[];for(let n of e.rows.slice(0,50)){if(!Q(n))continue;let e=Q(n.cells)?n.cells:void 0;(typeof n.title==`string`||e)&&t.push({id:typeof n.id==`string`?n.id:String(t.length),title:typeof n.title==`string`?n.title:``,...typeof n.subtitle==`string`?{subtitle:n.subtitle}:{},...typeof n.meta==`string`?{meta:n.meta}:{},...typeof n.href==`string`?{href:n.href}:{},...e?{cells:e}:{}})}return t}var cr=new Set([`title`,`identifier`,`status`,`money`,`quantity`,`date`,`party`,`subtotal`,`tax`,`discount`,`total`]);function lr(e,t){let n=[];if(Array.isArray(t))for(let e of t)Q(e)&&typeof e.key==`string`&&Qn.test(e.key)&&n.push({key:e.key,label:typeof e.label==`string`&&e.label!==``?e.label:Cn(e.key),...typeof e.role==`string`&&cr.has(e.role)?{role:e.role}:{},...typeof e.summarize==`boolean`?{summarize:e.summarize}:{}});return(e.length>0?e:n.map(e=>e.key)).slice(0,6).map(e=>n.find(t=>t.key===e)??{key:e,label:Cn(e)})}var ur=[`related`,`line-items`,`records`,`metric`,`chart`,`note`];function dr(e){return`detail:${e.replace(/^@/,``).replace(/[/:]+/g,`.`).replace(/[^A-Za-z0-9_.-]/g,`-`).replace(/^[^A-Za-z0-9]+/,``)||`record`}`}function fr(e,t,n){let r=`${e}-${Pn(t)}`.replace(/[^A-Za-z0-9_-]+/g,`-`).slice(0,60),i=r;for(let e=2;n.has(i);e+=1)i=`${r}-${e}`;return n.add(i),i}function pr(e,t,n={}){let r=t.filter(e=>e.kind===`children`),i=t.filter(e=>e.kind===`items`),a=[],o=[],s=new Set;for(let e of[...i,...r])o.includes(e.model)||o.push(e.model);if(n.metrics!==!1){let e=n.maxMetrics??4,t=[];for(let n of r){if(t.length>=e)break;t.push({id:fr(`count`,n,s),type:`metric`,span:1,options:{title:n.label,model:n.model,measure:`count`,field:n.field,filter:`parent`}});let r=(n.columns??[]).find(e=>e.role===`money`);!r||t.length>=e||t.push({id:fr(`sum`,n,s),type:`metric`,span:1,options:{title:`${n.label} · ${r.label}`,model:n.model,measure:`sum`,field:r.key,filter:`parent`,parentField:n.field}})}a.push(...t)}let c=i[0];if(c&&a.push({id:fr(`items`,c,s),type:`line-items`,span:4,options:{title:c.label,relation:Pn(c)}}),n.related===`panels`)for(let e of r)a.push({id:fr(`records`,e,s),type:`records`,span:2,options:{title:e.label,model:e.model,field:e.field,filter:`parent`,sort:`createdAt`,direction:`desc`,limit:5,...(e.columns??[]).length>0?{columns:er((e.columns??[]).map(e=>e.key))}:{}}});else r.length>0&&(s.add(`related`),a.push({id:`related`,type:`related`,span:4,options:{limit:5}}));return et({id:n.id??dr(e.objectRef),allowed:ur,models:o.length>0?o:void 0,defaults:a})}function mr(e){return e===`exclusive`||e===`inclusive`||e===`none`}function hr(e){if(!e||typeof e!=`object`||Array.isArray(e))return!1;let t=e;return mr(t.lineAmountType)&&(t.roundingScope===`line`||t.roundingScope===`document`)&&Number.isSafeInteger(t.subtotal)&&Number.isSafeInteger(t.discount)&&Number.isSafeInteger(t.tax)&&Number.isSafeInteger(t.total)&&Array.isArray(t.taxes)}function gr(e){let t=new Map;for(let n of e){if(!n||typeof n.taxComponentId!=`string`||typeof n.name!=`string`||typeof n.percent!=`string`||!Number.isSafeInteger(n.taxable)||!Number.isSafeInteger(n.tax))continue;let e=`${n.taxComponentId}\u0000${n.name}\u0000${n.percent}`,r=t.get(e);if(!r){t.set(e,{...n});continue}let i=r.taxable+n.taxable,a=r.tax+n.tax;Number.isSafeInteger(i)&&Number.isSafeInteger(a)&&(r.taxable=i,r.tax=a)}return[...t.values()]}function _r(e,t){let n=t.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`);return RegExp(`(^|[^\\d.])${n}\\s?%`).test(e)?e:`${e} ${t}%`}function vr(e){return typeof e==`number`&&Number.isSafeInteger(e)?e:null}function yr(e){let t=0;for(let n of e){if(n==null||n===``)continue;let e=vr(n);if(e===null||(t+=e,!Number.isSafeInteger(t)))return null}return t}function br(e,t){let n=e?.lineAmountType===`inclusive`,r=vr(e?.subtotal),i=vr(e?.discount),a=vr(e?.tax),o=vr(e?.total),s=[],c=t===null?null:n?a===null?null:t-a:t,l=r??c;l!==null&&s.push({key:`subtotal`,value:l,computed:r===null}),i!==null&&i!==0&&s.push({key:`discount`,value:i,computed:!1,included:!0}),a!==null&&a!==0&&s.push({key:`tax`,value:a,computed:!1});let u=o??(l===null||a===null?null:l+a);u!==null&&s.push({key:`total`,value:u,computed:o===null});let d=null;if(c!==null){if(r!==null&&r!==c)d={field:`subtotal`,recorded:r,lines:c};else if(r===null&&o!==null&&a!==null){let e=c+a;e!==o&&(d={field:`total`,recorded:o,lines:e})}}return{lines:s,lineSum:t,mismatch:d}}function xr(e,t){let n=e.filter(e=>e.kind===`children`);return t.length===0?n.slice(0,20):t.map(e=>n.find(t=>Pn(t)===e)).filter(e=>e!==void 0)}function Sr(e,t){return{title:e.label,model:e.model,field:e.field,filter:`parent`,sort:`createdAt`,direction:`desc`,limit:t,columns:er((e.columns??[]).map(e=>e.key))}}function Cr(e,t,n){let r=Q(t)?t:{},i=sr(r),a=(e.columns??[]).map(e=>e.key),o=[...Array.isArray(r.columns)?r.columns:[],...e.columns??[]],s={};if(Q(r.summaries))for(let[e,t]of Object.entries(r.summaries))typeof t==`number`&&Number.isFinite(t)&&(s[e]=t);let c=typeof r.total==`number`&&Number.isFinite(r.total)?r.total:i.length,l=typeof r.href==`string`?r.href:void 0;return{key:Pn(e),label:e.label,rows:i,total:c,columns:lr(a,o),...n??l?{href:n??l}:{},...typeof r.currency==`string`?{currency:r.currency}:{},...typeof r.timeZone==`string`?{timeZone:r.timeZone}:{},...Object.keys(s).length>0?{summaries:s}:{}}}function wr(e){return async(t,n)=>{let r=$n(t.relations,20),i=typeof t.limit==`number`?t.limit:5,a=xr(e.relations,r),o=await Promise.allSettled(a.map(t=>new Promise(r=>r(e.records(Sr(t,i),n))))),s=[],c;if(o.forEach((t,n)=>{let r=a[n];r&&(t.status===`rejected`?c??=t.reason:s.push(Cr(r,t.value,e.viewAllHref?.(r))))}),s.length===0&&c!==void 0)throw c;return{tabs:s}}}function Tr(e,t){let n=e.filter(e=>e.kind===`items`);return typeof t==`string`&&t!==``?n.find(e=>Pn(e)===t):n[0]}function Er(e,t){return{title:e.label,model:e.model,field:e.field,filter:`parent`,sort:e.sort??`createdAt`,direction:`asc`,limit:t,columns:er((e.columns??[]).map(e=>e.key))}}function Dr(e){return async(t,n)=>{let r=Tr(e.relations,t.relation),i=e.totals?.(),a=e.storedTotals?.(),o=e.currency?.();if(!r)return{rows:[],columns:[],...i?{totals:i}:{},...a?{storedTotals:a}:{}};let s=typeof t.limit==`number`?t.limit:50,c=Cr(r,await e.records(Er(r,s),n),void 0);return{rows:c.rows,columns:c.columns,...c.total===void 0?{}:{total:c.total},...i?{totals:i}:{},...a?{storedTotals:a}:{},...c.currency??o?{currency:c.currency??o}:{},...c.summaries?{summaries:c.summaries}:{},...c.href?{href:c.href}:{}}}}var Or=W({"ui.overview.no_data":`Nothing to show yet.`,"ui.overview.metric.change_up":`Up {value} from the previous period`,"ui.overview.metric.change_down":`Down {value} from the previous period`,"ui.overview.chart.summary":`Chart with {count} values`,"ui.overview.chart.table":`Chart data`,"ui.overview.chart.label_column":`Label`,"ui.overview.chart.value_column":`Value`}),kr=c(`<tr><th scope="row" class="svelte-75pkr"> </th><td class="svelte-75pkr"> </td></tr>`),Ar=c(`<table><caption class="svelte-75pkr"> </caption><thead class="svelte-75pkr"><tr><th scope="col" class="svelte-75pkr"> </th><th scope="col" class="svelte-75pkr"> </th></tr></thead><tbody class="svelte-75pkr"></tbody></table>`),jr=c(`<p class="smrt-chart__empty svelte-75pkr" data-smrt-component="Chart"> </p>`),Mr=c(`<div class="smrt-chart smrt-chart--table svelte-75pkr" data-smrt-component="Chart"><!></div>`),Nr=c(`<p class="smrt-chart__delta svelte-75pkr"><span aria-hidden="true"> </span> </p>`),Pr=c(`<div class="smrt-chart smrt-chart--stat svelte-75pkr" data-smrt-component="Chart"><p class="smrt-chart__headline svelte-75pkr"> </p> <p class="smrt-chart__caption svelte-75pkr"> </p> <!></div>`),Fr=d(`<circle class="smrt-chart__slice svelte-75pkr" cx="21" cy="21" r="15.9155" fill="none" stroke-width="6" pathLength="100" transform="rotate(-90 21 21)"></circle>`),Ir=c(`<li class="smrt-chart__legend-item svelte-75pkr"><span class="smrt-chart__swatch svelte-75pkr"></span> <span class="smrt-chart__label svelte-75pkr"> </span> <span class="smrt-chart__value svelte-75pkr"> </span></li>`),Lr=c(`<div class="smrt-chart smrt-chart--pie svelte-75pkr" data-smrt-component="Chart"><svg class="smrt-chart__donut svelte-75pkr" viewBox="0 0 42 42" role="img"></svg> <ul class="smrt-chart__legend svelte-75pkr" aria-hidden="true"></ul> <!></div>`),Rr=c(`<div class="smrt-chart svelte-75pkr" data-smrt-component="Chart"><svg class="smrt-chart__line svelte-75pkr" viewBox="0 0 100 40" preserveAspectRatio="none" role="img"><polyline fill="none" stroke="currentColor" stroke-width="2" vector-effect="non-scaling-stroke"></polyline></svg> <p class="smrt-chart__axis svelte-75pkr" aria-hidden="true"><span> </span> <span> </span></p> <!></div>`),zr=c(`<li class="smrt-chart__row svelte-75pkr"><span class="smrt-chart__label svelte-75pkr"> </span> <span class="smrt-chart__track svelte-75pkr" aria-hidden="true"><span class="smrt-chart__bar svelte-75pkr"></span></span> <span class="smrt-chart__value svelte-75pkr"> </span></li>`),Br=c(`<ul class="smrt-chart__bars svelte-75pkr" data-smrt-component="Chart"></ul>`);function Vr(o,c){h(c,!0);let u=(t,n=p)=>{var i=Ar(),o=A(i),c=N(o,!0),u=M(o),d=A(u),m=A(d),h=N(m,!0),g=M(m),_=N(g,!0);s(d),s(u);var b=M(u);f(b,21,()=>e(w),v,(t,n)=>{var r=kr(),i=A(r),a=N(i,!0),o=M(i),c=N(o,!0);s(r),R(t=>{l(a,e(n).label),l(c,t)},[()=>O(e(n).value)]),x(t,r)}),s(b),s(i),R((e,t,o)=>{a(i,1,r(n()?`smrt-chart__table`:`smrt-chart__data`),`svelte-75pkr`),l(c,e),l(h,t),l(_,o)},[()=>y(Or[`ui.overview.chart.table`]),()=>y(Or[`ui.overview.chart.label_column`]),()=>y(Or[`ui.overview.chart.value_column`])]),x(t,i)},d=E(c,`style`,3,`bar`),m=E(c,`title`,3,``),g=E(c,`locale`,3,`en`);function _(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}let{t:y}=ie(),C=n(()=>_(c.data)?c.data:null),w=n(()=>{if(!e(C)||!Array.isArray(e(C).points))return[];let t=[];for(let n of e(C).points.slice(0,60))_(n)&&typeof n.label==`string`&&typeof n.value==`number`&&Number.isFinite(n.value)&&t.push({label:n.label,value:n.value});return t}),T=[`bar`,`line`,`table`,`pie`,`stat`],D=n(()=>T.find(e=>e===d())??`bar`),O=t=>ft(t,{format:e(C)?.format??`integer`,currency:e(C)?.currency,locale:g()}),k=n(()=>Math.max(0,...e(w).map(e=>e.value))),ee=n(()=>Math.min(0,...e(w).map(e=>e.value))),j=n(()=>e(k)-e(ee)||1),te=n(()=>e(w).map((t,n)=>{let r=e(w).length===1?50:n/(e(w).length-1)*100,i=36-(t.value-e(ee))/e(j)*32;return`${r.toFixed(2)},${i.toFixed(2)}`}).join(` `)),P=n(()=>e(w).reduce((e,t)=>e+Math.max(0,t.value),0)),F=n(()=>{let t=0;return e(w).map((n,r)=>{let i=e(P)>0?Math.max(0,n.value)/e(P)*100:0,a={...n,index:r,share:i,offset:t};return t+=i,a})}),L=e=>ft(e/100,{format:`percent`,locale:g()}),B=n(()=>e(w).at(-1)),V=n(()=>{if(e(C)&&typeof e(C).delta==`number`&&Number.isFinite(e(C).delta))return e(C).delta;let t=e(w).at(-2);return!e(B)||!t||t.value===0?null:(e(B).value-t.value)/Math.abs(t.value)*100}),ne=n(()=>e(V)===null||e(V)===0?``:y(Or[e(V)>0?`ui.overview.metric.change_up`:`ui.overview.metric.change_down`],{value:ft(Math.abs(e(V))/100,{format:`percent`,locale:g()})})),H=n(()=>`${m()}. ${y(Or[`ui.overview.chart.summary`],{count:e(w).length})}`);var U=S(),re=I(U),W=e=>{var t=jr(),n=N(t,!0);R(e=>l(n,e),[()=>y(Or[`ui.overview.no_data`])]),x(e,t)},ae=e=>{var t=Mr(),n=A(t);u(n,()=>!1),s(t),x(e,t)},oe=n=>{var r=S(),i=I(r),a=n=>{var r=Pr(),i=A(r),a=N(i,!0),o=M(i,2),c=N(o,!0),u=M(o,2),d=t=>{var n=Nr(),r=A(n),i=N(r,!0),a=M(r);s(n),R(()=>{z(n,`data-direction`,(e(V)??0)>0?`up`:`down`),l(i,(e(V)??0)>0?`▲`:`▼`),l(a,` ${e(ne)??``}`)}),x(t,n)};t(u,t=>{e(ne)&&t(d)}),s(r),R(t=>{l(a,t),l(c,e(B).label)},[()=>O(e(B).value)]),x(n,r)};t(i,t=>{e(B)&&t(a)}),x(n,r)},G=n=>{var r=S(),i=I(r),a=n=>{var r=Lr(),i=A(r);f(i,21,()=>e(F),e=>e.index,(n,r)=>{var i=S(),a=I(i),o=t=>{var n=Fr();R(()=>{z(n,`data-slot`,e(r).index%8),z(n,`stroke-dasharray`,`${e(r).share??``} ${100-e(r).share}`),z(n,`stroke-dashoffset`,-e(r).offset)}),x(t,n)};t(a,t=>{e(r).share>0&&t(o)}),x(n,i)}),s(i);var a=M(i,2);f(a,21,()=>e(F),e=>e.index,(t,n)=>{var r=Ir(),i=A(r),a=M(i,2),o=N(a,!0),c=M(a,2),u=N(c);s(r),R((t,r)=>{z(i,`data-slot`,e(n).index%8),l(o,e(n).label),l(u,`${t??``} · ${r??``}`)},[()=>O(e(n).value),()=>L(e(n).share)]),x(t,r)}),s(a);var o=M(a,2);u(o,()=>!0),s(r),R(()=>z(i,`aria-label`,e(H))),x(n,r)},o=e=>{var t=jr(),n=N(t,!0);R(e=>l(n,e),[()=>y(Or[`ui.overview.no_data`])]),x(e,t)};t(i,t=>{e(P)>0?t(a):t(o,-1)}),x(n,r)},K=t=>{var n=Rr(),r=A(n),i=N(r),a=M(r,2),o=A(a),c=N(o,!0),d=M(o,2),f=N(d,!0);s(a);var p=M(a,2);u(p,()=>!0),s(n),R(()=>{z(r,`aria-label`,e(H)),z(i,`points`,e(te)),l(c,e(w)[0].label),l(f,e(w)[e(w).length-1].label)}),x(t,n)},se=t=>{var n=Br();f(n,21,()=>e(w),v,(t,n)=>{var r=zr(),i=A(r),a=N(i,!0),o=M(i,2),c=A(o);let u;s(o);var d=M(o,2),f=N(d,!0);s(r),R((t,r)=>{l(a,e(n).label),u=b(c,``,u,{"inline-size":t}),l(f,r)},[()=>`${e(k)>0?Math.max(0,e(n).value)/e(k)*100:0}%`,()=>O(e(n).value)]),x(t,r)}),s(n),R(()=>z(n,`aria-label`,e(H))),x(t,n)};t(re,t=>{e(w).length===0?t(W):e(D)===`table`?t(ae,1):e(D)===`stat`?t(oe,2):e(D)===`pie`?t(G,3):e(D)===`line`?t(K,4):t(se,-1)}),x(o,U),i()}var Hr=c(`<div data-smrt-component="ChartWidget"><!></div>`);function Ur(t,r){h(r,!0);var a=Hr(),o=A(a);{let t=n(()=>r.data??null),i=n(()=>String(r.options.style??`bar`));Vr(o,{get data(){return e(t)},get style(){return e(i)},get title(){return r.title},get locale(){return r.locale}})}s(a),x(t,a),i()}var Wr=c(`<a class="smrt-metric__value svelte-16na9c5"> </a>`),Gr=c(`<p class="smrt-metric__value svelte-16na9c5"> </p>`),Kr=c(`<p class="smrt-metric__label svelte-16na9c5"> </p>`),qr=c(`<p class="smrt-metric__change svelte-16na9c5"><span aria-hidden="true"> </span> </p>`),Jr=c(`<div class="smrt-metric svelte-16na9c5" data-smrt-component="MetricWidget"><!> <!> <!></div>`),Yr=c(`<p class="smrt-metric__label svelte-16na9c5" data-smrt-component="MetricWidget"> </p>`);function Xr(r,a){h(a,!0);let{t:o}=ie(),c=n(()=>Q(a.data)?a.data:null),u=n(()=>e(c)!==null&&typeof e(c).value==`number`&&Number.isFinite(e(c).value)),d=n(()=>e(u)&&e(c)?ft(e(c).value,{format:e(c).format,currency:e(c).currency,locale:a.locale}):``),f=n(()=>e(c)&&typeof e(c).change==`number`&&Number.isFinite(e(c).change)?e(c).change:null),p=n(()=>e(f)===null||e(f)===0?``:o(Z[e(f)>0?`ui.overview.metric.change_up`:`ui.overview.metric.change_down`],{value:ft(Math.abs(e(f))/100,{format:`percent`,locale:a.locale})})),m=n(()=>e(c)&&typeof e(c).href==`string`?gt(e(c).href):null);var g=S(),_=I(g),v=n=>{var r=Jr(),i=A(r),a=t=>{var n=Wr(),r=N(n,!0);R(()=>{z(n,`href`,e(m)),l(r,e(d))}),x(t,n)},o=t=>{var n=Gr(),r=N(n,!0);R(()=>l(r,e(d))),x(t,n)};t(i,t=>{e(m)?t(a):t(o,-1)});var u=M(i,2),h=t=>{var n=Kr(),r=N(n,!0);R(()=>l(r,e(c).label)),x(t,n)};t(u,t=>{typeof e(c).label==`string`&&e(c).label&&t(h)});var g=M(u,2),_=t=>{var n=qr(),r=A(n),i=N(r,!0),a=M(r);s(n),R(()=>{z(n,`data-direction`,(e(f)??0)>0?`up`:`down`),l(i,(e(f)??0)>0?`▲`:`▼`),l(a,` ${e(p)??``}`)}),x(t,n)};t(g,t=>{e(p)&&t(_)}),s(r),x(n,r)},y=e=>{var t=Yr(),n=N(t,!0);R(e=>l(n,e),[()=>o(Z[`ui.overview.no_data`])]),x(e,t)};t(_,t=>{e(u)&&e(c)?t(v):t(y,-1)}),x(r,g),i()}var Zr=(n,r=p)=>{var i=S(),a=I(i);f(a,17,r,v,(n,r)=>{var i=S(),a=I(i),o=t=>{var n=u();R(()=>l(n,e(r).text)),x(t,n)},c=t=>{var n=Qr(),i=N(n,!0);R(()=>l(i,e(r).text)),x(t,n)},d=t=>{var n=$r();Zr(A(n),()=>e(r).children),s(n),x(t,n)},f=t=>{var n=ei();Zr(A(n),()=>e(r).children),s(n),x(t,n)},p=t=>{var n=ti();Zr(A(n),()=>e(r).children),s(n),R(()=>z(n,`href`,e(r).href)),x(t,n)};t(a,t=>{e(r).type===`text`?t(o):e(r).type===`code`?t(c,1):e(r).type===`strong`?t(d,2):e(r).type===`em`?t(f,3):e(r).type===`link`&&t(p,4)}),x(n,i)}),x(n,i)},Qr=c(`<code class="svelte-h4l6y5"> </code>`),$r=c(`<strong><!></strong>`),ei=c(`<em><!></em>`),ti=c(`<a rel="noopener noreferrer" class="svelte-h4l6y5"><!></a>`),ni=c(`<p class="smrt-note__empty svelte-h4l6y5" data-smrt-component="NoteWidget"> </p>`),ri=c(`<p class="smrt-note__heading svelte-h4l6y5"><strong><!></strong></p>`),ii=c(`<p class="svelte-h4l6y5"><!></p>`),ai=c(`<blockquote class="svelte-h4l6y5"><!></blockquote>`),oi=c(`<li><!></li>`),si=c(`<ol class="svelte-h4l6y5"></ol>`),ci=c(`<ul class="svelte-h4l6y5"></ul>`),li=c(`<pre class="svelte-h4l6y5"><code class="svelte-h4l6y5"> </code></pre>`),ui=c(`<div class="smrt-note svelte-h4l6y5" data-smrt-component="NoteWidget"></div>`);function di(r,a){h(a,!0);let{t:o}=ie(),c=n(()=>yt(typeof a.options.body==`string`?a.options.body:``));var u=S(),d=I(u),p=e=>{var t=ni(),n=N(t,!0);R(e=>l(n,e),[()=>o(Z[`ui.overview.no_data`])]),x(e,t)},m=n=>{var r=ui();f(r,21,()=>e(c),v,(n,r)=>{var i=S(),a=I(i),o=t=>{var n=ri(),i=A(n);Zr(A(i),()=>e(r).children),s(i),s(n),R(()=>z(n,`data-level`,e(r).level)),x(t,n)},c=t=>{var n=ii();Zr(A(n),()=>e(r).children),s(n),x(t,n)},u=t=>{var n=ai();Zr(A(n),()=>e(r).children),s(n),x(t,n)},d=n=>{var i=S(),a=I(i),o=t=>{var n=si();f(n,21,()=>e(r).items,v,(t,n)=>{var r=oi();Zr(A(r),()=>e(n)),s(r),x(t,r)}),s(n),x(t,n)},c=t=>{var n=ci();f(n,21,()=>e(r).items,v,(t,n)=>{var r=oi();Zr(A(r),()=>e(n)),s(r),x(t,r)}),s(n),x(t,n)};t(a,t=>{e(r).ordered?t(o):t(c,-1)}),x(n,i)},p=t=>{var n=li(),i=A(n),a=N(i,!0);s(n),R(()=>l(a,e(r).text)),x(t,n)};t(a,t=>{e(r).type===`heading`?t(o):e(r).type===`paragraph`?t(c,1):e(r).type===`quote`?t(u,2):e(r).type===`list`?t(d,3):e(r).type===`code`&&t(p,4)}),x(n,i)}),s(r),x(n,r)};t(d,t=>{e(c).length===0?t(p):t(m,-1)}),x(r,u),i()}var fi=c(`<code class="svelte-13uvxec"> </code>`),pi=c(`<a class="smrt-record-table__link svelte-13uvxec"><!></a>`),mi=c(`<div class="smrt-record-table svelte-13uvxec" data-smrt-component="RecordTable" role="group"><!></div>`);function hi(r,a){h(a,!0);let o=(r,i)=>{let o=()=>(i?.()).column,c=()=>(i?.()).row,d=()=>(i?.()).value,f=n(()=>e(m).get(o().id)),p=n(()=>e(f)?ir(e(f),d(),e(y)):String(d()??``)),h=n(()=>e(p)===``&&o().id===e(g)?c().title:e(p));var v=S(),b=I(v),C=n=>{var r=pi(),i=A(r),a=t=>{var n=fi(),r=N(n,!0);R(()=>l(r,e(h))),x(t,n)},o=t=>{var n=u();R(()=>l(n,e(h))),x(t,n)};t(i,t=>{e(f)?.role===`identifier`?t(a):t(o,-1)}),s(r),R(()=>z(r,`href`,c().href)),x(n,r)},w=t=>{{let r=n(()=>nr(d(),a.statusTones));se(t,{size:`sm`,get variant(){return e(r)},children:(t,n)=>{_();var r=u();R(()=>l(r,e(h))),x(t,r)},$$slots:{default:!0}})}},T=t=>{var n=fi(),r=N(n,!0);R(()=>l(r,e(h))),x(t,n)},E=t=>{var n=u();R(()=>l(n,e(h))),x(t,n)};t(b,t=>{o().id===e(g)&&c().href&&e(h)!==``?t(C):e(f)?.role===`status`&&e(h)!==``?t(w,1):e(f)?.role===`identifier`&&e(h)!==``?t(T,2):t(E,-1)}),x(r,v)},c=E(a,`summaries`,3,!1),d=E(a,`total`,3,null),{t:f}=ie(),p=n(()=>a.rows.map(e=>({id:e.id,title:e.title,href:typeof e.href==`string`?gt(e.href):null,cells:e.cells??{}}))),m=n(()=>new Map(a.columns.map(e=>[e.key,e]))),g=n(()=>a.columns[0]?.key),v=n(()=>d()===null||d()<=a.rows.length),y=n(()=>({currency:a.currency,locale:a.locale,timeZone:a.timeZone})),b=n(()=>a.columns.map(t=>({id:t.key,label:t.label,accessor:`cells.${t.key}`,...ar(t.role)?{align:`right`}:{},summaryFormat:n=>ir(t,n,e(y))}))),C=n(()=>{if(!c()||a.columns.length===0)return;let t={},n=d()??a.rows.length;e(g)&&!ar(e(m).get(e(g))?.role)&&(t[e(g)]=()=>f(Z[`ui.overview.records.total`],{count:new Intl.NumberFormat(a.locale).format(n)}));for(let n of a.columns){if(!or(n))continue;let r=a.summaryValues?.[n.key];typeof r==`number`&&Number.isFinite(r)?t[n.key]=()=>ir(n,r,e(y)):e(v)?t[n.key]=`sum`:t[n.key]=()=>``}return t});var w=mi(),T=A(w);{let t=n(()=>f(Z[`ui.overview.table.total`]));X(T,{get data(){return e(p)},get columns(){return e(b)},rowKey:`id`,get cell(){return o},dense:!0,size:`sm`,hoverable:!1,phoneLayout:`cards`,get summaries(){return e(C)},get summaryLabel(){return e(t)}})}s(w),R(()=>z(w,`aria-label`,a.label)),x(r,w),i()}var gi=c(`<p class="smrt-records__foot smrt-records__foot--end svelte-1ouw4wc" data-smrt-component="RecordListWidget"><a class="svelte-1ouw4wc"> </a></p>`),_i=c(`<!> <!>`,1),vi=c(`<p class="smrt-records__empty svelte-1ouw4wc" data-smrt-component="RecordListWidget"> </p>`),yi=c(`<a class="smrt-records__title svelte-1ouw4wc"> </a>`),bi=c(`<span class="smrt-records__title svelte-1ouw4wc"> </span>`),xi=c(`<span class="smrt-records__sub svelte-1ouw4wc"> </span>`),Si=c(`<span class="smrt-records__meta svelte-1ouw4wc"> </span>`),Ci=c(`<li class="smrt-records__row svelte-1ouw4wc"><span class="smrt-records__main svelte-1ouw4wc"><!> <!></span> <!></li>`),wi=c(`<ul class="smrt-records svelte-1ouw4wc" data-smrt-component="RecordListWidget"></ul>`),Ti=c(`<span> </span>`),Ei=c(`<a class="svelte-1ouw4wc"> </a>`),Di=c(`<p class="smrt-records__foot svelte-1ouw4wc" data-smrt-component="RecordListWidget"><!> <!></p>`);function Oi(r,a){h(a,!0);let{t:o}=ie(),c=n(()=>{if(!Q(a.data)||!Array.isArray(a.data.rows))return[];let e=[];for(let t of a.data.rows.slice(0,50))Q(t)&&typeof t.title==`string`&&e.push({id:typeof t.id==`string`?t.id:String(e.length),title:t.title,subtitle:typeof t.subtitle==`string`?t.subtitle:void 0,meta:typeof t.meta==`string`?t.meta:void 0,href:typeof t.href==`string`?gt(t.href):null});return e}),u=n(()=>Q(a.data)&&typeof a.data.total==`number`&&a.data.total>e(c).length?a.data.total:null),d=n(()=>Q(a.data)&&typeof a.data.href==`string`?gt(a.data.href):null),p=n(()=>lr($n(a.options?.columns),Q(a.data)?a.data.columns:void 0)),m=n(()=>sr(a.data)),g=n(()=>typeof a.options?.summaries==`boolean`?a.options.summaries:e(p).some(e=>or(e))),_=n(()=>Q(a.data)&&typeof a.data.total==`number`&&Number.isFinite(a.data.total)?a.data.total:null),v=n(()=>{if(!Q(a.data)||!Q(a.data.summaries))return;let e={};for(let[t,n]of Object.entries(a.data.summaries))typeof n==`number`&&Number.isFinite(n)&&(e[t]=n);return e});var y=_i(),b=I(y),S=r=>{var i=_i(),c=I(i);{let t=n(()=>Q(a.data)&&typeof a.data.currency==`string`?a.data.currency:void 0),r=n(()=>Q(a.data)&&typeof a.data.timeZone==`string`?a.data.timeZone:void 0);hi(c,{get rows(){return e(m)},get columns(){return e(p)},get locale(){return a.locale},get label(){return a.title},get currency(){return e(t)},get timeZone(){return e(r)},get summaries(){return e(g)},get summaryValues(){return e(v)},get total(){return e(_)}})}var u=M(c,2),f=t=>{var n=gi(),r=A(n),i=N(r,!0);s(n),R(t=>{z(r,`href`,e(d)),l(i,t)},[()=>o(Z[`ui.overview.records.view_all`])]),x(t,n)};t(u,t=>{e(d)&&t(f)}),x(r,i)},C=e=>{var t=vi(),n=N(t,!0);R(e=>l(n,e),[()=>o(Z[`ui.overview.records.empty`])]),x(e,t)},w=n=>{var r=wi();f(r,21,()=>e(c),e=>e.id,(n,r)=>{var i=Ci(),a=A(i),o=A(a),c=t=>{var n=yi(),i=N(n,!0);R(()=>{z(n,`href`,e(r).href),l(i,e(r).title)}),x(t,n)},u=t=>{var n=bi(),i=N(n,!0);R(()=>l(i,e(r).title)),x(t,n)};t(o,t=>{e(r).href?t(c):t(u,-1)});var d=M(o,2),f=t=>{var n=xi(),i=N(n,!0);R(()=>l(i,e(r).subtitle)),x(t,n)};t(d,t=>{e(r).subtitle&&t(f)}),s(a);var p=M(a,2),m=t=>{var n=Si(),i=N(n,!0);R(()=>l(i,e(r).meta)),x(t,n)};t(p,t=>{e(r).meta&&t(m)}),s(i),x(n,i)}),s(r),x(n,r)};t(b,t=>{e(p).length>0&&e(m).length>0?t(S):e(c).length===0?t(C,1):t(w,-1)});var T=M(b,2),E=n=>{var r=Di(),i=A(r),c=t=>{var n=Ti(),r=N(n,!0);R(e=>l(r,e),[()=>o(Z[`ui.overview.records.total`],{count:new Intl.NumberFormat(a.locale).format(e(u))})]),x(t,n)};t(i,t=>{e(u)!==null&&t(c)});var f=M(i,2),p=t=>{var n=Ei(),r=N(n,!0);R(t=>{z(n,`href`,e(d)),l(r,t)},[()=>o(Z[`ui.overview.records.view_all`])]),x(t,n)};t(f,t=>{e(d)&&t(p)}),s(r),x(n,r)};t(T,t=>{e(p).length===0&&(e(u)!==null||e(d))&&t(E)}),x(r,y),i()}var ki=c(`<p class="smrt-shortcuts__empty svelte-1nfxkds" data-smrt-component="ShortcutsWidget"> </p>`),Ai=c(`<span class="smrt-shortcuts__count svelte-1nfxkds"> </span>`),ji=c(`<span class="smrt-shortcuts__desc svelte-1nfxkds"> </span>`),Mi=c(`<li class="smrt-shortcuts__card svelte-1nfxkds"><a class="smrt-shortcuts__link svelte-1nfxkds"><span class="smrt-shortcuts__heading svelte-1nfxkds"><span class="smrt-shortcuts__icon svelte-1nfxkds"><!></span> <span class="smrt-shortcuts__title svelte-1nfxkds"> </span> <!></span> <!></a></li>`),Ni=c(`<ul class="smrt-shortcuts svelte-1nfxkds" data-smrt-component="ShortcutsWidget"></ul>`);function Pi(r,a){h(a,!0);let o=E(a,`presentation`,3,`card`),{t:c}=ie(),u=n(()=>new Intl.NumberFormat(a.locale)),d=n(()=>new Intl.PluralRules(a.locale)),p=t=>c(Z[e(d).select(t)===`one`?`ui.overview.shortcuts.records_one`:`ui.overview.shortcuts.records_other`],{count:e(u).format(t)}),m=n(()=>{if(!Q(a.data)||!Array.isArray(a.data.items))return[];let e=[];for(let t of a.data.items.slice(0,48)){if(!Q(t)||typeof t.label!=`string`)continue;let n=typeof t.href==`string`?gt(t.href):null;n&&e.push({id:typeof t.id==`string`?t.id:n,label:t.label,href:n,icon:typeof t.icon==`string`?t.icon:pe,description:typeof t.description==`string`?t.description:void 0,count:typeof t.count==`number`&&Number.isFinite(t.count)&&t.count>=0?t.count:void 0})}return e});var g=S(),_=I(g),v=e=>{var t=ki(),n=N(t,!0);R(e=>l(n,e),[()=>c(Z[`ui.overview.shortcuts.empty`])]),x(e,t)},y=n=>{var r=Ni();f(r,21,()=>e(m),e=>e.id,(n,r)=>{var i=Mi(),o=A(i),c=A(o),u=A(c),d=A(u);he(d,{get name(){return e(r).icon},size:28,get iconComponent(){return a.iconComponent}}),s(u);var f=M(u,2),m=N(f,!0),h=M(f,2),g=t=>{var n=Ai(),i=N(n,!0);R(e=>l(i,e),[()=>p(e(r).count)]),x(t,n)};t(h,t=>{e(r).count!==void 0&&t(g)}),s(c);var _=M(c,2),v=t=>{var n=ji(),i=N(n,!0);R(()=>l(i,e(r).description)),x(t,n)};t(_,t=>{e(r).description&&t(v)}),s(o),s(i),R(()=>{z(o,`href`,e(r).href),l(m,e(r).label)}),x(n,i)}),s(r),R(()=>z(r,`data-presentation`,o())),x(n,r)};t(_,t=>{e(m).length===0?t(v):t(y,-1)}),x(r,g),i()}var Fi={key:`title`,type:`text`,label:`ui.overview.opt.title`,help:`ui.overview.opt.title_help`,maxLength:80},Ii={key:`model`,type:`model`,label:`ui.overview.opt.model`,help:`ui.overview.opt.model_help`,required:!0},Li={key:`filter`,type:`identifier`,label:`ui.overview.opt.filter`,help:`ui.overview.opt.filter_help`},Ri={key:`field`,type:`identifier`,label:`ui.overview.opt.field`,help:`ui.overview.opt.field_help`},zi={key:`parentField`,type:`identifier`,label:`ui.overview.opt.parent_field`,help:`ui.overview.opt.parent_field_help`},Bi={key:`columns`,type:`text`,label:`ui.overview.opt.columns`,help:`ui.overview.opt.columns_help`,maxLength:400},Vi={key:`summaries`,type:`boolean`,label:`ui.overview.opt.summaries`,help:`ui.overview.opt.summaries_help`},Hi=e=>({key:`measure`,type:`enum`,label:`ui.overview.opt.measure`,default:`count`,choices:e.map(e=>({value:e,label:`ui.overview.opt.measure_${e}`}))});function Ui(e){return{type:`metric`,title:`ui.overview.widget.metric.title`,description:`ui.overview.widget.metric.description`,icon:`layers`,options:[Fi,Ii,Hi([`count`,`sum`,`avg`,`min`,`max`]),Ri,Li,zi],component:Xr,load:e}}function Wi(e,t){return t>=1&&t<2?{...e}:null}function Gi(e){return{type:`chart`,title:`ui.overview.widget.chart.title`,description:`ui.overview.widget.chart.description`,icon:`repeat`,options:[Fi,Ii,{key:`groupBy`,type:`identifier`,label:`ui.overview.opt.group_by`},Hi([`count`,`sum`,`avg`]),Ri,{key:`period`,type:`enum`,label:`ui.overview.opt.period`,default:`30d`,choices:[`7d`,`30d`,`90d`,`12m`,`all`].map(e=>({value:e,label:`ui.overview.opt.period_${e}`}))},{key:`style`,type:`enum`,label:`ui.overview.opt.style`,default:`bar`,choices:[{value:`bar`,label:`ui.overview.opt.style_bar`},{value:`line`,label:`ui.overview.opt.style_line`},{value:`table`,label:`ui.overview.opt.style_table`},{value:`pie`,label:`ui.overview.opt.style_pie`},{value:`stat`,label:`ui.overview.opt.style_stat`}]},Li],component:Ur,load:e,version:2,migrate:Wi,defaultSpan:2}}function Ki(e){return{type:`records`,title:`ui.overview.widget.records.title`,description:`ui.overview.widget.records.description`,icon:`fileText`,options:[Fi,Ii,{key:`sort`,type:`identifier`,label:`ui.overview.opt.sort`},Ri,{key:`direction`,type:`enum`,label:`ui.overview.opt.direction`,default:`desc`,choices:[{value:`desc`,label:`ui.overview.opt.direction_desc`},{value:`asc`,label:`ui.overview.opt.direction_asc`}]},{key:`limit`,type:`integer`,label:`ui.overview.opt.limit`,default:5,min:1,max:20},Li,Bi,Vi],component:Oi,load:e,defaultSpan:2}}function qi(e){return{type:`shortcuts`,title:`ui.overview.widget.shortcuts.title`,description:`ui.overview.widget.shortcuts.description`,icon:`home`,options:[Fi,{key:`section`,type:`identifier`,label:`ui.overview.opt.section`,help:`ui.overview.opt.section_help`}],component:Pi,load:e,defaultSpan:4}}function Ji(){return{type:`note`,title:`ui.overview.widget.note.title`,description:`ui.overview.widget.note.description`,icon:`fileText`,options:[Fi,{key:`body`,type:`markdown`,label:`ui.overview.opt.body`,help:`ui.overview.opt.body_help`,default:``,maxLength:4e3}],component:di,defaultSpan:2}}function Yi(e=it,t={},n={}){let r=[e.register(Ji(),n)];return t.metric&&r.push(e.register(Ui(t.metric),n)),t.chart&&r.push(e.register(Gi(t.chart),n)),t.records&&r.push(e.register(Ki(t.records),n)),t.shortcuts&&r.push(e.register(qi(t.shortcuts),n)),()=>{for(let e of r)e()}}var Xi=c(`<p class="smrt-line-items__empty svelte-1q5no7f"> </p>`),Zi=c(`<div class="smrt-line-items__total svelte-1q5no7f"><dt class="svelte-1q5no7f"> </dt><dd class="svelte-1q5no7f"> </dd></div>`),Qi=c(`<div class="smrt-line-items__total smrt-line-items__total--muted svelte-1q5no7f"><dt class="svelte-1q5no7f"> </dt></div>`),$i=c(`<dd class="svelte-1q5no7f"> </dd>`),ea=c(`<div class="smrt-line-items__total smrt-line-items__total--muted svelte-1q5no7f"><dt class="svelte-1q5no7f"> </dt> <!></div>`),ta=c(`<dl class="smrt-line-items__totals svelte-1q5no7f" data-money-snapshot="stored"><!> <!> <!> <!> <div class="smrt-line-items__total smrt-line-items__total--grand svelte-1q5no7f"><dt class="svelte-1q5no7f"> </dt><dd class="svelte-1q5no7f"> </dd></div> <!></dl>`),na=c(`<span class="smrt-line-items__computed svelte-1q5no7f"> </span>`),ra=c(`<div><dt class="svelte-1q5no7f"> <!></dt> <dd class="svelte-1q5no7f"> </dd></div>`),ia=c(`<dl class="smrt-line-items__totals svelte-1q5no7f"></dl>`),aa=c(`<p class="smrt-line-items__flag svelte-1q5no7f"><strong> </strong> </p>`),oa=c(`<p class="smrt-line-items__foot svelte-1q5no7f"><a class="svelte-1q5no7f"> </a></p>`),sa=c(`<div class="smrt-line-items svelte-1q5no7f" data-smrt-component="LineItemsWidget"><!> <!> <!> <!></div>`);function ca(r,o){h(o,!0);let{t:c}=ie(),u=n(()=>sr(o.data)),d=n(()=>lr([],Q(o.data)?o.data.columns:void 0)),p=n(()=>Q(o.data)&&typeof o.data.total==`number`&&Number.isFinite(o.data.total)?o.data.total:e(u).length),m=n(()=>Q(o.data)&&typeof o.data.currency==`string`?o.data.currency:void 0),g=n(()=>{if(!Q(o.data)||!Q(o.data.summaries))return;let e={};for(let[t,n]of Object.entries(o.data.summaries))typeof n==`number`&&Number.isFinite(n)&&(e[t]=n);return e}),_=n(()=>[...e(d)].reverse().find(e=>e.role===`money`&&e.summarize!==!1)?.key),v=n(()=>{if(!e(_))return null;let t=e(g)?.[e(_)];return typeof t==`number`?t:e(p)>e(u).length?null:yr(e(u).map(t=>t.cells?.[e(_)]))}),y=n(()=>br(Q(o.data)&&Q(o.data.totals)?o.data.totals:void 0,e(v))),b=n(()=>Q(o.data)&&hr(o.data.storedTotals)?o.data.storedTotals:void 0),C=n(()=>e(b)?gr(e(b).taxes).filter(e=>e.tax!==0):[]),w=n(()=>e(C).length>0),T=n(()=>Q(o.data)&&typeof o.data.href==`string`?gt(o.data.href):null);function E(t){return ir({role:`money`},t,{currency:e(m),locale:o.locale})}let D={subtotal:Z[`ui.overview.line_items.subtotal`],discount:Z[`ui.overview.line_items.discount`],tax:Z[`ui.overview.line_items.tax`],total:Z[`ui.overview.line_items.total`]};var O=sa(),k=A(O),ee=t=>{hi(t,{get rows(){return e(u)},get columns(){return e(d)},get locale(){return o.locale},get label(){return o.title},get currency(){return e(m)},summaries:!0,get summaryValues(){return e(g)},get total(){return e(p)}})},j=e=>{var t=Xi(),n=N(t,!0);R(e=>l(n,e),[()=>c(Z[`ui.overview.line_items.empty`])]),x(e,t)};t(k,t=>{e(u).length>0&&e(d).length>0?t(ee):t(j,-1)});var te=M(k,2),P=n=>{var r=ta(),i=A(r),a=t=>{var n=Zi(),r=A(n),i=N(r,!0),a=M(r),o=N(a,!0);s(n),R((e,t)=>{l(i,e),l(o,t)},[()=>c(Z[`ui.overview.line_items.subtotal`]),()=>E(e(b).subtotal)]),x(t,n)};t(i,t=>{(e(b).lineAmountType!==`inclusive`||!e(w))&&t(a)});var o=M(i,2),u=t=>{var n=Qi(),r=A(n),i=N(r);s(n),R((e,t)=>l(i,`${e??``} ${t??``}`),[()=>c(Z[`ui.overview.line_items.discount_included`]),()=>E(Math.abs(e(b).discount))]),x(t,n)};t(o,t=>{e(b).discount!==0&&t(u)});var d=M(o,2);f(d,17,()=>e(C),e=>`${e.taxComponentId}-${e.name}-${e.percent}`,(n,r)=>{var i=ea(),a=A(i),o=N(a),u=M(a,2),d=t=>{var n=$i(),i=N(n,!0);R(e=>l(i,e),[()=>E(e(r).tax)]),x(t,n)};t(u,t=>{e(b).lineAmountType!==`inclusive`&&t(d)}),s(i),R((e,t)=>l(o,`${e??``} ${t??``}`),[()=>c(Z[e(b).lineAmountType===`inclusive`?`ui.overview.line_items.tax_included`:`ui.overview.line_items.tax_on`],{label:_r(e(r).name,e(r).percent)}),()=>E(e(b).lineAmountType===`inclusive`?e(r).tax:e(r).taxable)]),x(n,i)});var p=M(d,2),m=e=>{var t=Qi(),n=A(t),r=N(n,!0);s(t),R(e=>l(r,e),[()=>c(Z[`ui.overview.line_items.rounded_document`])]),x(e,t)};t(p,t=>{e(b).roundingScope===`document`&&t(m)});var h=M(p,2),g=A(h),_=N(g,!0),v=M(g),y=N(v,!0);s(h);var S=M(h,2),T=t=>{var n=Zi(),r=A(n),i=N(r,!0),a=M(r),o=N(a,!0);s(n),R((e,t)=>{l(i,e),l(o,t)},[()=>c(Z[`ui.overview.line_items.subtotal_excluding_tax`]),()=>E(e(b).subtotal)]),x(t,n)};t(S,t=>{e(b).lineAmountType===`inclusive`&&e(w)&&e(b).showNetSubtotal&&t(T)}),s(r),R((e,t)=>{l(_,e),l(y,t)},[()=>c(Z[`ui.overview.line_items.total`]),()=>E(e(b).total)]),x(n,r)},F=n=>{var r=ia();f(r,21,()=>e(y).lines,e=>e.key,(n,r)=>{var i=S(),o=I(i),u=t=>{var n=Qi(),i=A(n),a=N(i);s(n),R((e,t)=>l(a,`${e??``} ${t??``}`),[()=>c(Z[`ui.overview.line_items.discount_included`]),()=>E(Math.abs(e(r).value))]),x(t,n)},d=n=>{var i=ra();let o;var u=A(i),d=A(u),f=M(d),p=e=>{var t=na(),n=N(t,!0);R(e=>l(n,e),[()=>c(Z[`ui.overview.line_items.computed`])]),x(e,t)};t(f,t=>{e(r).computed&&t(p)}),s(u);var m=M(u,2),h=N(m,!0);s(i),R((t,n)=>{o=a(i,1,`smrt-line-items__total svelte-1q5no7f`,null,o,{"smrt-line-items__total--grand":e(r).key===`total`}),l(d,`${t??``} `),l(h,n)},[()=>c(D[e(r).key]),()=>e(r).key===`discount`?`−${E(e(r).value)}`:E(e(r).value)]),x(n,i)};t(o,t=>{e(r).included?t(u):t(d,-1)}),x(n,i)}),s(r),x(n,r)};t(te,t=>{e(b)?t(P):e(y).lines.length>0&&t(F,1)});var L=M(te,2),B=t=>{var n=aa(),r=A(n),i=N(r,!0),a=M(r);s(n),R((e,t)=>{l(i,e),l(a,` ${t??``}`)},[()=>c(Z[`ui.overview.line_items.mismatch`],{amount:E(e(y).mismatch.lines)}),()=>c(Z[e(y).mismatch.field===`subtotal`?`ui.overview.line_items.mismatch_subtotal`:`ui.overview.line_items.mismatch_total`],{amount:E(e(y).mismatch.recorded)})]),x(t,n)};t(L,t=>{!e(b)&&e(y).mismatch&&t(B)});var V=M(L,2),ne=t=>{var n=oa(),r=A(n),i=N(r,!0);s(n),R(t=>{z(r,`href`,e(T)),l(i,t)},[()=>c(Z[`ui.overview.records.view_all`])]),x(t,n)};t(V,t=>{e(T)&&t(ne)}),s(O),x(r,O),i()}var la=c(`<p class="smrt-related__empty svelte-ka1ryg" data-smrt-component="RelatedWidget"> </p>`),ua=c(`<a> </a>`),da=c(`<li><!></li>`),fa=c(`<ul class="smrt-related__list svelte-ka1ryg"></ul>`),pa=c(`<p class="smrt-related__foot svelte-ka1ryg"><a class="svelte-ka1ryg"> </a></p>`),ma=c(`<!> <!>`,1),ha=c(`<div class="smrt-related svelte-ka1ryg" data-smrt-component="RelatedWidget"><!></div>`);function ga(r,a){h(a,!0);let{t:o}=ie(),c=n(()=>{if(!Q(a.data)||!Array.isArray(a.data.tabs))return[];let e=[];for(let t of a.data.tabs){if(!Q(t)||typeof t.key!=`string`)continue;let n=sr(t),r=typeof t.total==`number`&&Number.isFinite(t.total)?t.total:n.length;if(n.length===0||r===0)continue;let i=lr([],t.columns),a={};if(Q(t.summaries))for(let[e,n]of Object.entries(t.summaries))typeof n==`number`&&Number.isFinite(n)&&(a[e]=n);e.push({key:t.key,label:typeof t.label==`string`?t.label:t.key,rows:n,total:r,columns:i,href:typeof t.href==`string`?gt(t.href):null,currency:typeof t.currency==`string`?t.currency:void 0,timeZone:typeof t.timeZone==`string`?t.timeZone:void 0,summaries:a})}return e}),d=D(null),p=n(()=>e(c).find(t=>t.key===e(d))??e(c)[0]);var m=S(),g=I(m),_=e=>{var t=la(),n=N(t,!0);R(e=>l(n,e),[()=>o(Z[`ui.overview.related.empty`])]),x(e,t)},v=r=>{var i=ha(),m=A(i);{let r=n(()=>e(c).map(e=>({id:e.key,label:e.label,count:e.total})));Se(m,{get tabs(){return e(r)},get active(){return e(p).key},onchange:e=>B(d,e,!0),size:`sm`,variant:`secondary`,get"aria-label"(){return a.title},children:(r,i)=>{var c=S(),d=I(c);V(d,()=>e(p).key,r=>{var i=ma(),c=I(i),d=t=>{hi(t,{get rows(){return e(p).rows},get columns(){return e(p).columns},get locale(){return a.locale},get label(){return e(p).label},get currency(){return e(p).currency},get timeZone(){return e(p).timeZone},summaries:!0,get summaryValues(){return e(p).summaries},get total(){return e(p).total}})},m=r=>{var i=fa();f(i,21,()=>e(p).rows,e=>e.id,(r,i)=>{var a=da(),o=A(a),c=t=>{var n=ua(),r=N(n,!0);R(t=>{z(n,`href`,t),l(r,e(i).title)},[()=>gt(e(i).href)]),x(t,n)},d=n(()=>e(i).href&>(e(i).href)),f=t=>{var n=u();R(()=>l(n,e(i).title)),x(t,n)};t(o,t=>{e(d)?t(c):t(f,-1)}),s(a),x(r,a)}),s(i),x(r,i)};t(c,t=>{e(p).columns.length>0?t(d):t(m,-1)});var h=M(c,2),g=t=>{var n=pa(),r=A(n),i=N(r,!0);s(n),R(t=>{z(r,`href`,e(p).href),l(i,t)},[()=>o(Z[`ui.overview.records.view_all`])]),x(t,n)};t(h,t=>{e(p).href&&t(g)}),x(r,i)}),x(r,c)},$$slots:{default:!0}})}s(i),x(r,i)};t(g,t=>{e(p)?t(v,-1):t(_)}),x(r,m),i()}function _a(e){return{type:`related`,title:`ui.overview.widget.related.title`,description:`ui.overview.widget.related.description`,icon:`layers`,options:[{key:`title`,type:`text`,label:`ui.overview.opt.title`,help:`ui.overview.opt.title_help`,maxLength:80},{key:`relations`,type:`text`,label:`ui.overview.opt.relations`,help:`ui.overview.opt.relations_help`,maxLength:1e3},{key:`limit`,type:`integer`,label:`ui.overview.opt.limit`,default:5,min:1,max:20}],component:ga,load:e,defaultSpan:4}}function va(e){return{type:`line-items`,title:`ui.overview.widget.line_items.title`,description:`ui.overview.widget.line_items.description`,icon:`fileText`,options:[{key:`title`,type:`text`,label:`ui.overview.opt.title`,help:`ui.overview.opt.title_help`,maxLength:80},{key:`relation`,type:`identifier`,label:`ui.overview.opt.relation`,help:`ui.overview.opt.relation_help`},{key:`limit`,type:`integer`,label:`ui.overview.opt.limit`,default:50,min:1,max:50}],component:ca,load:e,defaultSpan:4}}function ya(e=it,t,n={}){let r=[e.register(_a(wr(t)),n),e.register(va(Dr(t)),n)];return()=>{for(let e of r)e()}}var $=W({"ui.screens.create_title":`New {name}`,"ui.screens.edit_title":`Edit {name}`,"ui.screens.create_action":`New {name}`,"ui.screens.edit":`Edit`,"ui.screens.delete":`Delete`,"ui.screens.delete_title":`Delete this {name}?`,"ui.screens.delete_message":`This cannot be undone.`,"ui.screens.back":`Back to {name}`,"ui.screens.save":`Save`,"ui.screens.cancel":`Cancel`,"ui.screens.search":`Search {name}`,"ui.screens.empty_title":`No {name} yet`,"ui.screens.empty_search":`Nothing matches this search.`,"ui.screens.more_details":`More details`,"ui.screens.more_actions":`More actions`,"ui.screens.derived_hint":`Worked out from the line items.`,"ui.screens.select_none":`Not set`,"ui.screens.items":`Line items`,"ui.screens.details":`Details`,"ui.screens.show_empty":`Show empty fields ({count})`,"ui.screens.advanced_fields":`Advanced fields`,"ui.screens.not_set":`Not set`,"ui.screens.yes":`Yes`,"ui.screens.no":`No`,"ui.screens.load_failed":`Could not load this data.`,"ui.screens.save_failed":`Could not save your changes.`,"ui.screens.delete_failed":`Could not delete this record.`,"ui.screens.not_found":`This record no longer exists.`,"ui.screens.view_all":`View all`,"ui.screens.related":`Related records`,"ui.screens.error.required":`This field is required.`,"ui.screens.error.invalid_integer":`Enter a whole number.`,"ui.screens.error.invalid_decimal":`Enter a number.`,"ui.screens.error.invalid_money":`Enter an amount such as 12.50.`,"ui.screens.error.invalid_datetime":`Enter a valid date and time.`,"ui.screens.error.invalid_json":`Enter valid JSON.`}),ba=(e,t=p)=>{var n=xa(),r=N(n,!0);R(e=>{z(n,`title`,t()),l(r,e)},[()=>Xn(t())]),x(e,n)},xa=c(`<code> </code>`),Sa=c(`<h2 class="smrt-detail-screen__group-title svelte-c1e3gm"> </h2>`),Ca=c(`<span class="smrt-detail-screen__empty svelte-c1e3gm"> </span>`),wa=c(`<div class="svelte-c1e3gm"><dt class="svelte-c1e3gm"> </dt> <dd class="svelte-c1e3gm"> </dd></div>`),Ta=c(`<dl class="smrt-detail-screen__pairs svelte-c1e3gm"></dl>`),Ea=c(`<pre class="smrt-detail-screen__block svelte-c1e3gm"> </pre>`),Da=c(`<a> </a>`),Oa=c(`<a class="smrt-detail-screen__reference"><!></a>`),ka=c(`<span class="smrt-detail-screen__reference"> </span>`),Aa=c(`<div class="smrt-detail-screen__field svelte-c1e3gm"><dt class="svelte-c1e3gm"> </dt> <dd class="svelte-c1e3gm"><!></dd></div>`),ja=c(`<section class="smrt-detail-screen__group"><!> <dl class="smrt-detail-screen__fields svelte-c1e3gm"></dl></section>`),Ma=c(`<!> <!> <!> <!>`,1),Na=c(`<!> <!> <!> <!> <!>`,1),Pa=c(`<!> <article data-smrt-component="DetailScreen"><!></article> <!>`,1);function Fa(r,c){h(c,!0);let d=(r,i=p)=>{var a=S(),o=I(a);f(o,17,()=>Nn(i()),([e,t])=>e??``,(r,i)=>{var a=n(()=>y(e(i),2));let o=()=>e(a)[0],d=()=>e(a)[1];var p=ja(),m=A(p),h=e=>{var t=Sa(),n=N(t,!0);R(()=>l(n,o())),x(e,t)};t(m,e=>{o()&&e(h)});var g=M(m,2);f(g,21,d,e=>e.name,(r,i)=>{let a=n(()=>re(e(i)));var o=Aa(),d=A(o),p=N(d,!0),m=M(d,2),h=A(m),g=e=>{var t=Ca(),n=N(t,!0);R(e=>l(n,e),[()=>T($[`ui.screens.not_set`])]),x(e,t)},_=r=>{let o=n(()=>Yn(c.record[e(i).name]));var u=S(),d=I(u),p=t=>{var n=Ta();f(n,21,()=>e(o),e=>e.key,(t,n)=>{var r=wa(),i=A(r),a=N(i,!0),o=M(i,2),c=N(o,!0);s(r),R(t=>{l(a,t),l(c,e(n).value)},[()=>Cn(e(n).key)]),x(t,r)}),s(n),x(t,n)},m=t=>{var n=Ea(),r=N(n,!0);R(()=>l(r,e(a))),x(t,n)};t(d,t=>{e(o)?t(p):t(m,-1)}),x(r,u)},v=t=>{var n=Ea(),r=N(n,!0);R(()=>l(r,e(a))),x(t,n)},y=t=>{var n=Da(),r=N(n,!0);R(t=>{z(n,`href`,t),l(r,e(a))},[()=>W(e(i),e(a))]),x(t,n)},b=n(()=>W(e(i),e(a))),C=r=>{let o=n(()=>c.hrefFor?.(e(i),e(a))),d=n(()=>oe(e(i),e(a)));var f=S(),p=I(f),m=n=>{var r=Oa(),i=A(r),c=t=>{var n=u();R(()=>l(n,e(d))),x(t,n)},f=t=>{ba(t,()=>e(a))};t(i,t=>{e(d)?t(c):t(f,-1)}),s(r),R(()=>z(r,`href`,e(o))),x(n,r)},h=t=>{var n=ka(),r=N(n,!0);R(()=>l(r,e(d))),x(t,n)},g=t=>{ba(t,()=>e(a))};t(p,t=>{e(o)?t(m):e(d)?t(h,1):t(g,-1)}),x(r,f)},w=t=>{var n=u();R(()=>l(n,e(a))),x(t,n)};t(h,t=>{e(a)===``?t(g):e(i).kind===`json`?t(_,1):e(i).kind===`textarea`?t(v,2):e(b)?t(y,3):e(i).kind===`reference`?t(C,4):t(w,-1)}),s(m),s(o),R(()=>l(p,e(i).label)),x(r,o)}),s(g),s(p),x(r,p)}),x(r,a)},m=E(c,`policy`,3,null),g=E(c,`showHeader`,3,!0),v=E(c,`deleting`,3,!1),b=E(c,`relations`,19,()=>[]),C=E(c,`hideEmpty`,3,!1),w=E(c,`variant`,3,`plain`),{t:T}=ie(),O=n(()=>Tn(c.definition)),k=n(()=>On(c.definition,m())),ee=n(()=>e(k)?[]:Mn(c.definition,m(),{mode:`view`,include:c.fields})),j=n(()=>c.exclude?e(ee).filter(e=>!c.exclude.includes(e.name)):e(ee)),te=n(()=>C()?e(j).filter(e=>re(e)!==``):e(j)),P=n(()=>C()?e(j).filter(e=>re(e)===``):[]),F=n(()=>e(te).filter(e=>e.tier===`basic`)),L=n(()=>e(te).filter(e=>e.tier===`advanced`)),V=n(()=>{if(c.title)return c.title;let t=e(ee).find(e=>e.kind===`text`&&e.tier===`basic`),n=t?c.record[t.name]:void 0;return typeof n==`string`&&n.trim()!==``?n:e(O).singular}),U=n(()=>({currency:c.currency,locale:c.locale,yes:T($[`ui.screens.yes`]),no:T($[`ui.screens.no`])}));function re(t){return Wn(t,c.record[t.name],e(U))}function W(e,t){return e.kind===`email`?`mailto:${t}`:e.kind===`url`&&/^https?:\/\//i.test(t)?t:null}function ae(e){return b().find(t=>t.kind===`reference`&&t.field===e.name)?.model}function oe(e,t){let n=ae(e),r=n?c.labels?.[n]?.(t):void 0;return r&&r.trim()!==``?r:void 0}let G=D(!1),K=D(!1);async function se(){B(K,!1);try{await c.ondelete?.(),B(G,!1)}catch{B(K,!0),B(G,!1)}}var J=Pa(),Y=I(J),le=n=>{xe(n,{get title(){return e(V)},actions:n=>{var r=Ma(),i=I(r),a=t=>{ce(t,{variant:`ghost`,get onclick(){return c.onback},children:(t,n)=>{_();var r=u();R(e=>l(r,e),[()=>c.backLabel??T($[`ui.screens.back`],{name:e(O).plural.toLowerCase()})]),x(t,r)},$$slots:{default:!0}})};t(i,e=>{c.onback&&e(a)});var s=M(i,2),d=e=>{var t=S(),n=I(t);o(n,()=>c.extraActions),x(e,t)};t(s,e=>{c.extraActions&&e(d)});var f=M(s,2),p=e=>{ce(e,{variant:`secondary`,get onclick(){return c.onedit},children:(e,t)=>{_();var n=u();R(e=>l(n,e),[()=>T($[`ui.screens.edit`])]),x(e,n)},$$slots:{default:!0}})};t(f,e=>{c.onedit&&e(p)});var m=M(f,2),h=e=>{ce(e,{variant:`danger`,onclick:()=>B(G,!0),children:(e,t)=>{_();var n=u();R(e=>l(n,e),[()=>T($[`ui.screens.delete`])]),x(e,n)},$$slots:{default:!0}})};t(m,e=>{c.ondelete&&e(h)}),x(n,r)},$$slots:{actions:!0}})};t(Y,e=>{g()&&e(le)});var ue=M(Y,2);let de;var fe=A(ue),pe=t=>{H(t,{variant:`error`,children:(t,n)=>{_();var r=u();R(()=>l(r,e(k))),x(t,r)},$$slots:{default:!0}})},me=r=>{var i=Na(),a=I(i),s=e=>{H(e,{variant:`error`,dismissible:!0,ondismiss:()=>B(K,!1),children:(e,t)=>{_();var n=u();R(e=>l(n,e),[()=>T($[`ui.screens.delete_failed`])]),x(e,n)},$$slots:{default:!0}})};t(a,t=>{e(K)&&t(s)});var f=M(a,2);d(f,()=>e(F));var m=M(f,2),h=t=>{{let r=n(()=>T($[`ui.screens.more_details`]));q(t,{get title(){return e(r)},children:(t,n)=>{d(t,()=>e(L))},$$slots:{default:!0}})}};t(m,t=>{e(L).length>0&&t(h)});var g=M(m,2),v=t=>{{let r=n(()=>T($[`ui.screens.show_empty`],{count:e(P).length}));q(t,{get title(){return e(r)},children:(t,n)=>{d(t,()=>e(P))},$$slots:{default:!0}})}};t(g,t=>{e(P).length>0&&t(v)});var y=M(g,2);o(y,()=>c.children??p),x(r,i)};t(fe,t=>{e(k)?t(pe):t(me,-1)}),s(ue);var he=M(ue,2),X=t=>{{let r=n(()=>T($[`ui.screens.delete_title`],{name:e(O).singular.toLowerCase()})),i=n(()=>T($[`ui.screens.delete_message`])),a=n(()=>T($[`ui.screens.delete`])),o=n(()=>T($[`ui.screens.cancel`]));ne(t,{get open(){return e(G)},get title(){return e(r)},get message(){return e(i)},get confirmLabel(){return e(a)},get cancelLabel(){return e(o)},destructive:!0,get loading(){return v()},onconfirm:se,oncancel:()=>B(G,!1)})}};t(he,e=>{c.ondelete&&e(X)}),R(e=>{de=a(ue,1,`smrt-detail-screen svelte-c1e3gm`,null,de,{"smrt-detail-screen--card":w()===`card`}),z(ue,`aria-label`,e)},[()=>w()===`card`?T($[`ui.screens.details`]):e(V)]),x(r,J),i()}var Ia=c(`<small class="smrt-edit-form__hint svelte-6ki7lf"> </small>`),La=c(`<small class="smrt-edit-form__error svelte-6ki7lf" role="alert"> </small>`),Ra=c(`<div class="smrt-edit-form__check svelte-6ki7lf"><!> <!> <!></div>`),za=c(`<option> </option>`),Ba=c(`<!> <!> <!>`,1),Va=c(`<legend class="svelte-6ki7lf"> </legend>`),Ha=c(`<fieldset class="smrt-edit-form__group svelte-6ki7lf"><!> <!></fieldset>`),Ua=c(`<!> <!>`,1),Wa=c(`<!> <!> <!> <!>`,1),Ga=c(`<!> <section class="smrt-edit-form svelte-6ki7lf" data-smrt-component="EditForm"><!></section>`,1);function Ka(r,a){h(a,!0);let o=(r,i=p)=>{var o=S(),c=I(o),u=t=>{{let r=n(()=>X(i())),o=n(()=>T($[`ui.screens.derived_hint`]));ye(t,{get label(){return e(r)},get hint(){return e(o)},children:(t,r)=>{{let r=n(()=>Wn(i(),a.record?.[i().name],{currency:m()}));le(t,{get name(){return i().name},readonly:!0,get value(){return e(r)}})}},$$slots:{default:!0}})}},d=n(()=>V(i())),h=r=>{var a=Ra(),o=A(a),c=()=>e(W)[i().name]===!0,u=t=>e(W)[i().name]=t;Y(o,{get name(){return i().name},get label(){return i().label},get disabled(){return e(Ce)},get checked(){return c()},set checked(e){u(e)}});var d=M(o,2),f=e=>{var t=Ia(),n=N(t,!0);R(()=>l(n,i().help)),x(e,t)};t(d,e=>{i().help&&e(f)});var p=M(d,2),m=e=>{var t=La(),n=N(t,!0);R(e=>l(n,e),[()=>pe(i())]),x(e,t)},h=n(()=>pe(i()));t(p,t=>{e(h)&&t(m)}),s(a),x(r,a)},g=r=>{{let a=n(()=>X(i())),o=n(()=>he(i())),s=n(()=>pe(i()));ye(r,{get label(){return e(a)},get hint(){return e(o)},get error(){return e(s)},get required(){return i().required},children:(r,a)=>{var o=S(),s=I(o),c=r=>{var a=()=>de(i().name),o=e=>fe(i().name,e);be(r,{get name(){return i().name},get disabled(){return e(Ce)},get required(){return i().required},get value(){return a()},set value(e){o(e)},children:(r,a)=>{var o=Ba(),s=I(o),c=e=>{var t=za(),n=N(t,!0);t.value=t.__value=``,R(e=>l(n,e),[()=>T($[`ui.screens.select_none`])]),x(e,t)},u=n(()=>!i().required||de(i().name)===``);t(s,t=>{e(u)&&t(c)});var d=M(s,2);f(d,16,()=>i().options??[],e=>e,(e,t)=>{var n=za(),r=N(n,!0),i={};R(e=>{l(r,e),i!==(i=t)&&(n.value=(n.__value=i)??``)},[()=>rr(t)]),x(e,n)});var p=M(d,2),m=e=>{var t=za(),n=N(t,!0),r={};R((e,i)=>{l(n,e),r!==(r=i)&&(t.value=(t.__value=r)??``)},[()=>de(i().name),()=>de(i().name)]),x(e,t)},h=n(()=>de(i().name)!==``&&!(i().options??[]).includes(de(i().name)));t(p,t=>{e(h)&&t(m)}),x(r,o)},$$slots:{default:!0}})},u=t=>{var r=()=>de(i().name),a=e=>fe(i().name,e);{let o=n(()=>i().kind===`json`?8:4);ve(t,{get name(){return i().name},get rows(){return e(o)},get disabled(){return e(Ce)},get required(){return i().required},get value(){return r()},set value(e){a(e)}})}},d=t=>{var r=()=>de(i().name),a=e=>fe(i().name,e);{let o=n(()=>i().kind===`email`?`email`:i().kind===`url`?`url`:i().kind===`tel`?`tel`:i().kind===`integer`||i().kind===`decimal`?`number`:i().kind===`datetime`?`datetime-local`:`text`),s=n(()=>i().kind===`integer`?`1`:i().kind===`decimal`?`any`:void 0),c=n(()=>i().kind===`money`?`decimal`:void 0);le(t,{get name(){return i().name},get type(){return e(o)},get step(){return e(s)},get inputmode(){return e(c)},get disabled(){return e(Ce)},get required(){return i().required},get value(){return r()},set value(e){a(e)}})}};t(s,e=>{i().kind===`select`?e(c):i().kind===`textarea`||i().kind===`json`?e(u,1):e(d,-1)}),x(r,o)},$$slots:{default:!0}})}};t(c,t=>{e(d)?t(u):i().kind===`boolean`?t(h,1):t(g,-1)}),x(r,o)},c=(r,i=p)=>{var a=S(),c=I(a);f(c,17,()=>Nn(i()),([e,t])=>e??``,(r,i)=>{var a=n(()=>y(e(i),2));let c=()=>e(a)[0],u=()=>e(a)[1];var d=Ha(),p=A(d),m=e=>{var t=Va(),n=N(t,!0);R(()=>l(n,c())),x(e,t)};t(p,e=>{c()&&e(m)});var h=M(p,2);f(h,17,u,e=>e.name,(t,n)=>{o(t,()=>e(n))}),s(d),x(r,d)}),x(r,a)},d=E(a,`policy`,3,null),m=E(a,`currency`,3,`USD`),g=E(a,`showHeader`,3,!0),v=E(a,`submitting`,3,!1),b=E(a,`fieldErrors`,19,()=>({})),C=E(a,`error`,3,null),w=E(a,`derivedFields`,19,()=>[]),{t:T}=ie(),k=n(()=>a.record===void 0),ee=n(()=>Tn(a.definition)),te=n(()=>On(a.definition,d())),P=n(()=>a.title??T($[e(k)?`ui.screens.create_title`:`ui.screens.edit_title`],{name:e(ee).singular.toLowerCase()})),L=n(()=>e(te)?[]:Mn(a.definition,d(),{mode:`edit`,include:a.fields})),V=e=>w().includes(e.name),ne=n(()=>e(L).filter(e=>e.tier===`basic`)),U=n(()=>e(L).filter(e=>e.tier===`advanced`));function re(){return a.record?Vn(e(L),a.record,{currency:m()}):Hn(e(L),d(),{currency:m()})}let W=D(j(re())),ae=D(j({})),oe=D(j({})),G=D(!1),K=D(!1),se=D(!1),J=n(()=>`${a.definition.objectRef}:${a.record?String(a.record[a.definition.idField??`id`]):`new`}:${e(L).map(e=>e.name).join(`,`)}`),ue=F(()=>e(J));O(()=>{let t=e(J);t!==ue&&(ue=t,F(()=>{B(W,re(),!0),B(ae,{},!0),B(oe,{},!0),B(G,!1)}))});function de(t){let n=e(W)[t];return typeof n==`string`?n:``}function fe(t,n){e(W)[t]=String(n??``)}function pe(t){let n=e(ae)[t.name];return n?T($[`ui.screens.error.${n}`]):b()[t.name]??e(oe)[t.name]}let me=n(()=>e(U).some(t=>e(ae)[t.name]||b()[t.name]||e(oe)[t.name]));function he(e){return e.help??void 0}function X(e){return e.kind===`money`?`${e.label} (${m()})`:e.label}async function Se(){if(e(K)||v())return;B(G,!1),B(oe,{},!0);let t=Un(e(L).filter(e=>!V(e)),e(W),{currency:m(),record:a.record});if(B(ae,t.errors,!0),Object.keys(t.errors).length>0)e(U).some(e=>t.errors[e.name])&&B(se,!0);else{B(K,!0);try{let n=await a.onsubmit(t.values,{isNew:e(k)});n?.fieldErrors&&(B(oe,{...n.fieldErrors},!0),e(U).some(e=>n.fieldErrors?.[e.name])&&B(se,!0))}catch{B(G,!0)}finally{B(K,!1)}}}let Ce=n(()=>e(K)||v()),we=n(()=>C()??(e(G)?T($[`ui.screens.save_failed`]):null));var Te=Ga(),Ee=I(Te),De=t=>{xe(t,{get title(){return e(P)}})};t(Ee,e=>{g()&&e(De)});var Oe=M(Ee,2),ke=A(Oe),Ae=t=>{H(t,{variant:`error`,children:(t,n)=>{_();var r=u();R(()=>l(r,e(te))),x(t,r)},$$slots:{default:!0}})},je=r=>{_e(r,{onsubmit:Se,novalidate:!0,children:(r,i)=>{var o=Wa(),s=I(o),d=t=>{H(t,{variant:`error`,children:(t,n)=>{_();var r=u();R(()=>l(r,e(we))),x(t,r)},$$slots:{default:!0}})};t(s,t=>{e(we)&&t(d)});var f=M(s,2);c(f,()=>e(ne));var p=M(f,2),m=t=>{var r=()=>e(se)||e(me),i=e=>B(se,e,!0);{let a=n(()=>T($[`ui.screens.advanced_fields`]));q(t,{get title(){return e(a)},get open(){return r()},set open(e){i(e)},children:(t,n)=>{c(t,()=>e(U))},$$slots:{default:!0}})}};t(p,t=>{e(U).length>0&&t(m)});var h=M(p,2);ge(h,{children:(n,r)=>{var i=Ua(),o=I(i),s=t=>{ce(t,{type:`button`,variant:`ghost`,get disabled(){return e(Ce)},get onclick(){return a.oncancel},children:(e,t)=>{_();var n=u();R(e=>l(n,e),[()=>T($[`ui.screens.cancel`])]),x(e,n)},$$slots:{default:!0}})};t(o,e=>{a.oncancel&&e(s)});var c=M(o,2);ce(c,{type:`submit`,variant:`primary`,get loading(){return e(Ce)},get disabled(){return e(Ce)},children:(e,t)=>{_();var n=u();R(e=>l(n,e),[()=>T($[`ui.screens.save`])]),x(e,n)},$$slots:{default:!0}}),x(n,i)},$$slots:{default:!0}}),x(r,o)},$$slots:{default:!0}})};t(ke,t=>{e(te)?t(Ae):t(je,-1)}),s(Oe),R(()=>z(Oe,`aria-label`,e(P))),x(r,Te),i()}var qa=c(` <code class="smrt-record-header__id svelte-uiz8xl"> </code>`,1),Ja=c(`<code class="smrt-record-header__id smrt-record-header__id--chip svelte-uiz8xl"> </code>`),Ya=c(`<span class="smrt-record-header__sr svelte-uiz8xl"> </span> `,1),Xa=c(`<span aria-hidden="true">⋯</span>`),Za=c(`<div class="smrt-record-header__menu svelte-uiz8xl"><!> <!></div>`),Qa=c(`<code> </code>`),$a=c(`<a><!></a>`),eo=c(`<a> </a>`),to=c(`<div class="smrt-record-header__fact svelte-uiz8xl"><dt class="svelte-uiz8xl"> </dt> <dd class="svelte-uiz8xl"><!></dd></div>`),no=c(`<dl class="smrt-record-header__facts svelte-uiz8xl"></dl>`),ro=c(`<header class="smrt-record-header svelte-uiz8xl" data-smrt-component="RecordHeader"><!> <div class="smrt-record-header__row svelte-uiz8xl"><div class="smrt-record-header__identity svelte-uiz8xl"><h1 class="smrt-record-header__title svelte-uiz8xl"><!></h1> <!> <!></div> <div class="smrt-record-header__actions svelte-uiz8xl"><!> <!></div></div> <!> <!></header> <!>`,1);function io(r,a){h(a,!0);let c=E(a,`relations`,19,()=>[]),d=E(a,`deleting`,3,!1),{t:p}=ie(),m=n(()=>Tn(a.definition)),g=n(()=>!!(a.extraActions||a.ondelete)),v=D(!1),y=D(!1),b=D(!1);async function C(){B(b,!1);try{await a.ondelete?.(),B(y,!1)}catch{B(b,!0),B(y,!1)}}function w(e,t){let n=c().find(t=>t.kind===`reference`&&t.field===e.name)?.model,r=n?a.labels?.[n]?.(t):void 0;return r&&r.trim()!==``?r:void 0}function T(e){let t=a.record[e.field.name];return e.kind===`date`?Wn({kind:`datetime`,definition:{format:`date`}},t,{locale:a.locale}):Wn(e.field,t,{currency:a.currency,locale:a.locale})}function O(e,t){if(e.field.kind===`email`)return`mailto:${t}`;if(e.field.kind===`tel`)return`tel:${t.replace(/[^\d+]/g,``)}`}var k=ro(),ee=I(k),j=A(ee),te=t=>{ce(t,{variant:`ghost`,size:`sm`,get onclick(){return a.onback},children:(t,n)=>{_();var r=u();R(e=>l(r,e),[()=>a.backLabel??p($[`ui.screens.back`],{name:e(m).plural.toLowerCase()})]),x(t,r)},$$slots:{default:!0}})};t(j,e=>{a.onback&&e(te)});var P=M(j,2),F=A(P),L=A(F),V=A(L),U=e=>{var t=qa(),n=I(t,!0),r=M(n),i=N(r,!0);R(e=>{l(n,e),l(i,a.model.identifier.value)},[()=>a.model.heading.slice(0,a.model.heading.length-a.model.identifier.value.length)]),x(e,t)},re=e=>{var t=u();R(()=>l(t,a.model.heading)),x(e,t)};t(V,e=>{a.model.headingIdentifier&&a.model.identifier?e(U):e(re,-1)}),s(L);var W=M(L,2),oe=e=>{var t=Ja(),n=N(t,!0);R(()=>{z(t,`title`,a.model.identifier.field.label),l(n,a.model.identifier.value)}),x(e,t)};t(W,e=>{a.model.identifier&&!a.model.headingIdentifier&&e(oe)});var G=M(W,2),K=t=>{{let r=n(()=>nr(a.model.status.value,a.statusTones));se(t,{get variant(){return e(r)},children:(e,t)=>{var n=Ya(),r=I(n),i=N(r),o=M(r,1,!0);R(e=>{l(i,`${a.model.status.field.label??``}:`),l(o,e)},[()=>rr(a.model.status.value)]),x(e,n)},$$slots:{default:!0}})}};t(G,e=>{a.model.status&&e(K)}),s(F);var q=M(F,2),J=A(q),Y=e=>{ce(e,{variant:`primary`,get onclick(){return a.onedit},children:(e,t)=>{_();var n=u();R(e=>l(n,e),[()=>p($[`ui.screens.edit`])]),x(e,n)},$$slots:{default:!0}})};t(J,e=>{a.onedit&&e(Y)});var le=M(J,2),ue=r=>{{let i=e=>{var t=Xa();x(e,t)},c=n(()=>p($[`ui.screens.more_actions`])),d=n(()=>p($[`ui.screens.more_actions`]));ae(r,{get label(){return e(c)},get triggerLabel(){return e(d)},variant:`icon`,placement:`bottom-end`,get open(){return e(v)},set open(e){B(v,e,!0)},trigger:i,children:(e,n)=>{var r=Za(),i=A(r),c=e=>{var t=S(),n=I(t);o(n,()=>a.extraActions),x(e,t)};t(i,e=>{a.extraActions&&e(c)});var d=M(i,2),f=e=>{ce(e,{variant:`danger`,onclick:()=>{B(v,!1),B(y,!0)},children:(e,t)=>{_();var n=u();R(e=>l(n,e),[()=>p($[`ui.screens.delete`])]),x(e,n)},$$slots:{default:!0}})};t(d,e=>{a.ondelete&&e(f)}),s(r),x(e,r)},$$slots:{trigger:!0,default:!0}})}};t(le,t=>{e(g)&&t(ue)}),s(q),s(P);var de=M(P,2),fe=r=>{var i=no();f(i,21,()=>a.model.facts,e=>e.field.name,(r,i)=>{let o=n(()=>T(e(i)));var c=to(),d=A(c),f=N(d,!0),p=M(d,2),m=A(p),h=r=>{let c=n(()=>a.hrefFor?.(e(i).field,e(o))),d=n(()=>w(e(i).field,e(o)));var f=S(),p=I(f),m=n=>{var r=$a(),i=A(r),a=t=>{var n=u();R(()=>l(n,e(d))),x(t,n)},f=t=>{var n=Qa(),r=N(n,!0);R(t=>{z(n,`title`,e(o)),l(r,t)},[()=>Xn(e(o))]),x(t,n)};t(i,t=>{e(d)?t(a):t(f,-1)}),s(r),R(()=>z(r,`href`,e(c))),x(n,r)},h=t=>{var n=u();R(()=>l(n,e(d))),x(t,n)},g=t=>{var n=Qa(),r=N(n,!0);R(t=>{z(n,`title`,e(o)),l(r,t)},[()=>Xn(e(o))]),x(t,n)};t(p,t=>{e(c)?t(m):e(d)?t(h,1):t(g,-1)}),x(r,f)},g=t=>{var n=eo(),r=N(n,!0);R(t=>{z(n,`href`,t),l(r,e(o))},[()=>O(e(i),e(o))]),x(t,n)},_=n(()=>e(i).kind===`contact`&&O(e(i),e(o))),v=t=>{var n=u();R(()=>l(n,e(o))),x(t,n)};t(m,t=>{e(i).kind===`party`?t(h):e(_)?t(g,1):t(v,-1)}),s(p),s(c),R(()=>l(f,e(i).field.label)),x(r,c)}),s(i),x(r,i)};t(de,e=>{a.model.facts.length>0&&e(fe)});var pe=M(de,2),me=e=>{H(e,{variant:`error`,dismissible:!0,ondismiss:()=>B(b,!1),children:(e,t)=>{_();var n=u();R(e=>l(n,e),[()=>p($[`ui.screens.delete_failed`])]),x(e,n)},$$slots:{default:!0}})};t(pe,t=>{e(b)&&t(me)}),s(ee);var he=M(ee,2),X=t=>{{let r=n(()=>p($[`ui.screens.delete_title`],{name:e(m).singular.toLowerCase()})),i=n(()=>p($[`ui.screens.delete_message`])),a=n(()=>p($[`ui.screens.delete`])),o=n(()=>p($[`ui.screens.cancel`]));ne(t,{get open(){return e(y)},get title(){return e(r)},get message(){return e(i)},get confirmLabel(){return e(a)},get cancelLabel(){return e(o)},destructive:!0,get loading(){return d()},onconfirm:C,oncancel:()=>B(y,!1)})}};t(he,e=>{a.ondelete&&e(X)}),x(r,k),i()}function ao(e){return e==null?!1:typeof e!=`string`||e.trim()!==``}function oo(e,t){return(e.roles??[]).includes(t)}function so(e,t,n,r,i={}){let{singular:a}=Tn(e),o=t.filter(e=>ao(n[e.name])),s=e=>o.find(t=>oo(t,e)),c=[],l=s(`title`),u=s(`identifier`),d=s(`status`),f=u?String(n[u.name]):void 0,p,m=!1;i.title?p=i.title:f&&bn(r)?(p=`${a} ${f}`,m=!0):l?p=String(n[l.name]):f?(p=f,m=!0):p=a,l&&!m&&!i.title&&c.push(l.name);let h={heading:p,headingIdentifier:m,facts:[],shown:c};u&&f&&(h.identifier={field:u,value:f},c.push(u.name)),d&&(h.status={field:d,value:String(n[d.name])},c.push(d.name));let g=i.maxFacts??4,_=(e,t)=>{!t||c.includes(t.name)||h.facts.length>=g||(h.facts.push({kind:e,field:t}),c.push(t.name))};return _(`party`,s(`party`)),_(`date`,o.find(e=>oo(e,`date`)&&e.name!==`createdAt`&&e.name!==`updatedAt`)),_(`money`,s(`total`)??s(`money`)),_(`contact`,o.find(e=>e.kind===`email`)),_(`contact`,o.find(e=>e.kind===`tel`)),h}function co(e,t,n){let r={};for(let i of[`subtotal`,`discount`,`tax`,`total`]){let a=Object.keys(t).find(e=>t[e]?.includes(i)&&(!n||n.some(t=>t.name===e)));if(!a)continue;let o=e[a];r[i]=typeof o==`number`&&Number.isSafeInteger(o)?o:null}return mr(e.lineAmountType)&&(!n||n.some(e=>e.name===`lineAmountType`))&&(r.lineAmountType=e.lineAmountType),r}function lo(e){return Object.keys(e).filter(t=>[`subtotal`,`discount`,`tax`,`total`].some(n=>e[t]?.includes(n)))}var uo=c(`<span class="smrt-record-screen__count svelte-1ijjiku"> </span>`),fo=c(`<a class="smrt-record-screen__view-all svelte-1ijjiku"> </a>`),po=c(`<span class="smrt-record-screen__widget-heading svelte-1ijjiku"><span class="smrt-record-screen__widget-title"> <!></span> <!></span>`),mo=c(`<section class="smrt-record-screen__items svelte-1ijjiku"><!></section>`),ho=c(`<!> <!>`,1),go=c(`<aside class="smrt-record-screen__aside svelte-1ijjiku"><h2 class="smrt-record-screen__aside-title svelte-1ijjiku"> </h2> <!></aside>`),_o=c(`<div class="smrt-record-screen__sheet-body svelte-1ijjiku"><!></div>`),vo=c(`<section class="smrt-record-screen__sheet svelte-1ijjiku" data-smrt-component="RecordScreen"><!></section>`),yo=c(`<div data-smrt-component="RecordScreen"><div class="smrt-record-screen__main svelte-1ijjiku"><!> <!> <section class="smrt-record-screen__related svelte-1ijjiku"><!></section></div> <!></div> <!>`,1);function bo(r,c){h(c,!0);let u=(r,i=p,a=p)=>{let o=n(()=>i().type===`records`&&fe(i())&&J.entry(i()).status===`ready`?e(q)[i().id]:void 0);var u=po(),d=A(u),f=A(d,!0),m=M(f),h=t=>{var n=uo(),r=N(n);R(e=>l(r,` · ${e??``}`),[()=>new Intl.NumberFormat(c.locale).format(e(o).count)]),x(t,n)};t(m,t=>{e(o)&&e(o).count!==null&&t(h)}),s(d);var g=M(d,2),_=t=>{var n=fo(),r=N(n,!0);R(t=>{z(n,`href`,e(o).href),l(r,t)},[()=>b($[`ui.screens.view_all`])]),x(t,n)};t(g,t=>{e(o)?.href&&t(_)}),s(u),R(()=>l(f,a())),x(r,u)},d=r=>{var i=ho(),a=I(i),l=t=>{var r=S(),i=I(r);V(i,()=>e(T),t=>{{let r=n(()=>c.fieldErrors??{});Ka(t,{get definition(){return c.definition},get policy(){return f()},get currency(){return e(W)},get fields(){return c.fields},get record(){return c.record},showHeader:!1,get submitting(){return v()},get fieldErrors(){return e(r)},get error(){return y()},get onsubmit(){return c.onsave},oncancel:me,get derivedFields(){return e(ae)}})}}),x(t,r)};t(a,e=>{c.onsave&&e(l)});var u=M(a,2),d=e=>{var t=mo(),n=A(t);o(n,()=>c.items),s(t),R(e=>z(t,`aria-label`,e),[()=>b($[`ui.screens.items`])]),x(e,t)};t(u,e=>{c.items&&e(d)}),x(r,i)},f=E(c,`policy`,3,null),m=E(c,`relations`,19,()=>[]),g=E(c,`canCustomize`,3,!0),_=E(c,`deleting`,3,!1),v=E(c,`submitting`,3,!1),y=E(c,`error`,3,null),{t:b}=ie(),C=n(()=>Tn(c.definition)),w=n(()=>c.definition.idField??`id`),T=n(()=>c.record[e(w)]===void 0||c.record[e(w)]===null?``:String(c.record[e(w)])),k=n(()=>c.mode===`edit`),ee=n(()=>b($[`ui.screens.edit_title`],{name:e(C).singular.toLowerCase()})),te=n(()=>_n(c.definition)),L=n(()=>On(c.definition,f())?[]:Mn(c.definition,f(),{mode:`view`,include:c.fields})),ne=n(()=>so(c.definition,e(L),c.record,e(te),{title:c.title})),H=n(()=>m().some(e=>e.kind===`items`)),U=n(()=>yn(c.definition)),W=n(()=>{if(c.currency)return c.currency;let t=e(U)?c.record[e(U)]:void 0;return typeof t==`string`&&/^[A-Za-z]{3}$/.test(t.trim())?t.trim().toUpperCase():void 0}),ae=n(()=>c.derivedFields??(e(H)?lo(e(te)):[])),oe=F(()=>{let t=c.loaders?.records;if(c.registry&&!t)return c.registry;let n=rt();if(c.registry)for(let e of c.registry.list())n.register(e);else Yi(n,c.loaders??{});if(t){let r=rt();ya(r,{relations:m(),records:t,viewAllHref:e=>c.viewAllHref?.(e),totals:()=>co(c.record,e(te),e(L)),storedTotals:()=>c.lineItemStoredTotals?.(),currency:()=>e(W)});for(let e of r.list())n.has(e.type)||n.register(e)}return n}),G=F(()=>c.overview??pr(c.definition,m())),K=F(()=>c.override!==void 0),se=n(()=>m().filter(e=>e.kind!==`reference`)),q=D(j({}));function ce(t,n){if(t.type!==`records`)return n;let r=fe(t);if(!r||!Q(n))return n;let{total:i,href:a,...o}=n,s=Array.isArray(o.rows)?o.rows.length:null,l=typeof i==`number`&&i>(s??0)&&Array.isArray(o.columns)&&o.columns.length>0;return B(q,{...e(q),[t.id]:{count:typeof i==`number`&&Number.isFinite(i)?i:s,href:c.viewAllHref?.(r)??(typeof a==`string`?gt(a):null)}},!0),l?{...o,total:i}:o}let J=ct({definition:G,registry:oe,override:K?()=>c.override??null:void 0,onchange:e=>c.onoverviewchange?.(e),canCustomize:()=>g(),loadWidget:(t,n)=>{let r=oe.get(t.type)?.load;if(!r)return Promise.resolve(void 0);let i={...c.widgetContext,overviewId:G.id,signal:n,locale:typeof c.widgetContext?.locale==`string`?c.widgetContext.locale:c.locale,record:{model:c.definition.objectRef,id:e(T)}};return Promise.resolve(r(t.options,i)).then(e=>ce(t,e))}});P(()=>J.destroy());let Y=n(()=>e(H)&&J.document.widgets.some(e=>e.type===`line-items`)),le=n(()=>[...e(ne).shown,...e(U)?[e(U)]:[],...e(Y)?lo(e(te)):[]]),ue=F(()=>e(T));O(()=>{let t=e(T);t!==ue&&(ue=t,F(()=>{for(let e of J.document.widgets)J.reload(e.id)}))}),O(()=>{K&&(c.override,F(()=>J.sync()))});let de=n(()=>{let t=[];for(let n of e(se))t.some(e=>e.value===n.model)||t.push({value:n.model,label:n.label});return t});function fe(t){let{filter:n,model:r,field:i}=t.options;if(n===`parent`)return e(se).find(e=>e.model===r&&e.field===i)}let pe=D(!0);O(()=>{if(typeof window>`u`||typeof window.matchMedia!=`function`)return;let e=window.matchMedia(`(min-width: 48rem)`),t=()=>{B(pe,e.matches,!0)};return t(),e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)});function me(){c.oncancel?.()}var he=yo(),X=I(he);let ge;var _e=A(X),ve=A(_e);{let t=n(()=>e(k)?void 0:c.onedit);io(ve,{get definition(){return c.definition},get model(){return e(ne)},get record(){return c.record},get relations(){return m()},get hrefFor(){return c.hrefFor},get labels(){return c.labels},get currency(){return e(W)},get locale(){return c.locale},get backLabel(){return c.backLabel},get deleting(){return _()},get statusTones(){return c.statusTones},get onback(){return c.onback},get onedit(){return e(t)},get ondelete(){return c.ondelete},get extraActions(){return c.extraActions}})}var ye=M(ve,2);Fa(ye,{get definition(){return c.definition},get policy(){return f()},get record(){return c.record},get relations(){return m()},get fields(){return c.fields},get currency(){return e(W)},get locale(){return c.locale},get hrefFor(){return c.hrefFor},get labels(){return c.labels},showHeader:!1,get exclude(){return e(le)},hideEmpty:!0,variant:`card`,children:(e,t)=>{var n=S(),r=I(n);o(r,()=>c.children??p),x(e,n)},$$slots:{default:!0}});var be=M(ye,2),xe=A(be);{let t=n(()=>b($[`ui.screens.related`]));Kt(xe,{get controller(){return J},get editing(){return c.layoutEditing},presentation:`plain`,headingLevel:2,get heading(){return u},get label(){return e(t)},get models(){return e(de)}})}s(be),s(_e);var Se=M(_e,2),Ce=t=>{var n=go(),r=A(n),i=N(r,!0),a=M(r,2);d(a),s(n),R(()=>{z(n,`aria-label`,e(ee)),l(i,e(ee))}),x(t,n)};t(Se,t=>{e(k)&&e(pe)&&t(Ce)}),s(X);var we=M(X,2),Te=n=>{var r=vo(),i=A(r);re(i,{get open(){return e(k)},get title(){return e(ee)},onclose:me,variant:`page`,children:(n,r)=>{var i=S(),a=I(i),o=e=>{var t=_o(),n=A(t);d(n),s(t),x(e,t)};t(a,t=>{e(k)&&t(o)}),x(n,i)},$$slots:{default:!0}}),s(r),x(n,r)};t(we,t=>{e(pe)||t(Te)}),R(t=>{ge=a(X,1,`smrt-record-screen svelte-1ijjiku`,null,ge,{"smrt-record-screen--edit":e(k)}),z(X,`data-mode`,c.mode),z(be,`aria-label`,t)},[()=>b($[`ui.screens.related`])]),x(r,he),i()}var xo=[`name`,`title`,`label`,`code`];function So(e){let t=e.display?.label,n=new Set(e.fields.map(e=>e.name));return[...t?[t]:[],...xo].filter((e,t,r)=>n.has(e)&&r.indexOf(e)===t)}function Co(e,t){for(let n of So(e)){let e=t[n];if(typeof e==`string`&&e.trim()!==``)return e}}var wo=e=>e.type===`foreignKey`||e.type===`crossPackageRef`,To=[/^customer/i,/^vendor/i,/^profile/i,/^product/i,/^invoice/i,/^order/i,/^payment/i,/^contract/i];function Eo(e){if(So(e).some(e=>e!==`code`))return;let t=e.fields.filter(e=>!e.system),n=vn(_n({objectRef:e.id,className:e.name,fields:Object.fromEntries(t.map(e=>[e.name,{type:Do.has(e.type)?e.type:`text`,...e.enum?.length?{enum:e.enum}:{},...e.ui?{ui:{...e.ui}}:{}}]))}),`identifier`);return n?t.find(e=>e.name===n):void 0}var Do=new Set([`text`,`integer`,`decimal`,`boolean`,`datetime`,`json`,`foreignKey`,`crossPackageRef`]);function Oo(e,t){let n=Eo(e),r=n?t[n.name]:void 0;return typeof r==`string`&&r.trim()!==``?r:void 0}function ko(e,t){let n=e.filter(e=>wo(e)&&typeof t[e.name]==`string`&&t[e.name]!==``);for(let e of To){let t=n.find(t=>e.test(t.name));if(t)return t}}var Ao=/(paid|allocated|issue|^date$|createdat)/i;function jo(e,t,n,r=e.fields){let i=Co(e,t);if(i)return i;let a=Oo(e,t);if(a)return a;let o=ko(r,t),s=o?.related?n(o,String(t[o.name])):void 0;if(e.fields.find(e=>e.name===`amount`&&e.type===`integer`)&&typeof t.amount==`number`){let n=e.fields.find(e=>e.type===`datetime`&&Ao.test(e.name)&&t[e.name]);return No([s,oe(t.amount),n?String(t[n.name]).slice(0,10):void 0])}return No([s,typeof t.description==`string`&&t.description.trim()!==``?t.description:void 0])}function Mo(e,t,n,r){if(Co(e,t))return n;let i=Oo(e,t);return i&&i===n?`${r} ${i}`:n}function No(e){let t=e.filter(e=>!!e);return t.filter((e,n)=>t.indexOf(e)===n).join(` · `)||void 0}var Po=`@happyvertical/smrt-profiles:Profile`,Fo=`@happyvertical/smrt-commerce:Customer`,Io=`@happyvertical/smrt-commerce:Vendor`,Lo=20;function Ro(e){let t=G(e);if(!t)throw Error(`The catalog has no model ${e}`);return t.model}function zo(e){return String(e??``).slice(0,8)}function Bo(e){return e.fields.some(e=>e.name===`profileId`&&e.related===`@happyvertical/smrt-profiles:Profile`)}async function Vo(e,t){return typeof t.profileId==`string`&&t.profileId?e.get(Ro(Po),t.profileId):void 0}var Ho=3;async function Uo(e,t,n,r=0,i){if(Bo(t)){let t=await Vo(e,n),r=t&&Co(Ro(`@happyvertical/smrt-profiles:Profile`),t);if(r)return r}let a=ko(t.fields,n);if(a&&a.name===i){let e=jo(t,n,()=>void 0);if(e)return e}let o=a?.related?G(a.related)?.model:void 0,s;if(a&&o&&r<Ho){let t=await e.get(o,String(n[a.name]));t&&(s=await Uo(e,o,t,r+1))}return jo(t,n,()=>s)??zo(n.id)}async function Wo(e,t,n){let r=new Map;for(let i of t){let t=i.related;if(!t)continue;let a=G(t)?.model;if(!a)continue;let o=new Set(n.map(e=>e[i.name]).filter(e=>typeof e==`string`&&e!==``));for(let n of o){if(r.has(K(t,n)))continue;let i=await e.get(a,n);i&&r.set(K(t,n),await Uo(e,a,i))}}return r}var Go=(e,t)=>e.toLowerCase().includes(t.trim().toLowerCase());async function Ko(e,t,n){let r=[];for(let i of await e.list(t)){let a=await Uo(e,t,i);if(Go(a,n)&&r.push({id:i.id,label:a}),r.length>=Lo)break}return r}async function qo(e,t,n){let r=await e.get(t,n);return r?{id:r.id,label:await Uo(e,t,r)}:null}var Jo=e=>typeof e==`string`&&e!==``?e:void 0;async function Yo(e,t){let n=await Vo(e,t);return{...n?{id:n.id}:{},name:(n&&Co(Ro(`@happyvertical/smrt-profiles:Profile`),n))??zo(t.id),...Jo(n?.email)?{email:Jo(n?.email)}:{}}}async function Xo(e,t){return{id:t.id,...Jo(t.profileId)?{profileId:Jo(t.profileId)}:{},profile:await Yo(e,t),status:Jo(t.status)??``,...Jo(t.customerType)?{customerType:Jo(t.customerType)}:{},...typeof t.creditLimit==`number`?{creditLimitMinor:t.creditLimit}:{},...Jo(t.paymentTerms)?{paymentTerms:Jo(t.paymentTerms)}:{}}}async function Zo(e,t){return{id:t.id,...Jo(t.profileId)?{profileId:Jo(t.profileId)}:{},profile:await Yo(e,t),status:Jo(t.status)??``,...typeof t.leadTimeDays==`number`?{leadTimeDays:t.leadTimeDays}:{},...Jo(t.currency)?{currency:Jo(t.currency)}:{}}}async function Qo(e,t){let n=[];for(let r of await e.list(Ro(Fo))){let i=await Xo(e,r);if(Go(i.profile.name,t)&&n.push(i),n.length>=Lo)break}return n}async function $o(e,t){let n=await e.get(Ro(Fo),t);return n?Xo(e,n):null}async function es(e,t){let n=[];for(let r of await e.list(Ro(Io))){let i=await Zo(e,r);if(Go(i.profile.name,t)&&n.push(i),n.length>=Lo)break}return n}async function ts(e,t){let n=await e.get(Ro(Io),t);return n?Zo(e,n):null}export{rt as A,$n as C,_n as D,yn as E,Re as F,et as M,Ge as N,Kt as O,Ze as P,dr as S,Cn as T,_a as _,qo as a,wr as b,Ko as c,So as d,Mo as f,va as g,co as h,$o as i,$e as j,ct as k,es as l,bo as m,Uo as n,ts as o,jo as p,Wo as r,Qo as s,Bo as t,zo as u,Yi as v,Zn as w,pr as x,Dr as y};
|