@happyvertical/smrt-planner 0.57.5 → 0.57.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.
Files changed (488) hide show
  1. package/app/404.html +21 -21
  2. package/app/_app/immutable/assets/AppShell.DrL8T9I9.css +1 -0
  3. package/app/_app/immutable/assets/labels.AVmg4hBz.css +1 -0
  4. package/app/_app/immutable/chunks/{BybfWt-B.js → 0as86J1A.js} +1 -1
  5. package/app/_app/immutable/chunks/{CtjBwCj8.js → B7d7dGCP.js} +1 -1
  6. package/app/_app/immutable/chunks/{C1VofLtR.js → BPsie9Wr.js} +1 -1
  7. package/app/_app/immutable/chunks/{BDbFl7UA.js → BSYvnYu8.js} +1 -1
  8. package/app/_app/immutable/chunks/{O8DAZ_le.js → C3nKLKKd.js} +1 -1
  9. package/app/_app/immutable/chunks/CXKa_xdk.js +4 -0
  10. package/app/_app/immutable/chunks/CdBvpdnq.js +4 -0
  11. package/app/_app/immutable/chunks/{5ukUzDcw.js → CdlkzC7D.js} +1 -1
  12. package/app/_app/immutable/chunks/{BG9Gz_25.js → CoXf-L_3.js} +22 -22
  13. package/app/_app/immutable/chunks/{DjJovMrk.js → CwNhmq3e.js} +1 -1
  14. package/app/_app/immutable/chunks/{DuZeZzOA.js → D2Ykv2Y3.js} +1 -1
  15. package/app/_app/immutable/chunks/D31rqKs1.js +1 -0
  16. package/app/_app/immutable/chunks/{BiEOJeYb.js → D8rEUyzO.js} +1 -1
  17. package/app/_app/immutable/chunks/{Cr4byQts.js → DBp81N-t.js} +1 -1
  18. package/app/_app/immutable/chunks/DIE02RSm.js +1 -0
  19. package/app/_app/immutable/chunks/{gCpxN2IC.js → DrjdLb0M.js} +1 -1
  20. package/app/_app/immutable/chunks/{C3sRGrYK.js → Dyf3Cj8R.js} +1 -1
  21. package/app/_app/immutable/chunks/{Bal1oPZu.js → DypPefJO.js} +1 -1
  22. package/app/_app/immutable/chunks/DzRTyOpH.js +1 -0
  23. package/app/_app/immutable/chunks/{nphy1MQF.js → Dzh-1KQR.js} +1 -1
  24. package/app/_app/immutable/chunks/GVQNHDp5.js +1 -0
  25. package/app/_app/immutable/chunks/{NppCG--v.js → ORlJSBRk.js} +1 -1
  26. package/app/_app/immutable/chunks/{YGONf0jr.js → PsiVGwJV.js} +1 -1
  27. package/app/_app/immutable/chunks/{Cga8zF3r.js → eNZ3ToP2.js} +1 -1
  28. package/app/_app/immutable/chunks/{CTlMHIE6.js → exPME6UK.js} +1 -1
  29. package/app/_app/immutable/chunks/{J9kOiFLO.js → jol435F5.js} +1 -1
  30. package/app/_app/immutable/entry/{app.B4gMiHwR.js → app.C_C191oT.js} +2 -2
  31. package/app/_app/immutable/entry/start.C01jT-Kj.js +1 -0
  32. package/app/_app/immutable/nodes/{0.2MYMg80l.js → 0._tbUx7Ky.js} +1 -1
  33. package/app/_app/immutable/nodes/{1.DKP901Gn.js → 1.CTatAlE5.js} +1 -1
  34. package/app/_app/immutable/nodes/{10.DNN0cVai.js → 10.DHnK3kbB.js} +1 -1
  35. package/app/_app/immutable/nodes/{11.DgbmegX3.js → 11.Ck1kcQLu.js} +1 -1
  36. package/app/_app/immutable/nodes/{12.D5MtnJoE.js → 12.oK17D56_.js} +1 -1
  37. package/app/_app/immutable/nodes/{13._rY66Xa_.js → 13.DlEsuw6F.js} +1 -1
  38. package/app/_app/immutable/nodes/{14.B6TD25VU.js → 14.sDZ3z4Zh.js} +1 -1
  39. package/app/_app/immutable/nodes/{2.x9WyxQ1S.js → 2.GYBHfqdI.js} +3 -3
  40. package/app/_app/immutable/nodes/{3.V5uGCpGb.js → 3.DOL1VeVM.js} +1 -1
  41. package/app/_app/immutable/nodes/{4.CCwzLrgu.js → 4.CiKq5-ek.js} +1 -1
  42. package/app/_app/immutable/nodes/{5.CgHzwpns.js → 5.nKUg_W9L.js} +1 -1
  43. package/app/_app/immutable/nodes/{6.CvQHLh_u.js → 6.CVGw-hLa.js} +1 -1
  44. package/app/_app/immutable/nodes/{7.7EIrly34.js → 7.Clo6kG4w.js} +1 -1
  45. package/app/_app/immutable/nodes/{8.DyyRBuTw.js → 8.C3moca98.js} +1 -1
  46. package/app/_app/immutable/nodes/{9.DcURs0gN.js → 9.BnVJx5kW.js} +1 -1
  47. package/app/_app/version.json +1 -1
  48. package/app/advanced-styles/index.html +26 -26
  49. package/app/ai/index.html +30 -30
  50. package/app/blueprint/index.html +23 -23
  51. package/app/cookbook/index.html +23 -23
  52. package/app/index.html +32 -32
  53. package/app/m/ads/AdDeliveryTier/index.html +26 -26
  54. package/app/m/ads/AdEvent/index.html +26 -26
  55. package/app/m/ads/AdFormat/index.html +26 -26
  56. package/app/m/ads/AdGroup/index.html +26 -26
  57. package/app/m/ads/AdVariation/index.html +26 -26
  58. package/app/m/analytics/AnalyticsDataStream/index.html +26 -26
  59. package/app/m/analytics/AnalyticsEvent/index.html +26 -26
  60. package/app/m/analytics/AnalyticsProperty/index.html +26 -26
  61. package/app/m/analytics/AnalyticsReport/index.html +26 -26
  62. package/app/m/approvals/ApprovalEvent/index.html +26 -26
  63. package/app/m/approvals/ApprovalPolicy/index.html +26 -26
  64. package/app/m/approvals/ApprovalRequest/index.html +26 -26
  65. package/app/m/assets/Asset/attachments/index.html +27 -27
  66. package/app/m/assets/Asset/index.html +26 -26
  67. package/app/m/assets/AssetAssociation/index.html +26 -26
  68. package/app/m/assets/AssetMetafield/index.html +26 -26
  69. package/app/m/assets/AssetStatus/index.html +26 -26
  70. package/app/m/assets/AssetType/index.html +26 -26
  71. package/app/m/assets/Folder/index.html +26 -26
  72. package/app/m/chat/AgentSession/index.html +26 -26
  73. package/app/m/chat/ChatMessage/index.html +26 -26
  74. package/app/m/chat/ChatParticipant/index.html +26 -26
  75. package/app/m/chat/ChatReaction/index.html +26 -26
  76. package/app/m/chat/ChatRoom/index.html +26 -26
  77. package/app/m/chat/ChatThread/index.html +26 -26
  78. package/app/m/chat/VoiceGatewayTurn/index.html +26 -26
  79. package/app/m/chat/VoiceSession/index.html +26 -26
  80. package/app/m/commerce/Agreement/index.html +26 -26
  81. package/app/m/commerce/Cart/index.html +26 -26
  82. package/app/m/commerce/Contract/index.html +26 -26
  83. package/app/m/commerce/ContractLineItem/index.html +26 -26
  84. package/app/m/commerce/Customer/index.html +26 -26
  85. package/app/m/commerce/DocumentTax/index.html +26 -26
  86. package/app/m/commerce/Estimate/index.html +26 -26
  87. package/app/m/commerce/Fulfillment/index.html +26 -26
  88. package/app/m/commerce/FulfillmentLineItem/index.html +26 -26
  89. package/app/m/commerce/HistoricalCustomerFunds/index.html +26 -26
  90. package/app/m/commerce/HistoricalCustomerFundsAllocation/index.html +26 -26
  91. package/app/m/commerce/HistoricalSalesLine/index.html +26 -26
  92. package/app/m/commerce/Invoice/index.html +26 -26
  93. package/app/m/commerce/InvoiceLineItem/index.html +26 -26
  94. package/app/m/commerce/Lease/index.html +26 -26
  95. package/app/m/commerce/LicenseSale/index.html +26 -26
  96. package/app/m/commerce/Order/index.html +26 -26
  97. package/app/m/commerce/Payment/index.html +26 -26
  98. package/app/m/commerce/PaymentAllocation/index.html +26 -26
  99. package/app/m/commerce/PaymentInstrument/index.html +26 -26
  100. package/app/m/commerce/PaymentIntent/index.html +26 -26
  101. package/app/m/commerce/Payout/index.html +26 -26
  102. package/app/m/commerce/ProductionOrder/index.html +26 -26
  103. package/app/m/commerce/PurchaseContract/index.html +26 -26
  104. package/app/m/commerce/PurchaseOrder/index.html +26 -26
  105. package/app/m/commerce/SalesContract/index.html +26 -26
  106. package/app/m/commerce/SupplierQuote/index.html +26 -26
  107. package/app/m/commerce/TaxCode/index.html +26 -26
  108. package/app/m/commerce/TaxComponent/index.html +26 -26
  109. package/app/m/commerce/TaxSettings/index.html +26 -26
  110. package/app/m/commerce/TaxSummaryReport/index.html +26 -26
  111. package/app/m/commerce/Vendor/index.html +26 -26
  112. package/app/m/commerce/WholesaleOrder/index.html +26 -26
  113. package/app/m/content/Content/index.html +26 -26
  114. package/app/m/content/ContentContribution/index.html +26 -26
  115. package/app/m/content/ContentContributionAttachment/index.html +26 -26
  116. package/app/m/content/ContentContributionRevision/index.html +26 -26
  117. package/app/m/content/ContentContributionType/index.html +26 -26
  118. package/app/m/content/ContentContributor/index.html +26 -26
  119. package/app/m/content/ContentCorrection/index.html +26 -26
  120. package/app/m/content/ContentFeedSource/index.html +26 -26
  121. package/app/m/content/ContentGovernanceAssignment/index.html +26 -26
  122. package/app/m/content/ContentGovernancePolicy/index.html +26 -26
  123. package/app/m/content/ContentGovernanceProfile/index.html +26 -26
  124. package/app/m/content/ContentReference/index.html +26 -26
  125. package/app/m/content/ContentReview/index.html +26 -26
  126. package/app/m/content/ContentVersion/index.html +26 -26
  127. package/app/m/events/Event/index.html +26 -26
  128. package/app/m/events/EventParticipant/index.html +26 -26
  129. package/app/m/events/EventSeries/index.html +26 -26
  130. package/app/m/events/EventType/index.html +26 -26
  131. package/app/m/expenses/Expense/index.html +26 -26
  132. package/app/m/facts/Fact/index.html +26 -26
  133. package/app/m/facts/FactContent/index.html +26 -26
  134. package/app/m/facts/FactEvidence/index.html +26 -26
  135. package/app/m/facts/FactSource/index.html +26 -26
  136. package/app/m/facts/FactSubject/index.html +26 -26
  137. package/app/m/facts/FactTag/index.html +26 -26
  138. package/app/m/fields/FieldPolicy/index.html +26 -26
  139. package/app/m/fields/FieldPolicySuggestion/index.html +26 -26
  140. package/app/m/fields/FieldUsageCounter/index.html +26 -26
  141. package/app/m/images/Image/index.html +26 -26
  142. package/app/m/inventory/InventoryLocation/index.html +26 -26
  143. package/app/m/inventory/StockLevel/index.html +26 -26
  144. package/app/m/inventory/StockMovement/index.html +26 -26
  145. package/app/m/ledgers/Account/index.html +26 -26
  146. package/app/m/ledgers/Journal/index.html +26 -26
  147. package/app/m/ledgers/JournalEntry/index.html +26 -26
  148. package/app/m/ledgers/Ledger/index.html +26 -26
  149. package/app/m/manufacturing/Assembly/index.html +26 -26
  150. package/app/m/manufacturing/BillOfMaterials/index.html +26 -26
  151. package/app/m/manufacturing/BomLine/index.html +26 -26
  152. package/app/m/manufacturing/Operation/index.html +26 -26
  153. package/app/m/manufacturing/ProductionRun/index.html +26 -26
  154. package/app/m/manufacturing/ProductionRunCompletion/index.html +26 -26
  155. package/app/m/manufacturing/RoutingStep/index.html +26 -26
  156. package/app/m/marketing/Campaign/index.html +26 -26
  157. package/app/m/marketing/CampaignChannel/index.html +26 -26
  158. package/app/m/marketing/CampaignMetricSnapshot/index.html +26 -26
  159. package/app/m/messages/Account/index.html +26 -26
  160. package/app/m/messages/Attachment/index.html +26 -26
  161. package/app/m/messages/Blacklist/index.html +26 -26
  162. package/app/m/messages/Email/failed-sends/index.html +27 -27
  163. package/app/m/messages/Email/index.html +26 -26
  164. package/app/m/messages/Email/mailbox/index.html +27 -27
  165. package/app/m/messages/EmailAccount/index.html +26 -26
  166. package/app/m/messages/EmailAttachment/index.html +26 -26
  167. package/app/m/messages/EmailFolder/index.html +26 -26
  168. package/app/m/messages/Message/index.html +26 -26
  169. package/app/m/messages/MessagingEndpoint/index.html +26 -26
  170. package/app/m/messages/PersonaMessageRoute/index.html +26 -26
  171. package/app/m/messages/SlackAccount/index.html +26 -26
  172. package/app/m/messages/SlackMessage/index.html +26 -26
  173. package/app/m/messages/TelegramAccount/index.html +26 -26
  174. package/app/m/messages/Tweet/index.html +26 -26
  175. package/app/m/messages/TwitterAccount/index.html +26 -26
  176. package/app/m/messages/Whitelist/index.html +26 -26
  177. package/app/m/messages/ZulipAccount/index.html +26 -26
  178. package/app/m/places/Place/index.html +26 -26
  179. package/app/m/places/PlaceType/index.html +26 -26
  180. package/app/m/products/Category/index.html +26 -26
  181. package/app/m/products/Material/index.html +26 -26
  182. package/app/m/products/Product/index.html +26 -26
  183. package/app/m/products/Product/ingredients/index.html +27 -27
  184. package/app/m/products/ProductVariant/index.html +26 -26
  185. package/app/m/products/Sku/index.html +26 -26
  186. package/app/m/profiles/ApiKey/index.html +26 -26
  187. package/app/m/profiles/Bot/index.html +26 -26
  188. package/app/m/profiles/MagicLinkToken/index.html +26 -26
  189. package/app/m/profiles/NostrIdentity/index.html +26 -26
  190. package/app/m/profiles/OidcIdentity/index.html +26 -26
  191. package/app/m/profiles/Organization/index.html +26 -26
  192. package/app/m/profiles/Person/index.html +26 -26
  193. package/app/m/profiles/Profile/index.html +26 -26
  194. package/app/m/profiles/ProfileMetadata/index.html +26 -26
  195. package/app/m/profiles/ProfileMetafield/index.html +26 -26
  196. package/app/m/profiles/ProfileRelationship/index.html +26 -26
  197. package/app/m/profiles/ProfileRelationshipTerm/index.html +26 -26
  198. package/app/m/profiles/ProfileRelationshipType/index.html +26 -26
  199. package/app/m/profiles/ProfileType/index.html +26 -26
  200. package/app/m/projects/Comment/index.html +26 -26
  201. package/app/m/projects/Issue/index.html +26 -26
  202. package/app/m/projects/Label/index.html +26 -26
  203. package/app/m/projects/Project/index.html +26 -26
  204. package/app/m/projects/ProjectIntegration/index.html +26 -26
  205. package/app/m/projects/PullRequest/index.html +26 -26
  206. package/app/m/projects/Repository/index.html +26 -26
  207. package/app/m/properties/Property/index.html +26 -26
  208. package/app/m/properties/Zone/index.html +26 -26
  209. package/app/m/reports/RuntimeReport/index.html +26 -26
  210. package/app/m/reports/SmrtPrincipalReportRefreshTask/index.html +26 -26
  211. package/app/m/reports/SmrtReportLock/index.html +26 -26
  212. package/app/m/reports/SmrtReportRefreshTask/index.html +26 -26
  213. package/app/m/reports/SmrtReportRun/index.html +26 -26
  214. package/app/m/reports/SmrtReportSchedule/index.html +26 -26
  215. package/app/m/reports/SmrtReportWatermark/index.html +26 -26
  216. package/app/m/sales/Agreement/index.html +26 -26
  217. package/app/m/sales/AttributionException/index.html +26 -26
  218. package/app/m/sales/AttributionPolicy/index.html +26 -26
  219. package/app/m/sales/Commission/index.html +26 -26
  220. package/app/m/sales/CommissionAdjustment/index.html +26 -26
  221. package/app/m/sales/CommissionPayout/index.html +26 -26
  222. package/app/m/sales/CommissionPlan/index.html +26 -26
  223. package/app/m/sales/Earner/index.html +26 -26
  224. package/app/m/sales/EarnerSourceAttribution/index.html +26 -26
  225. package/app/m/sales/EarningEvent/index.html +26 -26
  226. package/app/m/sales/ExecutedAgreement/index.html +26 -26
  227. package/app/m/sales/Lead/index.html +26 -26
  228. package/app/m/sales/Opportunity/index.html +26 -26
  229. package/app/m/sales/OpportunityConversion/index.html +26 -26
  230. package/app/m/sales/PipelineDefinition/index.html +26 -26
  231. package/app/m/sales/PipelineStage/index.html +26 -26
  232. package/app/m/sales/Referral/index.html +26 -26
  233. package/app/m/sales/ReferralAgreement/index.html +26 -26
  234. package/app/m/sales/ReferralLink/index.html +26 -26
  235. package/app/m/sales/ReferralProgram/index.html +26 -26
  236. package/app/m/sales/ReferralTermSnapshot/index.html +26 -26
  237. package/app/m/sales/ReferralTouch/index.html +26 -26
  238. package/app/m/sales/Referrer/index.html +26 -26
  239. package/app/m/sales/SalesActivity/index.html +26 -26
  240. package/app/m/sales/SalesRepresentative/index.html +26 -26
  241. package/app/m/sites/Site/index.html +26 -26
  242. package/app/m/sites/SiteAgentBinding/index.html +26 -26
  243. package/app/m/social/OAuthState/index.html +26 -26
  244. package/app/m/social/SocialAccount/index.html +26 -26
  245. package/app/m/social/SocialPost/index.html +26 -26
  246. package/app/m/social/SocialPostAnalyticsSnapshot/index.html +26 -26
  247. package/app/m/subscriptions/BillingAdjustment/index.html +26 -26
  248. package/app/m/subscriptions/ClientCharge/index.html +26 -26
  249. package/app/m/subscriptions/CreditGrant/index.html +26 -26
  250. package/app/m/subscriptions/PricingRule/index.html +26 -26
  251. package/app/m/subscriptions/RetailCharge/index.html +26 -26
  252. package/app/m/subscriptions/SpendingPolicy/index.html +26 -26
  253. package/app/m/subscriptions/SubscriptionPlan/index.html +26 -26
  254. package/app/m/subscriptions/TenantSubscription/index.html +26 -26
  255. package/app/m/subscriptions/TenantUsageMetric/index.html +26 -26
  256. package/app/m/support/ServiceTimeEntry/index.html +26 -26
  257. package/app/m/support/SupportAiRun/index.html +26 -26
  258. package/app/m/support/SupportAvailability/index.html +26 -26
  259. package/app/m/support/SupportCase/index.html +26 -26
  260. package/app/m/support/SupportCaseEvent/index.html +26 -26
  261. package/app/m/support/SupportChannelBinding/index.html +26 -26
  262. package/app/m/support/SupportCharge/index.html +26 -26
  263. package/app/m/support/SupportCompensation/index.html +26 -26
  264. package/app/m/support/SupportCompensationPlan/index.html +26 -26
  265. package/app/m/support/SupportEscalation/index.html +26 -26
  266. package/app/m/support/SupportInteraction/index.html +26 -26
  267. package/app/m/support/SupportPlan/index.html +26 -26
  268. package/app/m/support/SupportPolicy/index.html +26 -26
  269. package/app/m/support/SupportQualification/index.html +26 -26
  270. package/app/m/support/SupportServiceTarget/index.html +26 -26
  271. package/app/m/support/SupportSpecialist/index.html +26 -26
  272. package/app/m/support/SupportWorkLink/index.html +26 -26
  273. package/app/m/tags/Tag/index.html +26 -26
  274. package/app/m/tags/TagAlias/index.html +26 -26
  275. package/app/m/timesheets/AttendanceBreak/index.html +26 -26
  276. package/app/m/timesheets/AttendancePunch/index.html +26 -26
  277. package/app/m/timesheets/AttendanceSegment/index.html +26 -26
  278. package/app/m/timesheets/ServiceChargeSnapshot/index.html +26 -26
  279. package/app/m/timesheets/ServiceCompensationSnapshot/index.html +26 -26
  280. package/app/m/timesheets/ServiceTimeEntry/index.html +26 -26
  281. package/app/m/users/Group/index.html +26 -26
  282. package/app/m/users/GroupMember/index.html +26 -26
  283. package/app/m/users/GroupRole/index.html +26 -26
  284. package/app/m/users/Membership/index.html +26 -26
  285. package/app/m/users/MembershipOverride/index.html +26 -26
  286. package/app/m/users/Permission/index.html +26 -26
  287. package/app/m/users/Role/index.html +26 -26
  288. package/app/m/users/RolePermission/index.html +26 -26
  289. package/app/m/users/Session/index.html +26 -26
  290. package/app/m/users/Tenant/index.html +26 -26
  291. package/app/m/users/TenantIntegration/index.html +26 -26
  292. package/app/m/users/TenantPermissionOverride/index.html +26 -26
  293. package/app/m/users/User/index.html +26 -26
  294. package/app/m/video/Character/index.html +26 -26
  295. package/app/m/video/CharacterAsset/index.html +26 -26
  296. package/app/m/video/CompositeJob/index.html +26 -26
  297. package/app/m/video/Performer/index.html +26 -26
  298. package/app/m/video/PerformerAsset/index.html +26 -26
  299. package/app/m/video/Scene/index.html +26 -26
  300. package/app/m/video/SceneAsset/index.html +26 -26
  301. package/app/m/video/VideoComposition/index.html +26 -26
  302. package/app/m/video/VideoCompositionAsset/index.html +26 -26
  303. package/app/m/video/VideoSequence/index.html +26 -26
  304. package/app/m/video/VideoSequenceAsset/index.html +26 -26
  305. package/app/m/video/VideoShot/index.html +26 -26
  306. package/app/m/video/VideoShotAsset/index.html +26 -26
  307. package/app/m/video/VideoShotCharacter/index.html +26 -26
  308. package/app/m/video/VideoWorkflow/index.html +26 -26
  309. package/app/m/voice/VoiceOutput/index.html +26 -26
  310. package/app/m/voice/VoiceProfile/index.html +26 -26
  311. package/app/m/voice/VoiceSample/index.html +26 -26
  312. package/app/mcp.html +2 -2
  313. package/app/packages/ads/index.html +24 -24
  314. package/app/packages/analytics/index.html +24 -24
  315. package/app/packages/approvals/index.html +24 -24
  316. package/app/packages/assets/index.html +24 -24
  317. package/app/packages/chat/index.html +24 -24
  318. package/app/packages/comments/index.html +24 -24
  319. package/app/packages/commerce/index.html +24 -24
  320. package/app/packages/content/index.html +24 -24
  321. package/app/packages/events/index.html +24 -24
  322. package/app/packages/expenses/index.html +24 -24
  323. package/app/packages/facts/index.html +24 -24
  324. package/app/packages/fields/index.html +24 -24
  325. package/app/packages/human-resources/index.html +24 -24
  326. package/app/packages/images/index.html +24 -24
  327. package/app/packages/index.html +24 -24
  328. package/app/packages/ingestion/index.html +24 -24
  329. package/app/packages/inventory/index.html +24 -24
  330. package/app/packages/ledgers/index.html +24 -24
  331. package/app/packages/manufacturing/index.html +24 -24
  332. package/app/packages/marketing/index.html +24 -24
  333. package/app/packages/messages/index.html +24 -24
  334. package/app/packages/places/index.html +24 -24
  335. package/app/packages/preferences/index.html +24 -24
  336. package/app/packages/products/index.html +24 -24
  337. package/app/packages/profiles/index.html +24 -24
  338. package/app/packages/projects/index.html +24 -24
  339. package/app/packages/properties/index.html +24 -24
  340. package/app/packages/reports/index.html +24 -24
  341. package/app/packages/sales/index.html +24 -24
  342. package/app/packages/sites/index.html +24 -24
  343. package/app/packages/social/index.html +24 -24
  344. package/app/packages/subscriptions/index.html +24 -24
  345. package/app/packages/support/index.html +24 -24
  346. package/app/packages/tags/index.html +24 -24
  347. package/app/packages/timesheets/index.html +24 -24
  348. package/app/packages/users/index.html +24 -24
  349. package/app/packages/video/index.html +24 -24
  350. package/app/packages/voice/index.html +24 -24
  351. package/app/packages/webhooks/index.html +24 -24
  352. package/app/recipes/account-access/help/index.html +25 -25
  353. package/app/recipes/account-access/index.html +28 -28
  354. package/app/recipes/activity/help/index.html +25 -25
  355. package/app/recipes/activity/index.html +28 -28
  356. package/app/recipes/agreements/help/index.html +25 -25
  357. package/app/recipes/agreements/index.html +28 -28
  358. package/app/recipes/analytics.reports/help/index.html +25 -25
  359. package/app/recipes/analytics.reports/index.html +28 -28
  360. package/app/recipes/assets/help/index.html +25 -25
  361. package/app/recipes/assets/index.html +28 -28
  362. package/app/recipes/billing/help/index.html +25 -25
  363. package/app/recipes/billing/index.html +28 -28
  364. package/app/recipes/chat.assistant/help/index.html +25 -25
  365. package/app/recipes/chat.assistant/index.html +28 -28
  366. package/app/recipes/comments/help/index.html +25 -25
  367. package/app/recipes/comments/index.html +28 -28
  368. package/app/recipes/commerce.customers/help/index.html +25 -25
  369. package/app/recipes/commerce.customers/index.html +28 -28
  370. package/app/recipes/commerce.estimates/help/index.html +25 -25
  371. package/app/recipes/commerce.estimates/index.html +28 -28
  372. package/app/recipes/commerce.purchases/help/index.html +25 -25
  373. package/app/recipes/commerce.purchases/index.html +28 -28
  374. package/app/recipes/commerce.sales/help/index.html +25 -25
  375. package/app/recipes/commerce.sales/index.html +28 -28
  376. package/app/recipes/commerce.vendors/help/index.html +25 -25
  377. package/app/recipes/commerce.vendors/index.html +28 -28
  378. package/app/recipes/commerce.wholesale/help/index.html +25 -25
  379. package/app/recipes/commerce.wholesale/index.html +28 -28
  380. package/app/recipes/events.calendar/help/index.html +25 -25
  381. package/app/recipes/events.calendar/index.html +28 -28
  382. package/app/recipes/expenses.tracking/help/index.html +25 -25
  383. package/app/recipes/expenses.tracking/index.html +28 -28
  384. package/app/recipes/fields.form-customization/help/index.html +25 -25
  385. package/app/recipes/fields.form-customization/index.html +28 -28
  386. package/app/recipes/ingestion/help/index.html +25 -25
  387. package/app/recipes/ingestion/index.html +28 -28
  388. package/app/recipes/integrations/help/index.html +25 -25
  389. package/app/recipes/integrations/index.html +28 -28
  390. package/app/recipes/inventory.stock/help/index.html +25 -25
  391. package/app/recipes/inventory.stock/index.html +28 -28
  392. package/app/recipes/ledgers.bookkeeping/help/index.html +25 -25
  393. package/app/recipes/ledgers.bookkeeping/index.html +28 -28
  394. package/app/recipes/messages/help/index.html +25 -25
  395. package/app/recipes/messages/index.html +28 -28
  396. package/app/recipes/products/help/index.html +25 -25
  397. package/app/recipes/products/index.html +28 -28
  398. package/app/recipes/projects.tracker/help/index.html +25 -25
  399. package/app/recipes/projects.tracker/index.html +28 -28
  400. package/app/recipes/reports.materialized/help/index.html +25 -25
  401. package/app/recipes/reports.materialized/index.html +28 -28
  402. package/app/recipes/reports.runtime/help/index.html +25 -25
  403. package/app/recipes/reports.runtime/index.html +28 -28
  404. package/app/recipes/sales.pipeline/help/index.html +25 -25
  405. package/app/recipes/sales.pipeline/index.html +28 -28
  406. package/app/recipes/tags.taxonomy/help/index.html +25 -25
  407. package/app/recipes/tags.taxonomy/index.html +28 -28
  408. package/app/recipes/team-collaboration/help/index.html +25 -25
  409. package/app/recipes/team-collaboration/index.html +28 -28
  410. package/app/recipes/timesheets.time-entries/help/index.html +25 -25
  411. package/app/recipes/timesheets.time-entries/index.html +28 -28
  412. package/app/s/custom-accounts/index.html +23 -23
  413. package/app/s/custom-appointments/index.html +23 -23
  414. package/app/s/custom-billing/index.html +23 -23
  415. package/app/s/custom-bookings/index.html +82 -0
  416. package/app/s/custom-buying/index.html +23 -23
  417. package/app/s/custom-checkout/index.html +23 -23
  418. package/app/s/custom-classes/index.html +23 -23
  419. package/app/s/custom-clients/index.html +23 -23
  420. package/app/s/custom-events/index.html +23 -23
  421. package/app/s/custom-fleet/index.html +23 -23
  422. package/app/s/custom-gigs/index.html +82 -0
  423. package/app/s/custom-giving/index.html +23 -23
  424. package/app/s/custom-instruments/index.html +82 -0
  425. package/app/s/custom-jobs/index.html +23 -23
  426. package/app/s/custom-kitchen/index.html +23 -23
  427. package/app/s/custom-lessons/index.html +82 -0
  428. package/app/s/custom-material/index.html +23 -23
  429. package/app/s/custom-meetings/index.html +23 -23
  430. package/app/s/custom-members/index.html +23 -23
  431. package/app/s/custom-merch/index.html +82 -0
  432. package/app/s/custom-money/index.html +82 -0
  433. package/app/s/custom-paint/index.html +23 -23
  434. package/app/s/custom-parts/index.html +23 -23
  435. package/app/s/custom-rentals/index.html +23 -23
  436. package/app/s/custom-roastery/index.html +23 -23
  437. package/app/s/custom-schedule/index.html +23 -23
  438. package/app/s/custom-shelf/index.html +23 -23
  439. package/app/s/custom-shop/index.html +23 -23
  440. package/app/s/custom-students/index.html +82 -0
  441. package/app/s/custom-wholesale/index.html +23 -23
  442. package/app/s/custom-work/index.html +23 -23
  443. package/app/s/custom-yard/index.html +23 -23
  444. package/app/s/section-access-control/index.html +23 -23
  445. package/app/s/section-account-security/index.html +23 -23
  446. package/app/s/section-accounting/index.html +23 -23
  447. package/app/s/section-activity/index.html +23 -23
  448. package/app/s/section-agreements/index.html +23 -23
  449. package/app/s/section-analytics/index.html +23 -23
  450. package/app/s/section-assets/index.html +23 -23
  451. package/app/s/section-billing/index.html +23 -23
  452. package/app/s/section-calendar/index.html +23 -23
  453. package/app/s/section-catalog/index.html +23 -23
  454. package/app/s/section-chat.assistant/index.html +23 -23
  455. package/app/s/section-comments/index.html +23 -23
  456. package/app/s/section-fields.form-customization/index.html +23 -23
  457. package/app/s/section-ingestion/index.html +23 -23
  458. package/app/s/section-integrations/index.html +23 -23
  459. package/app/s/section-messages/index.html +23 -23
  460. package/app/s/section-more/index.html +23 -23
  461. package/app/s/section-operations/index.html +23 -23
  462. package/app/s/section-projects/index.html +23 -23
  463. package/app/s/section-purchasing/index.html +23 -23
  464. package/app/s/section-reports.materialized/index.html +23 -23
  465. package/app/s/section-reports.runtime/index.html +23 -23
  466. package/app/s/section-sales/index.html +23 -23
  467. package/app/s/section-taxonomy/index.html +23 -23
  468. package/app/s/section-team/index.html +23 -23
  469. package/app/s/section-work/index.html +23 -23
  470. package/dist/catalog/catalog.json +38 -38
  471. package/dist/components/ThemeBridge.svelte +2 -2
  472. package/dist/data/packs.d.ts.map +1 -1
  473. package/dist/data/packs.js +415 -0
  474. package/dist/library/icons.d.ts.map +1 -1
  475. package/dist/library/icons.js +10 -0
  476. package/dist/library/library.json +506 -0
  477. package/dist/smrt-version.d.ts +1 -1
  478. package/dist/smrt-version.js +1 -1
  479. package/package.json +54 -54
  480. package/app/_app/immutable/assets/AppShell.Dnc9PAvY.css +0 -1
  481. package/app/_app/immutable/assets/labels.DrQMsG17.css +0 -1
  482. package/app/_app/immutable/chunks/9pRTae44.js +0 -1
  483. package/app/_app/immutable/chunks/BhU_yBI_.js +0 -1
  484. package/app/_app/immutable/chunks/Bsn3IIve.js +0 -4
  485. package/app/_app/immutable/chunks/C_3CJO_1.js +0 -1
  486. package/app/_app/immutable/chunks/CyUSxz1P.js +0 -4
  487. package/app/_app/immutable/chunks/d_dqmeIr.js +0 -1
  488. package/app/_app/immutable/entry/start.BXkBl20Z.js +0 -1
