@happyvertical/smrt-planner 0.57.16 → 0.57.18
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/shell.md +4 -1
- package/app/404.html +18 -18
- package/app/_app/immutable/chunks/{BxX_79XJ.js → 3YcXW6yo.js} +1 -1
- package/app/_app/immutable/chunks/{vsq4E2m7.js → B094Upwj.js} +1 -1
- package/app/_app/immutable/chunks/{BnfHLvXn.js → B5cHPql0.js} +1 -1
- package/app/_app/immutable/chunks/B6l3em0z.js +2 -0
- package/app/_app/immutable/chunks/{B29WjYP5.js → BKaViC3K.js} +1 -1
- package/app/_app/immutable/chunks/{BD6rgOfn.js → BMzaHFhM.js} +1 -1
- package/app/_app/immutable/chunks/{C3soiNdP.js → BSd70kcz.js} +5 -5
- package/app/_app/immutable/chunks/BkH1cevg.js +16 -0
- package/app/_app/immutable/chunks/{CXPo72CL.js → BqoDi2ah.js} +21 -21
- package/app/_app/immutable/chunks/{ZyeZpu_Z.js → C3_MyZ8U.js} +1 -1
- package/app/_app/immutable/chunks/{Dapxnz2C.js → CEnFvaV_.js} +1 -1
- package/app/_app/immutable/chunks/{BlPoOib9.js → CR7v6iSc.js} +1 -1
- package/app/_app/immutable/chunks/{DURcYLyk.js → CRAFzMd4.js} +3 -3
- package/app/_app/immutable/chunks/CYV1bZYS.js +2 -0
- package/app/_app/immutable/chunks/{CYql-HTd.js → CckqctPA.js} +1 -1
- package/app/_app/immutable/chunks/{Dh1aRV-5.js → CguB2Z-c.js} +1 -1
- package/app/_app/immutable/chunks/{Bbl6Vsf2.js → CmzwyvUc.js} +1 -1
- package/app/_app/immutable/chunks/{CWQqx7C7.js → Cwt6a32V.js} +1 -1
- package/app/_app/immutable/chunks/{BQGfk9t2.js → D18ccNbM.js} +1 -1
- package/app/_app/immutable/chunks/{6ott4F8t.js → D4ZXuDn5.js} +1 -1
- package/app/_app/immutable/chunks/D4xI8dt4.js +1 -0
- package/app/_app/immutable/chunks/{BxTs8P01.js → DNKv-5Rn.js} +1 -1
- package/app/_app/immutable/chunks/DdwZKwdT.js +1 -0
- package/app/_app/immutable/chunks/Do3aLnHk.js +1 -0
- package/app/_app/immutable/chunks/{DPcs_FRu.js → WxmttVik.js} +1 -1
- package/app/_app/immutable/chunks/{DJhmPAeb.js → cgG95It7.js} +1 -1
- package/app/_app/immutable/chunks/{CxmNJ62m.js → masgq8Qh.js} +1 -1
- package/app/_app/immutable/chunks/qBSxbVXE.js +4 -0
- package/app/_app/immutable/chunks/{dLwKu_Zp.js → yoo-DzHO.js} +1 -1
- package/app/_app/immutable/entry/{app.CW8FtNr0.js → app.Bfo_XQ_u.js} +2 -2
- package/app/_app/immutable/entry/start.COZRMvoH.js +1 -0
- package/app/_app/immutable/nodes/{0.DqyO6m6q.js → 0.CpAyxFG1.js} +2 -2
- package/app/_app/immutable/nodes/{1.BIXVkBVQ.js → 1.BIIgo6hP.js} +1 -1
- package/app/_app/immutable/nodes/{10.C4cTWnnq.js → 10.p-z5jbqI.js} +1 -1
- package/app/_app/immutable/nodes/{11.HoVqgyz1.js → 11.DikmsDwP.js} +1 -1
- package/app/_app/immutable/nodes/{12.CO24sNAm.js → 12.OJHha47l.js} +3 -3
- package/app/_app/immutable/nodes/{13.Clf4Jyo5.js → 13.B5uFEHhN.js} +1 -1
- package/app/_app/immutable/nodes/14.DSqhro7V.js +1 -0
- package/app/_app/immutable/nodes/{2.bUwTzzu3.js → 2.BsxeuTRf.js} +8 -8
- package/app/_app/immutable/nodes/{3.BSL8eQrf.js → 3.4GrrsC59.js} +1 -1
- package/app/_app/immutable/nodes/{4.BNokdlBB.js → 4.CyWWMczB.js} +1 -1
- package/app/_app/immutable/nodes/{5.CdEkISNH.js → 5.B3AevRqW.js} +1 -1
- package/app/_app/immutable/nodes/{6._evVXUuN.js → 6.DOjCozUO.js} +1 -1
- package/app/_app/immutable/nodes/{7.BJQbl-EW.js → 7.BVKnH6b6.js} +1 -1
- package/app/_app/immutable/nodes/{8.CaKFFEpk.js → 8.wnGurkrO.js} +1 -1
- package/app/_app/immutable/nodes/{9.D3k07D1g.js → 9.PyL2mnd3.js} +1 -1
- package/app/_app/version.json +1 -1
- package/app/advanced-styles/index.html +21 -21
- package/app/ai/index.html +24 -24
- package/app/blueprint/index.html +19 -19
- package/app/cookbook/index.html +19 -19
- package/app/index.html +31 -31
- package/app/m/ads/AdDeliveryTier/index.html +23 -23
- package/app/m/ads/AdEvent/index.html +23 -23
- package/app/m/ads/AdFormat/index.html +23 -23
- package/app/m/ads/AdGroup/index.html +23 -23
- package/app/m/ads/AdVariation/index.html +23 -23
- package/app/m/analytics/AnalyticsDataStream/index.html +23 -23
- package/app/m/analytics/AnalyticsEvent/index.html +23 -23
- package/app/m/analytics/AnalyticsProperty/index.html +23 -23
- package/app/m/analytics/AnalyticsReport/index.html +23 -23
- package/app/m/approvals/ApprovalEvent/index.html +23 -23
- package/app/m/approvals/ApprovalPolicy/index.html +23 -23
- package/app/m/approvals/ApprovalRequest/index.html +23 -23
- package/app/m/assets/Asset/attachments/index.html +24 -24
- package/app/m/assets/Asset/index.html +23 -23
- package/app/m/assets/AssetAssociation/index.html +23 -23
- package/app/m/assets/AssetMetafield/index.html +23 -23
- package/app/m/assets/AssetStatus/index.html +23 -23
- package/app/m/assets/AssetType/index.html +23 -23
- package/app/m/assets/Folder/index.html +23 -23
- package/app/m/chat/AgentSession/index.html +23 -23
- package/app/m/chat/ChatMessage/index.html +23 -23
- package/app/m/chat/ChatParticipant/index.html +23 -23
- package/app/m/chat/ChatReaction/index.html +23 -23
- package/app/m/chat/ChatRoom/index.html +23 -23
- package/app/m/chat/ChatThread/index.html +23 -23
- package/app/m/chat/VoiceGatewayTurn/index.html +23 -23
- package/app/m/chat/VoiceSession/index.html +23 -23
- package/app/m/commerce/Agreement/index.html +23 -23
- package/app/m/commerce/Cart/index.html +23 -23
- package/app/m/commerce/Contract/index.html +23 -23
- package/app/m/commerce/ContractLineItem/index.html +23 -23
- package/app/m/commerce/Customer/index.html +23 -23
- package/app/m/commerce/DocumentTax/index.html +23 -23
- package/app/m/commerce/Estimate/index.html +23 -23
- package/app/m/commerce/Fulfillment/index.html +23 -23
- package/app/m/commerce/FulfillmentLineItem/index.html +23 -23
- package/app/m/commerce/HistoricalCustomerFunds/index.html +23 -23
- package/app/m/commerce/HistoricalCustomerFundsAllocation/index.html +23 -23
- package/app/m/commerce/HistoricalSalesLine/index.html +23 -23
- package/app/m/commerce/Invoice/index.html +23 -23
- package/app/m/commerce/InvoiceLineItem/index.html +23 -23
- package/app/m/commerce/Lease/index.html +23 -23
- package/app/m/commerce/LicenseSale/index.html +23 -23
- package/app/m/commerce/Order/index.html +23 -23
- package/app/m/commerce/Payment/index.html +23 -23
- package/app/m/commerce/PaymentAllocation/index.html +23 -23
- package/app/m/commerce/PaymentInstrument/index.html +23 -23
- package/app/m/commerce/PaymentIntent/index.html +23 -23
- package/app/m/commerce/Payout/index.html +23 -23
- package/app/m/commerce/ProductionOrder/index.html +23 -23
- package/app/m/commerce/PurchaseContract/index.html +23 -23
- package/app/m/commerce/PurchaseOrder/index.html +23 -23
- package/app/m/commerce/SalesContract/index.html +23 -23
- package/app/m/commerce/SupplierQuote/index.html +23 -23
- package/app/m/commerce/TaxCode/index.html +23 -23
- package/app/m/commerce/TaxComponent/index.html +23 -23
- package/app/m/commerce/TaxSettings/index.html +23 -23
- package/app/m/commerce/TaxSummaryReport/index.html +23 -23
- package/app/m/commerce/TenantPaymentAccount/index.html +23 -23
- package/app/m/commerce/Vendor/index.html +23 -23
- package/app/m/commerce/WholesaleOrder/index.html +23 -23
- package/app/m/content/Content/index.html +23 -23
- package/app/m/content/ContentContribution/index.html +23 -23
- package/app/m/content/ContentContributionAttachment/index.html +23 -23
- package/app/m/content/ContentContributionRevision/index.html +23 -23
- package/app/m/content/ContentContributionType/index.html +23 -23
- package/app/m/content/ContentContributor/index.html +23 -23
- package/app/m/content/ContentCorrection/index.html +23 -23
- package/app/m/content/ContentFeedSource/index.html +23 -23
- package/app/m/content/ContentGovernanceAssignment/index.html +23 -23
- package/app/m/content/ContentGovernancePolicy/index.html +23 -23
- package/app/m/content/ContentGovernanceProfile/index.html +23 -23
- package/app/m/content/ContentReference/index.html +23 -23
- package/app/m/content/ContentReview/index.html +23 -23
- package/app/m/content/ContentVersion/index.html +23 -23
- package/app/m/events/Event/index.html +23 -23
- package/app/m/events/EventParticipant/index.html +23 -23
- package/app/m/events/EventSeries/index.html +23 -23
- package/app/m/events/EventType/index.html +23 -23
- package/app/m/expenses/Expense/index.html +23 -23
- package/app/m/facts/Fact/index.html +23 -23
- package/app/m/facts/FactContent/index.html +23 -23
- package/app/m/facts/FactEvidence/index.html +23 -23
- package/app/m/facts/FactSource/index.html +23 -23
- package/app/m/facts/FactSubject/index.html +23 -23
- package/app/m/facts/FactTag/index.html +23 -23
- package/app/m/fields/FieldPolicy/index.html +23 -23
- package/app/m/fields/FieldPolicySuggestion/index.html +23 -23
- package/app/m/fields/FieldUsageCounter/index.html +23 -23
- package/app/m/images/Image/index.html +23 -23
- package/app/m/inventory/InventoryLocation/index.html +23 -23
- package/app/m/inventory/Lot/index.html +88 -0
- package/app/m/inventory/LotCorrection/index.html +88 -0
- package/app/m/inventory/LotDocument/index.html +88 -0
- package/app/m/inventory/LotStockLevel/index.html +88 -0
- package/app/m/inventory/LotUsage/index.html +88 -0
- package/app/m/inventory/StockLevel/index.html +23 -23
- package/app/m/inventory/StockMovement/index.html +23 -23
- package/app/m/ledgers/Account/index.html +23 -23
- package/app/m/ledgers/Journal/index.html +23 -23
- package/app/m/ledgers/JournalEntry/index.html +23 -23
- package/app/m/ledgers/Ledger/index.html +23 -23
- package/app/m/manufacturing/Assembly/index.html +23 -23
- package/app/m/manufacturing/BillOfMaterials/index.html +23 -23
- package/app/m/manufacturing/BomLine/index.html +23 -23
- package/app/m/manufacturing/Operation/index.html +23 -23
- package/app/m/manufacturing/ProductionRun/index.html +23 -23
- package/app/m/manufacturing/ProductionRunCompletion/index.html +23 -23
- package/app/m/manufacturing/RoutingStep/index.html +23 -23
- package/app/m/marketing/Campaign/index.html +23 -23
- package/app/m/marketing/CampaignChannel/index.html +23 -23
- package/app/m/marketing/CampaignMetricSnapshot/index.html +23 -23
- package/app/m/messages/Account/index.html +23 -23
- package/app/m/messages/Attachment/index.html +23 -23
- package/app/m/messages/Blacklist/index.html +23 -23
- package/app/m/messages/Email/failed-sends/index.html +24 -24
- package/app/m/messages/Email/index.html +23 -23
- package/app/m/messages/Email/mailbox/index.html +24 -24
- package/app/m/messages/EmailAccount/index.html +23 -23
- package/app/m/messages/EmailAttachment/index.html +23 -23
- package/app/m/messages/EmailFolder/index.html +23 -23
- package/app/m/messages/Message/index.html +23 -23
- package/app/m/messages/MessagingEndpoint/index.html +23 -23
- package/app/m/messages/PersonaMessageRoute/index.html +23 -23
- package/app/m/messages/SlackAccount/index.html +23 -23
- package/app/m/messages/SlackMessage/index.html +23 -23
- package/app/m/messages/TelegramAccount/index.html +23 -23
- package/app/m/messages/Tweet/index.html +23 -23
- package/app/m/messages/TwitterAccount/index.html +23 -23
- package/app/m/messages/Whitelist/index.html +23 -23
- package/app/m/messages/ZulipAccount/index.html +23 -23
- package/app/m/places/Place/index.html +23 -23
- package/app/m/places/PlaceType/index.html +23 -23
- package/app/m/products/Category/index.html +23 -23
- package/app/m/products/Material/index.html +23 -23
- package/app/m/products/Product/index.html +23 -23
- package/app/m/products/Product/ingredients/index.html +24 -24
- package/app/m/products/ProductVariant/index.html +23 -23
- package/app/m/products/Sku/index.html +23 -23
- package/app/m/profiles/ApiKey/index.html +23 -23
- package/app/m/profiles/Bot/index.html +23 -23
- package/app/m/profiles/MagicLinkToken/index.html +23 -23
- package/app/m/profiles/NostrIdentity/index.html +23 -23
- package/app/m/profiles/OidcIdentity/index.html +23 -23
- package/app/m/profiles/Organization/index.html +23 -23
- package/app/m/profiles/Person/index.html +23 -23
- package/app/m/profiles/Profile/index.html +23 -23
- package/app/m/profiles/ProfileMetadata/index.html +23 -23
- package/app/m/profiles/ProfileMetafield/index.html +23 -23
- package/app/m/profiles/ProfileRelationship/index.html +23 -23
- package/app/m/profiles/ProfileRelationshipTerm/index.html +23 -23
- package/app/m/profiles/ProfileRelationshipType/index.html +23 -23
- package/app/m/profiles/ProfileType/index.html +23 -23
- package/app/m/projects/Comment/index.html +23 -23
- package/app/m/projects/Issue/index.html +23 -23
- package/app/m/projects/Label/index.html +23 -23
- package/app/m/projects/Project/index.html +23 -23
- package/app/m/projects/ProjectIntegration/index.html +23 -23
- package/app/m/projects/PullRequest/index.html +23 -23
- package/app/m/projects/Repository/index.html +23 -23
- package/app/m/properties/Property/index.html +23 -23
- package/app/m/properties/Zone/index.html +23 -23
- package/app/m/reports/RuntimeReport/index.html +23 -23
- package/app/m/reports/SmrtPrincipalReportRefreshTask/index.html +23 -23
- package/app/m/reports/SmrtReportLock/index.html +23 -23
- package/app/m/reports/SmrtReportRefreshTask/index.html +23 -23
- package/app/m/reports/SmrtReportRun/index.html +23 -23
- package/app/m/reports/SmrtReportSchedule/index.html +23 -23
- package/app/m/reports/SmrtReportWatermark/index.html +23 -23
- package/app/m/sales/Agreement/index.html +23 -23
- package/app/m/sales/AttributionException/index.html +23 -23
- package/app/m/sales/AttributionPolicy/index.html +23 -23
- package/app/m/sales/Commission/index.html +23 -23
- package/app/m/sales/CommissionAdjustment/index.html +23 -23
- package/app/m/sales/CommissionPayout/index.html +23 -23
- package/app/m/sales/CommissionPlan/index.html +23 -23
- package/app/m/sales/Earner/index.html +23 -23
- package/app/m/sales/EarnerSourceAttribution/index.html +23 -23
- package/app/m/sales/EarningEvent/index.html +23 -23
- package/app/m/sales/ExecutedAgreement/index.html +23 -23
- package/app/m/sales/Lead/index.html +23 -23
- package/app/m/sales/Opportunity/index.html +23 -23
- package/app/m/sales/OpportunityConversion/index.html +23 -23
- package/app/m/sales/PipelineDefinition/index.html +23 -23
- package/app/m/sales/PipelineStage/index.html +23 -23
- package/app/m/sales/Referral/index.html +23 -23
- package/app/m/sales/ReferralAgreement/index.html +23 -23
- package/app/m/sales/ReferralLink/index.html +23 -23
- package/app/m/sales/ReferralProgram/index.html +23 -23
- package/app/m/sales/ReferralTermSnapshot/index.html +23 -23
- package/app/m/sales/ReferralTouch/index.html +23 -23
- package/app/m/sales/Referrer/index.html +23 -23
- package/app/m/sales/SalesActivity/index.html +23 -23
- package/app/m/sales/SalesRepresentative/index.html +23 -23
- package/app/m/sites/Site/index.html +23 -23
- package/app/m/sites/SiteAgentBinding/index.html +23 -23
- package/app/m/social/OAuthState/index.html +23 -23
- package/app/m/social/SocialAccount/index.html +23 -23
- package/app/m/social/SocialPost/index.html +23 -23
- package/app/m/social/SocialPostAnalyticsSnapshot/index.html +23 -23
- package/app/m/subscriptions/BillingAdjustment/index.html +23 -23
- package/app/m/subscriptions/ClientCharge/index.html +23 -23
- package/app/m/subscriptions/CreditGrant/index.html +23 -23
- package/app/m/subscriptions/PricingRule/index.html +23 -23
- package/app/m/subscriptions/RetailCharge/index.html +23 -23
- package/app/m/subscriptions/SpendingPolicy/index.html +23 -23
- package/app/m/subscriptions/SubscriptionPlan/index.html +23 -23
- package/app/m/subscriptions/SubscriptionPlanVersion/index.html +23 -23
- package/app/m/subscriptions/TenantSubscription/index.html +23 -23
- package/app/m/subscriptions/TenantUsageMetric/index.html +23 -23
- package/app/m/support/ServiceTimeEntry/index.html +23 -23
- package/app/m/support/SupportAiRun/index.html +23 -23
- package/app/m/support/SupportAvailability/index.html +23 -23
- package/app/m/support/SupportCase/index.html +23 -23
- package/app/m/support/SupportCaseEvent/index.html +23 -23
- package/app/m/support/SupportChannelBinding/index.html +23 -23
- package/app/m/support/SupportCharge/index.html +23 -23
- package/app/m/support/SupportCompensation/index.html +23 -23
- package/app/m/support/SupportCompensationPlan/index.html +23 -23
- package/app/m/support/SupportEscalation/index.html +23 -23
- package/app/m/support/SupportInteraction/index.html +23 -23
- package/app/m/support/SupportPlan/index.html +23 -23
- package/app/m/support/SupportPolicy/index.html +23 -23
- package/app/m/support/SupportQualification/index.html +23 -23
- package/app/m/support/SupportServiceTarget/index.html +23 -23
- package/app/m/support/SupportSpecialist/index.html +23 -23
- package/app/m/support/SupportWorkLink/index.html +23 -23
- package/app/m/tags/Tag/index.html +23 -23
- package/app/m/tags/TagAlias/index.html +23 -23
- package/app/m/timesheets/AttendanceBreak/index.html +23 -23
- package/app/m/timesheets/AttendancePunch/index.html +23 -23
- package/app/m/timesheets/AttendanceSegment/index.html +23 -23
- package/app/m/timesheets/ServiceChargeSnapshot/index.html +23 -23
- package/app/m/timesheets/ServiceCompensationSnapshot/index.html +23 -23
- package/app/m/timesheets/ServiceTimeEntry/index.html +23 -23
- package/app/m/users/Group/index.html +23 -23
- package/app/m/users/GroupMember/index.html +23 -23
- package/app/m/users/GroupRole/index.html +23 -23
- package/app/m/users/Membership/index.html +23 -23
- package/app/m/users/MembershipOverride/index.html +23 -23
- package/app/m/users/Permission/index.html +23 -23
- package/app/m/users/Role/index.html +23 -23
- package/app/m/users/RolePermission/index.html +23 -23
- package/app/m/users/Session/index.html +23 -23
- package/app/m/users/Tenant/index.html +23 -23
- package/app/m/users/TenantIntegration/index.html +23 -23
- package/app/m/users/TenantPermissionOverride/index.html +23 -23
- package/app/m/users/User/index.html +23 -23
- package/app/m/video/Character/index.html +23 -23
- package/app/m/video/CharacterAsset/index.html +23 -23
- package/app/m/video/CompositeJob/index.html +23 -23
- package/app/m/video/Performer/index.html +23 -23
- package/app/m/video/PerformerAsset/index.html +23 -23
- package/app/m/video/Scene/index.html +23 -23
- package/app/m/video/SceneAsset/index.html +23 -23
- package/app/m/video/VideoComposition/index.html +23 -23
- package/app/m/video/VideoCompositionAsset/index.html +23 -23
- package/app/m/video/VideoSequence/index.html +23 -23
- package/app/m/video/VideoSequenceAsset/index.html +23 -23
- package/app/m/video/VideoShot/index.html +23 -23
- package/app/m/video/VideoShotAsset/index.html +23 -23
- package/app/m/video/VideoShotCharacter/index.html +23 -23
- package/app/m/video/VideoWorkflow/index.html +23 -23
- package/app/m/voice/VoiceOutput/index.html +23 -23
- package/app/m/voice/VoiceProfile/index.html +23 -23
- package/app/m/voice/VoiceSample/index.html +23 -23
- package/app/mcp.html +2 -2
- package/app/packages/ads/index.html +21 -21
- package/app/packages/analytics/index.html +21 -21
- package/app/packages/approvals/index.html +21 -21
- package/app/packages/assets/index.html +21 -21
- package/app/packages/chat/index.html +21 -21
- package/app/packages/comments/index.html +21 -21
- package/app/packages/commerce/index.html +21 -21
- package/app/packages/content/index.html +21 -21
- package/app/packages/events/index.html +21 -21
- package/app/packages/expenses/index.html +21 -21
- package/app/packages/facts/index.html +21 -21
- package/app/packages/fields/index.html +21 -21
- package/app/packages/human-resources/index.html +21 -21
- package/app/packages/images/index.html +21 -21
- package/app/packages/index.html +21 -21
- package/app/packages/ingestion/index.html +21 -21
- package/app/packages/inventory/index.html +22 -22
- package/app/packages/ledgers/index.html +21 -21
- package/app/packages/manufacturing/index.html +21 -21
- package/app/packages/marketing/index.html +21 -21
- package/app/packages/messages/index.html +21 -21
- package/app/packages/places/index.html +21 -21
- package/app/packages/preferences/index.html +21 -21
- package/app/packages/products/index.html +21 -21
- package/app/packages/profiles/index.html +21 -21
- package/app/packages/projects/index.html +21 -21
- package/app/packages/properties/index.html +21 -21
- package/app/packages/reports/index.html +21 -21
- package/app/packages/sales/index.html +21 -21
- package/app/packages/sites/index.html +21 -21
- package/app/packages/social/index.html +21 -21
- package/app/packages/subscriptions/index.html +21 -21
- package/app/packages/support/index.html +21 -21
- package/app/packages/tags/index.html +21 -21
- package/app/packages/timesheets/index.html +21 -21
- package/app/packages/users/index.html +22 -22
- package/app/packages/video/index.html +21 -21
- package/app/packages/voice/index.html +21 -21
- package/app/packages/webhooks/index.html +21 -21
- package/app/recipes/account-access/help/index.html +22 -22
- package/app/recipes/account-access/index.html +23 -23
- package/app/recipes/activity/help/index.html +21 -21
- package/app/recipes/activity/index.html +23 -23
- package/app/recipes/agreements/help/index.html +21 -21
- package/app/recipes/agreements/index.html +23 -23
- package/app/recipes/analytics.reports/help/index.html +21 -21
- package/app/recipes/analytics.reports/index.html +23 -23
- package/app/recipes/assets/help/index.html +21 -21
- package/app/recipes/assets/index.html +23 -23
- package/app/recipes/billing/help/index.html +21 -21
- package/app/recipes/billing/index.html +23 -23
- package/app/recipes/chat.assistant/help/index.html +21 -21
- package/app/recipes/chat.assistant/index.html +23 -23
- package/app/recipes/comments/help/index.html +21 -21
- package/app/recipes/comments/index.html +23 -23
- package/app/recipes/commerce.customers/help/index.html +21 -21
- package/app/recipes/commerce.customers/index.html +23 -23
- package/app/recipes/commerce.estimates/help/index.html +21 -21
- package/app/recipes/commerce.estimates/index.html +23 -23
- package/app/recipes/commerce.purchases/help/index.html +21 -21
- package/app/recipes/commerce.purchases/index.html +23 -23
- package/app/recipes/commerce.sales/help/index.html +21 -21
- package/app/recipes/commerce.sales/index.html +23 -23
- package/app/recipes/commerce.vendors/help/index.html +21 -21
- package/app/recipes/commerce.vendors/index.html +23 -23
- package/app/recipes/commerce.wholesale/help/index.html +21 -21
- package/app/recipes/commerce.wholesale/index.html +23 -23
- package/app/recipes/events.calendar/help/index.html +21 -21
- package/app/recipes/events.calendar/index.html +23 -23
- package/app/recipes/expenses.tracking/help/index.html +21 -21
- package/app/recipes/expenses.tracking/index.html +23 -23
- package/app/recipes/fields.form-customization/help/index.html +21 -21
- package/app/recipes/fields.form-customization/index.html +23 -23
- package/app/recipes/ingestion/help/index.html +21 -21
- package/app/recipes/ingestion/index.html +23 -23
- package/app/recipes/integrations/help/index.html +21 -21
- package/app/recipes/integrations/index.html +23 -23
- package/app/recipes/inventory.stock/help/index.html +22 -22
- package/app/recipes/inventory.stock/index.html +23 -23
- package/app/recipes/ledgers.bookkeeping/help/index.html +21 -21
- package/app/recipes/ledgers.bookkeeping/index.html +23 -23
- package/app/recipes/messages/help/index.html +21 -21
- package/app/recipes/messages/index.html +23 -23
- package/app/recipes/products/help/index.html +21 -21
- package/app/recipes/products/index.html +23 -23
- package/app/recipes/projects.tracker/help/index.html +21 -21
- package/app/recipes/projects.tracker/index.html +23 -23
- package/app/recipes/reports.materialized/help/index.html +21 -21
- package/app/recipes/reports.materialized/index.html +23 -23
- package/app/recipes/reports.runtime/help/index.html +21 -21
- package/app/recipes/reports.runtime/index.html +23 -23
- package/app/recipes/sales.pipeline/help/index.html +21 -21
- package/app/recipes/sales.pipeline/index.html +23 -23
- package/app/recipes/tags.taxonomy/help/index.html +21 -21
- package/app/recipes/tags.taxonomy/index.html +23 -23
- package/app/recipes/team-collaboration/help/index.html +21 -21
- package/app/recipes/team-collaboration/index.html +23 -23
- package/app/recipes/timesheets.time-entries/help/index.html +21 -21
- package/app/recipes/timesheets.time-entries/index.html +23 -23
- package/app/s/custom-accounts/index.html +19 -19
- package/app/s/custom-appointments/index.html +19 -19
- package/app/s/custom-billing/index.html +19 -19
- package/app/s/custom-bookings/index.html +19 -19
- package/app/s/custom-buying/index.html +19 -19
- package/app/s/custom-checkout/index.html +19 -19
- package/app/s/custom-classes/index.html +19 -19
- package/app/s/custom-clients/index.html +19 -19
- package/app/s/custom-events/index.html +19 -19
- package/app/s/custom-fleet/index.html +19 -19
- package/app/s/custom-gigs/index.html +19 -19
- package/app/s/custom-giving/index.html +19 -19
- package/app/s/custom-instruments/index.html +19 -19
- package/app/s/custom-jobs/index.html +19 -19
- package/app/s/custom-kitchen/index.html +19 -19
- package/app/s/custom-lessons/index.html +19 -19
- package/app/s/custom-material/index.html +19 -19
- package/app/s/custom-meetings/index.html +19 -19
- package/app/s/custom-members/index.html +19 -19
- package/app/s/custom-merch/index.html +19 -19
- package/app/s/custom-money/index.html +19 -19
- package/app/s/custom-paint/index.html +19 -19
- package/app/s/custom-parts/index.html +19 -19
- package/app/s/custom-rentals/index.html +19 -19
- package/app/s/custom-roastery/index.html +19 -19
- package/app/s/custom-schedule/index.html +19 -19
- package/app/s/custom-shelf/index.html +19 -19
- package/app/s/custom-shop/index.html +19 -19
- package/app/s/custom-students/index.html +19 -19
- package/app/s/custom-wholesale/index.html +19 -19
- package/app/s/custom-work/index.html +19 -19
- package/app/s/custom-yard/index.html +19 -19
- package/app/s/section-access-control/index.html +19 -19
- package/app/s/section-account-security/index.html +19 -19
- package/app/s/section-accounting/index.html +19 -19
- package/app/s/section-activity/index.html +19 -19
- package/app/s/section-agreements/index.html +19 -19
- package/app/s/section-analytics/index.html +19 -19
- package/app/s/section-assets/index.html +19 -19
- package/app/s/section-billing/index.html +19 -19
- package/app/s/section-calendar/index.html +19 -19
- package/app/s/section-catalog/index.html +19 -19
- package/app/s/section-chat.assistant/index.html +19 -19
- package/app/s/section-comments/index.html +19 -19
- package/app/s/section-fields.form-customization/index.html +19 -19
- package/app/s/section-ingestion/index.html +19 -19
- package/app/s/section-integrations/index.html +19 -19
- package/app/s/section-messages/index.html +19 -19
- package/app/s/section-more/index.html +19 -19
- package/app/s/section-operations/index.html +19 -19
- package/app/s/section-projects/index.html +19 -19
- package/app/s/section-purchasing/index.html +19 -19
- package/app/s/section-reports.materialized/index.html +19 -19
- package/app/s/section-reports.runtime/index.html +19 -19
- package/app/s/section-sales/index.html +19 -19
- package/app/s/section-taxonomy/index.html +19 -19
- package/app/s/section-team/index.html +19 -19
- package/app/s/section-work/index.html +19 -19
- package/dist/catalog/catalog.json +937 -39
- package/dist/overviews/registry.d.ts.map +1 -1
- package/dist/overviews/registry.js +24 -11
- package/dist/smrt-version.d.ts +1 -1
- package/dist/smrt-version.js +1 -1
- package/package.json +54 -54
- package/app/_app/immutable/chunks/1tQGPi8J.js +0 -2
- package/app/_app/immutable/chunks/3JC1zxNN.js +0 -1
- package/app/_app/immutable/chunks/BG_AWqA3.js +0 -2
- package/app/_app/immutable/chunks/CEGflXJ6.js +0 -4
- package/app/_app/immutable/chunks/CpfTjiSP.js +0 -1
- package/app/_app/immutable/chunks/DBoTKMLo.js +0 -16
- package/app/_app/immutable/chunks/KBE5GUjR.js +0 -1
- package/app/_app/immutable/entry/start.CEefgxcS.js +0 -1
- package/app/_app/immutable/nodes/14.oo80hNyP.js +0 -1
|
@@ -1,4 +0,0 @@
|
|
|
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 ee,d as O,ft as k,g as A,gt as j,ht as M,j as N,mt as P,n as te,nt as F,pt as I,q as L,st as R,v as z,vt as B,z as ne}from"./DG3qFFTE.js";import"./xihTtKlq.js";import{i as re,o as ie,r as ae,t as oe}from"./Bv5jGtB8.js";import{a as V,t as se}from"./YUSKx8_q.js";import{Et as ce,bt as le,d as H,h as U,jt as ue,kt as W}from"./CXPo72CL.js";import{n as G,t as K}from"./DK8Blf1Y.js";import{n as q,r as de}from"./By9nPosf.js";import{a as fe,d as pe,l as me,m as he,o as ge,s as _e}from"./DIE02RSm.js";import{t as J}from"./BQGfk9t2.js";import{b as Y,d as X,l as ve,n as ye,u as be}from"./Bs5WxZDd.js";import{$ as xe,Q as Se}from"./DBoTKMLo.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 typeof e==`object`&&!!e&&`default`in e}async function ot(e,t=it){let n=new Map;return await Promise.all([...new Set(e)].map(async e=>{let r=t.get(e);if(r){if(r.component)n.set(e,r.component);else if(r.loadComponent)try{let t=await r.loadComponent();n.set(e,at(t)?t.default:t)}catch{}}})),n}function st(e){return JSON.stringify([e.type,e.version??1,e.options])}var ct=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:st(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||lt(e,t.prior))return;let n=t.values.findIndex(t=>lt(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===st(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 lt(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 lt(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!==st(n))&&this.#g(n)}})}#g(t){let n=this.#e.loadWidget;if(!n)return;let r=st(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 lt(e,t){return JSON.stringify(e??null)===JSON.stringify(t??null)}function ut(e){return new ct(e)}function dt(e){return K.get(e.trim().toUpperCase())??2}var ft=`–`;function pt(e){try{return Intl.getCanonicalLocales(e)[0]??`en`}catch{return`en`}}function mt(e,{format:t=`integer`,currency:n=`USD`,locale:r,compact:i=!1}){if(typeof e!=`number`||!Number.isFinite(e))return ft;let a=pt(r),o=i?{notation:`compact`,maximumFractionDigits:1}:{};switch(t){case`money`:{let t=/^[A-Za-z]{3}$/.test(n)?n.toUpperCase():`USD`,r=dt(t);return new Intl.NumberFormat(a,{style:`currency`,currency:t,...o}).format(e/10**r)}case`percent`:return new Intl.NumberFormat(a,{style:`percent`,maximumFractionDigits:1}).format(e);case`decimal`:return new Intl.NumberFormat(a,{maximumFractionDigits:2,...o}).format(e);default:return new Intl.NumberFormat(a,{maximumFractionDigits:0,...o}).format(e)}}function ht(e,t,n){let r=new Date(/^\d{4}-\d{2}-\d{2} \d/.test(e)?`${e.replace(` `,`T`)}Z`:e);if(Number.isNaN(r.getTime()))return e;let i=pt(n),a=e=>new Intl.DateTimeFormat(i,{timeZone:`UTC`,...e}).format(r);switch(t){case`year`:return a({year:`numeric`});case`quarter`:return`Q${Math.floor(r.getUTCMonth()/3)+1} ${r.getUTCFullYear()}`;case`month`:return a({month:`short`,year:`numeric`});case`week`:case`day`:return a({month:`short`,day:`numeric`});default:return a({month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`,hourCycle:`h23`})}}var gt=200,_t=4,vt=2e4;function yt(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 bt=e=>e!==void 0&&/[A-Za-z0-9]/.test(e);function xt(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<_t&&e.startsWith(`**`,a)){let r=e.indexOf(`**`,a+2);if(r>a+2){i(),n.push({type:`strong`,children:xt(e.slice(a+2,r),t+1)}),a=r+2;continue}}if(t<_t&&(o===`*`||o===`_`)&&e[a+1]!==` `&&!(o===`_`&&bt(e[a-1]))){let r=e.indexOf(o,a+1);if(r>a+1&&e[r-1]!==` `&&!(o===`_`&&bt(e[r+1]))){i(),n.push({type:`em`,children:xt(e.slice(a+1,r),t+1)}),a=r+1;continue}}if(o===`[`&&t<_t){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=yt(e.slice(r+2,o));i(),c?n.push({type:`link`,href:c,children:xt(s,t+1)}):n.push(...xt(s,t+1)),a=o+1;continue}}r+=o,a+=1}}return i(),n}function St(e){let t=e.slice(0,vt).replace(/\r\n?/g,`
|
|
2
|
-
`).split(`
|
|
3
|
-
`),n=[],r=[],i=null,a=()=>{r.length&&n.push({type:`paragraph`,children:xt(r.join(` `),0)}),r=[]},o=()=>{i&&n.push({type:`list`,...i}),i=null};for(let e=0;e<t.length&&n.length<gt;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:xt(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(xt((l??u)?.[1]??``,0));continue}let d=/^\s*>\s?(.*)$/.exec(s);d?(a(),o(),n.push({type:`quote`,children:xt(d[1],0)})):(o(),r.push(s.trim()))}return a(),o(),n.slice(0,gt)}var Z=V({"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 Ct(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 wt(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 Tt=c(`<p class="smrt-widget-form__none svelte-1jw9hhr"> </p>`),Et=c(`<small class="smrt-widget-form__hint svelte-1jw9hhr"> </small>`),Dt=c(`<small class="smrt-widget-form__error svelte-1jw9hhr" role="alert"> </small>`),Ot=c(`<div class="smrt-widget-form__check svelte-1jw9hhr"><!> <!> <!></div>`),kt=c(`<option> </option>`),At=c(`<!> <!>`,1),jt=c(`<option> </option> <!> <!>`,1),Mt=c(`<!> <!> <!> <!>`,1);function Nt(r,a){h(a,!0);let{t:o}=se(),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 ee=e=>o(e.label),O=e=>e.help?o(e.help):void 0,A=e=>!e.required&&(e.default===void 0||e.default===null),N=n(()=>new Set((a.models??[]).map(e=>e.value))),te=n(()=>a.optionsEditor??a.definition.optionsEditor);var L=S(),z=I(L),ne=t=>{var n=S(),r=I(n);g(r,()=>e(te),(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)},re=r=>{X(r,{onsubmit:E,novalidate:!0,children:(r,i)=>{var d=Mt(),p=I(d),h=e=>{ie(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=Tt(),n=P(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=Ot(),o=k(a),c=()=>v[e(i).key]===!0,u=t=>v[e(i).key]=t;{let t=n(()=>ee(e(i)));de(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=Et(),r=P(n,!0);R(e=>l(r,e),[()=>O(e(i))]),x(t,n)},p=n(()=>O(e(i)));t(d,t=>{e(p)&&t(f)});var m=M(d,2),h=t=>{var n=Dt(),r=P(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(()=>ee(e(i))),c=n(()=>O(e(i)));ve(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;ye(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;Y(r,{get name(){return e(i).key},get value(){return a()},set value(e){s(e)},children:(r,a)=>{var s=At(),c=I(s),u=e=>{var t=kt(),n=P(t,!0);t.value=t.__value=``,R(e=>l(n,e),[()=>o(Z[`ui.overview.options_choose`])]),x(e,t)},d=n(()=>A(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=kt(),i=P(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;Y(r,{get name(){return e(i).key},get value(){return s()},set value(e){c(e)},children:(r,s)=>{var c=jt(),u=I(c),d=P(u,!0);u.value=u.__value=``;var p=M(u,2),h=t=>{var n=kt(),r=P(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(N).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=kt(),i=P(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);q(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);be(T,{children:(e,t)=>{var n=At(),r=I(n);G(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);G(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(te)?t(ne):t(re,-1)}),x(r,L),i()}var Pt=c(`<p class="smrt-overview__state svelte-1liasmg"> </p>`),Ft=c(`<p class="smrt-overview__state svelte-1liasmg" role="status"> </p> <!>`,1),It=c(`<article class="smrt-overview__widget svelte-1liasmg"><!> <div class="smrt-overview__content"><!></div></article>`),Lt=c(`<div class="smrt-overview__toolbar svelte-1liasmg" role="toolbar"><!> <!></div>`),Rt=c(`<p class="smrt-overview__empty svelte-1liasmg"> </p>`),zt=c(`<div class="smrt-overview__resize svelte-1liasmg" role="slider" tabindex="0" aria-orientation="horizontal"></div>`),Bt=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),Vt=c(`<div role="listitem" class="smrt-overview__item svelte-1liasmg"><div class="smrt-overview__tile svelte-1liasmg"><!></div></div>`),Ht=c(`<p> </p>`),Ut=c(`<small class="svelte-1liasmg"> </small>`),Wt=c(`<span class="smrt-overview__choice svelte-1liasmg"><!> <span class="smrt-overview__choice-text svelte-1liasmg"><strong> </strong> <!></span></span>`),Gt=c(`<li><!></li>`),Kt=c(`<ul class="smrt-overview__choices svelte-1liasmg"></ul>`),qt=c(`<!> <!>`,1),Jt=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 Yt(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=It(),m=k(f);N(m,()=>e(Ie),!1,(e,n)=>{A(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=k(h),b=e=>{var t=Pt(),n=P(t,!0);R(e=>l(n,e),[()=>w(Z[`ui.overview.unavailable`])]),x(e,t)},C=e=>{var t=Pt(),n=P(t,!0);R(e=>l(n,e),[()=>w(Z[`ui.overview.loading`])]),x(e,t)},T=e=>{var t=Ft(),n=I(t),r=P(n,!0),o=M(n,2);G(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(ie)?`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=Pt(),n=P(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}=se(),te=`__smrt-overview__`,re=me(),ie=n(()=>a.controller.canCustomize&&(a.editing??re?.editing??!1)),oe=n(()=>a.label??w(Z[`ui.overview.label`])),V=n(()=>a.controller.registry),ce=n(()=>a.controller.document.widgets.map(t=>{let n=e(V).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}})),le=n(()=>new Map(e(ce).map(e=>[e.widget.id,e])));ee(()=>{a.controller.document,F(()=>a.controller.sync())});let H=D(void 0),U=D(void 0),ue=D(``),W=D(null),K=D(!1),q=D(null);function de(e){B(ue,e,!0)}function he(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 J=fe({root:()=>e(H),selectors:{container:`[data-smrt-overview-list]`,containerKey:`smrtOverviewList`,item:`[data-smrt-overview-item]`,itemKey:`smrtOverviewItem`},containers:()=>[{id:te,label:e(oe)}],itemIds:()=>e(ce).map(e=>e.widget.id),itemLabel:t=>e(le).get(t)?.title,allowSameContainerReorder:()=>!0,enabled:()=>e(ie),orientation:()=>`vertical`,flow:()=>!0,announce:he,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)}}),Y=n(()=>J.drag?.itemId),X=n(()=>J.drag?.target.index),ve=n(()=>e(ce).filter(t=>t.widget.id!==e(Y)).length);function ye(t){if(e(X)===void 0||e(Y)===void 0||e(ce)[t].widget.id===e(Y))return;let n=0;for(let r=0;r<t;r+=1)e(ce)[r].widget.id!==e(Y)&&(n+=1);if(n===e(X))return`before`;if(e(X)>=e(ve)&&n===e(ve)-1)return`after`}function be(t){return e(W)?.id===t.widget.id?e(W).span:t.widget.span}function xe(){return e(H)!==void 0&&getComputedStyle(e(H)).direction===`rtl`}function Se(e,t){let n=a.controller.resize(e.widget.id,t);n.ok?de(w(Z[`ui.overview.announce_resized`],{widget:e.title,span:t,max:e.def?.maxSpan??4})):n.reason===`not_allowed`&&de(w(Z[`ui.overview.announce_denied`]))}function Ce(e,t){if(!t.def)return;let n=wt(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(W,{id:t.widget.id,span:t.widget.span},!0))}function Te(t,n){if(e(W)?.id!==n.widget.id||!n.def||!e(U))return;let r=t.currentTarget.closest(`[data-smrt-overview-item]`);if(!r)return;let i=e(U).getBoundingClientRect(),a=r.getBoundingClientRect(),o=xe(),s=getComputedStyle(e(U)).gridTemplateColumns.split(` `).filter(Boolean).length,c=Ct({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(W).span&&B(W,{id:n.widget.id,span:c},!0)}function Ee(t,n){if(e(W)?.id!==n.widget.id)return;let r=e(W).span;B(W,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&&de(w(Z[`ui.overview.announce_removed`],{widget:e.title}))}function Oe(){a.controller.reset().ok&&de(w(Z[`ui.overview.announce_reset`]))}function ke(e){B(q,{id:e.widget.id,type:e.widget.type,initial:e.widget.options},!0)}function Ae(t){let n=e(V).get(t);return n?w(n.title):t}function je(t){let n=a.controller.add(t);if(B(K,!1),n.ok)de(w(Z[`ui.overview.announce_added`],{widget:Ae(t)}));else if(n.reason===`invalid_options`){let n=e(V).get(t);B(q,{id:null,type:t,initial:n?Ne(n.options):{}},!0)}}function Me(t){let n=e(q);if(!n)return null;let r=n.id===null?a.controller.add(n.type,t):a.controller.setOptions(n.id,t);return r.ok?(de(w(Z[n.id===null?`ui.overview.announce_added`:`ui.overview.announce_configured`],{widget:Ae(n.type)})),B(q,null),null):r.reason===`invalid_options`?r.issues??[]:(r.reason===`not_allowed`&&de(w(Z[`ui.overview.announce_denied`])),B(q,null),null)}let Pe=n(()=>e(q)?e(V).get(e(q).type):void 0),Fe=n(()=>e(q)?w(Z[e(q).id===null?`ui.overview.options_new_title`:`ui.overview.options_title`],{widget:Ae(e(q).type)}):``),Ie=n(()=>`h${v()}`);var Le=Jt(),Re=I(Le),ze=k(Re),Be=t=>{var r=Lt(),i=k(r);{let t=n(()=>w(Z[`ui.overview.add`])),r=n(()=>a.controller.full||a.controller.addable.length===0);ge(i,{icon:`add`,get label(){return e(t)},get disabled(){return e(r)},onclick:()=>B(K,!0)})}var o=M(i,2);{let t=n(()=>w(Z[`ui.overview.reset`])),r=n(()=>!a.controller.customized);ge(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(ie)&&t(Be)});var Ve=M(ze,2),He=e=>{var t=Rt(),n=P(t,!0);R(e=>l(n,e),[()=>w(Z[`ui.overview.empty`])]),x(e,t)};t(Ve,t=>{e(ce).length===0&&t(He)});var Ue=M(Ve,2);z(Ue,`data-smrt-overview-list`,te),f(Ue,31,()=>e(ce),e=>e.widget.id,(r,i,a)=>{let o=n(()=>ye(e(a)));var c=Vt();let u;var f=k(c),p=k(f),h=r=>{var a=Bt(),o=I(a),c=k(o),u=M(c,2),f=P(u,!0),p=M(u,2),m=t=>{{let r=n(()=>w(Z[`ui.overview.configure`],{widget:e(i).title}));ge(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}));ge(h,{icon:`trash`,get label(){return e(t)},onclick:()=>De(e(i))})}s(o);var g=M(o,2),_=k(g);d(_,()=>e(i)),s(g);var v=M(g,2),y=t=>{var n=zt();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`,J.nativeDraggable),z(c,`aria-label`,t),z(c,`aria-pressed`,e(Y)===e(i).widget.id),z(u,`title`,e(i).title),l(f,e(i).title)},[()=>w(Z[`ui.overview.move`],{widget:e(i).title})]),C(`click`,c,()=>J.consumeClick(e(i).widget.id)),C(`keydown`,c,t=>J.keydown(t,e(i).widget.id)),T(`blur`,c,t=>J.blur(t,e(i).widget.id)),C(`pointerdown`,c,t=>J.pointerDown(t,e(i).widget.id)),C(`pointermove`,c,e=>J.pointerMove(e)),C(`pointerup`,c,e=>J.pointerUp(e)),T(`pointercancel`,c,e=>J.pointerCancel(e)),T(`dragstart`,c,t=>J.dragStart(t,e(i).widget.id)),T(`dragend`,c,()=>J.dragEnd()),x(r,a)},g=t=>{d(t,()=>e(i))};t(p,t=>{e(ie)?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(Y)===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=>{J.drag&&(t.stopPropagation(),J.dropOnItem(t,te,e(a)))}),m(c,()=>pe,null),x(r,c)}),s(Ue),O(Ue,e=>B(U,e),()=>e(U));var We=M(Ue,2),Ge=P(We);s(Re),O(Re,e=>B(H,e),()=>e(H));var Ke=M(Re,2),qe=r=>{var i=qt(),o=I(i),c=()=>e(K),u=e=>B(K,e,!0);{let r=n(()=>w(Z[`ui.overview.add_title`]));ae(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=Ht(),n=P(t,!0);R(e=>l(n,e),[()=>w(Z[`ui.overview.add_none`])]),x(e,t)},u=n=>{var r=Kt();f(r,21,()=>a.controller.addable,e=>e.type,(n,r)=>{var i=Gt(),o=k(i);G(o,{type:`button`,variant:`ghost`,fullWidth:!0,onclick:()=>je(e(r).type),children:(n,i)=>{var o=Wt(),c=k(o),u=t=>{_e(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=k(d),p=P(f,!0),m=M(f,2),h=t=>{var n=Ut(),i=P(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(q)!==null,m=e=>{e||B(q,null)};ae(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);ne(i,()=>`${e(q).id??`new`}:${e(q).type}`,t=>{{let r=n(()=>a.optionEditors?.get(e(q).type)??e(Pe).optionsEditor);Nt(t,{get definition(){return e(Pe)},get initial(){return e(q).initial},get models(){return a.models},get optionsEditor(){return e(r)},onsave:Me,oncancel:()=>B(q,null)})}}),x(t,r)};t(s,t=>{e(q)&&e(Pe)&&t(c)}),x(r,o)},$$slots:{default:!0}}),x(r,i)};t(Ke,t=>{e(ie)&&t(qe)}),R(()=>{z(Re,`data-editing`,e(ie)?``:void 0),z(Re,`data-presentation`,y()),z(Ue,`aria-label`,e(oe)),l(Ge,`${e(ue)??``}${J.announcement?` ${J.announcement}`:``}`)}),T(`dragover`,Ue,e=>e.preventDefault()),T(`drop`,Ue,e=>{J.drag&&J.dropOnContainer(e,te)}),x(r,Le),i()}w([`click`,`keydown`,`pointerdown`,`pointermove`,`pointerup`]);var Xt=[`title`,`identifier`,`status`,`money`,`quantity`,`date`,`party`,`subtotal`,`tax`,`discount`,`total`],Zt=new Set([`integer`,`decimal`]),Qt=new Set([`foreignKey`,`crossPackageRef`]),$t=/(?:^|[a-z])(?:amount|total|price|cost)$|^(?:subtotal|tax|discount)$/i,en=/^subtotal(?:Amount)?$|[a-z]Subtotal(?:Amount)?$/,tn=/^tax(?:Amount|Total)?$|[a-z]Tax(?:Amount|Total)?$/,nn=/^discount(?:Amount|Total)?$|[a-z]Discount(?:Amount|Total)?$/,rn=/^(?:total|grandTotal)(?:Amount)?$|^amountTotal$/,an=/(?:rate|percent|percentage|pct|ratio)$/i,on=/^(?:status|state)$|[a-z](?:Status|State)$/,sn=/^(?:number|reference|code|ref)$|[a-z](?:Number|Reference|Code)$/,cn=/^(?: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,ln=/^date$|[a-z](?:At|Date|On|Until)$/,un=/^(?:quantity|qty)|(?:Quantity|Qty)$/,dn=[`name`,`title`,`label`,`displayName`],fn=/customer|vendor|supplier|client|party|profile|contact|person|people|member|company|organi[sz]ation|payer|payee|buyer|seller|licensee|lessee/i;function pn(e){let t=e.role;return t===void 0?null:(Array.isArray(t)?t:[t]).filter(e=>Xt.includes(e))}function mn(e){return e.format??e.ui?.format}function hn(e){return mn(e)===`money`||e.type===`integer`&&e.ui?.widget===`currency`}function gn(e){return Array.isArray(e.enum)&&e.enum.length>0}function _n(e,t){return e?.find(e=>e.field===t)}function vn(e,t,n){let r=[],{type:i}=t,a=Zt.has(i),o=an.test(e);if(i===`text`&&(gn(t)&&on.test(e)&&r.push(`status`),sn.test(e)&&!cn.test(e)&&t.ui?.widget!==`phone`&&r.push(`identifier`)),i===`integer`&&!o&&$t.test(e)&&r.push(`money`),a&&un.test(e)&&r.push(`quantity`),i===`datetime`&&ln.test(e)&&r.push(`date`),Qt.has(i)){let t=n?.relatedCollection??``,i=e.replace(/Id$/,``);i!==`tenant`&&(fn.test(i)||fn.test(t))&&r.push(`party`)}return a&&!o&&(en.test(e)?r.push(`subtotal`):tn.test(e)?r.push(`tax`):nn.test(e)?r.push(`discount`):rn.test(e)&&r.push(`total`)),r}function yn(e){let t=new Set(e);return Xt.filter(e=>t.has(e))}function bn(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=pn(i);if(a)for(let e of a)n.add(e);else for(let t of vn(r,i,_n(e.relationships,r)))n.add(t);hn(i)&&n.add(`money`);let o=mn(i);(o===`date`||o===`datetime`)&&i.type===`datetime`&&n.add(`date`),i.display===!0&&n.add(`title`),t[r]=yn(n)}if(!r&&!Object.values(t).some(e=>e.includes(`title`)))for(let n of dn){let r=e.fields[n];if(r?.type===`text`&&pn(r)===null){t[n]=yn([...t[n]??[],`title`]);break}}return t}function xn(e,t){return Object.keys(e).find(n=>e[n]?.includes(t))}function Sn(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 Cn(e){return xn(e,`identifier`)!==void 0&&(xn(e,`party`)!==void 0||xn(e,`total`)!==void 0)}var wn=new Set([`id`,`tenantId`,`createdAt`,`updatedAt`,`createdBy`,`updatedBy`]),Tn=[`createdAt`,`updatedAt`];function En(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 Dn(e,t){return(t.type===`foreignKey`||t.type===`crossPackageRef`)&&/.[a-z]Id$/.test(e)?En(e.slice(0,-2)):En(e)}function On(e){let t=En(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 kn(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 An(e,t){return t===void 0?e.required===!0&&e.nullable!==!0:t}function jn(e,t){return t&&t.objectRef!==e.objectRef?`Field policy is for '${t.objectRef}', not '${e.objectRef}'.`:null}function Mn(e){return!e.startsWith(`_`)&&!e.startsWith(`$`)}function Nn(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 Pn(e,t){return(e.order??2**53-1)-(t.order??2**53-1)||e.index-t.index}function Fn(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=>Mn(t.name)&&!wn.has(t.name)&&t.name!==e.idField),c=t?null:Nn(s),l=bn(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=kn(e.definition,o);return{name:e.name,label:i||Dn(e.name,e.definition),help:a&&a.trim()!==``?a:null,type:e.definition.type,kind:s,required:An(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:En(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`&&Tn.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(Pn).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=Tn.map(f).filter(e=>e!==null);return[...p,...e]}return p}function In(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 Ln(e){return`${e.model.split(/[:/]/).pop()??e.model}-${e.field}`.replace(/[^A-Za-z0-9_.-]+/g,`-`).slice(0,64)}function Rn(e){return K.get(e.trim().toUpperCase())??2}function zn(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 Bn(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 Vn(e){return String(e).padStart(2,`0`)}function Hn(e){if(e==null||e===``)return``;let t=e instanceof Date?e:new Date(e);return Number.isNaN(t.getTime())?``:`${t.getFullYear()}-${Vn(t.getMonth()+1)}-${Vn(t.getDate())}T${Vn(t.getHours())}:${Vn(t.getMinutes())}`}function Un(e,t,n={}){if(e.kind===`boolean`)return t===!0||t===`true`;if(t==null)return``;switch(e.kind){case`money`:return zn(t,Rn(n.currency??`USD`))??``;case`datetime`:return Hn(t);case`json`:return typeof t==`string`?t:JSON.stringify(t,null,2);default:return String(t)}}function Wn(e,t,n={}){let r={};for(let i of e)r[i.name]=Un(i,t[i.name],n);return r}function Gn(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]=Un(i,a,n)}return r}function Kn(e,t,n={}){let r={},i={},a=Rn(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=Bn(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===Hn(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 qn(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=Rn(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=Jn(t);return Zn(e)?``:typeof e==`string`?e:JSON.stringify(e)}default:return String(t)}}catch{return String(t)}}function Jn(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 Yn(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Xn(e){return e==null||e===``}function Zn(e){return Xn(e)?!0:Array.isArray(e)?e.length===0:Yn(e)?Object.values(e).every(Xn):!1}function Qn(e){let t=Jn(e);if(!Yn(t))return null;let n=[];for(let[e,r]of Object.entries(t))Xn(r)||n.push({key:e,value:typeof r==`object`&&r?JSON.stringify(r):String(r)});return n.length>0?n:null}function $n(e){return e.length>12?`${e.slice(0,8)}…`:e}function er(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=yt(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 tr=/^[A-Za-z_][A-Za-z0-9_.-]{0,63}$/;function nr(e,t=6){if(typeof e!=`string`)return[];let n=[];for(let r of e.split(`,`)){let e=r.trim();if(tr.test(e)&&!n.includes(e)&&(n.push(e),n.length===t))break}return n}function rr(e){return e.join(`,`)}var ir={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 ar(e,t){if(typeof e!=`string`)return`default`;let n=e.trim().toLowerCase().replace(/[\s-]+/g,`_`);return t?.[e]??t?.[n]??ir[n]??`default`}function or(e){return typeof e!=`string`||e.trim()===``?``:En(e.trim())}function sr(e,t,n={}){if(t==null||t===``)return``;switch(e.role){case`money`:return qn({kind:`money`},t,{currency:n.currency,locale:n.locale});case`date`:return typeof t==`string`&&!/^\d{4}-\d{2}-\d{2}/.test(t)?t:qn({kind:`datetime`,definition:{format:`date`}},t,{locale:n.locale,timeZone:n.timeZone??`UTC`});case`quantity`:return qn({kind:`decimal`},t,{locale:n.locale});case`status`:return or(t);default:return typeof t==`number`?qn({kind:`decimal`},t,{locale:n.locale}):typeof t==`boolean`?t?`✓`:``:typeof t==`string`?t:JSON.stringify(t)}}function cr(e){return e===`money`||e===`quantity`}function lr(e){return e.summarize??cr(e.role)}function ur(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 dr=new Set([`title`,`identifier`,`status`,`money`,`quantity`,`date`,`party`,`subtotal`,`tax`,`discount`,`total`]);function fr(e,t){let n=[];if(Array.isArray(t))for(let e of t)Q(e)&&typeof e.key==`string`&&tr.test(e.key)&&n.push({key:e.key,label:typeof e.label==`string`&&e.label!==``?e.label:En(e.key),...typeof e.role==`string`&&dr.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:En(e)})}var pr=[`related`,`line-items`,`records`,`metric`,`chart`,`note`];function mr(e){return`detail:${e.replace(/^@/,``).replace(/[/:]+/g,`.`).replace(/[^A-Za-z0-9_.-]/g,`-`).replace(/^[^A-Za-z0-9]+/,``)||`record`}`}function hr(e,t,n){let r=`${e}-${Ln(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 gr(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:hr(`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:hr(`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:hr(`items`,c,s),type:`line-items`,span:4,options:{title:c.label,relation:Ln(c)}}),n.related===`panels`)for(let e of r)a.push({id:hr(`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:rr((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??mr(e.objectRef),allowed:pr,models:o.length>0?o:void 0,defaults:a})}function _r(e){return e===`exclusive`||e===`inclusive`||e===`none`}function vr(e){if(!e||typeof e!=`object`||Array.isArray(e))return!1;let t=e;return _r(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 yr(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 br(e,t){let n=t.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`);return RegExp(`(^|[^\\d.])${n}\\s?%`).test(e)?e:`${e} ${t}%`}function xr(e){return typeof e==`number`&&Number.isSafeInteger(e)?e:null}function Sr(e){let t=0;for(let n of e){if(n==null||n===``)continue;let e=xr(n);if(e===null||(t+=e,!Number.isSafeInteger(t)))return null}return t}function Cr(e,t){let n=e?.lineAmountType===`inclusive`,r=xr(e?.subtotal),i=xr(e?.discount),a=xr(e?.tax),o=xr(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 wr(e,t){let n=e.filter(e=>e.kind===`children`);return t.length===0?n.slice(0,20):t.map(e=>n.find(t=>Ln(t)===e)).filter(e=>e!==void 0)}function Tr(e,t){return{title:e.label,model:e.model,field:e.field,filter:`parent`,sort:`createdAt`,direction:`desc`,limit:t,columns:rr((e.columns??[]).map(e=>e.key))}}function Er(e,t,n){let r=Q(t)?t:{},i=ur(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:Ln(e),label:e.label,rows:i,total:c,columns:fr(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 Dr(e){return async(t,n)=>{let r=nr(t.relations,20),i=typeof t.limit==`number`?t.limit:5,a=wr(e.relations,r),o=await Promise.allSettled(a.map(t=>new Promise(r=>r(e.records(Tr(t,i),n))))),s=[],c;if(o.forEach((t,n)=>{let r=a[n];r&&(t.status===`rejected`?c??=t.reason:s.push(Er(r,t.value,e.viewAllHref?.(r))))}),s.length===0&&c!==void 0)throw c;return{tabs:s}}}function Or(e,t){let n=e.filter(e=>e.kind===`items`);return typeof t==`string`&&t!==``?n.find(e=>Ln(e)===t):n[0]}function kr(e,t){return{title:e.label,model:e.model,field:e.field,filter:`parent`,sort:e.sort??`createdAt`,direction:`asc`,limit:t,columns:rr((e.columns??[]).map(e=>e.key))}}function Ar(e){return async(t,n)=>{let r=Or(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=Er(r,await e.records(kr(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 jr=V({"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`,"ui.overview.chart.peak":`Peak {value} · {label}`,"ui.overview.chart.latest":`Latest {value} · {label}`,"ui.overview.chart.explore":`Use the arrow keys to read each value; Home and End jump to the first and last.`,"ui.overview.chart.point":`{label}: {value}`}),Mr=c(`<tr><th scope="row" class="svelte-75pkr"> </th><td class="svelte-75pkr"> </td></tr>`),Nr=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>`),Pr=d(`<line class="smrt-chart__grid svelte-75pkr" x1="0" x2="100" vector-effect="non-scaling-stroke"></line>`),Fr=d(`<line class="smrt-chart__guide svelte-75pkr" y1="0" y2="40" vector-effect="non-scaling-stroke"></line>`),Ir=c(`<span class="smrt-chart__dot svelte-75pkr" aria-hidden="true"></span> <span class="smrt-chart__tip svelte-75pkr" aria-hidden="true"><span> </span><strong> </strong></span>`,1),Lr=c(`<svg class="smrt-chart__line svelte-75pkr" viewBox="0 0 100 40" preserveAspectRatio="none"><!><polyline fill="none" stroke="currentColor" stroke-width="2" vector-effect="non-scaling-stroke"></polyline><!></svg> <!>`,1),Rr=c(`<p class="smrt-chart__empty svelte-75pkr" data-smrt-component="Chart"> </p>`),zr=c(`<div class="smrt-chart smrt-chart--table svelte-75pkr" data-smrt-component="Chart"><!></div>`),Br=c(`<p class="smrt-chart__delta svelte-75pkr"><span aria-hidden="true"> </span> </p>`),Vr=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>`),Hr=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>`),Ur=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>`),Wr=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>`),Gr=c(`<span> </span>`),Kr=c(`<p class="smrt-chart__values svelte-75pkr" aria-hidden="true"></p>`),qr=c(`<div class="smrt-chart__plot svelte-75pkr" role="slider" tabindex="0" aria-orientation="horizontal"><!></div>`),Jr=c(`<div class="smrt-chart__plot svelte-75pkr"><!></div>`),Yr=c(`<span class="svelte-75pkr"> </span>`),Xr=c(`<p class="smrt-chart__axis svelte-75pkr" aria-hidden="true"></p>`),Zr=c(`<span class="smrt-chart__table svelte-75pkr"> </span>`),Qr=c(`<p class="smrt-chart__readout svelte-75pkr"><span> </span> <span> </span></p>`),$r=c(`<div class="smrt-chart smrt-chart--line svelte-75pkr" data-smrt-component="Chart"><div><!> <div class="smrt-chart__body svelte-75pkr"><!> <!></div></div> <!> <!> <!></div>`),ei=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>`),ti=c(`<ul class="smrt-chart__bars svelte-75pkr" data-smrt-component="Chart"></ul>`);function ni(o,c){let u=L();h(c,!0);let d=(t,n=p)=>{var i=Nr(),o=k(i),c=P(o,!0),u=M(o),d=k(u),m=k(d),h=P(m,!0),g=M(m),_=P(g,!0);s(d),s(u);var y=M(u);f(y,21,()=>e(N),v,(t,n)=>{var r=Mr(),i=k(r),a=P(i,!0),o=M(i),c=P(o,!0);s(r),R(t=>{l(a,e(n).label),l(c,t)},[()=>re(e(n).value)]),x(t,r)}),s(y),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)},[()=>A(jr[`ui.overview.chart.table`]),()=>A(jr[`ui.overview.chart.label_column`]),()=>A(jr[`ui.overview.chart.value_column`])]),x(t,i)},m=(n,r=p)=>{var i=Lr(),a=I(i),o=k(a),c=e=>{var t=S(),n=I(t);f(n,16,()=>[4,20,36],e=>e,(e,t)=>{var n=Pr();R(()=>{z(n,`y1`,t),z(n,`y2`,t)}),x(e,n)}),x(e,t)};t(o,t=>{e(me)&&t(c)});var u=M(o),d=M(u),m=t=>{var n=Fr();R(()=>{z(n,`x1`,e(X).x),z(n,`x2`,e(X).x)}),x(t,n)};t(d,t=>{e(X)&&t(m)}),s(a);var h=M(a,2),g=t=>{var n=Ir(),r=I(n);let i;var a=M(r,2);let o;var c=k(a),u=P(c,!0),d=M(c),f=P(d,!0);s(a),R(t=>{i=b(r,``,i,{"inset-inline-start":`${e(X).x??``}%`,"inset-block-start":`${e(X).y/40*100}%`}),z(a,`data-edge`,e(X).x<15?`start`:e(X).x>85?`end`:void 0),o=b(a,``,o,{"inset-inline-start":`${e(X).x??``}%`}),l(u,e(X).label),l(f,t)},[()=>re(e(X).value)]),x(t,n)};t(h,t=>{e(X)&&t(g)}),R(()=>{z(a,`role`,r()?void 0:`img`),z(a,`aria-label`,r()?void 0:e(fe)),z(a,`aria-hidden`,r()?`true`:void 0),z(u,`points`,e(le))}),x(n,i)},g=E(c,`style`,3,`bar`),_=E(c,`title`,3,``),y=E(c,`locale`,3,`en`),w=E(c,`size`,3,`regular`),ee=E(c,`readout`,3,!0);function O(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}let{t:A}=se(),j=n(()=>O(c.data)?c.data:null),N=n(()=>{if(!e(j)||!Array.isArray(e(j).points))return[];let t=[];for(let n of e(j).points.slice(0,60))O(n)&&typeof n.label==`string`&&typeof n.value==`number`&&Number.isFinite(n.value)&&t.push({label:n.label,value:n.value});return t}),te=[`bar`,`line`,`table`,`pie`,`stat`],F=n(()=>te.find(e=>e===g())??`bar`);function ne(){return w()!==`compact`&&(c.valueAxis??w()===`tall`)}let re=t=>mt(t,{format:e(j)?.format??`integer`,currency:e(j)?.currency,locale:y()}),ie=n(()=>Math.max(0,...e(N).map(e=>e.value))),ae=n(()=>Math.min(0,...e(N).map(e=>e.value)));function oe(e){if(e<=0)return 0;let t=10**Math.floor(Math.log10(e));return([1,2,2.5,5,10].find(n=>e/t<=n)??10)*t}let V=n(()=>ne()&&e(ie)>0?oe(e(ie)/2)*2:e(ie)),ce=n(()=>e(V)-e(ae)||1),le=n(()=>e(N).map((t,n)=>{let r=e(N).length===1?50:n/(e(N).length-1)*100,i=36-(t.value-e(ae))/e(ce)*32;return`${r.toFixed(2)},${i.toFixed(2)}`}).join(` `)),H=n(()=>e(N).reduce((e,t)=>e+Math.max(0,t.value),0)),U=n(()=>{let t=0;return e(N).map((n,r)=>{let i=e(H)>0?Math.max(0,n.value)/e(H)*100:0,a={...n,index:r,share:i,offset:t};return t+=i,a})}),ue=e=>mt(e/100,{format:`percent`,locale:y()}),W=n(()=>e(N).at(-1)),G=n(()=>{if(e(j)&&typeof e(j).delta==`number`&&Number.isFinite(e(j).delta))return e(j).delta;let t=e(N).at(-2);return!e(W)||!t||t.value===0?null:(e(W).value-t.value)/Math.abs(t.value)*100}),K=n(()=>e(G)===null||e(G)===0?``:A(jr[e(G)>0?`ui.overview.metric.change_up`:`ui.overview.metric.change_down`],{value:mt(Math.abs(e(G))/100,{format:`percent`,locale:y()})})),q=n(()=>{if(e(N).length<=2)return e(N).map(e=>e.label);let t=e(N)[Math.floor((e(N).length-1)/2)];return[e(N)[0].label,t.label,e(N)[e(N).length-1].label]}),de=n(()=>e(N).reduce((e,t)=>!e||t.value>e.value?t:e,null)),fe=n(()=>`${_()}. ${A(jr[`ui.overview.chart.summary`],{count:e(N).length})}`),pe=n(()=>w()===`compact`),me=n(ne),he=n(()=>!e(pe)&&(c.explore??w()===`tall`)),ge=t=>mt(t,{format:e(j)?.format??`integer`,currency:e(j)?.currency,locale:y(),compact:!0}),_e=n(()=>[e(V),(e(V)+e(ae))/2,e(ae)]);function J(t){let n=e(N)[t];return{x:e(N).length===1?50:t/(e(N).length-1)*100,y:36-((n?.value??0)-e(ae))/e(ce)*32}}let Y=D(null),X=n(()=>e(Y)!==null&&e(N)[e(Y)]?{...e(N)[e(Y)],...J(e(Y))}:null),ve=n(()=>e(X)?A(jr[`ui.overview.chart.point`],{label:e(X).label,value:re(e(X).value)}):``);function ye(t){let n=t.currentTarget.getBoundingClientRect();if(n.width<=0||e(N).length===0)return;let r=Math.min(1,Math.max(0,(t.clientX-n.left)/n.width));B(Y,Math.round(r*(e(N).length-1)),!0)}function be(t){let n=e(N).length-1;if(n<0)return;let r=e(Y)??-1,i=t.key===`ArrowRight`||t.key===`ArrowUp`?Math.min(n,r+1):t.key===`ArrowLeft`||t.key===`ArrowDown`?Math.max(0,r<0?n:r-1):t.key===`Home`?0:t.key===`End`?n:null;i!==null&&(t.preventDefault(),B(Y,i,!0))}var xe=S(),Se=I(xe),Ce=e=>{var t=Rr(),n=P(t,!0);R(e=>l(n,e),[()=>A(jr[`ui.overview.no_data`])]),x(e,t)},we=e=>{var t=zr(),n=k(t);d(n,()=>!1),s(t),x(e,t)},Te=n=>{var r=S(),i=I(r),a=n=>{var r=Vr(),i=k(r),a=P(i,!0),o=M(i,2),c=P(o,!0),u=M(o,2),d=t=>{var n=Br(),r=k(n),i=P(r,!0),a=M(r);s(n),R(()=>{z(n,`data-direction`,(e(G)??0)>0?`up`:`down`),l(i,(e(G)??0)>0?`▲`:`▼`),l(a,` ${e(K)??``}`)}),x(t,n)};t(u,t=>{e(K)&&t(d)}),s(r),R(t=>{l(a,t),l(c,e(W).label)},[()=>re(e(W).value)]),x(n,r)};t(i,t=>{e(W)&&t(a)}),x(n,r)},Ee=n=>{var r=S(),i=I(r),a=n=>{var r=Wr(),i=k(r);f(i,21,()=>e(U),e=>e.index,(n,r)=>{var i=S(),a=I(i),o=t=>{var n=Hr();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(U),e=>e.index,(t,n)=>{var r=Ur(),i=k(r),a=M(i,2),o=P(a,!0),c=M(a,2),u=P(c);s(r),R((t,r)=>{z(i,`data-slot`,e(n).index%8),l(o,e(n).label),l(u,`${t??``} · ${r??``}`)},[()=>re(e(n).value),()=>ue(e(n).share)]),x(t,r)}),s(a);var o=M(a,2);d(o,()=>!0),s(r),R(()=>z(i,`aria-label`,e(fe))),x(n,r)},o=e=>{var t=Rr(),n=P(t,!0);R(e=>l(n,e),[()=>A(jr[`ui.overview.no_data`])]),x(e,t)};t(i,t=>{e(H)>0?t(a):t(o,-1)}),x(n,r)},De=n=>{var r=$r(),i=k(r);let o;var c=k(i),p=t=>{var n=Kr();f(n,21,()=>e(_e),v,(t,n)=>{var r=Gr(),i=P(r,!0);R(e=>l(i,e),[()=>ge(e(n))]),x(t,r)}),s(n),x(t,n)};t(c,t=>{e(me)&&t(p)});var h=M(c,2),g=k(h),_=t=>{var n=qr();z(n,`aria-valuemin`,0);var r=k(n);m(r,()=>!0),s(n),R((t,r)=>{z(n,`aria-label`,e(fe)),z(n,`aria-describedby`,`${u}-explore`),z(n,`aria-valuemax`,t),z(n,`aria-valuenow`,e(Y)??e(N).length-1),z(n,`aria-valuetext`,r)},[()=>Math.max(0,e(N).length-1),()=>e(ve)||(e(W)?A(jr[`ui.overview.chart.point`],{label:e(W).label,value:re(e(W).value)}):``)]),C(`pointermove`,n,ye),T(`pointerleave`,n,()=>B(Y,null)),C(`keydown`,n,be),T(`blur`,n,()=>B(Y,null)),x(t,n)},y=e=>{var t=Jr(),n=k(t);m(n,()=>!1),s(t),x(e,t)};t(g,t=>{e(he)?t(_):t(y,-1)});var b=M(g,2),S=t=>{var n=Xr();f(n,21,()=>e(q),v,(t,n)=>{var r=Yr(),i=P(r,!0);R(()=>l(i,e(n))),x(t,r)}),s(n),x(t,n)};t(b,t=>{e(pe)||t(S)}),s(h),s(i);var E=M(i,2),D=e=>{var t=Zr(),n=P(t,!0);R(e=>{z(t,`id`,`${u}-explore`),l(n,e)},[()=>A(jr[`ui.overview.chart.explore`])]),x(e,t)};t(E,t=>{e(he)&&t(D)});var O=M(E,2),j=t=>{var n=Qr(),r=k(n),i=P(r,!0),a=M(r,2),o=P(a,!0);s(n),R((e,t)=>{l(i,e),l(o,t)},[()=>A(jr[`ui.overview.chart.peak`],{value:re(e(de).value),label:e(de).label}),()=>A(jr[`ui.overview.chart.latest`],{value:re(e(W).value),label:e(W).label})]),x(t,n)};t(O,t=>{ee()&&!e(pe)&&e(de)&&e(W)&&t(j)});var te=M(O,2);d(te,()=>!0),s(r),R(()=>{z(r,`data-size`,w()),o=a(i,1,`smrt-chart__frame svelte-75pkr`,null,o,{"smrt-chart__frame--axis":e(me)})}),x(n,r)},Oe=t=>{var n=ti();f(n,21,()=>e(N),v,(t,n)=>{var r=ei(),i=k(r),a=P(i,!0),o=M(i,2),c=k(o);let u;s(o);var d=M(o,2),f=P(d,!0);s(r),R((t,r)=>{l(a,e(n).label),u=b(c,``,u,{"inline-size":t}),l(f,r)},[()=>`${e(ie)>0?Math.max(0,e(n).value)/e(ie)*100:0}%`,()=>re(e(n).value)]),x(t,r)}),s(n),R(()=>z(n,`aria-label`,e(fe))),x(t,n)};t(Se,t=>{e(N).length===0?t(Ce):e(F)===`table`?t(we,1):e(F)===`stat`?t(Te,2):e(F)===`pie`?t(Ee,3):e(F)===`line`?t(De,4):t(Oe,-1)}),x(o,xe),i()}w([`pointermove`,`keydown`]);var ri=c(`<div data-smrt-component="ChartWidget"><!></div>`);function ii(t,r){h(r,!0);var a=ri(),o=k(a);{let t=n(()=>r.data??null),i=n(()=>String(r.options.style??`bar`));ni(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 ai=c(`<a class="smrt-metric__value svelte-16na9c5"> </a>`),oi=c(`<p class="smrt-metric__value svelte-16na9c5"> </p>`),si=c(`<p class="smrt-metric__label svelte-16na9c5"> </p>`),ci=c(`<p class="smrt-metric__change svelte-16na9c5"><span aria-hidden="true"> </span> </p>`),li=c(`<div class="smrt-metric svelte-16na9c5" data-smrt-component="MetricWidget"><!> <!> <!></div>`),ui=c(`<p class="smrt-metric__label svelte-16na9c5" data-smrt-component="MetricWidget"> </p>`);function di(r,a){h(a,!0);let{t:o}=se(),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)?mt(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:mt(Math.abs(e(f))/100,{format:`percent`,locale:a.locale})})),m=n(()=>e(c)&&typeof e(c).href==`string`?yt(e(c).href):null);var g=S(),_=I(g),v=n=>{var r=li(),i=k(r),a=t=>{var n=ai(),r=P(n,!0);R(()=>{z(n,`href`,e(m)),l(r,e(d))}),x(t,n)},o=t=>{var n=oi(),r=P(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=si(),r=P(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=ci(),r=k(n),i=P(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=ui(),n=P(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 fi=(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=pi(),i=P(n,!0);R(()=>l(i,e(r).text)),x(t,n)},d=t=>{var n=mi();fi(k(n),()=>e(r).children),s(n),x(t,n)},f=t=>{var n=hi();fi(k(n),()=>e(r).children),s(n),x(t,n)},p=t=>{var n=gi();fi(k(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)},pi=c(`<code class="svelte-h4l6y5"> </code>`),mi=c(`<strong><!></strong>`),hi=c(`<em><!></em>`),gi=c(`<a rel="noopener noreferrer" class="svelte-h4l6y5"><!></a>`),_i=c(`<p class="smrt-note__empty svelte-h4l6y5" data-smrt-component="NoteWidget"> </p>`),vi=c(`<p class="smrt-note__heading svelte-h4l6y5"><strong><!></strong></p>`),yi=c(`<p class="svelte-h4l6y5"><!></p>`),bi=c(`<blockquote class="svelte-h4l6y5"><!></blockquote>`),xi=c(`<li><!></li>`),Si=c(`<ol class="svelte-h4l6y5"></ol>`),Ci=c(`<ul class="svelte-h4l6y5"></ul>`),wi=c(`<pre class="svelte-h4l6y5"><code class="svelte-h4l6y5"> </code></pre>`),Ti=c(`<div class="smrt-note svelte-h4l6y5" data-smrt-component="NoteWidget"></div>`);function Ei(r,a){h(a,!0);let{t:o}=se(),c=n(()=>St(typeof a.options.body==`string`?a.options.body:``));var u=S(),d=I(u),p=e=>{var t=_i(),n=P(t,!0);R(e=>l(n,e),[()=>o(Z[`ui.overview.no_data`])]),x(e,t)},m=n=>{var r=Ti();f(r,21,()=>e(c),v,(n,r)=>{var i=S(),a=I(i),o=t=>{var n=vi(),i=k(n);fi(k(i),()=>e(r).children),s(i),s(n),R(()=>z(n,`data-level`,e(r).level)),x(t,n)},c=t=>{var n=yi();fi(k(n),()=>e(r).children),s(n),x(t,n)},u=t=>{var n=bi();fi(k(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=xi();fi(k(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=xi();fi(k(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=wi(),i=k(n),a=P(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 Di=c(`<code class="svelte-13uvxec"> </code>`),Oi=c(`<a class="smrt-record-table__link svelte-13uvxec"><!></a>`),ki=c(`<div class="smrt-record-table svelte-13uvxec" data-smrt-component="RecordTable" role="group"><!></div>`);function Ai(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)?sr(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=Oi(),i=k(r),a=t=>{var n=Di(),r=P(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(()=>ar(d(),a.statusTones));ue(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=Di(),r=P(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}=se(),p=n(()=>a.rows.map(e=>({id:e.id,title:e.title,href:typeof e.href==`string`?yt(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}`,...cr(t.role)?{align:`right`}:{},summaryFormat:n=>sr(t,n,e(y))}))),C=n(()=>{if(!c()||a.columns.length===0)return;let t={},n=d()??a.rows.length;e(g)&&!cr(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(!lr(n))continue;let r=a.summaryValues?.[n.key];typeof r==`number`&&Number.isFinite(r)?t[n.key]=()=>sr(n,r,e(y)):e(v)?t[n.key]=`sum`:t[n.key]=()=>``}return t});var w=ki(),T=k(w);{let t=n(()=>f(Z[`ui.overview.table.total`]));J(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 ji=c(`<p class="smrt-records__foot smrt-records__foot--end svelte-1ouw4wc" data-smrt-component="RecordListWidget"><a class="svelte-1ouw4wc"> </a></p>`),Mi=c(`<!> <!>`,1),Ni=c(`<p class="smrt-records__empty svelte-1ouw4wc" data-smrt-component="RecordListWidget"> </p>`),Pi=c(`<a class="smrt-records__title svelte-1ouw4wc"> </a>`),Fi=c(`<span class="smrt-records__title svelte-1ouw4wc"> </span>`),Ii=c(`<span class="smrt-records__sub svelte-1ouw4wc"> </span>`),Li=c(`<span class="smrt-records__meta svelte-1ouw4wc"> </span>`),Ri=c(`<li class="smrt-records__row svelte-1ouw4wc"><span class="smrt-records__main svelte-1ouw4wc"><!> <!></span> <!></li>`),zi=c(`<ul class="smrt-records svelte-1ouw4wc" data-smrt-component="RecordListWidget"></ul>`),Bi=c(`<span> </span>`),Vi=c(`<a class="svelte-1ouw4wc"> </a>`),Hi=c(`<p class="smrt-records__foot svelte-1ouw4wc" data-smrt-component="RecordListWidget"><!> <!></p>`);function Ui(r,a){h(a,!0);let{t:o}=se(),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`?yt(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`?yt(a.data.href):null),p=n(()=>fr(nr(a.options?.columns),Q(a.data)?a.data.columns:void 0)),m=n(()=>ur(a.data)),g=n(()=>typeof a.options?.summaries==`boolean`?a.options.summaries:e(p).some(e=>lr(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=Mi(),b=I(y),S=r=>{var i=Mi(),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);Ai(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=ji(),r=k(n),i=P(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=Ni(),n=P(t,!0);R(e=>l(n,e),[()=>o(Z[`ui.overview.records.empty`])]),x(e,t)},w=n=>{var r=zi();f(r,21,()=>e(c),e=>e.id,(n,r)=>{var i=Ri(),a=k(i),o=k(a),c=t=>{var n=Pi(),i=P(n,!0);R(()=>{z(n,`href`,e(r).href),l(i,e(r).title)}),x(t,n)},u=t=>{var n=Fi(),i=P(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=Ii(),i=P(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=Li(),i=P(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=Hi(),i=k(r),c=t=>{var n=Bi(),r=P(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=Vi(),r=P(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 Wi=c(`<p class="smrt-shortcuts__empty svelte-1nfxkds" data-smrt-component="ShortcutsWidget"> </p>`),Gi=c(`<span class="smrt-shortcuts__desc svelte-1nfxkds"> </span>`),Ki=c(`<span class="smrt-shortcuts__foot svelte-1nfxkds"><span class="smrt-shortcuts__count svelte-1nfxkds"> </span></span>`),qi=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>`),Ji=c(`<ul class="smrt-shortcuts svelte-1nfxkds" data-smrt-component="ShortcutsWidget"></ul>`);function Yi(r,a){h(a,!0);let o=E(a,`presentation`,3,`card`),{t:c}=se(),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`?yt(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:he,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=Wi(),n=P(t,!0);R(e=>l(n,e),[()=>c(Z[`ui.overview.shortcuts.empty`])]),x(e,t)},y=n=>{var r=Ji();f(r,21,()=>e(m),e=>e.id,(n,r)=>{var i=qi(),o=k(i),c=k(o),u=k(c),d=k(u);_e(d,{get name(){return e(r).icon},size:28,get iconComponent(){return a.iconComponent}}),s(u);var f=M(u,2),m=P(f,!0);s(c);var h=M(c,2),g=t=>{var n=Gi(),i=P(n,!0);R(()=>{z(n,`title`,e(r).description),l(i,e(r).description)}),x(t,n)};t(h,t=>{e(r).description&&t(g)});var _=M(h,2),v=t=>{var n=Ki(),i=k(n),a=P(i,!0);s(n),R(e=>l(a,e),[()=>p(e(r).count)]),x(t,n)};t(_,t=>{e(r).count!==void 0&&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 Xi={key:`title`,type:`text`,label:`ui.overview.opt.title`,help:`ui.overview.opt.title_help`,maxLength:80},Zi={key:`model`,type:`model`,label:`ui.overview.opt.model`,help:`ui.overview.opt.model_help`,required:!0},Qi={key:`filter`,type:`identifier`,label:`ui.overview.opt.filter`,help:`ui.overview.opt.filter_help`},$i={key:`field`,type:`identifier`,label:`ui.overview.opt.field`,help:`ui.overview.opt.field_help`},ea={key:`parentField`,type:`identifier`,label:`ui.overview.opt.parent_field`,help:`ui.overview.opt.parent_field_help`},ta={key:`columns`,type:`text`,label:`ui.overview.opt.columns`,help:`ui.overview.opt.columns_help`,maxLength:400},na={key:`summaries`,type:`boolean`,label:`ui.overview.opt.summaries`,help:`ui.overview.opt.summaries_help`},ra=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 ia(e){return{type:`metric`,title:`ui.overview.widget.metric.title`,description:`ui.overview.widget.metric.description`,icon:`layers`,options:[Xi,Zi,ra([`count`,`sum`,`avg`,`min`,`max`]),$i,Qi,ea],component:di,load:e}}function aa(e,t){return t>=1&&t<2?{...e}:null}function oa(e){return{type:`chart`,title:`ui.overview.widget.chart.title`,description:`ui.overview.widget.chart.description`,icon:`repeat`,options:[Xi,Zi,{key:`groupBy`,type:`identifier`,label:`ui.overview.opt.group_by`},ra([`count`,`sum`,`avg`]),$i,{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`}]},Qi],component:ii,load:e,version:2,migrate:aa,defaultSpan:2}}function sa(e){return{type:`records`,title:`ui.overview.widget.records.title`,description:`ui.overview.widget.records.description`,icon:`fileText`,options:[Xi,Zi,{key:`sort`,type:`identifier`,label:`ui.overview.opt.sort`},$i,{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},Qi,ta,na],component:Ui,load:e,defaultSpan:2}}function ca(e){return{type:`shortcuts`,title:`ui.overview.widget.shortcuts.title`,description:`ui.overview.widget.shortcuts.description`,icon:`home`,options:[Xi,{key:`section`,type:`identifier`,label:`ui.overview.opt.section`,help:`ui.overview.opt.section_help`}],component:Yi,load:e,defaultSpan:4}}function la(){return{type:`note`,title:`ui.overview.widget.note.title`,description:`ui.overview.widget.note.description`,icon:`fileText`,options:[Xi,{key:`body`,type:`markdown`,label:`ui.overview.opt.body`,help:`ui.overview.opt.body_help`,default:``,maxLength:4e3}],component:Ei,defaultSpan:2}}function ua(e=it,t={},n={}){let r=[e.register(la(),n)];return t.metric&&r.push(e.register(ia(t.metric),n)),t.chart&&r.push(e.register(oa(t.chart),n)),t.records&&r.push(e.register(sa(t.records),n)),t.shortcuts&&r.push(e.register(ca(t.shortcuts),n)),()=>{for(let e of r)e()}}var da=c(`<p class="smrt-line-items__empty svelte-1q5no7f"> </p>`),fa=c(`<div class="smrt-line-items__total svelte-1q5no7f"><dt class="svelte-1q5no7f"> </dt><dd class="svelte-1q5no7f"> </dd></div>`),pa=c(`<div class="smrt-line-items__total smrt-line-items__total--muted svelte-1q5no7f"><dt class="svelte-1q5no7f"> </dt></div>`),ma=c(`<dd class="svelte-1q5no7f"> </dd>`),ha=c(`<div class="smrt-line-items__total smrt-line-items__total--muted svelte-1q5no7f"><dt class="svelte-1q5no7f"> </dt> <!></div>`),ga=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>`),_a=c(`<span class="smrt-line-items__computed svelte-1q5no7f"> </span>`),va=c(`<div><dt class="svelte-1q5no7f"> <!></dt> <dd class="svelte-1q5no7f"> </dd></div>`),ya=c(`<dl class="smrt-line-items__totals svelte-1q5no7f"></dl>`),ba=c(`<p class="smrt-line-items__flag svelte-1q5no7f"><strong> </strong> </p>`),xa=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}=se(),u=n(()=>ur(o.data)),d=n(()=>fr([],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:Sr(e(u).map(t=>t.cells?.[e(_)]))}),y=n(()=>Cr(Q(o.data)&&Q(o.data.totals)?o.data.totals:void 0,e(v))),b=n(()=>Q(o.data)&&vr(o.data.storedTotals)?o.data.storedTotals:void 0),C=n(()=>e(b)?yr(e(b).taxes).filter(e=>e.tax!==0):[]),w=n(()=>e(C).length>0),T=n(()=>Q(o.data)&&typeof o.data.href==`string`?yt(o.data.href):null);function E(t){return sr({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 ee=Sa(),O=k(ee),A=t=>{Ai(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=da(),n=P(t,!0);R(e=>l(n,e),[()=>c(Z[`ui.overview.line_items.empty`])]),x(e,t)};t(O,t=>{e(u).length>0&&e(d).length>0?t(A):t(j,-1)});var N=M(O,2),te=n=>{var r=ga(),i=k(r),a=t=>{var n=fa(),r=k(n),i=P(r,!0),a=M(r),o=P(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=pa(),r=k(n),i=P(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=ha(),a=k(i),o=P(a),u=M(a,2),d=t=>{var n=ma(),i=P(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:br(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=pa(),n=k(t),r=P(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=k(h),_=P(g,!0),v=M(g),y=P(v,!0);s(h);var S=M(h,2),T=t=>{var n=fa(),r=k(n),i=P(r,!0),a=M(r),o=P(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=ya();f(r,21,()=>e(y).lines,e=>e.key,(n,r)=>{var i=S(),o=I(i),u=t=>{var n=pa(),i=k(n),a=P(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=va();let o;var u=k(i),d=k(u),f=M(d),p=e=>{var t=_a(),n=P(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=P(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(N,t=>{e(b)?t(te):e(y).lines.length>0&&t(F,1)});var L=M(N,2),B=t=>{var n=ba(),r=k(n),i=P(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 ne=M(L,2),re=t=>{var n=xa(),r=k(n),i=P(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(ne,t=>{e(T)&&t(re)}),s(ee),x(r,ee),i()}var wa=c(`<p class="smrt-related__empty svelte-ka1ryg" data-smrt-component="RelatedWidget"> </p>`),Ta=c(`<a> </a>`),Ea=c(`<li><!></li>`),Da=c(`<ul class="smrt-related__list svelte-ka1ryg"></ul>`),Oa=c(`<p class="smrt-related__foot svelte-ka1ryg"><a class="svelte-ka1ryg"> </a></p>`),ka=c(`<!> <!>`,1),Aa=c(`<div class="smrt-related svelte-ka1ryg" data-smrt-component="RelatedWidget"><!></div>`);function ja(r,a){h(a,!0);let{t:o}=se(),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=ur(t),r=typeof t.total==`number`&&Number.isFinite(t.total)?t.total:n.length;if(n.length===0||r===0)continue;let i=fr([],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`?yt(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=wa(),n=P(t,!0);R(e=>l(n,e),[()=>o(Z[`ui.overview.related.empty`])]),x(e,t)},v=r=>{var i=Aa(),m=k(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);ne(d,()=>e(p).key,r=>{var i=ka(),c=I(i),d=t=>{Ai(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=Da();f(i,21,()=>e(p).rows,e=>e.id,(r,i)=>{var a=Ea(),o=k(a),c=t=>{var n=Ta(),r=P(n,!0);R(t=>{z(n,`href`,t),l(r,e(i).title)},[()=>yt(e(i).href)]),x(t,n)},d=n(()=>e(i).href&&yt(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=Oa(),r=k(n),i=P(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 Ma(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:ja,load:e,defaultSpan:4}}function Na(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 Pa(e=it,t,n={}){let r=[e.register(Ma(Dr(t)),n),e.register(Na(Ar(t)),n)];return()=>{for(let e of r)e()}}var $=V({"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.`}),Fa=(e,t=p)=>{var n=Ia(),r=P(n,!0);R(e=>{z(n,`title`,t()),l(r,e)},[()=>$n(t())]),x(e,n)},Ia=c(`<code> </code>`),La=c(`<h2 class="smrt-detail-screen__group-title svelte-c1e3gm"> </h2>`),Ra=c(`<span class="smrt-detail-screen__empty svelte-c1e3gm"> </span>`),za=c(`<div class="svelte-c1e3gm"><dt class="svelte-c1e3gm"> </dt> <dd class="svelte-c1e3gm"> </dd></div>`),Ba=c(`<dl class="smrt-detail-screen__pairs svelte-c1e3gm"></dl>`),Va=c(`<pre class="smrt-detail-screen__block svelte-c1e3gm"> </pre>`),Ha=c(`<a> </a>`),Ua=c(`<a class="smrt-detail-screen__reference"><!></a>`),Wa=c(`<span class="smrt-detail-screen__reference"> </span>`),Ga=c(`<div class="smrt-detail-screen__field svelte-c1e3gm"><dt class="svelte-c1e3gm"> </dt> <dd class="svelte-c1e3gm"><!></dd></div>`),Ka=c(`<section class="smrt-detail-screen__group"><!> <dl class="smrt-detail-screen__fields svelte-c1e3gm"></dl></section>`),qa=c(`<!> <!> <!> <!>`,1),Ja=c(`<!> <!> <!> <!> <!>`,1),Ya=c(`<!> <article data-smrt-component="DetailScreen"><!></article> <!>`,1);function Xa(r,c){h(c,!0);let d=(r,i=p)=>{var a=S(),o=I(a);f(o,17,()=>In(i()),([e,t])=>e??``,(r,i)=>{var a=n(()=>y(e(i),2));let o=()=>e(a)[0],d=()=>e(a)[1];var p=Ka(),m=k(p),h=e=>{var t=La(),n=P(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(()=>oe(e(i)));var o=Ga(),d=k(o),p=P(d,!0),m=M(d,2),h=k(m),g=e=>{var t=Ra(),n=P(t,!0);R(e=>l(n,e),[()=>T($[`ui.screens.not_set`])]),x(e,t)},_=r=>{let o=n(()=>Qn(c.record[e(i).name]));var u=S(),d=I(u),p=t=>{var n=Ba();f(n,21,()=>e(o),e=>e.key,(t,n)=>{var r=za(),i=k(r),a=P(i,!0),o=M(i,2),c=P(o,!0);s(r),R(t=>{l(a,t),l(c,e(n).value)},[()=>En(e(n).key)]),x(t,r)}),s(n),x(t,n)},m=t=>{var n=Va(),r=P(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=Va(),r=P(n,!0);R(()=>l(r,e(a))),x(t,n)},y=t=>{var n=Ha(),r=P(n,!0);R(t=>{z(n,`href`,t),l(r,e(a))},[()=>V(e(i),e(a))]),x(t,n)},b=n(()=>V(e(i),e(a))),C=r=>{let o=n(()=>c.hrefFor?.(e(i),e(a))),d=n(()=>le(e(i),e(a)));var f=S(),p=I(f),m=n=>{var r=Ua(),i=k(r),c=t=>{var n=u();R(()=>l(n,e(d))),x(t,n)},f=t=>{Fa(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=Wa(),r=P(n,!0);R(()=>l(r,e(d))),x(t,n)},g=t=>{Fa(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}=se(),ee=n(()=>On(c.definition)),O=n(()=>jn(c.definition,m())),A=n(()=>e(O)?[]:Fn(c.definition,m(),{mode:`view`,include:c.fields})),j=n(()=>c.exclude?e(A).filter(e=>!c.exclude.includes(e.name)):e(A)),N=n(()=>C()?e(j).filter(e=>oe(e)!==``):e(j)),te=n(()=>C()?e(j).filter(e=>oe(e)===``):[]),F=n(()=>e(N).filter(e=>e.tier===`basic`)),L=n(()=>e(N).filter(e=>e.tier===`advanced`)),ne=n(()=>{if(c.title)return c.title;let t=e(A).find(e=>e.kind===`text`&&e.tier===`basic`),n=t?c.record[t.name]:void 0;return typeof n==`string`&&n.trim()!==``?n:e(ee).singular}),ae=n(()=>({currency:c.currency,locale:c.locale,yes:T($[`ui.screens.yes`]),no:T($[`ui.screens.no`])}));function oe(t){return qn(t,c.record[t.name],e(ae))}function V(e,t){return e.kind===`email`?`mailto:${t}`:e.kind===`url`&&/^https?:\/\//i.test(t)?t:null}function ce(e){return b().find(t=>t.kind===`reference`&&t.field===e.name)?.model}function le(e,t){let n=ce(e),r=n?c.labels?.[n]?.(t):void 0;return r&&r.trim()!==``?r:void 0}let H=D(!1),U=D(!1);async function ue(){B(U,!1);try{await c.ondelete?.(),B(H,!1)}catch{B(U,!0),B(H,!1)}}var K=Ya(),q=I(K),de=n=>{xe(n,{get title(){return e(ne)},actions:n=>{var r=qa(),i=I(r),a=t=>{G(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(ee).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=>{G(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=>{G(e,{variant:`danger`,onclick:()=>B(H,!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(q,e=>{g()&&e(de)});var fe=M(q,2);let pe;var me=k(fe),he=t=>{ie(t,{variant:`error`,children:(t,n)=>{_();var r=u();R(()=>l(r,e(O))),x(t,r)},$$slots:{default:!0}})},ge=r=>{var i=Ja(),a=I(i),s=e=>{ie(e,{variant:`error`,dismissible:!0,ondismiss:()=>B(U,!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(U)&&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`]));W(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(te).length}));W(t,{get title(){return e(r)},children:(t,n)=>{d(t,()=>e(te))},$$slots:{default:!0}})}};t(g,t=>{e(te).length>0&&t(v)});var y=M(g,2);o(y,()=>c.children??p),x(r,i)};t(me,t=>{e(O)?t(he):t(ge,-1)}),s(fe);var _e=M(fe,2),J=t=>{{let r=n(()=>T($[`ui.screens.delete_title`],{name:e(ee).singular.toLowerCase()})),i=n(()=>T($[`ui.screens.delete_message`])),a=n(()=>T($[`ui.screens.delete`])),o=n(()=>T($[`ui.screens.cancel`]));re(t,{get open(){return e(H)},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:ue,oncancel:()=>B(H,!1)})}};t(_e,e=>{c.ondelete&&e(J)}),R(e=>{pe=a(fe,1,`smrt-detail-screen svelte-c1e3gm`,null,pe,{"smrt-detail-screen--card":w()===`card`}),z(fe,`aria-label`,e)},[()=>w()===`card`?T($[`ui.screens.details`]):e(ne)]),x(r,K),i()}var Za=c(`<small class="smrt-edit-form__hint svelte-6ki7lf"> </small>`),Qa=c(`<small class="smrt-edit-form__error svelte-6ki7lf" role="alert"> </small>`),$a=c(`<div class="smrt-edit-form__check svelte-6ki7lf"><!> <!> <!></div>`),eo=c(`<option> </option>`),to=c(`<!> <!> <!>`,1),no=c(`<legend class="svelte-6ki7lf"> </legend>`),ro=c(`<fieldset class="smrt-edit-form__group svelte-6ki7lf"><!> <!></fieldset>`),io=c(`<!> <!>`,1),ao=c(`<!> <!> <!> <!>`,1),oo=c(`<!> <section class="smrt-edit-form svelte-6ki7lf" data-smrt-component="EditForm"><!></section>`,1);function so(r,a){h(a,!0);let o=(r,i=p)=>{var o=S(),c=I(o),u=t=>{{let r=n(()=>J(i())),o=n(()=>T($[`ui.screens.derived_hint`]));ve(t,{get label(){return e(r)},get hint(){return e(o)},children:(t,r)=>{{let r=n(()=>qn(i(),a.record?.[i().name],{currency:m()}));q(t,{get name(){return i().name},readonly:!0,get value(){return e(r)}})}},$$slots:{default:!0}})}},d=n(()=>ne(i())),h=r=>{var a=$a(),o=k(a),c=()=>e(V)[i().name]===!0,u=t=>e(V)[i().name]=t;de(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=Za(),n=P(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=Qa(),n=P(t,!0);R(e=>l(n,e),[()=>he(i())]),x(e,t)},h=n(()=>he(i()));t(p,t=>{e(h)&&t(m)}),s(a),x(r,a)},g=r=>{{let a=n(()=>J(i())),o=n(()=>_e(i())),s=n(()=>he(i()));ve(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=()=>pe(i().name),o=e=>me(i().name,e);Y(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=to(),s=I(o),c=e=>{var t=eo(),n=P(t,!0);t.value=t.__value=``,R(e=>l(n,e),[()=>T($[`ui.screens.select_none`])]),x(e,t)},u=n(()=>!i().required||pe(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=eo(),r=P(n,!0),i={};R(e=>{l(r,e),i!==(i=t)&&(n.value=(n.__value=i)??``)},[()=>or(t)]),x(e,n)});var p=M(d,2),m=e=>{var t=eo(),n=P(t,!0),r={};R((e,i)=>{l(n,e),r!==(r=i)&&(t.value=(t.__value=r)??``)},[()=>pe(i().name),()=>pe(i().name)]),x(e,t)},h=n(()=>pe(i().name)!==``&&!(i().options??[]).includes(pe(i().name)));t(p,t=>{e(h)&&t(m)}),x(r,o)},$$slots:{default:!0}})},u=t=>{var r=()=>pe(i().name),a=e=>me(i().name,e);{let o=n(()=>i().kind===`json`?8:4);ye(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=()=>pe(i().name),a=e=>me(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);q(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,()=>In(i()),([e,t])=>e??``,(r,i)=>{var a=n(()=>y(e(i),2));let c=()=>e(a)[0],u=()=>e(a)[1];var d=ro(),p=k(d),m=e=>{var t=no(),n=P(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}=se(),O=n(()=>a.record===void 0),A=n(()=>On(a.definition)),N=n(()=>jn(a.definition,d())),te=n(()=>a.title??T($[e(O)?`ui.screens.create_title`:`ui.screens.edit_title`],{name:e(A).singular.toLowerCase()})),L=n(()=>e(N)?[]:Fn(a.definition,d(),{mode:`edit`,include:a.fields})),ne=e=>w().includes(e.name),re=n(()=>e(L).filter(e=>e.tier===`basic`)),ae=n(()=>e(L).filter(e=>e.tier===`advanced`));function oe(){return a.record?Wn(e(L),a.record,{currency:m()}):Gn(e(L),d(),{currency:m()})}let V=D(j(oe())),ce=D(j({})),le=D(j({})),H=D(!1),U=D(!1),ue=D(!1),K=n(()=>`${a.definition.objectRef}:${a.record?String(a.record[a.definition.idField??`id`]):`new`}:${e(L).map(e=>e.name).join(`,`)}`),fe=F(()=>e(K));ee(()=>{let t=e(K);t!==fe&&(fe=t,F(()=>{B(V,oe(),!0),B(ce,{},!0),B(le,{},!0),B(H,!1)}))});function pe(t){let n=e(V)[t];return typeof n==`string`?n:``}function me(t,n){e(V)[t]=String(n??``)}function he(t){let n=e(ce)[t.name];return n?T($[`ui.screens.error.${n}`]):b()[t.name]??e(le)[t.name]}let ge=n(()=>e(ae).some(t=>e(ce)[t.name]||b()[t.name]||e(le)[t.name]));function _e(e){return e.help??void 0}function J(e){return e.kind===`money`?`${e.label} (${m()})`:e.label}async function Se(){if(e(U)||v())return;B(H,!1),B(le,{},!0);let t=Kn(e(L).filter(e=>!ne(e)),e(V),{currency:m(),record:a.record});if(B(ce,t.errors,!0),Object.keys(t.errors).length>0)e(ae).some(e=>t.errors[e.name])&&B(ue,!0);else{B(U,!0);try{let n=await a.onsubmit(t.values,{isNew:e(O)});n?.fieldErrors&&(B(le,{...n.fieldErrors},!0),e(ae).some(e=>n.fieldErrors?.[e.name])&&B(ue,!0))}catch{B(H,!0)}finally{B(U,!1)}}}let Ce=n(()=>e(U)||v()),we=n(()=>C()??(e(H)?T($[`ui.screens.save_failed`]):null));var Te=oo(),Ee=I(Te),De=t=>{xe(t,{get title(){return e(te)}})};t(Ee,e=>{g()&&e(De)});var Oe=M(Ee,2),ke=k(Oe),Ae=t=>{ie(t,{variant:`error`,children:(t,n)=>{_();var r=u();R(()=>l(r,e(N))),x(t,r)},$$slots:{default:!0}})},je=r=>{X(r,{onsubmit:Se,novalidate:!0,children:(r,i)=>{var o=ao(),s=I(o),d=t=>{ie(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(re));var p=M(f,2),m=t=>{var r=()=>e(ue)||e(ge),i=e=>B(ue,e,!0);{let a=n(()=>T($[`ui.screens.advanced_fields`]));W(t,{get title(){return e(a)},get open(){return r()},set open(e){i(e)},children:(t,n)=>{c(t,()=>e(ae))},$$slots:{default:!0}})}};t(p,t=>{e(ae).length>0&&t(m)});var h=M(p,2);be(h,{children:(n,r)=>{var i=io(),o=I(i),s=t=>{G(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);G(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(N)?t(Ae):t(je,-1)}),s(Oe),R(()=>z(Oe,`aria-label`,e(te))),x(r,Te),i()}var co=c(` <code class="smrt-record-header__id svelte-uiz8xl"> </code>`,1),lo=c(`<code class="smrt-record-header__id smrt-record-header__id--chip svelte-uiz8xl"> </code>`),uo=c(`<span class="smrt-record-header__sr svelte-uiz8xl"> </span> `,1),fo=c(`<span aria-hidden="true">⋯</span>`),po=c(`<div class="smrt-record-header__menu svelte-uiz8xl"><!> <!></div>`),mo=c(`<code> </code>`),ho=c(`<a><!></a>`),go=c(`<a> </a>`),_o=c(`<div class="smrt-record-header__fact svelte-uiz8xl"><dt class="svelte-uiz8xl"> </dt> <dd class="svelte-uiz8xl"><!></dd></div>`),vo=c(`<dl class="smrt-record-header__facts svelte-uiz8xl"></dl>`),yo=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 bo(r,a){h(a,!0);let c=E(a,`relations`,19,()=>[]),d=E(a,`deleting`,3,!1),{t:p}=se(),m=n(()=>On(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`?qn({kind:`datetime`,definition:{format:`date`}},t,{locale:a.locale}):qn(e.field,t,{currency:a.currency,locale:a.locale})}function ee(e,t){if(e.field.kind===`email`)return`mailto:${t}`;if(e.field.kind===`tel`)return`tel:${t.replace(/[^\d+]/g,``)}`}var O=yo(),A=I(O),j=k(A),N=t=>{G(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(N)});var te=M(j,2),F=k(te),L=k(F),ne=k(L),ae=e=>{var t=co(),n=I(t,!0),r=M(n),i=P(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)},oe=e=>{var t=u();R(()=>l(t,a.model.heading)),x(e,t)};t(ne,e=>{a.model.headingIdentifier&&a.model.identifier?e(ae):e(oe,-1)}),s(L);var V=M(L,2),le=e=>{var t=lo(),n=P(t,!0);R(()=>{z(t,`title`,a.model.identifier.field.label),l(n,a.model.identifier.value)}),x(e,t)};t(V,e=>{a.model.identifier&&!a.model.headingIdentifier&&e(le)});var H=M(V,2),U=t=>{{let r=n(()=>ar(a.model.status.value,a.statusTones));ue(t,{get variant(){return e(r)},children:(e,t)=>{var n=uo(),r=I(n),i=P(r),o=M(r,1,!0);R(e=>{l(i,`${a.model.status.field.label??``}:`),l(o,e)},[()=>or(a.model.status.value)]),x(e,n)},$$slots:{default:!0}})}};t(H,e=>{a.model.status&&e(U)}),s(F);var W=M(F,2),K=k(W),q=e=>{G(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(K,e=>{a.onedit&&e(q)});var de=M(K,2),fe=r=>{{let i=e=>{var t=fo();x(e,t)},c=n(()=>p($[`ui.screens.more_actions`])),d=n(()=>p($[`ui.screens.more_actions`]));ce(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=po(),i=k(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=>{G(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(de,t=>{e(g)&&t(fe)}),s(W),s(te);var pe=M(te,2),me=r=>{var i=vo();f(i,21,()=>a.model.facts,e=>e.field.name,(r,i)=>{let o=n(()=>T(e(i)));var c=_o(),d=k(c),f=P(d,!0),p=M(d,2),m=k(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=ho(),i=k(r),a=t=>{var n=u();R(()=>l(n,e(d))),x(t,n)},f=t=>{var n=mo(),r=P(n,!0);R(t=>{z(n,`title`,e(o)),l(r,t)},[()=>$n(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=mo(),r=P(n,!0);R(t=>{z(n,`title`,e(o)),l(r,t)},[()=>$n(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=go(),r=P(n,!0);R(t=>{z(n,`href`,t),l(r,e(o))},[()=>ee(e(i),e(o))]),x(t,n)},_=n(()=>e(i).kind===`contact`&&ee(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(pe,e=>{a.model.facts.length>0&&e(me)});var he=M(pe,2),ge=e=>{ie(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(he,t=>{e(b)&&t(ge)}),s(A);var _e=M(A,2),J=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`]));re(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(_e,e=>{a.ondelete&&e(J)}),x(r,O),i()}function xo(e){return e==null?!1:typeof e!=`string`||e.trim()!==``}function So(e,t){return(e.roles??[]).includes(t)}function Co(e,t,n,r,i={}){let{singular:a}=On(e),o=t.filter(e=>xo(n[e.name])),s=e=>o.find(t=>So(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&&Cn(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=>So(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 wo(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 _r(e.lineAmountType)&&(!n||n.some(e=>e.name===`lineAmountType`))&&(r.lineAmountType=e.lineAmountType),r}function To(e){return Object.keys(e).filter(t=>[`subtotal`,`discount`,`tax`,`total`].some(n=>e[t]?.includes(n)))}var Eo=c(`<span class="smrt-record-screen__count svelte-1ijjiku"> </span>`),Do=c(`<a class="smrt-record-screen__view-all svelte-1ijjiku"> </a>`),Oo=c(`<span class="smrt-record-screen__widget-heading svelte-1ijjiku"><span class="smrt-record-screen__widget-title"> <!></span> <!></span>`),ko=c(`<section class="smrt-record-screen__items svelte-1ijjiku"><!></section>`),Ao=c(`<!> <!>`,1),jo=c(`<aside class="smrt-record-screen__aside svelte-1ijjiku"><h2 class="smrt-record-screen__aside-title svelte-1ijjiku"> </h2> <!></aside>`),Mo=c(`<div class="smrt-record-screen__sheet-body svelte-1ijjiku"><!></div>`),No=c(`<section class="smrt-record-screen__sheet svelte-1ijjiku" data-smrt-component="RecordScreen"><!></section>`),Po=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 Fo(r,c){h(c,!0);let u=(r,i=p,a=p)=>{let o=n(()=>i().type===`records`&&me(i())&&K.entry(i()).status===`ready`?e(W)[i().id]:void 0);var u=Oo(),d=k(u),f=k(d,!0),m=M(f),h=t=>{var n=Eo(),r=P(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=Do(),r=P(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=Ao(),a=I(i),l=t=>{var r=S(),i=I(r);ne(i,()=>e(T),t=>{{let r=n(()=>c.fieldErrors??{});so(t,{get definition(){return c.definition},get policy(){return f()},get currency(){return e(V)},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:ge,get derivedFields(){return e(ce)}})}}),x(t,r)};t(a,e=>{c.onsave&&e(l)});var u=M(a,2),d=e=>{var t=ko(),n=k(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}=se(),C=n(()=>On(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)])),O=n(()=>c.mode===`edit`),A=n(()=>b($[`ui.screens.edit_title`],{name:e(C).singular.toLowerCase()})),N=n(()=>bn(c.definition)),L=n(()=>jn(c.definition,f())?[]:Fn(c.definition,f(),{mode:`view`,include:c.fields})),re=n(()=>Co(c.definition,e(L),c.record,e(N),{title:c.title})),ie=n(()=>m().some(e=>e.kind===`items`)),ae=n(()=>Sn(c.definition)),V=n(()=>{if(c.currency)return c.currency;let t=e(ae)?c.record[e(ae)]:void 0;return typeof t==`string`&&/^[A-Za-z]{3}$/.test(t.trim())?t.trim().toUpperCase():void 0}),ce=n(()=>c.derivedFields??(e(ie)?To(e(N)):[])),le=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 ua(n,c.loaders??{});if(t){let r=rt();Pa(r,{relations:m(),records:t,viewAllHref:e=>c.viewAllHref?.(e),totals:()=>wo(c.record,e(N),e(L)),storedTotals:()=>c.lineItemStoredTotals?.(),currency:()=>e(V)});for(let e of r.list())n.has(e.type)||n.register(e)}return n}),H=F(()=>c.overview??gr(c.definition,m())),U=F(()=>c.override!==void 0),ue=n(()=>m().filter(e=>e.kind!==`reference`)),W=D(j({}));function G(t,n){if(t.type!==`records`)return n;let r=me(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(W,{...e(W),[t.id]:{count:typeof i==`number`&&Number.isFinite(i)?i:s,href:c.viewAllHref?.(r)??(typeof a==`string`?yt(a):null)}},!0),l?{...o,total:i}:o}let K=ut({definition:H,registry:le,override:U?()=>c.override??null:void 0,onchange:e=>c.onoverviewchange?.(e),canCustomize:()=>g(),loadWidget:(t,n)=>{let r=le.get(t.type)?.load;if(!r)return Promise.resolve(void 0);let i={...c.widgetContext,overviewId:H.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=>G(t,e))}});te(()=>K.destroy());let q=n(()=>e(ie)&&K.document.widgets.some(e=>e.type===`line-items`)),de=n(()=>[...e(re).shown,...e(ae)?[e(ae)]:[],...e(q)?To(e(N)):[]]),fe=F(()=>e(T));ee(()=>{let t=e(T);t!==fe&&(fe=t,F(()=>{for(let e of K.document.widgets)K.reload(e.id)}))}),ee(()=>{U&&(c.override,F(()=>K.sync()))});let pe=n(()=>{let t=[];for(let n of e(ue))t.some(e=>e.value===n.model)||t.push({value:n.model,label:n.label});return t});function me(t){let{filter:n,model:r,field:i}=t.options;if(n===`parent`)return e(ue).find(e=>e.model===r&&e.field===i)}let he=D(!0);ee(()=>{if(typeof window>`u`||typeof window.matchMedia!=`function`)return;let e=window.matchMedia(`(min-width: 48rem)`),t=()=>{B(he,e.matches,!0)};return t(),e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)});function ge(){c.oncancel?.()}var _e=Po(),J=I(_e);let Y;var X=k(J),ve=k(X);{let t=n(()=>e(O)?void 0:c.onedit);bo(ve,{get definition(){return c.definition},get model(){return e(re)},get record(){return c.record},get relations(){return m()},get hrefFor(){return c.hrefFor},get labels(){return c.labels},get currency(){return e(V)},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);Xa(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(V)},get locale(){return c.locale},get hrefFor(){return c.hrefFor},get labels(){return c.labels},showHeader:!1,get exclude(){return e(de)},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=k(be);{let t=n(()=>b($[`ui.screens.related`]));Yt(xe,{get controller(){return K},get editing(){return c.layoutEditing},presentation:`plain`,headingLevel:2,get heading(){return u},get label(){return e(t)},get models(){return e(pe)}})}s(be),s(X);var Se=M(X,2),Ce=t=>{var n=jo(),r=k(n),i=P(r,!0),a=M(r,2);d(a),s(n),R(()=>{z(n,`aria-label`,e(A)),l(i,e(A))}),x(t,n)};t(Se,t=>{e(O)&&e(he)&&t(Ce)}),s(J);var we=M(J,2),Te=n=>{var r=No(),i=k(r);oe(i,{get open(){return e(O)},get title(){return e(A)},onclose:ge,variant:`page`,children:(n,r)=>{var i=S(),a=I(i),o=e=>{var t=Mo(),n=k(t);d(n),s(t),x(e,t)};t(a,t=>{e(O)&&t(o)}),x(n,i)},$$slots:{default:!0}}),s(r),x(n,r)};t(we,t=>{e(he)||t(Te)}),R(t=>{Y=a(J,1,`smrt-record-screen svelte-1ijjiku`,null,Y,{"smrt-record-screen--edit":e(O)}),z(J,`data-mode`,c.mode),z(be,`aria-label`,t)},[()=>b($[`ui.screens.related`])]),x(r,_e),i()}var Io=[`name`,`title`,`label`,`code`];function Lo(e){let t=e.display?.label,n=new Set(e.fields.map(e=>e.name));return[...t?[t]:[],...Io].filter((e,t,r)=>n.has(e)&&r.indexOf(e)===t)}function Ro(e,t){for(let n of Lo(e)){let e=t[n];if(typeof e==`string`&&e.trim()!==``)return e}}var zo=e=>e.type===`foreignKey`||e.type===`crossPackageRef`,Bo=[/^customer/i,/^vendor/i,/^profile/i,/^product/i,/^invoice/i,/^order/i,/^payment/i,/^contract/i];function Vo(e){if(Lo(e).some(e=>e!==`code`))return;let t=e.fields.filter(e=>!e.system),n=xn(bn({objectRef:e.id,className:e.name,fields:Object.fromEntries(t.map(e=>[e.name,{type:Ho.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 Ho=new Set([`text`,`integer`,`decimal`,`boolean`,`datetime`,`json`,`foreignKey`,`crossPackageRef`]);function Uo(e,t){let n=Vo(e),r=n?t[n.name]:void 0;return typeof r==`string`&&r.trim()!==``?r:void 0}function Wo(e,t){let n=e.filter(e=>zo(e)&&typeof t[e.name]==`string`&&t[e.name]!==``);for(let e of Bo){let t=n.find(t=>e.test(t.name));if(t)return t}}var Go=/(paid|allocated|issue|^date$|createdat)/i;function Ko(e,t,n,r=e.fields){let i=Ro(e,t);if(i)return i;let a=Uo(e,t);if(a)return a;let o=Wo(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`&&Go.test(e.name)&&t[e.name]);return Jo([s,H(t.amount),n?String(t[n.name]).slice(0,10):void 0])}return Jo([s,typeof t.description==`string`&&t.description.trim()!==``?t.description:void 0])}function qo(e,t,n,r){if(Ro(e,t))return n;let i=Uo(e,t);return i&&i===n?`${r} ${i}`:n}function Jo(e){let t=e.filter(e=>!!e);return t.filter((e,n)=>t.indexOf(e)===n).join(` · `)||void 0}var Yo=`@happyvertical/smrt-profiles:Profile`,Xo=`@happyvertical/smrt-commerce:Customer`,Zo=`@happyvertical/smrt-commerce:Vendor`,Qo=20;function $o(e){let t=le(e);if(!t)throw Error(`The catalog has no model ${e}`);return t.model}function es(e){return String(e??``).slice(0,8)}function ts(e){return e.fields.some(e=>e.name===`profileId`&&e.related===`@happyvertical/smrt-profiles:Profile`)}async function ns(e,t){return typeof t.profileId==`string`&&t.profileId?e.get($o(Yo),t.profileId):void 0}var rs=3;async function is(e,t,n,r=0,i){if(ts(t)){let t=await ns(e,n),r=t&&Ro($o(`@happyvertical/smrt-profiles:Profile`),t);if(r)return r}let a=Wo(t.fields,n);if(a&&a.name===i){let e=Ko(t,n,()=>void 0);if(e)return e}let o=a?.related?le(a.related)?.model:void 0,s;if(a&&o&&r<rs){let t=await e.get(o,String(n[a.name]));t&&(s=await is(e,o,t,r+1))}return Ko(t,n,()=>s)??es(n.id)}async function as(e,t,n){let r=new Map;for(let i of t){let t=i.related;if(!t)continue;let a=le(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(U(t,n)))continue;let i=await e.get(a,n);i&&r.set(U(t,n),await is(e,a,i))}}return r}var os=(e,t)=>e.toLowerCase().includes(t.trim().toLowerCase());async function ss(e,t,n){let r=[];for(let i of await e.list(t)){let a=await is(e,t,i);if(os(a,n)&&r.push({id:i.id,label:a}),r.length>=Qo)break}return r}async function cs(e,t,n){let r=await e.get(t,n);return r?{id:r.id,label:await is(e,t,r)}:null}var ls=e=>typeof e==`string`&&e!==``?e:void 0;async function us(e,t){let n=await ns(e,t);return{...n?{id:n.id}:{},name:(n&&Ro($o(`@happyvertical/smrt-profiles:Profile`),n))??es(t.id),...ls(n?.email)?{email:ls(n?.email)}:{}}}async function ds(e,t){return{id:t.id,...ls(t.profileId)?{profileId:ls(t.profileId)}:{},profile:await us(e,t),status:ls(t.status)??``,...ls(t.customerType)?{customerType:ls(t.customerType)}:{},...typeof t.creditLimit==`number`?{creditLimitMinor:t.creditLimit}:{},...ls(t.paymentTerms)?{paymentTerms:ls(t.paymentTerms)}:{}}}async function fs(e,t){return{id:t.id,...ls(t.profileId)?{profileId:ls(t.profileId)}:{},profile:await us(e,t),status:ls(t.status)??``,...typeof t.leadTimeDays==`number`?{leadTimeDays:t.leadTimeDays}:{},...ls(t.currency)?{currency:ls(t.currency)}:{}}}async function ps(e,t){let n=[];for(let r of await e.list($o(Xo))){let i=await ds(e,r);if(os(i.profile.name,t)&&n.push(i),n.length>=Qo)break}return n}async function ms(e,t){let n=await e.get($o(Xo),t);return n?ds(e,n):null}async function hs(e,t){let n=[];for(let r of await e.list($o(Zo))){let i=await fs(e,r);if(os(i.profile.name,t)&&n.push(i),n.length>=Qo)break}return n}async function gs(e,t){let n=await e.get($o(Zo),t);return n?fs(e,n):null}export{ht as A,mr as C,Sn as D,En as E,$e as F,et as I,Ge as L,ut as M,rt as N,bn as O,ot as P,Ze as R,gr as S,er as T,Ma as _,cs as a,Ar as b,ss as c,Lo as d,qo as f,Na as g,wo as h,ms as i,mt as j,Yt as k,hs as l,Fo as m,is as n,gs as o,Ko as p,as as r,ps as s,ts as t,es as u,ua as v,nr as w,Dr as x,ni as y,Re as z};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import"./DG3qFFTE.js";import"./xihTtKlq.js";import"./CXPo72CL.js";import"./DURcYLyk.js";import"./By9nPosf.js";import"./Dapxnz2C.js";import"./Bs5WxZDd.js";function e(){return typeof window<`u`&&typeof window.matchMedia==`function`&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches}export{e as t};
|
|
@@ -1,16 +0,0 @@
|
|
|
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,I as u,K as d,L as f,Lt as p,Ot as m,Pt as h,U as g,W as _,X as v,Y as y,a as b,bt as x,ct as S,d as C,ft as w,gt as T,ht as E,k as D,mt as O,pt as k,q as ee,st as A,v as j,vt as M}from"./DG3qFFTE.js";import"./xihTtKlq.js";import{a as N}from"./Bv5jGtB8.js";import"./YUSKx8_q.js";import{_t as te,bt as P,p as F,u as I,vt as ne}from"./CXPo72CL.js";import"./DK8Blf1Y.js";import"./By9nPosf.js";import"./BQGfk9t2.js";y([`click`]),y([`click`,`keydown`]),y([`click`]);var L=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`})),R=x([]);function z(t){for(let n=e(R).length-1;n>=0;n--){let r=e(R)[n].paths.get(t);if(r!==void 0)return r}return L.get(t)}var B=d(`<svg xmlns="http://www.w3.org/2000/svg" data-smrt-component="Icon" class="svelte-em2a54"><path></path></svg>`);function V(t,i){m(i,!0);let a=b(i,`size`,3,24),o=b(i,`color`,3,`currentColor`),s=b(i,`viewBox`,3,`0 0 24 24`),c=n(()=>!!i[`aria-label`]),l=n(()=>i.path??(i.name?z(i.name):``)),u=n(()=>typeof a()==`number`?`${a()}px`:a());var d=B(),f=O(d);A(()=>{j(d,`width`,e(u)),j(d,`height`,e(u)),j(d,`viewBox`,s()),j(d,`fill`,o()),j(d,`aria-hidden`,!e(c)),j(d,`aria-label`,i[`aria-label`]),j(d,`role`,e(c)?`img`:void 0),j(f,`d`,e(l))}),g(t,d),r()}var re=c(`<p class="empty-description svelte-1x475nf"> </p>`),ie=c(`<a class="action-button svelte-1x475nf"> </a>`),ae=c(`<button type="button" class="action-button svelte-1x475nf"> </button>`),oe=c(`<div data-smrt-component="EmptyState"><div class="icon-container svelte-1x475nf"><!></div> <h3 class="empty-title svelte-1x475nf"> </h3> <!> <!></div>`);function se(e,n){let r=b(n,`icon`,3,`inbox`),a=b(n,`size`,3,`md`),c={document:`<svg width="100%" height="100%" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5">
|
|
2
|
-
<path d="M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V8l-6-6z"/>
|
|
3
|
-
<path d="M14 2v6h6M16 13H8M16 17H8M10 9H8"/>
|
|
4
|
-
</svg>`,folder:`<svg width="100%" height="100%" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5">
|
|
5
|
-
<path d="M22 19a2 2 0 01-2 2H4a2 2 0 01-2-2V5a2 2 0 012-2h5l2 3h9a2 2 0 012 2z"/>
|
|
6
|
-
</svg>`,users:`<svg width="100%" height="100%" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5">
|
|
7
|
-
<path d="M17 21v-2a4 4 0 00-4-4H5a4 4 0 00-4 4v2"/>
|
|
8
|
-
<circle cx="9" cy="7" r="4"/>
|
|
9
|
-
<path d="M23 21v-2a4 4 0 00-3-3.87M16 3.13a4 4 0 010 7.75"/>
|
|
10
|
-
</svg>`,search:`<svg width="100%" height="100%" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5">
|
|
11
|
-
<circle cx="11" cy="11" r="8"/>
|
|
12
|
-
<path d="M21 21l-4.35-4.35"/>
|
|
13
|
-
</svg>`,inbox:`<svg width="100%" height="100%" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5">
|
|
14
|
-
<path d="M22 12h-6l-2 3h-4l-2-3H2"/>
|
|
15
|
-
<path d="M5.45 5.11L2 12v6a2 2 0 002 2h16a2 2 0 002-2v-6l-3.45-6.89A2 2 0 0016.76 4H7.24a2 2 0 00-1.79 1.11z"/>
|
|
16
|
-
</svg>`};var d=oe();let f;var p=w(d),m=w(p),h=e=>{var t=_(),n=k(t);u(n,()=>c[r()]??c.inbox),g(e,t)},y=e=>{var t=_(),n=k(t);o(n,r),g(e,t)};t(m,e=>{typeof r()==`string`?e(h):e(y,-1)}),s(p);var x=E(p,2),S=O(x,!0),C=E(x,2),T=e=>{var t=re(),r=O(t,!0);A(()=>l(r,n.description)),g(e,t)};t(C,e=>{n.description&&e(T)});var ee=E(C,2),M=e=>{var r=_(),i=k(r),a=e=>{var t=ie(),r=O(t,!0);D(t,e=>N?.(e)),A(()=>{j(t,`href`,n.actionHref),l(r,n.actionLabel)}),g(e,t)},o=e=>{var t=ae(),r=O(t,!0);D(t,e=>N?.(e)),A(()=>l(r,n.actionLabel)),v(`click`,t,function(...e){n.onaction?.apply(this,e)}),g(e,t)};t(i,e=>{n.actionHref?e(a):n.onaction&&e(o,1)}),g(e,r)};t(ee,e=>{n.actionLabel&&e(M)}),s(d),A(()=>{f=i(d,1,`empty-state svelte-1x475nf`,null,f,{sm:a()===`sm`,lg:a()===`lg`}),l(S,n.title)}),g(e,d)}y([`click`]);var ce=Symbol.for(`smrt-ui.page-header`);function le(){return a(ce)??null}var ue=c(`<li class="svelte-1f2td7n"><a class="svelte-1f2td7n"> </a></li>`),de=c(`<nav class="page-crumbs svelte-1f2td7n" data-shell-breadcrumbs=""><ol class="svelte-1f2td7n"></ol></nav>`),fe=c(`<a class="back-link svelte-1f2td7n"><!> <span> </span></a>`),pe=c(`<h1 class="page-title page-title-field svelte-1f2td7n" data-page-title-field=""><!></h1>`),me=c(`<h1 class="page-title svelte-1f2td7n" data-shell-page-title=""> </h1>`),he=c(`<p class="page-subtitle svelte-1f2td7n"> </p>`),ge=c(`<div class="page-meta svelte-1f2td7n"><!></div>`),_e=c(`<div class="header-actions svelte-1f2td7n"><!></div>`),ve=c(`<div class="header-extra svelte-1f2td7n" data-page-header-extra=""><!></div>`),ye=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 be(i,a){m(a,!0);let c=b(a,`parents`,19,()=>[]),u=b(a,`crumbsLabel`,3,`Breadcrumb`),d=b(a,`backLabel`,3,`Back`),p=le(),h=n(()=>a.crumbs??(p?p.crumbs(c()):c()));S(()=>p?.report?.({title:a.shortTitle??a.title,parents:c()}));var _=ye(),v=w(_),y=t=>{var n=de(),r=w(n);f(r,23,()=>e(h),(e,t)=>`${t}:${e.href}`,(t,n)=>{var r=ue(),i=w(r),a=O(i,!0);s(r),A(()=>{j(i,`href`,e(n).href),l(a,e(n).label)}),g(t,r)}),s(r),s(n),A(()=>j(n,`aria-label`,u())),g(t,n)};t(v,t=>{e(h).length>0&&t(y)});var x=E(v,2),C=w(x),T=w(C),k=e=>{var t=fe(),n=w(t);V(n,{name:`chevron-left`,size:20});var r=E(n,2),i=O(r,!0);s(t),D(t,e=>N?.(e)),A(()=>{j(t,`href`,a.backHref),l(i,d())}),g(e,t)};t(T,e=>{a.backHref&&e(k)});var ee=E(T,2),M=e=>{var t=pe(),n=w(t);o(n,()=>a.titleField),s(t),g(e,t)},te=e=>{var t=me(),n=O(t,!0);A(()=>l(n,a.title)),g(e,t)};t(ee,e=>{a.titleField?e(M):e(te,-1)});var P=E(ee,2),F=e=>{var t=he(),n=O(t,!0);A(()=>l(n,a.subtitle)),g(e,t)};t(P,e=>{a.subtitle&&e(F)});var I=E(P,2),ne=e=>{var t=ge(),n=w(t);o(n,()=>a.meta),s(t),g(e,t)};t(I,e=>{a.meta&&e(ne)}),s(C);var L=E(C,2),R=e=>{var t=_e(),n=w(t);o(n,()=>a.actions),s(t),g(e,t)};t(L,e=>{a.actions&&e(R)}),s(x);var z=E(x,2),B=e=>{var t=ve(),n=w(t);o(n,()=>a.children),s(t),g(e,t)};t(z,e=>{a.children&&e(B)}),s(_),g(i,_),r()}y([`click`]),y([`click`]);function xe(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 Se=c(`<span class="smrt-tabs__tab-count svelte-19k21oo" data-smrt-part="count"> </span>`),Ce=c(`<span class="smrt-tabs__tab-badge svelte-19k21oo" data-smrt-part="badge"> </span>`),we=c(`<a data-smrt-part="tab"><span data-smrt-part="label"> </span> <!> <!></a>`),Te=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),Ee=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>`),De=c(`<div class="smrt-tabs__tab-panel svelte-19k21oo" data-smrt-part="panel"><!></div>`),Oe=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>`),ke=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>`),Ae=c(`<div class="smrt-tabs__tab-panel svelte-19k21oo" data-smrt-part="panel" role="tabpanel"><!></div>`),je=c(`<div class="smrt-tabs__container svelte-19k21oo" data-smrt-component="Tabs"><div data-smrt-part="list" role="tablist"></div> <!></div>`);function Me(a,c){let u=ee();m(c,!0);let d=(r,a=p)=>{var o=we();let u;var d=w(o),f=O(d,!0),m=E(d,2),h=e=>{var t=Se(),n=O(t,!0);A(()=>l(n,a().count)),g(e,t)};t(m,e=>{a().count!==void 0&&e(h)});var _=E(m,2),y=e=>{var t=Ce(),n=O(t,!0);A(()=>l(n,a().badge)),g(e,t)},b=n(()=>z(a()));t(_,t=>{e(b)&&t(y)}),s(o),A(()=>{u=i(o,1,`smrt-tabs__tab-link svelte-19k21oo`,null,u,{"smrt-tabs__active":a().id===c.active}),j(o,`href`,a().disabled?void 0:a().href),j(o,`aria-current`,a().id===c.active?`page`:void 0),j(o,`aria-disabled`,a().disabled?`true`:void 0),j(o,`data-tab-id`,a().id),l(f,a().label)}),v(`click`,o,e=>{a().disabled?e.preventDefault():re(a().id)}),g(r,o)},y=b(c,`size`,3,`md`),T=b(c,`variant`,3,`primary`),te=b(c,`moreLabel`,3,`More`),P=b(c,`moreBadgeLabel`,3,`has updates`),F=n(()=>c.tabs.length>0&&c.tabs.every(e=>!!e.href)),I=n(()=>e(F)?xe(c.tabs,c.active,c.maxVisible):{visible:c.tabs,overflow:[]}),ne=n(()=>e(I).overflow.some(e=>z(e))),L=x(null),R=x(null);S(()=>{let t=c.active;e(F)&&e(R)&&(e(L)&&(e(L).open=!1),e(R).querySelector(`[data-tab-id="${CSS.escape(t)}"]`)?.scrollIntoView?.({block:`nearest`,inline:`nearest`}))});function z(e){return e.badge!==void 0&&e.badge!==null&&e.badge!==``}let B=n(()=>c.tabs.filter(e=>!e.disabled)),V=x(null);function re(e){c.tabs.find(t=>t.id===e)?.disabled||e!==c.active&&c.onchange?.(e)}function ie(t,n){let r=e(B).findIndex(e=>e.id===n),i=null;switch(t.key){case`ArrowRight`:t.preventDefault(),i=(r+1)%e(B).length;break;case`ArrowLeft`:t.preventDefault(),i=(r-1+e(B).length)%e(B).length;break;case`Home`:t.preventDefault(),i=0;break;case`End`:t.preventDefault(),i=e(B).length-1}if(i!==null&&i!==r){let t=e(B)[i];t&&(c.onchange?.(t.id),requestAnimationFrame(()=>{(e(V)?.querySelector(`[data-tab-id="${CSS.escape(t.id)}"]`))?.focus()}))}}var ae=_(),oe=k(ae),se=n=>{var r=Oe(),a=w(r);let u;var p=w(a);f(p,21,()=>e(I).visible,e=>e.id,(t,n)=>{d(t,()=>e(n))}),s(p),C(p,e=>M(R,e),()=>e(R));var m=E(p,2),h=n=>{var r=Ee(),i=w(r),a=w(i),o=O(a,!0),c=E(a,2),u=e=>{var t=Te(),n=E(k(t),2),r=O(n);A(()=>l(r,`(${P()??``})`)),g(e,t)};t(c,t=>{e(ne)&&t(u)}),s(i);var p=E(i,2);f(p,21,()=>e(I).overflow,e=>e.id,(t,n)=>{d(t,()=>e(n))}),s(p),s(r),C(r,e=>M(L,e),()=>e(L)),A(()=>l(o,te())),g(n,r)};t(m,t=>{e(I).overflow.length>0&&t(h)}),s(a);var _=E(a,2),v=e=>{var t=De(),n=w(t);o(n,()=>c.children),s(t),g(e,t)};t(_,e=>{c.children&&e(v)}),s(r),A(()=>{u=i(a,1,`smrt-tabs__links svelte-19k21oo`,null,u,{"smrt-tabs__sm":y()===`sm`,"smrt-tabs__lg":y()===`lg`}),j(a,`aria-label`,c[`aria-label`])}),g(n,r)},ce=r=>{var a=je(),d=w(a);let p;f(d,21,()=>c.tabs,e=>e.id,(r,a)=>{var o=ke();let d;var f=w(o),p=w(f),m=O(p,!0),_=E(p,2),y=t=>{var n=Se(),r=O(n,!0);A(()=>l(r,e(a).count)),g(t,n)};t(_,t=>{e(a).count!==void 0&&t(y)});var b=E(_,2),x=t=>{var n=Ce(),r=O(n,!0);A(()=>l(r,e(a).badge)),g(t,n)},S=n(()=>z(e(a)));t(b,t=>{e(S)&&t(x)}),s(f),h(2),s(o),D(o,e=>N?.(e)),A(()=>{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,j(o,`id`,`tab-${u}-${e(a).id??``}`),j(o,`aria-selected`,e(a).id===c.active),j(o,`aria-controls`,`tab-panel-${u}`),j(o,`tabindex`,e(a).id===c.active?0:-1),j(o,`data-tab-id`,e(a).id),l(m,e(a).label)}),v(`click`,o,()=>re(e(a).id)),v(`keydown`,o,t=>ie(t,e(a).id)),g(r,o)}),s(d),C(d,e=>M(V,e),()=>e(V));var m=E(d,2),_=e=>{var t=Ae(),n=w(t);o(n,()=>c.children),s(t),A(()=>{j(t,`id`,`tab-panel-${u}`),j(t,`aria-labelledby`,`tab-${u}-${c.active??``}`)}),g(e,t)};t(m,e=>{c.children&&e(_)}),s(a),A(()=>{p=i(d,1,`smrt-tabs__nav svelte-19k21oo`,null,p,{"smrt-tabs__sm":y()===`sm`,"smrt-tabs__lg":y()===`lg`,"smrt-tabs__secondary":T()===`secondary`}),j(d,`aria-label`,c[`aria-label`])}),g(r,a)};t(oe,t=>{e(F)?t(se):t(ce,-1)}),g(a,ae),r()}y([`click`,`keydown`]),y([`click`,`keydown`]);function Ne(){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 Pe=Ne(),Fe=[`SmrtJunction`,`SmrtJunctionBase`,`SmrtPolymorphicAssociation`],Ie=[`Metafield`,`Metadata`,`Association`,`LineItem`,`Allocation`,`Revision`,`Attachment`,`Snapshot`,`Completion`,`Override`,`Alias`],Le=[`Status`,`Type`],Re={"@happyvertical/smrt-commerce:TaxComponent":`lookup`,"@happyvertical/smrt-commerce:TaxSettings":`settings`,"@happyvertical/smrt-commerce:DocumentTax":`snapshot`,"@happyvertical/smrt-commerce:TaxSummaryReport":`report`},H=new Set([`foreignKey`,`crossPackageRef`]);function ze(e){let t=e.id?Re[e.id]:void 0;if(t)return t;let n=e.extends?.split(`:`).pop();if(n&&Fe.includes(n))return`junction`;let r=e.fields.filter(e=>!e.system),i=r.filter(e=>H.has(e.type)).length;return i>=2&&r.length-i<=1?`link`:Ie.some(t=>e.name.endsWith(t))?`child`:r.length<=3&&Le.some(t=>e.name.endsWith(t))?`lookup`:null}function Be(e){return ze(e)!==null}var Ve=new Set([`junction`,`link`,`child`]);function U(e,t){return e.includes(`:`)?e:`${t.slice(0,t.lastIndexOf(`:`))}:${e}`}function W(e,t){let n=[],r=e.get(t);for(;r&&!n.includes(r.id);)n.push(r.id),r=r.extends?e.get(U(r.extends,r.id)):void 0;return n}function He(e,t){let n=e.packages.flatMap(e=>e.models),r=new Map(n.map(e=>[e.id,e])),i=new Set(W(r,t));return i.size?n.filter(e=>{if(i.has(e.id))return!1;let t=ze(e);return!t||!Ve.has(t)?!1:e.fields.some(t=>H.has(t.type)&&t.related&&i.has(U(t.related,e.id)))}):[]}function Ue(e,t){let n=e.fields.find(n=>H.has(n.type)&&n.related&&t.has(U(n.related,e.id)));return n?{model:e,fk:n.name}:void 0}function We(e,t,n){let r=e.packages.flatMap(e=>e.models),i=new Map(r.map(e=>[e.id,e])),a=new Set(W(i,n));if(!a.size)return[];let o=t.filter(e=>e.models.includes(n));if(!o.length)return He(e,n).flatMap(e=>{let t=Ue(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=Ue(e,a);r&&s.set(n,r)}}return[...s.values()]}function Ge(e,t){let n=e.packages.flatMap(e=>e.models),r=new Map(n.map(e=>[e.id,e])),i=new Set(W(r,t));if(!i.size)return[];let a=[];for(let e of n)if(!i.has(e.id))for(let t of e.fields)H.has(t.type)&&t.related&&i.has(U(t.related,e.id))&&a.push({model:e,fk:t.name});return a}function Ke(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(!H.has(e.type)||!e.related)return[];let t=r.get(U(e.related,i.id));return t?[{model:t,fk:e.name}]:[]}):[]}function qe(e,t){return e.some(e=>e.nav.some(e=>e.model===t))}function Je(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 Ye(e,t){let n=e.packages.flatMap(e=>e.models),r=new Map(n.map(e=>[e.id,e]));return W(r,t).flatMap(e=>{let t=r.get(e);return t?[t.name]:[]})}function Xe(e,t,n){let r=Ye(e,t);return He(e,t).filter(e=>n(e)&&r.some(t=>e.name.startsWith(t)))}function G(e){return e.group?.id??e.id}function Ze(e){let t=new Map;for(let n of e){let e=G(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 K(e){return e.section??{id:G(e),label:e.group?.label??e.label}}function Qe(e){let t=new Map;for(let n of e){let e=K(n),r=t.get(e.id);r?r.recipes.push(n):t.set(e.id,{...e,recipes:[n]})}return[...t.values()]}function $e(e){let t=new Set(e.map(e=>K(e).id)),n={};for(let r of e){let e=G(r),i=K(r).id;e!==i&&!t.has(e)&&(n[e]=i)}return n}function et(e,t,n){return`item:${e}:${t}${n?`:${n}`:``}`}function tt(e,t){return e?.trim()||t.description?.trim()||`Your ${nt(t.name)} records, all in one place.`}function nt(e){return e.replace(/([a-z0-9])([A-Z])/g,`$1 $2`).toLowerCase()}var rt={id:`more`,label:`More`,icon:`layers`,description:`Extra records you added one at a time.`},it=`fileText`;function at(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 ot(e,t){let n=new Set(t.flatMap(e=>e.models));return e.packages.flatMap(t=>ne(t).filter(e=>!n.has(e.id)).map(n=>({id:n.id,name:n.name,label:F(n.name),packageId:t.id,description:at(n),described:!!n.description?.trim(),plumbing:Be(n),fieldNames:n.fields.map(e=>e.name),includes:He(e,n.id).map(e=>F(e.name))})))}function st(e){return e.described?e.description:`${F(e.packageId)} · ${e.description}`}function ct(e,t){return t?[...e]:e.filter(e=>!e.plumbing)}function lt(e){return[...new Set(e.map(e=>e.packageId))]}function ut(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 dt(e){return e.flatMap(e=>{let t=P(e);return t?.model.exposed?[{id:et(t.pkg.id,t.model.name),packageId:t.pkg.id,modelName:t.model.name,label:F(t.model.name),icon:it,description:tt(void 0,t.model)}]:[]})}var ft={"@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 pt(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 mt={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 ht(e){return e.fields.filter(e=>!e.system)}var gt=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1_$2`).toLowerCase();function _t(e,t){return/Type$/.test(t.name)&&Array.isArray(t.enum)&&t.enum.length>0&&!!e.extends&&t.enum.includes(gt(e.name))}function vt(e){return e.some(e=>e.ui?.basic===!0)}function yt(e){return e!=null&&e!==``}function bt(e){if(e==null)return null;try{return{value:JSON.parse(e)}}catch{return null}}function q(e,t,n=[]){let r=ht(e),i=vt(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=_t(e,n),c=o.visibility??(s?`hidden`:!i||n.ui?.basic===!0?`basic`:`advanced`),l=o.label??I(n),u=o.help??null,d=o.order??n.ui?.order??r,f=o.locked??n.ui?.locked??s,p=gt(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=bt(_.defaultValue);e&&(h=!0,g=e.value),typeof _.locked==`boolean`&&(f=_.locked)}let v,y=o.required??n.required;return y&&c!==`basic`&&!(h&&yt(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 xt(e){return typeof e==`string`||typeof e==`number`||typeof e==`boolean`||e===null?e:void 0}function St(e){return e.filter(e=>e.visibility===`basic`).map(e=>{let{default:t,...n}=e.field,r=e.hasDefault?xt(e.default):void 0;return{...n,required:e.required,...r===void 0?{}:{default:r},label:e.label,...e.help?{help:e.help}:{}}})}function Ct(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 wt=[`api`,`mcp`,`cli`],Tt={api:`REST`,mcp:`MCP`,cli:`CLI`};function Et(e,t){return(t===`api`?e.rest.length:t===`mcp`?e.mcp.length:e.cli.length)>0}function J(e,t,n=[]){let r={};for(let i of wt){let a=Et(e,i),o=t?.exposure?.[i]===!1;r[i]={available:a,on:a&&!o&&!n.includes(i),locked:!a||o}}return r}function Dt(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 Ot(e,t,n=[]){return q(e,t,n).filter(e=>t?.fields?.[e.field.name]?.visibility!==`hidden`)}function kt(e){return e.required||e.locked}function At(e,t,n,r){let i={};for(let r of Ot(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=J(e,t,r);return{fields:i,exposure:{api:a.api.on,mcp:a.mcp.on,cli:a.cli.on}}}var jt=(e,t)=>JSON.stringify(e??null)===JSON.stringify(t??null);function Mt(e,t,n){let r=Ot(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=kt(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),jt(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 Nt(e,t,n){let r=J(e,t);return wt.filter(e=>r[e].on&&!n.exposure[e])}var Pt=ft,Y=pt(te.packages.flatMap(e=>e.recipes??[]),mt),Ft=new Map(Y.map(e=>[e.id,e]));function It(e){return Ft.get(e)}var X=Ft,Lt=Ze(Y);function Rt(e){return Lt.find(t=>t.id===e)}function zt(e){let t=e.models[0];return t?P(t)?.pkg:void 0}function Bt(e){return e.nav.flatMap(e=>{let t=P(e.model);return t?[{label:e.label,icon:e.icon??`fileText`,description:tt(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 Vt(e,t,n){return Y.some(r=>Bt(r).some(r=>r.key===n&&r.packageId===e&&r.model.name===t))}function Ht(e){return`/m/${e.packageId}/${e.model.name}/${e.key?`${e.key}/`:``}`}function Ut(e){return e.models.flatMap(e=>{let t=P(e);return t?[{model:t.model,packageId:t.pkg.id}]:[]})}function Wt(e,t=[]){let n=e.nav.length>0;return Ut(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]]:[])),...Pt[r.id]},fields:q(r,e.options?.[r.id],t).map(e=>({name:e.field.name,label:e.label,help:e.help,visibility:e.visibility}))}))}function Gt(e){return[...new Set(e)].sort()}function Z(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 Gt(n)}function Kt(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 qt(e,t,n){return Kt([e],t,n)}function Jt(e,t){return Gt([...e].filter(e=>t.has(e)))}var Yt={currency:`USD`,taxRate:0,paymentTerms:``,pricesIncludeTax:!1,taxRounding:`line`},Q=`@happyvertical/smrt-commerce:`,$={currency:[`Order`,`PurchaseOrder`,`WholesaleOrder`,`Estimate`,`Invoice`,`Agreement`,`Lease`].map(e=>({model:`${Q}${e}`,field:`currency`})),taxRate:[`InvoiceLineItem`,`ContractLineItem`].map(e=>({model:`${Q}${e}`,field:`taxRate`})),paymentTerms:[...[`Order`,`WholesaleOrder`,`Estimate`,`Invoice`,`Agreement`,`Lease`].map(e=>({model:`${Q}${e}`,field:`terms`})),{model:`${Q}Customer`,field:`paymentTerms`}],pricesIncludeTax:[`Invoice`,`Contract`].map(e=>({model:`${Q}${e}`,field:`lineAmountType`})),taxRounding:[`Invoice`,`Contract`].map(e=>({model:`${Q}${e}`,field:`taxRoundingScope`}))};function Xt(e){return Object.values($).some(t=>t.some(t=>t.model===e.objectRef&&t.field===e.fieldName))}var Zt=Object.keys($);function Qt(e){if(e?.defaultValue!==void 0&&e.defaultValue!==null)try{return JSON.parse(e.defaultValue)}catch{return}}function $t(e,t,n){return e.find(e=>e.scopeType===`app`&&e.objectRef===t&&e.fieldName===n)}function en(e){let t={...Yt},n=(t,n)=>{for(let{model:r,field:i}of $[t]){let t=Qt($t(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 tn(e){return $.taxRate.some(({model:t,field:n})=>typeof Qt($t(e.policies,t,n))==`number`)}function nn(e,t,n){let r=P(t)?.model;if(!r)return;let i=q(r,e.recipes.map(e=>X.get(e)?.options?.[t]).find(Boolean),[]).find(e=>e.field.name===n);return i?.hasDefault?i.default:void 0}var rn=e=>e==null||e===``;function an(e,t){let n=e.policies.map(e=>({...e}));for(let r of Zt){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 $[r]){let o=nn(e,t,i),s=!rn(a)&&!(!rn(o)&&o===a)&&!(rn(o)&&r===`taxRate`&&a===0),c=$t(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 on(e){return{...Yt,...e}}var sn=()=>({ids:[],rows:[],narrowed:{},features:[],unavailableRecipes:[],unavailableFeatures:[]});function cn(e){let t=new Set([...e.ids.flatMap(e=>X.get(e)?.models??[]),...e.features]);return{...e,rows:e.rows.filter(e=>t.has(e.objectRef)||Xt(e)),narrowed:Object.fromEntries(Object.entries(e.narrowed).filter(([e])=>t.has(e)))}}var ln=(e,t)=>({...e,ids:Z([...e.ids,...t],X)});function un(e,t){let n=new Set(t),r=e.ids.filter(e=>!n.has(e));return cn({...e,ids:Z(r,X)})}var dn=(e,t)=>e.features.includes(t)?e:{...e,features:[...e.features,t].sort()},fn=(e,t)=>cn({...e,features:e.features.filter(e=>e!==t)}),pn=(e,t)=>qt(t,e.ids,X);function mn(e,t){for(let n of e.ids){let e=X.get(n)?.options?.[t];if(e)return e}}function hn(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 gn(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 _n(e){let t=[...new Set(e.features)],n=e=>!!P(e)?.model.exposed;return cn({ids:Z(e.recipes,X),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=>!X.has(e)))].sort(),unavailableFeatures:t.filter(e=>!n(e)).sort()})}var vn=new class{#e=x(T([]));get ids(){return e(this.#e)}set ids(e){M(this.#e,e,!0)}#t=x(T([]));get rows(){return e(this.#t)}set rows(e){M(this.#t,e,!0)}#n=x(T({}));get narrowed(){return e(this.#n)}set narrowed(e){M(this.#n,e,!0)}#r=x(T([]));get features(){return e(this.#r)}set features(e){M(this.#r,e,!0)}#i=x(T([]));get unavailableRecipes(){return e(this.#i)}set unavailableRecipes(e){M(this.#i,e,!0)}#a=x(T([]));get unavailableFeatures(){return e(this.#a)}set unavailableFeatures(e){M(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(dn(this.data,e))}removeFeature(e){this.set(fn(this.data,e))}has(e){return this.ids.includes(e)}requiredBy(e){return pn(this.data,e)}add(...e){this.set(ln(this.data,e))}remove(...e){this.set(un(this.data,e))}toggle(e){this.has(e)?this.remove(e):this.add(e)}clear(){this.set(sn())}hintsFor(e){return mn(this,e)}apply(e){let t=this.hintsFor(e.id),n=q(e,t,this.rows);return{model:Dt(e,J(e,t,this.narrowed[e.id]??[])),resolved:n,fields:St(n),background:Ct(n)}}save(e,t,n){this.set(hn(this.data,e,t,n))}reset(e){this.save(e,[],[])}snapshot(){return gn(this.data)}load(e){this.set(_n(e))}};export{be as $,Mt as A,et as B,wt as C,kt as D,Ot as E,st as F,Ke as G,G as H,ut as I,Xe as J,qe as K,ct as L,ot as M,dt as N,Nt as O,lt as P,Me as Q,Qe as R,Lt as S,At as T,We as U,K as V,Je as W,Ge as X,Ye as Y,Pe as Z,Ut as _,Xt as a,Y as b,an as c,Z as d,se as et,It as f,Ht as g,Wt as h,tn as i,rt as j,J as k,Jt as l,Vt as m,gn as n,en as o,Rt as p,Be as q,$ as r,on as s,vn as t,V as tt,Kt as u,Bt as v,Tt as w,X as x,zt as y,$e as z};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{$ as e,B as t,Ct as n,Dt as r,Ft as i,G as a,H as o,L as s,O as c,Ot as l,P as u,Pt as d,U as f,W as p,X as m,Y as h,Z as g,_,a as v,b as y,bt as b,ct as x,ft as S,gt as C,ht as w,mt as T,pt as E,st as D,tt as O,v as k,vt as A,wt as j,xt as M,z as N}from"./DG3qFFTE.js";import"./xihTtKlq.js";import{O as P,bt as F,c as I,h as L,l as R,m as z,p as B,wt as V}from"./CXPo72CL.js";import{i as H,o as U,x as ee,y as W}from"./Bs5WxZDd.js";import{a as te,c as ne,i as re,l as ie,o as ae,p as G,s as oe}from"./CEGflXJ6.js";import{b as K,t as q}from"./DBoTKMLo.js";import{r as J}from"./D_U_DYjx.js";import{a as Y,c as se,d as ce,f as le,i as ue,n as de,o as fe,p as pe,r as X,s as me,u as he}from"./6ott4F8t.js";import{a as ge,c as _e,i as ve,l as ye,n as be,o as xe,r as Se,s as Ce,t as we,u as Te}from"./BlPoOib9.js";function Ee(e){return e.form.kind===`field-map`}function De(e){return e.form.kind===`variant-grid`}function Oe(e,t,n){let r=t.filter(t=>e.includes(t.id));return r.flatMap(e=>(e.forms??[]).filter(e=>e.model===n).map(t=>({recipeId:e.id,form:t,extensions:r.flatMap(e=>(e.extends??[]).filter(e=>e.form===t.id))})))}function ke(e,t){return e.extensions.some(e=>(e.records??[]).some(e=>e.model===t))}function Z(e){return(e.type===`foreignKey`||e.type===`crossPackageRef`)&&typeof e.related==`string`}function Ae(e,t){if(e.type===`boolean`)return`boolean`;if(Z(e))return`relation`;if(e.enum&&e.enum.length>0)return`enum`;if(e.ui?.widget)return e.ui.widget;if(e.type===`json`&&t!==void 0&&(V[t]??[]).includes(e.name))return`address`;if(P(e))return`money`;if(z(e))return`percent`;switch(e.type){case`datetime`:return`datetime`;case`integer`:return`integer`;case`decimal`:return`decimal`;case`json`:return`json`;default:return`text`}}var je=e=>typeof e==`number`&&Number.isFinite(e)?e:0;function Me(e){let t=e.name;if(e.type===`json`)return 99;if(/^(name|title|label|code)$|Number$|^number$/.test(t))return 0;if(t===`reference`&&e.type===`text`)return .5;if(t===`description`&&e.type===`text`)return 5.9;if(Z(e))return/^(customer|vendor|profile)/i.test(t)?1:/^(contract|.*(journal|account))/i.test(t)?7:2;if((e.enum?.length??0)>0&&/(status|state|stage)$/i.test(t))return 3;if(/^(totalAmount|amount|total)$/.test(t))return 4;if(e.type===`datetime`){if(/^start(date|at)?$/i.test(t))return 1.2;if(/^due/i.test(t))return 5;if(/(issue|paid|allocated|^date$)/i.test(t))return 5.2}return 6}function Ne(e,t=6){let n=e.filter(e=>e.type!==`json`),r=new Set(n.slice(0,3)),i=n.filter(e=>r.has(e)||Me(e)<6||[`integer`,`decimal`,`boolean`,`datetime`].includes(e.type)||(e.enum?.length??0)>0||Z(e)).map((e,t)=>({f:e,i:t,rank:Me(e)})).sort((e,t)=>e.rank-t.rank||e.i-t.i).map(e=>e.f),a=n.find(e=>e.name===`totalAmount`);if(a&&n.some(e=>e.name===`amountPaid`)){let e={...a,name:`amountDue`,label:`Amount due`,required:!1,derive:e=>je(e.totalAmount)-je(e.amountPaid)},t=i.findIndex(e=>e.name===`totalAmount`);i.splice(t<0?i.length:t+1,0,e)}let o=n.some(e=>e.name===`allDay`);return i.slice(0,t).map(e=>o&&e.type===`datetime`&&/^(start|end)(date|at)$/i.test(e.name)?{...e,showTime:!0}:e)}function Pe(e,t){return e.derive?e.derive(t):t[e.name]}function Fe(e,t,n){return e.filter(e=>e[t]===n)}function Ie(e){if(e.default!==void 0&&e.default!==null)return e.default;let t=e.enum??[];return t.length>0&&(e.required||/(status|state|stage)$/i.test(e.name))?t.includes(`draft`)?`draft`:t[0]:e.type===`boolean`?!1:e.type===`text`?``:null}function Le(e){let t={};for(let n of e)t[n.name]=Ie(n);return t}function Re(e,t,n){return{...Le(e),[t]:n}}var ze=e=>e==null||typeof e==`string`&&e.trim()===``;function Be(e,t,n=new Set){let r={};for(let i of e)i.required&&i.type!==`boolean`&&!n.has(i.name)&&ze(t[i.name])&&(r[i.name]=`${i.label} is required.`);return r}function Ve(e,t){let n=e.filter(e=>t[e.name]).map(e=>e.label);return n.length===0?``:`Cannot save yet: ${n.join(`, `)} ${n.length===1?`is`:`are`} required.`}function He(e,t,n,r){return G(e,n,(e,t)=>e.related?r.get(L(e.related,t)):void 0,t)??``}function Ue(e){e instanceof HTMLElement&&e.querySelector(`[data-invalid] :is(input, select, textarea, button):not([type="hidden"])`)?.focus()}function Q(e){return{records:[...e.form.records,...e.extensions.flatMap(e=>e.records??[])],fields:[...e.form.fields,...e.extensions.flatMap(e=>e.fields??[])]}}function We(e,t){let{records:n,fields:r}=Q(e);return r.map(e=>({field:e,catalogField:ce(e,n,t),modelId:le(e,n)}))}function Ge(e,t){return Object.fromEntries(We(e,t).map(({field:e,catalogField:t})=>[e.id,he(e,t)]))}function Ke(e){let{records:t}=Q(e),n=t.findIndex(t=>t.model===e.form.model);return n<0?0:n}async function qe(e,t,n,r){let{records:i}=Q(t),a=i[Ke(t)];if(!a)return{};let o=await e.get(n(a.model),r);return Y(e,i,{[a.as]:o},n)}async function Je(e,t,n,r){let{fields:i}=Q(t),a=await qe(e,t,n,r),o=Ge(t,n);return{values:Object.fromEntries(i.map(e=>{let{alias:t,field:n}=me(e.to),r=a[t]?.[n];return[e.id,r===void 0?o[e.id]:r]})),rows:a}}function Ye(e,t,n,r,i={},a={}){let{records:o,fields:s}=Q(e),c=ue(s,n),l=Ke(e),u=new Set;return o.map((e,o)=>{let d=fe(s,e.as,n),f={...pe(e.values,c),...o===l?Object.fromEntries(Object.entries(a).map(([e,t])=>[e,se(t)])):{}},p=t(e.model),m=r===void 0?void 0:i[e.as];try{if(o===l&&r!==void 0){let t=Object.fromEntries(Object.entries(f).filter(([,e])=>de(e)));return{op:`save`,as:e.as,model:p,id:r,values:{...d,...t}}}if(m)return{op:`save`,as:e.as,model:p,id:m.id,values:d};let t=e.match?pe(e.match,c):{},n=Object.values(t).some(e=>de(e)&&!u.has(e.ref))?{}:t,i=Object.keys(n).length>0;return{op:`save`,as:e.as,model:p,...i?{match:n}:{},onCreate:f,values:d}}finally{u.add(e.as)}})}var $=e=>typeof e==`string`&&e!==``?e:void 0;function Xe(e){let t=typeof e==`object`&&e&&!Array.isArray(e)?e:{},n=$(t.country),r=$(t.state);return{...$(t.street1)?{street:t.street1}:{},...$(t.city)?{city:t.city}:{},...r?{province:n===`US`?`US-${r}`:r}:{},...$(t.postalCode)?{postalCode:t.postalCode}:{},...n?{country:n}:{}}}function Ze(e,t){let n=typeof t==`object`&&t&&!Array.isArray(t)?{...t}:{};for(let e of[`street1`,`city`,`state`,`postalCode`,`country`])delete n[e];let r=$(e.province);return{...n,...$(e.street)?{street1:e.street}:{},...$(e.city)?{city:e.city}:{},...r?{state:r.replace(/^US-/,``)}:{},...$(e.postalCode)?{postalCode:e.postalCode}:{},...$(e.country)?{country:e.country}:{}}}function Qe(e){return document.body.appendChild(e),e.showModal(),()=>{e.close(),e.remove()}}function $e(e){let t=[e.status,e.customerType].filter(Boolean).join(` · `);return{id:e.id,label:e.profile.name,...t?{detail:t}:{}}}function et(e){return{id:e.id,label:e.profile.name,...e.status?{detail:e.status}:{}}}function tt(e,t){l(t,!0);let n=v(t,`value`,15,``),i=v(t,`label`,3,`Customer`),a=v(t,`required`,3,!1),o=v(t,`disabled`,3,!1),s=v(t,`createLabel`,3,`New customer`);U(e,{get name(){return t.name},get label(){return i()},get required(){return a()},get disabled(){return o()},get error(){return t.error},get onCreate(){return t.onCreate},get createLabel(){return s()},get onchange(){return t.onchange},search:async e=>(await t.search(e)).map($e),resolve:async e=>{let n=await t.resolve(e);return n?{id:n.id,label:n.profile.name}:null},get value(){return n()},set value(e){n(e)}}),r()}function nt(e,t){l(t,!0);let n=v(t,`value`,15,``),i=v(t,`label`,3,`Vendor`),a=v(t,`required`,3,!1),o=v(t,`disabled`,3,!1),s=v(t,`createLabel`,3,`New vendor`);U(e,{get name(){return t.name},get label(){return i()},get required(){return a()},get disabled(){return o()},get error(){return t.error},get onCreate(){return t.onCreate},get createLabel(){return s()},get onchange(){return t.onchange},search:async e=>(await t.search(e)).map(et),resolve:async e=>{let n=await t.resolve(e);return n?{id:n.id,label:n.profile.name}:null},get value(){return n()},set value(e){n(e)}}),r()}var rt=[{name:`CustomerSelect`,selects:`@happyvertical/smrt-commerce:Customer`,kind:`customer`,component:tt},{name:`VendorSelect`,selects:`@happyvertical/smrt-commerce:Vendor`,kind:`vendor`,component:nt}];function it(e,t=rt){return t.find(t=>t.selects===e)}var at=a(`<label class="plain svelte-1t0u16g"> <input type="text"/></label>`),ot=a(`<dialog class="create svelte-1t0u16g"><!></dialog>`),st=a(`<!> <!>`,1);function ct(a,s){l(s,!0);let d=v(s,`creatable`,3,!0),h=J(),T=n(()=>s.field.related??``),O=n(()=>F(e(T))?.model),j=n(()=>it(e(T))),P=n(()=>d()?Oe(q.ids,K,e(T)).find(Ee):void 0),I=n(()=>e(O)?.name.toLowerCase()??`record`),L=b(C(typeof s.value==`string`?s.value:``));x(()=>{let t=typeof s.value==`string`?s.value:``;t!==e(L)&&A(L,t,!0)});let R=b(!1),z=b(0);function B(){M(z),A(R,!0)}function V(e){A(R,!1),A(L,e.id,!0),s.onchange(e.id)}function H(e){A(L,e,!0),s.onchange(e===``?null:e)}var ee=st(),W=E(ee),G=t=>{var n=at(),r=S(n),a=w(r);_(a),i(n),D(()=>{o(r,`${s.label??``} `),k(a,`name`,s.name),a.required=s.required,y(a,e(L))}),m(`input`,a,e=>H(e.currentTarget.value)),f(t,n)},Y=t=>{let r=n(()=>e(j).component);var i=p(),a=E(i);{let t=n(()=>e(P)?B:void 0),i=n(()=>`New ${e(I)}`);u(a,()=>e(r),(n,r)=>{r(n,{get name(){return s.name},get label(){return s.label},get required(){return s.required},search:e=>oe(h,e),resolve:e=>re(h,e),get onCreate(){return e(t)},get createLabel(){return e(i)},onchange:H,get value(){return e(L)},set value(e){A(L,e,!0)}})})}f(t,i)},se=t=>{let r=n(()=>e(j).component);var i=p(),a=E(i);{let t=n(()=>e(P)?B:void 0),i=n(()=>`New ${e(I)}`);u(a,()=>e(r),(n,r)=>{r(n,{get name(){return s.name},get label(){return s.label},get required(){return s.required},search:e=>ie(h,e),resolve:e=>ae(h,e),get onCreate(){return e(t)},get createLabel(){return e(i)},onchange:H,get value(){return e(L)},set value(e){A(L,e,!0)}})})}f(t,i)},ce=t=>{{let r=n(()=>e(P)?B:void 0),i=n(()=>`New ${e(I)}`);U(t,{get name(){return s.name},get label(){return s.label},get required(){return s.required},search:t=>ne(h,e(O),t),resolve:t=>te(h,e(O),t),get onCreate(){return e(r)},get createLabel(){return e(i)},onchange:H,get value(){return e(L)},set value(e){A(L,e,!0)}})}};t(W,t=>{e(O)?e(j)?.kind===`customer`?t(Y,1):e(j)?.kind===`vendor`?t(se,2):t(ce,-1):t(G)});var le=w(W,2),ue=t=>{var n=ot(),r=S(n);N(r,()=>e(z),t=>{wt(t,{get active(){return e(P)},onsaved:V,oncancel:()=>A(R,!1)})}),i(n),c(n,()=>Qe),D(()=>k(n,`aria-label`,`New ${e(I)}`)),g(`close`,n,()=>A(R,!1)),f(t,n)};t(le,t=>{e(P)&&e(R)&&t(ue)}),f(a,ee),r()}h([`input`]);var lt=a(`<div class="percent svelte-n1ol00"><!> <span class="percent-sign svelte-n1ol00" aria-hidden="true">%</span></div>`),ut=a(`<input type="url" class="svelte-n1ol00"/>`),dt=a(`<input type="number" step="1" class="svelte-n1ol00"/>`),ft=a(`<input type="number" step="any" class="svelte-n1ol00"/>`),pt=a(`<textarea rows="3" class="svelte-n1ol00"></textarea>`),mt=a(`<input type="text" class="svelte-n1ol00"/>`),ht=a(`<!> <!>`,1),gt=a(`<p class="field-error svelte-n1ol00" role="alert"> </p>`),_t=a(`<small class="svelte-n1ol00"> </small>`),vt=a(`<div class="field svelte-n1ol00"><!> <!> <!></div>`);function yt(a,s){l(s,!0);let c=v(s,`idPrefix`,3,`field`),u=v(s,`hideRequired`,3,!1),p=v(s,`creatable`,3,!0),h=n(()=>Ae(s.field,s.modelId)),b=n(()=>s.label??B(s.field.name)),x=n(()=>`${c()}-${s.field.name}`),C=n(()=>s.field.required&&!u()),O=n(()=>s.value===null||s.value===void 0?``:typeof s.value==`object`?JSON.stringify(s.value):String(s.value)),A=n(()=>[...e(C)||(s.field.enum??[]).includes(``)?[]:[{value:``,label:`(none)`}],...(s.field.enum??[]).map(e=>({value:e,label:e===``?`(none)`:R(e)}))]);function M(e){if(e.trim()===``)return null;let t=Number(e);return Number.isFinite(t)?t:null}function N(e){try{return JSON.parse(e)}catch{return e}}let P=e=>e.slice(0,10);var F=vt(),I=S(F),L=t=>{{let r=n(()=>s.value===!0);H(t,{get checked(){return e(r)},onchange:e=>s.onchange(e.currentTarget.checked),get label(){return e(b)}})}},z=t=>{ct(t,{get field(){return s.field},get value(){return s.value},get onchange(){return s.onchange},get label(){return e(b)},get name(){return e(x)},get required(){return e(C)},get creatable(){return p()}})},V=t=>{ge(t,{get name(){return e(x)},get label(){return e(b)},get required(){return e(C)},get options(){return e(A)},get value(){return e(O)},onchange:e=>s.onchange(e)})},U=t=>{ve(t,{get name(){return e(x)},get label(){return e(b)},get required(){return e(C)},rows:4,get value(){return e(O)},onchange:e=>s.onchange(e)})},te=t=>{Se(t,{get name(){return e(x)},get label(){return e(b)},get required(){return e(C)},type:`email`,get value(){return e(O)},onchange:e=>s.onchange(e)})},ne=t=>{xe(t,{get name(){return e(x)},get label(){return e(b)},get required(){return e(C)},get value(){return e(O)},onchange:e=>s.onchange(e)})},re=t=>{{let r=n(()=>typeof s.value==`number`?s.value:null);_e(t,{get name(){return e(x)},get label(){return e(b)},get required(){return e(C)},currency:`USD`,min:0,get value(){return e(r)},onchange:e=>s.onchange(e)})}},ie=t=>{var r=lt(),a=S(r);{let t=n(()=>we(s.value));Ce(a,{get name(){return e(x)},get label(){return e(b)},get required(){return e(C)},min:0,step:.01,get value(){return e(t)},onchange:e=>s.onchange(be(e))})}d(2),i(r),f(t,r)},ae=t=>{{let r=n(()=>P(e(O)));ye(t,{get name(){return e(x)},get label(){return e(b)},get required(){return e(C)},includeTime:!1,get value(){return e(r)},onchange:e=>s.onchange(e?new Date(`${e}T00:00:00Z`).toISOString():``)})}},G=t=>{{let r=n(()=>Xe(s.value));Te(t,{get name(){return e(x)},get label(){return e(b)},get required(){return e(C)},get value(){return e(r)},onchange:e=>s.onchange(Ze(e,s.value))})}},oe=n=>{var r=ht(),i=E(r);ee(i,{get for(){return e(x)},get label(){return e(b)},get required(){return e(C)}});var a=w(i,2),o=t=>{W(t,{get id(){return e(x)},get required(){return e(C)},get value(){return e(O)},onchange:e=>s.onchange(e.currentTarget.value)})},c=t=>{var n=ut();_(n),D(()=>{k(n,`id`,e(x)),n.required=e(C),y(n,e(O))}),m(`input`,n,e=>s.onchange(e.currentTarget.value)),f(t,n)},l=t=>{var n=dt();_(n),D(()=>{k(n,`id`,e(x)),n.required=e(C),y(n,e(O))}),g(`focus`,n,e=>e.currentTarget.select()),m(`input`,n,e=>{let t=M(e.currentTarget.value);s.onchange(t===null?null:Math.trunc(t))}),f(t,n)},u=t=>{var n=ft();_(n),D(()=>{k(n,`id`,e(x)),n.required=e(C),y(n,e(O))}),g(`focus`,n,e=>e.currentTarget.select()),m(`input`,n,e=>s.onchange(M(e.currentTarget.value))),f(t,n)},d=t=>{var n=pt();j(n),D(()=>{k(n,`id`,e(x)),y(n,e(O))}),m(`input`,n,e=>s.onchange(N(e.currentTarget.value))),f(t,n)},p=t=>{var n=mt();_(n),D(()=>{k(n,`id`,e(x)),n.required=e(C),y(n,e(O))}),m(`input`,n,e=>s.onchange(e.currentTarget.value)),f(t,n)};t(a,t=>{e(h)===`currency`?t(o):e(h)===`url`?t(c,1):e(h)===`integer`?t(l,2):e(h)===`decimal`?t(u,3):e(h)===`json`?t(d,4):t(p,-1)}),f(n,r)};t(I,t=>{e(h)===`boolean`?t(L):e(h)===`relation`?t(z,1):e(h)===`enum`?t(V,2):e(h)===`textarea`?t(U,3):e(h)===`email`?t(te,4):e(h)===`phone`?t(ne,5):e(h)===`money`?t(re,6):e(h)===`percent`?t(ie,7):e(h)===`datetime`?t(ae,8):e(h)===`address`?t(G,9):t(oe,-1)});var K=w(I,2),q=t=>{var n=gt(),r=T(n,!0);D(()=>{k(n,`id`,`${e(x)}-error`),o(r,s.error)}),f(t,n)};t(K,e=>{s.error&&e(q)});var J=w(K,2),Y=e=>{var t=_t(),n=T(t,!0);D(()=>o(n,s.help)),f(e,t)};t(J,e=>{s.help&&e(Y)}),i(F),D(()=>{k(F,`data-renderer`,e(h)),k(F,`data-invalid`,s.error?``:void 0)}),f(a,F),r()}h([`input`]);var bt=a(`<p>Loading...</p>`),xt=a(`<p class="error svelte-1rp3j7g" role="alert" data-error-summary=""> </p>`),St=a(`<p class="error svelte-1rp3j7g" role="alert"> </p>`),Ct=a(`<form class="planner-form" novalidate=""><h3 class="svelte-1rp3j7g"> </h3> <!> <!> <!> <div class="actions svelte-1rp3j7g"><button type="submit" class="svelte-1rp3j7g">Save</button> <button type="button" class="secondary svelte-1rp3j7g">Cancel</button></div></form>`);function wt(a,c){l(c,!0);let u=J(),d=n(()=>We(c.active,X).filter(({catalogField:e,modelId:t})=>!q.rows.some(n=>n.objectRef===t&&n.fieldName===e.name&&n.visibility===`hidden`))),h=b(C(Ge(c.active,X))),_=b(c.id===void 0),v=b(``),y=b(C({})),x=n(()=>e(d).map(({field:e,catalogField:t})=>({...t,name:e.id,label:e.label,required:e.required??t.required}))),k=n(()=>Ve(e(x),e(y))),j={};async function M(e){let t=await Je(u,c.active,X,e);A(h,t.values,!0),j=t.rows,A(_,!0)}c.id!==void 0&&M(c.id);async function N(t){t.preventDefault();let n=t.currentTarget;if(A(v,``),A(y,Be(e(x),e(h)),!0),Object.keys(e(y)).length>0)await O(),Ue(n);else try{let t=await u.apply(Ye(c.active,X,e(h),c.id,j,c.preset)),n=Q(c.active).records[Ke(c.active)],r=n?t[n.as]:void 0;if(!r)throw Error(`Nothing was saved.`);c.onsaved(r)}catch(e){A(v,e instanceof Error?e.message:`Could not save.`,!0)}}var P=p(),F=E(P),L=e=>{var t=bt();f(e,t)},R=r=>{var a=Ct(),l=S(a),u=T(l),p=w(l,2);s(p,17,()=>e(d),({field:e,catalogField:t,modelId:n})=>e.id,(t,r)=>{let i=()=>e(r).field,a=()=>e(r).catalogField,o=()=>e(r).modelId;{let r=n(()=>({...a(),required:i().required??a().required}));yt(t,{get modelId(){return o()},get field(){return e(r)},get label(){return i().label},get help(){return i().help},get idPrefix(){return c.active.form.id},get error(){return e(y)[i().id]},get value(){return e(h)[i().id]},onchange:t=>{e(h)[i().id]=t,delete e(y)[i().id]}})}});var _=w(p,2),b=t=>{var n=xt(),r=T(n,!0);D(()=>o(r,e(k))),f(t,n)};t(_,t=>{e(k)&&t(b)});var x=w(_,2),C=t=>{var n=St(),r=T(n,!0);D(()=>o(r,e(v))),f(t,n)};t(x,t=>{e(v)&&t(C)});var E=w(x,2),O=w(S(E),2);i(E),i(a),D(e=>o(u,`${c.id===void 0?`New`:`Edit`} ${e??``}`),[()=>I(c.active.form.label,c.noun,c.noun!==void 0)]),g(`submit`,a,N),m(`click`,O,function(...e){c.oncancel?.apply(this,e)}),f(r,a)};t(F,t=>{e(_)?t(R,-1):t(L)}),f(a,P),r()}h([`click`]);export{Le as a,Ne as c,Fe as d,Oe as f,De as h,Re as i,Be as l,Ee as m,yt as n,Pe as o,ke as p,Ue as r,Ve as s,wt as t,He as u};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export{l as load_css,o as start}from"../chunks/Bbl6Vsf2.js";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e}from"../chunks/COiEfhsA.js";import{$ as t,A as n,B as r,Ct as i,Dt as a,F as o,Ft as s,G as c,H as l,J as u,Lt as d,Ot as f,U as p,W as m,X as h,Y as g,a as _,bt as v,ct as y,ft as b,gt as x,ht as S,it as C,mt as w,n as T,nt as E,pt as D,st as O,ut as k,v as A,vt as j,z as ee}from"../chunks/DG3qFFTE.js";import"../chunks/xihTtKlq.js";import{_ as te,g as M,p as N,t as P,v as ne,yt as F}from"../chunks/CXPo72CL.js";import{d as I}from"../chunks/DURcYLyk.js";import"../chunks/Dapxnz2C.js";import{s as L,u as R}from"../chunks/DIE02RSm.js";import{t as z}from"../chunks/B29WjYP5.js";import{M as B,P as V,R as H,k as U}from"../chunks/CEGflXJ6.js";import{D as re,b as W,n as G,x as K}from"../chunks/BG_AWqA3.js";import{B as q,H as J,N as ie,R as Y,_ as ae,b as X,g as Z,j as Q,t as $,v as oe,x as se}from"../chunks/DBoTKMLo.js";import{i as ce,r as le,t as ue}from"../chunks/CO-Ek-HE.js";import{n as de}from"../chunks/BxX_79XJ.js";import{r as fe}from"../chunks/D_U_DYjx.js";import{t as pe}from"../chunks/DJhmPAeb.js";import{t as me}from"../chunks/CxmNJ62m.js";import{r as he,t as ge}from"../chunks/CgAkqYsL.js";var _e=8e3,ve=262144,ye=class extends Error{};function be(e,t,n){let r=new AbortController,i=()=>r.abort();n?.addEventListener(`abort`,i,{once:!0}),n?.aborted&&r.abort();let a,o=new Promise((e,n)=>{a=setTimeout(()=>{r.abort(),n(new ye(`widget load timed out`))},t)});return Promise.race([Promise.resolve().then(()=>e(r.signal)),o]).finally(()=>{a!==void 0&&clearTimeout(a),n?.removeEventListener(`abort`,i)})}function xe(e,t){if(e===void 0)return!0;try{let n=JSON.stringify(e);return n!==void 0&&n.length<=t}catch{return!1}}async function Se(e,t,n,r,i={}){let a=H(e,{registry:n,definition:t}),o=i.timeoutMs??_e,s=i.maxDataLength??ve,c=await Promise.all(a.document.widgets.map(async e=>{let a=n.get(e.type),c={...e,status:`ready`};if(!a?.load)return c;let l=t=>({...e,status:`error`,error:{code:t}});try{let n=await be(n=>a.load?.(e.options,{...r,overviewId:t.id,signal:n}),o,r.signal);return xe(n,s)?n===void 0?c:{...c,data:n}:l(`invalid_data`)}catch(t){return i.onError?.({id:e.id,type:e.type},t),l(t instanceof ye?`timeout`:`load_failed`)}}));return{overviewId:t.id,widgets:c,issues:a.issues}}var Ce=e({entries:()=>we,load:()=>Te}),we=()=>{let e=[...Y(X).map(e=>`section:${e.id}`),`section:${Q.id}`,...de.flatMap(e=>(e.document.layout?.customSections??[]).map(e=>e.id))];return[...new Set(e)].map(e=>({section:he(e)}))},Te=({params:e})=>({sectionId:ge(e.section)});function Ee(e,t){let n=e.flatMap(e=>oe(e)),r=new Map;for(let e of n){let t=q(e.packageId,e.model.name,e.key);if(r.has(t))continue;let i=ce(e.model.id,e.key,n);r.set(t,{id:t,model:e.model,path:Z(e),...e.noun?{noun:e.noun}:{},...i?{scope:i}:{}})}for(let e of ie(t)){if(r.has(e.id))continue;let t=F(e.packageId,e.modelName);t&&r.set(e.id,{id:e.id,model:t,path:Z({packageId:e.packageId,model:t})})}return r}function De(e,t){let n=new Set(e),r=[];for(let e of t){let t=oe(e).some(e=>n.has(q(e.packageId,e.model.name,e.key))),i=J(e);t&&!r.some(e=>e.id===i)&&r.push({id:i,label:e.group?.label??e.label})}return r}var Oe=new Map(Y(X).map(e=>[e.id,e])),ke=new Map(de.flatMap(e=>Object.entries(e.sectionDescriptions??{})));function Ae(e){if(e===`section:${Q.id}`)return{icon:Q.icon,description:Q.description};if(e.startsWith(`section:`)){let t=Oe.get(e.slice(8));if(!t)return{};let n=t.recipes.find(e=>e.group?.summary)?.group?.summary;return{icon:t.icon,description:t.description??n}}let t=ke.get(e);return t?{description:t}:{}}function je(e,t=`Planner`){return e?.trim()||t}function Me(e,t){let n=new Set,r=[],i=(e,t)=>{n.has(e)||(n.add(e),r.push({value:e,label:te(N(t))}))};for(let t of e)for(let{model:e}of ae(t))i(e.id,e.name);for(let e of t.values())i(e.model.id,e.model.name);return r}var Ne=c(`<p class="svelte-2penap"> </p>`),Pe=c(`<header class="section-heading svelte-2penap"><span class="mark svelte-2penap"><!></span> <div class="heading svelte-2penap"><h1 class="svelte-2penap"> </h1> <!></div> <!></header>`);function Fe(e,t){var n=Pe(),i=b(n),a=b(i);L(a,{get name(){return t.icon},size:28}),s(i);var c=S(i,2),u=b(c),f=w(u,!0),m=S(u,2),h=e=>{var n=Ne(),r=w(n,!0);O(()=>l(r,t.description)),p(e,n)};r(m,e=>{t.description&&e(h)}),s(c);var g=S(c,2);o(g,()=>t.actions??d),s(n),O(()=>l(f,t.title)),p(e,n)}async function Ie(e,t,n,r){let i=(await Se({widgets:[n]},e,K,{...t,signal:r,locale:`en-US`})).widgets[0];if(!i||i.status===`error`)throw Error(i?.error?.code??`load_failed`);return i.data}function Le(e,t,n){let r=e.id;return B({definition:r.startsWith(`detail:`)?e:W(r,t.overview(r))??e,registry:K,override:()=>t.overview(r),onchange:e=>t.setOverview(r,e),...n?{loadWidget:(t,r)=>Ie(e,n(),t,r)}:{}})}var Re=(e,t=d,n=d)=>{var r=ze(),i=w(r,!0);O(()=>l(i,n())),p(e,r)},ze=c(`<span class="section-heading svelte-1qn3h3g"> </span>`);function Be(e,n){f(n,!0);let i=_(n,`presentation`,3,`card`),o=_(n,`href`,3,P),s=R(),c=fe(),l=Le(E(()=>n.definition),G,()=>({source:c,sections:s.sections,entryIndex:n.entries,href:o()})),u=v(void 0);y(()=>{let e=l.document.widgets.map(e=>e.type),t=!0;return V(e,K).then(e=>{t&&j(u,e,!0)}),()=>{t=!1}});function d(){for(let e of l.document.widgets)l.reload(e.id)}let h=!0;y(()=>{JSON.stringify(s.sections),n.entries,h?h=!1:E(d)}),y(()=>c.onReset?.(()=>d())),T(()=>l.destroy());var g=m(),b=D(g),x=e=>{U(e,{get controller(){return l},get models(){return n.models},get label(){return n.label},get presentation(){return i()},get heading(){return Re},get components(){return t(u)}})};r(b,e=>{t(u)&&e(x)}),p(e,g),a()}var Ve=c(`<section class="entries svelte-1jqhb2e" aria-labelledby="section-entries"><h2 id="section-entries" class="svelte-1jqhb2e">Menu entries</h2> <!></section>`),He=c(`<!> <!>`,1),Ue=c(`<h1>Section not found</h1> <p>This section is not in your app. <a>Back to the Planner</a></p>`,1),We=c(`<main class="section-view svelte-1jqhb2e"><!></main>`);function Ge(e,n){f(n,!0);let c=(e,n=d)=>{var a=m(),o=D(a),s=e=>{var r=u();O(e=>l(r,e),[()=>ne(t(V).get(n().id)??0)]),p(e,r)},c=i(()=>t(V).has(n().id));r(o,e=>{t(c)&&e(s)}),p(e,a)},h=_(n,`href`,3,P),g=R(),C=fe(),w=re(),T=i(()=>g.sections.find(e=>e.id===n.sectionId)),E=i(()=>w?.shell.sections.find(e=>e.id===n.sectionId)),k=i(()=>je(t(T)?.heading||t(E)?.label)),te=i(()=>t(T)?.icon??t(E)?.icon??`folder`),M=i(()=>Ae(n.sectionId).description??t(E)?.description),N=i(()=>t(T)?.items.map(e=>e.id)??[]),F=i(()=>$.ids.flatMap(e=>{let t=se.get(e);return t?[t]:[]})),L=i(()=>Ee(t(F),$.features)),z=i(()=>W(n.sectionId)),B=i(()=>Me(t(F),t(L))),V=v(x(new Map)),H=0;async function U(){let e=++H,n=new Map;await Promise.all(t(N).map(async e=>{let r=t(L).get(e);if(!r)return;let i=await C.list(r.model);n.set(e,i.filter(e=>le(r.scope,e)).length)})),e===H&&j(V,n,!0)}y(()=>{t(N),t(L),U()}),y(()=>C.onReset?.(()=>void U()));var K=m(),q=D(K),J=e=>{var a=We(),l=b(a),u=e=>{var a=He(),l=D(a);Fe(l,{get icon(){return t(te)},get title(){return t(k)},get description(){return t(M)},actions:e=>{var r=m(),i=D(r);o(i,()=>n.headerActions??d,()=>({title:t(k),itemIds:t(N)})),p(e,r)},$$slots:{actions:!0}});var u=S(l,2),f=e=>{var a=He(),o=D(a);ee(o,()=>n.sectionId,e=>{{let n=i(()=>`${t(k)} overview`);Be(e,{get definition(){return t(z)},get entries(){return t(L)},get models(){return t(B)},get href(){return h()},get label(){return t(n)}})}});var l=S(o,2),u=e=>{var t=Ve(),r=S(b(t),2);I(r,{get sectionId(){return n.sectionId},get meta(){return c}}),s(t),p(e,t)};r(l,e=>{g.editing&&e(u)}),p(e,a)},_=e=>{I(e,{get sectionId(){return n.sectionId},layout:`cards`,get meta(){return c},get actions(){return n.menuActions}})};r(u,e=>{t(z)?e(f):e(_,-1)}),p(e,a)},f=e=>{var t=Ue(),n=S(D(t),2),r=S(b(n));s(n),O(e=>A(r,`href`,e),[()=>h()(`/`)]),p(e,t)};r(l,e=>{t(T)?e(u):e(f,-1)}),s(a),p(e,a)};r(q,e=>{G.loaded&&e(J)}),p(e,K),a()}var Ke=c(`<a class="new svelte-sp05yg"> </a>`);function qe(e,o){f(o,!0);let s=(e,n)=>{let a=()=>(n?.()).title,o=()=>(n?.()).itemIds,s=i(()=>De(o(),t(_)));var c=m(),l=D(c),u=e=>{pe(e,{get section(){return t(s)[0].id},get label(){return t(s)[0].label}})},d=e=>{me(e,{get label(){return a()},get groups(){return t(s)}})};r(l,e=>{t(s).length===1?e(u):t(s).length>1&&e(d,1)}),p(e,c)},c=(e,n=d)=>{let a=i(()=>y(n()));var o=m(),s=D(o),c=e=>{var r=Ke(),i=w(r);O(()=>{A(r,`href`,n().href),l(i,`New ${t(a)??``}`)}),h(`click`,r,()=>b(n())),p(e,r)};r(s,e=>{t(a)&&e(c)}),p(e,o)},u=R(),g=i(()=>je(u.sections.find(e=>e.id===o.sectionId)?.heading)),_=i(()=>$.ids.flatMap(e=>{let t=se.get(e);return t?[t]:[]})),v=i(()=>Ee(t(_),$.features)),y=e=>{let n=t(v).get(e.id);return n?M(e.label,n.noun):void 0};function b(e){ue(new URL(e.href,z.url).pathname)}n(`sp05yg`,e=>{C(()=>{k.title=`${t(g)??``} · smrt planner`})}),Ge(e,{get sectionId(){return o.sectionId},get headerActions(){return s},get menuActions(){return c}}),a()}g([`click`]);function Je(e,t){f(t,!0),qe(e,{get sectionId(){return t.data.sectionId}}),a()}export{Je as component,Ce as universal};
|