@happyvertical/smrt-planner 0.60.4 → 0.60.6
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/app/404.html +18 -18
- package/app/_app/immutable/chunks/-jVMvnpv.js +1 -0
- package/app/_app/immutable/chunks/{DOJ0mTnf.js → B2up491X.js} +1 -1
- package/app/_app/immutable/chunks/{QD5OfFAp.js → BDhA6I_M.js} +1 -1
- package/app/_app/immutable/chunks/{Oxon8cDD.js → BRCZe8R4.js} +1 -1
- package/app/_app/immutable/chunks/{ChD0Ya1r.js → BUdNw_R5.js} +1 -1
- package/app/_app/immutable/chunks/{ENE_lftz.js → BY56fjip.js} +1 -1
- package/app/_app/immutable/chunks/{D1x5ijJb.js → BYwZ_UeC.js} +1 -1
- package/app/_app/immutable/chunks/{CzbKiIbN.js → BZdI1z-N.js} +1 -1
- package/app/_app/immutable/chunks/{-ggTgfM2.js → B_TfR61P.js} +1 -1
- package/app/_app/immutable/chunks/BqNQVyhl.js +1 -0
- package/app/_app/immutable/chunks/{BCruEZ83.js → C-A_haB1.js} +1 -1
- package/app/_app/immutable/chunks/{DzQA5WgS.js → C842jeAa.js} +1 -1
- package/app/_app/immutable/chunks/{DWRvnfqw.js → CAr04sRC.js} +1 -1
- package/app/_app/immutable/chunks/{DKGH436i.js → ChNjGKYd.js} +1 -1
- package/app/_app/immutable/chunks/{NuljWYRA.js → ChpbeHev.js} +1 -1
- package/app/_app/immutable/chunks/{C_HeDiC4.js → CzOwak4Z.js} +1 -1
- package/app/_app/immutable/chunks/{DFSuj4nU.js → D9MBacZo.js} +1 -1
- package/app/_app/immutable/chunks/{CFsI4nr9.js → DGu5bp_z.js} +1 -1
- package/app/_app/immutable/chunks/{vt4nGGr3.js → DQOroCMN.js} +2 -2
- package/app/_app/immutable/chunks/{DNfac59G.js → DV5uyaew.js} +1 -1
- package/app/_app/immutable/chunks/{yVGybWs_.js → DVpY8cFH.js} +1 -1
- package/app/_app/immutable/chunks/{RNr2AL13.js → DnAJSx5A.js} +1 -1
- package/app/_app/immutable/chunks/{BQW57rtm.js → DqF3UNFg.js} +1 -1
- package/app/_app/immutable/chunks/{2JTcL7GS.js → Dvyr8zQc.js} +1 -1
- package/app/_app/immutable/chunks/HiOPVQ5l.js +1 -0
- package/app/_app/immutable/chunks/{DormgCOG.js → Zte-WUy-.js} +33 -33
- package/app/_app/immutable/chunks/{DyGJXtfQ.js → b-_V29X7.js} +3 -3
- package/app/_app/immutable/chunks/{n-dBblBs.js → blNrXq3G.js} +1 -1
- package/app/_app/immutable/chunks/{C617Umoc.js → piAsleGb.js} +1 -1
- package/app/_app/immutable/entry/{app.BFXdz8RO.js → app.VsvePARE.js} +2 -2
- package/app/_app/immutable/entry/start.C9Rtl582.js +1 -0
- package/app/_app/immutable/nodes/{0.BUx1o8Za.js → 0.Cn7I5A1-.js} +1 -1
- package/app/_app/immutable/nodes/{1.B7nJJuuS.js → 1.B5PVTmSi.js} +1 -1
- package/app/_app/immutable/nodes/{10.DI5QFUkZ.js → 10.DiwpqAdM.js} +1 -1
- package/app/_app/immutable/nodes/{11.B-7_6CmY.js → 11.DKEe-0nX.js} +1 -1
- package/app/_app/immutable/nodes/{12.CJod2OOc.js → 12.FHOKn6Wp.js} +1 -1
- package/app/_app/immutable/nodes/{13.DBe_AN4i.js → 13.CDFWjTYj.js} +1 -1
- package/app/_app/immutable/nodes/{14.Bawi5Pz8.js → 14.BKjzX4FA.js} +1 -1
- package/app/_app/immutable/nodes/{2.BCTtC-OF.js → 2.BD8R-UG6.js} +3 -3
- package/app/_app/immutable/nodes/{3.JmVMI6Fy.js → 3.C4rialtY.js} +1 -1
- package/app/_app/immutable/nodes/{4.CMH01nZL.js → 4.BH8hNwJe.js} +1 -1
- package/app/_app/immutable/nodes/{5.C0LDyjB9.js → 5.Bucpg7s5.js} +1 -1
- package/app/_app/immutable/nodes/{6.1Ml5txmM.js → 6.Btht0LGB.js} +1 -1
- package/app/_app/immutable/nodes/{7.Do0OUzLt.js → 7.CPhMBha2.js} +1 -1
- package/app/_app/immutable/nodes/{8.B10KXCkX.js → 8.BfHkIxy7.js} +1 -1
- package/app/_app/immutable/nodes/{9.2wWPtZj8.js → 9.C2RUcqAt.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 +27 -27
- 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/articles/index.html +24 -24
- 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/human-resources/Employment/index.html +23 -23
- package/app/m/human-resources/EmploymentTerm/index.html +23 -23
- package/app/m/human-resources/HeldQualification/index.html +23 -23
- package/app/m/human-resources/Qualification/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 +23 -23
- package/app/m/inventory/LotCorrection/index.html +23 -23
- package/app/m/inventory/LotDocument/index.html +23 -23
- package/app/m/inventory/LotStockLevel/index.html +23 -23
- package/app/m/inventory/LotUsage/index.html +23 -23
- 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/SlackMessage/slack-messages/index.html +24 -24
- 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 +1 -1
- 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 +20 -20
- package/app/packages/ingestion/index.html +21 -21
- package/app/packages/inventory/index.html +21 -21
- 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/reactions/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 +21 -21
- 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 +21 -21
- 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/ads.campaigns/help/index.html +21 -21
- package/app/recipes/ads.campaigns/index.html +23 -23
- package/app/recipes/affiliates.referrals/help/index.html +21 -21
- package/app/recipes/affiliates.referrals/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/approvals.requests/help/index.html +21 -21
- package/app/recipes/approvals.requests/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/content.articles/help/index.html +21 -21
- package/app/recipes/content.articles/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/human-resources.people/help/index.html +21 -21
- package/app/recipes/human-resources.people/index.html +23 -23
- package/app/recipes/human-resources.qualifications/help/index.html +21 -21
- package/app/recipes/human-resources.qualifications/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 +21 -21
- 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/manufacturing.assemblies/help/index.html +21 -21
- package/app/recipes/manufacturing.assemblies/index.html +23 -23
- package/app/recipes/manufacturing.production/help/index.html +21 -21
- package/app/recipes/manufacturing.production/index.html +23 -23
- package/app/recipes/marketing.campaigns/help/index.html +21 -21
- package/app/recipes/marketing.campaigns/index.html +23 -23
- package/app/recipes/messages/help/index.html +21 -21
- package/app/recipes/messages/index.html +23 -23
- package/app/recipes/places.locations/help/index.html +21 -21
- package/app/recipes/places.locations/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/social.posts/help/index.html +21 -21
- package/app/recipes/social.posts/index.html +23 -23
- package/app/recipes/subscriptions.plans/help/index.html +21 -21
- package/app/recipes/subscriptions.plans/index.html +23 -23
- package/app/recipes/support.tickets/help/index.html +21 -21
- package/app/recipes/support.tickets/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/recipes/video.library/help/index.html +21 -21
- package/app/recipes/video.library/index.html +23 -23
- package/app/recipes/voice.profiles/help/index.html +21 -21
- package/app/recipes/voice.profiles/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-approvals/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-grow/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-make/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-places/index.html +19 -19
- package/app/s/section-projects/index.html +19 -19
- package/app/s/section-publish/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-staff/index.html +19 -19
- package/app/s/section-support/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 +39 -39
- package/dist/core/index.js +41 -41
- package/dist/smrt-version.d.ts +1 -1
- package/dist/smrt-version.js +1 -1
- package/package.json +55 -55
- package/app/_app/immutable/chunks/Din9xt9G.js +0 -1
- package/app/_app/immutable/chunks/Dysg00l5.js +0 -1
- package/app/_app/immutable/chunks/iqxwEt43.js +0 -1
- package/app/_app/immutable/entry/start.CiadGFFQ.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./DG3qFFTE.js";import{c as e}from"./
|
|
1
|
+
import"./DG3qFFTE.js";import{c as e}from"./BqNQVyhl.js";var t={get data(){return e.data},get error(){return e.error},get form(){return e.form},get params(){return e.params},get route(){return e.route},get state(){return e.state},get status(){return e.status},get url(){return e.url}};export{t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{$ as e,B as t,Dt as n,Ft as r,G as i,H as a,L as o,Ot as s,U as c,W as l,ft as u,ht as d,mt as f,pt as p,st as m,v as h}from"./DG3qFFTE.js";import"./xihTtKlq.js";import{t as g}from"./
|
|
1
|
+
import{$ as e,B as t,Dt as n,Ft as r,G as i,H as a,L as o,Ot as s,U as c,W as l,ft as u,ht as d,mt as f,pt as p,st as m,v as h}from"./DG3qFFTE.js";import"./xihTtKlq.js";import{t as g}from"./Zte-WUy-.js";import{nt as _}from"./Dvyr8zQc.js";import{t as v}from"./piAsleGb.js";var y=i(`<li><a class="svelte-ra5apm"> </a></li> <li><a class="svelte-ra5apm"> </a></li>`,1),b=i(`<details class="menu svelte-ra5apm"><summary class="svelte-ra5apm"><!></summary> <ul class="svelte-ra5apm"></ul></details>`);function x(i,x){s(x,!0);var S=l(),C=p(S),w=e=>{v(e,{get section(){return x.groups[0].id},get label(){return x.groups[0].label},compact:!0})},T=t=>{var n=b(),i=u(n),s=u(i);_(s,{path:`M19.14 12.94c.04-.3.06-.61.06-.94 0-.32-.02-.64-.07-.94l2.03-1.58a.49.49 0 0 0 .12-.61l-1.92-3.32a.488.488 0 0 0-.59-.22l-2.39.96c-.5-.38-1.03-.7-1.62-.94l-.36-2.54a.484.484 0 0 0-.48-.41h-3.84c-.24 0-.43.17-.47.41l-.36 2.54c-.59.24-1.13.57-1.62.94l-2.39-.96c-.22-.08-.47 0-.59.22L2.74 8.87c-.12.21-.08.47.12.61l2.03 1.58c-.05.3-.09.63-.09.94s.02.64.07.94l-2.03 1.58a.49.49 0 0 0-.12.61l1.92 3.32c.12.22.37.29.59.22l2.39-.96c.5.38 1.03.7 1.62.94l.36 2.54c.05.24.24.41.48.41h3.84c.24 0 .44-.17.47-.41l.36-2.54c.59-.24 1.13-.56 1.62-.94l2.39.96c.22.08.47 0 .59-.22l1.92-3.32c.12-.22.07-.47-.12-.61l-2.01-1.58zM12 15.6c-1.98 0-3.6-1.62-3.6-3.6s1.62-3.6 3.6-3.6 3.6 1.62 3.6 3.6-1.62 3.6-3.6 3.6z`,size:16}),r(i);var l=d(i,2);o(l,21,()=>x.groups,e=>e.id,(t,n)=>{var i=y(),o=p(i),s=u(o),l=f(s);r(o);var _=d(o,2),v=u(_),b=f(v);r(_),m((t,r)=>{h(s,`href`,t),a(l,`${e(n).label??``} options`),h(v,`href`,r),a(b,`${e(n).label??``} help`)},[()=>g(`/recipes/${e(n).id}/`),()=>g(`/recipes/${e(n).id}/help/`)]),c(t,i)}),r(l),r(n),m(()=>{h(i,`title`,`${x.label} options and help`),h(i,`aria-label`,`${x.label} options and help`)}),c(t,n)};t(C,e=>{x.groups.length===1?e(w):x.groups.length>1&&e(T,1)}),c(i,S),n()}export{x as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{O as e,u as t}from"./
|
|
1
|
+
import{O as e,u as t}from"./Zte-WUy-.js";import{v as n}from"./Dvyr8zQc.js";import{c as r}from"./BRCZe8R4.js";var i=`@happyvertical/smrt-reports:RuntimeReport`;function a(e){switch(e.type){case`text`:return`string`;case`integer`:return`integer`;case`decimal`:return`decimal`;case`boolean`:return`boolean`;case`datetime`:return`datetime`;case`foreignKey`:case`crossPackageRef`:return`id`;default:return null}}function o(e){let t=e.replace(/([a-z\d])([A-Z])/g,`$1_$2`).toLowerCase();return/(series|species)$/.test(t)?t:/[^aeiou]y$/.test(t)?`${t.slice(0,-1)}ies`:/(s|x|z|ch|sh)$/.test(t)?`${t}es`:`${t}s`}var s=[`totalAmount`,`total`,`amount`];function c(n,i,c=o(n.name)){let l=[{name:`id`,type:`string`}];for(let r of n.fields){let n=a(r);if(!n||r.system||l.some(e=>e.name===r.name))continue;let i=e(r)?`money`:n===`datetime`&&r.ui?.format===`date`?`date`:void 0;l.push({name:r.name,type:n,label:t(r),...i?{format:i}:{},...n===`string`&&r.enum?.length?{enum:r.enum}:{}})}let u=l.filter(e=>e.format===`money`),d=s.map(e=>u.find(t=>t.name===e)).find(Boolean),f={id:c,label:i,...n.description?{description:n.description}:{},schema:l,model:n,...d?{amountField:d.name}:{}},p=r([f],c).defaultTimeField;return p?{...f,dateField:p}:f}function l(e,t){let r=new Set(e),i=new Map;for(let e of t)if(r.has(e.id))for(let t of n(e))t.model.id!==`@happyvertical/smrt-reports:RuntimeReport`&&i.set(t.model.id,[...i.get(t.model.id)??[],t]);let a=new Map,s=new Set;for(let[e,t]of i){let n=t.find(e=>!e.filter)??t[0],r=o(n.model.name);s.has(r)&&(r=`${n.packageId}.${r}`),s.add(r),a.set(e,c(n.model,n.label,r))}return[...a.values()]}export{l as n,i as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{$ as e,B as t,Ct as n,Dt as r,E as i,Ft as a,G as o,H as s,J as c,L as l,Ot as u,Pt as d,U as f,W as p,Y as m,a as h,bt as ee,d as g,ft as _,ht as v,mt as y,n as b,nt as te,o as x,pt as S,q as C,r as w,st as T,tt as ne,v as E,vt as re}from"./DG3qFFTE.js";import"./xihTtKlq.js";import"./BLUInGBV.js";import{t as ie}from"./Bq8E3AWP.js";import"./
|
|
1
|
+
import{$ as e,B as t,Ct as n,Dt as r,E as i,Ft as a,G as o,H as s,J as c,L as l,Ot as u,Pt as d,U as f,W as p,Y as m,a as h,bt as ee,d as g,ft as _,ht as v,mt as y,n as b,nt as te,o as x,pt as S,q as C,r as w,st as T,tt as ne,v as E,vt as re}from"./DG3qFFTE.js";import"./xihTtKlq.js";import"./BLUInGBV.js";import{t as ie}from"./Bq8E3AWP.js";import"./Zte-WUy-.js";import{n as D}from"./DK8Blf1Y.js";import{D as O,T as k,f as ae,h as oe}from"./b-_V29X7.js";import{n as se}from"./v8gneLl4.js";import{o as A,u as j}from"./DIE02RSm.js";import{i as M}from"./CGVkRTMI.js";var N=new Set([`$$slots`,`$$events`,`$$legacy`]);function P(e,t){u(t,!0);let n=O(),i=x(t,N),a=null;w(()=>{a=n.registerFocusTool(i)}),b(()=>{a?.()}),r()}var ce=o(`<!> <!>`,1),le=o(`<span class="smrt-shell-layout-editor__muted svelte-xzk327"> </span>`),ue=o(`<div class="smrt-shell-layout-editor__row svelte-xzk327"><!></div>`),de=o(`<strong> </strong>`),fe=o(`<!> <!> <!> <!>`,1),F=o(`<span> </span> <!>`,1),I=o(`<div class="smrt-shell-layout-editor__preview"><h3 class="svelte-xzk327"> </h3> <div class="smrt-shell-layout-editor__preview-frame svelte-xzk327" role="group" inert=""><!></div></div>`),L=o(`<section class="smrt-shell-layout-editor svelte-xzk327" data-smrt-component="ShellLayoutEditor"><header class="svelte-xzk327"><div><h2 class="svelte-xzk327"> </h2> <p class="svelte-xzk327"> </p></div> <!></header> <fieldset class="smrt-shell-layout-editor__panels svelte-xzk327"><legend class="svelte-xzk327"> </legend> <!></fieldset> <div class="smrt-shell-layout-editor__body svelte-xzk327"><div class="smrt-shell-layout-editor__nav"><div class="smrt-shell-layout-editor__nav-head svelte-xzk327"><h3 class="svelte-xzk327"> </h3> <!></div> <!></div> <!></div></section>`);function R(o,m){let b=C();u(m,!0);let x=h(m,`preview`,3,!0),{t:w}=ie(),O=te(()=>m.controller??j()),N=`${b}-heading`,P=n(()=>O.sections),R=n(()=>O.panels),z=n(()=>O.applied),B=n(()=>e(P).map(e=>({id:e.id,label:e.heading??w(k[`ui.shell_layout_editor.top_level`]),fixed:e.group===null,root:e.group===null,hidden:e.hidden,custom:e.custom,titleVisible:e.titleVisible,count:e.items.length}))),V=n(()=>e(P).flatMap(e=>e.items.map(t=>({id:t.id,containerId:e.id,label:t.label}))));function H(e,t){t?O.show(e):O.hide(e)}let U=ee(void 0);function pe(t,n){let r=n.currentTarget;O.renameSection(t,r.value),r.value=e(B).find(e=>e.id===t)?.label??``}async function me(){let t=O.createSection(w(k[`ui.shell_layout_editor.new_section_label`]));if(!t)return;await ne();let n=e(U)?.querySelector(`input[data-section-name="${CSS.escape(t)}"]`);n?.focus(),n?.select()}function he(e,t,n){n>0&&!globalThis.confirm?.(w(k[`ui.shell_layout_editor.delete_confirm`],{label:t}))||O.deleteSection(e)}function ge(e){O.moveItem(e.item.id,e.target.containerId,e.target.index)}function _e(e){O.moveSection(e.container.id,e.target)}var W=L(),G=_(W),K=_(G),q=_(K),ve=y(q,!0),ye=v(q,2),be=y(ye,!0);a(K);var xe=v(K,2);{let t=n(()=>!O.customized);D(xe,{variant:`secondary`,size:`sm`,get disabled(){return e(t)},onclick:()=>O.reset(),children:(e,t)=>{d();var n=c();T(e=>s(n,e),[()=>w(k[`ui.shell_layout_editor.reset`])]),f(e,n)},$$slots:{default:!0}})}a(G);var J=v(G,2),Y=_(J),Se=y(Y,!0),Ce=v(Y,2);l(Ce,17,()=>e(R),e=>e.edge,(r,i)=>{var o=ue(),c=_(o),l=t=>{var r=ce(),a=S(r);{let t=n(()=>w(k[`ui.shell_layout_editor.show_panel`],{panel:e(i).label}));M(a,{interaction:!1,get checked(){return e(i).visible},get label(){return e(t)},onchange:t=>O.setPanel(e(i).edge,{visible:t.currentTarget.checked})})}var o=v(a,2);{let t=n(()=>e(i).initial===`expanded`),r=n(()=>!e(i).visible),a=n(()=>w(k[`ui.shell_layout_editor.start_expanded`],{panel:e(i).label}));M(o,{interaction:!1,get checked(){return e(t)},get disabled(){return e(r)},get label(){return e(a)},onchange:t=>O.setPanel(e(i).edge,{initial:t.currentTarget.checked?`expanded`:`collapsed`})})}f(t,r)},u=t=>{var n=le(),r=y(n,!0);T(e=>s(r,e),[()=>w(k[`ui.shell_layout_editor.panel_unavailable`],{panel:e(i).label})]),f(t,n)};t(c,t=>{e(i).available?t(l):t(u,-1)}),a(o),T(()=>E(o,`data-edge`,e(i).edge)),f(r,o)}),a(J);var X=v(J,2),Z=_(X),Q=_(Z),$=_(Q),we=y($,!0),Te=v($,2);D(Te,{variant:`secondary`,size:`sm`,onclick:me,children:(e,t)=>{d();var n=c();T(e=>s(n,e),[()=>w(k[`ui.shell_layout_editor.new_section`])]),f(e,n)},$$slots:{default:!0}}),a(Q);var Ee=v(Q,2);{let r=(r,i)=>{let a=()=>(i?.()).container,o=n(()=>e(B).find(e=>e.id===a().id));var c=p(),l=S(c),u=e=>{var t=de(),n=y(t,!0);T(()=>s(n,a().label)),f(e,t)},d=r=>{var i=fe(),s=S(i);{let t=n(()=>w(k[`ui.shell_layout_editor.section_name`],{label:a().label}));se(s,{class:`smrt-shell-layout-editor__name`,interaction:!1,get"data-section-name"(){return a().id},get"aria-label"(){return e(t)},get value(){return a().label},onchange:e=>pe(a().id,e)})}var c=v(s,2);{let t=n(()=>e(o)?.hidden?`eyeOff`:`eye`),r=n(()=>!e(o)?.hidden),i=n(()=>w(k[`ui.shell_layout_editor.show_entry`],{label:a().label}));A(c,{get icon(){return e(t)},get pressed(){return e(r)},get label(){return e(i)},onclick:()=>H(a().id,!!e(o)?.hidden)})}var l=v(c,2);{let t=n(()=>e(o)?.titleVisible===!1?`headingOff`:`heading`),r=n(()=>e(o)?.titleVisible??!0),i=n(()=>w(k[`ui.shell_layout_editor.show_title_for`],{label:a().label}));A(l,{get icon(){return e(t)},get pressed(){return e(r)},get label(){return e(i)},onclick:()=>O.setSectionTitleVisible(a().id,!(e(o)?.titleVisible??!0))})}var u=v(l,2),d=t=>{{let r=n(()=>w(k[`ui.shell_layout_editor.delete_section`],{label:a().label}));A(t,{icon:`trash`,get label(){return e(r)},onclick:()=>he(a().id,a().label,e(o).count)})}};t(u,t=>{e(o)?.custom&&t(d)}),f(r,i)};t(l,t=>{e(o)?.root?t(u):t(d,-1)}),f(r,c)},a=(t,r)=>{let a=()=>(r?.()).item,o=()=>(r?.()).container,c=n(()=>O.isHidden(a().id));var l=F(),u=S(l);let d;var p=y(u,!0),m=v(u,2);{let t=n(()=>e(c)?`eyeOff`:`eye`),r=n(()=>!e(c)),i=n(()=>w(k[`ui.shell_layout_editor.show_entry`],{label:a().label}));A(m,{get icon(){return e(t)},get pressed(){return e(r)},get label(){return e(i)},onclick:()=>H(a().id,e(c))})}T(e=>{d=i(u,1,`smrt-shell-layout-editor__label svelte-xzk327`,null,d,{"smrt-shell-layout-editor__muted":e}),s(p,a().label)},[()=>e(c)||O.isHidden(o().id)]),f(t,l)},o=n(()=>w(k[`ui.shell_layout_editor.sortable_label`]));oe(Ee,{get containers(){return e(B)},get items(){return e(V)},get label(){return e(o)},reorderContainers:!0,onmove:ge,oncontainermove:_e,containerHeader:r,item:a,$$slots:{containerHeader:!0,item:!0}})}a(Z);var De=v(Z,2),Oe=t=>{var r=I(),i=_(r),o=y(i,!0),c=v(i,2),l=_(c);{let t=n(()=>w(k[`ui.shell_layout_editor.preview_label`]));ae(l,{get items(){return e(z).nav},get groups(){return e(z).groups},get iconComponent(){return m.iconComponent},get"aria-label"(){return e(t)}})}a(c),a(r),T((e,t)=>{s(o,e),E(c,`aria-label`,t)},[()=>w(k[`ui.shell_layout_editor.preview`]),()=>w(k[`ui.shell_layout_editor.preview_label`])]),f(t,r)};t(De,e=>{x()&&e(Oe)}),a(X),a(W),g(W,e=>re(U,e),()=>e(U)),T((e,t,n,r)=>{E(W,`aria-labelledby`,N),E(q,`id`,N),s(ve,e),s(be,t),s(Se,n),s(we,r)},[()=>w(k[`ui.shell_layout_editor.heading`]),()=>w(k[`ui.shell_layout_editor.description`]),()=>w(k[`ui.shell_layout_editor.panels`]),()=>w(k[`ui.shell_layout_editor.navigation`])]),f(o,W),r()}m([`click`]);export{P as n,R as t};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./BGpjZKOE.js","./BaNbYf_w.js","./eBF8D7GD.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
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,J as d,K as f,L as p,Lt as m,Mt as h,Ot as g,P as _,Pt as v,R as y,Rt as b,T as x,U as S,W as C,X as w,Y as T,Z as E,_ as D,_t as O,a as k,bt as A,ct as j,d as ee,dt as M,f as N,ft as P,gt as F,ht as I,k as te,kt as L,lt as R,mt as z,n as ne,nt as re,ot as ie,pt as B,q as ae,rt as oe,st as V,tt as se,v as H,vt as U,xt as ce,yt as le,z as W}from"./DG3qFFTE.js";import{t as G}from"./BaNbYf_w.js";import"./xihTtKlq.js";import{r as ue}from"./BLUInGBV.js";import{a as K,t as q}from"./Bq8E3AWP.js";import{B as de,Pt as fe,R as J,W as pe}from"./DormgCOG.js";import{n as Y}from"./DK8Blf1Y.js";import{C as me,S as X,b as he,x as ge}from"./DyGJXtfQ.js";import{n as _e,r as ve}from"./v8gneLl4.js";import{i as ye}from"./BCruEZ83.js";import{_ as be,b as xe,c as Se,d as Ce,g as we,h as Te,i as Ee,m as De,n as Oe,p as ke,s as Ae}from"./CGVkRTMI.js";import{n as je}from"./D1x5ijJb.js";import{n as Me,r as Ne}from"./CsPuvW_W.js";import{c as Pe,t as Fe}from"./eBF8D7GD.js";import{_ as Ie,a as Le,g as Re,h as ze,l as Be,n as Ve,p as He,u as Ue}from"./vt4nGGr3.js";import{Q as Z,b as We,t as Ge}from"./2JTcL7GS.js";import{C as Ke,_ as qe,h as Je,i as Ye,m as Xe,o as Ze,r as Qe,t as $e,u as et}from"./Oxon8cDD.js";import{n as tt,t as nt}from"./ChD0Ya1r.js";function rt(e,t){let n=t.trim();if(!n)return;let r=e.value,i=typeof document<`u`&&document.activeElement===e,a=e.selectionStart??r.length,o=e.selectionEnd??r.length;!i&&a===0&&o===0&&r.length>0&&(a=r.length,o=r.length);let s=r.slice(0,a),c=r.slice(o),l=`${s.length>0&&!/\s$/.test(s)?` `:``}${n}${/^[\p{L}\p{N}]/u.test(c)?` `:``}`;e.value=`${s}${l}${c}`;let u=s.length+l.length;try{e.setSelectionRange(u,u)}catch{}e.dispatchEvent(new Event(`input`,{bubbles:!0}))}function it(e){let t=e,n=null,r=null,i=0,a=0,o=null,s=!1,c=!1,l=null;function u(){n&&clearTimeout(n),n=null}function d(){u(),r=null,o=null,s=!1}function f(){n&&(d(),t.onCancel?.())}function p(e){let n=!t.filter||t.filter(e);return n?n===!0?e.target instanceof Element?e.target:null:n:null}function m(){c=!0,l&&clearTimeout(l),l=setTimeout(()=>{c=!1,l=null},400)}return{handlePointerDown(e){if(t.disabled||!e.isPrimary||e.pointerType===`mouse`&&e.button!==0)return;let c=p(e);if(!c)return;d(),r=e.pointerId,i=e.clientX,a=e.clientY,o={target:c,pointerType:e.pointerType||`mouse`,clientX:e.clientX,clientY:e.clientY},t.onPressStart?.(o);let l=o;n=setTimeout(()=>{n=null,s=!0,t.onLongPress(l)},t.delay??500)},handlePointerMove(e){if(!n||e.pointerId!==r)return;let o=t.moveTolerance??10;Math.hypot(e.clientX-i,e.clientY-a)>o&&f()},handlePointerUp(e){if(e.pointerId===r){if(n)f();else if(s&&o){let e=o;m(),d(),t.onRelease?.(e)}else d()}},handlePointerCancel(e){if(e.pointerId===r){if(n)f();else if(s&&o){let e=o;d(),t.onRelease?.(e)}else d()}},handleDragStart(){f()},handleContextMenu(e){t.preventContextMenu&&(n||s)&&e.preventDefault()},handleClick(e){c&&(c=!1,l&&clearTimeout(l),l=null,e.preventDefault(),e.stopPropagation())},cancel(){d()},update(e){t=e,e.disabled&&d()},get pending(){return n!==null},get fired(){return s}}}function at(e,t){let n=it(t),r=e=>n.handlePointerDown(e),i=e=>n.handlePointerMove(e),a=e=>n.handlePointerUp(e),o=e=>n.handlePointerCancel(e),s=()=>n.handleDragStart(),c=e=>n.handleContextMenu(e),l=e=>n.handleClick(e);return e.addEventListener(`pointerdown`,r),e.addEventListener(`dragstart`,s),e.addEventListener(`contextmenu`,c),e.addEventListener(`click`,l,!0),window.addEventListener(`pointermove`,i),window.addEventListener(`pointerup`,a),window.addEventListener(`pointercancel`,o),{update(e){n.update(e)},destroy(){n.cancel(),e.removeEventListener(`pointerdown`,r),e.removeEventListener(`dragstart`,s),e.removeEventListener(`contextmenu`,c),e.removeEventListener(`click`,l,!0),window.removeEventListener(`pointermove`,i),window.removeEventListener(`pointerup`,a),window.removeEventListener(`pointercancel`,o)}}}var ot=new WeakMap;async function st(e,t={}){let n=Math.max(0,t.quietMs??120),r=Math.max(0,t.timeoutMs??5e3),i=Date.now(),a=()=>Math.max(0,r-(Date.now()-i)),o=e=>new Promise(t=>setTimeout(t,e));for(;;){let n=ot.get(e);if(!n||n.size===0||t.signal?.aborted)break;let r=a();if(r===0)return;await Promise.race([Promise.all([...n]),o(r)])}t.signal?.aborted||a()===0||await new Promise(r=>{let i=null,o=[],s=()=>{i&&clearTimeout(i),clearTimeout(l);for(let e of o)e();t.signal?.removeEventListener(`abort`,s),r()},c=()=>{i&&clearTimeout(i),i=setTimeout(s,n)},l=setTimeout(s,a());t.signal?.addEventListener(`abort`,s,{once:!0}),o.push(e.subscribe(e=>{(e.type===`registered`||e.type===`unregistered`)&&c()}));for(let e of t.alsoWatch??[]){let t=e?.subscribe?.(()=>c());t&&o.push(t)}c()})}async function ct(e={}){let t=e.window??(typeof window<`u`?window:void 0),n=e.navigator??(typeof navigator<`u`?navigator:void 0);return!t||!(`SpeechRecognition`in t)&&!(`webkitSpeechRecognition`in t)?`missing`:n&&`brave`in n&&n.brave||/\bElectron\//.test(n?.userAgent??``)?`unreliable`:`works`}function lt(e){return new Worker(new URL(`../workers/local-speech.worker-BzGX7Qdn.js`,import.meta.url).href,{name:e?.name})}var ut=2**28,dt=16,ft=.95;function pt(e){if(e===0)return 1;let t=Math.PI*e;return Math.sin(t)/t}function mt(e,t,n){for(let[e,r]of[[`fromRate`,t],[`toRate`,n]])if(!Number.isFinite(r)||r<=0)throw new Pe(`invalid_argument`,`${e} must be a positive finite number (got ${String(r)})`);let r=Math.floor(e.length*n/t);if(r>ut)throw new Pe(`invalid_argument`,`resampled output would be ${r} samples; the limit is ${ut}`);if(t===n)return e.slice();let i=new Float32Array(r),a=t/n,o=a>1?ft/a:1,s=dt/o,c=e.length-1;for(let t=0;t<r;t+=1){let n=t*a,r=Math.max(0,Math.ceil(n-s)),l=Math.min(c,Math.floor(n+s)),u=0,d=0;for(let t=r;t<=l;t+=1){let r=t-n,i=.5+.5*Math.cos(Math.PI*r/s),a=o*pt(o*r)*i;u+=a*e[t],d+=a}i[t]=d===0?0:u/d}return i}var ht={silenceMs:800,minSpeechMs:150,preRollMs:300,maxUtteranceMs:3e4,sensitivity:.5,calibrateMs:300},gt=.0015,_t=.003,vt=.006,yt=.2,bt=.02,xt=2e3,St=250;function Ct(e,t,n){return Math.min(n,Math.max(t,e))}function wt(e={}){let t=(e,t,n)=>typeof e==`number`&&Number.isFinite(e)?Math.max(n,e):t;return{silenceMs:t(e.silenceMs,ht.silenceMs,20),minSpeechMs:t(e.minSpeechMs,ht.minSpeechMs,0),preRollMs:t(e.preRollMs,ht.preRollMs,0),maxUtteranceMs:t(e.maxUtteranceMs,ht.maxUtteranceMs,1e3),sensitivity:Ct(typeof e.sensitivity==`number`&&Number.isFinite(e.sensitivity)?e.sensitivity:ht.sensitivity,0,1),calibrateMs:t(e.calibrateMs,ht.calibrateMs,0)}}function Tt(e){let t=e.length;if(t===0)return 0;let n=0;for(let r=0;r<t;r++){let t=e[r];n+=t*t}return Math.sqrt(n/t)}function Et(e={}){let t=wt(e),n=6-4*t.sensitivity,r=.02-.015*t.sensitivity,i=_t,a=0,o=[],s=!1,c=0,l=0,u=0,d=()=>Math.max(i*n,r),f=()=>Math.max(d()*.6,i*1.5),p=()=>{s=!1,c=0,l=0,u=0};return{get speaking(){return s},get noiseFloor(){return i},get threshold(){return d()},push(e,n=20){let r=[],m=Number.isFinite(e)?Math.max(0,e):0,h=Ct(m/(d()*3),0,1),g=a<t.calibrateMs;if(g&&(a+=n,!s)){o.push(m);let e=[...o].sort((e,t)=>e-t);i=Ct(e[Math.min(e.length-1,Math.floor(e.length*yt))]??_t,gt,vt)}if(!s){if(m>d())c+=n,c>=t.minSpeechMs&&(s=!0,l=0,u=c,r.push({type:`start`,leadMs:t.preRollMs+c}),c=0);else if(g)c=0;else{c=0;let e=n/xt*(m<i?4:1);i=Ct(i+(m-i)*Math.min(1,e),gt,bt)}return{events:r,level:h,speaking:s}}return u+=n,m>f()?l=0:l+=n,l>=t.silenceMs?(r.push({type:`end`,reason:`silence`,trailingSilenceMs:l}),p()):u>=t.maxUtteranceMs&&(r.push({type:`split`}),u=0,l=0),{events:r,level:h,speaking:s}},flush(){let e=[];return s&&e.push({type:`end`,reason:`flush`,trailingSilenceMs:l}),p(),e}}}function Dt(e){let t=wt(e),n=Et(t),r=Math.max(1,Math.round(e.sampleRate*20/1e3)),i=r/e.sampleRate*1e3,a=Math.ceil((t.preRollMs+t.minSpeechMs)/i)+1,o=[],s=new Float32Array,c=null,l=!1,u=(t,n,r)=>{let a=Math.max(0,Math.floor((r-St)/i)),o=t.slice(0,Math.max(1,t.length-a)),s=0;for(let e of o)s+=e.length;let c=new Float32Array(s),l=0;for(let e of o)c.set(e,l),l+=e.length;e.onUtterance({pcm:c,sampleRate:e.sampleRate,durationMs:s/e.sampleRate*1e3,reason:n})},d=t=>{t!==l&&(l=t,e.onSpeaking?.(t))},f=s=>{let l=n.push(Tt(s),i);e.onLevel?.(l.level),o.push(s),o.length>a&&o.shift(),c&&c.push(s);for(let e of l.events)if(e.type===`start`){c=[...o];let e=Math.ceil(t.preRollMs/i),n=Math.max(0,o.length-Math.ceil(t.minSpeechMs/i));for(let t=n;t<e;t++)c.unshift(new Float32Array(r))}else if(e.type===`end`){let t=c??[];c=null,o.length=0,t.length>0&&u(t,e.reason,e.trailingSilenceMs)}else if(e.type===`split`){let e=c??[];c=[],e.length>0&&u(e,`max`,0)}d(n.speaking)};return{get speaking(){return n.speaking},segmenter:n,push(e){let t=e;s.length>0&&(t=new Float32Array(s.length+e.length),t.set(s,0),t.set(e,s.length));let n=0;for(;n+r<=t.length;)f(t.slice(n,n+r)),n+=r;s=t.slice(n)},flush(){let t=n.flush();for(let e of t)e.type===`end`&&c&&c.length>0&&u(c,`flush`,e.trailingSilenceMs);c=null,o.length=0,s=new Float32Array,d(!1),e.onLevel?.(0)},discard(){n.flush(),c=null,o.length=0,s=new Float32Array,d(!1),e.onLevel?.(0)}}}var Ot=44,kt=4294967295,At=1;function jt(e){let t=new Int16Array(e.length);for(let n=0;n<e.length;n+=1){let r=e[n];Number.isNaN(r)||(t[n]=Math.min(32767,Math.round((r>1?1:r<-1?-1:r)*32768)))}return t}function Mt(e,t){if(!Number.isInteger(e)||e<1||e*2>kt)throw new Pe(`invalid_argument`,`${t} must be a positive integer sample rate (got ${String(e)})`)}function Nt(e,t,n){for(let r=0;r<n.length;r+=1)e.setUint8(t+r,n.charCodeAt(r))}function Pt(e,t){Mt(t,`sampleRate`);let n=e.length*2;if(n+Ot-8>kt)throw new Pe(`invalid_argument`,`too many samples for a single WAV (4 GiB limit)`);let r=e instanceof Int16Array?e:jt(e),i=new Uint8Array(Ot+n),a=new DataView(i.buffer);Nt(a,0,`RIFF`),a.setUint32(4,36+n,!0),Nt(a,8,`WAVE`),Nt(a,12,`fmt `),a.setUint32(16,16,!0),a.setUint16(20,At,!0),a.setUint16(22,1,!0),a.setUint32(24,t,!0),a.setUint32(28,t*2,!0),a.setUint16(32,2,!0),a.setUint16(34,16,!0),Nt(a,36,`data`),a.setUint32(40,n,!0);for(let e=0;e<r.length;e+=1)a.setInt16(Ot+e*2,r[e],!0);return i}var Ft=`hv-pcm-tap`,It=`
|
|
2
|
+
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,J as d,K as f,L as p,Lt as m,Mt as h,Ot as g,P as _,Pt as v,R as y,Rt as b,T as x,U as S,W as C,X as w,Y as T,Z as E,_ as D,_t as O,a as k,bt as A,ct as j,d as ee,dt as M,f as N,ft as P,gt as F,ht as I,k as te,kt as L,lt as R,mt as z,n as ne,nt as re,ot as ie,pt as B,q as ae,rt as oe,st as V,tt as se,v as H,vt as U,xt as ce,yt as le,z as W}from"./DG3qFFTE.js";import{t as G}from"./BaNbYf_w.js";import"./xihTtKlq.js";import{r as ue}from"./BLUInGBV.js";import{a as K,t as q}from"./Bq8E3AWP.js";import{B as de,Pt as fe,R as J,W as pe}from"./Zte-WUy-.js";import{n as Y}from"./DK8Blf1Y.js";import{C as me,S as X,b as he,x as ge}from"./b-_V29X7.js";import{n as _e,r as ve}from"./v8gneLl4.js";import{i as ye}from"./C-A_haB1.js";import{_ as be,b as xe,c as Se,d as Ce,g as we,h as Te,i as Ee,m as De,n as Oe,p as ke,s as Ae}from"./CGVkRTMI.js";import{n as je}from"./BYwZ_UeC.js";import{n as Me,r as Ne}from"./CsPuvW_W.js";import{c as Pe,t as Fe}from"./eBF8D7GD.js";import{_ as Ie,a as Le,g as Re,h as ze,l as Be,n as Ve,p as He,u as Ue}from"./DQOroCMN.js";import{Q as Z,b as We,t as Ge}from"./Dvyr8zQc.js";import{C as Ke,_ as qe,h as Je,i as Ye,m as Xe,o as Ze,r as Qe,t as $e,u as et}from"./BRCZe8R4.js";import{n as tt,t as nt}from"./BUdNw_R5.js";function rt(e,t){let n=t.trim();if(!n)return;let r=e.value,i=typeof document<`u`&&document.activeElement===e,a=e.selectionStart??r.length,o=e.selectionEnd??r.length;!i&&a===0&&o===0&&r.length>0&&(a=r.length,o=r.length);let s=r.slice(0,a),c=r.slice(o),l=`${s.length>0&&!/\s$/.test(s)?` `:``}${n}${/^[\p{L}\p{N}]/u.test(c)?` `:``}`;e.value=`${s}${l}${c}`;let u=s.length+l.length;try{e.setSelectionRange(u,u)}catch{}e.dispatchEvent(new Event(`input`,{bubbles:!0}))}function it(e){let t=e,n=null,r=null,i=0,a=0,o=null,s=!1,c=!1,l=null;function u(){n&&clearTimeout(n),n=null}function d(){u(),r=null,o=null,s=!1}function f(){n&&(d(),t.onCancel?.())}function p(e){let n=!t.filter||t.filter(e);return n?n===!0?e.target instanceof Element?e.target:null:n:null}function m(){c=!0,l&&clearTimeout(l),l=setTimeout(()=>{c=!1,l=null},400)}return{handlePointerDown(e){if(t.disabled||!e.isPrimary||e.pointerType===`mouse`&&e.button!==0)return;let c=p(e);if(!c)return;d(),r=e.pointerId,i=e.clientX,a=e.clientY,o={target:c,pointerType:e.pointerType||`mouse`,clientX:e.clientX,clientY:e.clientY},t.onPressStart?.(o);let l=o;n=setTimeout(()=>{n=null,s=!0,t.onLongPress(l)},t.delay??500)},handlePointerMove(e){if(!n||e.pointerId!==r)return;let o=t.moveTolerance??10;Math.hypot(e.clientX-i,e.clientY-a)>o&&f()},handlePointerUp(e){if(e.pointerId===r){if(n)f();else if(s&&o){let e=o;m(),d(),t.onRelease?.(e)}else d()}},handlePointerCancel(e){if(e.pointerId===r){if(n)f();else if(s&&o){let e=o;d(),t.onRelease?.(e)}else d()}},handleDragStart(){f()},handleContextMenu(e){t.preventContextMenu&&(n||s)&&e.preventDefault()},handleClick(e){c&&(c=!1,l&&clearTimeout(l),l=null,e.preventDefault(),e.stopPropagation())},cancel(){d()},update(e){t=e,e.disabled&&d()},get pending(){return n!==null},get fired(){return s}}}function at(e,t){let n=it(t),r=e=>n.handlePointerDown(e),i=e=>n.handlePointerMove(e),a=e=>n.handlePointerUp(e),o=e=>n.handlePointerCancel(e),s=()=>n.handleDragStart(),c=e=>n.handleContextMenu(e),l=e=>n.handleClick(e);return e.addEventListener(`pointerdown`,r),e.addEventListener(`dragstart`,s),e.addEventListener(`contextmenu`,c),e.addEventListener(`click`,l,!0),window.addEventListener(`pointermove`,i),window.addEventListener(`pointerup`,a),window.addEventListener(`pointercancel`,o),{update(e){n.update(e)},destroy(){n.cancel(),e.removeEventListener(`pointerdown`,r),e.removeEventListener(`dragstart`,s),e.removeEventListener(`contextmenu`,c),e.removeEventListener(`click`,l,!0),window.removeEventListener(`pointermove`,i),window.removeEventListener(`pointerup`,a),window.removeEventListener(`pointercancel`,o)}}}var ot=new WeakMap;async function st(e,t={}){let n=Math.max(0,t.quietMs??120),r=Math.max(0,t.timeoutMs??5e3),i=Date.now(),a=()=>Math.max(0,r-(Date.now()-i)),o=e=>new Promise(t=>setTimeout(t,e));for(;;){let n=ot.get(e);if(!n||n.size===0||t.signal?.aborted)break;let r=a();if(r===0)return;await Promise.race([Promise.all([...n]),o(r)])}t.signal?.aborted||a()===0||await new Promise(r=>{let i=null,o=[],s=()=>{i&&clearTimeout(i),clearTimeout(l);for(let e of o)e();t.signal?.removeEventListener(`abort`,s),r()},c=()=>{i&&clearTimeout(i),i=setTimeout(s,n)},l=setTimeout(s,a());t.signal?.addEventListener(`abort`,s,{once:!0}),o.push(e.subscribe(e=>{(e.type===`registered`||e.type===`unregistered`)&&c()}));for(let e of t.alsoWatch??[]){let t=e?.subscribe?.(()=>c());t&&o.push(t)}c()})}async function ct(e={}){let t=e.window??(typeof window<`u`?window:void 0),n=e.navigator??(typeof navigator<`u`?navigator:void 0);return!t||!(`SpeechRecognition`in t)&&!(`webkitSpeechRecognition`in t)?`missing`:n&&`brave`in n&&n.brave||/\bElectron\//.test(n?.userAgent??``)?`unreliable`:`works`}function lt(e){return new Worker(new URL(`../workers/local-speech.worker-BzGX7Qdn.js`,import.meta.url).href,{name:e?.name})}var ut=2**28,dt=16,ft=.95;function pt(e){if(e===0)return 1;let t=Math.PI*e;return Math.sin(t)/t}function mt(e,t,n){for(let[e,r]of[[`fromRate`,t],[`toRate`,n]])if(!Number.isFinite(r)||r<=0)throw new Pe(`invalid_argument`,`${e} must be a positive finite number (got ${String(r)})`);let r=Math.floor(e.length*n/t);if(r>ut)throw new Pe(`invalid_argument`,`resampled output would be ${r} samples; the limit is ${ut}`);if(t===n)return e.slice();let i=new Float32Array(r),a=t/n,o=a>1?ft/a:1,s=dt/o,c=e.length-1;for(let t=0;t<r;t+=1){let n=t*a,r=Math.max(0,Math.ceil(n-s)),l=Math.min(c,Math.floor(n+s)),u=0,d=0;for(let t=r;t<=l;t+=1){let r=t-n,i=.5+.5*Math.cos(Math.PI*r/s),a=o*pt(o*r)*i;u+=a*e[t],d+=a}i[t]=d===0?0:u/d}return i}var ht={silenceMs:800,minSpeechMs:150,preRollMs:300,maxUtteranceMs:3e4,sensitivity:.5,calibrateMs:300},gt=.0015,_t=.003,vt=.006,yt=.2,bt=.02,xt=2e3,St=250;function Ct(e,t,n){return Math.min(n,Math.max(t,e))}function wt(e={}){let t=(e,t,n)=>typeof e==`number`&&Number.isFinite(e)?Math.max(n,e):t;return{silenceMs:t(e.silenceMs,ht.silenceMs,20),minSpeechMs:t(e.minSpeechMs,ht.minSpeechMs,0),preRollMs:t(e.preRollMs,ht.preRollMs,0),maxUtteranceMs:t(e.maxUtteranceMs,ht.maxUtteranceMs,1e3),sensitivity:Ct(typeof e.sensitivity==`number`&&Number.isFinite(e.sensitivity)?e.sensitivity:ht.sensitivity,0,1),calibrateMs:t(e.calibrateMs,ht.calibrateMs,0)}}function Tt(e){let t=e.length;if(t===0)return 0;let n=0;for(let r=0;r<t;r++){let t=e[r];n+=t*t}return Math.sqrt(n/t)}function Et(e={}){let t=wt(e),n=6-4*t.sensitivity,r=.02-.015*t.sensitivity,i=_t,a=0,o=[],s=!1,c=0,l=0,u=0,d=()=>Math.max(i*n,r),f=()=>Math.max(d()*.6,i*1.5),p=()=>{s=!1,c=0,l=0,u=0};return{get speaking(){return s},get noiseFloor(){return i},get threshold(){return d()},push(e,n=20){let r=[],m=Number.isFinite(e)?Math.max(0,e):0,h=Ct(m/(d()*3),0,1),g=a<t.calibrateMs;if(g&&(a+=n,!s)){o.push(m);let e=[...o].sort((e,t)=>e-t);i=Ct(e[Math.min(e.length-1,Math.floor(e.length*yt))]??_t,gt,vt)}if(!s){if(m>d())c+=n,c>=t.minSpeechMs&&(s=!0,l=0,u=c,r.push({type:`start`,leadMs:t.preRollMs+c}),c=0);else if(g)c=0;else{c=0;let e=n/xt*(m<i?4:1);i=Ct(i+(m-i)*Math.min(1,e),gt,bt)}return{events:r,level:h,speaking:s}}return u+=n,m>f()?l=0:l+=n,l>=t.silenceMs?(r.push({type:`end`,reason:`silence`,trailingSilenceMs:l}),p()):u>=t.maxUtteranceMs&&(r.push({type:`split`}),u=0,l=0),{events:r,level:h,speaking:s}},flush(){let e=[];return s&&e.push({type:`end`,reason:`flush`,trailingSilenceMs:l}),p(),e}}}function Dt(e){let t=wt(e),n=Et(t),r=Math.max(1,Math.round(e.sampleRate*20/1e3)),i=r/e.sampleRate*1e3,a=Math.ceil((t.preRollMs+t.minSpeechMs)/i)+1,o=[],s=new Float32Array,c=null,l=!1,u=(t,n,r)=>{let a=Math.max(0,Math.floor((r-St)/i)),o=t.slice(0,Math.max(1,t.length-a)),s=0;for(let e of o)s+=e.length;let c=new Float32Array(s),l=0;for(let e of o)c.set(e,l),l+=e.length;e.onUtterance({pcm:c,sampleRate:e.sampleRate,durationMs:s/e.sampleRate*1e3,reason:n})},d=t=>{t!==l&&(l=t,e.onSpeaking?.(t))},f=s=>{let l=n.push(Tt(s),i);e.onLevel?.(l.level),o.push(s),o.length>a&&o.shift(),c&&c.push(s);for(let e of l.events)if(e.type===`start`){c=[...o];let e=Math.ceil(t.preRollMs/i),n=Math.max(0,o.length-Math.ceil(t.minSpeechMs/i));for(let t=n;t<e;t++)c.unshift(new Float32Array(r))}else if(e.type===`end`){let t=c??[];c=null,o.length=0,t.length>0&&u(t,e.reason,e.trailingSilenceMs)}else if(e.type===`split`){let e=c??[];c=[],e.length>0&&u(e,`max`,0)}d(n.speaking)};return{get speaking(){return n.speaking},segmenter:n,push(e){let t=e;s.length>0&&(t=new Float32Array(s.length+e.length),t.set(s,0),t.set(e,s.length));let n=0;for(;n+r<=t.length;)f(t.slice(n,n+r)),n+=r;s=t.slice(n)},flush(){let t=n.flush();for(let e of t)e.type===`end`&&c&&c.length>0&&u(c,`flush`,e.trailingSilenceMs);c=null,o.length=0,s=new Float32Array,d(!1),e.onLevel?.(0)},discard(){n.flush(),c=null,o.length=0,s=new Float32Array,d(!1),e.onLevel?.(0)}}}var Ot=44,kt=4294967295,At=1;function jt(e){let t=new Int16Array(e.length);for(let n=0;n<e.length;n+=1){let r=e[n];Number.isNaN(r)||(t[n]=Math.min(32767,Math.round((r>1?1:r<-1?-1:r)*32768)))}return t}function Mt(e,t){if(!Number.isInteger(e)||e<1||e*2>kt)throw new Pe(`invalid_argument`,`${t} must be a positive integer sample rate (got ${String(e)})`)}function Nt(e,t,n){for(let r=0;r<n.length;r+=1)e.setUint8(t+r,n.charCodeAt(r))}function Pt(e,t){Mt(t,`sampleRate`);let n=e.length*2;if(n+Ot-8>kt)throw new Pe(`invalid_argument`,`too many samples for a single WAV (4 GiB limit)`);let r=e instanceof Int16Array?e:jt(e),i=new Uint8Array(Ot+n),a=new DataView(i.buffer);Nt(a,0,`RIFF`),a.setUint32(4,36+n,!0),Nt(a,8,`WAVE`),Nt(a,12,`fmt `),a.setUint32(16,16,!0),a.setUint16(20,At,!0),a.setUint16(22,1,!0),a.setUint32(24,t,!0),a.setUint32(28,t*2,!0),a.setUint16(32,2,!0),a.setUint16(34,16,!0),Nt(a,36,`data`),a.setUint32(40,n,!0);for(let e=0;e<r.length;e+=1)a.setInt16(Ot+e*2,r[e],!0);return i}var Ft=`hv-pcm-tap`,It=`
|
|
3
3
|
class HvPcmTap extends AudioWorkletProcessor {
|
|
4
4
|
process(inputs) {
|
|
5
5
|
const channels = inputs[0];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{D as e,M as t,w as n}from"./
|
|
1
|
+
import{D as e,M as t,w as n}from"./Zte-WUy-.js";import{r}from"./DqF3UNFg.js";var i=`@happyvertical/smrt-assets:Asset`,a=`@happyvertical/smrt-products:ProductAsset`,o=`assets.library`;function s(e,t,n){let r=new Map(t.map(e=>[e.id,e]));return n.filter(t=>t.productId===e).flatMap(e=>{let t=r.get(String(e.assetId)),n=t?.sourceUri;return!t||typeof n!=`string`?[]:[{id:t.id,name:String(t.name??`Product image`),sourceUri:n,mimeType:String(t.mimeType??`image/*`),description:String(t.description??``),sortOrder:Number(e.sortOrder??0)}]}).sort((e,t)=>e.sortOrder-t.sortOrder||e.name.localeCompare(t.name))}function c(e,t,n,o){return[{op:`save`,as:`asset`,model:r(i),values:{name:t.name||`Product image`,sourceUri:n,mimeType:t.type||`image/*`,description:`Image selected for this product in the browser demo.`,sourceType:`browser-demo`}},{op:`save`,model:r(a),values:{productId:e,assetId:{ref:`asset`},relationship:`gallery`,sortOrder:o}}]}function l(e,t){return t.filter(t=>t.productId===e).flatMap(e=>[{op:`delete`,model:r(a),id:e.id},{op:`delete`,model:r(i),id:String(e.assetId)}])}var u=`@happyvertical/smrt-products:Product`,d=`@happyvertical/smrt-products:ProductVariant`,f=`@happyvertical/smrt-products:Sku`,p=`@happyvertical/smrt-inventory:StockLevel`,m=`@happyvertical/smrt-profiles:ProfileType`,h=`@happyvertical/smrt-inventory:InventoryLocation`;function g(r){return{[h]:{from:[],make:()=>(t().locations??[]).map((e,t)=>({id:n(`${h}:sample:${t}`),...e,placeId:``,active:!0}))},[f]:{from:[r(u)],make:([e])=>(e??[]).map((e,t)=>({id:n(`${f}:sample:${e.id}`),productId:e.id,code:`SKU-${String(t+1).padStart(3,`0`)}`,barcode:``,name:String(e.name??``),attributes:``,parentSkuId:``,active:!0}))},[p]:{from:[r(f),r(h)],make:([r,i])=>{let a=t(),o=new Map(a.products.map(e=>[e.name,e.at]));return(r??[]).flatMap(t=>(i??[]).flatMap((r,i)=>{let a=e(`${t.id}:${r.id}`),s=o.get(String(t.name));if(s!==void 0){if(s!==i)return[]}else if(i>0&&a%3==0)return[];let c=10+a%4*5;return[{id:n(`${p}:sample:${t.id}:${r.id}`),skuId:t.id,locationId:r.id,state:`available`,qty:a%5==0?c-3:c+a%40,reorderPoint:c,reorderQuantity:c*3}]}))}}}}function _(e,t){let n=new Map(e.map(e=>[e.id,e.productId])),r=new Map;for(let e of t){let t=n.get(String(e.skuId));typeof t==`string`&&r.set(t,(r.get(t)??0)+Number(e.qty??0))}return r}function v(e,t,n,r=[]){return[...l(e,r),...t.flatMap(e=>[{op:`delete`,model:n(p),match:{skuId:e.id}},{op:`delete`,model:n(f),id:e.id}]),{op:`delete`,model:n(d),match:{productId:e}},{op:`delete`,model:n(u),id:e}]}export{d as a,g as c,a as d,c as f,p as i,i as l,m as n,v as o,s as p,f as r,_ as s,u as t,o as u};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{$ as e,B as t,Ct as n,D as r,Dt as i,E as a,Ft as o,G as s,H as c,J as l,L as u,Ot as d,Pt as f,U as p,W as m,X as h,Y as g,a as _,b as v,bt as y,ct as b,ft as x,ht as S,mt as C,pt as w,st as T,v as E,vt as D}from"./DG3qFFTE.js";import"./xihTtKlq.js";import{n as O}from"./DK8Blf1Y.js";import{n as k}from"./v8gneLl4.js";import{b as A,i as j,x as M}from"./CGVkRTMI.js";import{A as N,D as P,E as F,O as I,T as L,_ as R,i as z,k as B,n as V,r as ee,t as H,v as U,w as te}from"./
|
|
1
|
+
import{$ as e,B as t,Ct as n,D as r,Dt as i,E as a,Ft as o,G as s,H as c,J as l,L as u,Ot as d,Pt as f,U as p,W as m,X as h,Y as g,a as _,b as v,bt as y,ct as b,ft as x,ht as S,mt as C,pt as w,st as T,v as E,vt as D}from"./DG3qFFTE.js";import"./xihTtKlq.js";import{n as O}from"./DK8Blf1Y.js";import{n as k}from"./v8gneLl4.js";import{b as A,i as j,x as M}from"./CGVkRTMI.js";import{A as N,D as P,E as F,O as I,T as L,_ as R,i as z,k as B,n as V,r as ee,t as H,v as U,w as te}from"./CzOwak4Z.js";import{nt as W}from"./Dvyr8zQc.js";var ne=s(`<p class="notice svelte-19u3zp7" role="status"> </p>`),G=s(`<option> </option>`),re=s(`<label class="svelte-19u3zp7">Assistant mode <!></label> <p class="meta svelte-19u3zp7">Changing modes happens only when you choose it here.</p>`,1),ie=s(`<p class="status svelte-19u3zp7">Inference off</p> <p class="meta svelte-19u3zp7">Build, edit, validate and export your cookbook without a model. No
|
|
2
2
|
provider is contacted and no browser model is downloaded.</p>`,1),ae=s(`<p class="status svelte-19u3zp7">Server</p> <p class="meta svelte-19u3zp7">This site's server answers the assistant. What you type, and a short
|
|
3
3
|
summary of your plan, is sent to it. Nothing is downloaded.</p>`,1),oe=s(`<p class="meta svelte-19u3zp7">A key is saved for another address, so it is not used here. Paste it again for this address.</p>`),se=s(`<div class="field svelte-19u3zp7"><!> <!></div> <!> <p class="meta svelte-19u3zp7"> <button class="link svelte-19u3zp7" type="button">Forget the key</button></p>`,1),ce=s(`<p class="meta svelte-19u3zp7"><strong>Browser access.</strong> </p>`),le=s(`<p> </p>`),ue=s(`<p class="status svelte-19u3zp7" role="status"> </p>`),de=s(`<label class="svelte-19u3zp7">Model provider <!></label> <div class="field svelte-19u3zp7"><!> <!></div> <div class="field svelte-19u3zp7"><!> <!></div> <!> <!> <p class="meta svelte-19u3zp7">What you type, and a short summary of your plan, is sent to this
|
|
4
4
|
endpoint.</p> <!> <!> <div class="actions svelte-19u3zp7"><!> <!></div>`,1),fe=s(`<p role="status" class="svelte-19u3zp7">This browser has no WebGPU, which the model needs. Try a recent
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./
|
|
2
|
-
import{$ as e,Et as t,Mt as n,bt as r,vt as i}from"./DG3qFFTE.js";import{t as a}from"./BaNbYf_w.js";import"./xihTtKlq.js";import{I as o,L as s,O as c,Q as l,St as u,W as d,Z as f,_ as p,_t as m,bt as h,et as g,h as _,ht as v,p as y,x as b,yt as x}from"./DormgCOG.js";import{v as S}from"./DyGJXtfQ.js";import"./v8gneLl4.js";import"./DIE02RSm.js";import{u as ee}from"./BCruEZ83.js";import{A as C,C as te,E as ne,F as re,G as ie,I as ae,M as oe,N as se,O as ce,P as le,T as ue,U as de,V as fe,W as w,b as pe,h as me,j as he,k as ge,n as _e,q as ve,r as ye,w as be}from"./QD5OfFAp.js";import{B as xe,D as Se,G as Ce,H as we,J as Te,K as Ee,M as De,V as Oe,X as ke,Y as Ae,Z as je,a as Me,b as T,c as Ne,d as Pe,l as Fe,n as Ie,r as Le,s as Re,t as E,v as ze,x as D,z as Be}from"./2JTcL7GS.js";function Ve(e){let t=e?.surfaces?.find(e=>e.kind===`widget`&&e.sectionDefault===!0);return t?{id:t.type,type:t.type,span:4,options:{}}:void 0}function He(e){let t=e.lastIndexOf(`#`);if(t<=0||t===e.length-1)return null;let n=e.slice(0,t),r=e.slice(t+1);return n.startsWith(`.`)||n.startsWith(`/`)||/\s/.test(n)||!/^[A-Za-z_$][\w$]*$/.test(r)?null:{specifier:n,exportName:r}}function O(e,t){let n=He(e);return n?Promise.resolve(t(n.specifier,n.exportName)).then(t=>{if(t==null)throw Error(`export "${e}" was not found`);return t}):Promise.reject(Error(`invalid export ref "${e}"`))}function k(e){let t;return()=>(t??=e(),t)}function Ue(e){return typeof e==`object`&&!!e&&`default`in e&&!!e.default}function We(e,t,n){let r=k(()=>O(e.export,t)),i=e.optionsEditor?k(()=>O(e.optionsEditor,t)):void 0,a=e.data?.load?k(()=>O(e.data?.load,t)):void 0,o={type:e.type,title:e.label,options:e.options??[],loadComponent:async()=>{let e=await r();return Ue(e)?e.default:e}};return e.description!==void 0&&(o.description=e.description),e.icon!==void 0&&(o.icon=e.icon),e.version!==void 0&&(o.version=e.version),e.allowedIn&&(o.allowedIn=e.allowedIn),e.defaultSpan!==void 0&&(o.defaultSpan=e.defaultSpan),e.minSpan!==void 0&&(o.minSpan=e.minSpan),e.maxSpan!==void 0&&(o.maxSpan=e.maxSpan),n&&(o.migrate=n),i&&(o.loadOptionsEditor=async()=>{let e=await i();return Ue(e)?e.default:e}),a&&(o.load=async(t,n)=>{let r=await a();if(typeof r!=`function`)throw Error(`loader "${e.data?.load}" is not a function`);return r(t,n)}),o}async function Ge(e,t,n,r={}){let i=[],a=[],o=[];for(let s of t)if(!r.enabled||r.enabled(s.id))for(let t of s.surfaces??[]){if(t.kind!==`widget`)continue;let c=(e,n)=>a.push({recipeId:s.id,type:t.type,reason:e,message:n});if(e.has(t.type)&&!r.replace){c(`duplicate_type`,`"${t.type}" is already registered`);continue}let l;if(t.migrate)try{let e=await O(t.migrate,n);if(typeof e!=`function`)throw Error(`not a function`);l=e}catch(e){c(`unresolved`,`migrate "${t.migrate}": ${e instanceof Error?e.message:String(e)}`);continue}try{o.push(e.register(We(t,n,l),{replace:r.replace})),i.push(t.type)}catch(e){c(`invalid`,e instanceof Error?e.message:String(e))}}return{registered:i,skipped:a,dispose:()=>{for(let e of o.splice(0))e()}}}var Ke=[`identifier`,`status`,`date`,`party`,`total`,`money`];function qe(e){for(let t of[`identifier`,`status`,`date`,`money`,`quantity`,`party`,`title`])if(e.includes(t))return t}function Je(e,t,n={}){let r=new Set(n.exclude??[]),i=n.max??4,a=Object.keys(t).filter(t=>!r.has(t)&&t in e.fields),o=e=>a.find(n=>t[n]?.includes(e)),s=[],c=e=>{e&&!s.includes(e)&&s.push(e)};c(o(`identifier`)??o(`title`));for(let e of Ke)e!==`identifier`&&(e===`money`&&s.some(e=>t[e]?.includes(`money`))||c(e===`date`?a.find(e=>t[e]?.includes(`date`)&&e!==`createdAt`&&e!==`updatedAt`)??o(`date`):o(e)));return s.slice(0,i).map(n=>({key:n,label:A(n,e),...qe(t[n]??[])?{role:qe(t[n]??[])}:{}}))}function Ye(e,t,n={}){let r=new Set(n.exclude??[]),i=Object.keys(t).filter(t=>!r.has(t)&&t in e.fields),a=i.filter(t=>e.fields[t]?.type===`text`),o=a.find(e=>/^(?:description|title|name|label)$/.test(e))??a.find(e=>t[e]?.includes(`title`))??a.find(e=>!t[e]?.includes(`identifier`)),s=i.find(e=>t[e]?.includes(`quantity`)),c=i.filter(e=>t[e]?.includes(`money`)),l=c.find(e=>/unit|price|rate/i.test(e)),u=c.find(e=>/^(?:amount|lineTotal|total|lineAmount)$/.test(e))??[...c].reverse().find(e=>e!==l),d=[];return o&&d.push({key:o,label:A(o,e)}),s&&d.push({key:s,label:A(s,e),role:`quantity`}),l&&d.push({key:l,label:A(l,e),role:`money`,summarize:!1}),u&&u!==l&&d.push({key:u,label:A(u,e),role:`money`}),d}function A(e,t){let n=t.fields[e];return n&&(n.type===`foreignKey`||n.type===`crossPackageRef`)&&/.[a-z]Id$/.test(e)?le(e.slice(0,-2)):le(e)}function Xe(e){if(e.dataWidgets&&e.page)return[e.page];let t=[{id:`shortcuts`,type:`shortcuts`,span:4,options:{}}];if(e.dataWidgets&&e.lead){let n=e.lead,r=e.override,i=r&&typeof r==`object`&&!Array.isArray(r)?r:void 0,a=i?.changed;a&&typeof a==`object`&&!Array.isArray(a)&&Object.hasOwn(a,`count`)&&!(Array.isArray(i?.removed)&&i.removed.includes(`count`))&&t.push({id:`count`,type:`metric`,span:1,options:{title:n.plural,model:n.id,measure:`count`}}),t.push({id:`latest`,type:`records`,span:4,options:{title:`${n.name} records`,model:n.id,limit:5,summaries:!1}})}return t}var Ze=[`text`,`integer`,`decimal`,`boolean`,`datetime`,`json`,`foreignKey`,`crossPackageRef`];function Qe(e){return Ze.includes(e)?e:`text`}var $e=/(Date|^date|period(Start|End))$/;function et(e,t){return t.type===`datetime`&&!t.system&&$e.test(t.name)&&!e.fields.some(e=>e.name===`allDay`)?`date`:void 0}function tt(e){return pe(e)[0]}function nt(e,t){let n=t.ui?{...t.ui}:void 0,r=c(t)?`money`:et(e,t);return{type:Qe(t.type),required:t.required,nullable:!t.required,...t.default===void 0?{}:{default:t.default},...t.description?{description:t.description}:{},...n?{ui:n}:{},...t.enum?.length?{enum:[...t.enum]}:{},...r?{format:r}:{},...tt(e)===t.name?{display:!0}:{}}}function rt(e,t){return e.includes(`:`)?e:`${t.slice(0,t.lastIndexOf(`:`))}:${e}`}function it(e,t){if(!t.related)return!1;let n=rt(t.related,e.id);return Ae(m,n,g).some(t=>t.id===e.id)}function at(e){return e.fields.flatMap(t=>{if(t.type!==`foreignKey`&&t.type!==`crossPackageRef`||!t.related)return[];let n=h(rt(t.related,e.id));return n?[{field:t.name,kind:t.type===`crossPackageRef`?`crossPackageRef`:`foreignKey`,relatedCollection:n.model.collection,...it(e,t)?{role:`items`}:{}}]:[]})}function j(e){let t=at(e);return{name:e.collection,objectRef:e.id,className:e.name,idField:`id`,fields:Object.fromEntries(e.fields.map(t=>[t.name,nt(e,t)])),...t.length?{relationships:t}:{}}}function ot(e,t){return{objectRef:e.id,fields:Object.fromEntries(t.map((e,t)=>[e.name,{visibility:`basic`,label:e.label,help:e.help??null,order:t,required:e.required}]))}}function st(e,t){let n=new Set(t);for(let t of e)for(let e of t.models)n.add(e);return n}function ct(e){return y(e.replace(/_?id$/i,``)||e)}function M(e,t,n){let r=ke(e,t),i=new Set(e.packages.flatMap(e=>(e.recipes??[]).filter(e=>e.exposure===`ui-only`).flatMap(e=>e.models))),a=je(e,t).filter(e=>(e.model.exposed||i.has(e.model.id))&&n.has(e.model.id)),o=new Set(Ae(e,t,g).map(e=>e.id)),s=new Map;for(let e of a)s.set(e.model.id,(s.get(e.model.id)??0)+1);let c=a.map(e=>{let t=o.has(e.model.id)?`items`:`children`,n=j(e.model),i=ae(n),a=[e.fk];return{model:e.model.id,field:e.fk,label:(s.get(e.model.id)??0)>1?`${Ce(e.model.name,r)} (${ct(e.fk).toLowerCase()})`:Ce(e.model.name,r),kind:t,columns:t===`items`?Ye(n,i,{exclude:a}):Je(n,i,{exclude:a,max:5}),...t===`items`&&`sortOrder`in n.fields?{sort:`sortOrder`}:{}}});for(let n of Ee(e,t))c.push({model:n.model.id,field:n.fk,label:ct(n.fk),kind:`reference`});return c}var lt=Symbol(`smrt-cookbook`);function ut(){return t(lt)}function dt(e,t){let{sections:n}=t;if(!n)throw Error(`the cookbook widget context is missing`);let r=typeof e.section==`string`?e.section:``,i=r?n.find(e=>e.id===`section:${r}`||e.id===`custom:${r}`)?.id:t.overviewId;if(!i)throw Error(`unknown section ${r}`);return se(n,i)}function ft(e){return e?async(t,n)=>{let r=dt(t,n);try{let t=await e(n,r.items.map(e=>({...e})));if(!Array.isArray(t))return r;let i=new Set,a=[];for(let e of t){if(!e||typeof e.href!=`string`)continue;let t=typeof e.id==`string`&&e.id?e.id:e.href;i.has(t)&&(t=`${t}#${a.length}`),i.add(t),a.push({...e,id:t})}return{items:a}}catch(e){if(n.signal?.aborted)throw e;return r}}:dt}var pt=new Set([`foreignKey`,`crossPackageRef`]);function N(e,t){return`/m/${e}/${t}/`}function mt(e,t,n,r=`view`){let i=`${N(e,t)}${encodeURIComponent(n)}/`;return r===`edit`?`${i}edit/`:i}function ht(e,t,n,r){return`${N(e,t)}?${encodeURIComponent(n)}=${encodeURIComponent(r)}`}function gt(e,t){let n=new URLSearchParams(e);for(let e of t.fields){if(!pt.has(e.type))continue;let t=n.get(e.name);if(t)return{field:e.name,equals:t}}}function _t(e){return e?.equals===void 0?``:`${encodeURIComponent(e.field)}=${encodeURIComponent(e.equals)}`}var P=e=>typeof e==`number`&&Number.isSafeInteger(e)?e:null,vt=(e,t)=>e.fields.some(e=>e.name===t);function yt(e,t){let n=ae(j(e)),r=te(t,n);return Object.values(r).some(e=>P(e)!==null)?r:void 0}function bt(e,t){return!!e.fields.find(e=>e.name===`status`)?.enum?.includes(`draft`)&&typeof t.status==`string`&&t.status!==``&&t.status!==`draft`}function xt(e,t,n){if(!bt(e,t)||![`subtotal`,`taxAmount`,`totalAmount`,`discountTotal`].every(t=>vt(e,t)))return;let r=P(t.subtotal),i=P(t.taxAmount),a=P(t.totalAmount),o=P(t.discountTotal)??0;if(r===null||i===null||a===null)return;let s=f(t,`exclusive`);return{subtotal:r,discount:o,tax:i,total:a,lineAmountType:s,roundingScope:l(t,`line`),showNetSubtotal:s===`inclusive`,taxes:v(n,s).flatMap(e=>e.taxComponentId?[{taxComponentId:e.taxComponentId,name:e.name,percent:e.percent,taxable:e.taxable,tax:e.tax}]:[])}}var F=fe();function I(e){let{source:t,href:n}=e;if(!t||!n)throw Error(`the planner widget context is missing`);return{source:t,href:n}}function L(e){let t=typeof e==`string`?h(e):void 0;if(!t)throw Error(`unknown model ${String(e)}`);return{model:t.model,packageId:t.pkg.id,path:N(t.pkg.id,t.model.name)}}var R=new Set([`foreignKey`,`crossPackageRef`]);function z(e,t,n){let r=e.filter;if(typeof r!=`string`||r===``)return;if(r!==`parent`)throw Error(`unknown filter ${r}`);let{record:i}=t;if(!i?.id)throw Error(`the parent filter needs a record`);let a=typeof e.parentField==`string`&&e.parentField?e.parentField:e.field,o=typeof a==`string`?a:``,s=n.fields.find(e=>e.name===o);if(!s||!R.has(s.type))throw Error(`${n.name} has no reference field ${o}`);return{field:o,id:i.id}}async function B(e,t,n){return n?e.listWhere(t,n.field,n.id):e.list(t)}function V(e,t,n){return e(n?ht(t.packageId,t.model.name,n.field,n.id):t.path)}var H=e=>typeof e==`number`&&Number.isFinite(e);async function St(e,t){let{source:n,href:r}=I(t),i=L(e.model),{model:a}=i,o=z(e,t,a),s=await B(n,a,o),l=V(r,i,o),u=typeof e.measure==`string`?e.measure:``;if(u===`count`||u===``)return{value:s.length,format:`integer`,href:l};let d=a.fields.find(t=>t.name===e.field);if(!d||d.type!==`integer`&&d.type!==`decimal`)throw Error(`${u} needs a numeric field of ${a.name}`);let f=s.map(e=>e[d.name]).filter(H),p=0;if(f.length){if(u===`sum`||u===`avg`)p=f.reduce((e,t)=>e+t,0),u===`avg`&&(p/=f.length);else if(u===`min`)p=Math.min(...f);else if(u===`max`)p=Math.max(...f);else throw Error(`unknown measure ${u}`)}let m=c(d);return{value:m?Math.round(p):p,format:m?`money`:d.type===`integer`?`integer`:`decimal`,...m?{currency:`USD`}:{},href:l}}function Ct(e,t){return H(e)&&H(t)?e-t:String(e??``).localeCompare(String(t??``))}var wt=new Set([`createdAt`,`updatedAt`]),Tt=[`identifier`,`status`,`date`,`money`,`quantity`,`party`,`title`];function Et(e=[]){return Tt.find(t=>e.includes(t))}function Dt(e,t,n,r){let i=j(e),a=r?[r]:[],o=oe(n),s=o.length?[]:me(E.apply(e).fields.filter(t=>!a.includes(t.name)&&!Se(e,t))).filter(e=>!e.derive),c=o.length?o:s.map(e=>e.name),l=[...Ye(i,t,{exclude:a}),...Je(i,t,{exclude:a,max:c.length+8})];return c.map(n=>{let r=e.fields.find(e=>e.name===n);if(!r)throw Error(`${e.name} has no field ${n}`);let i=l.find(e=>e.key===n),a=s.find(e=>e.name===n)?.label;if(i)return a?{...i,label:a}:i;let o=Et(t[n]);return{key:n,label:a??(R.has(r.type)?y(n.replace(/Id$/,``)):y(n)),...o?{role:o}:{}}})}var Ot=new Set([`money`,`quantity`]);function kt(e,t){let n={};for(let r of e)(r.summarize??Ot.has(r.role))&&(n[r.key]=t.reduce((e,t)=>{let n=t[r.key];return H(n)?e+n:e},0));return n}function At(e,t){let n=re(j(e)),r=new Set(t.map(e=>n?e[n]:void 0).filter(e=>typeof e==`string`&&e!==``));return r.size===1?[...r][0]??`USD`:`USD`}async function jt(e,t){let{source:n,href:r}=I(t),i=L(e.model),{model:a}=i,o=z(e,t,a),s=await B(n,a,o);if(typeof e.sort==`string`&&e.sort){if(!a.fields.find(t=>t.name===e.sort)&&!wt.has(e.sort))throw Error(`${a.name} has no field ${e.sort}`);let t=s.some(t=>t[e.sort]!==void 0)?e.sort:W(a)?.name;if(t){let n=e.direction===`asc`?1:-1;s=[...s].sort((e,r)=>n*Ct(e[t],r[t]))}}let c=Dt(a,ae(j(a)),e.columns,o?.field),l=H(e.limit)?e.limit:5,u=s.slice(0,l),d=a.fields.filter(e=>R.has(e.type)&&c.some(t=>t.key===e.name)),f=await ye(n,d,u),p=e=>Object.fromEntries(c.map(t=>{let n=e[t.key],r=d.find(e=>e.name===t.key);return r?.related&&typeof n==`string`&&n?[t.key,f.get(_(r.related,n))??``]:[t.key,n??null]})),m=kt(c,s),h=!Te(a);return{rows:await Promise.all(u.map(async e=>({id:String(e.id),title:await _e(n,a,e,0,o?.field),...h?{href:r(mt(i.packageId,a.name,String(e.id)))}:{},cells:p(e)}))),...e.summaries===!1?{}:{total:s.length},...h?{href:V(r,i,o)}:{},columns:c,currency:At(a,s),...Object.keys(m).length?{summaries:m}:{}}}var Mt={"7d":7,"30d":30,"90d":90,"12m":365,all:null},U=864e5;function Nt(e){return e===`7d`||e===`30d`?`day`:e===`90d`?`week`:`month`}function Pt(e,t){let n=new Date(e);if(t===`month`)return Date.UTC(n.getUTCFullYear(),n.getUTCMonth(),1);let r=Date.UTC(n.getUTCFullYear(),n.getUTCMonth(),n.getUTCDate());return t===`week`?r-(n.getUTCDay()+6)%7*U:r}function Ft(e,t){if(t===`month`){let t=new Date(e);return Date.UTC(t.getUTCFullYear(),t.getUTCMonth()+1,1)}return e+(t===`week`?7:1)*U}function It(e,t){let n=new Date(e).toISOString();return t===`month`?n.slice(0,7):n.slice(0,10)}var Lt=e=>e.type===`datetime`&&!e.system;function W(e){let t=e.fields.filter(Lt);return t.find(e=>/^(issue|order|start|created)/i.test(e.name))??t[0]}function Rt(e){if(typeof e!=`string`&&typeof e!=`number`)return;let t=new Date(e).getTime();return Number.isFinite(t)?t:void 0}async function zt(e,t){let{source:n,href:r}=I(t),i=L(e.model),{model:a}=i,o=z(e,t,a),s=typeof e.groupBy==`string`?e.groupBy:``,l=s?a.fields.find(e=>e.name===s):W(a);if(!l)throw Error(s?`${a.name} has no field ${s}`:`${a.name} has no date field to chart; choose a group-by field`);let u=typeof e.measure==`string`?e.measure:``,d;if(u&&u!==`count`){if(u!==`sum`&&u!==`avg`)throw Error(`unknown measure ${u}`);if(d=a.fields.find(t=>t.name===e.field),!d||d.type!==`integer`&&d.type!==`decimal`)throw Error(`${u} needs a numeric field of ${a.name}`)}let f=typeof e.period==`string`?e.period:`30d`;if(!Object.hasOwn(Mt,f))throw Error(`unknown period ${f}`);let p=Mt[f],m=Lt(l),h=m?l:W(a),g=p!==null&&h?b-p*U:-1/0,_=await B(n,a,o);h&&g!==-1/0&&(_=_.filter(e=>{let t=Rt(e[h.name]);return t!==void 0&&t>=g&&t<=b}));let v=new Map,y=(e,t,n)=>{let r=v.get(e)??{key:t,sum:0,n:0};if(d){let e=n[d.name];if(!H(e))return;r.sum+=e}r.n+=1,v.set(e,r)},x=Nt(f);if(m){let e=g===-1/0?Math.min(..._.map(e=>Rt(e[l.name])??b),b):g;for(let t=Pt(e,x);t<=b;t=Ft(t,x))v.set(It(t,x),{key:t,sum:0,n:0});for(let e of _){let t=Rt(e[l.name]);if(t===void 0)continue;let n=Pt(t,x);y(It(n,x),n,e)}}else for(let e of _){let t=e[l.name],n=t==null||t===``?`(none)`:String(t);y(n,n,e)}let S=d?c(d):!1,ee=e=>{if(!d)return e.n;let t=u===`avg`&&e.n?e.sum/e.n:e.sum;return S?Math.round(t):t},C=[...v.entries()].map(([e,t])=>({label:e,value:ee(t),key:t.key}));return C=m?C.sort((e,t)=>Number(e.key)-Number(t.key)):C.sort((e,t)=>t.value-e.value||e.label.localeCompare(t.label)),{points:C.map(({label:e,value:t})=>({label:e,value:t})),format:d?S?`money`:d.type===`integer`?`integer`:`decimal`:`integer`,...S?{currency:`USD`}:{},href:V(r,i,o)}}ne(F,{metric:St,records:jt,chart:zt,shortcuts:async(e,t)=>t,shortcuts:ft()});function Bt(e){let{relations:t,viewAllHref:n}=e;if(!t)throw Error(`the record page context is missing`);return{relations:t,records:jt,viewAllHref:n}}async function Vt(e,t){let{source:n}=I(e),r=e.record;if(!r?.id)throw Error(`line items need a record`);let{model:i}=L(r.model),a=await n.get(i,r.id);if(!a)return{};let o=t.find(e=>e.kind===`items`),s=o?h(o.model)?.model:void 0,c=xt(i,a,o&&s?await n.listWhere(s,o.field,r.id):[]),l=c?void 0:yt(i,a),u=re(j(i)),d=u?a[u]:void 0;return{...c?{storedTotals:c}:{},...l?{totals:l}:{},...typeof d==`string`&&d?{currency:d}:{}}}F.register(ue((e,t)=>ge(Bt(t))(e,t))),F.register(be(async(e,t)=>{let n=Bt(t),{totals:r,storedTotals:i,currency:a}=await Vt(t,n.relations);return ce({...n,totals:()=>r,storedTotals:()=>i,currency:()=>a})(e,t)}));var Ht=[`shortcuts`,`metric`,`records`,`chart`,`note`],Ut={"@happyvertical/smrt-reports/svelte":async()=>({SavedReportsWidget:(await a(async()=>{let{default:e}=await import(`./n-dBblBs.js`);return{default:e}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35]),import.meta.url)).default})},Wt=async(e,t)=>{let n=Ut[e];if(n)return(await n())[t]},Gt=T.filter(e=>e.surfaces?.some(e=>e.kind===`widget`)),Kt=Gt.flatMap(e=>(e.surfaces??[]).flatMap(e=>e.kind===`widget`?[e.type]:[]));Ge(F,Gt,Wt);var qt=new Map(Be(T).map(e=>[`section:${e.id}`,e])),Jt=m.packages.flatMap(e=>e.models.map(e=>e.id)),Yt=[...Ht,...Kt];function Xt(e){let t=qt.get(e);for(let e of t?.recipes??[]){let t=ze(e)[0];if(t)return{id:t.model.id,name:y(t.model.name)}}}function Zt(e,t){let n=Ve(qt.get(e)?.recipes[0]),r=Xt(e);return Xe({lead:r?{...r,plural:p(r.name)}:void 0,dataWidgets:!0,page:n&&Kt.includes(n.type)?n:void 0,override:t})}var Qt=new Map;function $t(e,t){if(!ve.test(e))return;let n=Qt.get(e);return n||(n=w({id:e,allowed:Yt,models:Jt,defaults:Zt(e)}),Qt.set(e,n)),t===void 0?n:w({...n,defaults:Zt(e,t)})}function en(e,t){return`detail:${e}.${t}`}var tn=new Map(m.packages.flatMap(e=>e.models.filter(u).map(t=>[he(t.id),{packageId:e.id,model:t}])));function nn(e){let[,t,n]=/^detail:([A-Za-z0-9_-]+)\.([A-Za-z0-9_]+)$/.exec(e)??[],r=t&&n?x(t,n):void 0;return t&&r&&u(r)?{packageId:t,model:r}:tn.get(e)}var rn=new Set(m.packages.flatMap(e=>e.models.filter(u).map(e=>e.id))),an=new Map;function on(e){let t=an.get(e);if(t)return t;let n=nn(e);if(!n)return;let r=M(m,n.model.id,rn),i=C(j(n.model),r,{id:e,maxMetrics:2*r.length});return t=w({...i,maxWidgets:Math.max(i.maxWidgets??24,i.defaults.length+24)}),an.set(e,t),t}function sn(e,t){let n=on(e),r=nn(e);if(!n||!r)return;let i=M(m,r.model.id,t),a=0,o=n.defaults.filter(e=>e.type===`line-items`?i.some(e=>e.kind===`items`):e.type===`related`?i.some(e=>e.kind===`children`):t.has(String(e.options.model))?e.type!==`metric`||(a+=1,a<=4):!1);return w({...n,defaults:o})}function cn(e,t){return e.startsWith(`detail:`)?on(e):$t(e,t)}function ln(e,t){return qt.has(e)||e===`section:${De.id}`?!0:e.startsWith(`detail:`)?nn(e)!==void 0:e.startsWith(`custom:`)&&ve.test(e)&&(t?.customSections??[]).some(t=>t.id===e)}var un=e=>typeof e==`object`&&!!e&&!Array.isArray(e);function dn(e,t){let n=t.widgetId?`widget ${t.widgetId}${t.type?` (${t.type})`:``}`:`an entry`,r=t.options?.length?`: ${t.options.map(e=>`${e.key} ${e.code}`).join(`, `)}`:``;return`Overview ${e}: ${n} was dropped (${t.code}${r}).`}function fn(e,t){let n={...e};return e.added&&(n.added=e.added.filter(e=>!t.has(e.id))),e.changed&&(n.changed=Object.fromEntries(Object.entries(e.changed).filter(([e])=>!t.has(e)))),n}function pn(e,t){let n=cn(e,t);if(!n)return{override:null,issues:[{widgetId:null,type:null,code:`malformed`,message:`not an overview id`}]};let r=de(n,t,F);if(r.ok){let e=ie(t).override?.changed?.count;return e&&n.defaults.some(e=>e.id===`count`)?{override:{...r.override??{version:1},changed:{...r.override?.changed,count:e}},issues:[]}:{override:r.override,issues:[]}}let i=ie(t),a=new Set(r.issues.flatMap(e=>e.widgetId?[e.widgetId]:[]));if(!i.override)return{override:null,issues:r.issues};let o=de(n,fn(i.override,a),F);return o.ok?{override:o.override,issues:r.issues}:{override:null,issues:[...r.issues,...o.issues]}}function mn(e,t){if(!un(e))return null;let n=[],r=[];for(let i of Object.keys(e).sort()){if(!ln(i,t)){r.push(`Overview ${i} is not a page in this app and was dropped.`);continue}let{override:a,issues:o}=pn(i,e[i]);for(let e of o)r.push(dn(i,e));a&&n.push([i,a])}return{overviews:Object.fromEntries(n),dropped:r}}var hn=ee,gn=`glass`,_n=`system`,vn=[`light`,`dark`,`system`],yn=[`none`,`sm`,`md`,`lg`,`xl`,`full`],bn=[`comfortable`,`touch`],xn=[`auto`,`standard`,`more`],G={"system-ui":`system-ui, -apple-system, "Segoe UI", sans-serif`,Inter:`Inter, system-ui, sans-serif`,Georgia:`Georgia, "Times New Roman", serif`,"ui-rounded":`ui-rounded, "SF Pro Rounded", system-ui, sans-serif`,"ui-monospace":`ui-monospace, "SF Mono", Menlo, monospace`},Sn=/^#?([0-9a-f]{3}|[0-9a-f]{6})$/i;function Cn(e){if(typeof e!=`string`)return null;let t=Sn.exec(e.trim());if(!t)return null;let n=t[1].toLowerCase();return n.length===3&&(n=[...n].map(e=>e+e).join(``)),`#${n}`}var wn=e=>typeof e==`object`&&!!e&&!Array.isArray(e);function Tn(e){if(e===void 0)return{ok:!0,theme:void 0};if(!wn(e))return{ok:!1,error:`The cookbook "theme" must be an object.`};let t={};if(e.preset!==void 0){if(typeof e.preset!=`string`||!hn.includes(e.preset))return{ok:!1,error:`The theme preset must be one of ${hn.join(`, `)}.`};t.preset=e.preset}if(e.colorScheme!==void 0){if(!vn.includes(e.colorScheme))return{ok:!1,error:`The theme colorScheme must be light, dark or system.`};t.colorScheme=e.colorScheme}for(let[n,r]of[[`borderRadius`,yn],[`density`,bn],[`contrast`,xn]]){let i=e[n];if(i!==void 0){if(!r.includes(i))return{ok:!1,error:`The theme ${n} must be one of ${r.join(`, `)}.`};t[n]=i}}if(e.fontFamily!==void 0){if(typeof e.fontFamily!=`string`||!Object.hasOwn(G,e.fontFamily))return{ok:!1,error:`The theme font must be one of ${Object.keys(G).join(`, `)}.`};t.fontFamily=e.fontFamily}if(e.custom!==void 0){if(!wn(e.custom))return{ok:!1,error:`The theme "custom" must be an object.`};let n=Cn(e.custom.primary);if(!n)return{ok:!1,error:`The theme custom primary must be a hex colour like #c2410c.`};let r={primary:n};if(e.custom.fontFamily!==void 0){let t=e.custom.fontFamily;if(typeof t!=`string`||!Object.hasOwn(G,t))return{ok:!1,error:`The theme font must be one of ${Object.keys(G).join(`, `)}.`};r.fontFamily=t}t.custom=r}if(e.customCss!==void 0){if(typeof e.customCss!=`string`)return{ok:!1,error:`The theme customCss must be a string.`};if(Array.from(e.customCss).length>65536)return{ok:!1,error:`The theme customCss is too long (65,536 characters maximum).`};e.customCss&&(t.customCss=e.customCss)}return{ok:!0,theme:Object.keys(t).length?t:void 0}}function En(e){if(!e)return;let t={};return e.preset&&(t.preset=e.preset),e.colorScheme&&(t.colorScheme=e.colorScheme),e.borderRadius&&(t.borderRadius=e.borderRadius),e.density&&(t.density=e.density),e.contrast&&(t.contrast=e.contrast),e.fontFamily&&(t.fontFamily=e.fontFamily),e.custom&&(t.custom={...e.custom}),e.customCss&&(t.customCss=e.customCss),Object.keys(t).length?t:void 0}function Dn(e){let t=e?.colorScheme??`system`,n=e?.custom?`brand colour ${e.custom.primary}`:e?.preset??`glass`;return t===`system`?n:`${n}, ${t}`}var K=`section:`;function On(e,t=xe(T)){let n=Object.keys(t).sort((e,t)=>t.length-e.length);if(!n.length)return e;let r=e=>{if(!e.startsWith(K))return e;let r=e.slice(8);for(let e of n){if(r===e)return`${K}${t[e]}`;if(r.startsWith(`${e}:`))return`${K}${t[e]}${r.slice(e.length)}`}return e},i=e=>e.startsWith(K)&&n.includes(e.slice(8)),a=e=>[...new Set(e)],o={...e};if(e.sectionOrder&&(o.sectionOrder=a(e.sectionOrder.map(r))),e.hidden&&(o.hidden=a(e.hidden.filter(e=>!i(e)).map(r))),e.itemOrder){let t={};for(let[n,i]of Object.entries(e.itemOrder)){let e=r(n);t[e]=a([...t[e]??[],...i.map(r)])}o.itemOrder=t}return e.moved&&(o.moved=Object.fromEntries(Object.entries(e.moved).map(([e,t])=>[r(e),r(t)]))),o}function kn(e,t=T){let n=new Map;for(let e of t){let t=we(e).id;for(let r of ze(e))r.key&&n.set(`${K}${t}:${r.packageId}:${r.model.name}:${r.label}`,Oe(r.packageId,r.model.name,r.key))}let r=e=>{let t=n.get(e);if(t)return t;if(!e.startsWith(K))return e;let r=e.slice(8).split(`:`);return r.length<3||!r[1]||!r[2]?e:Oe(r[1],r[2])},i=e=>[...new Set(e)],a=(e,t)=>{let n={};for(let[i,a]of Object.entries(e)){let e=r(i);e in n||(n[e]=t(a))}return n},o={...e};return e.hidden&&(o.hidden=i(e.hidden.map(r))),e.itemOrder&&(o.itemOrder=a(e.itemOrder,e=>i(e.map(r)))),e.moved&&(o.moved=a(e.moved,r)),e.items&&(o.items=a(e.items,e=>e)),o}var q=`https://s-m-r-t.dev/schemas/cookbook/v1.json`,An=new Set([`basic`,`advanced`,`hidden`]),jn=new Set([`api`,`mcp`,`cli`]),J=e=>({ok:!1,error:e}),Y=e=>typeof e==`object`&&!!e&&!Array.isArray(e),X=e=>Array.isArray(e)&&e.every(e=>typeof e==`string`);function Mn(e,t){if(!Y(e))return`${t} is not an object`;let{objectRef:n,fieldName:r}=e;if(typeof n!=`string`||!n)return`${t} has no objectRef`;if(typeof r!=`string`||!r)return`${t} has no fieldName`;if(e.scopeType!==`app`)return`${t} must have scopeType "app"`;let i={objectRef:n,fieldName:r,scopeType:`app`};for(let n of[`defaultValue`,`help`,`label`]){let r=e[n];if(r!==void 0){if(typeof r!=`string`&&r!==null)return`${t}.${n} is invalid`;i[n]=r}}if(e.visibility!==void 0){let n=e.visibility;if(n!==null&&!(typeof n==`string`&&An.has(n)))return`${t}.visibility is invalid`;i.visibility=n}if(e.displayOrder!==void 0){let n=e.displayOrder;if(n!==null&&!(typeof n==`number`&&Number.isFinite(n)))return`${t}.displayOrder is invalid`;i.displayOrder=n}if(e.locked!==void 0){if(e.locked!==null&&typeof e.locked!=`boolean`)return`${t}.locked is invalid`;i.locked=e.locked}return i}function Nn(e){if(!Y(e)||e.version!==1)return`layout must be an object with version 1`;for(let t of[`sectionOrder`,`hidden`])if(e[t]!==void 0&&!X(e[t]))return`layout.${t} must be a list of strings`;for(let t of[`itemOrder`,`moved`,`panels`])if(e[t]!==void 0&&!Y(e[t]))return`layout.${t} must be an object`;let t=e.itemOrder;if(Y(t)){for(let[e,n]of Object.entries(t))if(e===`__proto__`||!X(n))return`layout.itemOrder.${e} must be a list of strings`}let n=e.moved;if(Y(n)){for(let[e,t]of Object.entries(n))if(e===`__proto__`||typeof t!=`string`)return`layout.moved.${e} must be a string`}return e}function Pn(e,t={}){if(!Y(e))return J(`This is not a cookbook: expected a JSON object.`);if(e.$schema!==void 0&&e.$schema!==`https://s-m-r-t.dev/schemas/cookbook/v1.json`&&e.$schema!==`https://s-m-r-t.dev/schemas/blueprint/v1.json`)return J(`This is not a cookbook: its "$schema" is not a cookbook schema this planner knows.`);let{version:n}=e;if(n===void 0)return J(`This is not a cookbook: it has no "version".`);if(typeof n!=`number`||!Number.isInteger(n))return J(`The cookbook "version" must be a whole number.`);if(n>1)return J(`This cookbook is version ${n}, newer than this planner understands (1). Update the planner or re-export it.`);if(n!==1)return J(`Cookbook version ${n} is not supported (this planner reads version 1).`);if(!X(e.recipes))return J(`The cookbook "recipes" must be a list of recipe ids.`);let r=e.recipes.filter(e=>!D.has(e)),i=[...new Set([...Me(e.recipes.filter(e=>D.has(e)),D),...r])].sort(),a=[];if(e.features!==void 0){if(!X(e.features))return J(`The cookbook "features" must be a list of model names.`);let t=new Set;for(let n of e.features){if(t.has(n))return J(`The cookbook lists the feature ${n} more than once.`);t.add(n)}a=[...e.features].sort()}let o=new Set([...i.flatMap(e=>D.get(e)?.models??[]),...a]);if(!Array.isArray(e.policies))return J(`The cookbook "policies" must be a list.`);let s=[];for(let[t,n]of e.policies.entries()){let e=Mn(n,`policies[${t}]`);if(typeof e==`string`)return J(`Invalid cookbook: ${e}.`);(o.has(e.objectRef)||Ne(e))&&s.push(e)}let c;if(e.exposure!==void 0){if(!Y(e.exposure))return J(`The cookbook "exposure" must be an object.`);let t=[];for(let[n,r]of Object.entries(e.exposure)){if(!X(r)||!r.every(e=>jn.has(e)))return J(`Invalid cookbook: exposure for ${n} must list api, mcp or cli.`);r.length&&o.has(n)&&t.push([n,[...r]])}c=Object.fromEntries(t)}let l;if(e.layout!==void 0){let t=Nn(e.layout);if(typeof t==`string`)return J(`Invalid cookbook: ${t}.`);l=kn(On(t))}let u;if(e.theme!==void 0){let n=Tn(e.theme);if(n.ok)u=n.theme;else if(!t.dropUnknownRecipes)return J(n.error)}let d,f=[];if(e.overviews!==void 0){if(t.overviews){let n=t.overviews(e.overviews,l);if(!n)return J(`The cookbook "overviews" must be an object.`);d=n.overviews,f=n.dropped}else{if(!Y(e.overviews))return J(`The cookbook "overviews" must be an object.`);Object.keys(e.overviews).length&&(f=[`Page customisations (overviews) are not kept by this host and were dropped.`])}}let p={$schema:q,version:1,recipes:i,features:a,policies:s};for(let t of[`name`,`description`]){let n=e[t];if(n!==void 0){if(typeof n!=`string`)return J(`The cookbook "${t}" must be a string.`);n.trim()&&(p[t]=n.trim())}}if(e.specs!==void 0){if(typeof e.specs!=`string`)return J(`The cookbook "specs" must be a string.`);e.specs.trim()&&(p.specs=e.specs.trim())}return c&&Object.keys(c).length&&(p.exposure=c),l&&(p.layout=l),u&&(p.theme=u),d&&Object.keys(d).length&&(p.overviews=d),f.length?{ok:!0,cookbook:p,dropped:f}:{ok:!0,cookbook:p}}var Fn=e=>({ok:!1,error:e});function In(e,t={}){return Pn(e,{...t,overviews:mn})}function Ln(e,t={}){let n;try{n=JSON.parse(e)}catch{return Fn(`This file is not valid JSON.`)}try{return In(n,t)}catch{return Fn(`This file is not a valid cookbook.`)}}var Z=`smrt-planner:cookbook-doc:v1`,Rn=`smrt-planner:blueprint:v1`,zn=`smrt-planner:cookbook-doc:unreadable`;function Bn(){try{return globalThis.localStorage??null}catch{return null}}function Vn(e){if(!e)return{status:`unavailable`};let t;try{t=e.getItem(Z)}catch{return{status:`unavailable`}}let n=null;try{n=e.getItem(Rn)}catch{}let r=t===null&&n!==null,i=r?n:t;if(i===null)return{status:`empty`};let a=Ln(i,{dropUnknownRecipes:!0});if(a.ok)return r&&Q(e,Z,JSON.stringify(a.cookbook)),{status:`loaded`,cookbook:a.cookbook,previousKept:n!==null,...a.dropped?{dropped:a.dropped}:{}};t=i;let o=Q(e,zn,t);return{status:`unreadable`,reason:a.error,keptAside:o}}function Q(e,t,n){if(!e)return!1;try{return e.setItem(t,n),!0}catch{return!1}}function Hn(e,t){if(!e)return!1;try{return e.removeItem(t),!0}catch{return!1}}function Un(e,t){return Q(e,Z,JSON.stringify(t))}function Wn(e,t={}){let n={$schema:q,version:1,...Ie(e)};t.name&&(n.name=t.name),t.description&&(n.description=t.description),t.specs&&(n.specs=t.specs),t.layout&&(n.layout=t.layout);let r=En(t.theme);r&&(n.theme=r);let i=t.overviews??{},a=Object.keys(i).sort();return a.length&&(n.overviews=Object.fromEntries(a.map(e=>[e,i[e]]))),n}var Gn=new Set([`basic`,`advanced`,`hidden`]),Kn=new Set([`api`,`mcp`,`cli`]);function qn(e){let t=e.replace(/-/g,`+`).replace(/_/g,`/`),n=atob(t+`=`.repeat((4-t.length%4)%4));return new TextDecoder().decode(Uint8Array.from(n,e=>e.charCodeAt(0)))}function Jn(e){let t=new URLSearchParams(e);return t.has(`r`)||t.has(`o`)}function Yn(e){let t={rows:[],narrowed:{}};if(!e)return t;let n;try{n=JSON.parse(qn(e))}catch{return t}if(!n||typeof n!=`object`)return t;let r=[];for(let[e,t]of Object.entries(n.r??{}))if(t&&typeof t==`object`)for(let[n,i]of Object.entries(t)){if(!i||typeof i!=`object`)continue;let t={objectRef:e,fieldName:n,scopeType:`app`};typeof i.v==`string`&&Gn.has(i.v)&&(t.visibility=i.v),typeof i.l==`string`&&(t.label=i.l),(typeof i.h==`string`||i.h===null)&&(t.help=i.h),(typeof i.d==`string`||i.d===null)&&(t.defaultValue=i.d),typeof i.o==`number`&&Number.isFinite(i.o)&&(t.displayOrder=i.o),typeof i.k==`boolean`&&(t.locked=i.k),r.push(t)}let i={};for(let[e,t]of Object.entries(n.x??{})){if(!Array.isArray(t))continue;let n=t.filter(e=>Kn.has(e));n.length&&(i[e]=n)}return{rows:r,narrowed:i}}function Xn(e){let t=new URLSearchParams(e),n=(t.get(`r`)??``).split(`,`).filter(Boolean),r=Me(Le(n,D),D),i=new Set(r.flatMap(e=>D.get(e)?.models??[])),{rows:a,narrowed:o}=Yn(t.get(`o`)??``),s={$schema:q,version:1,recipes:r,features:[],policies:a.filter(e=>i.has(e.objectRef))},c=Object.fromEntries(Object.entries(o).filter(([e])=>i.has(e)));return Object.keys(c).length&&(s.exposure=c),s}var Zn=`smrt-planner:shell`;function $(e){let t=Fe(e),n=e.policies.some(e=>e.defaultValue!==void 0&&Ne(e));s(Re(e)||n?t.taxRate:void 0),o({pricesIncludeTax:t.pricesIncludeTax,taxRounding:t.taxRounding,currency:t.currency})}var Qn=new class{#e=r(0);get replacementGeneration(){return e(this.#e)}set replacementGeneration(e){i(this.#e,e,!0)}#t=r();get layout(){return e(this.#t)}set layout(e){i(this.#t,e,!0)}#n=r();get name(){return e(this.#n)}set name(e){i(this.#n,e,!0)}#r=r();get description(){return e(this.#r)}set description(e){i(this.#r,e,!0)}#i=r();get specs(){return e(this.#i)}set specs(e){i(this.#i,e,!0)}#a=r();get theme(){return e(this.#a)}set theme(e){i(this.#a,e,!0)}#o=r({});get overviews(){return e(this.#o)}set overviews(e){i(this.#o,e)}#s=r(`unknown`);get persist(){return e(this.#s)}set persist(e){i(this.#s,e,!0)}#c=r(!1);get loaded(){return e(this.#c)}set loaded(e){i(this.#c,e,!0)}hostManaged=!1;#l=r(``);get loadNotice(){return e(this.#l)}set loadNotice(e){i(this.#l,e,!0)}saveBlocked=!1;#u=r(!1);get keepLegacyUrl(){return e(this.#u)}set keepLegacyUrl(e){i(this.#u,e,!0)}replacedBeforeLoad=!1;previousKept=!1;storage=null;timer;snapshot(){return Wn(n(E.data),{layout:n(this.layout),theme:n(this.theme),overviews:n(this.overviews),name:this.name,description:this.description,specs:this.specs})}overview(e){return Object.hasOwn(this.overviews,e)?this.overviews[e]:null}setOverview(e,t){let n=Object.fromEntries(Object.entries(this.overviews).filter(([t])=>t!==e));t&&(n[e]=t),this.overviews=n}setLayout(e){this.layout=S(e)?void 0:e}setSpecs(e){let t=e.trimEnd();this.specs=t.trim()?t:void 0}apply(e){E.load(e),this.layout=e.layout,this.theme=e.theme,this.name=e.name,this.description=e.description,this.specs=e.specs,this.overviews={...e.overviews??{}},$(e)}get unavailableNotice(){let e=[...E.unavailableRecipes,...E.unavailableFeatures];if(!e.length)return``;let t=e.length;return`${t} ${t===1?`recipe`:`recipes`} in this cookbook ${t===1?`isn't`:`aren't`} available in this version: ${e.join(`, `)}. They are kept when you save or export.`}removeUnavailable(){E.removeUnavailable(),this.scheduleSave()}setTheme(e){this.theme=En(e)}settings(){return Fe(this.snapshot())}setSettings(e){let t=Pe(this.snapshot(),e);E.rows=t.policies.map(e=>({...e})),$(t)}replace(e){this.replacementGeneration++,this.apply(e),this.loaded||(this.replacedBeforeLoad=!0),this.saveBlocked=!1,this.keepLegacyUrl=!1}reset(e={}){this.replacementGeneration++,E.clear(),$({policies:[]}),this.layout=void 0,e.preserveTheme||(this.theme=void 0),this.name=void 0,this.description=void 0,this.specs=void 0,this.overviews={},this.saveBlocked=!1,this.keepLegacyUrl=!1}importText(e){let t=Ln(e);return t.ok&&this.replace(t.cookbook),t}hydrate(e,t=d()){this.storage=t;let n=Vn(t);n.status===`loaded`&&(this.previousKept=n.previousKept),n.status===`loaded`&&!this.replacedBeforeLoad?(this.apply(n.cookbook),n.dropped?.length&&(this.loadNotice=`Some saved page customisations could not be used and were removed: ${n.dropped.join(` `)}`)):n.status===`unreadable`&&(this.saveBlocked=!n.keptAside,this.loadNotice=n.keptAside?`The saved cookbook could not be read (${n.reason}) and was kept aside; starting empty.`:`The saved cookbook could not be read (${n.reason}). Starting empty without overwriting it; import or reset to save again.`);let r=!1;if(Jn(e)&&(n.status===`loaded`&&!Q(t,`smrt-planner:cookbook-doc:backup`,JSON.stringify(n.cookbook))&&(this.saveBlocked=!0),this.apply(Xn(e)),r=!0),this.persist=n.status===`unavailable`?`memory`:`unknown`,this.loaded=!0,r){let e=this.save();this.keepLegacyUrl=!e}return r}save(){if(clearTimeout(this.timer),this.timer=void 0,!this.loaded)return!1;if(this.hostManaged)return!0;if(this.saveBlocked)return this.persist=`memory`,!1;let e=Un(this.storage,this.snapshot());return this.persist=e?`ok`:`memory`,e&&this.previousKept&&(this.previousKept=!Hn(this.storage,Rn)),e&&(this.keepLegacyUrl=!1),e}scheduleSave(){this.loaded&&!this.hostManaged&&(clearTimeout(this.timer),this.timer=setTimeout(()=>this.save(),300))}flush(){this.timer!==void 0&&this.save()}};export{j as A,N as C,ut as D,mt as E,st as O,ht as S,_t as T,Cn as _,Bn as a,$t as b,q as c,_n as d,gn as f,Dn as g,hn as h,Z as i,ot as j,M as k,yn as l,G as m,Qn as n,In as o,bn as p,$ as r,Ln as s,Zn as t,xn as u,sn as v,gt as w,F as x,en as y};
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./blNrXq3G.js","./DG3qFFTE.js","./COiEfhsA.js","./xihTtKlq.js","./Zte-WUy-.js","./Bq8E3AWP.js","./DK8Blf1Y.js","../assets/currency-metadata.ksbBA8-C.css","../assets/app.CNgJdfDA.css","./B2up491X.js","./BLUInGBV.js","../assets/feedback.nSgE8ogy.css","./b-_V29X7.js","./BaNbYf_w.js","./v8gneLl4.js","../assets/SegmentedControl.CH_vc242.css","./DIE02RSm.js","../assets/webmcp-ui-context.hO24Ni5w.css","./C-A_haB1.js","../assets/data.B71l2JEr.css","./CUyVrfsu.js","./CGVkRTMI.js","../assets/forms.Zvn0Ncy0.css","./BYcBM-fh.js","../assets/AppShell.CG6RWMlI.css","./ChpbeHev.js","../assets/workspace.C40zM0Mb.css","./BDhA6I_M.js","./Dvyr8zQc.js","../assets/state.C0UZEhxS.css","../assets/labels.Gb0NBp4g.css","./BRCZe8R4.js","./BUdNw_R5.js","./ChNjGKYd.js","../assets/planner.DOQVfcOi.css","./D_U_DYjx.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{$ as e,Et as t,Mt as n,bt as r,vt as i}from"./DG3qFFTE.js";import{t as a}from"./BaNbYf_w.js";import"./xihTtKlq.js";import{I as o,L as s,O as c,Q as l,St as u,W as d,Z as f,_ as p,_t as m,bt as h,et as g,h as _,ht as v,p as y,x as b,yt as x}from"./Zte-WUy-.js";import{v as S}from"./b-_V29X7.js";import"./v8gneLl4.js";import"./DIE02RSm.js";import{u as ee}from"./C-A_haB1.js";import{A as C,C as te,E as ne,F as re,G as ie,I as ae,M as oe,N as se,O as ce,P as le,T as ue,U as de,V as fe,W as w,b as pe,h as me,j as he,k as ge,n as _e,q as ve,r as ye,w as be}from"./BDhA6I_M.js";import{B as xe,D as Se,G as Ce,H as we,J as Te,K as Ee,M as De,V as Oe,X as ke,Y as Ae,Z as je,a as Me,b as T,c as Ne,d as Pe,l as Fe,n as Ie,r as Le,s as Re,t as E,v as ze,x as D,z as Be}from"./Dvyr8zQc.js";function Ve(e){let t=e?.surfaces?.find(e=>e.kind===`widget`&&e.sectionDefault===!0);return t?{id:t.type,type:t.type,span:4,options:{}}:void 0}function He(e){let t=e.lastIndexOf(`#`);if(t<=0||t===e.length-1)return null;let n=e.slice(0,t),r=e.slice(t+1);return n.startsWith(`.`)||n.startsWith(`/`)||/\s/.test(n)||!/^[A-Za-z_$][\w$]*$/.test(r)?null:{specifier:n,exportName:r}}function O(e,t){let n=He(e);return n?Promise.resolve(t(n.specifier,n.exportName)).then(t=>{if(t==null)throw Error(`export "${e}" was not found`);return t}):Promise.reject(Error(`invalid export ref "${e}"`))}function k(e){let t;return()=>(t??=e(),t)}function Ue(e){return typeof e==`object`&&!!e&&`default`in e&&!!e.default}function We(e,t,n){let r=k(()=>O(e.export,t)),i=e.optionsEditor?k(()=>O(e.optionsEditor,t)):void 0,a=e.data?.load?k(()=>O(e.data?.load,t)):void 0,o={type:e.type,title:e.label,options:e.options??[],loadComponent:async()=>{let e=await r();return Ue(e)?e.default:e}};return e.description!==void 0&&(o.description=e.description),e.icon!==void 0&&(o.icon=e.icon),e.version!==void 0&&(o.version=e.version),e.allowedIn&&(o.allowedIn=e.allowedIn),e.defaultSpan!==void 0&&(o.defaultSpan=e.defaultSpan),e.minSpan!==void 0&&(o.minSpan=e.minSpan),e.maxSpan!==void 0&&(o.maxSpan=e.maxSpan),n&&(o.migrate=n),i&&(o.loadOptionsEditor=async()=>{let e=await i();return Ue(e)?e.default:e}),a&&(o.load=async(t,n)=>{let r=await a();if(typeof r!=`function`)throw Error(`loader "${e.data?.load}" is not a function`);return r(t,n)}),o}async function Ge(e,t,n,r={}){let i=[],a=[],o=[];for(let s of t)if(!r.enabled||r.enabled(s.id))for(let t of s.surfaces??[]){if(t.kind!==`widget`)continue;let c=(e,n)=>a.push({recipeId:s.id,type:t.type,reason:e,message:n});if(e.has(t.type)&&!r.replace){c(`duplicate_type`,`"${t.type}" is already registered`);continue}let l;if(t.migrate)try{let e=await O(t.migrate,n);if(typeof e!=`function`)throw Error(`not a function`);l=e}catch(e){c(`unresolved`,`migrate "${t.migrate}": ${e instanceof Error?e.message:String(e)}`);continue}try{o.push(e.register(We(t,n,l),{replace:r.replace})),i.push(t.type)}catch(e){c(`invalid`,e instanceof Error?e.message:String(e))}}return{registered:i,skipped:a,dispose:()=>{for(let e of o.splice(0))e()}}}var Ke=[`identifier`,`status`,`date`,`party`,`total`,`money`];function qe(e){for(let t of[`identifier`,`status`,`date`,`money`,`quantity`,`party`,`title`])if(e.includes(t))return t}function Je(e,t,n={}){let r=new Set(n.exclude??[]),i=n.max??4,a=Object.keys(t).filter(t=>!r.has(t)&&t in e.fields),o=e=>a.find(n=>t[n]?.includes(e)),s=[],c=e=>{e&&!s.includes(e)&&s.push(e)};c(o(`identifier`)??o(`title`));for(let e of Ke)e!==`identifier`&&(e===`money`&&s.some(e=>t[e]?.includes(`money`))||c(e===`date`?a.find(e=>t[e]?.includes(`date`)&&e!==`createdAt`&&e!==`updatedAt`)??o(`date`):o(e)));return s.slice(0,i).map(n=>({key:n,label:A(n,e),...qe(t[n]??[])?{role:qe(t[n]??[])}:{}}))}function Ye(e,t,n={}){let r=new Set(n.exclude??[]),i=Object.keys(t).filter(t=>!r.has(t)&&t in e.fields),a=i.filter(t=>e.fields[t]?.type===`text`),o=a.find(e=>/^(?:description|title|name|label)$/.test(e))??a.find(e=>t[e]?.includes(`title`))??a.find(e=>!t[e]?.includes(`identifier`)),s=i.find(e=>t[e]?.includes(`quantity`)),c=i.filter(e=>t[e]?.includes(`money`)),l=c.find(e=>/unit|price|rate/i.test(e)),u=c.find(e=>/^(?:amount|lineTotal|total|lineAmount)$/.test(e))??[...c].reverse().find(e=>e!==l),d=[];return o&&d.push({key:o,label:A(o,e)}),s&&d.push({key:s,label:A(s,e),role:`quantity`}),l&&d.push({key:l,label:A(l,e),role:`money`,summarize:!1}),u&&u!==l&&d.push({key:u,label:A(u,e),role:`money`}),d}function A(e,t){let n=t.fields[e];return n&&(n.type===`foreignKey`||n.type===`crossPackageRef`)&&/.[a-z]Id$/.test(e)?le(e.slice(0,-2)):le(e)}function Xe(e){if(e.dataWidgets&&e.page)return[e.page];let t=[{id:`shortcuts`,type:`shortcuts`,span:4,options:{}}];if(e.dataWidgets&&e.lead){let n=e.lead,r=e.override,i=r&&typeof r==`object`&&!Array.isArray(r)?r:void 0,a=i?.changed;a&&typeof a==`object`&&!Array.isArray(a)&&Object.hasOwn(a,`count`)&&!(Array.isArray(i?.removed)&&i.removed.includes(`count`))&&t.push({id:`count`,type:`metric`,span:1,options:{title:n.plural,model:n.id,measure:`count`}}),t.push({id:`latest`,type:`records`,span:4,options:{title:`${n.name} records`,model:n.id,limit:5,summaries:!1}})}return t}var Ze=[`text`,`integer`,`decimal`,`boolean`,`datetime`,`json`,`foreignKey`,`crossPackageRef`];function Qe(e){return Ze.includes(e)?e:`text`}var $e=/(Date|^date|period(Start|End))$/;function et(e,t){return t.type===`datetime`&&!t.system&&$e.test(t.name)&&!e.fields.some(e=>e.name===`allDay`)?`date`:void 0}function tt(e){return pe(e)[0]}function nt(e,t){let n=t.ui?{...t.ui}:void 0,r=c(t)?`money`:et(e,t);return{type:Qe(t.type),required:t.required,nullable:!t.required,...t.default===void 0?{}:{default:t.default},...t.description?{description:t.description}:{},...n?{ui:n}:{},...t.enum?.length?{enum:[...t.enum]}:{},...r?{format:r}:{},...tt(e)===t.name?{display:!0}:{}}}function rt(e,t){return e.includes(`:`)?e:`${t.slice(0,t.lastIndexOf(`:`))}:${e}`}function it(e,t){if(!t.related)return!1;let n=rt(t.related,e.id);return Ae(m,n,g).some(t=>t.id===e.id)}function at(e){return e.fields.flatMap(t=>{if(t.type!==`foreignKey`&&t.type!==`crossPackageRef`||!t.related)return[];let n=h(rt(t.related,e.id));return n?[{field:t.name,kind:t.type===`crossPackageRef`?`crossPackageRef`:`foreignKey`,relatedCollection:n.model.collection,...it(e,t)?{role:`items`}:{}}]:[]})}function j(e){let t=at(e);return{name:e.collection,objectRef:e.id,className:e.name,idField:`id`,fields:Object.fromEntries(e.fields.map(t=>[t.name,nt(e,t)])),...t.length?{relationships:t}:{}}}function ot(e,t){return{objectRef:e.id,fields:Object.fromEntries(t.map((e,t)=>[e.name,{visibility:`basic`,label:e.label,help:e.help??null,order:t,required:e.required}]))}}function st(e,t){let n=new Set(t);for(let t of e)for(let e of t.models)n.add(e);return n}function ct(e){return y(e.replace(/_?id$/i,``)||e)}function M(e,t,n){let r=ke(e,t),i=new Set(e.packages.flatMap(e=>(e.recipes??[]).filter(e=>e.exposure===`ui-only`).flatMap(e=>e.models))),a=je(e,t).filter(e=>(e.model.exposed||i.has(e.model.id))&&n.has(e.model.id)),o=new Set(Ae(e,t,g).map(e=>e.id)),s=new Map;for(let e of a)s.set(e.model.id,(s.get(e.model.id)??0)+1);let c=a.map(e=>{let t=o.has(e.model.id)?`items`:`children`,n=j(e.model),i=ae(n),a=[e.fk];return{model:e.model.id,field:e.fk,label:(s.get(e.model.id)??0)>1?`${Ce(e.model.name,r)} (${ct(e.fk).toLowerCase()})`:Ce(e.model.name,r),kind:t,columns:t===`items`?Ye(n,i,{exclude:a}):Je(n,i,{exclude:a,max:5}),...t===`items`&&`sortOrder`in n.fields?{sort:`sortOrder`}:{}}});for(let n of Ee(e,t))c.push({model:n.model.id,field:n.fk,label:ct(n.fk),kind:`reference`});return c}var lt=Symbol(`smrt-cookbook`);function ut(){return t(lt)}function dt(e,t){let{sections:n}=t;if(!n)throw Error(`the cookbook widget context is missing`);let r=typeof e.section==`string`?e.section:``,i=r?n.find(e=>e.id===`section:${r}`||e.id===`custom:${r}`)?.id:t.overviewId;if(!i)throw Error(`unknown section ${r}`);return se(n,i)}function ft(e){return e?async(t,n)=>{let r=dt(t,n);try{let t=await e(n,r.items.map(e=>({...e})));if(!Array.isArray(t))return r;let i=new Set,a=[];for(let e of t){if(!e||typeof e.href!=`string`)continue;let t=typeof e.id==`string`&&e.id?e.id:e.href;i.has(t)&&(t=`${t}#${a.length}`),i.add(t),a.push({...e,id:t})}return{items:a}}catch(e){if(n.signal?.aborted)throw e;return r}}:dt}var pt=new Set([`foreignKey`,`crossPackageRef`]);function N(e,t){return`/m/${e}/${t}/`}function mt(e,t,n,r=`view`){let i=`${N(e,t)}${encodeURIComponent(n)}/`;return r===`edit`?`${i}edit/`:i}function ht(e,t,n,r){return`${N(e,t)}?${encodeURIComponent(n)}=${encodeURIComponent(r)}`}function gt(e,t){let n=new URLSearchParams(e);for(let e of t.fields){if(!pt.has(e.type))continue;let t=n.get(e.name);if(t)return{field:e.name,equals:t}}}function _t(e){return e?.equals===void 0?``:`${encodeURIComponent(e.field)}=${encodeURIComponent(e.equals)}`}var P=e=>typeof e==`number`&&Number.isSafeInteger(e)?e:null,vt=(e,t)=>e.fields.some(e=>e.name===t);function yt(e,t){let n=ae(j(e)),r=te(t,n);return Object.values(r).some(e=>P(e)!==null)?r:void 0}function bt(e,t){return!!e.fields.find(e=>e.name===`status`)?.enum?.includes(`draft`)&&typeof t.status==`string`&&t.status!==``&&t.status!==`draft`}function xt(e,t,n){if(!bt(e,t)||![`subtotal`,`taxAmount`,`totalAmount`,`discountTotal`].every(t=>vt(e,t)))return;let r=P(t.subtotal),i=P(t.taxAmount),a=P(t.totalAmount),o=P(t.discountTotal)??0;if(r===null||i===null||a===null)return;let s=f(t,`exclusive`);return{subtotal:r,discount:o,tax:i,total:a,lineAmountType:s,roundingScope:l(t,`line`),showNetSubtotal:s===`inclusive`,taxes:v(n,s).flatMap(e=>e.taxComponentId?[{taxComponentId:e.taxComponentId,name:e.name,percent:e.percent,taxable:e.taxable,tax:e.tax}]:[])}}var F=fe();function I(e){let{source:t,href:n}=e;if(!t||!n)throw Error(`the planner widget context is missing`);return{source:t,href:n}}function L(e){let t=typeof e==`string`?h(e):void 0;if(!t)throw Error(`unknown model ${String(e)}`);return{model:t.model,packageId:t.pkg.id,path:N(t.pkg.id,t.model.name)}}var R=new Set([`foreignKey`,`crossPackageRef`]);function z(e,t,n){let r=e.filter;if(typeof r!=`string`||r===``)return;if(r!==`parent`)throw Error(`unknown filter ${r}`);let{record:i}=t;if(!i?.id)throw Error(`the parent filter needs a record`);let a=typeof e.parentField==`string`&&e.parentField?e.parentField:e.field,o=typeof a==`string`?a:``,s=n.fields.find(e=>e.name===o);if(!s||!R.has(s.type))throw Error(`${n.name} has no reference field ${o}`);return{field:o,id:i.id}}async function B(e,t,n){return n?e.listWhere(t,n.field,n.id):e.list(t)}function V(e,t,n){return e(n?ht(t.packageId,t.model.name,n.field,n.id):t.path)}var H=e=>typeof e==`number`&&Number.isFinite(e);async function St(e,t){let{source:n,href:r}=I(t),i=L(e.model),{model:a}=i,o=z(e,t,a),s=await B(n,a,o),l=V(r,i,o),u=typeof e.measure==`string`?e.measure:``;if(u===`count`||u===``)return{value:s.length,format:`integer`,href:l};let d=a.fields.find(t=>t.name===e.field);if(!d||d.type!==`integer`&&d.type!==`decimal`)throw Error(`${u} needs a numeric field of ${a.name}`);let f=s.map(e=>e[d.name]).filter(H),p=0;if(f.length){if(u===`sum`||u===`avg`)p=f.reduce((e,t)=>e+t,0),u===`avg`&&(p/=f.length);else if(u===`min`)p=Math.min(...f);else if(u===`max`)p=Math.max(...f);else throw Error(`unknown measure ${u}`)}let m=c(d);return{value:m?Math.round(p):p,format:m?`money`:d.type===`integer`?`integer`:`decimal`,...m?{currency:`USD`}:{},href:l}}function Ct(e,t){return H(e)&&H(t)?e-t:String(e??``).localeCompare(String(t??``))}var wt=new Set([`createdAt`,`updatedAt`]),Tt=[`identifier`,`status`,`date`,`money`,`quantity`,`party`,`title`];function Et(e=[]){return Tt.find(t=>e.includes(t))}function Dt(e,t,n,r){let i=j(e),a=r?[r]:[],o=oe(n),s=o.length?[]:me(E.apply(e).fields.filter(t=>!a.includes(t.name)&&!Se(e,t))).filter(e=>!e.derive),c=o.length?o:s.map(e=>e.name),l=[...Ye(i,t,{exclude:a}),...Je(i,t,{exclude:a,max:c.length+8})];return c.map(n=>{let r=e.fields.find(e=>e.name===n);if(!r)throw Error(`${e.name} has no field ${n}`);let i=l.find(e=>e.key===n),a=s.find(e=>e.name===n)?.label;if(i)return a?{...i,label:a}:i;let o=Et(t[n]);return{key:n,label:a??(R.has(r.type)?y(n.replace(/Id$/,``)):y(n)),...o?{role:o}:{}}})}var Ot=new Set([`money`,`quantity`]);function kt(e,t){let n={};for(let r of e)(r.summarize??Ot.has(r.role))&&(n[r.key]=t.reduce((e,t)=>{let n=t[r.key];return H(n)?e+n:e},0));return n}function At(e,t){let n=re(j(e)),r=new Set(t.map(e=>n?e[n]:void 0).filter(e=>typeof e==`string`&&e!==``));return r.size===1?[...r][0]??`USD`:`USD`}async function jt(e,t){let{source:n,href:r}=I(t),i=L(e.model),{model:a}=i,o=z(e,t,a),s=await B(n,a,o);if(typeof e.sort==`string`&&e.sort){if(!a.fields.find(t=>t.name===e.sort)&&!wt.has(e.sort))throw Error(`${a.name} has no field ${e.sort}`);let t=s.some(t=>t[e.sort]!==void 0)?e.sort:W(a)?.name;if(t){let n=e.direction===`asc`?1:-1;s=[...s].sort((e,r)=>n*Ct(e[t],r[t]))}}let c=Dt(a,ae(j(a)),e.columns,o?.field),l=H(e.limit)?e.limit:5,u=s.slice(0,l),d=a.fields.filter(e=>R.has(e.type)&&c.some(t=>t.key===e.name)),f=await ye(n,d,u),p=e=>Object.fromEntries(c.map(t=>{let n=e[t.key],r=d.find(e=>e.name===t.key);return r?.related&&typeof n==`string`&&n?[t.key,f.get(_(r.related,n))??``]:[t.key,n??null]})),m=kt(c,s),h=!Te(a);return{rows:await Promise.all(u.map(async e=>({id:String(e.id),title:await _e(n,a,e,0,o?.field),...h?{href:r(mt(i.packageId,a.name,String(e.id)))}:{},cells:p(e)}))),...e.summaries===!1?{}:{total:s.length},...h?{href:V(r,i,o)}:{},columns:c,currency:At(a,s),...Object.keys(m).length?{summaries:m}:{}}}var Mt={"7d":7,"30d":30,"90d":90,"12m":365,all:null},U=864e5;function Nt(e){return e===`7d`||e===`30d`?`day`:e===`90d`?`week`:`month`}function Pt(e,t){let n=new Date(e);if(t===`month`)return Date.UTC(n.getUTCFullYear(),n.getUTCMonth(),1);let r=Date.UTC(n.getUTCFullYear(),n.getUTCMonth(),n.getUTCDate());return t===`week`?r-(n.getUTCDay()+6)%7*U:r}function Ft(e,t){if(t===`month`){let t=new Date(e);return Date.UTC(t.getUTCFullYear(),t.getUTCMonth()+1,1)}return e+(t===`week`?7:1)*U}function It(e,t){let n=new Date(e).toISOString();return t===`month`?n.slice(0,7):n.slice(0,10)}var Lt=e=>e.type===`datetime`&&!e.system;function W(e){let t=e.fields.filter(Lt);return t.find(e=>/^(issue|order|start|created)/i.test(e.name))??t[0]}function Rt(e){if(typeof e!=`string`&&typeof e!=`number`)return;let t=new Date(e).getTime();return Number.isFinite(t)?t:void 0}async function zt(e,t){let{source:n,href:r}=I(t),i=L(e.model),{model:a}=i,o=z(e,t,a),s=typeof e.groupBy==`string`?e.groupBy:``,l=s?a.fields.find(e=>e.name===s):W(a);if(!l)throw Error(s?`${a.name} has no field ${s}`:`${a.name} has no date field to chart; choose a group-by field`);let u=typeof e.measure==`string`?e.measure:``,d;if(u&&u!==`count`){if(u!==`sum`&&u!==`avg`)throw Error(`unknown measure ${u}`);if(d=a.fields.find(t=>t.name===e.field),!d||d.type!==`integer`&&d.type!==`decimal`)throw Error(`${u} needs a numeric field of ${a.name}`)}let f=typeof e.period==`string`?e.period:`30d`;if(!Object.hasOwn(Mt,f))throw Error(`unknown period ${f}`);let p=Mt[f],m=Lt(l),h=m?l:W(a),g=p!==null&&h?b-p*U:-1/0,_=await B(n,a,o);h&&g!==-1/0&&(_=_.filter(e=>{let t=Rt(e[h.name]);return t!==void 0&&t>=g&&t<=b}));let v=new Map,y=(e,t,n)=>{let r=v.get(e)??{key:t,sum:0,n:0};if(d){let e=n[d.name];if(!H(e))return;r.sum+=e}r.n+=1,v.set(e,r)},x=Nt(f);if(m){let e=g===-1/0?Math.min(..._.map(e=>Rt(e[l.name])??b),b):g;for(let t=Pt(e,x);t<=b;t=Ft(t,x))v.set(It(t,x),{key:t,sum:0,n:0});for(let e of _){let t=Rt(e[l.name]);if(t===void 0)continue;let n=Pt(t,x);y(It(n,x),n,e)}}else for(let e of _){let t=e[l.name],n=t==null||t===``?`(none)`:String(t);y(n,n,e)}let S=d?c(d):!1,ee=e=>{if(!d)return e.n;let t=u===`avg`&&e.n?e.sum/e.n:e.sum;return S?Math.round(t):t},C=[...v.entries()].map(([e,t])=>({label:e,value:ee(t),key:t.key}));return C=m?C.sort((e,t)=>Number(e.key)-Number(t.key)):C.sort((e,t)=>t.value-e.value||e.label.localeCompare(t.label)),{points:C.map(({label:e,value:t})=>({label:e,value:t})),format:d?S?`money`:d.type===`integer`?`integer`:`decimal`:`integer`,...S?{currency:`USD`}:{},href:V(r,i,o)}}ne(F,{metric:St,records:jt,chart:zt,shortcuts:async(e,t)=>t,shortcuts:ft()});function Bt(e){let{relations:t,viewAllHref:n}=e;if(!t)throw Error(`the record page context is missing`);return{relations:t,records:jt,viewAllHref:n}}async function Vt(e,t){let{source:n}=I(e),r=e.record;if(!r?.id)throw Error(`line items need a record`);let{model:i}=L(r.model),a=await n.get(i,r.id);if(!a)return{};let o=t.find(e=>e.kind===`items`),s=o?h(o.model)?.model:void 0,c=xt(i,a,o&&s?await n.listWhere(s,o.field,r.id):[]),l=c?void 0:yt(i,a),u=re(j(i)),d=u?a[u]:void 0;return{...c?{storedTotals:c}:{},...l?{totals:l}:{},...typeof d==`string`&&d?{currency:d}:{}}}F.register(ue((e,t)=>ge(Bt(t))(e,t))),F.register(be(async(e,t)=>{let n=Bt(t),{totals:r,storedTotals:i,currency:a}=await Vt(t,n.relations);return ce({...n,totals:()=>r,storedTotals:()=>i,currency:()=>a})(e,t)}));var Ht=[`shortcuts`,`metric`,`records`,`chart`,`note`],Ut={"@happyvertical/smrt-reports/svelte":async()=>({SavedReportsWidget:(await a(async()=>{let{default:e}=await import(`./blNrXq3G.js`);return{default:e}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35]),import.meta.url)).default})},Wt=async(e,t)=>{let n=Ut[e];if(n)return(await n())[t]},Gt=T.filter(e=>e.surfaces?.some(e=>e.kind===`widget`)),Kt=Gt.flatMap(e=>(e.surfaces??[]).flatMap(e=>e.kind===`widget`?[e.type]:[]));Ge(F,Gt,Wt);var qt=new Map(Be(T).map(e=>[`section:${e.id}`,e])),Jt=m.packages.flatMap(e=>e.models.map(e=>e.id)),Yt=[...Ht,...Kt];function Xt(e){let t=qt.get(e);for(let e of t?.recipes??[]){let t=ze(e)[0];if(t)return{id:t.model.id,name:y(t.model.name)}}}function Zt(e,t){let n=Ve(qt.get(e)?.recipes[0]),r=Xt(e);return Xe({lead:r?{...r,plural:p(r.name)}:void 0,dataWidgets:!0,page:n&&Kt.includes(n.type)?n:void 0,override:t})}var Qt=new Map;function $t(e,t){if(!ve.test(e))return;let n=Qt.get(e);return n||(n=w({id:e,allowed:Yt,models:Jt,defaults:Zt(e)}),Qt.set(e,n)),t===void 0?n:w({...n,defaults:Zt(e,t)})}function en(e,t){return`detail:${e}.${t}`}var tn=new Map(m.packages.flatMap(e=>e.models.filter(u).map(t=>[he(t.id),{packageId:e.id,model:t}])));function nn(e){let[,t,n]=/^detail:([A-Za-z0-9_-]+)\.([A-Za-z0-9_]+)$/.exec(e)??[],r=t&&n?x(t,n):void 0;return t&&r&&u(r)?{packageId:t,model:r}:tn.get(e)}var rn=new Set(m.packages.flatMap(e=>e.models.filter(u).map(e=>e.id))),an=new Map;function on(e){let t=an.get(e);if(t)return t;let n=nn(e);if(!n)return;let r=M(m,n.model.id,rn),i=C(j(n.model),r,{id:e,maxMetrics:2*r.length});return t=w({...i,maxWidgets:Math.max(i.maxWidgets??24,i.defaults.length+24)}),an.set(e,t),t}function sn(e,t){let n=on(e),r=nn(e);if(!n||!r)return;let i=M(m,r.model.id,t),a=0,o=n.defaults.filter(e=>e.type===`line-items`?i.some(e=>e.kind===`items`):e.type===`related`?i.some(e=>e.kind===`children`):t.has(String(e.options.model))?e.type!==`metric`||(a+=1,a<=4):!1);return w({...n,defaults:o})}function cn(e,t){return e.startsWith(`detail:`)?on(e):$t(e,t)}function ln(e,t){return qt.has(e)||e===`section:${De.id}`?!0:e.startsWith(`detail:`)?nn(e)!==void 0:e.startsWith(`custom:`)&&ve.test(e)&&(t?.customSections??[]).some(t=>t.id===e)}var un=e=>typeof e==`object`&&!!e&&!Array.isArray(e);function dn(e,t){let n=t.widgetId?`widget ${t.widgetId}${t.type?` (${t.type})`:``}`:`an entry`,r=t.options?.length?`: ${t.options.map(e=>`${e.key} ${e.code}`).join(`, `)}`:``;return`Overview ${e}: ${n} was dropped (${t.code}${r}).`}function fn(e,t){let n={...e};return e.added&&(n.added=e.added.filter(e=>!t.has(e.id))),e.changed&&(n.changed=Object.fromEntries(Object.entries(e.changed).filter(([e])=>!t.has(e)))),n}function pn(e,t){let n=cn(e,t);if(!n)return{override:null,issues:[{widgetId:null,type:null,code:`malformed`,message:`not an overview id`}]};let r=de(n,t,F);if(r.ok){let e=ie(t).override?.changed?.count;return e&&n.defaults.some(e=>e.id===`count`)?{override:{...r.override??{version:1},changed:{...r.override?.changed,count:e}},issues:[]}:{override:r.override,issues:[]}}let i=ie(t),a=new Set(r.issues.flatMap(e=>e.widgetId?[e.widgetId]:[]));if(!i.override)return{override:null,issues:r.issues};let o=de(n,fn(i.override,a),F);return o.ok?{override:o.override,issues:r.issues}:{override:null,issues:[...r.issues,...o.issues]}}function mn(e,t){if(!un(e))return null;let n=[],r=[];for(let i of Object.keys(e).sort()){if(!ln(i,t)){r.push(`Overview ${i} is not a page in this app and was dropped.`);continue}let{override:a,issues:o}=pn(i,e[i]);for(let e of o)r.push(dn(i,e));a&&n.push([i,a])}return{overviews:Object.fromEntries(n),dropped:r}}var hn=ee,gn=`glass`,_n=`system`,vn=[`light`,`dark`,`system`],yn=[`none`,`sm`,`md`,`lg`,`xl`,`full`],bn=[`comfortable`,`touch`],xn=[`auto`,`standard`,`more`],G={"system-ui":`system-ui, -apple-system, "Segoe UI", sans-serif`,Inter:`Inter, system-ui, sans-serif`,Georgia:`Georgia, "Times New Roman", serif`,"ui-rounded":`ui-rounded, "SF Pro Rounded", system-ui, sans-serif`,"ui-monospace":`ui-monospace, "SF Mono", Menlo, monospace`},Sn=/^#?([0-9a-f]{3}|[0-9a-f]{6})$/i;function Cn(e){if(typeof e!=`string`)return null;let t=Sn.exec(e.trim());if(!t)return null;let n=t[1].toLowerCase();return n.length===3&&(n=[...n].map(e=>e+e).join(``)),`#${n}`}var wn=e=>typeof e==`object`&&!!e&&!Array.isArray(e);function Tn(e){if(e===void 0)return{ok:!0,theme:void 0};if(!wn(e))return{ok:!1,error:`The cookbook "theme" must be an object.`};let t={};if(e.preset!==void 0){if(typeof e.preset!=`string`||!hn.includes(e.preset))return{ok:!1,error:`The theme preset must be one of ${hn.join(`, `)}.`};t.preset=e.preset}if(e.colorScheme!==void 0){if(!vn.includes(e.colorScheme))return{ok:!1,error:`The theme colorScheme must be light, dark or system.`};t.colorScheme=e.colorScheme}for(let[n,r]of[[`borderRadius`,yn],[`density`,bn],[`contrast`,xn]]){let i=e[n];if(i!==void 0){if(!r.includes(i))return{ok:!1,error:`The theme ${n} must be one of ${r.join(`, `)}.`};t[n]=i}}if(e.fontFamily!==void 0){if(typeof e.fontFamily!=`string`||!Object.hasOwn(G,e.fontFamily))return{ok:!1,error:`The theme font must be one of ${Object.keys(G).join(`, `)}.`};t.fontFamily=e.fontFamily}if(e.custom!==void 0){if(!wn(e.custom))return{ok:!1,error:`The theme "custom" must be an object.`};let n=Cn(e.custom.primary);if(!n)return{ok:!1,error:`The theme custom primary must be a hex colour like #c2410c.`};let r={primary:n};if(e.custom.fontFamily!==void 0){let t=e.custom.fontFamily;if(typeof t!=`string`||!Object.hasOwn(G,t))return{ok:!1,error:`The theme font must be one of ${Object.keys(G).join(`, `)}.`};r.fontFamily=t}t.custom=r}if(e.customCss!==void 0){if(typeof e.customCss!=`string`)return{ok:!1,error:`The theme customCss must be a string.`};if(Array.from(e.customCss).length>65536)return{ok:!1,error:`The theme customCss is too long (65,536 characters maximum).`};e.customCss&&(t.customCss=e.customCss)}return{ok:!0,theme:Object.keys(t).length?t:void 0}}function En(e){if(!e)return;let t={};return e.preset&&(t.preset=e.preset),e.colorScheme&&(t.colorScheme=e.colorScheme),e.borderRadius&&(t.borderRadius=e.borderRadius),e.density&&(t.density=e.density),e.contrast&&(t.contrast=e.contrast),e.fontFamily&&(t.fontFamily=e.fontFamily),e.custom&&(t.custom={...e.custom}),e.customCss&&(t.customCss=e.customCss),Object.keys(t).length?t:void 0}function Dn(e){let t=e?.colorScheme??`system`,n=e?.custom?`brand colour ${e.custom.primary}`:e?.preset??`glass`;return t===`system`?n:`${n}, ${t}`}var K=`section:`;function On(e,t=xe(T)){let n=Object.keys(t).sort((e,t)=>t.length-e.length);if(!n.length)return e;let r=e=>{if(!e.startsWith(K))return e;let r=e.slice(8);for(let e of n){if(r===e)return`${K}${t[e]}`;if(r.startsWith(`${e}:`))return`${K}${t[e]}${r.slice(e.length)}`}return e},i=e=>e.startsWith(K)&&n.includes(e.slice(8)),a=e=>[...new Set(e)],o={...e};if(e.sectionOrder&&(o.sectionOrder=a(e.sectionOrder.map(r))),e.hidden&&(o.hidden=a(e.hidden.filter(e=>!i(e)).map(r))),e.itemOrder){let t={};for(let[n,i]of Object.entries(e.itemOrder)){let e=r(n);t[e]=a([...t[e]??[],...i.map(r)])}o.itemOrder=t}return e.moved&&(o.moved=Object.fromEntries(Object.entries(e.moved).map(([e,t])=>[r(e),r(t)]))),o}function kn(e,t=T){let n=new Map;for(let e of t){let t=we(e).id;for(let r of ze(e))r.key&&n.set(`${K}${t}:${r.packageId}:${r.model.name}:${r.label}`,Oe(r.packageId,r.model.name,r.key))}let r=e=>{let t=n.get(e);if(t)return t;if(!e.startsWith(K))return e;let r=e.slice(8).split(`:`);return r.length<3||!r[1]||!r[2]?e:Oe(r[1],r[2])},i=e=>[...new Set(e)],a=(e,t)=>{let n={};for(let[i,a]of Object.entries(e)){let e=r(i);e in n||(n[e]=t(a))}return n},o={...e};return e.hidden&&(o.hidden=i(e.hidden.map(r))),e.itemOrder&&(o.itemOrder=a(e.itemOrder,e=>i(e.map(r)))),e.moved&&(o.moved=a(e.moved,r)),e.items&&(o.items=a(e.items,e=>e)),o}var q=`https://s-m-r-t.dev/schemas/cookbook/v1.json`,An=new Set([`basic`,`advanced`,`hidden`]),jn=new Set([`api`,`mcp`,`cli`]),J=e=>({ok:!1,error:e}),Y=e=>typeof e==`object`&&!!e&&!Array.isArray(e),X=e=>Array.isArray(e)&&e.every(e=>typeof e==`string`);function Mn(e,t){if(!Y(e))return`${t} is not an object`;let{objectRef:n,fieldName:r}=e;if(typeof n!=`string`||!n)return`${t} has no objectRef`;if(typeof r!=`string`||!r)return`${t} has no fieldName`;if(e.scopeType!==`app`)return`${t} must have scopeType "app"`;let i={objectRef:n,fieldName:r,scopeType:`app`};for(let n of[`defaultValue`,`help`,`label`]){let r=e[n];if(r!==void 0){if(typeof r!=`string`&&r!==null)return`${t}.${n} is invalid`;i[n]=r}}if(e.visibility!==void 0){let n=e.visibility;if(n!==null&&!(typeof n==`string`&&An.has(n)))return`${t}.visibility is invalid`;i.visibility=n}if(e.displayOrder!==void 0){let n=e.displayOrder;if(n!==null&&!(typeof n==`number`&&Number.isFinite(n)))return`${t}.displayOrder is invalid`;i.displayOrder=n}if(e.locked!==void 0){if(e.locked!==null&&typeof e.locked!=`boolean`)return`${t}.locked is invalid`;i.locked=e.locked}return i}function Nn(e){if(!Y(e)||e.version!==1)return`layout must be an object with version 1`;for(let t of[`sectionOrder`,`hidden`])if(e[t]!==void 0&&!X(e[t]))return`layout.${t} must be a list of strings`;for(let t of[`itemOrder`,`moved`,`panels`])if(e[t]!==void 0&&!Y(e[t]))return`layout.${t} must be an object`;let t=e.itemOrder;if(Y(t)){for(let[e,n]of Object.entries(t))if(e===`__proto__`||!X(n))return`layout.itemOrder.${e} must be a list of strings`}let n=e.moved;if(Y(n)){for(let[e,t]of Object.entries(n))if(e===`__proto__`||typeof t!=`string`)return`layout.moved.${e} must be a string`}return e}function Pn(e,t={}){if(!Y(e))return J(`This is not a cookbook: expected a JSON object.`);if(e.$schema!==void 0&&e.$schema!==`https://s-m-r-t.dev/schemas/cookbook/v1.json`&&e.$schema!==`https://s-m-r-t.dev/schemas/blueprint/v1.json`)return J(`This is not a cookbook: its "$schema" is not a cookbook schema this planner knows.`);let{version:n}=e;if(n===void 0)return J(`This is not a cookbook: it has no "version".`);if(typeof n!=`number`||!Number.isInteger(n))return J(`The cookbook "version" must be a whole number.`);if(n>1)return J(`This cookbook is version ${n}, newer than this planner understands (1). Update the planner or re-export it.`);if(n!==1)return J(`Cookbook version ${n} is not supported (this planner reads version 1).`);if(!X(e.recipes))return J(`The cookbook "recipes" must be a list of recipe ids.`);let r=e.recipes.filter(e=>!D.has(e)),i=[...new Set([...Me(e.recipes.filter(e=>D.has(e)),D),...r])].sort(),a=[];if(e.features!==void 0){if(!X(e.features))return J(`The cookbook "features" must be a list of model names.`);let t=new Set;for(let n of e.features){if(t.has(n))return J(`The cookbook lists the feature ${n} more than once.`);t.add(n)}a=[...e.features].sort()}let o=new Set([...i.flatMap(e=>D.get(e)?.models??[]),...a]);if(!Array.isArray(e.policies))return J(`The cookbook "policies" must be a list.`);let s=[];for(let[t,n]of e.policies.entries()){let e=Mn(n,`policies[${t}]`);if(typeof e==`string`)return J(`Invalid cookbook: ${e}.`);(o.has(e.objectRef)||Ne(e))&&s.push(e)}let c;if(e.exposure!==void 0){if(!Y(e.exposure))return J(`The cookbook "exposure" must be an object.`);let t=[];for(let[n,r]of Object.entries(e.exposure)){if(!X(r)||!r.every(e=>jn.has(e)))return J(`Invalid cookbook: exposure for ${n} must list api, mcp or cli.`);r.length&&o.has(n)&&t.push([n,[...r]])}c=Object.fromEntries(t)}let l;if(e.layout!==void 0){let t=Nn(e.layout);if(typeof t==`string`)return J(`Invalid cookbook: ${t}.`);l=kn(On(t))}let u;if(e.theme!==void 0){let n=Tn(e.theme);if(n.ok)u=n.theme;else if(!t.dropUnknownRecipes)return J(n.error)}let d,f=[];if(e.overviews!==void 0){if(t.overviews){let n=t.overviews(e.overviews,l);if(!n)return J(`The cookbook "overviews" must be an object.`);d=n.overviews,f=n.dropped}else{if(!Y(e.overviews))return J(`The cookbook "overviews" must be an object.`);Object.keys(e.overviews).length&&(f=[`Page customisations (overviews) are not kept by this host and were dropped.`])}}let p={$schema:q,version:1,recipes:i,features:a,policies:s};for(let t of[`name`,`description`]){let n=e[t];if(n!==void 0){if(typeof n!=`string`)return J(`The cookbook "${t}" must be a string.`);n.trim()&&(p[t]=n.trim())}}if(e.specs!==void 0){if(typeof e.specs!=`string`)return J(`The cookbook "specs" must be a string.`);e.specs.trim()&&(p.specs=e.specs.trim())}return c&&Object.keys(c).length&&(p.exposure=c),l&&(p.layout=l),u&&(p.theme=u),d&&Object.keys(d).length&&(p.overviews=d),f.length?{ok:!0,cookbook:p,dropped:f}:{ok:!0,cookbook:p}}var Fn=e=>({ok:!1,error:e});function In(e,t={}){return Pn(e,{...t,overviews:mn})}function Ln(e,t={}){let n;try{n=JSON.parse(e)}catch{return Fn(`This file is not valid JSON.`)}try{return In(n,t)}catch{return Fn(`This file is not a valid cookbook.`)}}var Z=`smrt-planner:cookbook-doc:v1`,Rn=`smrt-planner:blueprint:v1`,zn=`smrt-planner:cookbook-doc:unreadable`;function Bn(){try{return globalThis.localStorage??null}catch{return null}}function Vn(e){if(!e)return{status:`unavailable`};let t;try{t=e.getItem(Z)}catch{return{status:`unavailable`}}let n=null;try{n=e.getItem(Rn)}catch{}let r=t===null&&n!==null,i=r?n:t;if(i===null)return{status:`empty`};let a=Ln(i,{dropUnknownRecipes:!0});if(a.ok)return r&&Q(e,Z,JSON.stringify(a.cookbook)),{status:`loaded`,cookbook:a.cookbook,previousKept:n!==null,...a.dropped?{dropped:a.dropped}:{}};t=i;let o=Q(e,zn,t);return{status:`unreadable`,reason:a.error,keptAside:o}}function Q(e,t,n){if(!e)return!1;try{return e.setItem(t,n),!0}catch{return!1}}function Hn(e,t){if(!e)return!1;try{return e.removeItem(t),!0}catch{return!1}}function Un(e,t){return Q(e,Z,JSON.stringify(t))}function Wn(e,t={}){let n={$schema:q,version:1,...Ie(e)};t.name&&(n.name=t.name),t.description&&(n.description=t.description),t.specs&&(n.specs=t.specs),t.layout&&(n.layout=t.layout);let r=En(t.theme);r&&(n.theme=r);let i=t.overviews??{},a=Object.keys(i).sort();return a.length&&(n.overviews=Object.fromEntries(a.map(e=>[e,i[e]]))),n}var Gn=new Set([`basic`,`advanced`,`hidden`]),Kn=new Set([`api`,`mcp`,`cli`]);function qn(e){let t=e.replace(/-/g,`+`).replace(/_/g,`/`),n=atob(t+`=`.repeat((4-t.length%4)%4));return new TextDecoder().decode(Uint8Array.from(n,e=>e.charCodeAt(0)))}function Jn(e){let t=new URLSearchParams(e);return t.has(`r`)||t.has(`o`)}function Yn(e){let t={rows:[],narrowed:{}};if(!e)return t;let n;try{n=JSON.parse(qn(e))}catch{return t}if(!n||typeof n!=`object`)return t;let r=[];for(let[e,t]of Object.entries(n.r??{}))if(t&&typeof t==`object`)for(let[n,i]of Object.entries(t)){if(!i||typeof i!=`object`)continue;let t={objectRef:e,fieldName:n,scopeType:`app`};typeof i.v==`string`&&Gn.has(i.v)&&(t.visibility=i.v),typeof i.l==`string`&&(t.label=i.l),(typeof i.h==`string`||i.h===null)&&(t.help=i.h),(typeof i.d==`string`||i.d===null)&&(t.defaultValue=i.d),typeof i.o==`number`&&Number.isFinite(i.o)&&(t.displayOrder=i.o),typeof i.k==`boolean`&&(t.locked=i.k),r.push(t)}let i={};for(let[e,t]of Object.entries(n.x??{})){if(!Array.isArray(t))continue;let n=t.filter(e=>Kn.has(e));n.length&&(i[e]=n)}return{rows:r,narrowed:i}}function Xn(e){let t=new URLSearchParams(e),n=(t.get(`r`)??``).split(`,`).filter(Boolean),r=Me(Le(n,D),D),i=new Set(r.flatMap(e=>D.get(e)?.models??[])),{rows:a,narrowed:o}=Yn(t.get(`o`)??``),s={$schema:q,version:1,recipes:r,features:[],policies:a.filter(e=>i.has(e.objectRef))},c=Object.fromEntries(Object.entries(o).filter(([e])=>i.has(e)));return Object.keys(c).length&&(s.exposure=c),s}var Zn=`smrt-planner:shell`;function $(e){let t=Fe(e),n=e.policies.some(e=>e.defaultValue!==void 0&&Ne(e));s(Re(e)||n?t.taxRate:void 0),o({pricesIncludeTax:t.pricesIncludeTax,taxRounding:t.taxRounding,currency:t.currency})}var Qn=new class{#e=r(0);get replacementGeneration(){return e(this.#e)}set replacementGeneration(e){i(this.#e,e,!0)}#t=r();get layout(){return e(this.#t)}set layout(e){i(this.#t,e,!0)}#n=r();get name(){return e(this.#n)}set name(e){i(this.#n,e,!0)}#r=r();get description(){return e(this.#r)}set description(e){i(this.#r,e,!0)}#i=r();get specs(){return e(this.#i)}set specs(e){i(this.#i,e,!0)}#a=r();get theme(){return e(this.#a)}set theme(e){i(this.#a,e,!0)}#o=r({});get overviews(){return e(this.#o)}set overviews(e){i(this.#o,e)}#s=r(`unknown`);get persist(){return e(this.#s)}set persist(e){i(this.#s,e,!0)}#c=r(!1);get loaded(){return e(this.#c)}set loaded(e){i(this.#c,e,!0)}hostManaged=!1;#l=r(``);get loadNotice(){return e(this.#l)}set loadNotice(e){i(this.#l,e,!0)}saveBlocked=!1;#u=r(!1);get keepLegacyUrl(){return e(this.#u)}set keepLegacyUrl(e){i(this.#u,e,!0)}replacedBeforeLoad=!1;previousKept=!1;storage=null;timer;snapshot(){return Wn(n(E.data),{layout:n(this.layout),theme:n(this.theme),overviews:n(this.overviews),name:this.name,description:this.description,specs:this.specs})}overview(e){return Object.hasOwn(this.overviews,e)?this.overviews[e]:null}setOverview(e,t){let n=Object.fromEntries(Object.entries(this.overviews).filter(([t])=>t!==e));t&&(n[e]=t),this.overviews=n}setLayout(e){this.layout=S(e)?void 0:e}setSpecs(e){let t=e.trimEnd();this.specs=t.trim()?t:void 0}apply(e){E.load(e),this.layout=e.layout,this.theme=e.theme,this.name=e.name,this.description=e.description,this.specs=e.specs,this.overviews={...e.overviews??{}},$(e)}get unavailableNotice(){let e=[...E.unavailableRecipes,...E.unavailableFeatures];if(!e.length)return``;let t=e.length;return`${t} ${t===1?`recipe`:`recipes`} in this cookbook ${t===1?`isn't`:`aren't`} available in this version: ${e.join(`, `)}. They are kept when you save or export.`}removeUnavailable(){E.removeUnavailable(),this.scheduleSave()}setTheme(e){this.theme=En(e)}settings(){return Fe(this.snapshot())}setSettings(e){let t=Pe(this.snapshot(),e);E.rows=t.policies.map(e=>({...e})),$(t)}replace(e){this.replacementGeneration++,this.apply(e),this.loaded||(this.replacedBeforeLoad=!0),this.saveBlocked=!1,this.keepLegacyUrl=!1}reset(e={}){this.replacementGeneration++,E.clear(),$({policies:[]}),this.layout=void 0,e.preserveTheme||(this.theme=void 0),this.name=void 0,this.description=void 0,this.specs=void 0,this.overviews={},this.saveBlocked=!1,this.keepLegacyUrl=!1}importText(e){let t=Ln(e);return t.ok&&this.replace(t.cookbook),t}hydrate(e,t=d()){this.storage=t;let n=Vn(t);n.status===`loaded`&&(this.previousKept=n.previousKept),n.status===`loaded`&&!this.replacedBeforeLoad?(this.apply(n.cookbook),n.dropped?.length&&(this.loadNotice=`Some saved page customisations could not be used and were removed: ${n.dropped.join(` `)}`)):n.status===`unreadable`&&(this.saveBlocked=!n.keptAside,this.loadNotice=n.keptAside?`The saved cookbook could not be read (${n.reason}) and was kept aside; starting empty.`:`The saved cookbook could not be read (${n.reason}). Starting empty without overwriting it; import or reset to save again.`);let r=!1;if(Jn(e)&&(n.status===`loaded`&&!Q(t,`smrt-planner:cookbook-doc:backup`,JSON.stringify(n.cookbook))&&(this.saveBlocked=!0),this.apply(Xn(e)),r=!0),this.persist=n.status===`unavailable`?`memory`:`unknown`,this.loaded=!0,r){let e=this.save();this.keepLegacyUrl=!e}return r}save(){if(clearTimeout(this.timer),this.timer=void 0,!this.loaded)return!1;if(this.hostManaged)return!0;if(this.saveBlocked)return this.persist=`memory`,!1;let e=Un(this.storage,this.snapshot());return this.persist=e?`ok`:`memory`,e&&this.previousKept&&(this.previousKept=!Hn(this.storage,Rn)),e&&(this.keepLegacyUrl=!1),e}scheduleSave(){this.loaded&&!this.hostManaged&&(clearTimeout(this.timer),this.timer=setTimeout(()=>this.save(),300))}flush(){this.timer!==void 0&&this.save()}};export{j as A,N as C,ut as D,mt as E,st as O,ht as S,_t as T,Cn as _,Bn as a,$t as b,q as c,_n as d,gn as f,Dn as g,hn as h,Z as i,ot as j,M as k,yn as l,G as m,Qn as n,In as o,bn as p,$ as r,Ln as s,Zn as t,xn as u,sn as v,gt as w,F as x,en as y};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{$ as e,bt as t,tt as n,vt as r,xt as i}from"./DG3qFFTE.js";import{F as a,G as o,H as s,N as c,P as ee,U as te,V as l,W as u,_t as d,ct as f,ft as p,pt as m,w as h,z as ne}from"./
|
|
1
|
+
import{$ as e,bt as t,tt as n,vt as r,xt as i}from"./DG3qFFTE.js";import{F as a,G as o,H as s,N as c,P as ee,U as te,V as l,W as u,_t as d,ct as f,ft as p,pt as m,w as h,z as ne}from"./Zte-WUy-.js";import{_ as re,r as ie}from"./b-_V29X7.js";import{c as ae}from"./CzOwak4Z.js";import"./HiOPVQ5l.js";import{i as oe,n as g,o as _,r as v,s as y}from"./DQOroCMN.js";import{M as b,P as x,V as S,W as C,b as w,t as T,v as E,x as D,z as O}from"./Dvyr8zQc.js";import{b as k,v as A,x as j,y as M}from"./BRCZe8R4.js";import{n as N}from"./BUdNw_R5.js";import{t as P}from"./ChNjGKYd.js";import{r as F,t as I}from"./DqF3UNFg.js";import{a as L,c as R,d as z,l as B,n as V}from"./D9MBacZo.js";function H(e,t=A.appliedWork){return j(e.snapshot(),t)}function U(e,t,n){let r=M(e,_,n);if(r.ok){let n=t.theme,i=r.cookbook.theme,o=i?i.colorScheme||!n?.colorScheme?void 0:{...i,colorScheme:n.colorScheme}:n;t.replace(r.cookbook),o&&(t.theme=o),a(e.id),A.select(e.id,k(t.snapshot()))}return r}function W(e,t){return e.document.recipes.every(e=>t.recipes.includes(e))&&e.document.features.every(e=>t.features.includes(e))}function G(e){let t=e.recipes.flatMap(e=>{let t=D.get(e);return t?[t]:[]}),n=O(t).map(e=>{let t=new Set,n=[];for(let r of e.recipes)for(let e of E(r)){let r=S(e.packageId,e.model.name,e.key);t.has(r)||(t.add(r),n.push({id:r,href:`#`,label:e.label,icon:e.icon,description:e.description}))}return{id:`section:${e.id}`,heading:e.label,items:n}}).filter(e=>e.items.length>0),r=x(e.features).map(e=>({id:e.id,href:`#`,label:e.label,icon:e.icon,description:e.description}));return r.length&&n.push({id:`section:${b.id}`,heading:b.label,items:r}),n}function K(e){let t=e.layout;return re([],G(e),void 0,t).groups.map(e=>({id:e.id??String(e.heading),label:e.heading??``,entries:e.items.map(e=>({id:e.id??e.href,label:t?.items?.[e.id??e.href]?.label?.trim()||e.label}))}))}var q={live:`Live`,mock:`Mock`,sample:`Sample`,server:`Server`},se={live:`Runs for real in your browser.`,mock:`Runs in your browser, but a provider is faked.`,sample:`Shows sample data only; it cannot reach what it needs.`,server:`Needs a server, which this browser-only demo does not have.`},ce={live:`success`,mock:`info`,sample:`warning`,server:`default`};function le(e){return e.effectiveDemo??e.demo}function ue(e){if(e)return{mode:e.mode,label:q[e.mode],meaning:se[e.mode],variant:ce[e.mode],reasons:e.reasons,mocked:e.mocked??[]}}function de(e){if(!e)return;if(e.status===`browser-safe`)return`Its package builds for a browser.`;let t=[`Its package does not build for a browser yet`];return e.reason&&t.push(`(${e.reason})`),e.issues?.length&&t.push(`and is tracked in ${e.issues.join(`, `)}`),`${t.join(` `)}.`}var J=`@happyvertical/smrt-commerce:`,fe=`${J}TaxCode`,pe=`${J}TaxComponent`,Y=`${J}TaxSettings`,me=`${J}DocumentTax`;function X(){let e=ee()??.05;return{codes:p(e),fallback:f(e)}}function he(e){try{let t=e?.getItem(oe);if(!t)return;let n=y(t,{dropUnknownRecipes:!0});n.ok&&v(n.cookbook)}catch{}}function ge(){return he(u()),I({storage:u(),defaults:e=>T.apply(e).background,empty:[L,V,me,P],samples:{[fe]:{from:[],make:()=>X().codes.map(e=>({id:e.id,code:e.code,name:e.name,kind:e.kind,appliesTo:e.appliesTo,active:e.active,componentsJson:JSON.stringify(e.components.map(e=>({taxComponentId:e.id,compound:!1})))}))},[pe]:{from:[],make:()=>m(X().codes).map(e=>({id:e.id,name:e.name,percent:e.percent,liabilityAccountId:null,recoverable:e.recoverable,active:!0}))},[Y]:{from:[],make:()=>{let{fallback:e}=X(),t=c();return[{id:h(`${Y}:sample`),defaultSalesTaxCodeId:e.id,defaultPurchaseTaxCodeId:e.id,defaultLineAmountType:t.pricesIncludeTax?`inclusive`:`exclusive`,taxRoundingScope:t.taxRounding}]}},...R(F),[B]:{from:[F(`@happyvertical/smrt-products:Product`)],make:([e])=>(e??[]).map((e,t)=>({id:h(`${B}:sample:${e.id}`),name:`${String(e.name??`Product`)} image`,sourceUri:`data:image/svg+xml,${encodeURIComponent(`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 240 240"><rect width="240" height="240" fill="hsl(${t*47%360} 40% 82%)"/><circle cx="120" cy="94" r="46" fill="hsl(${(t*47+30)%360} 35% 58%)"/><path d="M44 214c20-55 132-55 152 0" fill="hsl(${(t*47+10)%360} 30% 46%)"/><text x="120" y="224" text-anchor="middle" font-family="sans-serif" font-size="14" fill="white">${String(e.name??``).replace(/[<&>]/g,``)}</text></svg>`)}`,mimeType:`image/svg+xml`,description:`Sample image for ${String(e.name??`this product`)}.`,sourceType:`browser-demo`}))},[z]:{from:[F(`@happyvertical/smrt-products:Product`),F(B)],make:([e,t])=>(e??[]).flatMap((e,n)=>{let r=t?.[n];return r?[{id:h(`${z}:sample:${e.id}`),productId:e.id,assetId:r.id,relationship:`gallery`,sortOrder:0}]:[]})}},children:{models:d.packages.flatMap(e=>e.models),links:e=>C(d,w,e)}})}var _e=new class{#e=t(void 0);get endpoint(){return e(this.#e)}set endpoint(e){r(this.#e,e,!0)}#t=t(!1);get tokenInConfig(){return e(this.#t)}set tokenInConfig(e){r(this.#t,e,!0)}#n=t(void 0);get token(){return e(this.#n)}set token(e){r(this.#n,e,!0)}#r=t(`idle`);get status(){return e(this.#r)}set status(e){r(this.#r,e,!0)}#i=t(void 0);get outcome(){return e(this.#i)}set outcome(e){r(this.#i,e,!0)}get config(){return this.endpoint&&this.token&&!this.tokenInConfig?{endpoint:this.endpoint,token:this.token}:void 0}get needsLink(){return!!this.endpoint&&!this.token&&!this.tokenInConfig}configure(e,t){this.endpoint=e?.endpoint,this.tokenInConfig=e?.tokenInConfig===!0,this.token=e?t:void 0,this.status=`idle`,this.outcome=void 0}async send(e,t){let n=this.config;if(!n||this.status===`sending`)return;this.status=`sending`,this.outcome=void 0;let r=await ae(n,e,t);this.outcome=r,this.status=r.ok?`sent`:`failed`}},Z=`cookbook`,ve=new class{#e=t(null);get open(){return e(this.#e)}set open(e){r(this.#e,e,!0)}#t=t(null);get returnTo(){return e(this.#t)}set returnTo(e){r(this.#t,e,!0)}navigator=null;show(e){this.returnTo=e,this.navigator?this.navigator.open(e):this.set(e)}back(){this.open&&(this.returnTo=this.open),this.navigator?this.navigator.close():this.set(null)}async set(e,t=!0){this.open!==e&&(t?await ie(async()=>{this.open=e,await n()}):this.open=e)}};function ye(e,t){let n=new URLSearchParams(e).get(Z);return n&&t.includes(n)?n:null}function be(e,t){let n=new URLSearchParams(e);t?n.set(Z,t):n.delete(Z);let r=n.toString().replace(/%2C/gi,`,`);return r?`?${r}`:``}var xe=`Planner`;function Q(e,t,n=N,r=xe){let i=e.name?.trim();if(i)return i;let a=t?n.find(e=>e.id===t):void 0;return a&&W(a,e)?a.name:r}function Se(e){return Q(g.snapshot(),A.active,void 0,e)}var Ce=Symbol(`planner-project-persistence-owner`),$=t(0),we={get remembering(){return e($),l()},get recoveryAvailable(){return e($),o().recoveryAvailable()},setRemember(e){let t=te(e);return i($),t},recover(){let e=o().recover();return i($),e},discardRecovery(){let e=o().discardRecovery();return i($),e}};function Te(e){if(!s())return!1;try{e.nativeAssistant?.reset(),g.reset({preserveTheme:!0}),A.active=null,A.appliedWork=null,ne(),a(null),e.dataSource.reset?.(),e.controller.resetWorkspace?.()}finally{i($),e.onreset?.()}return!0}export{H as _,ye as a,_e as c,ue as d,le as f,W as g,U as h,Se as i,ge as l,K as m,Te as n,ve as o,G as p,we as r,be as s,Ce as t,de as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./
|
|
1
|
+
import{t as e}from"./HiOPVQ5l.js";var t=new Map;function n(n,r){if(e())return 0;if(typeof document>`u`)return r;let i=t.get(n);if(i!==void 0)return i;let a=getComputedStyle(document.documentElement).getPropertyValue(`--smrt-duration-${n}`).trim(),o=/^([\d.]+)(ms|s)$/.exec(a),s=o?Number(o[1])*(o[2]===`s`?1e3:1):r;return t.set(n,s),s}export{n as t};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{$ as e,A as t,B as n,Ct 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,Ot as m,Pt as h,R as g,Rt as _,U as v,W as y,X as b,Y as x,Z as S,_ as C,a as w,b as T,bt as E,ct as D,dt as O,ft as k,gt as A,ht as j,it as M,k as N,mt as P,n as F,o as I,pt as L,q as R,s as z,st as B,tt as V,ut as H,v as U,vt as W,xt as G,y as K,z as ee}from"./DG3qFFTE.js";import{n as q}from"./
|
|
1
|
+
import{$ as e,A as t,B as n,Ct 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,Ot as m,Pt as h,R as g,Rt as _,U as v,W as y,X as b,Y as x,Z as S,_ as C,a as w,b as T,bt as E,ct as D,dt as O,ft as k,gt as A,ht as j,it as M,k as N,mt as P,n as F,o as I,pt as L,q as R,s as z,st as B,tt as V,ut as H,v as U,vt as W,xt as G,y as K,z as ee}from"./DG3qFFTE.js";import{n as q}from"./BqNQVyhl.js";import"./xihTtKlq.js";import{i as J,r as Y}from"./BLUInGBV.js";import{a as X,t as te}from"./Bq8E3AWP.js";import{$ as ne,C as re,St as ie,X as ae,_ as oe,_t as se,a as ce,bt as le,c as ue,d as de,et as fe,f as pe,g as me,h as he,nt as ge,p as _e,q as ve,t as ye,tt as be,u as xe,ut as Se,v as Ce,yt as we}from"./Zte-WUy-.js";import{n as Z}from"./DK8Blf1Y.js";import{n as Te}from"./v8gneLl4.js";import"./ChpbeHev.js";import{u as Ee}from"./DIE02RSm.js";import{b as De,d as Oe,f as ke,l as Ae,n as je,r as Me,x as Ne}from"./CGVkRTMI.js";import"./-jVMvnpv.js";import{t as Pe}from"./C842jeAa.js";import{S as Fe,_ as Ie,a as Le,d as Re,f as ze,g as Be,h as Ve,m as He,n as Ue,p as We,r as Ge,t as Ke,u as qe,v as Je,x as Ye}from"./BDhA6I_M.js";import{A as Xe,C as Ze,E as Qe,O as $e,S as et,j as tt,k as nt,n as rt,v as it,w as at,x as ot,y as st}from"./DQOroCMN.js";import{G as ct,H as lt,M as ut,Q as dt,U as ft,W as pt,X as mt,b as ht,g as gt,h as _t,q as vt,t as yt,v as bt,x as xt}from"./Dvyr8zQc.js";import{a as St,i as Ct,n as wt,r as Tt}from"./CO-Ek-HE.js";import{a as Et,c as Dt,i as Ot,l as kt,n as At}from"./B2up491X.js";import{r as jt}from"./D_U_DYjx.js";import"./ChNjGKYd.js";import{t as Mt}from"./piAsleGb.js";import{a as Nt,d as Pt,i as Ft,l as It,o as Lt,p as Rt,r as zt,s as Bt,u as Vt}from"./DqF3UNFg.js";import{a as Ht,d as Ut,f as Wt,i as Gt,l as Kt,o as qt,p as Jt,r as Yt,s as Xt,u as Zt}from"./D9MBacZo.js";import{n as Qt}from"./CgAkqYsL.js";import{a as $t,i as en,n as tn,o as nn,r as rn,s as an,t as on}from"./BY56fjip.js";import{t as sn}from"./JBD5vUbP.js";function cn(e,t){return{key:t,direction:e?.key===t&&e.direction===`ascending`?`descending`:`ascending`}}var ln=new Intl.Collator(void 0,{numeric:!0,sensitivity:`base`});function un(e){return e==null||e===``||typeof e==`number`&&!Number.isFinite(e)}function dn(e,t){if(typeof e==`number`&&typeof t==`number`)return e-t;if(typeof e==`boolean`&&typeof t==`boolean`)return Number(e)-Number(t);let n=e instanceof Date?e.getTime():e,r=t instanceof Date?t.getTime():t;return typeof n==`number`&&typeof r==`number`?n-r:ln.compare(String(n),String(r))}function fn(e,t,n){return t?e.map((e,r)=>({row:e,index:r,value:n(e,t.key)})).sort((e,n)=>{let r=un(e.value);if(r!==un(n.value))return r?1:-1;let i=r?0:dn(e.value,n.value);return(t.direction===`ascending`?i:-i)||e.index-n.index}).map(({row:e})=>e):[...e]}var pn={name:`@happyvertical/smrt-assets`,displayName:`Assets`,description:`Provider-agnostic asset management with versioning, metadata, folders, and associations`,uiSlots:{"attachment-list":{id:`attachment-list`,label:`Attachment List`,description:`Authorized private links and supplied version history`,icon:`file-text`,category:`list`,order:8,propsInterface:`AttachmentListProps`},"attachment-upload":{id:`attachment-upload`,label:`Attachment Upload`,description:`Native multipart upload with retained request fields and recovery guidance`,icon:`upload`,category:`form`,order:9,propsInterface:`AttachmentUploadProps`},"attachment-panel":{id:`attachment-panel`,label:`Attachments`,description:`Attachment list and optional native upload composition`,icon:`file-text`,category:`display`,order:10,propsInterface:`AttachmentPanelProps`},"asset-manager":{id:`asset-manager`,label:`Asset Manager`,description:`Combined asset management surface with toolbar, grid/list view, detail, and selection`,icon:`folder-image`,category:`admin`,order:1,propsInterface:`AssetManagerProps`},"asset-grid":{id:`asset-grid`,label:`Asset Grid`,description:`Grid view of asset thumbnails with selection`,icon:`grid`,category:`list`,order:2,propsInterface:`AssetGridProps`},"asset-list":{id:`asset-list`,label:`Asset List`,description:`Sortable list view of assets with metadata columns`,icon:`list`,category:`list`,order:3,propsInterface:`AssetListProps`},"asset-detail":{id:`asset-detail`,label:`Asset Detail`,description:`Detailed view of a single asset with metadata and preview`,icon:`file-text`,category:`detail`,order:4,propsInterface:`AssetDetailProps`},"asset-toolbar":{id:`asset-toolbar`,label:`Asset Toolbar`,description:`Toolbar with view toggle, filters, sort, and upload action`,icon:`sliders`,category:`action`,order:5,propsInterface:`AssetToolbarProps`},"asset-action-bar":{id:`asset-action-bar`,label:`Asset Action Bar`,description:`Bulk action bar shown when assets are selected`,icon:`more-horizontal`,category:`action`,order:6,propsInterface:`ActionBarProps`},"asset-create-modal":{id:`asset-create-modal`,label:`Create Asset Modal`,description:`Modal dialog for uploading and creating a new asset`,icon:`upload`,category:`form`,order:7,propsInterface:`CreateAssetModalProps`}},models:[`Asset`,`AssetType`,`AssetStatus`,`AssetMetafield`,`Folder`],collections:[`AssetCollection`,`AssetTypeCollection`,`AssetStatusCollection`,`AssetMetafieldCollection`,`AssetAssociationCollection`,`FolderCollection`]},Q=X({"assets.action_bar.delete_confirm_title":`Delete {count} asset{plural}?`,"assets.action_bar.delete_confirm_message_one":`This action cannot be undone. The asset and its file data will be permanently removed.`,"assets.action_bar.delete_confirm_message_other":`This action cannot be undone. The assets and their file data will be permanently removed.`,"assets.action_bar.delete":`Delete`,"assets.action_bar.cancel":`Cancel`,"assets.asset_detail.open_pdf_in_new_tab":`Open PDF in new tab`,"assets.asset_detail.alt_text":`Alt Text`,"assets.asset_detail.alt_text_missing_warning":`⚠️ Missing — required for accessibility`,"assets.asset_detail.quick_actions":`Quick Actions`,"assets.asset_detail.copy_url":`📋 Copy URL`,"assets.asset_detail.copy_markdown":`📝 Copy Markdown`,"assets.asset_detail.edit_image":`✏️ Edit Image`,"assets.asset_detail.used_in":`Used In`,"assets.asset_detail.alt_text_placeholder":`Describe this image for screen readers`,"assets.asset_detail.description_placeholder":`Optional description`,"assets.asset_grid.loading":`Loading assets...`,"assets.asset_grid.no_assets_found":`No assets found`,"assets.asset_grid.empty_hint":`Upload an asset or change your search filters to see results.`,"assets.asset_grid.no_alt":`⚠️ No alt`,"assets.asset_grid.missing_alt_text":`Missing alt text`,"assets.asset_grid.open_named":`Open {name}`,"assets.asset_grid.select_named":`Select {name}`,"assets.asset_grid.select_named_checkbox":`Select {name}`,"assets.asset_list.loading":`Loading assets...`,"assets.asset_list.no_assets_found":`No assets found`,"assets.asset_list.empty_hint":`Upload an asset or change your search filters to see results.`,"assets.asset_list.select_all":`Select all`,"assets.asset_list.select_named":`Select {name}`,"assets.asset_manager.drop_file_to_upload":`Drop file to upload`,"assets.asset_toolbar.all_types":`All types`,"assets.asset_toolbar.newest_first":`Newest first`,"assets.asset_toolbar.oldest_first":`Oldest first`,"assets.asset_toolbar.name_a_z":`Name A–Z`,"assets.asset_toolbar.name_z_a":`Name Z–A`,"assets.asset_toolbar.recently_updated":`Recently updated`,"assets.asset_toolbar.search_placeholder":`Search assets...`,"assets.asset_toolbar.search_assets":`Search assets`,"assets.asset_toolbar.clear_search":`Clear search`,"assets.asset_toolbar.filter_by_type":`Filter by type`,"assets.asset_toolbar.sort_assets":`Sort assets`,"assets.asset_toolbar.view_mode":`View mode`,"assets.asset_toolbar.view_label":`{label} view`,"assets.create_asset_modal.dropzone_text":`Drag & drop a file here, or click to browse`,"assets.create_asset_modal.dropzone_hint":`You can also paste an image from your clipboard`,"assets.create_asset_modal.large_file_warning":`⚠️ Large file — may slow page loads`,"assets.create_asset_modal.alt_text":`Alt Text`,"assets.create_asset_modal.alt_text_recommended_warning":`⚠️ Recommended for accessibility`,"assets.create_asset_modal.name_placeholder":`Asset name`,"assets.create_asset_modal.description_placeholder":`Optional description`,"assets.create_asset_modal.alt_text_placeholder":`Describe this image for screen readers`,"assets.create_asset_modal.upload_asset":`Upload Asset`,"assets.create_asset_modal.preview_alt":`Preview`,"assets.create_asset_modal.remove_file":`Remove file`,"assets.create_asset_modal.upload_failed":`Upload failed. Please try again.`,"assets.asset_detail_preview.modal_preview":`Modal Preview`,"assets.asset_detail_preview.description":`Launch the asset detail dialog from inside the preview stage so the shared
|
|
2
2
|
playground stays navigable.`,"assets.asset_detail_preview.open_asset_detail":`Open Asset Detail`,"assets.create_asset_modal_preview.modal_preview":`Modal Preview`,"assets.create_asset_modal_preview.title":`Create Asset Modal`,"assets.create_asset_modal_preview.description":`Open the upload dialog from inside the preview stage to exercise the real
|
|
3
3
|
modal flow without covering the host navigation.`,"assets.create_asset_modal_preview.open_upload_modal":`Open Upload Modal`,"assets.create_asset_modal_preview.alt_text":`Alt Text`,"assets.asset_manager_route.eyebrow":`Package Route Surface`,"assets.asset_manager_route.title":`Asset Manager`,"assets.asset_manager_route.lede":`The reference route for browsing, selecting, and reviewing uploaded
|
|
4
4
|
assets with the package-owned asset manager UI.`,"assets.asset_manager_route.selection_state":`Selection State`,"assets.asset_manager_route.no_assets_selected":`No assets selected.`,"assets.asset_manager_route.assets_selected":`asset{plural} selected.`,"assets.asset_manager_route.custom_action_example":`Custom Action Example`,"assets.asset_manager_route.custom_action_description":`This route keeps package-owned defaults while leaving room for app
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{$ as e,A as t,D as n,E as r,J as i,M as a,N as o,P as s,Q as c,S as l,T as u,Y as d,Z as f,at as p,bt as m,ct as h,dt as g,et as _,ft as ee,gt as v,it as y,j as te,k as b,lt as x,mt as ne,rt as re,st as S,ut as C,w,x as T,y as E,z as ie}from"./DormgCOG.js";var D=e=>{let t=m(e);if(!t)throw Error(`The catalog has no model ${e}`);return t.model};function O(e){return String(e??``).toUpperCase().replace(/[^A-Z0-9]+/g,`-`).replace(/^-+|-+$/g,``)}var k=/\{([A-Za-z_][\w]*\.[A-Za-z_][\w]*)(?:\|(slug))?\}/g;function A(e,t){return e.replace(k,(e,n,r)=>{let i=t[n],a=i==null?``:String(i);return r===`slug`?O(a):a})}function j(e,t,n=e=>e){return typeof e==`string`?A(e,t):typeof e==`object`&&e?{ref:n(e.ref),...e.field?{field:e.field}:{}}:e}function M(e,t,n){return Object.fromEntries(Object.entries(e??{}).map(([e,r])=>[e,j(r,t,n)]))}function N(e){return typeof e==`string`||typeof e==`number`||typeof e==`boolean`||typeof e==`object`&&e&&!Array.isArray(e)?e:null}function P(e,t,n){return Object.fromEntries(e.flatMap(e=>{let r=F(e.to);return r.alias===t?[[r.field,N(n[e.id])]]:[]}))}function F(e){let t=e.indexOf(`.`);if(t<1||t===e.length-1)throw Error(`A form field maps to "alias.field", got "${e}"`);return{alias:e.slice(0,t),field:e.slice(t+1)}}function I(e,t,n){let{alias:r,field:i}=F(e.to),a=t.find(e=>e.as===r);if(!a)throw Error(`Form field ${e.id} maps to unknown ${r}`);let o=n(a.model).fields.find(e=>e.name===i);if(!o)throw Error(`${a.model} has no field ${i} (form field ${e.id})`);return o}function L(e,t){let{alias:n}=F(e.to),r=t.find(e=>e.as===n);if(!r)throw Error(`Form field ${e.id} maps to unknown ${n}`);return r.model}function R(e,t){return e.default===void 0?t.default===void 0?t.type===`text`?``:null:t.default:e.default}function z(e,t){return Object.fromEntries(e.map(e=>[e.to,t[e.id]]))}var B=(e,t)=>e===t;async function V(e,t,n,r){let i={...n};for(let n of t){if(n.as in i)continue;if(!n.match){i[n.as]=void 0;continue}let t={},a=!0;for(let[e,r]of Object.entries(n.match))if(typeof r==`object`&&r){let n=i[r.ref];n||(a=!1),t[e]=r.field?n?.[r.field]:n?.id}else t[e]=r;i[n.as]=a?(await e.list(r(n.model))).find(e=>Object.entries(t).every(([t,n])=>B(e[t],n))):void 0}return i}var H=4,U=(e,t)=>e.fields.some(e=>e.name===t);function W(e,r,i,o,s){let c=l(n(`${o}:${e.id}:${i.id}`)),d=U(e,`debit`)&&U(e,`credit`),f=d?2*(1+Math.floor(c()*2)):1+Math.floor(c()*H),p=_(e),m=1e3*(1+Math.floor(c()*90));return Array.from({length:f},(l,f)=>{let h=n(`${i.id}:${f}`)%997,g={...u(e,h,o,s),id:w(`${e.id}:${i.id}:${f}`),[r]:i.id};if(U(e,`sortOrder`)&&(g.sortOrder=f),p){let n=e.fields.find(e=>e.related?.endsWith(`:Product`)&&e.name in g),r=a(),{products:o}=r,l=n?o[t(n,{modelId:e.id,index:h,rows:s})%o.length]:o[h%o.length],u=b(h);u?(U(e,`description`)&&(g.description=u.description),g.unitPrice=u.price,n&&(g[n.name]=``)):n&&l&&(U(e,`description`)&&(g.description=l.name),g.unitPrice=l.price);let[d,p]=u?.quantity??l?.quantity??r.lineQuantity??[1,5],m=d+Math.floor(c()*(p-d+1));U(e,`quantity`)&&(g.quantity=m),Object.assign(g,ae(e,i,f,m,Number(g.unitPrice??0))),g.amount=C(g)}if(d){let e=f%2==0;g.debit=e?m/100:0,g.credit=e?0:m/100}return g})}function G(e){return n(`discount:${e.id}`)%3==0}function K(e,t){return Math.round(e*t/1e3)*100}function q(e,t){return t>0&&n(`tax-override:${e.id}:${t}`)%7==0}function J(e,t,r=o().currency){let i=n(`tax-override-kind:${e.id}:${t}`)%4,a=x(r);if(a&&i<2)return a;let s=i%2==0?`exempt`:`zero-rated`;return S.find(e=>e.kind===s)}function ae(e,t,r,i,a){let o={},s=r===0&&G(t),c=n(`discount-kind:${t.id}`)%2==0;U(e,`discountType`)&&(o.discountType=s?c?`percent`:`amount`:`none`),U(e,`discountRate`)&&(o.discountRate=s&&c?`10`:null),U(e,`discount`)&&(o.discount=s&&!(c&&U(e,`discountType`))?K(i,a):0),!U(e,`discountType`)&&o.discount&&(o.discountType=`amount`);let l=q(t,r)?J(t,r):void 0;return U(e,`taxMode`)&&(o.taxMode=l?`override`:`inherit`),U(e,`taxCodeId`)&&(o.taxCodeId=l?.id??null),o}function oe(e,t){let n={...e,...t};return`discount`in t&&!(`discountType`in t)&&n.discountType===`amount`&&(n.discountType=`percent`,n.discountRate=`10`,n.discount=0),`discountRate`in t&&n.discountType===`percent`&&(n.discountType=`none`,n.discountRate=null,n.discount=0),n}var se=[`@happyvertical/smrt-commerce:Order`,`@happyvertical/smrt-commerce:Invoice`],Y=2500;function ce(e,t,n){n===2&&se.includes(t.id)&&typeof e.subtotal==`number`&&typeof e.totalAmount==`number`&&(t.fields.some(e=>e.name===`status`&&e.enum?.includes(`draft`))&&(e.status=`draft`),e.subtotal+=Y,e.totalAmount+=Y)}function le(e,t,n,r){if(!n.length||!n.every(e=>`unitPrice`in e))return[...n];let i=y(t,e,n,r);return Object.assign(e,i.row),i.lines}var X=e=>typeof e==`number`&&Number.isFinite(e)?e:0,ue=e=>e.status!==`draft`&&e.status!==`cancelled`&&X(e.totalAmount)>0;function de(e,t,r,i){let a=new Map(r.map(e=>[e.id,X(e.totalAmount)])),o=[];for(let s of t){if(s.status!==`completed`){s.status!==`refunded`&&(s.paidAt=null);continue}let t=l(n(`${i}:alloc:${s.id}`)),c=r.filter(e=>ue(e)&&e.customerId===s.customerId&&(a.get(e.id)??0)>0).slice(0,t()<.3?2:1);if(c.length===0)continue;let d=c.map((e,n)=>{let r=a.get(e.id)??0,i=n>0||t()<.6?r:Math.min(r,Math.max(100,Math.round(r*(.3+t()*.4)/100)*100));return a.set(e.id,r-i),{inv:e,part:i}}),f=Math.max(...d.map(({inv:e})=>Date.parse(String(e.issueDate)))),p=new Date(Math.max(f,Math.min(f+(1+Math.floor(t()*20))*E,T))).toISOString();s.amount=d.reduce((e,t)=>e+t.part,0),s.paidAt=p,`contractId`in s&&d[0]?.inv.contractId&&(s.contractId=d[0].inv.contractId);for(let{inv:t,part:n}of d)o.push({...u(e.model,o.length,i),id:w(`${e.model.id}:${s.id}:${t.id}`),[e.paymentFk]:s.id,[e.invoiceFk]:t.id,amount:n,allocatedAt:p})}return o}function Z(e){return typeof e==`object`&&!!e&&typeof e.ref==`string`}var Q=`smrt-planner:data:v6:`,fe=`@happyvertical/smrt-commerce:TaxCode`,pe=`@happyvertical/smrt-commerce:TaxComponent`,me=[`taxable`,`zero-rated`,`exempt`,`out-of-scope`];function he(e,t){return!!e.fields.find(e=>e.name===`status`)?.enum?.includes(`draft`)&&typeof t.status==`string`&&t.status!==``&&t.status!==`draft`}var $=`${Q}_created`;function ge(e){if(e)try{let t=[];for(let n=0;n<e.length;n++){let r=e.key(n);r?.startsWith(`smrt-planner:data:v6:`)&&t.push(r)}for(let n of t)e.removeItem(n)}catch{}}function _e(t={}){let n=t.seed??1,a=t.rowsPerModel??8,l=new Set(t.empty??[]),u=new Map,m=new Set,b=t.storage??null,x=e=>`${Q}${e.id}`,S=e=>{if(b)try{let t=b.getItem(x(e));if(t===null)return;let n=JSON.parse(t);if(Array.isArray(n)&&n.every(e=>typeof e==`object`&&!!e&&typeof e.id==`string`))return n}catch{}},C=0;if(b)try{C=Number(b.getItem($))||0}catch{C=0}let E=new Map,D=e=>{let n=E.get(e);return n||(n=t.children?.links(e)??[],E.set(e,n)),n},O,k,A=e=>{if(!O){O=new Map;for(let e of t.children?.models??[])for(let t of D(e.id)){let n=O.get(t.model.id)??[];n.push({parent:e,fk:t.fk}),O.set(t.model.id,n)}k=new Map(O);for(let[e,t]of O){let n=e.slice(e.lastIndexOf(`:`)+1).toLowerCase(),r=t.find(e=>n.startsWith(e.fk.replace(/Id$/,``).toLowerCase()))?.fk??t[0]?.fk;O.set(e,t.filter(e=>e.fk===r))}}return O.get(e)??[]},j=t=>{if(!e(t))return;A(t.id);let n=k?.get(t.id)??[],r=d(t)?.name,a=i(t)?.name,o=n.find(e=>e.fk===r)?.parent,s=n.find(e=>e.fk===a)?.parent;return o&&s&&r&&a?{model:t,paymentFk:r,invoiceFk:a,payment:o,invoice:s}:void 0},M=(n,r)=>{if(!p(n))return r;let i=D(n.id).find(t=>e(t.model)),a=i&&j(i.model);if(!i||!a)return r;let o=new Map(P(a.payment).map(e=>[e.id,e])),s=P(i.model).filter(e=>e[i.fk]===r.id&&o.get(String(e[a.paymentFk]))?.status===`completed`).map(e=>({amount:Number(e.amount??0),at:String(e.allocatedAt??``)})),c=re(r,s,(t.now??(()=>T))()),l={...r,amountPaid:c.amountPaid,status:c.status};return n.fields.some(e=>e.name===`paidDate`)&&(l.paidDate=c.paidDate),l},N=(e,t)=>{let n=P(e),r=n.findIndex(e=>e.id===t);r>=0&&(n[r]=M(e,n[r]))},P=e=>{let i=u.get(e.id);if(i)return i;let o=S(e);if(o){u.set(e.id,o);for(let t of D(e.id))P(t.model);return o}let s=l.has(e.id)?void 0:t.samples?.[e.id];if(s){let t=[];return u.set(e.id,t),t.push(...s.make(s.from.map(P),n)),t}let c=j(e),d=c?[]:A(e.id),f=l.has(e.id)||d.length||c?[]:r(e,te(e.id,a),n,a);u.set(e.id,f);for(let t of D(e.id))P(t.model);if(c&&!l.has(e.id)){for(let e of D(c.invoice.id))_(e.model)&&P(e.model);let e=P(c.invoice);f.push(...de(c,P(c.payment),e,n)),e.forEach((t,n)=>{e[n]=M(c.invoice,t)})}if(!l.has(e.id))for(let{parent:r,fk:i}of d){let o=t.defaults?.(e)??{};P(r).forEach((t,s)=>{let c=W(e,i,t,n,a).map(e=>oe(e,o));_(e)?(f.push(...le(t,r,c,L(r,t))),ce(t,r,s)):f.push(...c)})}return f},F=new Map((t.children?.models??[]).map(e=>[e.id,e])),I=e=>{let t=ee(e),n=F.get(fe),r=F.get(pe),i=n?P(n):[];if(!i.length)return t;let a=new Map(t.flatMap(e=>e.components.map(e=>[e.id,e])));for(let e of r?P(r):[])a.set(e.id,{id:e.id,key:e.id,name:String(e.name??``),percent:String(e.percent??`0`),recoverable:e.recoverable===!0});let o=i.map(e=>{let t=[];try{t=JSON.parse(String(e.componentsJson??`[]`))}catch{t=[]}let n=(Array.isArray(t)?t:[]).flatMap(e=>{let t=e&&typeof e==`object`?a.get(String(e.taxComponentId)):void 0;return t?[t]:[]}),r=me.includes(String(e.kind))?e.kind:`taxable`,i=[`sales`,`purchases`,`both`].includes(String(e.appliesTo))?e.appliesTo:`both`;return{id:e.id,code:String(e.code??``),name:String(e.name??``),kind:r,appliesTo:i,active:e.active!==!1,components:n}}),s=new Map(o.map(e=>[e.id,e]));if(t.some(e=>s.has(e.id))){let n=h(e);return[...t.filter(e=>s.has(e.id)||e.id===n.id).map(e=>s.get(e.id)??e),...o.filter(e=>!t.some(t=>t.id===e.id))]}return[...t,...o]},L=(e,t)=>{let n=o(),r=s()??.05,i=I(r),a=e.fields.find(e=>e.name===`customerId`&&e.related),l=a?.related?F.get(a.related):void 0,d=l?P(l).find(e=>e.id===t.customerId):void 0,p=e=>{for(let[t,n]of u){if(!t.endsWith(`:Product`))continue;let r=n.find(t=>t.id===e);if(r)return r}},m=e=>typeof e==`string`&&e?e:null;return{lineAmountType:f(t,n.pricesIncludeTax?`inclusive`:`exclusive`),roundingScope:c(t,n.taxRounding),currency:g(t.currency,g(n.currency)),codes:i,appDefaultCodeId:h(r).id,customerTaxExempt:d?.taxExempt===!0,partyCodeId:m(d?.defaultTaxCodeId),productCodeOf:e=>m(p(e)?.defaultSalesTaxCodeId)}},R=e=>{if(!b)return;let t=e=>{let t=j(e);return t?[t.payment,t.invoice]:[]},n=[e,...D(e.id).map(e=>e.model),...A(e.id).map(e=>e.parent),...t(e),...D(e.id).flatMap(e=>t(e.model))];try{for(let e of n){let t=u.get(e.id);t&&b.setItem(x(e),JSON.stringify(t))}b.setItem($,String(C))}catch{}},z=e=>D(e.id).find(t=>_(t.model)&&A(t.model.id).some(n=>n.parent.id===e.id&&n.fk===t.fk)),B=(e,t,n=!1)=>{let r=z(e);if(!r)return!1;let i=P(e),a=i.findIndex(e=>e.id===t);if(a<0)return!1;let o=P(r.model),s=o.filter(e=>e[r.fk]===t),c=i[a];if(he(e,c)){if(n)throw new v(`FROZEN_DOCUMENT`,`This ${e.name.toLowerCase()} has been issued, so its lines can no longer change.`);return!0}let l=y(e,c,s,L(e,c));i[a]=l.row;for(let e of l.lines){let t=o.findIndex(t=>t.id===e.id);t>=0&&(o[t]=e)}return!0},V=(e,t)=>{let n=t;if(z(e)&&(B(e,t.id),n=P(e).find(e=>e.id===t.id)??n),_(e)){let r=A(e.id).some(({parent:e,fk:n})=>B(e,t[n],!0)),i=P(e),a=i.findIndex(e=>e.id===t.id);if(!r&&a>=0){let e=o(),n=s()??.05;i[a]=ne([t],{lineAmountType:e.pricesIncludeTax?`inclusive`:`exclusive`,roundingScope:e.taxRounding,currency:g(e.currency),codes:I(n),appDefaultCodeId:h(n).id}).lines[0]}n=P(e).find(e=>e.id===t.id)??n}p(e)&&(N(e,t.id),n=P(e).find(e=>e.id===t.id)??n);let r=j(e);r&&N(r.invoice,t[r.invoiceFk]);for(let n of D(e.id)){let r=j(n.model);if(r&&r.payment.id===e.id)for(let e of P(n.model))e[r.paymentFk]===t.id&&N(r.invoice,e[r.invoiceFk])}return n},H=e=>{let t=[e,...D(e.id).map(e=>e.model),...A(e.id).map(e=>e.parent)];return new Map(t.map(e=>[e.id,P(e).map(e=>({...e}))]))},U=e=>{for(let[t,n]of e){let e=u.get(t);e&&e.splice(0,e.length,...n)}},G=(e,n)=>({...n,...t.defaults?.(e)??{}}),K=e=>w(`${e.id}:new:${n}:${C++}`),q=(e,t)=>Object.entries(t).every(([t,n])=>e[t]===n);return{async list(e){return P(e).map(t=>G(e,t))},async listWhere(e,t,n){return P(e).filter(e=>String(e[t]??``)===n).map(t=>G(e,t))},async get(e,t){let n=P(e).find(e=>e.id===t);return n?G(e,n):void 0},async create(e,n){let r={...t.defaults?.(e)??{},...n,id:K(e)},i=H(e);P(e).push(r);let a;try{a=V(e,r)}catch(e){throw U(i),C--,e}return R(e),{...a}},async update(e,t,n){let r=P(e),i=r.findIndex(e=>e.id===t);if(i<0)return;let a=H(e),o=r[i],s={...o,...n,id:t};r[i]=s;let c;try{if(c=V(e,s),_(e))for(let{parent:t,fk:n}of A(e.id))o[n]!==s[n]&&B(t,o[n],!0)}catch(e){throw U(a),e}return R(e),{...c}},async delete(e,t){let n=P(e),r=n.findIndex(e=>e.id===t);if(r<0)return!1;let i=H(e),[a]=n.splice(r,1);try{let t=j(e);t&&a&&N(t.invoice,a[t.invoiceFk]);for(let{parent:t,fk:n}of A(e.id))_(e)&&a&&B(t,a[n],!0)}catch(e){throw U(i),e}return R(e),!0},reset(){ie(),u.clear(),C=0,ge(b);for(let e of[...m])e()},onReset(e){return m.add(e),()=>{m.delete(e)}},async apply(e){let n=new Map,r=C,i=new Map,a=e=>{i.set(e.id,e);let t=P(e);return n.has(e.id)||n.set(e.id,t.map(e=>({...e}))),t},o={},s=e=>Object.fromEntries(Object.entries(e??{}).map(([e,t])=>{if(!Z(t))return[e,t];let n=o[t.ref];if(!n)throw Error(`Unknown record reference ${t.ref}`);return[e,t.field?n[t.field]:n.id]}));try{for(let n of e){let e=a(n.model),r=s(n.match);if(n.op===`delete`){let t=e.filter(e=>n.id===void 0?q(e,r):e.id===n.id);if(n.id===void 0&&Object.keys(r).length===0)throw Error(`A delete needs an id or a match`);for(let n of t)e.splice(e.indexOf(n),1);continue}let i=s(n.values),c=-1;if(n.id!==void 0){if(c=e.findIndex(e=>e.id===n.id),c<0)throw Error(`No ${n.model.name} with id ${n.id}`)}else Object.keys(r).length>0&&(c=e.findIndex(e=>q(e,r)));let l;if(c>=0){let t=e[c];l={...t,...i,id:t.id},e[c]=l}else l={...t.defaults?.(n.model)??{},...r,...s(n.onCreate),...i,id:K(n.model)},e.push(l);n.as&&(o[n.as]={...l})}}catch(e){for(let[e,t]of n)u.set(e,t);throw C=r,e}for(let e of i.values())R(e);return o}}}export{V as a,N as c,I as d,L as f,z as i,O as l,Z as n,P as o,M as p,D as r,F as s,_e as t,R as u};
|
|
1
|
+
import{$ as e,A as t,D as n,E as r,J as i,M as a,N as o,P as s,Q as c,S as l,T as u,Y as d,Z as f,at as p,bt as m,ct as h,dt as g,et as _,ft as ee,gt as v,it as y,j as te,k as b,lt as x,mt as ne,rt as re,st as S,ut as C,w,x as T,y as E,z as ie}from"./Zte-WUy-.js";var D=e=>{let t=m(e);if(!t)throw Error(`The catalog has no model ${e}`);return t.model};function O(e){return String(e??``).toUpperCase().replace(/[^A-Z0-9]+/g,`-`).replace(/^-+|-+$/g,``)}var k=/\{([A-Za-z_][\w]*\.[A-Za-z_][\w]*)(?:\|(slug))?\}/g;function A(e,t){return e.replace(k,(e,n,r)=>{let i=t[n],a=i==null?``:String(i);return r===`slug`?O(a):a})}function j(e,t,n=e=>e){return typeof e==`string`?A(e,t):typeof e==`object`&&e?{ref:n(e.ref),...e.field?{field:e.field}:{}}:e}function M(e,t,n){return Object.fromEntries(Object.entries(e??{}).map(([e,r])=>[e,j(r,t,n)]))}function N(e){return typeof e==`string`||typeof e==`number`||typeof e==`boolean`||typeof e==`object`&&e&&!Array.isArray(e)?e:null}function P(e,t,n){return Object.fromEntries(e.flatMap(e=>{let r=F(e.to);return r.alias===t?[[r.field,N(n[e.id])]]:[]}))}function F(e){let t=e.indexOf(`.`);if(t<1||t===e.length-1)throw Error(`A form field maps to "alias.field", got "${e}"`);return{alias:e.slice(0,t),field:e.slice(t+1)}}function I(e,t,n){let{alias:r,field:i}=F(e.to),a=t.find(e=>e.as===r);if(!a)throw Error(`Form field ${e.id} maps to unknown ${r}`);let o=n(a.model).fields.find(e=>e.name===i);if(!o)throw Error(`${a.model} has no field ${i} (form field ${e.id})`);return o}function L(e,t){let{alias:n}=F(e.to),r=t.find(e=>e.as===n);if(!r)throw Error(`Form field ${e.id} maps to unknown ${n}`);return r.model}function R(e,t){return e.default===void 0?t.default===void 0?t.type===`text`?``:null:t.default:e.default}function z(e,t){return Object.fromEntries(e.map(e=>[e.to,t[e.id]]))}var B=(e,t)=>e===t;async function V(e,t,n,r){let i={...n};for(let n of t){if(n.as in i)continue;if(!n.match){i[n.as]=void 0;continue}let t={},a=!0;for(let[e,r]of Object.entries(n.match))if(typeof r==`object`&&r){let n=i[r.ref];n||(a=!1),t[e]=r.field?n?.[r.field]:n?.id}else t[e]=r;i[n.as]=a?(await e.list(r(n.model))).find(e=>Object.entries(t).every(([t,n])=>B(e[t],n))):void 0}return i}var H=4,U=(e,t)=>e.fields.some(e=>e.name===t);function W(e,r,i,o,s){let c=l(n(`${o}:${e.id}:${i.id}`)),d=U(e,`debit`)&&U(e,`credit`),f=d?2*(1+Math.floor(c()*2)):1+Math.floor(c()*H),p=_(e),m=1e3*(1+Math.floor(c()*90));return Array.from({length:f},(l,f)=>{let h=n(`${i.id}:${f}`)%997,g={...u(e,h,o,s),id:w(`${e.id}:${i.id}:${f}`),[r]:i.id};if(U(e,`sortOrder`)&&(g.sortOrder=f),p){let n=e.fields.find(e=>e.related?.endsWith(`:Product`)&&e.name in g),r=a(),{products:o}=r,l=n?o[t(n,{modelId:e.id,index:h,rows:s})%o.length]:o[h%o.length],u=b(h);u?(U(e,`description`)&&(g.description=u.description),g.unitPrice=u.price,n&&(g[n.name]=``)):n&&l&&(U(e,`description`)&&(g.description=l.name),g.unitPrice=l.price);let[d,p]=u?.quantity??l?.quantity??r.lineQuantity??[1,5],m=d+Math.floor(c()*(p-d+1));U(e,`quantity`)&&(g.quantity=m),Object.assign(g,ae(e,i,f,m,Number(g.unitPrice??0))),g.amount=C(g)}if(d){let e=f%2==0;g.debit=e?m/100:0,g.credit=e?0:m/100}return g})}function G(e){return n(`discount:${e.id}`)%3==0}function K(e,t){return Math.round(e*t/1e3)*100}function q(e,t){return t>0&&n(`tax-override:${e.id}:${t}`)%7==0}function J(e,t,r=o().currency){let i=n(`tax-override-kind:${e.id}:${t}`)%4,a=x(r);if(a&&i<2)return a;let s=i%2==0?`exempt`:`zero-rated`;return S.find(e=>e.kind===s)}function ae(e,t,r,i,a){let o={},s=r===0&&G(t),c=n(`discount-kind:${t.id}`)%2==0;U(e,`discountType`)&&(o.discountType=s?c?`percent`:`amount`:`none`),U(e,`discountRate`)&&(o.discountRate=s&&c?`10`:null),U(e,`discount`)&&(o.discount=s&&!(c&&U(e,`discountType`))?K(i,a):0),!U(e,`discountType`)&&o.discount&&(o.discountType=`amount`);let l=q(t,r)?J(t,r):void 0;return U(e,`taxMode`)&&(o.taxMode=l?`override`:`inherit`),U(e,`taxCodeId`)&&(o.taxCodeId=l?.id??null),o}function oe(e,t){let n={...e,...t};return`discount`in t&&!(`discountType`in t)&&n.discountType===`amount`&&(n.discountType=`percent`,n.discountRate=`10`,n.discount=0),`discountRate`in t&&n.discountType===`percent`&&(n.discountType=`none`,n.discountRate=null,n.discount=0),n}var se=[`@happyvertical/smrt-commerce:Order`,`@happyvertical/smrt-commerce:Invoice`],Y=2500;function ce(e,t,n){n===2&&se.includes(t.id)&&typeof e.subtotal==`number`&&typeof e.totalAmount==`number`&&(t.fields.some(e=>e.name===`status`&&e.enum?.includes(`draft`))&&(e.status=`draft`),e.subtotal+=Y,e.totalAmount+=Y)}function le(e,t,n,r){if(!n.length||!n.every(e=>`unitPrice`in e))return[...n];let i=y(t,e,n,r);return Object.assign(e,i.row),i.lines}var X=e=>typeof e==`number`&&Number.isFinite(e)?e:0,ue=e=>e.status!==`draft`&&e.status!==`cancelled`&&X(e.totalAmount)>0;function de(e,t,r,i){let a=new Map(r.map(e=>[e.id,X(e.totalAmount)])),o=[];for(let s of t){if(s.status!==`completed`){s.status!==`refunded`&&(s.paidAt=null);continue}let t=l(n(`${i}:alloc:${s.id}`)),c=r.filter(e=>ue(e)&&e.customerId===s.customerId&&(a.get(e.id)??0)>0).slice(0,t()<.3?2:1);if(c.length===0)continue;let d=c.map((e,n)=>{let r=a.get(e.id)??0,i=n>0||t()<.6?r:Math.min(r,Math.max(100,Math.round(r*(.3+t()*.4)/100)*100));return a.set(e.id,r-i),{inv:e,part:i}}),f=Math.max(...d.map(({inv:e})=>Date.parse(String(e.issueDate)))),p=new Date(Math.max(f,Math.min(f+(1+Math.floor(t()*20))*E,T))).toISOString();s.amount=d.reduce((e,t)=>e+t.part,0),s.paidAt=p,`contractId`in s&&d[0]?.inv.contractId&&(s.contractId=d[0].inv.contractId);for(let{inv:t,part:n}of d)o.push({...u(e.model,o.length,i),id:w(`${e.model.id}:${s.id}:${t.id}`),[e.paymentFk]:s.id,[e.invoiceFk]:t.id,amount:n,allocatedAt:p})}return o}function Z(e){return typeof e==`object`&&!!e&&typeof e.ref==`string`}var Q=`smrt-planner:data:v6:`,fe=`@happyvertical/smrt-commerce:TaxCode`,pe=`@happyvertical/smrt-commerce:TaxComponent`,me=[`taxable`,`zero-rated`,`exempt`,`out-of-scope`];function he(e,t){return!!e.fields.find(e=>e.name===`status`)?.enum?.includes(`draft`)&&typeof t.status==`string`&&t.status!==``&&t.status!==`draft`}var $=`${Q}_created`;function ge(e){if(e)try{let t=[];for(let n=0;n<e.length;n++){let r=e.key(n);r?.startsWith(`smrt-planner:data:v6:`)&&t.push(r)}for(let n of t)e.removeItem(n)}catch{}}function _e(t={}){let n=t.seed??1,a=t.rowsPerModel??8,l=new Set(t.empty??[]),u=new Map,m=new Set,b=t.storage??null,x=e=>`${Q}${e.id}`,S=e=>{if(b)try{let t=b.getItem(x(e));if(t===null)return;let n=JSON.parse(t);if(Array.isArray(n)&&n.every(e=>typeof e==`object`&&!!e&&typeof e.id==`string`))return n}catch{}},C=0;if(b)try{C=Number(b.getItem($))||0}catch{C=0}let E=new Map,D=e=>{let n=E.get(e);return n||(n=t.children?.links(e)??[],E.set(e,n)),n},O,k,A=e=>{if(!O){O=new Map;for(let e of t.children?.models??[])for(let t of D(e.id)){let n=O.get(t.model.id)??[];n.push({parent:e,fk:t.fk}),O.set(t.model.id,n)}k=new Map(O);for(let[e,t]of O){let n=e.slice(e.lastIndexOf(`:`)+1).toLowerCase(),r=t.find(e=>n.startsWith(e.fk.replace(/Id$/,``).toLowerCase()))?.fk??t[0]?.fk;O.set(e,t.filter(e=>e.fk===r))}}return O.get(e)??[]},j=t=>{if(!e(t))return;A(t.id);let n=k?.get(t.id)??[],r=d(t)?.name,a=i(t)?.name,o=n.find(e=>e.fk===r)?.parent,s=n.find(e=>e.fk===a)?.parent;return o&&s&&r&&a?{model:t,paymentFk:r,invoiceFk:a,payment:o,invoice:s}:void 0},M=(n,r)=>{if(!p(n))return r;let i=D(n.id).find(t=>e(t.model)),a=i&&j(i.model);if(!i||!a)return r;let o=new Map(P(a.payment).map(e=>[e.id,e])),s=P(i.model).filter(e=>e[i.fk]===r.id&&o.get(String(e[a.paymentFk]))?.status===`completed`).map(e=>({amount:Number(e.amount??0),at:String(e.allocatedAt??``)})),c=re(r,s,(t.now??(()=>T))()),l={...r,amountPaid:c.amountPaid,status:c.status};return n.fields.some(e=>e.name===`paidDate`)&&(l.paidDate=c.paidDate),l},N=(e,t)=>{let n=P(e),r=n.findIndex(e=>e.id===t);r>=0&&(n[r]=M(e,n[r]))},P=e=>{let i=u.get(e.id);if(i)return i;let o=S(e);if(o){u.set(e.id,o);for(let t of D(e.id))P(t.model);return o}let s=l.has(e.id)?void 0:t.samples?.[e.id];if(s){let t=[];return u.set(e.id,t),t.push(...s.make(s.from.map(P),n)),t}let c=j(e),d=c?[]:A(e.id),f=l.has(e.id)||d.length||c?[]:r(e,te(e.id,a),n,a);u.set(e.id,f);for(let t of D(e.id))P(t.model);if(c&&!l.has(e.id)){for(let e of D(c.invoice.id))_(e.model)&&P(e.model);let e=P(c.invoice);f.push(...de(c,P(c.payment),e,n)),e.forEach((t,n)=>{e[n]=M(c.invoice,t)})}if(!l.has(e.id))for(let{parent:r,fk:i}of d){let o=t.defaults?.(e)??{};P(r).forEach((t,s)=>{let c=W(e,i,t,n,a).map(e=>oe(e,o));_(e)?(f.push(...le(t,r,c,L(r,t))),ce(t,r,s)):f.push(...c)})}return f},F=new Map((t.children?.models??[]).map(e=>[e.id,e])),I=e=>{let t=ee(e),n=F.get(fe),r=F.get(pe),i=n?P(n):[];if(!i.length)return t;let a=new Map(t.flatMap(e=>e.components.map(e=>[e.id,e])));for(let e of r?P(r):[])a.set(e.id,{id:e.id,key:e.id,name:String(e.name??``),percent:String(e.percent??`0`),recoverable:e.recoverable===!0});let o=i.map(e=>{let t=[];try{t=JSON.parse(String(e.componentsJson??`[]`))}catch{t=[]}let n=(Array.isArray(t)?t:[]).flatMap(e=>{let t=e&&typeof e==`object`?a.get(String(e.taxComponentId)):void 0;return t?[t]:[]}),r=me.includes(String(e.kind))?e.kind:`taxable`,i=[`sales`,`purchases`,`both`].includes(String(e.appliesTo))?e.appliesTo:`both`;return{id:e.id,code:String(e.code??``),name:String(e.name??``),kind:r,appliesTo:i,active:e.active!==!1,components:n}}),s=new Map(o.map(e=>[e.id,e]));if(t.some(e=>s.has(e.id))){let n=h(e);return[...t.filter(e=>s.has(e.id)||e.id===n.id).map(e=>s.get(e.id)??e),...o.filter(e=>!t.some(t=>t.id===e.id))]}return[...t,...o]},L=(e,t)=>{let n=o(),r=s()??.05,i=I(r),a=e.fields.find(e=>e.name===`customerId`&&e.related),l=a?.related?F.get(a.related):void 0,d=l?P(l).find(e=>e.id===t.customerId):void 0,p=e=>{for(let[t,n]of u){if(!t.endsWith(`:Product`))continue;let r=n.find(t=>t.id===e);if(r)return r}},m=e=>typeof e==`string`&&e?e:null;return{lineAmountType:f(t,n.pricesIncludeTax?`inclusive`:`exclusive`),roundingScope:c(t,n.taxRounding),currency:g(t.currency,g(n.currency)),codes:i,appDefaultCodeId:h(r).id,customerTaxExempt:d?.taxExempt===!0,partyCodeId:m(d?.defaultTaxCodeId),productCodeOf:e=>m(p(e)?.defaultSalesTaxCodeId)}},R=e=>{if(!b)return;let t=e=>{let t=j(e);return t?[t.payment,t.invoice]:[]},n=[e,...D(e.id).map(e=>e.model),...A(e.id).map(e=>e.parent),...t(e),...D(e.id).flatMap(e=>t(e.model))];try{for(let e of n){let t=u.get(e.id);t&&b.setItem(x(e),JSON.stringify(t))}b.setItem($,String(C))}catch{}},z=e=>D(e.id).find(t=>_(t.model)&&A(t.model.id).some(n=>n.parent.id===e.id&&n.fk===t.fk)),B=(e,t,n=!1)=>{let r=z(e);if(!r)return!1;let i=P(e),a=i.findIndex(e=>e.id===t);if(a<0)return!1;let o=P(r.model),s=o.filter(e=>e[r.fk]===t),c=i[a];if(he(e,c)){if(n)throw new v(`FROZEN_DOCUMENT`,`This ${e.name.toLowerCase()} has been issued, so its lines can no longer change.`);return!0}let l=y(e,c,s,L(e,c));i[a]=l.row;for(let e of l.lines){let t=o.findIndex(t=>t.id===e.id);t>=0&&(o[t]=e)}return!0},V=(e,t)=>{let n=t;if(z(e)&&(B(e,t.id),n=P(e).find(e=>e.id===t.id)??n),_(e)){let r=A(e.id).some(({parent:e,fk:n})=>B(e,t[n],!0)),i=P(e),a=i.findIndex(e=>e.id===t.id);if(!r&&a>=0){let e=o(),n=s()??.05;i[a]=ne([t],{lineAmountType:e.pricesIncludeTax?`inclusive`:`exclusive`,roundingScope:e.taxRounding,currency:g(e.currency),codes:I(n),appDefaultCodeId:h(n).id}).lines[0]}n=P(e).find(e=>e.id===t.id)??n}p(e)&&(N(e,t.id),n=P(e).find(e=>e.id===t.id)??n);let r=j(e);r&&N(r.invoice,t[r.invoiceFk]);for(let n of D(e.id)){let r=j(n.model);if(r&&r.payment.id===e.id)for(let e of P(n.model))e[r.paymentFk]===t.id&&N(r.invoice,e[r.invoiceFk])}return n},H=e=>{let t=[e,...D(e.id).map(e=>e.model),...A(e.id).map(e=>e.parent)];return new Map(t.map(e=>[e.id,P(e).map(e=>({...e}))]))},U=e=>{for(let[t,n]of e){let e=u.get(t);e&&e.splice(0,e.length,...n)}},G=(e,n)=>({...n,...t.defaults?.(e)??{}}),K=e=>w(`${e.id}:new:${n}:${C++}`),q=(e,t)=>Object.entries(t).every(([t,n])=>e[t]===n);return{async list(e){return P(e).map(t=>G(e,t))},async listWhere(e,t,n){return P(e).filter(e=>String(e[t]??``)===n).map(t=>G(e,t))},async get(e,t){let n=P(e).find(e=>e.id===t);return n?G(e,n):void 0},async create(e,n){let r={...t.defaults?.(e)??{},...n,id:K(e)},i=H(e);P(e).push(r);let a;try{a=V(e,r)}catch(e){throw U(i),C--,e}return R(e),{...a}},async update(e,t,n){let r=P(e),i=r.findIndex(e=>e.id===t);if(i<0)return;let a=H(e),o=r[i],s={...o,...n,id:t};r[i]=s;let c;try{if(c=V(e,s),_(e))for(let{parent:t,fk:n}of A(e.id))o[n]!==s[n]&&B(t,o[n],!0)}catch(e){throw U(a),e}return R(e),{...c}},async delete(e,t){let n=P(e),r=n.findIndex(e=>e.id===t);if(r<0)return!1;let i=H(e),[a]=n.splice(r,1);try{let t=j(e);t&&a&&N(t.invoice,a[t.invoiceFk]);for(let{parent:t,fk:n}of A(e.id))_(e)&&a&&B(t,a[n],!0)}catch(e){throw U(i),e}return R(e),!0},reset(){ie(),u.clear(),C=0,ge(b);for(let e of[...m])e()},onReset(e){return m.add(e),()=>{m.delete(e)}},async apply(e){let n=new Map,r=C,i=new Map,a=e=>{i.set(e.id,e);let t=P(e);return n.has(e.id)||n.set(e.id,t.map(e=>({...e}))),t},o={},s=e=>Object.fromEntries(Object.entries(e??{}).map(([e,t])=>{if(!Z(t))return[e,t];let n=o[t.ref];if(!n)throw Error(`Unknown record reference ${t.ref}`);return[e,t.field?n[t.field]:n.id]}));try{for(let n of e){let e=a(n.model),r=s(n.match);if(n.op===`delete`){let t=e.filter(e=>n.id===void 0?q(e,r):e.id===n.id);if(n.id===void 0&&Object.keys(r).length===0)throw Error(`A delete needs an id or a match`);for(let n of t)e.splice(e.indexOf(n),1);continue}let i=s(n.values),c=-1;if(n.id!==void 0){if(c=e.findIndex(e=>e.id===n.id),c<0)throw Error(`No ${n.model.name} with id ${n.id}`)}else Object.keys(r).length>0&&(c=e.findIndex(e=>q(e,r)));let l;if(c>=0){let t=e[c];l={...t,...i,id:t.id},e[c]=l}else l={...t.defaults?.(n.model)??{},...r,...s(n.onCreate),...i,id:K(n.model)},e.push(l);n.as&&(o[n.as]={...l})}}catch(e){for(let[e,t]of n)u.set(e,t);throw C=r,e}for(let e of i.values())R(e);return o}}}export{V as a,N as c,I as d,L as f,z as i,O as l,Z as n,P as o,M as p,D as r,F as s,_e as t,R as u};
|
|
@@ -1,4 +1,4 @@
|
|
|
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 ee,mt as D,pt as O,q as k,st as A,v as j,vt as M}from"./DG3qFFTE.js";import"./xihTtKlq.js";import{a as N}from"./BLUInGBV.js";import"./Bq8E3AWP.js";import{_t as te,bt as P,p as F,u as I,vt as ne}from"./
|
|
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 ee,mt as D,pt as O,q as k,st as A,v as j,vt as M}from"./DG3qFFTE.js";import"./xihTtKlq.js";import{a as N}from"./BLUInGBV.js";import"./Bq8E3AWP.js";import{_t as te,bt as P,p as F,u as I,vt as ne}from"./Zte-WUy-.js";import"./DK8Blf1Y.js";import"./v8gneLl4.js";import"./C-A_haB1.js";y([`click`]),y([`click`,`keydown`]),y([`click`]);var L=[1,1.5,2,3,4,5];L[0],L[L.length-1],y([`click`,`pointerdown`,`pointermove`,`pointerup`]);var R=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`})),z=x([]);function B(t){for(let n=e(z).length-1;n>=0;n--){let r=e(z)[n].paths.get(t);if(r!==void 0)return r}return R.get(t)}var V=d(`<svg xmlns="http://www.w3.org/2000/svg" data-smrt-component="Icon" class="svelte-em2a54"><path></path></svg>`);function H(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?B(i.name):``)),u=n(()=>typeof a()==`number`?`${a()}px`:a());var d=V(),f=D(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
2
|
<path d="M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V8l-6-6z"/>
|
|
3
3
|
<path d="M14 2v6h6M16 13H8M16 17H8M10 9H8"/>
|
|
4
4
|
</svg>`,folder:`<svg width="100%" height="100%" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5">
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"./DG3qFFTE.js";import"./xihTtKlq.js";import"./Zte-WUy-.js";import"./b-_V29X7.js";import"./v8gneLl4.js";import"./ChpbeHev.js";import"./CGVkRTMI.js";function e(){return typeof window<`u`&&typeof window.matchMedia==`function`&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches}export{e as t};
|