@@ -0,0 +1 @@
1
+ @layer smrt.reset,smrt.structure;@layer smrt.theme{.smrt-widget-form__check.svelte-1jw9hhr{gap:var(--smrt-spacing-1);flex-direction:column;display:flex}.smrt-widget-form__hint.svelte-1jw9hhr{color:var(--smrt-color-on-surface-variant)}.smrt-widget-form__error.svelte-1jw9hhr{color:var(--smrt-color-error)}.smrt-widget-form__none.svelte-1jw9hhr{color:var(--smrt-color-on-surface-variant);margin:0}.smrt-overview.svelte-1liasmg{min-inline-size:0;container-type:inline-size}.smrt-overview__toolbar.svelte-1liasmg{gap:var(--smrt-spacing-1);margin-block-end:var(--smrt-spacing-2);display:flex}.smrt-overview__empty.svelte-1liasmg{color:var(--smrt-color-on-surface-variant);margin:0}.smrt-overview__list.svelte-1liasmg{--smrt-overview-grid-pad:var(--smrt-spacing-2);margin:calc(-1 * var(--smrt-overview-grid-pad));grid-template-columns:repeat(4,minmax(0,1fr));display:grid}.smrt-overview__item.svelte-1liasmg{grid-column:span var(--smrt-overview-grid-span,1);min-inline-size:0;padding:var(--smrt-overview-grid-pad);position:relative}.smrt-overview__item[data-dragging].svelte-1liasmg{opacity:.5}.smrt-overview__item[data-drop].svelte-1liasmg:before{content:"";inset-block:var(--smrt-overview-grid-pad);border-radius:var(--smrt-radius-full);background:var(--smrt-color-primary);inline-size:.1875rem;position:absolute}.smrt-overview__item[data-drop=before].svelte-1liasmg:before{inset-inline-start:0}.smrt-overview__item[data-drop=after].svelte-1liasmg:before{inset-inline-end:0}.smrt-overview__tile.svelte-1liasmg{box-sizing:border-box;block-size:100%;padding:var(--smrt-spacing-3);border:var(--smrt-hairline);border-radius:var(--smrt-radius-large,var(--smrt-radius-medium));background:var(--smrt-color-surface);color:var(--smrt-color-on-surface);position:relative}[data-presentation=plain].svelte-1liasmg:not([data-editing]) .smrt-overview__tile:where(.svelte-1liasmg){background:0 0;border:0;border-radius:0;padding:0}[data-editing].svelte-1liasmg .smrt-overview__tile:where(.svelte-1liasmg){border-style:dashed}.smrt-overview__widget.svelte-1liasmg{gap:var(--smrt-spacing-2);align-content:start;min-inline-size:0;display:grid}.smrt-overview__title.svelte-1liasmg{overflow-wrap:break-word;color:var(--smrt-color-on-surface-variant);font-size:var(--smrt-typography-title-small-size,.875rem);font-weight:var(--smrt-typography-weight-medium,500);margin:0}.smrt-overview__state.svelte-1liasmg{color:var(--smrt-color-on-surface-variant);margin:0}.smrt-overview__chrome.svelte-1liasmg{align-items:center;gap:var(--smrt-spacing-1);margin-block-end:var(--smrt-spacing-2);display:flex}.smrt-overview__chrome-title.svelte-1liasmg{text-overflow:ellipsis;white-space:nowrap;min-inline-size:0;color:var(--smrt-color-on-surface-variant);font-size:var(--smrt-typography-label-large-size,.875rem);flex:auto;overflow:hidden}.smrt-overview__handle.svelte-1liasmg{border-radius:var(--smrt-radius-small);block-size:2rem;inline-size:2rem;color:var(--smrt-color-on-surface-variant);cursor:grab;touch-action:none;background:0 0;border:0;flex:none;place-items:center;padding:0;display:inline-grid}.smrt-overview__handle.svelte-1liasmg:active{cursor:grabbing}.smrt-overview__handle.svelte-1liasmg:hover{background:var(--smrt-color-surface-container-high)}.smrt-overview__handle.svelte-1liasmg:focus-visible{outline:2px solid var(--smrt-color-primary);outline-offset:2px}.smrt-overview__handle[aria-pressed=true].svelte-1liasmg{background:var(--smrt-color-primary-container);color:var(--smrt-color-on-primary-container)}.smrt-overview__resize.svelte-1liasmg{border:var(--smrt-hairline-strong);border-radius:var(--smrt-radius-full);background:var(--smrt-color-surface-container-high);cursor:ew-resize;touch-action:none;block-size:2.75rem;inline-size:.875rem;position:absolute;inset-block-start:50%;inset-inline-end:-.4375rem;transform:translateY(-50%)}.smrt-overview__resize.svelte-1liasmg:hover{background:var(--smrt-color-primary-container)}.smrt-overview__resize.svelte-1liasmg:focus-visible{outline:2px solid var(--smrt-color-primary);outline-offset:2px}.smrt-overview__choices.svelte-1liasmg{gap:var(--smrt-spacing-1);margin:0;padding:0;list-style:none;display:grid}.smrt-overview__choice.svelte-1liasmg{align-items:center;gap:var(--smrt-spacing-3);text-align:start;display:flex}.smrt-overview__choice-text.svelte-1liasmg{display:grid}.smrt-overview__choice-text.svelte-1liasmg small:where(.svelte-1liasmg){color:var(--smrt-color-on-surface-variant)}.smrt-overview__live.svelte-1liasmg{clip:rect(0 0 0 0);clip-path:inset(50%);white-space:nowrap;block-size:1px;inline-size:1px;position:absolute;overflow:hidden}@container (width<=40rem){.smrt-overview__list.svelte-1liasmg{grid-template-columns:repeat(2,minmax(0,1fr))}.smrt-overview__item[data-span="3"].svelte-1liasmg,.smrt-overview__item[data-span="4"].svelte-1liasmg{grid-column:span 2}}@container (width<=22rem){.smrt-overview__list.svelte-1liasmg{grid-template-columns:minmax(0,1fr)}.smrt-overview__list.svelte-1liasmg .smrt-overview__item[data-span]:where(.svelte-1liasmg){grid-column:span 1}}.smrt-chart.svelte-75pkr{gap:var(--smrt-spacing-1);color:var(--smrt-color-primary);display:grid}.smrt-chart__line.svelte-75pkr{block-size:7rem;inline-size:100%;overflow:visible}.smrt-chart__axis.svelte-75pkr{color:var(--smrt-color-on-surface-variant);font-size:var(--smrt-typography-label-large-size,.75rem);justify-content:space-between;margin:0;display:flex}.smrt-chart__bars.svelte-75pkr{gap:var(--smrt-spacing-2);margin:0;padding:0;list-style:none;display:grid}.smrt-chart__row.svelte-75pkr{align-items:center;gap:var(--smrt-spacing-2);font-size:var(--smrt-typography-body-medium-size,.875rem);color:var(--smrt-color-on-surface);grid-template-columns:minmax(4rem,30%) minmax(0,1fr) auto;display:grid}.smrt-chart__label.svelte-75pkr{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.smrt-chart__track.svelte-75pkr{border-radius:var(--smrt-radius-full);background:var(--smrt-color-surface-container-high);block-size:.625rem;display:block;overflow:hidden}.smrt-chart__bar.svelte-75pkr{border-radius:inherit;background:var(--smrt-color-primary);block-size:100%;display:block}.smrt-chart__value.svelte-75pkr{font-variant-numeric:tabular-nums;color:var(--smrt-color-on-surface-variant)}.smrt-chart__empty.svelte-75pkr{color:var(--smrt-color-on-surface-variant);margin:0}.smrt-chart--table.svelte-75pkr{color:var(--smrt-color-on-surface)}.smrt-chart__data.svelte-75pkr{border-collapse:collapse;inline-size:100%;font-size:var(--smrt-typography-body-medium-size,.875rem)}.smrt-chart__data.svelte-75pkr caption:where(.svelte-75pkr){clip:rect(0 0 0 0);clip-path:inset(50%);white-space:nowrap;block-size:1px;inline-size:1px;position:absolute;overflow:hidden}.smrt-chart__data.svelte-75pkr th:where(.svelte-75pkr),.smrt-chart__data.svelte-75pkr td:where(.svelte-75pkr){padding:var(--smrt-spacing-1) var(--smrt-spacing-2);border-block-end:var(--smrt-hairline);text-align:start}.smrt-chart__data.svelte-75pkr thead:where(.svelte-75pkr) th:where(.svelte-75pkr){background:var(--smrt-surface-sunken);color:var(--smrt-color-on-surface-variant);font-weight:var(--smrt-typography-weight-medium,500)}.smrt-chart__data.svelte-75pkr tbody:where(.svelte-75pkr) th:where(.svelte-75pkr){font-weight:inherit;overflow-wrap:anywhere}.smrt-chart__data.svelte-75pkr td:where(.svelte-75pkr),.smrt-chart__data.svelte-75pkr thead:where(.svelte-75pkr) th:where(.svelte-75pkr):last-child{text-align:end;font-variant-numeric:tabular-nums}.smrt-chart--stat.svelte-75pkr{gap:var(--smrt-spacing-1);color:var(--smrt-color-on-surface)}.smrt-chart__headline.svelte-75pkr{font-size:var(--smrt-typography-display-small-size,2rem);font-weight:var(--smrt-typography-weight-medium,500);font-variant-numeric:tabular-nums;margin:0;line-height:1.1}.smrt-chart__caption.svelte-75pkr{color:var(--smrt-color-on-surface-variant);font-size:var(--smrt-typography-body-medium-size,.875rem);margin:0}.smrt-chart__delta.svelte-75pkr{color:var(--smrt-color-on-surface-variant);font-size:var(--smrt-typography-label-large-size,.875rem);margin:0}.smrt-chart--pie.svelte-75pkr{align-items:center;gap:var(--smrt-spacing-4);grid-template-columns:minmax(6rem,10rem) minmax(0,1fr)}.smrt-chart__donut.svelte-75pkr{block-size:auto;inline-size:100%}.smrt-chart__slice[data-slot="0"].svelte-75pkr,.smrt-chart__swatch[data-slot="0"].svelte-75pkr{stroke:var(--smrt-color-primary);background:var(--smrt-color-primary)}.smrt-chart__slice[data-slot="1"].svelte-75pkr,.smrt-chart__swatch[data-slot="1"].svelte-75pkr{stroke:var(--smrt-color-secondary);background:var(--smrt-color-secondary)}.smrt-chart__slice[data-slot="2"].svelte-75pkr,.smrt-chart__swatch[data-slot="2"].svelte-75pkr{stroke:var(--smrt-color-tertiary);background:var(--smrt-color-tertiary)}.smrt-chart__slice[data-slot="3"].svelte-75pkr,.smrt-chart__swatch[data-slot="3"].svelte-75pkr{stroke:var(--smrt-color-info);background:var(--smrt-color-info)}.smrt-chart__slice[data-slot="4"].svelte-75pkr,.smrt-chart__swatch[data-slot="4"].svelte-75pkr{stroke:var(--smrt-color-primary-container);background:var(--smrt-color-primary-container)}.smrt-chart__slice[data-slot="5"].svelte-75pkr,.smrt-chart__swatch[data-slot="5"].svelte-75pkr{stroke:var(--smrt-color-secondary-container);background:var(--smrt-color-secondary-container)}.smrt-chart__slice[data-slot="6"].svelte-75pkr,.smrt-chart__swatch[data-slot="6"].svelte-75pkr{stroke:var(--smrt-color-tertiary-container);background:var(--smrt-color-tertiary-container)}.smrt-chart__slice[data-slot="7"].svelte-75pkr,.smrt-chart__swatch[data-slot="7"].svelte-75pkr{stroke:var(--smrt-color-info-container);background:var(--smrt-color-info-container)}.smrt-chart__legend.svelte-75pkr{gap:var(--smrt-spacing-1);color:var(--smrt-color-on-surface);font-size:var(--smrt-typography-body-medium-size,.875rem);margin:0;padding:0;list-style:none;display:grid}.smrt-chart__legend-item.svelte-75pkr{align-items:center;gap:var(--smrt-spacing-2);grid-template-columns:auto minmax(0,1fr) auto;display:grid}.smrt-chart__swatch.svelte-75pkr{border-radius:var(--smrt-radius-small);block-size:.75rem;inline-size:.75rem}.smrt-chart__legend.svelte-75pkr .smrt-chart__label:where(.svelte-75pkr){text-overflow:ellipsis;white-space:nowrap;overflow:hidden}@media (prefers-reduced-motion:no-preference){.smrt-chart__slice.svelte-75pkr{transition:stroke-dasharray var(--smrt-duration-normal) var(--smrt-easing-standard), stroke-dashoffset var(--smrt-duration-normal) var(--smrt-easing-standard)}.smrt-chart__bar.svelte-75pkr{transition:inline-size var(--smrt-duration-normal) var(--smrt-easing-standard)}}.smrt-chart__table.svelte-75pkr{clip:rect(0 0 0 0);clip-path:inset(50%);white-space:nowrap;block-size:1px;inline-size:1px;position:absolute;overflow:hidden}@media (forced-colors:active){.smrt-chart__slice[data-slot="0"].svelte-75pkr,.smrt-chart__swatch[data-slot="0"].svelte-75pkr{stroke:canvastext;background:canvastext}.smrt-chart__slice[data-slot="1"].svelte-75pkr,.smrt-chart__swatch[data-slot="1"].svelte-75pkr{stroke:highlight;background:highlight}.smrt-chart__slice[data-slot="2"].svelte-75pkr,.smrt-chart__swatch[data-slot="2"].svelte-75pkr{stroke:linktext;background:linktext}.smrt-chart__slice[data-slot="3"].svelte-75pkr,.smrt-chart__swatch[data-slot="3"].svelte-75pkr{stroke:visitedtext;background:visitedtext}.smrt-chart__slice[data-slot="4"].svelte-75pkr,.smrt-chart__swatch[data-slot="4"].svelte-75pkr{stroke:activetext;background:activetext}.smrt-chart__slice[data-slot="5"].svelte-75pkr,.smrt-chart__swatch[data-slot="5"].svelte-75pkr{stroke:graytext;background:graytext}.smrt-chart__slice[data-slot="6"].svelte-75pkr,.smrt-chart__swatch[data-slot="6"].svelte-75pkr{stroke:buttontext;background:buttontext}.smrt-chart__slice[data-slot="7"].svelte-75pkr,.smrt-chart__swatch[data-slot="7"].svelte-75pkr{stroke:marktext;background:marktext}.smrt-chart__swatch.svelte-75pkr{border:var(--smrt-hairline-strong)}.smrt-chart__slice.svelte-75pkr{stroke-linecap:butt}.smrt-chart__track.svelte-75pkr{border:var(--smrt-hairline-strong);background:canvas}.smrt-chart__bar.svelte-75pkr{background:highlight}}.smrt-metric.svelte-16na9c5{gap:var(--smrt-spacing-1);display:grid}.smrt-metric__value.svelte-16na9c5{color:var(--smrt-color-on-surface);font-size:var(--smrt-typography-display-small-size,2rem);font-weight:var(--smrt-typography-weight-medium,500);font-variant-numeric:tabular-nums;margin:0;line-height:1.1;text-decoration:none}a.smrt-metric__value.svelte-16na9c5:hover{text-decoration:underline}a.smrt-metric__value.svelte-16na9c5:focus-visible{outline:2px solid var(--smrt-color-primary);outline-offset:2px;border-radius:var(--smrt-radius-small,.25rem)}.smrt-metric__label.svelte-16na9c5{color:var(--smrt-color-on-surface-variant);font-size:var(--smrt-typography-body-medium-size,.875rem);margin:0}.smrt-metric__change.svelte-16na9c5{color:var(--smrt-color-on-surface-variant);font-size:var(--smrt-typography-label-large-size,.875rem);margin:0}.smrt-note.svelte-h4l6y5{gap:var(--smrt-spacing-2);color:var(--smrt-color-on-surface);font-size:var(--smrt-typography-body-medium-size,.875rem);overflow-wrap:anywhere;display:grid}.smrt-note.svelte-h4l6y5 p:where(.svelte-h4l6y5),.smrt-note.svelte-h4l6y5 ul:where(.svelte-h4l6y5),.smrt-note.svelte-h4l6y5 ol:where(.svelte-h4l6y5),.smrt-note.svelte-h4l6y5 blockquote:where(.svelte-h4l6y5),.smrt-note.svelte-h4l6y5 pre:where(.svelte-h4l6y5){margin:0}.smrt-note.svelte-h4l6y5 ul:where(.svelte-h4l6y5),.smrt-note.svelte-h4l6y5 ol:where(.svelte-h4l6y5){padding-inline-start:var(--smrt-spacing-5,1.25rem)}.smrt-note.svelte-h4l6y5 blockquote:where(.svelte-h4l6y5){border-inline-start:3px solid var(--smrt-color-outline-variant);color:var(--smrt-color-on-surface-variant);padding-inline-start:var(--smrt-spacing-3)}.smrt-note.svelte-h4l6y5 pre:where(.svelte-h4l6y5){padding:var(--smrt-spacing-2);border-radius:var(--smrt-radius-small,.25rem);background:var(--smrt-color-surface-container);overflow-x:auto}.smrt-note.svelte-h4l6y5 code:where(.svelte-h4l6y5){font-family:var(--smrt-font-family-mono,ui-monospace, monospace)}.smrt-note.svelte-h4l6y5 a:where(.svelte-h4l6y5){color:var(--smrt-color-primary)}.smrt-note__heading[data-level="1"].svelte-h4l6y5{font-size:var(--smrt-typography-title-large-size,1.25rem)}.smrt-note__heading[data-level="2"].svelte-h4l6y5{font-size:var(--smrt-typography-title-medium-size,1.125rem)}.smrt-note__empty.svelte-h4l6y5{color:var(--smrt-color-on-surface-variant);margin:0}.smrt-record-table.svelte-13uvxec{font-variant-numeric:tabular-nums;min-inline-size:0}.smrt-record-table.svelte-13uvxec code:where(.svelte-13uvxec){font-family:var(--smrt-font-family-mono)}.smrt-record-table__link.svelte-13uvxec{color:var(--smrt-color-primary);text-decoration:none}.smrt-record-table__link.svelte-13uvxec:hover{text-decoration:underline}.smrt-records.svelte-1ouw4wc{margin:0;padding:0;list-style:none;display:grid}.smrt-records__row.svelte-1ouw4wc{justify-content:space-between;align-items:baseline;gap:var(--smrt-spacing-3);padding:var(--smrt-spacing-2) 0;border-block-end:var(--smrt-hairline);display:flex}.smrt-records__row.svelte-1ouw4wc:last-child{border-block-end:0}.smrt-records__main.svelte-1ouw4wc{min-inline-size:0;display:grid}.smrt-records__title.svelte-1ouw4wc{text-overflow:ellipsis;white-space:nowrap;color:var(--smrt-color-on-surface);font-weight:var(--smrt-typography-weight-medium,500);text-decoration:none;overflow:hidden}a.smrt-records__title.svelte-1ouw4wc:hover{text-decoration:underline}.smrt-records__sub.svelte-1ouw4wc,.smrt-records__meta.svelte-1ouw4wc{color:var(--smrt-color-on-surface-variant);font-size:var(--smrt-typography-body-medium-size,.875rem)}.smrt-records__meta.svelte-1ouw4wc{font-variant-numeric:tabular-nums;flex:none}.smrt-records__foot.svelte-1ouw4wc{justify-content:space-between;gap:var(--smrt-spacing-3);margin:var(--smrt-spacing-2) 0 0;color:var(--smrt-color-on-surface-variant);font-size:var(--smrt-typography-body-medium-size,.875rem);display:flex}.smrt-records__foot--end.svelte-1ouw4wc{justify-content:flex-end}.smrt-records__foot.svelte-1ouw4wc a:where(.svelte-1ouw4wc){color:var(--smrt-color-primary)}.smrt-records__empty.svelte-1ouw4wc{color:var(--smrt-color-on-surface-variant);margin:0}.smrt-shortcuts.svelte-1nfxkds{gap:var(--smrt-spacing-3);grid-template-columns:repeat(auto-fill,minmax(min(12rem,100%),1fr));margin:0;padding:0;list-style:none;display:grid}.smrt-shortcuts__card.svelte-1nfxkds{border:var(--smrt-hairline);border-radius:var(--smrt-radius-large,var(--smrt-radius-medium));background:var(--smrt-color-surface);min-inline-size:0;transition:background-color .12s,border-color .12s;display:flex;position:relative}.smrt-shortcuts__card.svelte-1nfxkds:hover{background:var(--smrt-color-surface-container-high);border-color:var(--smrt-hairline-strong-color)}.smrt-shortcuts__link.svelte-1nfxkds{gap:var(--smrt-spacing-2);padding:var(--smrt-spacing-3);color:var(--smrt-color-on-surface);flex-direction:column;flex:auto;text-decoration:none;display:flex}.smrt-shortcuts__link.svelte-1nfxkds:focus-visible{outline:2px solid var(--smrt-color-primary);outline-offset:2px;border-radius:inherit}.smrt-shortcuts__heading.svelte-1nfxkds{align-items:center;gap:var(--smrt-spacing-2);min-inline-size:0;display:flex}.smrt-shortcuts__icon.svelte-1nfxkds{block-size:28px;inline-size:28px;color:var(--smrt-color-primary);flex:0 0 28px;place-items:center;display:inline-grid}.smrt-shortcuts__icon.svelte-1nfxkds .smrt-shell-section-icon{block-size:28px;inline-size:28px}.smrt-shortcuts__title.svelte-1nfxkds{min-inline-size:0;font-weight:var(--smrt-typography-weight-medium,500);overflow-wrap:break-word;flex:auto}.smrt-shortcuts__desc.svelte-1nfxkds{-webkit-line-clamp:2;line-clamp:2;color:var(--smrt-color-on-surface-variant);font-size:var(--smrt-typography-body-medium-size,.875rem);-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.smrt-shortcuts__foot.svelte-1nfxkds{align-items:center;gap:var(--smrt-spacing-2);flex-wrap:wrap;margin-block-start:auto;display:flex}.smrt-shortcuts__count.svelte-1nfxkds{color:var(--smrt-color-on-surface-variant);font-size:var(--smrt-typography-body-small-size,.75rem);font-variant-numeric:tabular-nums}.smrt-shortcuts[data-presentation=plain].svelte-1nfxkds{gap:var(--smrt-spacing-1)}.smrt-shortcuts[data-presentation=plain].svelte-1nfxkds .smrt-shortcuts__card:where(.svelte-1nfxkds){border-radius:var(--smrt-radius-medium);background:0 0;border:0}.smrt-shortcuts[data-presentation=plain].svelte-1nfxkds .smrt-shortcuts__card:where(.svelte-1nfxkds):hover{background:color-mix(in srgb, var(--smrt-color-on-surface) calc(var(--smrt-state-hover) * 100%), transparent)}.smrt-shortcuts__empty.svelte-1nfxkds{color:var(--smrt-color-on-surface-variant);margin:0}.smrt-line-items.svelte-1q5no7f{gap:var(--smrt-spacing-3);min-inline-size:0;display:grid}.smrt-line-items__empty.svelte-1q5no7f{color:var(--smrt-color-on-surface-variant);margin:0}.smrt-line-items__totals.svelte-1q5no7f{justify-self:end;gap:var(--smrt-spacing-1);font-variant-numeric:tabular-nums;min-inline-size:min(100%,18rem);margin:0;display:grid}.smrt-line-items__total.svelte-1q5no7f{justify-content:space-between;gap:var(--smrt-spacing-4);display:flex}.smrt-line-items__total.svelte-1q5no7f dt:where(.svelte-1q5no7f){color:var(--smrt-color-on-surface-variant)}.smrt-line-items__total--muted.svelte-1q5no7f{color:var(--smrt-color-on-surface-variant);font-size:var(--smrt-typography-body-small-size)}.smrt-line-items__total.svelte-1q5no7f dd:where(.svelte-1q5no7f){text-align:end;margin:0}.smrt-line-items__total--grand.svelte-1q5no7f{border-block-start:var(--smrt-hairline);font-weight:var(--smrt-typography-weight-semibold);padding-block-start:var(--smrt-spacing-2)}.smrt-line-items__total--grand.svelte-1q5no7f dt:where(.svelte-1q5no7f){color:var(--smrt-color-on-surface)}.smrt-line-items__computed.svelte-1q5no7f{font-size:var(--smrt-typography-body-small-size,.75rem);margin-inline-start:var(--smrt-spacing-1)}.smrt-line-items__flag.svelte-1q5no7f{padding:var(--smrt-spacing-2) var(--smrt-spacing-3);border-inline-start:var(--smrt-spacing-1) solid var(--smrt-color-warning);border-radius:var(--smrt-radius-sm);background:var(--smrt-color-warning-container);color:var(--smrt-color-on-warning-container);margin:0}.smrt-line-items__foot.svelte-1q5no7f{justify-content:flex-end;margin:0;display:flex}.smrt-line-items__foot.svelte-1q5no7f a:where(.svelte-1q5no7f){color:var(--smrt-color-primary)}.smrt-related.svelte-ka1ryg{min-inline-size:0}.smrt-related__list.svelte-ka1ryg{gap:var(--smrt-spacing-2);margin:var(--smrt-spacing-2) 0 0;padding:0;list-style:none;display:grid}.smrt-related__foot.svelte-ka1ryg{margin:var(--smrt-spacing-2) 0 0;font-size:var(--smrt-typography-body-medium-size,.875rem);justify-content:flex-end;display:flex}.smrt-related__foot.svelte-ka1ryg a:where(.svelte-ka1ryg){color:var(--smrt-color-primary)}.smrt-related__empty.svelte-ka1ryg{color:var(--smrt-color-on-surface-variant);margin:0}.smrt-detail-screen.svelte-c1e3gm{gap:var(--smrt-spacing-lg,1.5rem);flex-direction:column;display:flex}.smrt-detail-screen--card.svelte-c1e3gm{padding:var(--smrt-spacing-md,1rem);border:var(--smrt-hairline);border-radius:var(--smrt-radius-lg);background:var(--smrt-color-surface)}.smrt-detail-screen--card.svelte-c1e3gm .smrt-detail-screen__fields:where(.svelte-c1e3gm){grid-template-columns:repeat(auto-fill,minmax(max(14rem,40%),1fr))}.smrt-detail-screen__group-title.svelte-c1e3gm{margin:0 0 var(--smrt-spacing-sm,.5rem);font-size:var(--smrt-typography-title-medium-size,1rem)}.smrt-detail-screen__fields.svelte-c1e3gm{gap:var(--smrt-spacing-md,1rem);grid-template-columns:repeat(auto-fill,minmax(14rem,1fr));margin:0;display:grid}.smrt-detail-screen__field.svelte-c1e3gm dt:where(.svelte-c1e3gm){color:var(--smrt-color-on-surface-variant);font-size:var(--smrt-typography-body-medium-size,.875rem)}.smrt-detail-screen__field.svelte-c1e3gm dd:where(.svelte-c1e3gm){overflow-wrap:anywhere;margin:0}.smrt-detail-screen__empty.svelte-c1e3gm{color:var(--smrt-color-on-surface-variant)}.smrt-detail-screen__pairs.svelte-c1e3gm{gap:var(--smrt-spacing-1,.25rem);margin:0;display:grid}.smrt-detail-screen__pairs.svelte-c1e3gm div:where(.svelte-c1e3gm){gap:0 var(--smrt-spacing-sm,.5rem);flex-wrap:wrap;display:flex}.smrt-detail-screen__pairs.svelte-c1e3gm dt:where(.svelte-c1e3gm){color:var(--smrt-color-on-surface-variant);font-size:var(--smrt-typography-body-medium-size,.875rem)}.smrt-detail-screen__pairs.svelte-c1e3gm dd:where(.svelte-c1e3gm){margin:0}.smrt-detail-screen__block.svelte-c1e3gm{white-space:pre-wrap;margin:0;font-family:inherit}.smrt-edit-form.svelte-6ki7lf{max-width:40rem}.smrt-edit-form__group.svelte-6ki7lf{margin:0 0 var(--smrt-spacing-md,1rem);gap:var(--smrt-spacing-md,1rem);border:0;flex-direction:column;padding:0;display:flex}.smrt-edit-form__group.svelte-6ki7lf legend:where(.svelte-6ki7lf){font-weight:var(--smrt-typography-weight-semibold,600);margin-bottom:var(--smrt-spacing-sm,.5rem)}.smrt-edit-form__check.svelte-6ki7lf{gap:var(--smrt-spacing-xs,.25rem);flex-direction:column;display:flex}.smrt-edit-form__hint.svelte-6ki7lf{color:var(--smrt-color-on-surface-variant)}.smrt-edit-form__error.svelte-6ki7lf{color:var(--smrt-color-error)}.smrt-record-header.svelte-uiz8xl{gap:var(--smrt-spacing-2);justify-items:start;display:grid}.smrt-record-header__row.svelte-uiz8xl{justify-content:space-between;align-items:center;gap:var(--smrt-spacing-3);flex-wrap:wrap;inline-size:100%;display:flex}.smrt-record-header__identity.svelte-uiz8xl{align-items:center;gap:var(--smrt-spacing-2) var(--smrt-spacing-3);flex-wrap:wrap;min-inline-size:0;display:flex}.smrt-record-header__title.svelte-uiz8xl{font-size:var(--smrt-typography-headline-small-size,1.5rem);font-weight:var(--smrt-typography-weight-semibold);overflow-wrap:anywhere;margin:0}.smrt-record-header__id.svelte-uiz8xl{font-family:var(--smrt-font-family-mono)}.smrt-record-header__id--chip.svelte-uiz8xl{padding:0 var(--smrt-spacing-2);border-radius:var(--smrt-radius-sm);background:var(--smrt-color-surface-container);color:var(--smrt-color-on-surface-variant)}.smrt-record-header__actions.svelte-uiz8xl{align-items:center;gap:var(--smrt-spacing-2);display:flex}.smrt-record-header__menu.svelte-uiz8xl{gap:var(--smrt-spacing-2);padding:var(--smrt-spacing-2);min-inline-size:10rem;display:grid}.smrt-record-header__facts.svelte-uiz8xl{gap:var(--smrt-spacing-2) var(--smrt-spacing-6);flex-wrap:wrap;margin:0;display:flex}.smrt-record-header__fact.svelte-uiz8xl{gap:0;display:grid}.smrt-record-header__fact.svelte-uiz8xl dt:where(.svelte-uiz8xl){color:var(--smrt-color-on-surface-variant);font-size:var(--smrt-typography-body-small-size,.75rem)}.smrt-record-header__fact.svelte-uiz8xl dd:where(.svelte-uiz8xl){font-variant-numeric:tabular-nums;margin:0}.smrt-record-header__sr.svelte-uiz8xl{clip-path:inset(50%);white-space:nowrap;block-size:1px;inline-size:1px;position:absolute;overflow:hidden}@media (width<=47.99rem){.smrt-record-header__actions.svelte-uiz8xl{inline-size:100%}.smrt-record-header__actions.svelte-uiz8xl>:first-child{flex:1}}.smrt-record-screen.svelte-1ijjiku{gap:var(--smrt-spacing-lg,1.5rem);grid-template-columns:minmax(0,1fr);align-items:start;display:grid}.smrt-record-screen__main.svelte-1ijjiku{gap:var(--smrt-spacing-lg,1.5rem);flex-direction:column;min-inline-size:0;display:flex}.smrt-record-screen__related.svelte-1ijjiku{min-inline-size:0}.smrt-record-screen__widget-heading.svelte-1ijjiku{justify-content:space-between;align-items:baseline;gap:var(--smrt-spacing-sm,.5rem);flex-wrap:wrap;display:flex}.smrt-record-screen__count.svelte-1ijjiku{color:var(--smrt-color-on-surface-variant);font-variant-numeric:tabular-nums}.smrt-record-screen__view-all.svelte-1ijjiku{font-size:var(--smrt-typography-body-medium-size,.875rem);font-weight:var(--smrt-typography-weight-normal,400)}.smrt-record-screen__aside.svelte-1ijjiku{gap:var(--smrt-spacing-md,1rem);padding:var(--smrt-spacing-md,1rem);border:var(--smrt-hairline);border-radius:var(--smrt-radius-lg);background:var(--smrt-color-surface-container-low,var(--smrt-color-surface));animation:svelte-1ijjiku-smrt-record-screen-in var(--smrt-duration-medium1) var(--smrt-easing-standard) both;flex-direction:column;display:flex}.smrt-record-screen__items.svelte-1ijjiku{min-inline-size:0}.smrt-record-screen__aside-title.svelte-1ijjiku{font-size:var(--smrt-typography-title-medium-size,1rem);margin:0}@media (width>=48rem){.smrt-record-screen--edit.svelte-1ijjiku{grid-template-columns:minmax(0,1fr) minmax(20rem,28rem)}.smrt-record-screen__aside.svelte-1ijjiku{position:sticky;inset-block-start:var(--smrt-spacing-md,1rem)}}.smrt-record-screen__sheet.svelte-1ijjiku{z-index:var(--smrt-z-index-modal);pointer-events:none;position:fixed;inset:0}.smrt-record-screen__sheet.svelte-1ijjiku>*{pointer-events:auto}.smrt-record-screen__sheet-body.svelte-1ijjiku{padding:var(--smrt-spacing-md,1rem)}@keyframes svelte-1ijjiku-smrt-record-screen-in{0%{opacity:0;transform:translateX(var(--smrt-spacing-md,1rem))}to{opacity:1;transform:none}}@media (prefers-reduced-motion:reduce){.smrt-record-screen__aside.svelte-1ijjiku{animation:none}}}
@@ -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"./C_3CJO_1.js";import"./xihTtKlq.js";import{i as J,r as Y}from"./Bv5jGtB8.js";import{a as X,t as te}from"./YUSKx8_q.js";import{C as ne,G as re,H as ie,J as ae,K as oe,_ as se,a as ce,c as le,d as ue,dt as de,f as fe,ft as pe,g as me,h as he,lt as ge,nt as _e,p as ve,q as ye,t as be,u as xe,v as Se,z as Ce}from"./BG9Gz_25.js";import{n as Z}from"./DK8Blf1Y.js";import{t as we}from"./M-CuJzQN.js";import"./DuZeZzOA.js";import{u as Te}from"./9pRTae44.js";import{l as Ee,n as De,r as Oe,s as ke,u as Ae,v as je,y as Me}from"./gMSmS-_y.js";import"./d_dqmeIr.js";import{t as Ne}from"./BiEOJeYb.js";import{a as Pe,f as Fe,m as Ie,n as Le,r as Re,t as ze,u as Be}from"./CyUSxz1P.js";import{C as Ve,D as He,E as Ue,M as We,N as Ge,P as Ke,S as qe,T as Je,j as Ye,k as Xe,n as Ze,v as Qe,w as $e,x as et,y as tt}from"./O8DAZ_le.js";import{H as nt,K as rt,U as it,V as at,W as ot,Y as st,Z as ct,b as lt,g as ut,h as dt,j as ft,t as pt,v as mt,x as ht}from"./CtjBwCj8.js";import{r as gt}from"./D_U_DYjx.js";import{t as _t}from"./C1VofLtR.js";import{a as vt,d as yt,i as bt,l as xt,o as St,p as Ct,r as wt,s as Tt,u as Et}from"./C3sRGrYK.js";import{a as Dt,d as Ot,f as kt,i as At,l as jt,o as Mt,p as Nt,r as Pt,s as Ft,u as It}from"./CTlMHIE6.js";import{n as Lt}from"./CgAkqYsL.js";import{a as Rt,c as zt,d as Bt,f as Vt,h as Ht,i as Ut,l as Wt,m as Gt,n as Kt,o as qt,p as Jt,r as Yt,s as Xt,t as Zt,u as Qt}from"./YGONf0jr.js";import{t as $t}from"./JBD5vUbP.js";import{n as en}from"./D71UrO5c.js";function tn(e,t){return{key:t,direction:e?.key===t&&e.direction===`ascending`?`descending`:`ascending`}}var nn=new Intl.Collator(void 0,{numeric:!0,sensitivity:`base`});function rn(e){return e==null||e===``||typeof e==`number`&&!Number.isFinite(e)}function an(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:nn.compare(String(n),String(r))}function on(e,t,n){return t?e.map((e,r)=>({row:e,index:r,value:n(e,t.key)})).sort((e,n)=>{let r=rn(e.value);if(r!==rn(n.value))return r?1:-1;let i=r?0:an(e.value,n.value);return(t.direction===`ascending`?i:-i)||e.index-n.index}).map(({row:e})=>e):[...e]}var sn={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
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"./D31rqKs1.js";import"./xihTtKlq.js";import{i as J,r as Y}from"./Bv5jGtB8.js";import{a as X,t as te}from"./YUSKx8_q.js";import{C as ne,G as re,H as ie,J as ae,K as oe,_ as se,a as ce,c as le,d as ue,dt as de,f as fe,ft as pe,g as me,h as he,lt as ge,nt as _e,p as ve,q as ye,t as be,u as xe,v as Se,z as Ce}from"./CoXf-L_3.js";import{n as Z}from"./DK8Blf1Y.js";import{t as we}from"./M-CuJzQN.js";import"./D2Ykv2Y3.js";import{u as Te}from"./DIE02RSm.js";import{l as Ee,n as De,r as Oe,s as ke,u as Ae,v as je,y as Me}from"./gMSmS-_y.js";import"./DzRTyOpH.js";import{t as Ne}from"./D8rEUyzO.js";import{a as Pe,f as Fe,m as Ie,n as Le,r as Re,t as ze,u as Be}from"./CXKa_xdk.js";import{C as Ve,D as He,E as Ue,M as We,N as Ge,P as Ke,S as qe,T as Je,j as Ye,k as Xe,n as Ze,v as Qe,w as $e,x as et,y as tt}from"./C3nKLKKd.js";import{H as nt,K as rt,U as it,V as at,W as ot,Y as st,Z as ct,b as lt,g as ut,h as dt,j as ft,t as pt,v as mt,x as ht}from"./B7d7dGCP.js";import{r as gt}from"./D_U_DYjx.js";import{t as _t}from"./BPsie9Wr.js";import{a as vt,d as yt,i as bt,l as xt,o as St,p as Ct,r as wt,s as Tt,u as Et}from"./Dyf3Cj8R.js";import{a as Dt,d as Ot,f as kt,i as At,l as jt,o as Mt,p as Nt,r as Pt,s as Ft,u as It}from"./exPME6UK.js";import{n as Lt}from"./CgAkqYsL.js";import{a as Rt,c as zt,d as Bt,f as Vt,h as Ht,i as Ut,l as Wt,m as Gt,n as Kt,o as qt,p as Jt,r as Yt,s as Xt,t as Zt,u as Qt}from"./PsiVGwJV.js";import{t as $t}from"./JBD5vUbP.js";import{n as en}from"./D71UrO5c.js";function tn(e,t){return{key:t,direction:e?.key===t&&e.direction===`ascending`?`descending`:`ascending`}}var nn=new Intl.Collator(void 0,{numeric:!0,sensitivity:`base`});function rn(e){return e==null||e===``||typeof e==`number`&&!Number.isFinite(e)}function an(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:nn.compare(String(n),String(r))}function on(e,t,n){return t?e.map((e,r)=>({row:e,index:r,value:n(e,t.key)})).sort((e,n)=>{let r=rn(e.value);if(r!==rn(n.value))return r?1:-1;let i=r?0:an(e.value,n.value);return(t.direction===`ascending`?i:-i)||e.index-n.index}).map(({row:e})=>e):[...e]}var sn={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,B as t,Ct as n,Dt as r,E as i,Et as a,F as o,Ft as s,G as c,H as l,K as u,L as d,Lt as f,Ot as p,Pt as m,U as h,W as g,X as _,Y as v,a as y,bt as b,ct as ee,d as x,ft as S,gt as C,ht as w,k as te,mt as T,pt as E,q as ne,st as D,v as O,vt as k}from"./DG3qFFTE.js";import"./xihTtKlq.js";import{a as re}from"./Bv5jGtB8.js";import"./YUSKx8_q.js";import{ft as A,lt as ie,p as j,u as M,ut as N}from"./BG9Gz_25.js";import"./DK8Blf1Y.js";import"./M-CuJzQN.js";import"./Cga8zF3r.js";v([`click`]),v([`click`,`keydown`]),v([`click`]);var P=new Map(Object.entries({menu:`M3 18h18v-2H3v2zm0-5h18v-2H3v2zm0-7v2h18V6H3z`,search:`M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z`,close:`M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z`,"chevron-right":`M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6-6-6z`,"chevron-left":`M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12l4.58-4.59z`,"chevron-down":`M7.41 8.59L12 13.17l4.59-4.58L18 10l-6 6-6-6 1.41-1.41z`,check:`M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41L9 16.17z`,add:`M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z`,mic:`M12 14c1.66 0 3-1.34 3-3V5c0-1.66-1.34-3-3-3S9 3.34 9 5v6c0 1.66 1.34 3 3 3z M17 11c0 2.76-2.24 5-5 5s-5-2.24-5-5H5c0 3.53 2.04 6.43 5 7.07V21h4v-2.93c2.96-.64 5-3.54 5-7.07h-2z`,alert:`M12 2a10 10 0 1 0 0 20 10 10 0 0 0 0-20zm-1 5h2v6h-2zm0 8h2v2h-2z`,warning:`M1 21h22L12 2 1 21zm12-3h-2v-2h2zm0-4h-2v-4h2z`,info:`M12 2a10 10 0 1 0 0 20 10 10 0 0 0 0-20zm1 15h-2v-6h2zm0-8h-2V7h2z`,home:`M3 10 12 2 21 10v11h-6v-7H9v7H3z`,user:`M12 3a4 4 0 1 0 0 8 4 4 0 0 0 0-8zM4 21v-2c0-4 16-4 16 0v2H4z`,settings:`M10 2h4l1 3 3-1 3 3-1 3 3 1v4l-3 1 1 3-3 3-3-1-1 3h-4l-1-3-3 1-3-3 1-3-3-1v-4l3-1-1-3 3-3 3 1 1-3zm2 6a4 4 0 1 0 0 8 4 4 0 0 0 0-8z`,trash:`M7 3h10v2h4v2H3V5h4V3zm-2 6h14v12H5V9zm4 2v8h2v-8H9zm4 0v8h2v-8h-2z`,edit:`M3 17.25V21h3.75L17.81 9.94l-3.75-3.75L3 17.25zM20.71 7.04a1 1 0 0 0 0-1.41l-2.34-2.34a1 1 0 0 0-1.41 0l-1.83 1.83 3.75 3.75 1.83-1.83z`,calendar:`M7 2h2v2h6V2h2v2h4v18H3V4h4V2zm-2 8v10h14V10H5zm2 2h4v4H7v-4z`,clock:`M12 2a10 10 0 1 0 0 20 10 10 0 0 0 0-20zm0 2a8 8 0 1 1 0 16 8 8 0 0 1 0-16zm-1 2h2v5.5l4 2.5-1 1.5-5-3V6z`,camera:`M9 3h6l2 3h4v15H3V6h4l2-3zm3 5a5 5 0 1 0 0 10 5 5 0 0 0 0-10zm0 2a3 3 0 1 1 0 6 3 3 0 0 1 0-6z`,upload:`M11 16V7l-4 4-1.5-1.5L12 3l6.5 6.5L17 11l-4-4v9h-2zM3 18h18v3H3v-3z`,download:`M11 3h2v9l4-4 1.5 1.5L12 16l-6.5-6.5L7 8l4 4V3zM3 18h18v3H3v-3z`})),F=b([]);function I(t){for(let n=e(F).length-1;n>=0;n--){let r=e(F)[n].paths.get(t);if(r!==void 0)return r}return P.get(t)}var L=u(`<svg xmlns="http://www.w3.org/2000/svg" data-smrt-component="Icon" class="svelte-em2a54"><path></path></svg>`);function R(t,i){p(i,!0);let a=y(i,`size`,3,24),o=y(i,`color`,3,`currentColor`),s=y(i,`viewBox`,3,`0 0 24 24`),c=n(()=>!!i[`aria-label`]),l=n(()=>i.path??(i.name?I(i.name):``)),u=n(()=>typeof a()==`number`?`${a()}px`:a());var d=L(),f=T(d);D(()=>{O(d,`width`,e(u)),O(d,`height`,e(u)),O(d,`viewBox`,s()),O(d,`fill`,o()),O(d,`aria-hidden`,!e(c)),O(d,`aria-label`,i[`aria-label`]),O(d,`role`,e(c)?`img`:void 0),O(f,`d`,e(l))}),h(t,d),r()}v([`click`]);var z=Symbol.for(`smrt-ui.page-header`);function ae(){return a(z)??null}var oe=c(`<li class="svelte-1f2td7n"><a class="svelte-1f2td7n"> </a></li>`),B=c(`<nav class="page-crumbs svelte-1f2td7n" data-shell-breadcrumbs=""><ol class="svelte-1f2td7n"></ol></nav>`),se=c(`<a class="back-link svelte-1f2td7n"><!> <span> </span></a>`),ce=c(`<h1 class="page-title page-title-field svelte-1f2td7n" data-page-title-field=""><!></h1>`),le=c(`<h1 class="page-title svelte-1f2td7n" data-shell-page-title=""> </h1>`),ue=c(`<p class="page-subtitle svelte-1f2td7n"> </p>`),de=c(`<div class="page-meta svelte-1f2td7n"><!></div>`),fe=c(`<div class="header-actions svelte-1f2td7n"><!></div>`),pe=c(`<div class="header-extra svelte-1f2td7n" data-page-header-extra=""><!></div>`),me=c(`<header class="page-header svelte-1f2td7n" data-page-header="" data-smrt-component="PageHeader"><!> <div class="header-main svelte-1f2td7n"><div class="header-content svelte-1f2td7n"><!> <!> <!> <!></div> <!></div> <!></header>`);function he(i,a){p(a,!0);let c=y(a,`parents`,19,()=>[]),u=y(a,`crumbsLabel`,3,`Breadcrumb`),f=y(a,`backLabel`,3,`Back`),m=ae(),g=n(()=>a.crumbs??(m?m.crumbs(c()):c()));ee(()=>m?.report?.({title:a.shortTitle??a.title,parents:c()}));var _=me(),v=S(_),b=t=>{var n=B(),r=S(n);d(r,23,()=>e(g),(e,t)=>`${t}:${e.href}`,(t,n)=>{var r=oe(),i=S(r),a=T(i,!0);s(r),D(()=>{O(i,`href`,e(n).href),l(a,e(n).label)}),h(t,r)}),s(r),s(n),D(()=>O(n,`aria-label`,u())),h(t,n)};t(v,t=>{e(g).length>0&&t(b)});var x=w(v,2),C=S(x),E=S(C),ne=e=>{var t=se(),n=S(t);R(n,{name:`chevron-left`,size:20});var r=w(n,2),i=T(r,!0);s(t),te(t,e=>re?.(e)),D(()=>{O(t,`href`,a.backHref),l(i,f())}),h(e,t)};t(E,e=>{a.backHref&&e(ne)});var k=w(E,2),A=e=>{var t=ce(),n=S(t);o(n,()=>a.titleField),s(t),h(e,t)},ie=e=>{var t=le(),n=T(t,!0);D(()=>l(n,a.title)),h(e,t)};t(k,e=>{a.titleField?e(A):e(ie,-1)});var j=w(k,2),M=e=>{var t=ue(),n=T(t,!0);D(()=>l(n,a.subtitle)),h(e,t)};t(j,e=>{a.subtitle&&e(M)});var N=w(j,2),P=e=>{var t=de(),n=S(t);o(n,()=>a.meta),s(t),h(e,t)};t(N,e=>{a.meta&&e(P)}),s(C);var F=w(C,2),I=e=>{var t=fe(),n=S(t);o(n,()=>a.actions),s(t),h(e,t)};t(F,e=>{a.actions&&e(I)}),s(x);var L=w(x,2),z=e=>{var t=pe(),n=S(t);o(n,()=>a.children),s(t),h(e,t)};t(L,e=>{a.children&&e(z)}),s(_),h(i,_),r()}v([`click`]),v([`click`]);function ge(e,t,n){if(!n||n<1||e.length<=n)return{visible:[...e],overflow:[]};let r=e.slice(0,n-1),i=e.slice(n-1),a=i.find(e=>e.id===t)??i[0];return{visible:a?[...r,a]:r,overflow:i.filter(e=>e!==a)}}var _e=c(`<span class="smrt-tabs__tab-count svelte-19k21oo" data-smrt-part="count"> </span>`),ve=c(`<span class="smrt-tabs__tab-badge svelte-19k21oo" data-smrt-part="badge"> </span>`),ye=c(`<a data-smrt-part="tab"><span data-smrt-part="label"> </span> <!> <!></a>`),be=c(`<span class="smrt-tabs__tab-dot svelte-19k21oo" data-smrt-part="marker" aria-hidden="true"></span> <span class="smrt-tabs__visually-hidden svelte-19k21oo" data-smrt-part="description"> </span>`,1),xe=c(`<details class="smrt-tabs__more svelte-19k21oo" data-smrt-part="overflow"><summary class="smrt-tabs__tab-link svelte-19k21oo" data-smrt-part="trigger"><span data-smrt-part="label"> </span> <!></summary> <div class="smrt-tabs__more-menu svelte-19k21oo" data-smrt-part="menu"></div></details>`),Se=c(`<div class="smrt-tabs__tab-panel svelte-19k21oo" data-smrt-part="panel"><!></div>`),Ce=c(`<div class="smrt-tabs__container svelte-19k21oo" data-smrt-component="Tabs"><nav data-smrt-part="list" data-shell-tabs=""><div class="smrt-tabs__links-row svelte-19k21oo" data-smrt-part="row"></div> <!></nav> <!></div>`),we=c(`<button type="button" data-smrt-part="tab" role="tab"><span class="smrt-tabs__tab-content-wrapper svelte-19k21oo" data-smrt-part="body"><span data-smrt-part="label"> </span> <!> <!></span> <div class="smrt-tabs__active-indicator svelte-19k21oo" data-smrt-part="indicator"></div></button>`),Te=c(`<div class="smrt-tabs__tab-panel svelte-19k21oo" data-smrt-part="panel" role="tabpanel"><!></div>`),Ee=c(`<div class="smrt-tabs__container svelte-19k21oo" data-smrt-component="Tabs"><div data-smrt-part="list" role="tablist"></div> <!></div>`);function De(a,c){let u=ne();p(c,!0);let v=(r,a=f)=>{var o=ye();let u;var d=S(o),p=T(d,!0),m=w(d,2),g=e=>{var t=_e(),n=T(t,!0);D(()=>l(n,a().count)),h(e,t)};t(m,e=>{a().count!==void 0&&e(g)});var v=w(m,2),y=e=>{var t=ve(),n=T(t,!0);D(()=>l(n,a().badge)),h(e,t)},b=n(()=>L(a()));t(v,t=>{e(b)&&t(y)}),s(o),D(()=>{u=i(o,1,`smrt-tabs__tab-link svelte-19k21oo`,null,u,{"smrt-tabs__active":a().id===c.active}),O(o,`href`,a().disabled?void 0:a().href),O(o,`aria-current`,a().id===c.active?`page`:void 0),O(o,`aria-disabled`,a().disabled?`true`:void 0),O(o,`data-tab-id`,a().id),l(p,a().label)}),_(`click`,o,e=>{a().disabled?e.preventDefault():ae(a().id)}),h(r,o)},C=y(c,`size`,3,`md`),A=y(c,`variant`,3,`primary`),ie=y(c,`moreLabel`,3,`More`),j=y(c,`moreBadgeLabel`,3,`has updates`),M=n(()=>c.tabs.length>0&&c.tabs.every(e=>!!e.href)),N=n(()=>e(M)?ge(c.tabs,c.active,c.maxVisible):{visible:c.tabs,overflow:[]}),P=n(()=>e(N).overflow.some(e=>L(e))),F=b(null),I=b(null);ee(()=>{let t=c.active;e(M)&&e(I)&&(e(F)&&(e(F).open=!1),e(I).querySelector(`[data-tab-id="${CSS.escape(t)}"]`)?.scrollIntoView?.({block:`nearest`,inline:`nearest`}))});function L(e){return e.badge!==void 0&&e.badge!==null&&e.badge!==``}let R=n(()=>c.tabs.filter(e=>!e.disabled)),z=b(null);function ae(e){c.tabs.find(t=>t.id===e)?.disabled||e!==c.active&&c.onchange?.(e)}function oe(t,n){let r=e(R).findIndex(e=>e.id===n),i=null;switch(t.key){case`ArrowRight`:t.preventDefault(),i=(r+1)%e(R).length;break;case`ArrowLeft`:t.preventDefault(),i=(r-1+e(R).length)%e(R).length;break;case`Home`:t.preventDefault(),i=0;break;case`End`:t.preventDefault(),i=e(R).length-1}if(i!==null&&i!==r){let t=e(R)[i];t&&(c.onchange?.(t.id),requestAnimationFrame(()=>{(e(z)?.querySelector(`[data-tab-id="${CSS.escape(t.id)}"]`))?.focus()}))}}var B=g(),se=E(B),ce=n=>{var r=Ce(),a=S(r);let u;var f=S(a);d(f,21,()=>e(N).visible,e=>e.id,(t,n)=>{v(t,()=>e(n))}),s(f),x(f,e=>k(I,e),()=>e(I));var p=w(f,2),m=n=>{var r=xe(),i=S(r),a=S(i),o=T(a,!0),c=w(a,2),u=e=>{var t=be(),n=w(E(t),2),r=T(n);D(()=>l(r,`(${j()??``})`)),h(e,t)};t(c,t=>{e(P)&&t(u)}),s(i);var f=w(i,2);d(f,21,()=>e(N).overflow,e=>e.id,(t,n)=>{v(t,()=>e(n))}),s(f),s(r),x(r,e=>k(F,e),()=>e(F)),D(()=>l(o,ie())),h(n,r)};t(p,t=>{e(N).overflow.length>0&&t(m)}),s(a);var g=w(a,2),_=e=>{var t=Se(),n=S(t);o(n,()=>c.children),s(t),h(e,t)};t(g,e=>{c.children&&e(_)}),s(r),D(()=>{u=i(a,1,`smrt-tabs__links svelte-19k21oo`,null,u,{"smrt-tabs__sm":C()===`sm`,"smrt-tabs__lg":C()===`lg`}),O(a,`aria-label`,c[`aria-label`])}),h(n,r)},le=r=>{var a=Ee(),f=S(a);let p;d(f,21,()=>c.tabs,e=>e.id,(r,a)=>{var o=we();let d;var f=S(o),p=S(f),g=T(p,!0),v=w(p,2),y=t=>{var n=_e(),r=T(n,!0);D(()=>l(r,e(a).count)),h(t,n)};t(v,t=>{e(a).count!==void 0&&t(y)});var b=w(v,2),ee=t=>{var n=ve(),r=T(n,!0);D(()=>l(r,e(a).badge)),h(t,n)},x=n(()=>L(e(a)));t(b,t=>{e(x)&&t(ee)}),s(f),m(2),s(o),te(o,e=>re?.(e)),D(()=>{d=i(o,1,`smrt-tabs__tab-button svelte-19k21oo`,null,d,{"smrt-tabs__active":e(a).id===c.active}),o.disabled=e(a).disabled,O(o,`id`,`tab-${u}-${e(a).id??``}`),O(o,`aria-selected`,e(a).id===c.active),O(o,`aria-controls`,`tab-panel-${u}`),O(o,`tabindex`,e(a).id===c.active?0:-1),O(o,`data-tab-id`,e(a).id),l(g,e(a).label)}),_(`click`,o,()=>ae(e(a).id)),_(`keydown`,o,t=>oe(t,e(a).id)),h(r,o)}),s(f),x(f,e=>k(z,e),()=>e(z));var g=w(f,2),v=e=>{var t=Te(),n=S(t);o(n,()=>c.children),s(t),D(()=>{O(t,`id`,`tab-panel-${u}`),O(t,`aria-labelledby`,`tab-${u}-${c.active??``}`)}),h(e,t)};t(g,e=>{c.children&&e(v)}),s(a),D(()=>{p=i(f,1,`smrt-tabs__nav svelte-19k21oo`,null,p,{"smrt-tabs__sm":C()===`sm`,"smrt-tabs__lg":C()===`lg`,"smrt-tabs__secondary":A()===`secondary`}),O(f,`aria-label`,c[`aria-label`])}),h(r,a)};t(se,t=>{e(M)?t(ce):t(le,-1)}),h(a,B),r()}v([`click`,`keydown`]),v([`click`,`keydown`]);function Oe(){let e=new Map,t=new Map,n=(e,t)=>`${e}:${t}`;return{register(t,r,i){e.set(n(t,r),i)},get(t,r){return e.get(n(t,r))},has(t,r){return e.has(n(t,r))},getSlots(t){let n=`${t}:`;return Array.from(e.keys()).filter(e=>e.startsWith(n)).map(e=>e.slice(n.length))},getModules(){return Array.from(t.keys())},getModuleMeta(e){return t.get(e)},registerModule(e){t.set(e.name,e)},unregister(t,r){return e.delete(n(t,r))},clear(){e.clear(),t.clear()}}}var ke=Oe(),Ae=[`SmrtJunction`,`SmrtJunctionBase`,`SmrtPolymorphicAssociation`],je=[`Metafield`,`Metadata`,`Association`,`LineItem`,`Allocation`,`Revision`,`Attachment`,`Snapshot`,`Completion`,`Override`,`Alias`],Me=[`Status`,`Type`],Ne={"@happyvertical/smrt-commerce:TaxComponent":`lookup`,"@happyvertical/smrt-commerce:TaxSettings":`settings`,"@happyvertical/smrt-commerce:DocumentTax":`snapshot`,"@happyvertical/smrt-commerce:TaxSummaryReport":`report`},V=new Set([`foreignKey`,`crossPackageRef`]);function Pe(e){let t=e.id?Ne[e.id]:void 0;if(t)return t;let n=e.extends?.split(`:`).pop();if(n&&Ae.includes(n))return`junction`;let r=e.fields.filter(e=>!e.system),i=r.filter(e=>V.has(e.type)).length;return i>=2&&r.length-i<=1?`link`:je.some(t=>e.name.endsWith(t))?`child`:r.length<=3&&Me.some(t=>e.name.endsWith(t))?`lookup`:null}function Fe(e){return Pe(e)!==null}var Ie=new Set([`junction`,`link`,`child`]);function H(e,t){return e.includes(`:`)?e:`${t.slice(0,t.lastIndexOf(`:`))}:${e}`}function U(e,t){let n=[],r=e.get(t);for(;r&&!n.includes(r.id);)n.push(r.id),r=r.extends?e.get(H(r.extends,r.id)):void 0;return n}function Le(e,t){let n=e.packages.flatMap(e=>e.models),r=new Map(n.map(e=>[e.id,e])),i=new Set(U(r,t));return i.size?n.filter(e=>{if(i.has(e.id))return!1;let t=Pe(e);return!t||!Ie.has(t)?!1:e.fields.some(t=>V.has(t.type)&&t.related&&i.has(H(t.related,e.id)))}):[]}function Re(e,t){let n=e.fields.find(n=>V.has(n.type)&&n.related&&t.has(H(n.related,e.id)));return n?{model:e,fk:n.name}:void 0}function ze(e,t,n){let r=e.packages.flatMap(e=>e.models),i=new Map(r.map(e=>[e.id,e])),a=new Set(U(i,n));if(!a.size)return[];let o=t.filter(e=>e.models.includes(n));if(!o.length)return Le(e,n).flatMap(e=>{let t=Re(e,a);return t?[t]:[]});let s=new Map;for(let e of o){let t=new Set(e.nav.map(e=>e.model));for(let n of e.models){let e=i.get(n);if(!e||t.has(n)||a.has(n)||s.has(n))continue;let r=Re(e,a);r&&s.set(n,r)}}return[...s.values()]}function Be(e,t){let n=e.packages.flatMap(e=>e.models),r=new Map(n.map(e=>[e.id,e])),i=new Set(U(r,t));if(!i.size)return[];let a=[];for(let e of n)if(!i.has(e.id))for(let t of e.fields)V.has(t.type)&&t.related&&i.has(H(t.related,e.id))&&a.push({model:e,fk:t.name});return a}function Ve(e,t){let n=e.packages.flatMap(e=>e.models),r=new Map(n.map(e=>[e.id,e])),i=r.get(t);return i?i.fields.flatMap(e=>{if(!V.has(e.type)||!e.related)return[];let t=r.get(H(e.related,i.id));return t?[{model:t,fk:e.name}]:[]}):[]}function He(e,t){return e.some(e=>e.nav.some(e=>e.model===t))}function Ue(e,t){let n=e;for(let e of t)if(n.length>e.length&&n.startsWith(e)){n=n.slice(e.length);break}let r=n.replace(/([a-z0-9])([A-Z])/g,`$1 $2`).toLowerCase(),i=/[^aeiou]y$/.test(r)?`${r.slice(0,-1)}ies`:/(s|x|ch|sh)$/.test(r)?`${r}es`:`${r}s`;return i.charAt(0).toUpperCase()+i.slice(1)}function We(e,t){let n=e.packages.flatMap(e=>e.models),r=new Map(n.map(e=>[e.id,e]));return U(r,t).flatMap(e=>{let t=r.get(e);return t?[t.name]:[]})}function Ge(e,t,n){let r=We(e,t);return Le(e,t).filter(e=>n(e)&&r.some(t=>e.name.startsWith(t)))}function W(e){return e.group?.id??e.id}function Ke(e){let t=new Map;for(let n of e){let e=W(n),r=t.get(e);r?r.recipes.push(n):t.set(e,{id:e,label:n.group?.label??n.label,recipes:[n]})}return[...t.values()]}function G(e){return e.section??{id:W(e),label:e.group?.label??e.label}}function qe(e){let t=new Map;for(let n of e){let e=G(n),r=t.get(e.id);r?r.recipes.push(n):t.set(e.id,{...e,recipes:[n]})}return[...t.values()]}function Je(e){let t=new Set(e.map(e=>G(e).id)),n={};for(let r of e){let e=W(r),i=G(r).id;e!==i&&!t.has(e)&&(n[e]=i)}return n}function Ye(e,t,n){return`item:${e}:${t}${n?`:${n}`:``}`}function Xe(e,t){return e?.trim()||t.description?.trim()||`Your ${Ze(t.name)} records, all in one place.`}function Ze(e){return e.replace(/([a-z0-9])([A-Z])/g,`$1 $2`).toLowerCase()}var Qe={id:`more`,label:`More`,icon:`layers`,description:`Extra records you added one at a time.`},$e=`fileText`;function et(e){let t=e.description?.trim();if(t)return t.split(/(?<=[.!?])\s/)[0]??t;let n=e.fields.filter(e=>!e.system).length;return`${n} ${n===1?`field`:`fields`}`}function tt(e,t){let n=new Set(t.flatMap(e=>e.models));return e.packages.flatMap(t=>N(t).filter(e=>!n.has(e.id)).map(n=>({id:n.id,name:n.name,label:j(n.name),packageId:t.id,description:et(n),described:!!n.description?.trim(),plumbing:Fe(n),fieldNames:n.fields.map(e=>e.name),includes:Le(e,n.id).map(e=>j(e.name))})))}function nt(e){return e.described?e.description:`${j(e.packageId)} · ${e.description}`}function rt(e,t){return t?[...e]:e.filter(e=>!e.plumbing)}function it(e){return[...new Set(e.map(e=>e.packageId))]}function at(e,t,n){let r=t.toLowerCase().split(/\s+/).filter(Boolean);return e.filter(e=>{if(n&&e.packageId!==n)return!1;if(!r.length)return!0;let t=[e.name,e.label,e.description,e.packageId,...e.fieldNames].join(` `).toLowerCase();return r.every(e=>t.includes(e))})}function ot(e){return e.flatMap(e=>{let t=A(e);return t?.model.exposed?[{id:Ye(t.pkg.id,t.model.name),packageId:t.pkg.id,modelName:t.model.name,label:j(t.model.name),icon:$e,description:Xe(void 0,t.model)}]:[]})}var st={"@happyvertical/smrt-commerce:Customer":{profileId:`Links this customer to their profile record, where their name and contact details are kept.`,creditLimit:`The most this customer may owe you at one time. Leave it empty or at zero if you do not set limits.`,paymentTerms:`How long the customer has to pay, written the way you would say it, for example "Net 30".`,taxExempt:`Turn this on if you do not charge this customer sales tax.`,taxId:`The customer's tax or VAT number, kept on file for tax-exempt sales.`,defaultShippingAddress:`Where you usually send this customer's goods, so you do not retype it on every order.`,defaultBillingAddress:`Where you send this customer's invoices.`,status:`Whether this is a current customer, for example active or inactive.`,customerType:`The kind of customer, for example an individual or a business.`,notes:`Anything worth remembering about this customer.`},"@happyvertical/smrt-commerce:Vendor":{profileId:`Links this vendor to their profile record, where their name and contact details are kept.`,leadTimeDays:`How many days the vendor usually takes between your order and delivery.`,minimumOrderAmount:`The smallest order the vendor will accept.`,paymentTerms:`How long you have to pay this vendor, written the way you would say it, for example "Net 30".`,currency:`The currency this vendor bills you in.`,defaultContactEmail:`The email address you normally use to reach this vendor.`,defaultContactPhone:`The phone number you normally use to reach this vendor.`,status:`Whether you still buy from this vendor, for example active or inactive.`,notes:`Anything worth remembering about this vendor.`,payoutAddresses:`Where payments to this vendor should be sent.`},"@happyvertical/smrt-commerce:Order":{status:`Where the order stands, for example draft, accepted or completed.`,customerId:`The customer this order is for.`,subtotal:`The order amount before tax.`,taxAmount:`The tax charged on the order.`,totalAmount:`What the customer pays in all, tax included.`,currency:`The currency of the order's amounts.`,issueDate:`The date the order was placed.`,dueDate:`The date payment is expected. An order still open after this date counts as overdue.`,expiryDate:`The last day the order's price or offer is good for.`,reference:`Your own number or note for finding this order later, such as the customer's purchase order number.`,notes:`Anything worth remembering about this order.`,terms:`The conditions agreed with the customer, such as deposits, delivery or payment conditions.`,channelId:`Where the order came from, for example your shop or a marketplace.`},"@happyvertical/smrt-commerce:PurchaseOrder":{status:`Where the purchase stands, for example draft, accepted or completed.`,vendorId:`The vendor you are buying from.`,subtotal:`The order amount before tax.`,taxAmount:`The tax charged on the order.`,totalAmount:`What you pay in all, tax included.`,currency:`The currency of the order's amounts.`,issueDate:`The date you placed the order.`,dueDate:`The date the goods or the payment are due.`,expiryDate:`The last day the vendor's offer is good for.`,reference:`Your own number or note for finding this order later, such as the vendor's quote number.`,notes:`Anything worth remembering about this purchase.`,terms:`The conditions agreed with the vendor, such as payment or delivery conditions.`,channelId:`Where the order was placed, for example a vendor's website or a phone call.`},"@happyvertical/smrt-products:Product":{name:`What you call the product, as customers will see it.`,price:`What one costs, in dollars and cents.`,description:`A few words on what the product is and who it is for.`},"@happyvertical/smrt-products:ProductVariant":{productId:`The product this choice belongs to. Set for you when you save the product.`,axisName:`What the product varies by, for example size or color.`,allowedValues:`The values on offer for it, for example S, M and L.`},"@happyvertical/smrt-products:Sku":{productId:`The product this item is a version of. Set for you when you save the product.`,code:`The short code that identifies this exact size and color. Made for you from the product name.`,attributes:`Which size and color this item is. Set for you from the grid.`},"@happyvertical/smrt-inventory:StockLevel":{skuId:`The item being counted. Set for you when you save the product.`,locationId:`Where it is kept. New stock goes to the main warehouse.`,state:`Whether the count is available to sell. New stock starts as available.`,qty:`How many you have on hand.`},"@happyvertical/smrt-inventory:InventoryLocation":{code:`A short code for the place stock is kept, for example MAIN.`,name:`What you call the place, for example Main warehouse.`,kind:`What sort of place it is, for example a warehouse or a shop floor.`},"@happyvertical/smrt-commerce:Estimate":{status:`Where the estimate stands, for example draft, sent, accepted or completed.`,customerId:`The customer this estimate is for.`,subtotal:`The estimate amount before tax.`,taxAmount:`The tax charged on the estimate.`,totalAmount:`What the customer pays in all, tax included.`,currency:`The currency of the estimate's amounts.`,issueDate:`The date the estimate was issued or starts.`,dueDate:`The date payment is expected.`,expiryDate:`The last day the estimate is good for, or the day it ends.`,reference:`Your own number or note for finding this estimate later.`,notes:`Anything worth remembering about this estimate.`,terms:`The conditions agreed with the customer, such as deposits, delivery or payment conditions.`,channelId:`Where the estimate came from, for example your shop or a marketplace.`},"@happyvertical/smrt-commerce:WholesaleOrder":{status:`Where the wholesale order stands, for example draft, sent, accepted or completed.`,customerId:`The customer this wholesale order is for.`,subtotal:`The wholesale order amount before tax.`,taxAmount:`The tax charged on the wholesale order.`,totalAmount:`What the customer pays in all, tax included.`,currency:`The currency of the wholesale order's amounts.`,issueDate:`The date the wholesale order was issued or starts.`,dueDate:`The date payment is expected.`,expiryDate:`The last day the wholesale order is good for, or the day it ends.`,reference:`Your own number or note for finding this wholesale order later.`,notes:`Anything worth remembering about this wholesale order.`,terms:`The conditions agreed with the customer, such as deposits, delivery or payment conditions.`,channelId:`Where the wholesale order came from, for example your shop or a marketplace.`},"@happyvertical/smrt-commerce:Agreement":{status:`Where the agreement stands, for example draft, sent, accepted or completed.`,customerId:`The customer this agreement is for.`,subtotal:`The agreement amount before tax.`,taxAmount:`The tax charged on the agreement.`,totalAmount:`What the customer pays in all, tax included.`,currency:`The currency of the agreement's amounts.`,issueDate:`The date the agreement was issued or starts.`,dueDate:`The date payment is expected.`,expiryDate:`The last day the agreement is good for, or the day it ends.`,reference:`Your own number or note for finding this agreement later.`,notes:`Anything worth remembering about this agreement.`,terms:`The conditions agreed with the customer, such as deposits, delivery or payment conditions.`,channelId:`Where the agreement came from, for example your shop or a marketplace.`},"@happyvertical/smrt-commerce:Lease":{status:`Where the lease stands, for example draft, sent, accepted or completed.`,customerId:`The customer this lease is for.`,subtotal:`The lease amount before tax.`,taxAmount:`The tax charged on the lease.`,totalAmount:`What the customer pays in all, tax included.`,currency:`The currency of the lease's amounts.`,issueDate:`The date the lease was issued or starts.`,dueDate:`The date payment is expected.`,expiryDate:`The last day the lease is good for, or the day it ends.`,reference:`Your own number or note for finding this lease later.`,notes:`Anything worth remembering about this lease.`,terms:`The conditions agreed with the customer, such as deposits, delivery or payment conditions.`,channelId:`Where the lease came from, for example your shop or a marketplace.`},"@happyvertical/smrt-commerce:LicenseSale":{status:`Where the licence sale stands, for example draft, sent, accepted or completed.`,customerId:`The customer this licence sale is for.`,subtotal:`The licence sale amount before tax.`,taxAmount:`The tax charged on the licence sale.`,totalAmount:`What the customer pays in all, tax included.`,currency:`The currency of the licence sale's amounts.`,issueDate:`The date the licence sale was issued or starts.`,dueDate:`The date payment is expected.`,expiryDate:`The last day the licence sale is good for, or the day it ends.`,reference:`Your own number or note for finding this licence sale later.`,notes:`Anything worth remembering about this licence sale.`,terms:`The conditions agreed with the customer, such as deposits, delivery or payment conditions.`,channelId:`Where the licence sale came from, for example your shop or a marketplace.`},"@happyvertical/smrt-commerce:Contract":{status:`Where the contract stands, for example draft, sent, accepted or completed.`,subtotal:`The contract amount before tax.`,taxAmount:`The tax charged on the contract.`,totalAmount:`What the customer pays in all, tax included.`,currency:`The currency of the contract's amounts.`,issueDate:`The date the contract was issued or starts.`,dueDate:`The date payment is expected.`,expiryDate:`The last day the contract is good for, or the day it ends.`,reference:`Your own number or note for finding this contract later.`,notes:`Anything worth remembering about this contract.`,terms:`The conditions agreed with the customer, such as deposits, delivery or payment conditions.`,channelId:`Where the contract came from, for example your shop or a marketplace.`,contractType:`The kind of contract: order, estimate, lease, agreement and so on.`},"@happyvertical/smrt-commerce:ContractLineItem":{contractId:`The order, quote or agreement this line belongs to.`,description:`What is being sold or bought on this line.`,quantity:`How many.`,unitPrice:`The price of one, before tax.`,taxRate:`The tax rate for this line, as a percentage (5 means 5%).`,amount:`The line total.`,productId:`The product this line is for, if it is one you list.`},"@happyvertical/smrt-inventory:StockMovement":{skuId:`The item that moved.`,locationId:`The place it moved at.`,fromState:`What it was before, for example available or damaged.`,toState:`What it became.`,qty:`How many moved.`,reasonCode:`Why it moved, for example adjustment, sale or return.`,note:`Anything worth remembering about this movement.`,occurredAt:`When it happened.`},"@happyvertical/smrt-commerce:Invoice":{customerId:`The customer being billed.`,contractId:`The order or agreement this invoice bills for, if any.`,invoiceNumber:`The number printed on the invoice.`,issueDate:`The date the invoice was issued.`,dueDate:`The date payment is expected.`,paidDate:`The date it was paid in full.`,subtotal:`The amount before tax.`,taxAmount:`The tax charged.`,totalAmount:`What the customer owes in all, tax included.`,amountPaid:`How much of the total has been paid so far.`,currency:`The currency of the invoice.`,status:`Where the invoice stands: draft, sent, viewed, paid, overdue or cancelled.`,notes:`Private notes, not shown to the customer.`,customerNotes:`A message shown to the customer on the invoice.`,terms:`The payment conditions, such as Net 30.`},"@happyvertical/smrt-commerce:InvoiceLineItem":{invoiceId:`The invoice this line belongs to.`,description:`What is being billed on this line.`,quantity:`How many.`,unitPrice:`The price of one, before tax.`,taxRate:`The tax rate for this line, as a percentage (5 means 5%).`,amount:`The line total.`},"@happyvertical/smrt-commerce:Payment":{contractId:`The order or agreement this payment is for, if any.`,customerId:`The customer who paid.`,amount:`How much was paid.`,currency:`The currency of the payment.`,method:`How it was paid: cash, check, card, bank transfer or other.`,status:`Whether the payment is pending, completed, failed or refunded.`,reference:`Your own note, such as a check number.`,paidAt:`When the money was received.`,notes:`Anything worth remembering about this payment.`},"@happyvertical/smrt-commerce:PaymentAllocation":{paymentId:`The payment being applied.`,invoiceId:`The invoice it settles.`,amount:`How much of the payment goes to this invoice.`,allocatedAt:`When it was applied.`,notes:`Anything worth remembering about this allocation.`},"@happyvertical/smrt-commerce:Fulfillment":{contractId:`The order being fulfilled.`,fulfillmentType:`How it gets to the customer: shipment, delivery, pickup, digital or service.`,status:`Where it stands: pending, processing, shipped, delivered or cancelled.`,trackingNumber:`The carrier's tracking number.`,carrier:`The company carrying it.`,shippedAt:`When it left you.`,deliveredAt:`When it arrived.`,notes:`Anything worth remembering about this shipment.`},"@happyvertical/smrt-commerce:FulfillmentLineItem":{fulfillmentId:`The shipment this line belongs to.`,contractLineItemId:`The order line being sent.`,quantityFulfilled:`How many of that line are in this shipment.`},"@happyvertical/smrt-ledgers:Account":{number:`The account number in your chart of accounts.`,name:`What the account is called.`,description:`What the account is used for.`,type:`asset, liability, equity, revenue or expense.`,active:`Turn this off to stop using the account without deleting it.`},"@happyvertical/smrt-ledgers:Journal":{number:`The journal's reference number.`,date:`The date of the transaction.`,description:`What the transaction was.`,status:`draft while you work on it, posted once final, or voided.`,postedAt:`When it was posted.`},"@happyvertical/smrt-ledgers:JournalEntry":{journalId:`The journal this entry belongs to.`,accountId:`The account this entry changes.`,debit:`The amount debited. Leave zero on a credit.`,credit:`The amount credited. Leave zero on a debit.`,currency:`The currency of the amounts.`,memo:`A note on this entry.`},"@happyvertical/smrt-projects:Project":{title:`The project's name.`,description:`What the project is about.`,owner:`Who owns or runs the project.`,url:`A link to the project elsewhere.`},"@happyvertical/smrt-projects:Issue":{projectId:`The project this issue belongs to.`,title:`A short summary of the issue.`,body:`The full description.`,state:`open or closed.`,author:`Who raised the issue.`,labels:`The labels attached to the issue.`,assignees:`The people working on it.`},"@happyvertical/smrt-projects:Label":{projectId:`The project this label belongs to.`,name:`The label's name, for example bug.`,color:`The label's colour.`,description:`What the label means.`},"@happyvertical/smrt-projects:Comment":{issueId:`The issue this comment is on.`,body:`The comment text.`,author:`Who wrote it.`},"@happyvertical/smrt-events:Event":{name:`What the event is called.`,seriesId:`The series this event is part of, if any.`,typeId:`The kind of event.`,placeId:`Where it takes place.`,description:`What the event is about.`,startDate:`When it starts.`,endDate:`When it ends.`,allDay:`Turn this on for an event that lasts all day.`,status:`scheduled, in progress, completed, cancelled or postponed.`},"@happyvertical/smrt-events:EventType":{name:`What this kind of event is called, for example workshop.`,description:`What this kind of event is for.`},"@happyvertical/smrt-events:EventSeries":{name:`What the series is called.`,typeId:`The kind of event in this series.`,organizerId:`Who runs the series.`,description:`What the series is about.`,startDate:`When the series begins.`,endDate:`When the series ends.`,recurrence:`How often it repeats.`},"@happyvertical/smrt-events:EventParticipant":{eventId:`The event the person takes part in.`,profileId:`The person taking part.`,role:`What they do there, for example speaker or attendee.`},"@happyvertical/smrt-sales:Lead":{name:`What you call this lead.`,contactName:`The person to talk to.`,email:`Their email address.`,phone:`Their phone number.`,organizationName:`The company they are with.`,ownerRepId:`The sales representative who owns this lead.`,status:`Where the lead stands, for example new or qualified.`},"@happyvertical/smrt-sales:Opportunity":{name:`What you call this deal.`,leadId:`The lead it came from.`,ownerRepId:`The sales representative who owns this deal.`,pipelineId:`The pipeline it moves through.`,stageId:`The stage it is at now.`,expectedValueCents:`What you expect the deal to be worth, in cents.`,currency:`The currency of that value.`,probability:`How likely it is to close, as a decimal (0.5 is 50%).`,expectedCloseAt:`When you expect it to close.`,status:`open, won or lost.`},"@happyvertical/smrt-sales:PipelineDefinition":{key:`A short code for the pipeline.`,name:`What the pipeline is called.`,isDefault:`Turn this on to use it for new deals.`,status:`Whether the pipeline is in use.`,metadata:`Extra details kept with the pipeline.`},"@happyvertical/smrt-sales:PipelineStage":{pipelineId:`The pipeline this stage belongs to.`,key:`A short code for the stage.`,name:`What the stage is called.`,sortOrder:`Where it comes in the pipeline.`,probability:`How likely a deal at this stage is to close, as a decimal.`,isWon:`Turn this on for the stage that means the deal is won.`,isLost:`Turn this on for the stage that means the deal is lost.`},"@happyvertical/smrt-sales:SalesActivity":{subjectKind:`What the activity is about: a lead or an opportunity.`,subjectId:`The lead or opportunity it is about.`,activityKind:`The kind of activity, for example call, note or email.`,summary:`What happened or what needs doing.`,dueAt:`When it is due.`,completedAt:`When it was done.`}};function ct(e,t){let n=new Map(e.map(e=>[e.id,e])),r=[...Object.keys(t.recipes),...t.order].filter(e=>!n.has(e));if(r.length>0)throw Error(`Recipes only declared locally, not in a smrt package: ${[...new Set(r)].join(`, `)}`);let i=[...t.order,...e.map(e=>e.id).filter(e=>!t.order.includes(e))];return[...new Set(i)].map(e=>{let r=n.get(e),i=t.recipes[e];return i?{...r,...i}:r})}var lt={order:[`commerce.customers`,`commerce.purchases`,`commerce.sales`,`commerce.vendors`,`inventory.stock`,`products.simple`,`products.clothing`,`products.ingredients`,`commerce.estimates`,`commerce.wholesale`,`commerce.invoicing`,`commerce.fulfillment`,`commerce.agreements`,`commerce.leases`,`commerce.licenses`,`ledgers.bookkeeping`,`projects.tracker`,`events.calendar`,`sales.pipeline`],recipes:{"commerce.customers":{forms:[{id:`customer.default`,kind:`field-map`,label:`Customer`,kindLabel:`Customer`,model:`@happyvertical/smrt-commerce:Customer`,records:[{as:`profileType`,model:`@happyvertical/smrt-profiles:ProfileType`,match:{name:`Customer`}},{as:`profile`,model:`@happyvertical/smrt-profiles:Profile`,match:{id:{ref:`customer`,field:`profileId`}},values:{typeId:{ref:`profileType`}}},{as:`customer`,model:`@happyvertical/smrt-commerce:Customer`,values:{profileId:{ref:`profile`}}}],fields:[{id:`name`,label:`Name`,to:`profile.name`,required:!0},{id:`email`,label:`Email`,to:`profile.email`},{id:`status`,label:`Status`,to:`customer.status`,default:`active`},{id:`customerType`,label:`Customer type`,to:`customer.customerType`,default:`dtc`},{id:`paymentTerms`,label:`Payment terms`,to:`customer.paymentTerms`},{id:`creditLimit`,label:`Credit limit`,to:`customer.creditLimit`},{id:`taxExempt`,label:`Tax exempt`,to:`customer.taxExempt`},{id:`taxId`,label:`Tax ID`,to:`customer.taxId`},{id:`shippingAddress`,label:`Shipping address`,to:`customer.defaultShippingAddress`},{id:`billingAddress`,label:`Billing address`,to:`customer.defaultBillingAddress`},{id:`notes`,label:`Notes`,to:`customer.notes`}]}]},"commerce.vendors":{forms:[{id:`vendor.default`,kind:`field-map`,label:`Vendor`,kindLabel:`Vendor`,model:`@happyvertical/smrt-commerce:Vendor`,records:[{as:`profileType`,model:`@happyvertical/smrt-profiles:ProfileType`,match:{name:`Vendor`}},{as:`profile`,model:`@happyvertical/smrt-profiles:Profile`,match:{id:{ref:`vendor`,field:`profileId`}},values:{typeId:{ref:`profileType`}}},{as:`vendor`,model:`@happyvertical/smrt-commerce:Vendor`,values:{profileId:{ref:`profile`}}}],fields:[{id:`name`,label:`Name`,to:`profile.name`,required:!0},{id:`email`,label:`Email`,to:`profile.email`},{id:`status`,label:`Status`,to:`vendor.status`,default:`active`},{id:`currency`,label:`Currency`,to:`vendor.currency`,default:`USD`},{id:`paymentTerms`,label:`Payment terms`,to:`vendor.paymentTerms`},{id:`leadTimeDays`,label:`Lead time (days)`,to:`vendor.leadTimeDays`},{id:`minimumOrderAmount`,label:`Minimum order`,to:`vendor.minimumOrderAmount`},{id:`contactEmail`,label:`Contact email`,to:`vendor.defaultContactEmail`},{id:`contactPhone`,label:`Contact phone`,to:`vendor.defaultContactPhone`},{id:`notes`,label:`Notes`,to:`vendor.notes`},{id:`payoutAddresses`,label:`Payout addresses`,to:`vendor.payoutAddresses`}]}]},"inventory.stock":{extends:[{form:`product.simple`,records:[{as:`sku`,model:`@happyvertical/smrt-products:Sku`,match:{productId:{ref:`product`}},values:{code:`{product.name|slug}`,name:`{product.name}`,attributes:`{}`,active:!0}},{as:`location`,model:`@happyvertical/smrt-inventory:InventoryLocation`,match:{code:`MAIN`},values:{name:`Main warehouse`,kind:`warehouse`}},{as:`stock`,model:`@happyvertical/smrt-inventory:StockLevel`,match:{skuId:{ref:`sku`},locationId:{ref:`location`},state:`available`}}],fields:[{id:`quantity`,label:`Quantity`,to:`stock.qty`,default:0}]},{form:`product.clothing`,records:[{as:`location`,model:`@happyvertical/smrt-inventory:InventoryLocation`,match:{code:`MAIN`},values:{name:`Main warehouse`,kind:`warehouse`}},{as:`stock`,model:`@happyvertical/smrt-inventory:StockLevel`,match:{skuId:{ref:`sku`},locationId:{ref:`location`},state:`available`}}],fields:[{id:`quantity`,label:`Quantity`,to:`stock.qty`,default:0}]}]},"products.simple":{forms:[{id:`product.simple`,kind:`field-map`,label:`Simple product`,kindLabel:`Simple`,model:`@happyvertical/smrt-products:Product`,records:[{as:`product`,model:`@happyvertical/smrt-products:Product`}],fields:[{id:`name`,label:`Name`,to:`product.name`,required:!0},{id:`price`,label:`Price`,to:`product.price`},{id:`description`,label:`Description`,to:`product.description`}]}]},"products.clothing":{forms:[{id:`product.clothing`,kind:`variant-grid`,label:`Clothing item`,kindLabel:`Clothing`,model:`@happyvertical/smrt-products:Product`,product:{as:`product`,model:`@happyvertical/smrt-products:Product`},fields:[{id:`name`,label:`Name`,to:`product.name`,required:!0},{id:`price`,label:`Price`,to:`product.price`}],axes:[{name:`size`,label:`Sizes`,values:[`XS`,`S`,`M`,`L`,`XL`]},{name:`color`,label:`Colors`,values:[]}],variants:`@happyvertical/smrt-products:ProductVariant`,skus:`@happyvertical/smrt-products:Sku`}]}}};function ut(e){return e.fields.filter(e=>!e.system)}var dt=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1_$2`).toLowerCase();function ft(e,t){return/Type$/.test(t.name)&&Array.isArray(t.enum)&&t.enum.length>0&&!!e.extends&&t.enum.includes(dt(e.name))}function pt(e){return e.some(e=>e.ui?.basic===!0)}function mt(e){return e!=null&&e!==``}function ht(e){if(e==null)return null;try{return{value:JSON.parse(e)}}catch{return null}}function K(e,t,n=[]){let r=ut(e),i=pt(r),a=new Map(n.filter(t=>t.objectRef===e.id).map(e=>[e.fieldName,e]));return r.map((n,r)=>{let o=t?.fields?.[n.name]??{},s=ft(e,n),c=o.visibility??(s?`hidden`:!i||n.ui?.basic===!0?`basic`:`advanced`),l=o.label??M(n),u=o.help??null,d=o.order??n.ui?.order??r,f=o.locked??n.ui?.locked??s,p=dt(e.name),m=n.default===void 0?s&&n.enum?.includes(p)?p:void 0:n.default,h=`default`in o||m!==void 0,g=`default`in o?o.default:m,_=a.get(n.name);if(_&&(!f||_.locked===!1)){_.visibility&&(c=_.visibility),_.label&&(l=_.label),_.help!==void 0&&(u=_.help||null),typeof _.displayOrder==`number`&&(d=_.displayOrder);let e=ht(_.defaultValue);e&&(h=!0,g=e.value),typeof _.locked==`boolean`&&(f=_.locked)}let v,y=o.required??n.required;return y&&c!==`basic`&&!(h&&mt(g))&&(c=`basic`,v=!0),{field:n,visibility:c,label:l,help:u,order:d,group:n.ui?.group??null,locked:f,required:y,hasDefault:h,default:g,...v?{visibilityForced:v}:{}}}).map((e,t)=>({entry:e,index:t})).sort((e,t)=>e.entry.order-t.entry.order||e.index-t.index).map(({entry:e})=>e)}function gt(e){return typeof e==`string`||typeof e==`number`||typeof e==`boolean`||e===null?e:void 0}function _t(e){return e.filter(e=>e.visibility===`basic`).map(e=>{let{default:t,...n}=e.field,r=e.hasDefault?gt(e.default):void 0;return{...n,required:e.required,...r===void 0?{}:{default:r},label:e.label,...e.help?{help:e.help}:{}}})}function vt(e){let t={};for(let n of e)n.visibility!==`basic`&&n.hasDefault&&n.default!==void 0&&(t[n.field.name]=n.default);return t}var yt=[`api`,`mcp`,`cli`],bt={api:`REST`,mcp:`MCP`,cli:`CLI`};function xt(e,t){return(t===`api`?e.rest.length:t===`mcp`?e.mcp.length:e.cli.length)>0}function q(e,t,n=[]){let r={};for(let i of yt){let a=xt(e,i),o=t?.exposure?.[i]===!1;r[i]={available:a,on:a&&!o&&!n.includes(i),locked:!a||o}}return r}function St(e,t){let n=t.mcp.on;return{...e,rest:t.api.on?e.rest:[],mcp:n?e.mcp:[],cli:t.cli.on?e.cli:[],methods:e.methods.map(e=>({...e,aiCallable:e.aiCallable&&n}))}}function Ct(e,t,n=[]){return K(e,t,n).filter(e=>t?.fields?.[e.field.name]?.visibility!==`hidden`)}function wt(e){return e.required||e.locked}function Tt(e,t,n,r){let i={};for(let r of Ct(e,t,n))i[r.field.name]={use:r.visibility===`basic`,label:r.label,help:r.help??``,default:r.hasDefault?r.default:null,order:r.order};let a=q(e,t,r);return{fields:i,exposure:{api:a.api.on,mcp:a.mcp.on,cli:a.cli.on}}}var Et=(e,t)=>JSON.stringify(e??null)===JSON.stringify(t??null);function Dt(e,t,n){let r=Ct(e,t),i=[];for(let t of r){let r=n.fields[t.field.name];if(!r||t.locked)continue;let a={objectRef:e.id,fieldName:t.field.name,scopeType:`app`},o=wt(t)?!0:r.use;o!==(t.visibility===`basic`)&&(a.visibility=o?`basic`:`hidden`),r.label.trim()&&r.label!==t.label&&(a.label=r.label.trim()),r.help!==(t.help??``)&&(a.help=r.help||null),Et(r.default,t.hasDefault?t.default:null)||(a.defaultValue=JSON.stringify(r.default??null)),r.order!==t.order&&(a.displayOrder=r.order),Object.keys(a).length>3&&i.push(a)}return i}function Ot(e,t,n){let r=q(e,t);return yt.filter(e=>r[e].on&&!n.exposure[e])}var kt=st,J=ct(ie.packages.flatMap(e=>e.recipes??[]),lt),At=new Map(J.map(e=>[e.id,e]));function jt(e){return At.get(e)}var Y=At,Mt=Ke(J);function Nt(e){return Mt.find(t=>t.id===e)}function Pt(e){let t=e.models[0];return t?A(t)?.pkg:void 0}function Ft(e){return e.nav.flatMap(e=>{let t=A(e.model);return t?[{label:e.label,icon:e.icon??`fileText`,description:Xe(e.description,t.model),...e.key?{key:e.key}:{},...e.noun?{noun:e.noun}:{},...e.filter?{filter:e.filter}:{},model:t.model,packageId:t.pkg.id}]:[]})}function It(e,t,n){return J.some(r=>Ft(r).some(r=>r.key===n&&r.packageId===e&&r.model.name===t))}function Lt(e){return`/m/${e.packageId}/${e.model.name}/${e.key?`${e.key}/`:``}`}function Rt(e){return e.models.flatMap(e=>{let t=A(e);return t?[{model:t.model,packageId:t.pkg.id}]:[]})}function zt(e,t=[]){let n=e.nav.length>0;return Rt(e).map(({model:r})=>({id:r.id,name:r.name,...n?{}:{glossary:!1},descriptions:{...Object.fromEntries(r.fields.flatMap(e=>e.description?[[e.name,e.description]]:[])),...kt[r.id]},fields:K(r,e.options?.[r.id],t).map(e=>({name:e.field.name,label:e.label,help:e.help,visibility:e.visibility}))}))}function Bt(e){return[...new Set(e)].sort()}function X(e,t){let n=new Set,r=e=>{let i=t.get(e);if(i&&!n.has(e)){n.add(e);for(let e of i.requires)r(e)}};for(let t of e)r(t);let i=!0;for(;i;){i=!1;for(let e of[...n])for(let a of t.get(e)?.requiresAny??[]){if(a.some(e=>n.has(e)))continue;let e=a.find(e=>t.has(e));e&&(r(e),i=!0)}}return Bt(n)}function Vt(e,t,n){let r=new Set(e),i=t.filter(e=>!r.has(e)),a=new Set(i);return i.filter(e=>{let t=n.get(e);return t?t.requires.some(e=>r.has(e))?!0:(t.requiresAny??[]).some(e=>e.some(e=>r.has(e))&&!e.some(e=>a.has(e))):!1})}function Ht(e,t,n){return Vt([e],t,n)}function Ut(e,t){return Bt([...e].filter(e=>t.has(e)))}var Wt={currency:`USD`,taxRate:0,paymentTerms:``,pricesIncludeTax:!1,taxRounding:`line`},Z=`@happyvertical/smrt-commerce:`,Q={currency:[`Order`,`PurchaseOrder`,`WholesaleOrder`,`Estimate`,`Invoice`,`Agreement`,`Lease`].map(e=>({model:`${Z}${e}`,field:`currency`})),taxRate:[`InvoiceLineItem`,`ContractLineItem`].map(e=>({model:`${Z}${e}`,field:`taxRate`})),paymentTerms:[...[`Order`,`WholesaleOrder`,`Estimate`,`Invoice`,`Agreement`,`Lease`].map(e=>({model:`${Z}${e}`,field:`terms`})),{model:`${Z}Customer`,field:`paymentTerms`}],pricesIncludeTax:[`Invoice`,`Contract`].map(e=>({model:`${Z}${e}`,field:`lineAmountType`})),taxRounding:[`Invoice`,`Contract`].map(e=>({model:`${Z}${e}`,field:`taxRoundingScope`}))};function Gt(e){return Object.values(Q).some(t=>t.some(t=>t.model===e.objectRef&&t.field===e.fieldName))}var Kt=Object.keys(Q);function qt(e){if(e?.defaultValue!==void 0&&e.defaultValue!==null)try{return JSON.parse(e.defaultValue)}catch{return}}function Jt(e,t,n){return e.find(e=>e.scopeType===`app`&&e.objectRef===t&&e.fieldName===n)}function Yt(e){let t={...Wt},n=(t,n)=>{for(let{model:r,field:i}of Q[t]){let t=qt(Jt(e.policies,r,i));if(typeof t===n)return t}},r=n(`currency`,`string`),i=n(`taxRate`,`number`),a=n(`paymentTerms`,`string`),o=n(`pricesIncludeTax`,`string`),s=n(`taxRounding`,`string`);return typeof r==`string`&&(t.currency=r),typeof i==`number`&&(t.taxRate=i),typeof a==`string`&&(t.paymentTerms=a),(o===`inclusive`||o===`exclusive`)&&(t.pricesIncludeTax=o===`inclusive`),(s===`line`||s===`document`)&&(t.taxRounding=s),t}function Xt(e){return Q.taxRate.some(({model:t,field:n})=>typeof qt(Jt(e.policies,t,n))==`number`)}function Zt(e,t,n){let r=A(t)?.model;if(!r)return;let i=K(r,e.recipes.map(e=>Y.get(e)?.options?.[t]).find(Boolean),[]).find(e=>e.field.name===n);return i?.hasDefault?i.default:void 0}var Qt=e=>e==null||e===``;function $t(e,t){let n=e.policies.map(e=>({...e}));for(let r of Kt){let i=t[r],a=r===`paymentTerms`?String(i).trim():r===`currency`?String(i).trim().toUpperCase():r===`pricesIncludeTax`?i?`inclusive`:`exclusive`:i;for(let{model:t,field:i}of Q[r]){let o=Zt(e,t,i),s=!Qt(a)&&!(!Qt(o)&&o===a)&&!(Qt(o)&&r===`taxRate`&&a===0),c=Jt(n,t,i);if(s){let e=JSON.stringify(a);c?c.defaultValue=e:n.push({objectRef:t,fieldName:i,scopeType:`app`,defaultValue:e})}else c&&(delete c.defaultValue,Object.keys(c).length<=3&&(n=n.filter(e=>e!==c)))}}return{...e,policies:n}}function en(e){return{...Wt,...e}}var tn=()=>({ids:[],rows:[],narrowed:{},features:[],unavailableRecipes:[],unavailableFeatures:[]});function $(e){let t=new Set([...e.ids.flatMap(e=>Y.get(e)?.models??[]),...e.features]);return{...e,rows:e.rows.filter(e=>t.has(e.objectRef)||Gt(e)),narrowed:Object.fromEntries(Object.entries(e.narrowed).filter(([e])=>t.has(e)))}}var nn=(e,t)=>({...e,ids:X([...e.ids,...t],Y)});function rn(e,t){let n=new Set(t),r=e.ids.filter(e=>!n.has(e));return $({...e,ids:X(r,Y)})}var an=(e,t)=>e.features.includes(t)?e:{...e,features:[...e.features,t].sort()},on=(e,t)=>$({...e,features:e.features.filter(e=>e!==t)}),sn=(e,t)=>Ht(t,e.ids,Y);function cn(e,t){for(let n of e.ids){let e=Y.get(n)?.options?.[t];if(e)return e}}function ln(e,t,n,r){let i={...e.narrowed};return r.length?i[t]=[...r]:delete i[t],{...e,rows:[...e.rows.filter(e=>e.objectRef!==t),...n],narrowed:i}}function un(e){let t=[...e.rows].sort((e,t)=>e.objectRef.localeCompare(t.objectRef)||e.fieldName.localeCompare(t.fieldName)),n=Object.fromEntries(Object.keys(e.narrowed).sort().filter(t=>e.narrowed[t].length).map(t=>[t,[...e.narrowed[t]].sort()])),r={recipes:[...e.ids,...e.unavailableRecipes].sort(),features:[...e.features,...e.unavailableFeatures].sort(),policies:t.map(e=>({...e}))};return Object.keys(n).length&&(r.exposure=n),r}function dn(e){let t=[...new Set(e.features)],n=e=>!!A(e)?.model.exposed;return $({ids:X(e.recipes,Y),rows:e.policies.map(e=>({...e})),narrowed:Object.fromEntries(Object.entries(e.exposure??{}).map(([e,t])=>[e,[...t]])),features:t.filter(n).sort(),unavailableRecipes:[...new Set(e.recipes.filter(e=>!Y.has(e)))].sort(),unavailableFeatures:t.filter(e=>!n(e)).sort()})}var fn=new class{#e=b(C([]));get ids(){return e(this.#e)}set ids(e){k(this.#e,e,!0)}#t=b(C([]));get rows(){return e(this.#t)}set rows(e){k(this.#t,e,!0)}#n=b(C({}));get narrowed(){return e(this.#n)}set narrowed(e){k(this.#n,e,!0)}#r=b(C([]));get features(){return e(this.#r)}set features(e){k(this.#r,e,!0)}#i=b(C([]));get unavailableRecipes(){return e(this.#i)}set unavailableRecipes(e){k(this.#i,e,!0)}#a=b(C([]));get unavailableFeatures(){return e(this.#a)}set unavailableFeatures(e){k(this.#a,e,!0)}get data(){return{ids:this.ids,rows:this.rows,narrowed:this.narrowed,features:this.features,unavailableRecipes:this.unavailableRecipes,unavailableFeatures:this.unavailableFeatures}}set(e){this.ids=e.ids,this.rows=e.rows,this.narrowed=e.narrowed,this.features=e.features,this.unavailableRecipes=e.unavailableRecipes,this.unavailableFeatures=e.unavailableFeatures}removeUnavailable(){this.unavailableRecipes=[],this.unavailableFeatures=[]}hasFeature(e){return this.features.includes(e)}addFeature(e){this.set(an(this.data,e))}removeFeature(e){this.set(on(this.data,e))}has(e){return this.ids.includes(e)}requiredBy(e){return sn(this.data,e)}add(...e){this.set(nn(this.data,e))}remove(...e){this.set(rn(this.data,e))}toggle(e){this.has(e)?this.remove(e):this.add(e)}clear(){this.set(tn())}hintsFor(e){return cn(this,e)}apply(e){let t=this.hintsFor(e.id),n=K(e,t,this.rows);return{model:St(e,q(e,t,this.narrowed[e.id]??[])),resolved:n,fields:_t(n),background:vt(n)}}save(e,t,n){this.set(ln(this.data,e,t,n))}reset(e){this.save(e,[],[])}snapshot(){return un(this.data)}load(e){this.set(dn(e))}};export{he as $,Dt as A,Ye as B,yt as C,wt as D,Ct as E,nt as F,Ve as G,W as H,at as I,Ge as J,He as K,rt as L,tt as M,ot as N,Ot as O,it as P,De as Q,qe as R,Mt as S,Tt as T,ze as U,G as V,Ue as W,Be as X,We as Y,ke as Z,Rt as _,Gt as a,J as b,$t as c,X as d,R as et,jt as f,Lt as g,zt as h,Xt as i,Qe as j,q as k,Ut as l,It as m,un as n,Yt as o,Nt as p,Fe as q,Q as r,en as s,fn as t,Vt as u,Ft as v,bt as w,Y as x,Pt as y,Je as z};
1
+ import{$ as e,B as t,Ct as n,Dt as r,E as i,Et as a,F as o,Ft as s,G as c,H as l,K as u,L as d,Lt as f,Ot as p,Pt as m,U as h,W as g,X as _,Y as v,a as y,bt as b,ct as ee,d as x,ft as S,gt as C,ht as w,k as te,mt as T,pt as E,q as ne,st as D,v as O,vt as k}from"./DG3qFFTE.js";import"./xihTtKlq.js";import{a as re}from"./Bv5jGtB8.js";import"./YUSKx8_q.js";import{ft as A,lt as ie,p as j,u as M,ut as N}from"./CoXf-L_3.js";import"./DK8Blf1Y.js";import"./M-CuJzQN.js";import"./eNZ3ToP2.js";v([`click`]),v([`click`,`keydown`]),v([`click`]);var P=new Map(Object.entries({menu:`M3 18h18v-2H3v2zm0-5h18v-2H3v2zm0-7v2h18V6H3z`,search:`M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z`,close:`M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z`,"chevron-right":`M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6-6-6z`,"chevron-left":`M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12l4.58-4.59z`,"chevron-down":`M7.41 8.59L12 13.17l4.59-4.58L18 10l-6 6-6-6 1.41-1.41z`,check:`M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41L9 16.17z`,add:`M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z`,mic:`M12 14c1.66 0 3-1.34 3-3V5c0-1.66-1.34-3-3-3S9 3.34 9 5v6c0 1.66 1.34 3 3 3z M17 11c0 2.76-2.24 5-5 5s-5-2.24-5-5H5c0 3.53 2.04 6.43 5 7.07V21h4v-2.93c2.96-.64 5-3.54 5-7.07h-2z`,alert:`M12 2a10 10 0 1 0 0 20 10 10 0 0 0 0-20zm-1 5h2v6h-2zm0 8h2v2h-2z`,warning:`M1 21h22L12 2 1 21zm12-3h-2v-2h2zm0-4h-2v-4h2z`,info:`M12 2a10 10 0 1 0 0 20 10 10 0 0 0 0-20zm1 15h-2v-6h2zm0-8h-2V7h2z`,home:`M3 10 12 2 21 10v11h-6v-7H9v7H3z`,user:`M12 3a4 4 0 1 0 0 8 4 4 0 0 0 0-8zM4 21v-2c0-4 16-4 16 0v2H4z`,settings:`M10 2h4l1 3 3-1 3 3-1 3 3 1v4l-3 1 1 3-3 3-3-1-1 3h-4l-1-3-3 1-3-3 1-3-3-1v-4l3-1-1-3 3-3 3 1 1-3zm2 6a4 4 0 1 0 0 8 4 4 0 0 0 0-8z`,trash:`M7 3h10v2h4v2H3V5h4V3zm-2 6h14v12H5V9zm4 2v8h2v-8H9zm4 0v8h2v-8h-2z`,edit:`M3 17.25V21h3.75L17.81 9.94l-3.75-3.75L3 17.25zM20.71 7.04a1 1 0 0 0 0-1.41l-2.34-2.34a1 1 0 0 0-1.41 0l-1.83 1.83 3.75 3.75 1.83-1.83z`,calendar:`M7 2h2v2h6V2h2v2h4v18H3V4h4V2zm-2 8v10h14V10H5zm2 2h4v4H7v-4z`,clock:`M12 2a10 10 0 1 0 0 20 10 10 0 0 0 0-20zm0 2a8 8 0 1 1 0 16 8 8 0 0 1 0-16zm-1 2h2v5.5l4 2.5-1 1.5-5-3V6z`,camera:`M9 3h6l2 3h4v15H3V6h4l2-3zm3 5a5 5 0 1 0 0 10 5 5 0 0 0 0-10zm0 2a3 3 0 1 1 0 6 3 3 0 0 1 0-6z`,upload:`M11 16V7l-4 4-1.5-1.5L12 3l6.5 6.5L17 11l-4-4v9h-2zM3 18h18v3H3v-3z`,download:`M11 3h2v9l4-4 1.5 1.5L12 16l-6.5-6.5L7 8l4 4V3zM3 18h18v3H3v-3z`})),F=b([]);function I(t){for(let n=e(F).length-1;n>=0;n--){let r=e(F)[n].paths.get(t);if(r!==void 0)return r}return P.get(t)}var L=u(`<svg xmlns="http://www.w3.org/2000/svg" data-smrt-component="Icon" class="svelte-em2a54"><path></path></svg>`);function R(t,i){p(i,!0);let a=y(i,`size`,3,24),o=y(i,`color`,3,`currentColor`),s=y(i,`viewBox`,3,`0 0 24 24`),c=n(()=>!!i[`aria-label`]),l=n(()=>i.path??(i.name?I(i.name):``)),u=n(()=>typeof a()==`number`?`${a()}px`:a());var d=L(),f=T(d);D(()=>{O(d,`width`,e(u)),O(d,`height`,e(u)),O(d,`viewBox`,s()),O(d,`fill`,o()),O(d,`aria-hidden`,!e(c)),O(d,`aria-label`,i[`aria-label`]),O(d,`role`,e(c)?`img`:void 0),O(f,`d`,e(l))}),h(t,d),r()}v([`click`]);var z=Symbol.for(`smrt-ui.page-header`);function ae(){return a(z)??null}var oe=c(`<li class="svelte-1f2td7n"><a class="svelte-1f2td7n"> </a></li>`),B=c(`<nav class="page-crumbs svelte-1f2td7n" data-shell-breadcrumbs=""><ol class="svelte-1f2td7n"></ol></nav>`),se=c(`<a class="back-link svelte-1f2td7n"><!> <span> </span></a>`),ce=c(`<h1 class="page-title page-title-field svelte-1f2td7n" data-page-title-field=""><!></h1>`),le=c(`<h1 class="page-title svelte-1f2td7n" data-shell-page-title=""> </h1>`),ue=c(`<p class="page-subtitle svelte-1f2td7n"> </p>`),de=c(`<div class="page-meta svelte-1f2td7n"><!></div>`),fe=c(`<div class="header-actions svelte-1f2td7n"><!></div>`),pe=c(`<div class="header-extra svelte-1f2td7n" data-page-header-extra=""><!></div>`),me=c(`<header class="page-header svelte-1f2td7n" data-page-header="" data-smrt-component="PageHeader"><!> <div class="header-main svelte-1f2td7n"><div class="header-content svelte-1f2td7n"><!> <!> <!> <!></div> <!></div> <!></header>`);function he(i,a){p(a,!0);let c=y(a,`parents`,19,()=>[]),u=y(a,`crumbsLabel`,3,`Breadcrumb`),f=y(a,`backLabel`,3,`Back`),m=ae(),g=n(()=>a.crumbs??(m?m.crumbs(c()):c()));ee(()=>m?.report?.({title:a.shortTitle??a.title,parents:c()}));var _=me(),v=S(_),b=t=>{var n=B(),r=S(n);d(r,23,()=>e(g),(e,t)=>`${t}:${e.href}`,(t,n)=>{var r=oe(),i=S(r),a=T(i,!0);s(r),D(()=>{O(i,`href`,e(n).href),l(a,e(n).label)}),h(t,r)}),s(r),s(n),D(()=>O(n,`aria-label`,u())),h(t,n)};t(v,t=>{e(g).length>0&&t(b)});var x=w(v,2),C=S(x),E=S(C),ne=e=>{var t=se(),n=S(t);R(n,{name:`chevron-left`,size:20});var r=w(n,2),i=T(r,!0);s(t),te(t,e=>re?.(e)),D(()=>{O(t,`href`,a.backHref),l(i,f())}),h(e,t)};t(E,e=>{a.backHref&&e(ne)});var k=w(E,2),A=e=>{var t=ce(),n=S(t);o(n,()=>a.titleField),s(t),h(e,t)},ie=e=>{var t=le(),n=T(t,!0);D(()=>l(n,a.title)),h(e,t)};t(k,e=>{a.titleField?e(A):e(ie,-1)});var j=w(k,2),M=e=>{var t=ue(),n=T(t,!0);D(()=>l(n,a.subtitle)),h(e,t)};t(j,e=>{a.subtitle&&e(M)});var N=w(j,2),P=e=>{var t=de(),n=S(t);o(n,()=>a.meta),s(t),h(e,t)};t(N,e=>{a.meta&&e(P)}),s(C);var F=w(C,2),I=e=>{var t=fe(),n=S(t);o(n,()=>a.actions),s(t),h(e,t)};t(F,e=>{a.actions&&e(I)}),s(x);var L=w(x,2),z=e=>{var t=pe(),n=S(t);o(n,()=>a.children),s(t),h(e,t)};t(L,e=>{a.children&&e(z)}),s(_),h(i,_),r()}v([`click`]),v([`click`]);function ge(e,t,n){if(!n||n<1||e.length<=n)return{visible:[...e],overflow:[]};let r=e.slice(0,n-1),i=e.slice(n-1),a=i.find(e=>e.id===t)??i[0];return{visible:a?[...r,a]:r,overflow:i.filter(e=>e!==a)}}var _e=c(`<span class="smrt-tabs__tab-count svelte-19k21oo" data-smrt-part="count"> </span>`),ve=c(`<span class="smrt-tabs__tab-badge svelte-19k21oo" data-smrt-part="badge"> </span>`),ye=c(`<a data-smrt-part="tab"><span data-smrt-part="label"> </span> <!> <!></a>`),be=c(`<span class="smrt-tabs__tab-dot svelte-19k21oo" data-smrt-part="marker" aria-hidden="true"></span> <span class="smrt-tabs__visually-hidden svelte-19k21oo" data-smrt-part="description"> </span>`,1),xe=c(`<details class="smrt-tabs__more svelte-19k21oo" data-smrt-part="overflow"><summary class="smrt-tabs__tab-link svelte-19k21oo" data-smrt-part="trigger"><span data-smrt-part="label"> </span> <!></summary> <div class="smrt-tabs__more-menu svelte-19k21oo" data-smrt-part="menu"></div></details>`),Se=c(`<div class="smrt-tabs__tab-panel svelte-19k21oo" data-smrt-part="panel"><!></div>`),Ce=c(`<div class="smrt-tabs__container svelte-19k21oo" data-smrt-component="Tabs"><nav data-smrt-part="list" data-shell-tabs=""><div class="smrt-tabs__links-row svelte-19k21oo" data-smrt-part="row"></div> <!></nav> <!></div>`),we=c(`<button type="button" data-smrt-part="tab" role="tab"><span class="smrt-tabs__tab-content-wrapper svelte-19k21oo" data-smrt-part="body"><span data-smrt-part="label"> </span> <!> <!></span> <div class="smrt-tabs__active-indicator svelte-19k21oo" data-smrt-part="indicator"></div></button>`),Te=c(`<div class="smrt-tabs__tab-panel svelte-19k21oo" data-smrt-part="panel" role="tabpanel"><!></div>`),Ee=c(`<div class="smrt-tabs__container svelte-19k21oo" data-smrt-component="Tabs"><div data-smrt-part="list" role="tablist"></div> <!></div>`);function De(a,c){let u=ne();p(c,!0);let v=(r,a=f)=>{var o=ye();let u;var d=S(o),p=T(d,!0),m=w(d,2),g=e=>{var t=_e(),n=T(t,!0);D(()=>l(n,a().count)),h(e,t)};t(m,e=>{a().count!==void 0&&e(g)});var v=w(m,2),y=e=>{var t=ve(),n=T(t,!0);D(()=>l(n,a().badge)),h(e,t)},b=n(()=>L(a()));t(v,t=>{e(b)&&t(y)}),s(o),D(()=>{u=i(o,1,`smrt-tabs__tab-link svelte-19k21oo`,null,u,{"smrt-tabs__active":a().id===c.active}),O(o,`href`,a().disabled?void 0:a().href),O(o,`aria-current`,a().id===c.active?`page`:void 0),O(o,`aria-disabled`,a().disabled?`true`:void 0),O(o,`data-tab-id`,a().id),l(p,a().label)}),_(`click`,o,e=>{a().disabled?e.preventDefault():ae(a().id)}),h(r,o)},C=y(c,`size`,3,`md`),A=y(c,`variant`,3,`primary`),ie=y(c,`moreLabel`,3,`More`),j=y(c,`moreBadgeLabel`,3,`has updates`),M=n(()=>c.tabs.length>0&&c.tabs.every(e=>!!e.href)),N=n(()=>e(M)?ge(c.tabs,c.active,c.maxVisible):{visible:c.tabs,overflow:[]}),P=n(()=>e(N).overflow.some(e=>L(e))),F=b(null),I=b(null);ee(()=>{let t=c.active;e(M)&&e(I)&&(e(F)&&(e(F).open=!1),e(I).querySelector(`[data-tab-id="${CSS.escape(t)}"]`)?.scrollIntoView?.({block:`nearest`,inline:`nearest`}))});function L(e){return e.badge!==void 0&&e.badge!==null&&e.badge!==``}let R=n(()=>c.tabs.filter(e=>!e.disabled)),z=b(null);function ae(e){c.tabs.find(t=>t.id===e)?.disabled||e!==c.active&&c.onchange?.(e)}function oe(t,n){let r=e(R).findIndex(e=>e.id===n),i=null;switch(t.key){case`ArrowRight`:t.preventDefault(),i=(r+1)%e(R).length;break;case`ArrowLeft`:t.preventDefault(),i=(r-1+e(R).length)%e(R).length;break;case`Home`:t.preventDefault(),i=0;break;case`End`:t.preventDefault(),i=e(R).length-1}if(i!==null&&i!==r){let t=e(R)[i];t&&(c.onchange?.(t.id),requestAnimationFrame(()=>{(e(z)?.querySelector(`[data-tab-id="${CSS.escape(t.id)}"]`))?.focus()}))}}var B=g(),se=E(B),ce=n=>{var r=Ce(),a=S(r);let u;var f=S(a);d(f,21,()=>e(N).visible,e=>e.id,(t,n)=>{v(t,()=>e(n))}),s(f),x(f,e=>k(I,e),()=>e(I));var p=w(f,2),m=n=>{var r=xe(),i=S(r),a=S(i),o=T(a,!0),c=w(a,2),u=e=>{var t=be(),n=w(E(t),2),r=T(n);D(()=>l(r,`(${j()??``})`)),h(e,t)};t(c,t=>{e(P)&&t(u)}),s(i);var f=w(i,2);d(f,21,()=>e(N).overflow,e=>e.id,(t,n)=>{v(t,()=>e(n))}),s(f),s(r),x(r,e=>k(F,e),()=>e(F)),D(()=>l(o,ie())),h(n,r)};t(p,t=>{e(N).overflow.length>0&&t(m)}),s(a);var g=w(a,2),_=e=>{var t=Se(),n=S(t);o(n,()=>c.children),s(t),h(e,t)};t(g,e=>{c.children&&e(_)}),s(r),D(()=>{u=i(a,1,`smrt-tabs__links svelte-19k21oo`,null,u,{"smrt-tabs__sm":C()===`sm`,"smrt-tabs__lg":C()===`lg`}),O(a,`aria-label`,c[`aria-label`])}),h(n,r)},le=r=>{var a=Ee(),f=S(a);let p;d(f,21,()=>c.tabs,e=>e.id,(r,a)=>{var o=we();let d;var f=S(o),p=S(f),g=T(p,!0),v=w(p,2),y=t=>{var n=_e(),r=T(n,!0);D(()=>l(r,e(a).count)),h(t,n)};t(v,t=>{e(a).count!==void 0&&t(y)});var b=w(v,2),ee=t=>{var n=ve(),r=T(n,!0);D(()=>l(r,e(a).badge)),h(t,n)},x=n(()=>L(e(a)));t(b,t=>{e(x)&&t(ee)}),s(f),m(2),s(o),te(o,e=>re?.(e)),D(()=>{d=i(o,1,`smrt-tabs__tab-button svelte-19k21oo`,null,d,{"smrt-tabs__active":e(a).id===c.active}),o.disabled=e(a).disabled,O(o,`id`,`tab-${u}-${e(a).id??``}`),O(o,`aria-selected`,e(a).id===c.active),O(o,`aria-controls`,`tab-panel-${u}`),O(o,`tabindex`,e(a).id===c.active?0:-1),O(o,`data-tab-id`,e(a).id),l(g,e(a).label)}),_(`click`,o,()=>ae(e(a).id)),_(`keydown`,o,t=>oe(t,e(a).id)),h(r,o)}),s(f),x(f,e=>k(z,e),()=>e(z));var g=w(f,2),v=e=>{var t=Te(),n=S(t);o(n,()=>c.children),s(t),D(()=>{O(t,`id`,`tab-panel-${u}`),O(t,`aria-labelledby`,`tab-${u}-${c.active??``}`)}),h(e,t)};t(g,e=>{c.children&&e(v)}),s(a),D(()=>{p=i(f,1,`smrt-tabs__nav svelte-19k21oo`,null,p,{"smrt-tabs__sm":C()===`sm`,"smrt-tabs__lg":C()===`lg`,"smrt-tabs__secondary":A()===`secondary`}),O(f,`aria-label`,c[`aria-label`])}),h(r,a)};t(se,t=>{e(M)?t(ce):t(le,-1)}),h(a,B),r()}v([`click`,`keydown`]),v([`click`,`keydown`]);function Oe(){let e=new Map,t=new Map,n=(e,t)=>`${e}:${t}`;return{register(t,r,i){e.set(n(t,r),i)},get(t,r){return e.get(n(t,r))},has(t,r){return e.has(n(t,r))},getSlots(t){let n=`${t}:`;return Array.from(e.keys()).filter(e=>e.startsWith(n)).map(e=>e.slice(n.length))},getModules(){return Array.from(t.keys())},getModuleMeta(e){return t.get(e)},registerModule(e){t.set(e.name,e)},unregister(t,r){return e.delete(n(t,r))},clear(){e.clear(),t.clear()}}}var ke=Oe(),Ae=[`SmrtJunction`,`SmrtJunctionBase`,`SmrtPolymorphicAssociation`],je=[`Metafield`,`Metadata`,`Association`,`LineItem`,`Allocation`,`Revision`,`Attachment`,`Snapshot`,`Completion`,`Override`,`Alias`],Me=[`Status`,`Type`],Ne={"@happyvertical/smrt-commerce:TaxComponent":`lookup`,"@happyvertical/smrt-commerce:TaxSettings":`settings`,"@happyvertical/smrt-commerce:DocumentTax":`snapshot`,"@happyvertical/smrt-commerce:TaxSummaryReport":`report`},V=new Set([`foreignKey`,`crossPackageRef`]);function Pe(e){let t=e.id?Ne[e.id]:void 0;if(t)return t;let n=e.extends?.split(`:`).pop();if(n&&Ae.includes(n))return`junction`;let r=e.fields.filter(e=>!e.system),i=r.filter(e=>V.has(e.type)).length;return i>=2&&r.length-i<=1?`link`:je.some(t=>e.name.endsWith(t))?`child`:r.length<=3&&Me.some(t=>e.name.endsWith(t))?`lookup`:null}function Fe(e){return Pe(e)!==null}var Ie=new Set([`junction`,`link`,`child`]);function H(e,t){return e.includes(`:`)?e:`${t.slice(0,t.lastIndexOf(`:`))}:${e}`}function U(e,t){let n=[],r=e.get(t);for(;r&&!n.includes(r.id);)n.push(r.id),r=r.extends?e.get(H(r.extends,r.id)):void 0;return n}function Le(e,t){let n=e.packages.flatMap(e=>e.models),r=new Map(n.map(e=>[e.id,e])),i=new Set(U(r,t));return i.size?n.filter(e=>{if(i.has(e.id))return!1;let t=Pe(e);return!t||!Ie.has(t)?!1:e.fields.some(t=>V.has(t.type)&&t.related&&i.has(H(t.related,e.id)))}):[]}function Re(e,t){let n=e.fields.find(n=>V.has(n.type)&&n.related&&t.has(H(n.related,e.id)));return n?{model:e,fk:n.name}:void 0}function ze(e,t,n){let r=e.packages.flatMap(e=>e.models),i=new Map(r.map(e=>[e.id,e])),a=new Set(U(i,n));if(!a.size)return[];let o=t.filter(e=>e.models.includes(n));if(!o.length)return Le(e,n).flatMap(e=>{let t=Re(e,a);return t?[t]:[]});let s=new Map;for(let e of o){let t=new Set(e.nav.map(e=>e.model));for(let n of e.models){let e=i.get(n);if(!e||t.has(n)||a.has(n)||s.has(n))continue;let r=Re(e,a);r&&s.set(n,r)}}return[...s.values()]}function Be(e,t){let n=e.packages.flatMap(e=>e.models),r=new Map(n.map(e=>[e.id,e])),i=new Set(U(r,t));if(!i.size)return[];let a=[];for(let e of n)if(!i.has(e.id))for(let t of e.fields)V.has(t.type)&&t.related&&i.has(H(t.related,e.id))&&a.push({model:e,fk:t.name});return a}function Ve(e,t){let n=e.packages.flatMap(e=>e.models),r=new Map(n.map(e=>[e.id,e])),i=r.get(t);return i?i.fields.flatMap(e=>{if(!V.has(e.type)||!e.related)return[];let t=r.get(H(e.related,i.id));return t?[{model:t,fk:e.name}]:[]}):[]}function He(e,t){return e.some(e=>e.nav.some(e=>e.model===t))}function Ue(e,t){let n=e;for(let e of t)if(n.length>e.length&&n.startsWith(e)){n=n.slice(e.length);break}let r=n.replace(/([a-z0-9])([A-Z])/g,`$1 $2`).toLowerCase(),i=/[^aeiou]y$/.test(r)?`${r.slice(0,-1)}ies`:/(s|x|ch|sh)$/.test(r)?`${r}es`:`${r}s`;return i.charAt(0).toUpperCase()+i.slice(1)}function We(e,t){let n=e.packages.flatMap(e=>e.models),r=new Map(n.map(e=>[e.id,e]));return U(r,t).flatMap(e=>{let t=r.get(e);return t?[t.name]:[]})}function Ge(e,t,n){let r=We(e,t);return Le(e,t).filter(e=>n(e)&&r.some(t=>e.name.startsWith(t)))}function W(e){return e.group?.id??e.id}function Ke(e){let t=new Map;for(let n of e){let e=W(n),r=t.get(e);r?r.recipes.push(n):t.set(e,{id:e,label:n.group?.label??n.label,recipes:[n]})}return[...t.values()]}function G(e){return e.section??{id:W(e),label:e.group?.label??e.label}}function qe(e){let t=new Map;for(let n of e){let e=G(n),r=t.get(e.id);r?r.recipes.push(n):t.set(e.id,{...e,recipes:[n]})}return[...t.values()]}function Je(e){let t=new Set(e.map(e=>G(e).id)),n={};for(let r of e){let e=W(r),i=G(r).id;e!==i&&!t.has(e)&&(n[e]=i)}return n}function Ye(e,t,n){return`item:${e}:${t}${n?`:${n}`:``}`}function Xe(e,t){return e?.trim()||t.description?.trim()||`Your ${Ze(t.name)} records, all in one place.`}function Ze(e){return e.replace(/([a-z0-9])([A-Z])/g,`$1 $2`).toLowerCase()}var Qe={id:`more`,label:`More`,icon:`layers`,description:`Extra records you added one at a time.`},$e=`fileText`;function et(e){let t=e.description?.trim();if(t)return t.split(/(?<=[.!?])\s/)[0]??t;let n=e.fields.filter(e=>!e.system).length;return`${n} ${n===1?`field`:`fields`}`}function tt(e,t){let n=new Set(t.flatMap(e=>e.models));return e.packages.flatMap(t=>N(t).filter(e=>!n.has(e.id)).map(n=>({id:n.id,name:n.name,label:j(n.name),packageId:t.id,description:et(n),described:!!n.description?.trim(),plumbing:Fe(n),fieldNames:n.fields.map(e=>e.name),includes:Le(e,n.id).map(e=>j(e.name))})))}function nt(e){return e.described?e.description:`${j(e.packageId)} · ${e.description}`}function rt(e,t){return t?[...e]:e.filter(e=>!e.plumbing)}function it(e){return[...new Set(e.map(e=>e.packageId))]}function at(e,t,n){let r=t.toLowerCase().split(/\s+/).filter(Boolean);return e.filter(e=>{if(n&&e.packageId!==n)return!1;if(!r.length)return!0;let t=[e.name,e.label,e.description,e.packageId,...e.fieldNames].join(` `).toLowerCase();return r.every(e=>t.includes(e))})}function ot(e){return e.flatMap(e=>{let t=A(e);return t?.model.exposed?[{id:Ye(t.pkg.id,t.model.name),packageId:t.pkg.id,modelName:t.model.name,label:j(t.model.name),icon:$e,description:Xe(void 0,t.model)}]:[]})}var st={"@happyvertical/smrt-commerce:Customer":{profileId:`Links this customer to their profile record, where their name and contact details are kept.`,creditLimit:`The most this customer may owe you at one time. Leave it empty or at zero if you do not set limits.`,paymentTerms:`How long the customer has to pay, written the way you would say it, for example "Net 30".`,taxExempt:`Turn this on if you do not charge this customer sales tax.`,taxId:`The customer's tax or VAT number, kept on file for tax-exempt sales.`,defaultShippingAddress:`Where you usually send this customer's goods, so you do not retype it on every order.`,defaultBillingAddress:`Where you send this customer's invoices.`,status:`Whether this is a current customer, for example active or inactive.`,customerType:`The kind of customer, for example an individual or a business.`,notes:`Anything worth remembering about this customer.`},"@happyvertical/smrt-commerce:Vendor":{profileId:`Links this vendor to their profile record, where their name and contact details are kept.`,leadTimeDays:`How many days the vendor usually takes between your order and delivery.`,minimumOrderAmount:`The smallest order the vendor will accept.`,paymentTerms:`How long you have to pay this vendor, written the way you would say it, for example "Net 30".`,currency:`The currency this vendor bills you in.`,defaultContactEmail:`The email address you normally use to reach this vendor.`,defaultContactPhone:`The phone number you normally use to reach this vendor.`,status:`Whether you still buy from this vendor, for example active or inactive.`,notes:`Anything worth remembering about this vendor.`,payoutAddresses:`Where payments to this vendor should be sent.`},"@happyvertical/smrt-commerce:Order":{status:`Where the order stands, for example draft, accepted or completed.`,customerId:`The customer this order is for.`,subtotal:`The order amount before tax.`,taxAmount:`The tax charged on the order.`,totalAmount:`What the customer pays in all, tax included.`,currency:`The currency of the order's amounts.`,issueDate:`The date the order was placed.`,dueDate:`The date payment is expected. An order still open after this date counts as overdue.`,expiryDate:`The last day the order's price or offer is good for.`,reference:`Your own number or note for finding this order later, such as the customer's purchase order number.`,notes:`Anything worth remembering about this order.`,terms:`The conditions agreed with the customer, such as deposits, delivery or payment conditions.`,channelId:`Where the order came from, for example your shop or a marketplace.`},"@happyvertical/smrt-commerce:PurchaseOrder":{status:`Where the purchase stands, for example draft, accepted or completed.`,vendorId:`The vendor you are buying from.`,subtotal:`The order amount before tax.`,taxAmount:`The tax charged on the order.`,totalAmount:`What you pay in all, tax included.`,currency:`The currency of the order's amounts.`,issueDate:`The date you placed the order.`,dueDate:`The date the goods or the payment are due.`,expiryDate:`The last day the vendor's offer is good for.`,reference:`Your own number or note for finding this order later, such as the vendor's quote number.`,notes:`Anything worth remembering about this purchase.`,terms:`The conditions agreed with the vendor, such as payment or delivery conditions.`,channelId:`Where the order was placed, for example a vendor's website or a phone call.`},"@happyvertical/smrt-products:Product":{name:`What you call the product, as customers will see it.`,price:`What one costs, in dollars and cents.`,description:`A few words on what the product is and who it is for.`},"@happyvertical/smrt-products:ProductVariant":{productId:`The product this choice belongs to. Set for you when you save the product.`,axisName:`What the product varies by, for example size or color.`,allowedValues:`The values on offer for it, for example S, M and L.`},"@happyvertical/smrt-products:Sku":{productId:`The product this item is a version of. Set for you when you save the product.`,code:`The short code that identifies this exact size and color. Made for you from the product name.`,attributes:`Which size and color this item is. Set for you from the grid.`},"@happyvertical/smrt-inventory:StockLevel":{skuId:`The item being counted. Set for you when you save the product.`,locationId:`Where it is kept. New stock goes to the main warehouse.`,state:`Whether the count is available to sell. New stock starts as available.`,qty:`How many you have on hand.`},"@happyvertical/smrt-inventory:InventoryLocation":{code:`A short code for the place stock is kept, for example MAIN.`,name:`What you call the place, for example Main warehouse.`,kind:`What sort of place it is, for example a warehouse or a shop floor.`},"@happyvertical/smrt-commerce:Estimate":{status:`Where the estimate stands, for example draft, sent, accepted or completed.`,customerId:`The customer this estimate is for.`,subtotal:`The estimate amount before tax.`,taxAmount:`The tax charged on the estimate.`,totalAmount:`What the customer pays in all, tax included.`,currency:`The currency of the estimate's amounts.`,issueDate:`The date the estimate was issued or starts.`,dueDate:`The date payment is expected.`,expiryDate:`The last day the estimate is good for, or the day it ends.`,reference:`Your own number or note for finding this estimate later.`,notes:`Anything worth remembering about this estimate.`,terms:`The conditions agreed with the customer, such as deposits, delivery or payment conditions.`,channelId:`Where the estimate came from, for example your shop or a marketplace.`},"@happyvertical/smrt-commerce:WholesaleOrder":{status:`Where the wholesale order stands, for example draft, sent, accepted or completed.`,customerId:`The customer this wholesale order is for.`,subtotal:`The wholesale order amount before tax.`,taxAmount:`The tax charged on the wholesale order.`,totalAmount:`What the customer pays in all, tax included.`,currency:`The currency of the wholesale order's amounts.`,issueDate:`The date the wholesale order was issued or starts.`,dueDate:`The date payment is expected.`,expiryDate:`The last day the wholesale order is good for, or the day it ends.`,reference:`Your own number or note for finding this wholesale order later.`,notes:`Anything worth remembering about this wholesale order.`,terms:`The conditions agreed with the customer, such as deposits, delivery or payment conditions.`,channelId:`Where the wholesale order came from, for example your shop or a marketplace.`},"@happyvertical/smrt-commerce:Agreement":{status:`Where the agreement stands, for example draft, sent, accepted or completed.`,customerId:`The customer this agreement is for.`,subtotal:`The agreement amount before tax.`,taxAmount:`The tax charged on the agreement.`,totalAmount:`What the customer pays in all, tax included.`,currency:`The currency of the agreement's amounts.`,issueDate:`The date the agreement was issued or starts.`,dueDate:`The date payment is expected.`,expiryDate:`The last day the agreement is good for, or the day it ends.`,reference:`Your own number or note for finding this agreement later.`,notes:`Anything worth remembering about this agreement.`,terms:`The conditions agreed with the customer, such as deposits, delivery or payment conditions.`,channelId:`Where the agreement came from, for example your shop or a marketplace.`},"@happyvertical/smrt-commerce:Lease":{status:`Where the lease stands, for example draft, sent, accepted or completed.`,customerId:`The customer this lease is for.`,subtotal:`The lease amount before tax.`,taxAmount:`The tax charged on the lease.`,totalAmount:`What the customer pays in all, tax included.`,currency:`The currency of the lease's amounts.`,issueDate:`The date the lease was issued or starts.`,dueDate:`The date payment is expected.`,expiryDate:`The last day the lease is good for, or the day it ends.`,reference:`Your own number or note for finding this lease later.`,notes:`Anything worth remembering about this lease.`,terms:`The conditions agreed with the customer, such as deposits, delivery or payment conditions.`,channelId:`Where the lease came from, for example your shop or a marketplace.`},"@happyvertical/smrt-commerce:LicenseSale":{status:`Where the licence sale stands, for example draft, sent, accepted or completed.`,customerId:`The customer this licence sale is for.`,subtotal:`The licence sale amount before tax.`,taxAmount:`The tax charged on the licence sale.`,totalAmount:`What the customer pays in all, tax included.`,currency:`The currency of the licence sale's amounts.`,issueDate:`The date the licence sale was issued or starts.`,dueDate:`The date payment is expected.`,expiryDate:`The last day the licence sale is good for, or the day it ends.`,reference:`Your own number or note for finding this licence sale later.`,notes:`Anything worth remembering about this licence sale.`,terms:`The conditions agreed with the customer, such as deposits, delivery or payment conditions.`,channelId:`Where the licence sale came from, for example your shop or a marketplace.`},"@happyvertical/smrt-commerce:Contract":{status:`Where the contract stands, for example draft, sent, accepted or completed.`,subtotal:`The contract amount before tax.`,taxAmount:`The tax charged on the contract.`,totalAmount:`What the customer pays in all, tax included.`,currency:`The currency of the contract's amounts.`,issueDate:`The date the contract was issued or starts.`,dueDate:`The date payment is expected.`,expiryDate:`The last day the contract is good for, or the day it ends.`,reference:`Your own number or note for finding this contract later.`,notes:`Anything worth remembering about this contract.`,terms:`The conditions agreed with the customer, such as deposits, delivery or payment conditions.`,channelId:`Where the contract came from, for example your shop or a marketplace.`,contractType:`The kind of contract: order, estimate, lease, agreement and so on.`},"@happyvertical/smrt-commerce:ContractLineItem":{contractId:`The order, quote or agreement this line belongs to.`,description:`What is being sold or bought on this line.`,quantity:`How many.`,unitPrice:`The price of one, before tax.`,taxRate:`The tax rate for this line, as a percentage (5 means 5%).`,amount:`The line total.`,productId:`The product this line is for, if it is one you list.`},"@happyvertical/smrt-inventory:StockMovement":{skuId:`The item that moved.`,locationId:`The place it moved at.`,fromState:`What it was before, for example available or damaged.`,toState:`What it became.`,qty:`How many moved.`,reasonCode:`Why it moved, for example adjustment, sale or return.`,note:`Anything worth remembering about this movement.`,occurredAt:`When it happened.`},"@happyvertical/smrt-commerce:Invoice":{customerId:`The customer being billed.`,contractId:`The order or agreement this invoice bills for, if any.`,invoiceNumber:`The number printed on the invoice.`,issueDate:`The date the invoice was issued.`,dueDate:`The date payment is expected.`,paidDate:`The date it was paid in full.`,subtotal:`The amount before tax.`,taxAmount:`The tax charged.`,totalAmount:`What the customer owes in all, tax included.`,amountPaid:`How much of the total has been paid so far.`,currency:`The currency of the invoice.`,status:`Where the invoice stands: draft, sent, viewed, paid, overdue or cancelled.`,notes:`Private notes, not shown to the customer.`,customerNotes:`A message shown to the customer on the invoice.`,terms:`The payment conditions, such as Net 30.`},"@happyvertical/smrt-commerce:InvoiceLineItem":{invoiceId:`The invoice this line belongs to.`,description:`What is being billed on this line.`,quantity:`How many.`,unitPrice:`The price of one, before tax.`,taxRate:`The tax rate for this line, as a percentage (5 means 5%).`,amount:`The line total.`},"@happyvertical/smrt-commerce:Payment":{contractId:`The order or agreement this payment is for, if any.`,customerId:`The customer who paid.`,amount:`How much was paid.`,currency:`The currency of the payment.`,method:`How it was paid: cash, check, card, bank transfer or other.`,status:`Whether the payment is pending, completed, failed or refunded.`,reference:`Your own note, such as a check number.`,paidAt:`When the money was received.`,notes:`Anything worth remembering about this payment.`},"@happyvertical/smrt-commerce:PaymentAllocation":{paymentId:`The payment being applied.`,invoiceId:`The invoice it settles.`,amount:`How much of the payment goes to this invoice.`,allocatedAt:`When it was applied.`,notes:`Anything worth remembering about this allocation.`},"@happyvertical/smrt-commerce:Fulfillment":{contractId:`The order being fulfilled.`,fulfillmentType:`How it gets to the customer: shipment, delivery, pickup, digital or service.`,status:`Where it stands: pending, processing, shipped, delivered or cancelled.`,trackingNumber:`The carrier's tracking number.`,carrier:`The company carrying it.`,shippedAt:`When it left you.`,deliveredAt:`When it arrived.`,notes:`Anything worth remembering about this shipment.`},"@happyvertical/smrt-commerce:FulfillmentLineItem":{fulfillmentId:`The shipment this line belongs to.`,contractLineItemId:`The order line being sent.`,quantityFulfilled:`How many of that line are in this shipment.`},"@happyvertical/smrt-ledgers:Account":{number:`The account number in your chart of accounts.`,name:`What the account is called.`,description:`What the account is used for.`,type:`asset, liability, equity, revenue or expense.`,active:`Turn this off to stop using the account without deleting it.`},"@happyvertical/smrt-ledgers:Journal":{number:`The journal's reference number.`,date:`The date of the transaction.`,description:`What the transaction was.`,status:`draft while you work on it, posted once final, or voided.`,postedAt:`When it was posted.`},"@happyvertical/smrt-ledgers:JournalEntry":{journalId:`The journal this entry belongs to.`,accountId:`The account this entry changes.`,debit:`The amount debited. Leave zero on a credit.`,credit:`The amount credited. Leave zero on a debit.`,currency:`The currency of the amounts.`,memo:`A note on this entry.`},"@happyvertical/smrt-projects:Project":{title:`The project's name.`,description:`What the project is about.`,owner:`Who owns or runs the project.`,url:`A link to the project elsewhere.`},"@happyvertical/smrt-projects:Issue":{projectId:`The project this issue belongs to.`,title:`A short summary of the issue.`,body:`The full description.`,state:`open or closed.`,author:`Who raised the issue.`,labels:`The labels attached to the issue.`,assignees:`The people working on it.`},"@happyvertical/smrt-projects:Label":{projectId:`The project this label belongs to.`,name:`The label's name, for example bug.`,color:`The label's colour.`,description:`What the label means.`},"@happyvertical/smrt-projects:Comment":{issueId:`The issue this comment is on.`,body:`The comment text.`,author:`Who wrote it.`},"@happyvertical/smrt-events:Event":{name:`What the event is called.`,seriesId:`The series this event is part of, if any.`,typeId:`The kind of event.`,placeId:`Where it takes place.`,description:`What the event is about.`,startDate:`When it starts.`,endDate:`When it ends.`,allDay:`Turn this on for an event that lasts all day.`,status:`scheduled, in progress, completed, cancelled or postponed.`},"@happyvertical/smrt-events:EventType":{name:`What this kind of event is called, for example workshop.`,description:`What this kind of event is for.`},"@happyvertical/smrt-events:EventSeries":{name:`What the series is called.`,typeId:`The kind of event in this series.`,organizerId:`Who runs the series.`,description:`What the series is about.`,startDate:`When the series begins.`,endDate:`When the series ends.`,recurrence:`How often it repeats.`},"@happyvertical/smrt-events:EventParticipant":{eventId:`The event the person takes part in.`,profileId:`The person taking part.`,role:`What they do there, for example speaker or attendee.`},"@happyvertical/smrt-sales:Lead":{name:`What you call this lead.`,contactName:`The person to talk to.`,email:`Their email address.`,phone:`Their phone number.`,organizationName:`The company they are with.`,ownerRepId:`The sales representative who owns this lead.`,status:`Where the lead stands, for example new or qualified.`},"@happyvertical/smrt-sales:Opportunity":{name:`What you call this deal.`,leadId:`The lead it came from.`,ownerRepId:`The sales representative who owns this deal.`,pipelineId:`The pipeline it moves through.`,stageId:`The stage it is at now.`,expectedValueCents:`What you expect the deal to be worth, in cents.`,currency:`The currency of that value.`,probability:`How likely it is to close, as a decimal (0.5 is 50%).`,expectedCloseAt:`When you expect it to close.`,status:`open, won or lost.`},"@happyvertical/smrt-sales:PipelineDefinition":{key:`A short code for the pipeline.`,name:`What the pipeline is called.`,isDefault:`Turn this on to use it for new deals.`,status:`Whether the pipeline is in use.`,metadata:`Extra details kept with the pipeline.`},"@happyvertical/smrt-sales:PipelineStage":{pipelineId:`The pipeline this stage belongs to.`,key:`A short code for the stage.`,name:`What the stage is called.`,sortOrder:`Where it comes in the pipeline.`,probability:`How likely a deal at this stage is to close, as a decimal.`,isWon:`Turn this on for the stage that means the deal is won.`,isLost:`Turn this on for the stage that means the deal is lost.`},"@happyvertical/smrt-sales:SalesActivity":{subjectKind:`What the activity is about: a lead or an opportunity.`,subjectId:`The lead or opportunity it is about.`,activityKind:`The kind of activity, for example call, note or email.`,summary:`What happened or what needs doing.`,dueAt:`When it is due.`,completedAt:`When it was done.`}};function ct(e,t){let n=new Map(e.map(e=>[e.id,e])),r=[...Object.keys(t.recipes),...t.order].filter(e=>!n.has(e));if(r.length>0)throw Error(`Recipes only declared locally, not in a smrt package: ${[...new Set(r)].join(`, `)}`);let i=[...t.order,...e.map(e=>e.id).filter(e=>!t.order.includes(e))];return[...new Set(i)].map(e=>{let r=n.get(e),i=t.recipes[e];return i?{...r,...i}:r})}var lt={order:[`commerce.customers`,`commerce.purchases`,`commerce.sales`,`commerce.vendors`,`inventory.stock`,`products.simple`,`products.clothing`,`products.ingredients`,`commerce.estimates`,`commerce.wholesale`,`commerce.invoicing`,`commerce.fulfillment`,`commerce.agreements`,`commerce.leases`,`commerce.licenses`,`ledgers.bookkeeping`,`projects.tracker`,`events.calendar`,`sales.pipeline`],recipes:{"commerce.customers":{forms:[{id:`customer.default`,kind:`field-map`,label:`Customer`,kindLabel:`Customer`,model:`@happyvertical/smrt-commerce:Customer`,records:[{as:`profileType`,model:`@happyvertical/smrt-profiles:ProfileType`,match:{name:`Customer`}},{as:`profile`,model:`@happyvertical/smrt-profiles:Profile`,match:{id:{ref:`customer`,field:`profileId`}},values:{typeId:{ref:`profileType`}}},{as:`customer`,model:`@happyvertical/smrt-commerce:Customer`,values:{profileId:{ref:`profile`}}}],fields:[{id:`name`,label:`Name`,to:`profile.name`,required:!0},{id:`email`,label:`Email`,to:`profile.email`},{id:`status`,label:`Status`,to:`customer.status`,default:`active`},{id:`customerType`,label:`Customer type`,to:`customer.customerType`,default:`dtc`},{id:`paymentTerms`,label:`Payment terms`,to:`customer.paymentTerms`},{id:`creditLimit`,label:`Credit limit`,to:`customer.creditLimit`},{id:`taxExempt`,label:`Tax exempt`,to:`customer.taxExempt`},{id:`taxId`,label:`Tax ID`,to:`customer.taxId`},{id:`shippingAddress`,label:`Shipping address`,to:`customer.defaultShippingAddress`},{id:`billingAddress`,label:`Billing address`,to:`customer.defaultBillingAddress`},{id:`notes`,label:`Notes`,to:`customer.notes`}]}]},"commerce.vendors":{forms:[{id:`vendor.default`,kind:`field-map`,label:`Vendor`,kindLabel:`Vendor`,model:`@happyvertical/smrt-commerce:Vendor`,records:[{as:`profileType`,model:`@happyvertical/smrt-profiles:ProfileType`,match:{name:`Vendor`}},{as:`profile`,model:`@happyvertical/smrt-profiles:Profile`,match:{id:{ref:`vendor`,field:`profileId`}},values:{typeId:{ref:`profileType`}}},{as:`vendor`,model:`@happyvertical/smrt-commerce:Vendor`,values:{profileId:{ref:`profile`}}}],fields:[{id:`name`,label:`Name`,to:`profile.name`,required:!0},{id:`email`,label:`Email`,to:`profile.email`},{id:`status`,label:`Status`,to:`vendor.status`,default:`active`},{id:`currency`,label:`Currency`,to:`vendor.currency`,default:`USD`},{id:`paymentTerms`,label:`Payment terms`,to:`vendor.paymentTerms`},{id:`leadTimeDays`,label:`Lead time (days)`,to:`vendor.leadTimeDays`},{id:`minimumOrderAmount`,label:`Minimum order`,to:`vendor.minimumOrderAmount`},{id:`contactEmail`,label:`Contact email`,to:`vendor.defaultContactEmail`},{id:`contactPhone`,label:`Contact phone`,to:`vendor.defaultContactPhone`},{id:`notes`,label:`Notes`,to:`vendor.notes`},{id:`payoutAddresses`,label:`Payout addresses`,to:`vendor.payoutAddresses`}]}]},"inventory.stock":{extends:[{form:`product.simple`,records:[{as:`sku`,model:`@happyvertical/smrt-products:Sku`,match:{productId:{ref:`product`}},values:{code:`{product.name|slug}`,name:`{product.name}`,attributes:`{}`,active:!0}},{as:`location`,model:`@happyvertical/smrt-inventory:InventoryLocation`,match:{code:`MAIN`},values:{name:`Main warehouse`,kind:`warehouse`}},{as:`stock`,model:`@happyvertical/smrt-inventory:StockLevel`,match:{skuId:{ref:`sku`},locationId:{ref:`location`},state:`available`}}],fields:[{id:`quantity`,label:`Quantity`,to:`stock.qty`,default:0}]},{form:`product.clothing`,records:[{as:`location`,model:`@happyvertical/smrt-inventory:InventoryLocation`,match:{code:`MAIN`},values:{name:`Main warehouse`,kind:`warehouse`}},{as:`stock`,model:`@happyvertical/smrt-inventory:StockLevel`,match:{skuId:{ref:`sku`},locationId:{ref:`location`},state:`available`}}],fields:[{id:`quantity`,label:`Quantity`,to:`stock.qty`,default:0}]}]},"products.simple":{forms:[{id:`product.simple`,kind:`field-map`,label:`Simple product`,kindLabel:`Simple`,model:`@happyvertical/smrt-products:Product`,records:[{as:`product`,model:`@happyvertical/smrt-products:Product`}],fields:[{id:`name`,label:`Name`,to:`product.name`,required:!0},{id:`price`,label:`Price`,to:`product.price`},{id:`description`,label:`Description`,to:`product.description`}]}]},"products.clothing":{forms:[{id:`product.clothing`,kind:`variant-grid`,label:`Clothing item`,kindLabel:`Clothing`,model:`@happyvertical/smrt-products:Product`,product:{as:`product`,model:`@happyvertical/smrt-products:Product`},fields:[{id:`name`,label:`Name`,to:`product.name`,required:!0},{id:`price`,label:`Price`,to:`product.price`}],axes:[{name:`size`,label:`Sizes`,values:[`XS`,`S`,`M`,`L`,`XL`]},{name:`color`,label:`Colors`,values:[]}],variants:`@happyvertical/smrt-products:ProductVariant`,skus:`@happyvertical/smrt-products:Sku`}]}}};function ut(e){return e.fields.filter(e=>!e.system)}var dt=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1_$2`).toLowerCase();function ft(e,t){return/Type$/.test(t.name)&&Array.isArray(t.enum)&&t.enum.length>0&&!!e.extends&&t.enum.includes(dt(e.name))}function pt(e){return e.some(e=>e.ui?.basic===!0)}function mt(e){return e!=null&&e!==``}function ht(e){if(e==null)return null;try{return{value:JSON.parse(e)}}catch{return null}}function K(e,t,n=[]){let r=ut(e),i=pt(r),a=new Map(n.filter(t=>t.objectRef===e.id).map(e=>[e.fieldName,e]));return r.map((n,r)=>{let o=t?.fields?.[n.name]??{},s=ft(e,n),c=o.visibility??(s?`hidden`:!i||n.ui?.basic===!0?`basic`:`advanced`),l=o.label??M(n),u=o.help??null,d=o.order??n.ui?.order??r,f=o.locked??n.ui?.locked??s,p=dt(e.name),m=n.default===void 0?s&&n.enum?.includes(p)?p:void 0:n.default,h=`default`in o||m!==void 0,g=`default`in o?o.default:m,_=a.get(n.name);if(_&&(!f||_.locked===!1)){_.visibility&&(c=_.visibility),_.label&&(l=_.label),_.help!==void 0&&(u=_.help||null),typeof _.displayOrder==`number`&&(d=_.displayOrder);let e=ht(_.defaultValue);e&&(h=!0,g=e.value),typeof _.locked==`boolean`&&(f=_.locked)}let v,y=o.required??n.required;return y&&c!==`basic`&&!(h&&mt(g))&&(c=`basic`,v=!0),{field:n,visibility:c,label:l,help:u,order:d,group:n.ui?.group??null,locked:f,required:y,hasDefault:h,default:g,...v?{visibilityForced:v}:{}}}).map((e,t)=>({entry:e,index:t})).sort((e,t)=>e.entry.order-t.entry.order||e.index-t.index).map(({entry:e})=>e)}function gt(e){return typeof e==`string`||typeof e==`number`||typeof e==`boolean`||e===null?e:void 0}function _t(e){return e.filter(e=>e.visibility===`basic`).map(e=>{let{default:t,...n}=e.field,r=e.hasDefault?gt(e.default):void 0;return{...n,required:e.required,...r===void 0?{}:{default:r},label:e.label,...e.help?{help:e.help}:{}}})}function vt(e){let t={};for(let n of e)n.visibility!==`basic`&&n.hasDefault&&n.default!==void 0&&(t[n.field.name]=n.default);return t}var yt=[`api`,`mcp`,`cli`],bt={api:`REST`,mcp:`MCP`,cli:`CLI`};function xt(e,t){return(t===`api`?e.rest.length:t===`mcp`?e.mcp.length:e.cli.length)>0}function q(e,t,n=[]){let r={};for(let i of yt){let a=xt(e,i),o=t?.exposure?.[i]===!1;r[i]={available:a,on:a&&!o&&!n.includes(i),locked:!a||o}}return r}function St(e,t){let n=t.mcp.on;return{...e,rest:t.api.on?e.rest:[],mcp:n?e.mcp:[],cli:t.cli.on?e.cli:[],methods:e.methods.map(e=>({...e,aiCallable:e.aiCallable&&n}))}}function Ct(e,t,n=[]){return K(e,t,n).filter(e=>t?.fields?.[e.field.name]?.visibility!==`hidden`)}function wt(e){return e.required||e.locked}function Tt(e,t,n,r){let i={};for(let r of Ct(e,t,n))i[r.field.name]={use:r.visibility===`basic`,label:r.label,help:r.help??``,default:r.hasDefault?r.default:null,order:r.order};let a=q(e,t,r);return{fields:i,exposure:{api:a.api.on,mcp:a.mcp.on,cli:a.cli.on}}}var Et=(e,t)=>JSON.stringify(e??null)===JSON.stringify(t??null);function Dt(e,t,n){let r=Ct(e,t),i=[];for(let t of r){let r=n.fields[t.field.name];if(!r||t.locked)continue;let a={objectRef:e.id,fieldName:t.field.name,scopeType:`app`},o=wt(t)?!0:r.use;o!==(t.visibility===`basic`)&&(a.visibility=o?`basic`:`hidden`),r.label.trim()&&r.label!==t.label&&(a.label=r.label.trim()),r.help!==(t.help??``)&&(a.help=r.help||null),Et(r.default,t.hasDefault?t.default:null)||(a.defaultValue=JSON.stringify(r.default??null)),r.order!==t.order&&(a.displayOrder=r.order),Object.keys(a).length>3&&i.push(a)}return i}function Ot(e,t,n){let r=q(e,t);return yt.filter(e=>r[e].on&&!n.exposure[e])}var kt=st,J=ct(ie.packages.flatMap(e=>e.recipes??[]),lt),At=new Map(J.map(e=>[e.id,e]));function jt(e){return At.get(e)}var Y=At,Mt=Ke(J);function Nt(e){return Mt.find(t=>t.id===e)}function Pt(e){let t=e.models[0];return t?A(t)?.pkg:void 0}function Ft(e){return e.nav.flatMap(e=>{let t=A(e.model);return t?[{label:e.label,icon:e.icon??`fileText`,description:Xe(e.description,t.model),...e.key?{key:e.key}:{},...e.noun?{noun:e.noun}:{},...e.filter?{filter:e.filter}:{},model:t.model,packageId:t.pkg.id}]:[]})}function It(e,t,n){return J.some(r=>Ft(r).some(r=>r.key===n&&r.packageId===e&&r.model.name===t))}function Lt(e){return`/m/${e.packageId}/${e.model.name}/${e.key?`${e.key}/`:``}`}function Rt(e){return e.models.flatMap(e=>{let t=A(e);return t?[{model:t.model,packageId:t.pkg.id}]:[]})}function zt(e,t=[]){let n=e.nav.length>0;return Rt(e).map(({model:r})=>({id:r.id,name:r.name,...n?{}:{glossary:!1},descriptions:{...Object.fromEntries(r.fields.flatMap(e=>e.description?[[e.name,e.description]]:[])),...kt[r.id]},fields:K(r,e.options?.[r.id],t).map(e=>({name:e.field.name,label:e.label,help:e.help,visibility:e.visibility}))}))}function Bt(e){return[...new Set(e)].sort()}function X(e,t){let n=new Set,r=e=>{let i=t.get(e);if(i&&!n.has(e)){n.add(e);for(let e of i.requires)r(e)}};for(let t of e)r(t);let i=!0;for(;i;){i=!1;for(let e of[...n])for(let a of t.get(e)?.requiresAny??[]){if(a.some(e=>n.has(e)))continue;let e=a.find(e=>t.has(e));e&&(r(e),i=!0)}}return Bt(n)}function Vt(e,t,n){let r=new Set(e),i=t.filter(e=>!r.has(e)),a=new Set(i);return i.filter(e=>{let t=n.get(e);return t?t.requires.some(e=>r.has(e))?!0:(t.requiresAny??[]).some(e=>e.some(e=>r.has(e))&&!e.some(e=>a.has(e))):!1})}function Ht(e,t,n){return Vt([e],t,n)}function Ut(e,t){return Bt([...e].filter(e=>t.has(e)))}var Wt={currency:`USD`,taxRate:0,paymentTerms:``,pricesIncludeTax:!1,taxRounding:`line`},Z=`@happyvertical/smrt-commerce:`,Q={currency:[`Order`,`PurchaseOrder`,`WholesaleOrder`,`Estimate`,`Invoice`,`Agreement`,`Lease`].map(e=>({model:`${Z}${e}`,field:`currency`})),taxRate:[`InvoiceLineItem`,`ContractLineItem`].map(e=>({model:`${Z}${e}`,field:`taxRate`})),paymentTerms:[...[`Order`,`WholesaleOrder`,`Estimate`,`Invoice`,`Agreement`,`Lease`].map(e=>({model:`${Z}${e}`,field:`terms`})),{model:`${Z}Customer`,field:`paymentTerms`}],pricesIncludeTax:[`Invoice`,`Contract`].map(e=>({model:`${Z}${e}`,field:`lineAmountType`})),taxRounding:[`Invoice`,`Contract`].map(e=>({model:`${Z}${e}`,field:`taxRoundingScope`}))};function Gt(e){return Object.values(Q).some(t=>t.some(t=>t.model===e.objectRef&&t.field===e.fieldName))}var Kt=Object.keys(Q);function qt(e){if(e?.defaultValue!==void 0&&e.defaultValue!==null)try{return JSON.parse(e.defaultValue)}catch{return}}function Jt(e,t,n){return e.find(e=>e.scopeType===`app`&&e.objectRef===t&&e.fieldName===n)}function Yt(e){let t={...Wt},n=(t,n)=>{for(let{model:r,field:i}of Q[t]){let t=qt(Jt(e.policies,r,i));if(typeof t===n)return t}},r=n(`currency`,`string`),i=n(`taxRate`,`number`),a=n(`paymentTerms`,`string`),o=n(`pricesIncludeTax`,`string`),s=n(`taxRounding`,`string`);return typeof r==`string`&&(t.currency=r),typeof i==`number`&&(t.taxRate=i),typeof a==`string`&&(t.paymentTerms=a),(o===`inclusive`||o===`exclusive`)&&(t.pricesIncludeTax=o===`inclusive`),(s===`line`||s===`document`)&&(t.taxRounding=s),t}function Xt(e){return Q.taxRate.some(({model:t,field:n})=>typeof qt(Jt(e.policies,t,n))==`number`)}function Zt(e,t,n){let r=A(t)?.model;if(!r)return;let i=K(r,e.recipes.map(e=>Y.get(e)?.options?.[t]).find(Boolean),[]).find(e=>e.field.name===n);return i?.hasDefault?i.default:void 0}var Qt=e=>e==null||e===``;function $t(e,t){let n=e.policies.map(e=>({...e}));for(let r of Kt){let i=t[r],a=r===`paymentTerms`?String(i).trim():r===`currency`?String(i).trim().toUpperCase():r===`pricesIncludeTax`?i?`inclusive`:`exclusive`:i;for(let{model:t,field:i}of Q[r]){let o=Zt(e,t,i),s=!Qt(a)&&!(!Qt(o)&&o===a)&&!(Qt(o)&&r===`taxRate`&&a===0),c=Jt(n,t,i);if(s){let e=JSON.stringify(a);c?c.defaultValue=e:n.push({objectRef:t,fieldName:i,scopeType:`app`,defaultValue:e})}else c&&(delete c.defaultValue,Object.keys(c).length<=3&&(n=n.filter(e=>e!==c)))}}return{...e,policies:n}}function en(e){return{...Wt,...e}}var tn=()=>({ids:[],rows:[],narrowed:{},features:[],unavailableRecipes:[],unavailableFeatures:[]});function $(e){let t=new Set([...e.ids.flatMap(e=>Y.get(e)?.models??[]),...e.features]);return{...e,rows:e.rows.filter(e=>t.has(e.objectRef)||Gt(e)),narrowed:Object.fromEntries(Object.entries(e.narrowed).filter(([e])=>t.has(e)))}}var nn=(e,t)=>({...e,ids:X([...e.ids,...t],Y)});function rn(e,t){let n=new Set(t),r=e.ids.filter(e=>!n.has(e));return $({...e,ids:X(r,Y)})}var an=(e,t)=>e.features.includes(t)?e:{...e,features:[...e.features,t].sort()},on=(e,t)=>$({...e,features:e.features.filter(e=>e!==t)}),sn=(e,t)=>Ht(t,e.ids,Y);function cn(e,t){for(let n of e.ids){let e=Y.get(n)?.options?.[t];if(e)return e}}function ln(e,t,n,r){let i={...e.narrowed};return r.length?i[t]=[...r]:delete i[t],{...e,rows:[...e.rows.filter(e=>e.objectRef!==t),...n],narrowed:i}}function un(e){let t=[...e.rows].sort((e,t)=>e.objectRef.localeCompare(t.objectRef)||e.fieldName.localeCompare(t.fieldName)),n=Object.fromEntries(Object.keys(e.narrowed).sort().filter(t=>e.narrowed[t].length).map(t=>[t,[...e.narrowed[t]].sort()])),r={recipes:[...e.ids,...e.unavailableRecipes].sort(),features:[...e.features,...e.unavailableFeatures].sort(),policies:t.map(e=>({...e}))};return Object.keys(n).length&&(r.exposure=n),r}function dn(e){let t=[...new Set(e.features)],n=e=>!!A(e)?.model.exposed;return $({ids:X(e.recipes,Y),rows:e.policies.map(e=>({...e})),narrowed:Object.fromEntries(Object.entries(e.exposure??{}).map(([e,t])=>[e,[...t]])),features:t.filter(n).sort(),unavailableRecipes:[...new Set(e.recipes.filter(e=>!Y.has(e)))].sort(),unavailableFeatures:t.filter(e=>!n(e)).sort()})}var fn=new class{#e=b(C([]));get ids(){return e(this.#e)}set ids(e){k(this.#e,e,!0)}#t=b(C([]));get rows(){return e(this.#t)}set rows(e){k(this.#t,e,!0)}#n=b(C({}));get narrowed(){return e(this.#n)}set narrowed(e){k(this.#n,e,!0)}#r=b(C([]));get features(){return e(this.#r)}set features(e){k(this.#r,e,!0)}#i=b(C([]));get unavailableRecipes(){return e(this.#i)}set unavailableRecipes(e){k(this.#i,e,!0)}#a=b(C([]));get unavailableFeatures(){return e(this.#a)}set unavailableFeatures(e){k(this.#a,e,!0)}get data(){return{ids:this.ids,rows:this.rows,narrowed:this.narrowed,features:this.features,unavailableRecipes:this.unavailableRecipes,unavailableFeatures:this.unavailableFeatures}}set(e){this.ids=e.ids,this.rows=e.rows,this.narrowed=e.narrowed,this.features=e.features,this.unavailableRecipes=e.unavailableRecipes,this.unavailableFeatures=e.unavailableFeatures}removeUnavailable(){this.unavailableRecipes=[],this.unavailableFeatures=[]}hasFeature(e){return this.features.includes(e)}addFeature(e){this.set(an(this.data,e))}removeFeature(e){this.set(on(this.data,e))}has(e){return this.ids.includes(e)}requiredBy(e){return sn(this.data,e)}add(...e){this.set(nn(this.data,e))}remove(...e){this.set(rn(this.data,e))}toggle(e){this.has(e)?this.remove(e):this.add(e)}clear(){this.set(tn())}hintsFor(e){return cn(this,e)}apply(e){let t=this.hintsFor(e.id),n=K(e,t,this.rows);return{model:St(e,q(e,t,this.narrowed[e.id]??[])),resolved:n,fields:_t(n),background:vt(n)}}save(e,t,n){this.set(ln(this.data,e,t,n))}reset(e){this.save(e,[],[])}snapshot(){return un(this.data)}load(e){this.set(dn(e))}};export{he as $,Dt as A,Ye as B,yt as C,wt as D,Ct as E,nt as F,Ve as G,W as H,at as I,Ge as J,He as K,rt as L,tt as M,ot as N,Ot as O,it as P,De as Q,qe as R,Mt as S,Tt as T,ze as U,G as V,Ue as W,Be as X,We as Y,ke as Z,Rt as _,Gt as a,J as b,$t as c,X as d,R as et,jt as f,Lt as g,zt as h,Xt as i,Qe as j,q as k,Ut as l,It as m,un as n,Yt as o,Nt as p,Fe as q,Q as r,en as s,fn as t,Vt as u,Ft as v,bt as w,Y as x,Pt as y,Je as z};
@@ -1 +1 @@
1
- import{$ as e,Ct as t,Dt as n,E as r,Ft as i,G as a,Ot as o,U as s,a as c,ft as l,ht as u,st as d,v as f}from"./DG3qFFTE.js";import"./xihTtKlq.js";import{t as p}from"./BG9Gz_25.js";import{et as m}from"./CtjBwCj8.js";var h=a(`<div><a class="svelte-1fbsd8p"><!></a> <a class="svelte-1fbsd8p"><!></a></div>`);function g(a,g){o(g,!0);let _=c(g,`compact`,3,!1),v=t(()=>`${p(`/recipes/${g.section}/help/`)}${g.helpAnchor?`#${g.helpAnchor}`:``}`);var y=h();let b;var x=l(y),S=l(x);{let n=t(()=>_()?16:22);m(S,{path:`M11 18h2v-2h-2v2zm1-16C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8zm0-14c-2.21 0-4 1.79-4 4h2c0-1.1.9-2 2-2s2 .9 2 2c0 2-3 1.75-3 5h2c0-2.25 3-2.5 3-5 0-2.21-1.79-4-4-4z`,get size(){return e(n)}})}i(x);var C=u(x,2),w=l(C);{let n=t(()=>_()?16:22);m(w,{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`,get size(){return e(n)}})}i(C),i(y),d(t=>{b=r(y,1,`icons svelte-1fbsd8p`,null,b,{compact:_()}),f(x,`href`,e(v)),f(x,`title`,`${g.label} help`),f(x,`aria-label`,`${g.label} help`),f(x,`aria-current`,g.current===`help`?`page`:void 0),f(C,`href`,t),f(C,`title`,`${g.label} options`),f(C,`aria-label`,`${g.label} options`),f(C,`aria-current`,g.current===`options`?`page`:void 0)},[()=>p(`/recipes/${g.section}/`)]),s(a,y),n()}export{g as t};
1
+ import{$ as e,Ct as t,Dt as n,E as r,Ft as i,G as a,Ot as o,U as s,a as c,ft as l,ht as u,st as d,v as f}from"./DG3qFFTE.js";import"./xihTtKlq.js";import{t as p}from"./CoXf-L_3.js";import{et as m}from"./B7d7dGCP.js";var h=a(`<div><a class="svelte-1fbsd8p"><!></a> <a class="svelte-1fbsd8p"><!></a></div>`);function g(a,g){o(g,!0);let _=c(g,`compact`,3,!1),v=t(()=>`${p(`/recipes/${g.section}/help/`)}${g.helpAnchor?`#${g.helpAnchor}`:``}`);var y=h();let b;var x=l(y),S=l(x);{let n=t(()=>_()?16:22);m(S,{path:`M11 18h2v-2h-2v2zm1-16C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8zm0-14c-2.21 0-4 1.79-4 4h2c0-1.1.9-2 2-2s2 .9 2 2c0 2-3 1.75-3 5h2c0-2.25 3-2.5 3-5 0-2.21-1.79-4-4-4z`,get size(){return e(n)}})}i(x);var C=u(x,2),w=l(C);{let n=t(()=>_()?16:22);m(w,{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`,get size(){return e(n)}})}i(C),i(y),d(t=>{b=r(y,1,`icons svelte-1fbsd8p`,null,b,{compact:_()}),f(x,`href`,e(v)),f(x,`title`,`${g.label} help`),f(x,`aria-label`,`${g.label} help`),f(x,`aria-current`,g.current===`help`?`page`:void 0),f(C,`href`,t),f(C,`title`,`${g.label} options`),f(C,`aria-label`,`${g.label} options`),f(C,`aria-current`,g.current===`options`?`page`:void 0)},[()=>p(`/recipes/${g.section}/`)]),s(a,y),n()}export{g as t};
@@ -1 +1 @@
1
- import{t as e}from"./BhU_yBI_.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
+ import{t as e}from"./GVQNHDp5.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 +1 @@
1
- import{$ as e,Et as t,Mt as n,bt as r,vt as i}from"./DG3qFFTE.js";import"./xihTtKlq.js";import{I as a,K as o,L as s,O as c,U as l,W as u,_ as d,dt as f,ft as p,h as m,lt as h,p as g,st as _,x as v}from"./BG9Gz_25.js";import{g as y}from"./Bsn3IIve.js";import"./M-CuJzQN.js";import"./9pRTae44.js";import{u as b}from"./Cga8zF3r.js";import{A as x,C as S,D as C,E as w,F as ee,M as T,N as te,S as ne,T as re,_ as ie,b as ae,d as oe,g as se,h as ce,j as le,n as ue,r as de,v as fe,w as pe,x as me,y as he}from"./CyUSxz1P.js";import{B as ge,G as _e,J as ve,R as ye,V as be,W as xe,X as Se,Y as Ce,a as we,b as E,c as Te,d as Ee,i as De,j as Oe,l as ke,n as Ae,o as je,q as Me,t as D,v as Ne,x as O,z as Pe}from"./CtjBwCj8.js";function Fe(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 k(e,t){let n=Fe(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 A(e){let t;return()=>(t??=e(),t)}function Ie(e){return typeof e==`object`&&!!e&&`default`in e&&!!e.default}function Le(e,t,n){let r=A(()=>k(e.export,t)),i=e.optionsEditor?A(()=>k(e.optionsEditor,t)):void 0,a=e.data?.load?A(()=>k(e.data?.load,t)):void 0,o={type:e.type,title:e.label,options:e.options??[],loadComponent:async()=>{let e=await r();return Ie(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 Ie(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 Re(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 k(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(Le(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 ze=[`identifier`,`status`,`date`,`party`,`total`,`money`];function Be(e){for(let t of[`identifier`,`status`,`date`,`money`,`quantity`,`party`,`title`])if(e.includes(t))return t}function Ve(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 ze)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:j(n,e),...Be(t[n]??[])?{role:Be(t[n]??[])}:{}}))}function He(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:j(o,e)}),s&&d.push({key:s,label:j(s,e),role:`quantity`}),l&&d.push({key:l,label:j(l,e),role:`money`,summarize:!1}),u&&u!==l&&d.push({key:u,label:j(u,e),role:`money`}),d}function j(e,t){let n=t.fields[e];return n&&(n.type===`foreignKey`||n.type===`crossPackageRef`)&&/.[a-z]Id$/.test(e)?re(e.slice(0,-2)):re(e)}var Ue=[`text`,`integer`,`decimal`,`boolean`,`datetime`,`json`,`foreignKey`,`crossPackageRef`];function We(e){return Ue.includes(e)?e:`text`}var Ge=/(Date|^date|period(Start|End))$/;function Ke(e,t){return t.type===`datetime`&&!t.system&&Ge.test(t.name)&&!e.fields.some(e=>e.name===`allDay`)?`date`:void 0}function qe(e){return oe(e)[0]}function Je(e,t){let n=t.ui?{...t.ui}:void 0,r=c(t)?`money`:Ke(e,t);return{type:We(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}:{},...qe(e)===t.name?{display:!0}:{}}}function Ye(e,t){return e.includes(`:`)?e:`${t.slice(0,t.lastIndexOf(`:`))}:${e}`}function Xe(e,t){if(!t.related)return!1;let n=Ye(t.related,e.id);return ve(h,n,o).some(t=>t.id===e.id)}function Ze(e){return e.fields.flatMap(t=>{if(t.type!==`foreignKey`&&t.type!==`crossPackageRef`||!t.related)return[];let n=p(Ye(t.related,e.id));return n?[{field:t.name,kind:t.type===`crossPackageRef`?`crossPackageRef`:`foreignKey`,relatedCollection:n.model.collection,...Xe(e,t)?{role:`items`}:{}}]:[]})}function M(e){let t=Ze(e);return{name:e.collection,objectRef:e.id,className:e.name,idField:`id`,fields:Object.fromEntries(e.fields.map(t=>[t.name,Je(e,t)])),...t.length?{relationships:t}:{}}}function Qe(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 $e(e,t){let n=new Set(t);for(let t of e)for(let e of t.models)n.add(e);return n}function et(e){return g(e.replace(/_?id$/i,``)||e)}function N(e,t,n){let r=Ce(e,t),i=Se(e,t).filter(e=>e.model.exposed&&n.has(e.model.id)),a=new Set(ve(e,t,o).map(e=>e.id)),s=new Map;for(let e of i)s.set(e.model.id,(s.get(e.model.id)??0)+1);let c=i.map(e=>{let t=a.has(e.model.id)?`items`:`children`,n=M(e.model),i=C(n),o=[e.fk];return{model:e.model.id,field:e.fk,label:(s.get(e.model.id)??0)>1?`${xe(e.model.name,r)} (${et(e.fk).toLowerCase()})`:xe(e.model.name,r),kind:t,columns:t===`items`?He(n,i,{exclude:o}):Ve(n,i,{exclude:o,max:5}),...t===`items`&&`sortOrder`in n.fields?{sort:`sortOrder`}:{}}});for(let n of _e(e,t))c.push({model:n.model.id,field:n.fk,label:et(n.fk),kind:`reference`});return c}var tt=Symbol(`smrt-cookbook`);function nt(){return t(tt)}function rt(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 pe(n,i)}function it(e){return e?async(t,n)=>{let r=rt(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}}:rt}var at=new Set([`foreignKey`,`crossPackageRef`]);function P(e,t){return`/m/${e}/${t}/`}function ot(e,t,n,r=`view`){let i=`${P(e,t)}${encodeURIComponent(n)}/`;return r===`edit`?`${i}edit/`:i}function st(e,t,n,r){return`${P(e,t)}?${encodeURIComponent(n)}=${encodeURIComponent(r)}`}function ct(e,t){let n=new URLSearchParams(e);for(let e of t.fields){if(!at.has(e.type))continue;let t=n.get(e.name);if(t)return{field:e.name,equals:t}}}function lt(e){return e?.equals===void 0?``:`${encodeURIComponent(e.field)}=${encodeURIComponent(e.equals)}`}function ut(e,t,n){let r=n.filter(t=>t.model.id===e&&t.filter);if(t){let e=r.find(e=>e.key===t)?.filter;return e?{field:e.field,equals:e.value}:void 0}let i=r[0]?.filter;if(!i)return;let a=r.map(e=>e.filter).filter(e=>e?.field===i.field).map(e=>String(e?.value));return{field:i.field,notIn:[...new Set(a)]}}function dt(e,t){if(!e)return!0;let n=String(t[e.field]??``);return e.equals===void 0?!e.notIn?.includes(n):n===e.equals}function ft(e){return e?.equals===void 0?{}:{[e.field]:e.equals}}var F=e=>typeof e==`number`&&Number.isSafeInteger(e)?e:null,pt=(e,t)=>e.fields.some(e=>e.name===t);function mt(e,t){let n=C(M(e)),r=ce(t,n);return Object.values(r).some(e=>F(e)!==null)?r:void 0}function ht(e,t){return!!e.fields.find(e=>e.name===`status`)?.enum?.includes(`draft`)&&typeof t.status==`string`&&t.status!==``&&t.status!==`draft`}function gt(e,t,n){if(!ht(e,t)||![`subtotal`,`taxAmount`,`totalAmount`,`discountTotal`].every(t=>pt(e,t)))return;let r=F(t.subtotal),i=F(t.taxAmount),a=F(t.totalAmount),o=F(t.discountTotal)??0;if(r===null||i===null||a===null)return;let s=l(t,`exclusive`);return{subtotal:r,discount:o,tax:i,total:a,lineAmountType:s,roundingScope:u(t,`line`),showNetSubtotal:s===`inclusive`,taxes:_(n,s).flatMap(e=>e.taxComponentId?[{taxComponentId:e.taxComponentId,name:e.name,percent:e.percent,taxable:e.taxable,tax:e.tax}]:[])}}var I=x();function L(e){let{source:t,href:n}=e;if(!t||!n)throw Error(`the planner widget context is missing`);return{source:t,href:n}}function R(e){let t=typeof e==`string`?p(e):void 0;if(!t)throw Error(`unknown model ${String(e)}`);return{model:t.model,packageId:t.pkg.id,path:P(t.pkg.id,t.model.name)}}var z=new Set([`foreignKey`,`crossPackageRef`]);function B(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||!z.has(s.type))throw Error(`${n.name} has no reference field ${o}`);return{field:o,id:i.id}}async function _t(e,t,n){return n?e.listWhere(t,n.field,n.id):e.list(t)}function vt(e,t,n){return e(n?st(t.packageId,t.model.name,n.field,n.id):t.path)}var V=e=>typeof e==`number`&&Number.isFinite(e);async function yt(e,t){let{source:n,href:r}=L(t),i=R(e.model),{model:a}=i,o=B(e,t,a),s=await _t(n,a,o),l=vt(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(V),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 bt(e,t){return V(e)&&V(t)?e-t:String(e??``).localeCompare(String(t??``))}var xt=new Set([`createdAt`,`updatedAt`]),St=[`identifier`,`status`,`date`,`money`,`quantity`,`party`,`title`];function Ct(e=[]){return St.find(t=>e.includes(t))}function wt(e,t,n,r){let i=M(e),a=r?[r]:[],o=S(n);if(o.length===0)return Ve(i,t,{exclude:a,max:5});let s=[...He(i,t,{exclude:a}),...Ve(i,t,{exclude:a,max:o.length+8})];return o.map(n=>{let r=e.fields.find(e=>e.name===n);if(!r)throw Error(`${e.name} has no field ${n}`);let i=s.find(e=>e.key===n);if(i)return i;let a=Ct(t[n]);return{key:n,label:z.has(r.type)?g(n.replace(/Id$/,``)):g(n),...a?{role:a}:{}}})}var Tt=new Set([`money`,`quantity`]);function Et(e,t){let n={};for(let r of e)(r.summarize??Tt.has(r.role))&&(n[r.key]=t.reduce((e,t)=>{let n=t[r.key];return V(n)?e+n:e},0));return n}function Dt(e,t){let n=w(M(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 Ot(e,t){let{source:n,href:r}=L(t),i=R(e.model),{model:a}=i,o=B(e,t,a),s=await _t(n,a,o);if(typeof e.sort==`string`&&e.sort){if(!a.fields.find(t=>t.name===e.sort)&&!xt.has(e.sort))throw Error(`${a.name} has no field ${e.sort}`);let t=s.some(t=>t[e.sort]!==void 0)?e.sort:It(a)?.name;if(t){let n=e.direction===`asc`?1:-1;s=[...s].sort((e,r)=>n*bt(e[t],r[t]))}}let c=wt(a,C(M(a)),e.columns,o?.field),l=V(e.limit)?e.limit:5,u=s.slice(0,l),d=a.fields.filter(e=>z.has(e.type)&&c.some(t=>t.key===e.name)),f=await de(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(m(r.related,n))??``]:[t.key,n??null]})),h=Et(c,s),g=!Me(a);return{rows:await Promise.all(u.map(async e=>({id:String(e.id),title:await ue(n,a,e,0,o?.field),...g?{href:r(ot(i.packageId,a.name,String(e.id)))}:{},cells:p(e)}))),total:s.length,...g?{href:vt(r,i,o)}:{},columns:c,currency:Dt(a,s),...Object.keys(h).length?{summaries:h}:{}}}var kt={"7d":7,"30d":30,"90d":90,"12m":365,all:null},At=864e5;function jt(e){return e===`7d`||e===`30d`?`day`:e===`90d`?`week`:`month`}function Mt(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*At:r}function Nt(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)*At}function Pt(e,t){let n=new Date(e).toISOString();return t===`month`?n.slice(0,7):n.slice(0,10)}var Ft=e=>e.type===`datetime`&&!e.system;function It(e){let t=e.fields.filter(Ft);return t.find(e=>/^(issue|order|start|created)/i.test(e.name))??t[0]}function H(e){if(typeof e!=`string`&&typeof e!=`number`)return;let t=new Date(e).getTime();return Number.isFinite(t)?t:void 0}async function Lt(e,t){let{source:n,href:r}=L(t),i=R(e.model),{model:a}=i,o=B(e,t,a),s=typeof e.groupBy==`string`?e.groupBy:``,l=s?a.fields.find(e=>e.name===s):It(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(kt,f))throw Error(`unknown period ${f}`);let p=kt[f],m=Ft(l),h=m?l:It(a),g=p!==null&&h?v-p*At:-1/0,_=await _t(n,a,o);h&&g!==-1/0&&(_=_.filter(e=>{let t=H(e[h.name]);return t!==void 0&&t>=g&&t<=v}));let y=new Map,b=(e,t,n)=>{let r=y.get(e)??{key:t,sum:0,n:0};if(d){let e=n[d.name];if(!V(e))return;r.sum+=e}r.n+=1,y.set(e,r)},x=jt(f);if(m){let e=g===-1/0?Math.min(..._.map(e=>H(e[l.name])??v),v):g;for(let t=Mt(e,x);t<=v;t=Nt(t,x))y.set(Pt(t,x),{key:t,sum:0,n:0});for(let e of _){let t=H(e[l.name]);if(t===void 0)continue;let n=Mt(t,x);b(Pt(n,x),n,e)}}else for(let e of _){let t=e[l.name],n=t==null||t===``?`(none)`:String(t);b(n,n,e)}let S=d?c(d):!1,C=e=>{if(!d)return e.n;let t=u===`avg`&&e.n?e.sum/e.n:e.sum;return S?Math.round(t):t},w=[...y.entries()].map(([e,t])=>({label:e,value:C(t),key:t.key}));return w=m?w.sort((e,t)=>Number(e.key)-Number(t.key)):w.sort((e,t)=>t.value-e.value||e.label.localeCompare(t.label)),{points:w.map(({label:e,value:t})=>({label:e,value:t})),format:d?S?`money`:d.type===`integer`?`integer`:`decimal`:`integer`,...S?{currency:`USD`}:{},href:vt(r,i,o)}}var Rt=async(e,t)=>{let{source:n,entryIndex:r}=e;if(!n||!r)throw Error(`the planner widget context is missing`);return Promise.all(t.map(async e=>{let t=r.get(e.id??``);if(!t)return e;let i=await n.list(t.model);return{...e,count:i.filter(e=>dt(t.scope,e)).length}}))};fe(I,{metric:yt,records:Ot,chart:Lt,shortcuts:Rt,shortcuts:it(Rt)});function zt(e){let{relations:t,viewAllHref:n}=e;if(!t)throw Error(`the record page context is missing`);return{relations:t,records:Ot,viewAllHref:n}}async function Bt(e,t){let{source:n}=L(e),r=e.record;if(!r?.id)throw Error(`line items need a record`);let{model:i}=R(r.model),a=await n.get(i,r.id);if(!a)return{};let o=t.find(e=>e.kind===`items`),s=o?p(o.model)?.model:void 0,c=gt(i,a,o&&s?await n.listWhere(s,o.field,r.id):[]),l=c?void 0:mt(i,a),u=w(M(i)),d=u?a[u]:void 0;return{...c?{storedTotals:c}:{},...l?{totals:l}:{},...typeof d==`string`&&d?{currency:d}:{}}}I.register(ie((e,t)=>ae(zt(t))(e,t))),I.register(se(async(e,t)=>{let n=zt(t),{totals:r,storedTotals:i,currency:a}=await Bt(t,n.relations);return he({...n,totals:()=>r,storedTotals:()=>i,currency:()=>a})(e,t)}));var Vt=[`shortcuts`,`metric`,`records`,`chart`,`note`],Ht={},Ut=async(e,t)=>{let n=Ht[e];if(n)return(await n())[t]},Wt=E.filter(e=>e.surfaces?.some(e=>e.kind===`widget`)),Gt=Wt.flatMap(e=>(e.surfaces??[]).flatMap(e=>e.kind===`widget`?[e.type]:[]));Re(I,Wt,Ut);var Kt=new Map(ye(E).map(e=>[`section:${e.id}`,e])),qt=h.packages.flatMap(e=>e.models.map(e=>e.id)),Jt=[...Vt,...Gt];function Yt(e){let t=Kt.get(e);for(let e of t?.recipes??[]){let t=Ne(e)[0];if(t)return{id:t.model.id,name:g(t.model.name)}}}function Xt(e){let t=[{id:`shortcuts`,type:`shortcuts`,span:4,options:{}}],n=Yt(e);return n&&t.push({id:`count`,type:`metric`,span:1,options:{title:d(n.name),model:n.id,measure:`count`}},{id:`latest`,type:`records`,span:3,options:{title:`${n.name} records`,model:n.id,limit:5}}),t}var Zt=new Map;function Qt(e){if(!ee.test(e))return;let t=Zt.get(e);return t||(t=T({id:e,allowed:Jt,models:qt,defaults:Xt(e)}),Zt.set(e,t)),t}function $t(e,t){return`detail:${e}.${t}`}var en=new Map(h.packages.flatMap(e=>e.models.filter(e=>e.exposed).map(t=>[ne(t.id),{packageId:e.id,model:t}])));function U(e){let[,t,n]=/^detail:([A-Za-z0-9_-]+)\.([A-Za-z0-9_]+)$/.exec(e)??[],r=t&&n?f(t,n):void 0;return t&&r?.exposed?{packageId:t,model:r}:en.get(e)}var tn=new Set(h.packages.flatMap(e=>e.models.filter(e=>e.exposed).map(e=>e.id))),nn=new Map;function rn(e){let t=nn.get(e);if(t)return t;let n=U(e);if(!n)return;let r=N(h,n.model.id,tn),i=me(M(n.model),r,{id:e,maxMetrics:2*r.length});return t=T({...i,maxWidgets:Math.max(i.maxWidgets??24,i.defaults.length+24)}),nn.set(e,t),t}function an(e,t){let n=rn(e),r=U(e);if(!n||!r)return;let i=N(h,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 T({...n,defaults:o})}function on(e){return e.startsWith(`detail:`)?rn(e):Qt(e)}function sn(e,t){return Kt.has(e)||e===`section:${Oe.id}`?!0:e.startsWith(`detail:`)?U(e)!==void 0:e.startsWith(`custom:`)&&ee.test(e)&&(t?.customSections??[]).some(t=>t.id===e)}var cn=e=>typeof e==`object`&&!!e&&!Array.isArray(e);function ln(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 un(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 dn(e,t){let n=on(e);if(!n)return{override:null,issues:[{widgetId:null,type:null,code:`malformed`,message:`not an overview id`}]};let r=le(n,t,I);if(r.ok)return{override:r.override,issues:[]};let i=te(t),a=new Set(r.issues.flatMap(e=>e.widgetId?[e.widgetId]:[]));if(!i.override)return{override:null,issues:r.issues};let o=le(n,un(i.override,a),I);return o.ok?{override:o.override,issues:r.issues}:{override:null,issues:[...r.issues,...o.issues]}}function fn(e,t){if(!cn(e))return null;let n=[],r=[];for(let i of Object.keys(e).sort()){if(!sn(i,t)){r.push(`Overview ${i} is not a page in this app and was dropped.`);continue}let{override:a,issues:o}=dn(i,e[i]);for(let e of o)r.push(ln(i,e));a&&n.push([i,a])}return{overviews:Object.fromEntries(n),dropped:r}}var W=b,pn=`glass`,mn=`system`,hn=[`light`,`dark`,`system`],gn=[`none`,`sm`,`md`,`lg`,`xl`,`full`],_n=[`comfortable`,`touch`],vn=[`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`},yn=/^#?([0-9a-f]{3}|[0-9a-f]{6})$/i;function bn(e){if(typeof e!=`string`)return null;let t=yn.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 xn=e=>typeof e==`object`&&!!e&&!Array.isArray(e);function Sn(e){if(e===void 0)return{ok:!0,theme:void 0};if(!xn(e))return{ok:!1,error:`The cookbook "theme" must be an object.`};let t={};if(e.preset!==void 0){if(typeof e.preset!=`string`||!W.includes(e.preset))return{ok:!1,error:`The theme preset must be one of ${W.join(`, `)}.`};t.preset=e.preset}if(e.colorScheme!==void 0){if(!hn.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`,gn],[`density`,_n],[`contrast`,vn]]){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(!xn(e.custom))return{ok:!1,error:`The theme "custom" must be an object.`};let n=bn(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 Cn(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 wn(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 Tn(e,t=Pe(E)){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 En(e,t=E){let n=new Map;for(let e of t){let t=be(e).id;for(let r of Ne(e))r.key&&n.set(`${K}${t}:${r.packageId}:${r.model.name}:${r.label}`,ge(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:ge(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`,Dn=new Set([`basic`,`advanced`,`hidden`]),On=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 kn(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`&&Dn.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 An(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 jn(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=>!O.has(e)),i=[...new Set([...Ee(e.recipes.filter(e=>O.has(e)),O),...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=>O.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=kn(n,`policies[${t}]`);if(typeof e==`string`)return J(`Invalid cookbook: ${e}.`);(o.has(e.objectRef)||we(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=>On.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=An(e.layout);if(typeof t==`string`)return J(`Invalid cookbook: ${t}.`);l=En(Tn(t))}let u;if(e.theme!==void 0){let n=Sn(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())}}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 Mn=e=>({ok:!1,error:e});function Nn(e,t={}){return jn(e,{...t,overviews:fn})}function Pn(e,t={}){let n;try{n=JSON.parse(e)}catch{return Mn(`This file is not valid JSON.`)}try{return Nn(n,t)}catch{return Mn(`This file is not a valid cookbook.`)}}var Z=`smrt-planner:cookbook-doc:v1`,Fn=`smrt-planner:blueprint:v1`,In=`smrt-planner:cookbook-doc:unreadable`;function Ln(){try{return globalThis.localStorage??null}catch{return null}}function Rn(e){if(!e)return{status:`unavailable`};let t;try{t=e.getItem(Z)}catch{return{status:`unavailable`}}let n=null;try{n=e.getItem(Fn)}catch{}let r=t===null&&n!==null,i=r?n:t;if(i===null)return{status:`empty`};let a=Pn(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,In,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 zn(e,t){if(!e)return!1;try{return e.removeItem(t),!0}catch{return!1}}function Bn(e,t){return Q(e,Z,JSON.stringify(t))}function Vn(e,t={}){let n={$schema:q,version:1,...Ae(e)};t.name&&(n.name=t.name),t.description&&(n.description=t.description),t.layout&&(n.layout=t.layout);let r=Cn(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 Hn=new Set([`basic`,`advanced`,`hidden`]),Un=new Set([`api`,`mcp`,`cli`]);function Wn(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 Gn(e){let t=new URLSearchParams(e);return t.has(`r`)||t.has(`o`)}function Kn(e){let t={rows:[],narrowed:{}};if(!e)return t;let n;try{n=JSON.parse(Wn(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`&&Hn.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=>Un.has(e));n.length&&(i[e]=n)}return{rows:r,narrowed:i}}function qn(e){let t=new URLSearchParams(e),n=(t.get(`r`)??``).split(`,`).filter(Boolean),r=Ee(ke(n,O),O),i=new Set(r.flatMap(e=>O.get(e)?.models??[])),{rows:a,narrowed:o}=Kn(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 Jn=`smrt-planner:shell`;function $(e){let t=je(e),n=e.policies.some(e=>e.defaultValue!==void 0&&we(e));s(De(e)||n?t.taxRate:void 0),a({pricesIncludeTax:t.pricesIncludeTax,taxRounding:t.taxRounding,currency:t.currency})}var Yn=new class{#e=r();get layout(){return e(this.#e)}set layout(e){i(this.#e,e,!0)}#t=r();get name(){return e(this.#t)}set name(e){i(this.#t,e,!0)}#n=r();get description(){return e(this.#n)}set description(e){i(this.#n,e,!0)}#r=r();get theme(){return e(this.#r)}set theme(e){i(this.#r,e,!0)}#i=r({});get overviews(){return e(this.#i)}set overviews(e){i(this.#i,e)}#a=r(`unknown`);get persist(){return e(this.#a)}set persist(e){i(this.#a,e,!0)}#o=r(!1);get loaded(){return e(this.#o)}set loaded(e){i(this.#o,e,!0)}hostManaged=!1;#s=r(``);get loadNotice(){return e(this.#s)}set loadNotice(e){i(this.#s,e,!0)}saveBlocked=!1;#c=r(!1);get keepLegacyUrl(){return e(this.#c)}set keepLegacyUrl(e){i(this.#c,e,!0)}replacedBeforeLoad=!1;previousKept=!1;storage=null;timer;snapshot(){return Vn(n(D.data),{layout:n(this.layout),theme:n(this.theme),overviews:n(this.overviews),name:this.name,description:this.description})}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=y(e)?void 0:e}apply(e){D.load(e),this.layout=e.layout,this.theme=e.theme,this.name=e.name,this.description=e.description,this.overviews={...e.overviews??{}},$(e)}get unavailableNotice(){let e=[...D.unavailableRecipes,...D.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(){D.removeUnavailable(),this.scheduleSave()}setTheme(e){this.theme=Cn(e)}settings(){return je(this.snapshot())}setSettings(e){let t=Te(this.snapshot(),e);D.rows=t.policies.map(e=>({...e})),$(t)}replace(e){this.apply(e),this.loaded||(this.replacedBeforeLoad=!0),this.saveBlocked=!1,this.keepLegacyUrl=!1}reset(){D.clear(),$({policies:[]}),this.layout=void 0,this.theme=void 0,this.name=void 0,this.description=void 0,this.overviews={};try{globalThis.localStorage?.removeItem(Jn)}catch{}this.saveBlocked=!1,this.keepLegacyUrl=!1}importText(e){let t=Pn(e);return t.ok&&this.replace(t.cookbook),t}hydrate(e,t=Ln()){this.storage=t;let n=Rn(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(Gn(e)&&(n.status===`loaded`&&!Q(t,`smrt-planner:cookbook-doc:backup`,JSON.stringify(n.cookbook))&&(this.saveBlocked=!0),this.apply(qn(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=Bn(this.storage,this.snapshot());return this.persist=e?`ok`:`memory`,e&&this.previousKept&&(this.previousKept=!zn(this.storage,Fn)),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{nt as A,ut as C,ct as D,P as E,N as M,M as N,lt as O,Qe as P,dt as S,st as T,bn as _,Ln as a,Qt as b,q as c,mn as d,pn as f,wn as g,W as h,Z as i,$e as j,ot as k,gn as l,G as m,Yn as n,Nn as o,_n as p,$ as r,Pn as s,Jn as t,vn as u,an as v,ft as w,I as x,$t as y};
1
+ import{$ as e,Et as t,Mt as n,bt as r,vt as i}from"./DG3qFFTE.js";import"./xihTtKlq.js";import{I as a,K as o,L as s,O as c,U as l,W as u,_ as d,dt as f,ft as p,h as m,lt as h,p as g,st as _,x as v}from"./CoXf-L_3.js";import{g as y}from"./CdBvpdnq.js";import"./M-CuJzQN.js";import"./DIE02RSm.js";import{u as b}from"./eNZ3ToP2.js";import{A as x,C as S,D as C,E as w,F as ee,M as T,N as te,S as ne,T as re,_ as ie,b as ae,d as oe,g as se,h as ce,j as le,n as ue,r as de,v as fe,w as pe,x as me,y as he}from"./CXKa_xdk.js";import{B as ge,G as _e,J as ve,R as ye,V as be,W as xe,X as Se,Y as Ce,a as we,b as E,c as Te,d as Ee,i as De,j as Oe,l as ke,n as Ae,o as je,q as Me,t as D,v as Ne,x as O,z as Pe}from"./B7d7dGCP.js";function Fe(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 k(e,t){let n=Fe(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 A(e){let t;return()=>(t??=e(),t)}function Ie(e){return typeof e==`object`&&!!e&&`default`in e&&!!e.default}function Le(e,t,n){let r=A(()=>k(e.export,t)),i=e.optionsEditor?A(()=>k(e.optionsEditor,t)):void 0,a=e.data?.load?A(()=>k(e.data?.load,t)):void 0,o={type:e.type,title:e.label,options:e.options??[],loadComponent:async()=>{let e=await r();return Ie(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 Ie(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 Re(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 k(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(Le(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 ze=[`identifier`,`status`,`date`,`party`,`total`,`money`];function Be(e){for(let t of[`identifier`,`status`,`date`,`money`,`quantity`,`party`,`title`])if(e.includes(t))return t}function Ve(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 ze)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:j(n,e),...Be(t[n]??[])?{role:Be(t[n]??[])}:{}}))}function He(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:j(o,e)}),s&&d.push({key:s,label:j(s,e),role:`quantity`}),l&&d.push({key:l,label:j(l,e),role:`money`,summarize:!1}),u&&u!==l&&d.push({key:u,label:j(u,e),role:`money`}),d}function j(e,t){let n=t.fields[e];return n&&(n.type===`foreignKey`||n.type===`crossPackageRef`)&&/.[a-z]Id$/.test(e)?re(e.slice(0,-2)):re(e)}var Ue=[`text`,`integer`,`decimal`,`boolean`,`datetime`,`json`,`foreignKey`,`crossPackageRef`];function We(e){return Ue.includes(e)?e:`text`}var Ge=/(Date|^date|period(Start|End))$/;function Ke(e,t){return t.type===`datetime`&&!t.system&&Ge.test(t.name)&&!e.fields.some(e=>e.name===`allDay`)?`date`:void 0}function qe(e){return oe(e)[0]}function Je(e,t){let n=t.ui?{...t.ui}:void 0,r=c(t)?`money`:Ke(e,t);return{type:We(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}:{},...qe(e)===t.name?{display:!0}:{}}}function Ye(e,t){return e.includes(`:`)?e:`${t.slice(0,t.lastIndexOf(`:`))}:${e}`}function Xe(e,t){if(!t.related)return!1;let n=Ye(t.related,e.id);return ve(h,n,o).some(t=>t.id===e.id)}function Ze(e){return e.fields.flatMap(t=>{if(t.type!==`foreignKey`&&t.type!==`crossPackageRef`||!t.related)return[];let n=p(Ye(t.related,e.id));return n?[{field:t.name,kind:t.type===`crossPackageRef`?`crossPackageRef`:`foreignKey`,relatedCollection:n.model.collection,...Xe(e,t)?{role:`items`}:{}}]:[]})}function M(e){let t=Ze(e);return{name:e.collection,objectRef:e.id,className:e.name,idField:`id`,fields:Object.fromEntries(e.fields.map(t=>[t.name,Je(e,t)])),...t.length?{relationships:t}:{}}}function Qe(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 $e(e,t){let n=new Set(t);for(let t of e)for(let e of t.models)n.add(e);return n}function et(e){return g(e.replace(/_?id$/i,``)||e)}function N(e,t,n){let r=Ce(e,t),i=Se(e,t).filter(e=>e.model.exposed&&n.has(e.model.id)),a=new Set(ve(e,t,o).map(e=>e.id)),s=new Map;for(let e of i)s.set(e.model.id,(s.get(e.model.id)??0)+1);let c=i.map(e=>{let t=a.has(e.model.id)?`items`:`children`,n=M(e.model),i=C(n),o=[e.fk];return{model:e.model.id,field:e.fk,label:(s.get(e.model.id)??0)>1?`${xe(e.model.name,r)} (${et(e.fk).toLowerCase()})`:xe(e.model.name,r),kind:t,columns:t===`items`?He(n,i,{exclude:o}):Ve(n,i,{exclude:o,max:5}),...t===`items`&&`sortOrder`in n.fields?{sort:`sortOrder`}:{}}});for(let n of _e(e,t))c.push({model:n.model.id,field:n.fk,label:et(n.fk),kind:`reference`});return c}var tt=Symbol(`smrt-cookbook`);function nt(){return t(tt)}function rt(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 pe(n,i)}function it(e){return e?async(t,n)=>{let r=rt(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}}:rt}var at=new Set([`foreignKey`,`crossPackageRef`]);function P(e,t){return`/m/${e}/${t}/`}function ot(e,t,n,r=`view`){let i=`${P(e,t)}${encodeURIComponent(n)}/`;return r===`edit`?`${i}edit/`:i}function st(e,t,n,r){return`${P(e,t)}?${encodeURIComponent(n)}=${encodeURIComponent(r)}`}function ct(e,t){let n=new URLSearchParams(e);for(let e of t.fields){if(!at.has(e.type))continue;let t=n.get(e.name);if(t)return{field:e.name,equals:t}}}function lt(e){return e?.equals===void 0?``:`${encodeURIComponent(e.field)}=${encodeURIComponent(e.equals)}`}function ut(e,t,n){let r=n.filter(t=>t.model.id===e&&t.filter);if(t){let e=r.find(e=>e.key===t)?.filter;return e?{field:e.field,equals:e.value}:void 0}let i=r[0]?.filter;if(!i)return;let a=r.map(e=>e.filter).filter(e=>e?.field===i.field).map(e=>String(e?.value));return{field:i.field,notIn:[...new Set(a)]}}function dt(e,t){if(!e)return!0;let n=String(t[e.field]??``);return e.equals===void 0?!e.notIn?.includes(n):n===e.equals}function ft(e){return e?.equals===void 0?{}:{[e.field]:e.equals}}var F=e=>typeof e==`number`&&Number.isSafeInteger(e)?e:null,pt=(e,t)=>e.fields.some(e=>e.name===t);function mt(e,t){let n=C(M(e)),r=ce(t,n);return Object.values(r).some(e=>F(e)!==null)?r:void 0}function ht(e,t){return!!e.fields.find(e=>e.name===`status`)?.enum?.includes(`draft`)&&typeof t.status==`string`&&t.status!==``&&t.status!==`draft`}function gt(e,t,n){if(!ht(e,t)||![`subtotal`,`taxAmount`,`totalAmount`,`discountTotal`].every(t=>pt(e,t)))return;let r=F(t.subtotal),i=F(t.taxAmount),a=F(t.totalAmount),o=F(t.discountTotal)??0;if(r===null||i===null||a===null)return;let s=l(t,`exclusive`);return{subtotal:r,discount:o,tax:i,total:a,lineAmountType:s,roundingScope:u(t,`line`),showNetSubtotal:s===`inclusive`,taxes:_(n,s).flatMap(e=>e.taxComponentId?[{taxComponentId:e.taxComponentId,name:e.name,percent:e.percent,taxable:e.taxable,tax:e.tax}]:[])}}var I=x();function L(e){let{source:t,href:n}=e;if(!t||!n)throw Error(`the planner widget context is missing`);return{source:t,href:n}}function R(e){let t=typeof e==`string`?p(e):void 0;if(!t)throw Error(`unknown model ${String(e)}`);return{model:t.model,packageId:t.pkg.id,path:P(t.pkg.id,t.model.name)}}var z=new Set([`foreignKey`,`crossPackageRef`]);function B(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||!z.has(s.type))throw Error(`${n.name} has no reference field ${o}`);return{field:o,id:i.id}}async function _t(e,t,n){return n?e.listWhere(t,n.field,n.id):e.list(t)}function vt(e,t,n){return e(n?st(t.packageId,t.model.name,n.field,n.id):t.path)}var V=e=>typeof e==`number`&&Number.isFinite(e);async function yt(e,t){let{source:n,href:r}=L(t),i=R(e.model),{model:a}=i,o=B(e,t,a),s=await _t(n,a,o),l=vt(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(V),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 bt(e,t){return V(e)&&V(t)?e-t:String(e??``).localeCompare(String(t??``))}var xt=new Set([`createdAt`,`updatedAt`]),St=[`identifier`,`status`,`date`,`money`,`quantity`,`party`,`title`];function Ct(e=[]){return St.find(t=>e.includes(t))}function wt(e,t,n,r){let i=M(e),a=r?[r]:[],o=S(n);if(o.length===0)return Ve(i,t,{exclude:a,max:5});let s=[...He(i,t,{exclude:a}),...Ve(i,t,{exclude:a,max:o.length+8})];return o.map(n=>{let r=e.fields.find(e=>e.name===n);if(!r)throw Error(`${e.name} has no field ${n}`);let i=s.find(e=>e.key===n);if(i)return i;let a=Ct(t[n]);return{key:n,label:z.has(r.type)?g(n.replace(/Id$/,``)):g(n),...a?{role:a}:{}}})}var Tt=new Set([`money`,`quantity`]);function Et(e,t){let n={};for(let r of e)(r.summarize??Tt.has(r.role))&&(n[r.key]=t.reduce((e,t)=>{let n=t[r.key];return V(n)?e+n:e},0));return n}function Dt(e,t){let n=w(M(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 Ot(e,t){let{source:n,href:r}=L(t),i=R(e.model),{model:a}=i,o=B(e,t,a),s=await _t(n,a,o);if(typeof e.sort==`string`&&e.sort){if(!a.fields.find(t=>t.name===e.sort)&&!xt.has(e.sort))throw Error(`${a.name} has no field ${e.sort}`);let t=s.some(t=>t[e.sort]!==void 0)?e.sort:It(a)?.name;if(t){let n=e.direction===`asc`?1:-1;s=[...s].sort((e,r)=>n*bt(e[t],r[t]))}}let c=wt(a,C(M(a)),e.columns,o?.field),l=V(e.limit)?e.limit:5,u=s.slice(0,l),d=a.fields.filter(e=>z.has(e.type)&&c.some(t=>t.key===e.name)),f=await de(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(m(r.related,n))??``]:[t.key,n??null]})),h=Et(c,s),g=!Me(a);return{rows:await Promise.all(u.map(async e=>({id:String(e.id),title:await ue(n,a,e,0,o?.field),...g?{href:r(ot(i.packageId,a.name,String(e.id)))}:{},cells:p(e)}))),total:s.length,...g?{href:vt(r,i,o)}:{},columns:c,currency:Dt(a,s),...Object.keys(h).length?{summaries:h}:{}}}var kt={"7d":7,"30d":30,"90d":90,"12m":365,all:null},At=864e5;function jt(e){return e===`7d`||e===`30d`?`day`:e===`90d`?`week`:`month`}function Mt(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*At:r}function Nt(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)*At}function Pt(e,t){let n=new Date(e).toISOString();return t===`month`?n.slice(0,7):n.slice(0,10)}var Ft=e=>e.type===`datetime`&&!e.system;function It(e){let t=e.fields.filter(Ft);return t.find(e=>/^(issue|order|start|created)/i.test(e.name))??t[0]}function H(e){if(typeof e!=`string`&&typeof e!=`number`)return;let t=new Date(e).getTime();return Number.isFinite(t)?t:void 0}async function Lt(e,t){let{source:n,href:r}=L(t),i=R(e.model),{model:a}=i,o=B(e,t,a),s=typeof e.groupBy==`string`?e.groupBy:``,l=s?a.fields.find(e=>e.name===s):It(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(kt,f))throw Error(`unknown period ${f}`);let p=kt[f],m=Ft(l),h=m?l:It(a),g=p!==null&&h?v-p*At:-1/0,_=await _t(n,a,o);h&&g!==-1/0&&(_=_.filter(e=>{let t=H(e[h.name]);return t!==void 0&&t>=g&&t<=v}));let y=new Map,b=(e,t,n)=>{let r=y.get(e)??{key:t,sum:0,n:0};if(d){let e=n[d.name];if(!V(e))return;r.sum+=e}r.n+=1,y.set(e,r)},x=jt(f);if(m){let e=g===-1/0?Math.min(..._.map(e=>H(e[l.name])??v),v):g;for(let t=Mt(e,x);t<=v;t=Nt(t,x))y.set(Pt(t,x),{key:t,sum:0,n:0});for(let e of _){let t=H(e[l.name]);if(t===void 0)continue;let n=Mt(t,x);b(Pt(n,x),n,e)}}else for(let e of _){let t=e[l.name],n=t==null||t===``?`(none)`:String(t);b(n,n,e)}let S=d?c(d):!1,C=e=>{if(!d)return e.n;let t=u===`avg`&&e.n?e.sum/e.n:e.sum;return S?Math.round(t):t},w=[...y.entries()].map(([e,t])=>({label:e,value:C(t),key:t.key}));return w=m?w.sort((e,t)=>Number(e.key)-Number(t.key)):w.sort((e,t)=>t.value-e.value||e.label.localeCompare(t.label)),{points:w.map(({label:e,value:t})=>({label:e,value:t})),format:d?S?`money`:d.type===`integer`?`integer`:`decimal`:`integer`,...S?{currency:`USD`}:{},href:vt(r,i,o)}}var Rt=async(e,t)=>{let{source:n,entryIndex:r}=e;if(!n||!r)throw Error(`the planner widget context is missing`);return Promise.all(t.map(async e=>{let t=r.get(e.id??``);if(!t)return e;let i=await n.list(t.model);return{...e,count:i.filter(e=>dt(t.scope,e)).length}}))};fe(I,{metric:yt,records:Ot,chart:Lt,shortcuts:Rt,shortcuts:it(Rt)});function zt(e){let{relations:t,viewAllHref:n}=e;if(!t)throw Error(`the record page context is missing`);return{relations:t,records:Ot,viewAllHref:n}}async function Bt(e,t){let{source:n}=L(e),r=e.record;if(!r?.id)throw Error(`line items need a record`);let{model:i}=R(r.model),a=await n.get(i,r.id);if(!a)return{};let o=t.find(e=>e.kind===`items`),s=o?p(o.model)?.model:void 0,c=gt(i,a,o&&s?await n.listWhere(s,o.field,r.id):[]),l=c?void 0:mt(i,a),u=w(M(i)),d=u?a[u]:void 0;return{...c?{storedTotals:c}:{},...l?{totals:l}:{},...typeof d==`string`&&d?{currency:d}:{}}}I.register(ie((e,t)=>ae(zt(t))(e,t))),I.register(se(async(e,t)=>{let n=zt(t),{totals:r,storedTotals:i,currency:a}=await Bt(t,n.relations);return he({...n,totals:()=>r,storedTotals:()=>i,currency:()=>a})(e,t)}));var Vt=[`shortcuts`,`metric`,`records`,`chart`,`note`],Ht={},Ut=async(e,t)=>{let n=Ht[e];if(n)return(await n())[t]},Wt=E.filter(e=>e.surfaces?.some(e=>e.kind===`widget`)),Gt=Wt.flatMap(e=>(e.surfaces??[]).flatMap(e=>e.kind===`widget`?[e.type]:[]));Re(I,Wt,Ut);var Kt=new Map(ye(E).map(e=>[`section:${e.id}`,e])),qt=h.packages.flatMap(e=>e.models.map(e=>e.id)),Jt=[...Vt,...Gt];function Yt(e){let t=Kt.get(e);for(let e of t?.recipes??[]){let t=Ne(e)[0];if(t)return{id:t.model.id,name:g(t.model.name)}}}function Xt(e){let t=[{id:`shortcuts`,type:`shortcuts`,span:4,options:{}}],n=Yt(e);return n&&t.push({id:`count`,type:`metric`,span:1,options:{title:d(n.name),model:n.id,measure:`count`}},{id:`latest`,type:`records`,span:3,options:{title:`${n.name} records`,model:n.id,limit:5}}),t}var Zt=new Map;function Qt(e){if(!ee.test(e))return;let t=Zt.get(e);return t||(t=T({id:e,allowed:Jt,models:qt,defaults:Xt(e)}),Zt.set(e,t)),t}function $t(e,t){return`detail:${e}.${t}`}var en=new Map(h.packages.flatMap(e=>e.models.filter(e=>e.exposed).map(t=>[ne(t.id),{packageId:e.id,model:t}])));function U(e){let[,t,n]=/^detail:([A-Za-z0-9_-]+)\.([A-Za-z0-9_]+)$/.exec(e)??[],r=t&&n?f(t,n):void 0;return t&&r?.exposed?{packageId:t,model:r}:en.get(e)}var tn=new Set(h.packages.flatMap(e=>e.models.filter(e=>e.exposed).map(e=>e.id))),nn=new Map;function rn(e){let t=nn.get(e);if(t)return t;let n=U(e);if(!n)return;let r=N(h,n.model.id,tn),i=me(M(n.model),r,{id:e,maxMetrics:2*r.length});return t=T({...i,maxWidgets:Math.max(i.maxWidgets??24,i.defaults.length+24)}),nn.set(e,t),t}function an(e,t){let n=rn(e),r=U(e);if(!n||!r)return;let i=N(h,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 T({...n,defaults:o})}function on(e){return e.startsWith(`detail:`)?rn(e):Qt(e)}function sn(e,t){return Kt.has(e)||e===`section:${Oe.id}`?!0:e.startsWith(`detail:`)?U(e)!==void 0:e.startsWith(`custom:`)&&ee.test(e)&&(t?.customSections??[]).some(t=>t.id===e)}var cn=e=>typeof e==`object`&&!!e&&!Array.isArray(e);function ln(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 un(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 dn(e,t){let n=on(e);if(!n)return{override:null,issues:[{widgetId:null,type:null,code:`malformed`,message:`not an overview id`}]};let r=le(n,t,I);if(r.ok)return{override:r.override,issues:[]};let i=te(t),a=new Set(r.issues.flatMap(e=>e.widgetId?[e.widgetId]:[]));if(!i.override)return{override:null,issues:r.issues};let o=le(n,un(i.override,a),I);return o.ok?{override:o.override,issues:r.issues}:{override:null,issues:[...r.issues,...o.issues]}}function fn(e,t){if(!cn(e))return null;let n=[],r=[];for(let i of Object.keys(e).sort()){if(!sn(i,t)){r.push(`Overview ${i} is not a page in this app and was dropped.`);continue}let{override:a,issues:o}=dn(i,e[i]);for(let e of o)r.push(ln(i,e));a&&n.push([i,a])}return{overviews:Object.fromEntries(n),dropped:r}}var W=b,pn=`glass`,mn=`system`,hn=[`light`,`dark`,`system`],gn=[`none`,`sm`,`md`,`lg`,`xl`,`full`],_n=[`comfortable`,`touch`],vn=[`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`},yn=/^#?([0-9a-f]{3}|[0-9a-f]{6})$/i;function bn(e){if(typeof e!=`string`)return null;let t=yn.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 xn=e=>typeof e==`object`&&!!e&&!Array.isArray(e);function Sn(e){if(e===void 0)return{ok:!0,theme:void 0};if(!xn(e))return{ok:!1,error:`The cookbook "theme" must be an object.`};let t={};if(e.preset!==void 0){if(typeof e.preset!=`string`||!W.includes(e.preset))return{ok:!1,error:`The theme preset must be one of ${W.join(`, `)}.`};t.preset=e.preset}if(e.colorScheme!==void 0){if(!hn.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`,gn],[`density`,_n],[`contrast`,vn]]){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(!xn(e.custom))return{ok:!1,error:`The theme "custom" must be an object.`};let n=bn(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 Cn(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 wn(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 Tn(e,t=Pe(E)){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 En(e,t=E){let n=new Map;for(let e of t){let t=be(e).id;for(let r of Ne(e))r.key&&n.set(`${K}${t}:${r.packageId}:${r.model.name}:${r.label}`,ge(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:ge(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`,Dn=new Set([`basic`,`advanced`,`hidden`]),On=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 kn(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`&&Dn.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 An(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 jn(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=>!O.has(e)),i=[...new Set([...Ee(e.recipes.filter(e=>O.has(e)),O),...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=>O.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=kn(n,`policies[${t}]`);if(typeof e==`string`)return J(`Invalid cookbook: ${e}.`);(o.has(e.objectRef)||we(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=>On.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=An(e.layout);if(typeof t==`string`)return J(`Invalid cookbook: ${t}.`);l=En(Tn(t))}let u;if(e.theme!==void 0){let n=Sn(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())}}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 Mn=e=>({ok:!1,error:e});function Nn(e,t={}){return jn(e,{...t,overviews:fn})}function Pn(e,t={}){let n;try{n=JSON.parse(e)}catch{return Mn(`This file is not valid JSON.`)}try{return Nn(n,t)}catch{return Mn(`This file is not a valid cookbook.`)}}var Z=`smrt-planner:cookbook-doc:v1`,Fn=`smrt-planner:blueprint:v1`,In=`smrt-planner:cookbook-doc:unreadable`;function Ln(){try{return globalThis.localStorage??null}catch{return null}}function Rn(e){if(!e)return{status:`unavailable`};let t;try{t=e.getItem(Z)}catch{return{status:`unavailable`}}let n=null;try{n=e.getItem(Fn)}catch{}let r=t===null&&n!==null,i=r?n:t;if(i===null)return{status:`empty`};let a=Pn(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,In,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 zn(e,t){if(!e)return!1;try{return e.removeItem(t),!0}catch{return!1}}function Bn(e,t){return Q(e,Z,JSON.stringify(t))}function Vn(e,t={}){let n={$schema:q,version:1,...Ae(e)};t.name&&(n.name=t.name),t.description&&(n.description=t.description),t.layout&&(n.layout=t.layout);let r=Cn(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 Hn=new Set([`basic`,`advanced`,`hidden`]),Un=new Set([`api`,`mcp`,`cli`]);function Wn(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 Gn(e){let t=new URLSearchParams(e);return t.has(`r`)||t.has(`o`)}function Kn(e){let t={rows:[],narrowed:{}};if(!e)return t;let n;try{n=JSON.parse(Wn(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`&&Hn.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=>Un.has(e));n.length&&(i[e]=n)}return{rows:r,narrowed:i}}function qn(e){let t=new URLSearchParams(e),n=(t.get(`r`)??``).split(`,`).filter(Boolean),r=Ee(ke(n,O),O),i=new Set(r.flatMap(e=>O.get(e)?.models??[])),{rows:a,narrowed:o}=Kn(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 Jn=`smrt-planner:shell`;function $(e){let t=je(e),n=e.policies.some(e=>e.defaultValue!==void 0&&we(e));s(De(e)||n?t.taxRate:void 0),a({pricesIncludeTax:t.pricesIncludeTax,taxRounding:t.taxRounding,currency:t.currency})}var Yn=new class{#e=r();get layout(){return e(this.#e)}set layout(e){i(this.#e,e,!0)}#t=r();get name(){return e(this.#t)}set name(e){i(this.#t,e,!0)}#n=r();get description(){return e(this.#n)}set description(e){i(this.#n,e,!0)}#r=r();get theme(){return e(this.#r)}set theme(e){i(this.#r,e,!0)}#i=r({});get overviews(){return e(this.#i)}set overviews(e){i(this.#i,e)}#a=r(`unknown`);get persist(){return e(this.#a)}set persist(e){i(this.#a,e,!0)}#o=r(!1);get loaded(){return e(this.#o)}set loaded(e){i(this.#o,e,!0)}hostManaged=!1;#s=r(``);get loadNotice(){return e(this.#s)}set loadNotice(e){i(this.#s,e,!0)}saveBlocked=!1;#c=r(!1);get keepLegacyUrl(){return e(this.#c)}set keepLegacyUrl(e){i(this.#c,e,!0)}replacedBeforeLoad=!1;previousKept=!1;storage=null;timer;snapshot(){return Vn(n(D.data),{layout:n(this.layout),theme:n(this.theme),overviews:n(this.overviews),name:this.name,description:this.description})}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=y(e)?void 0:e}apply(e){D.load(e),this.layout=e.layout,this.theme=e.theme,this.name=e.name,this.description=e.description,this.overviews={...e.overviews??{}},$(e)}get unavailableNotice(){let e=[...D.unavailableRecipes,...D.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(){D.removeUnavailable(),this.scheduleSave()}setTheme(e){this.theme=Cn(e)}settings(){return je(this.snapshot())}setSettings(e){let t=Te(this.snapshot(),e);D.rows=t.policies.map(e=>({...e})),$(t)}replace(e){this.apply(e),this.loaded||(this.replacedBeforeLoad=!0),this.saveBlocked=!1,this.keepLegacyUrl=!1}reset(){D.clear(),$({policies:[]}),this.layout=void 0,this.theme=void 0,this.name=void 0,this.description=void 0,this.overviews={};try{globalThis.localStorage?.removeItem(Jn)}catch{}this.saveBlocked=!1,this.keepLegacyUrl=!1}importText(e){let t=Pn(e);return t.ok&&this.replace(t.cookbook),t}hydrate(e,t=Ln()){this.storage=t;let n=Rn(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(Gn(e)&&(n.status===`loaded`&&!Q(t,`smrt-planner:cookbook-doc:backup`,JSON.stringify(n.cookbook))&&(this.saveBlocked=!0),this.apply(qn(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=Bn(this.storage,this.snapshot());return this.persist=e?`ok`:`memory`,e&&this.previousKept&&(this.previousKept=!zn(this.storage,Fn)),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{nt as A,ut as C,ct as D,P as E,N as M,M as N,lt as O,Qe as P,dt as S,st as T,bn as _,Ln as a,Qt as b,q as c,mn as d,pn as f,wn as g,W as h,Z as i,$e as j,ot as k,gn as l,G as m,Yn as n,Nn as o,_n as p,$ as r,Pn as s,Jn as t,vn as u,an as v,ft as w,I as x,$t as y};