@oneclick.dev/cms-core-modules 0.0.58 → 0.0.60

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 (147) hide show
  1. package/dist/{Components-D9yIIosM.mjs → Components-C83O-xlF.mjs} +1 -1
  2. package/dist/{ContentEditor-DCmt_y_R.js → ContentEditor-BAepN3Yd.js} +51 -34
  3. package/dist/{ContentEditor-CtGeIzC4.mjs → ContentEditor-BPjWW3d1.mjs} +12341 -10099
  4. package/dist/Create-Bh4g6QW4.js +1 -0
  5. package/dist/{Create-Bwf1RXdG.mjs → Create-Cf7pvh5G.mjs} +38 -39
  6. package/dist/DateFormatter-BPPBZp1j.js +1 -0
  7. package/dist/{CalendarDate-CRT2Viyt.mjs → DateFormatter-DsmlAuYV.mjs} +353 -256
  8. package/dist/{Detail-CpfOQChd.mjs → Detail-B4b_FLDa.mjs} +2 -2
  9. package/dist/{Detail-B-PnkcXD.mjs → Detail-BGD75ul4.mjs} +2 -2
  10. package/dist/{Detail-Dd_OkpcN.js → Detail-BayNaAg9.js} +1 -1
  11. package/dist/{Detail-C4E1T87K.mjs → Detail-Byk781b4.mjs} +3 -3
  12. package/dist/{Detail-Cd5CBVN0.js → Detail-CnK-qbhE.js} +1 -1
  13. package/dist/Detail-CtbWzq-R.js +1 -0
  14. package/dist/{Detail-CNfTDUE5.js → Detail-Cxd2VMOl.js} +1 -1
  15. package/dist/{Detail-BVlGSjOq.mjs → Detail-D10shmpK.mjs} +6 -7
  16. package/dist/{Detail-CwagT6gQ.mjs → Detail-U0mgLKt6.mjs} +2 -2
  17. package/dist/EditLayout.vue_vue_type_script_setup_true_lang-CcysXzmW.mjs +75 -0
  18. package/dist/EditLayout.vue_vue_type_script_setup_true_lang-Czu6Dcde.js +1 -0
  19. package/dist/{Entries-zyhycw1M.mjs → Entries-C6Di46My.mjs} +1 -1
  20. package/dist/{Find-BPR0uU-Z.mjs → Find-B4sAEx0B.mjs} +2 -2
  21. package/dist/{Find-BidEQJxT.js → Find-Ds6OvuH6.js} +1 -1
  22. package/dist/{GlobalStyling-BLQ_1W2y.mjs → GlobalStyling-C9VthHWK.mjs} +1 -1
  23. package/dist/NewReservationDialog.vue_vue_type_script_setup_true_lang-BJitmbPE.mjs +396 -0
  24. package/dist/NewReservationDialog.vue_vue_type_script_setup_true_lang-D50uTpZY.js +1 -0
  25. package/dist/Overview-B-8TLLjh.js +1 -0
  26. package/dist/{Overview-CDN88OSM.mjs → Overview-BCpJNiEB.mjs} +1 -1
  27. package/dist/Overview-B_99j5eA.js +1 -0
  28. package/dist/{Overview-BLsZMHNW.mjs → Overview-CIa1E-HH.mjs} +1 -1
  29. package/dist/{Overview-D1nJLBe1.mjs → Overview-CgViRnNc.mjs} +1 -1
  30. package/dist/Overview-DtWvKB3W.mjs +327 -0
  31. package/dist/Overview-HvlDEgqi.mjs +862 -0
  32. package/dist/{Overview-BH3NwvNX.mjs → Overview-Su8ZUbMs.mjs} +3 -3
  33. package/dist/ReservationDetailDialog.vue_vue_type_script_setup_true_lang-CI8YgHdU.js +345 -0
  34. package/dist/ReservationDetailDialog.vue_vue_type_script_setup_true_lang-P-MWwcVh.mjs +2093 -0
  35. package/dist/{TableView-CS13LLxk.mjs → TableView-B8iLWWcP.mjs} +48394 -36321
  36. package/dist/TableView-BxK6R8v3.js +312 -0
  37. package/dist/{TemplateList.vue_vue_type_script_setup_true_lang-BiLAkhIA.mjs → TemplateList.vue_vue_type_script_setup_true_lang-Cmovy7kk.mjs} +5 -5
  38. package/dist/{View-C7axVP9t.mjs → View-DDXN0tKD.mjs} +7 -7
  39. package/dist/View-DfzaVOzS.js +1 -0
  40. package/dist/agenda-D81m29_4.mjs +1135 -0
  41. package/dist/agenda-uzPPxgsW.js +1 -0
  42. package/dist/availability-B-tRp8hB.mjs +629 -0
  43. package/dist/availability-BiBbzEIM.js +1 -0
  44. package/dist/{exceptions-D3b18TiY.mjs → exceptions-BFchkR06.mjs} +70 -71
  45. package/dist/exceptions-C-DPRNQa.js +1 -0
  46. package/dist/index-4tjmIans.js +1 -0
  47. package/dist/index-AmUV8LZQ.mjs +176 -0
  48. package/dist/index-BDaVYdkD.mjs +7763 -0
  49. package/dist/{index-DT1wWnUk.mjs → index-BWDwEd8D.mjs} +1 -1
  50. package/dist/{index-CImCyE3L.mjs → index-BfBBm9uY.mjs} +1 -1
  51. package/dist/{index-DMoyoaks.mjs → index-Bkq58CeQ.mjs} +2 -2
  52. package/dist/{index-DI6mydpm.mjs → index-CABh6Qn6.mjs} +2 -2
  53. package/dist/{index-CQiY-oTN.mjs → index-CQkOH2_3.mjs} +1 -1
  54. package/dist/{index-Bwi1mtkq.mjs → index-CU-tbS5W.mjs} +1 -1
  55. package/dist/{index-BzuHN-r8.mjs → index-Cpnn_Pxd.mjs} +1 -1
  56. package/dist/index-CxETuRsG.js +1 -0
  57. package/dist/{index-DyCHxFp3.mjs → index-DRqJOqUR.mjs} +502 -449
  58. package/dist/index-DTago6vW-Bhr8E1Y6.js +88 -0
  59. package/dist/index-DTago6vW-CnomHQ_S.mjs +4123 -0
  60. package/dist/index-DfV8-6ON.js +245 -0
  61. package/dist/index-Dnn2SCSl.js +1 -0
  62. package/dist/{index-BEGU8Kme.mjs → index-Dpl9sU6a.mjs} +2 -2
  63. package/dist/index-Uf7TwBuW.mjs +110 -0
  64. package/dist/index-YMaY4uuk-BgpTtr73.js +1 -0
  65. package/dist/{index-CKPshlZ8-BQiiP6r_.mjs → index-YMaY4uuk-C_xV5K9Z.mjs} +399 -363
  66. package/dist/{index--jjEzba7.mjs → index-cOnxXTbF.mjs} +1 -1
  67. package/dist/index-hlylYYgy.mjs +24 -0
  68. package/dist/index.cjs.js +1 -1
  69. package/dist/index.mjs +98 -81
  70. package/dist/orders-Bh8w0ueq.mjs +346 -0
  71. package/dist/orders-Dt0zMz97.js +1 -0
  72. package/dist/payment-BQaAqQ5q.js +1 -0
  73. package/dist/payment-BbWByERf.mjs +1080 -0
  74. package/dist/regular-1LXNPviB.js +1 -0
  75. package/dist/regular-_05oq5Tx.mjs +1101 -0
  76. package/dist/regular-slots-Bs3WJB3U.js +1 -0
  77. package/dist/regular-slots-C2NYxLPn.mjs +222 -0
  78. package/dist/resources-DgPnEv76.mjs +811 -0
  79. package/dist/resources-eb0pivDL.js +1 -0
  80. package/dist/src/appointments/components/edit/EditLayout.vue.d.ts +2 -2
  81. package/dist/src/appointments/components/edit/EventDialog/BookingsList.vue.d.ts +92 -0
  82. package/dist/src/appointments/components/edit/EventDialog/CancelReservationDialog.vue.d.ts +8 -0
  83. package/dist/src/appointments/components/edit/EventDialog/EventDialog.vue.d.ts +10 -0
  84. package/dist/src/appointments/components/edit/{EventDialog.vue.d.ts → EventDialog/ResendConfirmationDialog.vue.d.ts} +1 -1
  85. package/dist/src/appointments/components/edit/EventDialog/ReservationDetailDialog.vue.d.ts +51 -0
  86. package/dist/src/appointments/components/edit/EventDialog/TimelineChart.vue.d.ts +24 -0
  87. package/dist/src/appointments/components/edit/EventDialog/TransferReservationDialog.vue.d.ts +4 -0
  88. package/dist/src/appointments/components/edit/EventTimeline.vue.d.ts +15 -7
  89. package/dist/src/appointments/components/edit/NewReservationDialog/NewReservationDialog.vue.d.ts +2 -0
  90. package/dist/src/appointments/components/edit/dashboard/BookingsList.vue.d.ts +68 -0
  91. package/dist/src/appointments/components/edit/dashboard/Timeline.vue.d.ts +15 -0
  92. package/dist/src/appointments/components/edit/dashboard/timeline/ResourceSelector.vue.d.ts +50 -0
  93. package/dist/src/appointments/config.d.ts +30 -0
  94. package/dist/src/appointments/index.d.ts +32 -5
  95. package/dist/src/appointments/pages/edit/agenda.vue.d.ts +1 -1
  96. package/dist/src/appointments/pages/edit/availability.vue.d.ts +1 -1
  97. package/dist/src/appointments/pages/edit/index.vue.d.ts +1 -1
  98. package/dist/src/appointments/pages/edit/orders.vue.d.ts +64 -0
  99. package/dist/src/appointments/pages/edit/payment.vue.d.ts +1 -1
  100. package/dist/src/appointments/pages/edit/regular-slots.vue.d.ts +1 -1
  101. package/dist/src/appointments/pages/edit/resources.vue.d.ts +1 -1
  102. package/dist/src/appointments/routes.d.ts +2 -5
  103. package/dist/src/appointments/types.d.ts +16 -0
  104. package/dist/src/appointments/utils/printReservation.d.ts +45 -0
  105. package/dist/src/content-manager/components/content-editor/ContentStructuredContentSections.vue.d.ts +4 -0
  106. package/dist/src/content-manager/components/content-editor/PageSettings.vue.d.ts +2 -0
  107. package/dist/src/content-manager/components/content-editor/SidebarSectionWrapper.vue.d.ts +11 -1
  108. package/dist/src/content-manager/types.d.ts +5 -0
  109. package/dist/{vee-validate-zod-BPQyEfpF.js → vee-validate-zod-ByykgYKJ.js} +1 -1
  110. package/dist/{vee-validate-zod-IXkfh-6Q.mjs → vee-validate-zod-CcOwoF6y.mjs} +4 -4
  111. package/package.json +4 -2
  112. package/dist/CalendarDate-CWtpXgpD.js +0 -1
  113. package/dist/Create-BP8TX6rj.js +0 -1
  114. package/dist/DateFormatter-BbcSwTs4.js +0 -1
  115. package/dist/DateFormatter-CbO0PVUK.mjs +0 -99
  116. package/dist/Detail-DUo6qKqO.js +0 -1
  117. package/dist/EditLayout.vue_vue_type_script_setup_true_lang-BWuKVkvV.js +0 -1
  118. package/dist/EditLayout.vue_vue_type_script_setup_true_lang-D0-EcU0_.mjs +0 -55
  119. package/dist/Overview-BNMZ9MUK.js +0 -1
  120. package/dist/Overview-CEPodGCn.mjs +0 -311
  121. package/dist/Overview-CvquDPhB.js +0 -1
  122. package/dist/Overview-D67UjG6n.mjs +0 -947
  123. package/dist/RegularSlotEditor.vue_vue_type_script_setup_true_lang-0xZSq0rx.js +0 -1
  124. package/dist/RegularSlotEditor.vue_vue_type_script_setup_true_lang-Bj_PVLLV.mjs +0 -392
  125. package/dist/TableView-Dv4YXBD1.js +0 -111
  126. package/dist/View-7qb_ohVo.js +0 -1
  127. package/dist/agenda-B49oKGeh.mjs +0 -706
  128. package/dist/agenda-DipQ5IWP.js +0 -1
  129. package/dist/availability-C7q9tq6l.js +0 -1
  130. package/dist/availability-DeCkqiu8.mjs +0 -613
  131. package/dist/exceptions-DJ9zWX3k.js +0 -1
  132. package/dist/index-CKPshlZ8-CIz1tDwX.js +0 -1
  133. package/dist/index-DUeFrD-B.js +0 -1
  134. package/dist/index-DsnoK4ia.mjs +0 -579
  135. package/dist/index-WL1P6d3j.js +0 -1
  136. package/dist/index-_mG-aU3Z.mjs +0 -87
  137. package/dist/index-_sQDF1pH.js +0 -1
  138. package/dist/index-klI238nT.mjs +0 -24
  139. package/dist/payment-kTjsV0Jj.js +0 -1
  140. package/dist/payment-zpCM0LD-.mjs +0 -981
  141. package/dist/regular-C4_3YXqx.mjs +0 -602
  142. package/dist/regular-DFwPEbZO.js +0 -1
  143. package/dist/regular-slots-4ooEpICB.mjs +0 -67
  144. package/dist/regular-slots-BAVGbomI.js +0 -1
  145. package/dist/resources-MpQkSstv.mjs +0 -563
  146. package/dist/resources-iM28T3dD.js +0 -1
  147. package/dist/src/appointments/components/edit/RegularSlotEditor.vue.d.ts +0 -16
@@ -1,5 +1,5 @@
1
- import { defineComponent as B, inject as G, resolveComponent as c, createBlock as S, openBlock as r, withCtx as l, createVNode as t, createElementVNode as s, createElementBlock as w, createCommentVNode as b, createTextVNode as d, unref as e, isRef as j, toDisplayString as y, withModifiers as Y, watch as Z, provide as R, computed as ee, ref as te, onMounted as le } from "vue";
2
- import { u as E, a as N, t as oe, o as q, s as M, f as se } from "./vee-validate-zod-IXkfh-6Q.mjs";
1
+ import { defineComponent as B, inject as G, resolveComponent as c, openBlock as r, createBlock as S, withCtx as l, createVNode as t, createElementVNode as s, createTextVNode as d, isRef as j, unref as e, createElementBlock as w, toDisplayString as y, createCommentVNode as b, withModifiers as Y, watch as Z, provide as R, computed as ee, ref as te, onMounted as le } from "vue";
2
+ import { u as E, a as N, t as oe, o as q, s as M, f as se } from "./vee-validate-zod-CcOwoF6y.mjs";
3
3
  import { X as ne, ImagePlus as ie, Tag as ae, ChevronRight as re, Trash as ce, Loader2 as W } from "lucide-vue-next";
4
4
  import { g as ue } from "./google-CvtuJwgk.mjs";
5
5
  import { useModulePermissions as de, useModuleRoute as pe, useConfirmation as me, useFirebaseIntegration as fe, useModuleBreadcrumbs as _e } from "@oneclick.dev/cms-kit";
@@ -1,5 +1,5 @@
1
- import { defineComponent as ne, inject as tt, resolveComponent as v, createBlock as L, openBlock as h, withCtx as f, createVNode as s, createElementVNode as u, createElementBlock as w, createCommentVNode as M, createTextVNode as V, unref as m, isRef as Y, toDisplayString as F, computed as de, watch as re, useTemplateRef as Ee, ref as X, nextTick as Te, Fragment as q, renderList as ie, withModifiers as fe, onMounted as lt, normalizeClass as $e, withKeys as Yt, provide as dt, withAsyncContext as Kt } from "vue";
2
- import { u as xe, a as U, t as Jt, o as Se, b as ve, s as H, d as ut, p as Ne, c as Ie, e as be, f as qt } from "./vee-validate-zod-IXkfh-6Q.mjs";
1
+ import { defineComponent as ne, inject as tt, resolveComponent as v, openBlock as h, createBlock as L, withCtx as f, createVNode as s, createElementVNode as u, createTextVNode as V, isRef as Y, unref as m, createElementBlock as w, toDisplayString as F, createCommentVNode as M, computed as de, watch as re, useTemplateRef as Ee, ref as X, nextTick as Te, Fragment as q, renderList as ie, withModifiers as fe, onMounted as lt, normalizeClass as $e, withKeys as Yt, provide as dt, withAsyncContext as Kt } from "vue";
2
+ import { u as xe, a as U, t as Jt, o as Se, b as ve, s as H, p as Ne, c as be, d as Ie, e as ut, f as qt } from "./vee-validate-zod-CcOwoF6y.mjs";
3
3
  import { Info as Wt, GripVertical as Qe, CircleX as Gt, Trash2 as Zt, PlusCircle as ct, Search as ft, ListFilter as Qt, ChevronDown as pt, X as en, ImagePlus as gt, Plus as tn, Tag as nn, ChevronRight as on, Archive as ln, Trash as rn, Loader2 as mt } from "lucide-vue-next";
4
4
  import { animations as yt } from "@formkit/drag-and-drop";
5
5
  import { useConfirmation as Dt, useModuleRoute as St, useFirebaseIntegration as Ct, useModulePermissions as an, useModuleBreadcrumbs as sn } from "@oneclick.dev/cms-kit";
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),l=require("./vee-validate-zod-BPQyEfpF.js"),y=require("./countries-CgZ081No.js"),g=require("lucide-vue-next"),$=require("@oneclick.dev/cms-kit"),E=require("./index-ijdf0d9-.js"),M={class:"flex flex-col gap-4"},F={class:"flex flex-col gap-2"},L={key:0,class:"text-red-500 text-sm mt-1"},R={class:"flex flex-col gap-4"},z={class:"flex flex-col gap-2"},U={key:0,class:"text-red-500 text-sm mt-1"},j={class:"flex flex-col gap-4"},P={class:"flex flex-col gap-2"},q={key:0,class:"text-red-500 text-sm mt-1"},G=e.defineComponent({__name:"Main",setup(B){const d=e.inject("isLoadingCompleted",e.ref(!1)),{errors:o}=l.useFormContext(),{value:a}=l.useField("title"),{value:n}=l.useField("description"),{value:s}=l.useField("price");return(u,t)=>{const c=e.resolveComponent("Label"),p=e.resolveComponent("Input"),m=e.resolveComponent("Textarea"),V=e.resolveComponent("CardContent"),w=e.resolveComponent("Card");return e.openBlock(),e.createBlock(w,null,{default:e.withCtx(()=>[e.createVNode(V,{class:"flex flex-col gap-4"},{default:e.withCtx(()=>[e.createElementVNode("div",M,[e.createElementVNode("div",F,[e.createVNode(c,{for:"title",class:"text-sm"},{default:e.withCtx(()=>[...t[3]||(t[3]=[e.createTextVNode("Name",-1)])]),_:1}),e.createVNode(p,{type:"text",id:"title",placeholder:e.unref(d)?"Fast shipping":"",modelValue:e.unref(a),"onUpdate:modelValue":t[0]||(t[0]=N=>e.isRef(a)?a.value=N:null)},null,8,["placeholder","modelValue"]),e.unref(o).title?(e.openBlock(),e.createElementBlock("p",L,e.toDisplayString(e.unref(o).title),1)):e.createCommentVNode("",!0)])]),e.createElementVNode("div",R,[e.createElementVNode("div",z,[e.createVNode(c,{for:"description",class:"text-sm"},{default:e.withCtx(()=>[...t[4]||(t[4]=[e.createTextVNode("Description (optional)",-1)])]),_:1}),e.createVNode(m,{id:"description",placeholder:e.unref(d)?"Ships next day":"",modelValue:e.unref(n),"onUpdate:modelValue":t[1]||(t[1]=N=>e.isRef(n)?n.value=N:null)},null,8,["placeholder","modelValue"]),e.unref(o).description?(e.openBlock(),e.createElementBlock("p",U,e.toDisplayString(e.unref(o).description),1)):e.createCommentVNode("",!0)])]),e.createElementVNode("div",j,[e.createElementVNode("div",P,[e.createVNode(c,{for:"price",class:"text-sm"},{default:e.withCtx(()=>[...t[5]||(t[5]=[e.createTextVNode("Price",-1)])]),_:1}),e.createVNode(p,{type:"number",min:"0",id:"price",placeholder:e.unref(d)?"Free":"",modelValue:e.unref(s),"onUpdate:modelValue":t[2]||(t[2]=N=>e.isRef(s)?s.value=N:null),class:"no-spinner"},null,8,["placeholder","modelValue"]),e.unref(o).price?(e.openBlock(),e.createElementBlock("p",q,e.toDisplayString(e.unref(o).price),1)):e.createCommentVNode("",!0)])])]),_:1})]),_:1})}}}),A={class:"flex flex-col gap-4"},J={class:"flex flex-col gap-2"},K={class:"truncate"},W={class:"relative w-full max-w-sm items-center"},X={class:"absolute start-0 inset-y-0 flex items-center justify-center px-3"},Z={class:"truncate"},H={key:0,class:"text-red-500 text-sm mt-1"},Q={key:0},Y={class:"group flex items-center gap-2 bg-muted/50 rounded-md mb-1 p-2"},ee={class:"w-6"},te={class:"text-muted-foreground group-hover:text-black dark:group-hover:text-white"},oe=e.defineComponent({__name:"Countries",setup(B){const{errors:d}=l.useFormContext(),{value:o}=l.useField("countries");return e.watch(o,a=>{let n=a?.sort((u,t)=>!u||!t?0:y.rawCountries.find(c=>c.cca2===u)?.name.common.localeCompare(y.rawCountries.find(c=>c.cca2===t)?.name.common)),s=!0;for(let u=0;u<a.length;u++)if(a[u]!==o.value[u]){s=!1;break}s||(o.value=n)}),(a,n)=>{const s=e.resolveComponent("Label"),u=e.resolveComponent("Button"),t=e.resolveComponent("ComboboxTrigger"),c=e.resolveComponent("ComboboxAnchor"),p=e.resolveComponent("ComboboxInput"),m=e.resolveComponent("ComboboxEmpty"),V=e.resolveComponent("ComboboxItemIndicator"),w=e.resolveComponent("ComboboxItem"),N=e.resolveComponent("ComboboxGroup"),f=e.resolveComponent("ComboboxList"),T=e.resolveComponent("Combobox"),S=e.resolveComponent("CardContent"),k=e.resolveComponent("Card");return e.openBlock(),e.createBlock(k,null,{default:e.withCtx(()=>[e.createVNode(S,{class:"flex flex-col gap-4"},{default:e.withCtx(()=>[n[3]||(n[3]=e.createElementVNode("h3",{class:"text-lg font-semibold mb-4"},"Countries",-1)),e.createElementVNode("div",A,[e.createElementVNode("div",J,[e.createVNode(s,{class:"text-sm mb-2"},{default:e.withCtx(()=>[...n[1]||(n[1]=[e.createTextVNode("For which countries should this option be available?",-1)])]),_:1}),e.createVNode(T,{modelValue:e.unref(o),"onUpdate:modelValue":n[0]||(n[0]=x=>e.isRef(o)?o.value=x:null),multiple:!0},{default:e.withCtx(()=>[e.createVNode(c,{"as-child":""},{default:e.withCtx(()=>[e.createVNode(t,{"as-child":""},{default:e.withCtx(()=>[e.createVNode(u,{variant:"outline",class:"justify-between"},{default:e.withCtx(()=>[e.createElementVNode("span",K,e.toDisplayString(e.unref(o)?.length>0?e.unref(o).slice(0,4).map(x=>e.unref(y.rawCountries).find(b=>b.cca2===x)?.name.common).join(", "):"Select countries"),1),e.createVNode(e.unref(g.ChevronsUpDown),{class:"ml-2 size-4 shrink-0 opacity-50"})]),_:1})]),_:1})]),_:1}),e.createVNode(f,null,{default:e.withCtx(()=>[e.createElementVNode("div",W,[e.createVNode(p,{class:"pl-9 focus-visible:ring-0 border-0 border-b rounded-none h-10",placeholder:"Find country..."}),e.createElementVNode("span",X,[e.createVNode(e.unref(g.Search),{class:"size-4 text-muted-foreground"})])]),e.createVNode(m,null,{default:e.withCtx(()=>[...n[2]||(n[2]=[e.createTextVNode(" No countries found. ",-1)])]),_:1}),e.createVNode(N,{class:"max-h-72 overflow-y-scroll"},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(y.rawCountries),x=>(e.openBlock(),e.createBlock(w,{key:x.cca2,value:x.cca2},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(x.flag)+" ",1),e.createElementVNode("span",Z,e.toDisplayString(x.name.common),1),e.createVNode(V,null,{default:e.withCtx(()=>[e.createVNode(e.unref(g.Check),{class:"size-4"})]),_:1})]),_:2},1032,["value"]))),128))]),_:1})]),_:1})]),_:1},8,["modelValue"]),e.unref(d).countries?(e.openBlock(),e.createElementBlock("p",H,e.toDisplayString(e.unref(d).countries),1)):e.createCommentVNode("",!0)])]),e.unref(o)?.length>0?(e.openBlock(),e.createElementBlock("div",Q,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(o),x=>(e.openBlock(),e.createElementBlock("div",Y,[e.createElementVNode("div",ee,e.toDisplayString(e.unref(y.rawCountries).find(b=>b.cca2===x)?.flag),1),e.createElementVNode("p",te,e.toDisplayString(e.unref(y.rawCountries).find(b=>b.cca2===x)?.name.common),1),e.createVNode(u,{variant:"ghost",size:"icon",onClick:b=>o.value=e.unref(o).filter(O=>O!==x),class:"hidden group-hover:flex ml-auto size-6"},{default:e.withCtx(()=>[e.createVNode(e.unref(g.X),{class:"size-3"})]),_:1},8,["onClick"])]))),256))])):e.createCommentVNode("",!0)]),_:1})]),_:1})}}}),ne={class:"flex items-center space-x-2"},le={class:"flex items-center space-x-2"},se={class:"flex items-center space-x-2"},ie={key:0,class:"flex gap-2 w-full mt-4"},re={class:"flex flex-col gap-4 w-full"},ae={class:"flex flex-col gap-2"},ce={class:"relative"},de={key:0,class:"text-red-500 text-sm mt-1"},ue={class:"flex flex-col gap-4 w-full"},pe={class:"flex flex-col gap-2"},me={class:"relative"},fe={key:0,class:"text-red-500 text-sm mt-1"},xe={key:1,class:"flex gap-2 w-full mt-4"},_e={class:"flex flex-col gap-4 w-full"},Ce={class:"flex flex-col gap-2"},ve={class:"relative"},Ve={key:0,class:"text-red-500 text-sm mt-1"},Ne={class:"flex flex-col gap-4 w-full"},ge={class:"flex flex-col gap-2"},be={class:"relative"},he={key:0,class:"text-red-500 text-sm mt-1"},we=e.defineComponent({__name:"Condition",setup(B){const d=e.inject("isLoadingCompleted",e.ref(!1)),{errors:o}=l.useFormContext(),{value:a}=l.useField("condition"),{value:n}=l.useField("condition_min"),{value:s}=l.useField("condition_max");return(u,t)=>{const c=e.resolveComponent("RadioGroupItem"),p=e.resolveComponent("Label"),m=e.resolveComponent("RadioGroup"),V=e.resolveComponent("Input"),w=e.resolveComponent("CardContent"),N=e.resolveComponent("Card");return e.openBlock(),e.createBlock(N,null,{default:e.withCtx(()=>[e.createVNode(w,{class:"flex flex-col gap-4"},{default:e.withCtx(()=>[t[16]||(t[16]=e.createElementVNode("h3",{class:"text-lg font-semibold mb-4"},"Condition",-1)),t[17]||(t[17]=e.createElementVNode("p",null," Specify when this option should be available ",-1)),e.createVNode(m,{"default-value":"always",modelValue:e.unref(a),"onUpdate:modelValue":t[0]||(t[0]=f=>e.isRef(a)?a.value=f:null),class:e.normalizeClass(["flex flex-col transition-all duration-300",{"opacity-0 pointer-events-none":!e.unref(d)}])},{default:e.withCtx(()=>[e.createElementVNode("div",ne,[e.createVNode(c,{id:"always",value:"always"}),e.createVNode(p,{for:"always"},{default:e.withCtx(()=>[...t[5]||(t[5]=[e.createTextVNode("Always",-1)])]),_:1})]),e.createElementVNode("div",le,[e.createVNode(c,{id:"weight_based",value:"weight_based"}),e.createVNode(p,{for:"weight_based"},{default:e.withCtx(()=>[...t[6]||(t[6]=[e.createTextVNode("Weight based",-1)])]),_:1})]),e.createElementVNode("div",se,[e.createVNode(c,{id:"price_based",value:"price_based"}),e.createVNode(p,{for:"price_based"},{default:e.withCtx(()=>[...t[7]||(t[7]=[e.createTextVNode("Price based",-1)])]),_:1})])]),_:1},8,["modelValue","class"]),e.unref(a)==="weight_based"?(e.openBlock(),e.createElementBlock("div",ie,[e.createElementVNode("div",re,[e.createElementVNode("div",ae,[e.createVNode(p,{for:"condition_min",class:"text-sm"},{default:e.withCtx(()=>[...t[8]||(t[8]=[e.createTextVNode("Minimum weight",-1)])]),_:1}),e.createElementVNode("div",ce,[e.createVNode(V,{type:"number",id:"condition_min",min:"0",placeholder:"0",modelValue:e.unref(n),"onUpdate:modelValue":t[1]||(t[1]=f=>e.isRef(n)?n.value=f:null),class:"no-spinner pr-10"},null,8,["modelValue"]),t[9]||(t[9]=e.createElementVNode("span",{class:"absolute pointer-events-none top-1/2 right-3 -translate-y-1/2 text-sm text-muted-foreground"},"kg",-1))]),e.unref(o).condition_min?(e.openBlock(),e.createElementBlock("p",de,e.toDisplayString(e.unref(o).condition_min),1)):e.createCommentVNode("",!0)])]),e.createElementVNode("div",ue,[e.createElementVNode("div",pe,[e.createVNode(p,{for:"condition_max",class:"text-sm"},{default:e.withCtx(()=>[...t[10]||(t[10]=[e.createTextVNode("Maximum weight",-1)])]),_:1}),e.createElementVNode("div",me,[e.createVNode(V,{type:"number",id:"condition_max",min:"0",placeholder:"No limit",modelValue:e.unref(s),"onUpdate:modelValue":t[2]||(t[2]=f=>e.isRef(s)?s.value=f:null),class:"no-spinner pr-10"},null,8,["modelValue"]),t[11]||(t[11]=e.createElementVNode("span",{class:"absolute pointer-events-none top-1/2 right-3 -translate-y-1/2 text-sm text-muted-foreground"},"kg",-1))]),e.unref(o).condition_max?(e.openBlock(),e.createElementBlock("p",fe,e.toDisplayString(e.unref(o).condition_max),1)):e.createCommentVNode("",!0)])])])):e.unref(a)==="price_based"?(e.openBlock(),e.createElementBlock("div",xe,[e.createElementVNode("div",_e,[e.createElementVNode("div",Ce,[e.createVNode(p,{for:"condition_min",class:"text-sm"},{default:e.withCtx(()=>[...t[12]||(t[12]=[e.createTextVNode("Minimum price",-1)])]),_:1}),e.createElementVNode("div",ve,[e.createVNode(V,{type:"number",id:"condition_min",min:"0",placeholder:"0, 00",modelValue:e.unref(n),"onUpdate:modelValue":t[3]||(t[3]=f=>e.isRef(n)?n.value=f:null),class:"no-spinner pl-8"},null,8,["modelValue"]),t[13]||(t[13]=e.createElementVNode("span",{class:"absolute pointer-events-none top-1/2 left-3 -translate-y-1/2 text-sm text-muted-foreground"},"€",-1))]),e.unref(o).condition_min?(e.openBlock(),e.createElementBlock("p",Ve,e.toDisplayString(e.unref(o).condition_min),1)):e.createCommentVNode("",!0)])]),e.createElementVNode("div",Ne,[e.createElementVNode("div",ge,[e.createVNode(p,{for:"condition_max",class:"text-sm"},{default:e.withCtx(()=>[...t[14]||(t[14]=[e.createTextVNode("Maximum price",-1)])]),_:1}),e.createElementVNode("div",be,[e.createVNode(V,{type:"number",id:"condition_max",min:"0",placeholder:"No limit",modelValue:e.unref(s),"onUpdate:modelValue":t[4]||(t[4]=f=>e.isRef(s)?s.value=f:null),class:"no-spinner pl-8"},null,8,["modelValue"]),t[15]||(t[15]=e.createElementVNode("span",{class:"absolute pointer-events-none top-1/2 left-3 -translate-y-1/2 text-sm text-muted-foreground"},"€",-1))]),e.unref(o).condition_max?(e.openBlock(),e.createElementBlock("p",he,e.toDisplayString(e.unref(o).condition_max),1)):e.createCommentVNode("",!0)])])])):e.createCommentVNode("",!0)]),_:1})]),_:1})}}}),ke={class:"flex gap-2 rounded-lg p-2 bg-white text-black overflow-hidden shadow border"},ye={class:"w-full overflow-hidden"},Ee={class:"truncate"},Be={key:0,class:"text-sm text-muted-foreground"},$e={class:"ml-auto shrink-0"},Se={class:"font-bold"},Te=e.defineComponent({__name:"Example",setup(B){const{value:d}=l.useField("title"),{value:o}=l.useField("description"),{value:a}=l.useField("price");return(n,s)=>{const u=e.resolveComponent("CardContent"),t=e.resolveComponent("Card");return e.openBlock(),e.createBlock(t,null,{default:e.withCtx(()=>[e.createVNode(u,null,{default:e.withCtx(()=>[s[1]||(s[1]=e.createElementVNode("p",{class:"text-md font-semibold mb-2"},"Example",-1)),e.createElementVNode("div",ke,[s[0]||(s[0]=e.createElementVNode("div",{class:"pt-1 shrink-0"},[e.createElementVNode("div",{class:"size-4 rounded-full bg-primary flex items-center justify-center"},[e.createElementVNode("div",{class:"size-2 rounded-full bg-white"})])],-1)),e.createElementVNode("div",ye,[e.createElementVNode("p",Ee,e.toDisplayString(e.unref(d)||"Option Name"),1),e.unref(o)?(e.openBlock(),e.createElementBlock("p",Be,e.toDisplayString(e.unref(o)),1)):e.createCommentVNode("",!0)]),e.createElementVNode("div",$e,[e.createElementVNode("p",Se,e.toDisplayString(e.unref(a)?"€"+e.unref(a).toFixed(2):"FREE"),1)])])]),_:1})]),_:1})}}}),Oe={class:"relative @container"},Ie={class:"flex flex-row gap-4 justify-between max-w-5xl mx-auto mt-4 mb-6"},De={class:"flex items-center"},Me={class:"text-lg font-semibold mx-2"},Fe={class:"flex flex-col @3xl:flex-row gap-4 max-w-5xl mx-auto pb-24"},Le={class:"flex flex-col gap-4 w-full @3xl:w-2/3"},Re={class:"flex flex-col gap-4 w-full @3xl:w-1/3"},ze={key:0,class:"fixed bottom-4 left-0 md:left-12 right-0 min-w-xs max-w-5xl w-[calc(100%-2rem)] md:w-[calc(100%-5rem)] xl:w-[calc(100%-2rem)] h-16 border border-white/10 backdrop-blur-sm border-t border-border flex items-center justify-center px-4 mx-auto z-[9999] rounded-xl overflow-hidden shadow bg-[radial-gradient(#ffffff80,transparent)] dark:bg-[radial-gradient(#00000080,transparent)]"},Ue={class:"w-full max-w-5xl flex items-center justify-end mx-auto"},je=e.defineComponent({__name:"Detail",props:{config:{type:Object,required:!0}},setup(B){const d=B,{hasPermission:o,hasAnyPermission:a}=$.useModulePermissions(),{params:n,navigateTo:s}=$.useModuleRoute(),{confirm:u}=$.useConfirmation(),t=$.useFirebaseIntegration(d.config.project),c=e.computed(()=>!n.value.optionId||n.value.optionId==="new"),p=e.ref(!1),m=e.ref(!1),V=l.toTypedSchema(l.objectType({id:l.stringType().optional(),status:l.stringType().optional(),title:l.stringType().min(1,"Title is required"),description:l.stringType().optional(),price:l.preprocessType(r=>r===""?void 0:r,l.coerce.number().positive("Must be positive").optional()),countries:l.arrayType(l.stringType()).optional(),condition:l.stringType(),condition_min:l.preprocessType(r=>r===""?void 0:r,l.coerce.number().positive("Must be positive").optional()),condition_max:l.preprocessType(r=>r===""?void 0:r,l.coerce.number().positive("Must be positive").optional())})),{handleSubmit:w,errors:N,values:f,setValues:T}=l.useForm({validationSchema:V,initialValues:{status:"published",countries:[],condition:"always"}});$.useModuleBreadcrumbs(()=>[{text:f.title??"New Option"}]);const S=w(async r=>{m.value=!0;let i=await k()||[];if(c.value){let _=JSON.parse(JSON.stringify(r));_.id=crypto.randomUUID();const v=[...i,_],C=d.config.shippingOptionsCollection.split(":");await t.update(C[0],null,{[C[1]]:v}),s(_.id),E.toast.success("Shipping option created")}else{let _=JSON.parse(JSON.stringify(r));const v=i.map(h=>h.id===n.value.optionId?_:h),C=d.config.shippingOptionsCollection.split(":");await t.update(C[0],null,{[C[1]]:v}),s(`${n.value.optionId}`),E.toast.success("Shipping option updated")}m.value=!1}),k=async()=>{if(!d.config.shippingOptionsCollection)return[];const r=d.config.shippingOptionsCollection.split(":");return r.length!==2?[]:(await t.get(r[0]))?.[r[1]]||[]},x=async()=>{const i=(await k()).find(_=>_.id===n.value.optionId);T(i),p.value=!0},b=async()=>{try{const r=await k();let i={...[...r||[]].find(h=>h.id===n.value.optionId)};console.log(r,n.value.optionId,r.find(h=>h.id===n.value.optionId)),i.id=crypto.randomUUID(),i.status="published",i.title=i.title+" (copy)";const v=[...await k()||[],i],C=d.config.shippingOptionsCollection.split(":");await t.update(C[0],null,{[C[1]]:v}),s(i.id),E.toast.success("Option duplicated")}catch{E.toast.error("Failed to duplicate option")}},O=async()=>{if(await u("Are you sure you want to delete this option?"))try{const i=await k()||[];if(i.length===0||!n.value.optionId)throw new Error("Error loading values");const _=i.filter(C=>C.id!==n.value.optionId),v=d.config.shippingOptionsCollection.split(":");await t.update(v[0],null,{[v[1]]:_}),s(""),E.toast.success("Option deleted")}catch{E.toast.error("Failed to delete option")}};return e.onMounted(()=>{c.value?p.value=!0:x()}),e.provide("isLoadingCompleted",p),(r,i)=>{const _=e.resolveComponent("Button"),v=e.resolveComponent("MenubarTrigger"),C=e.resolveComponent("MenubarMenu"),h=e.resolveComponent("MenubarItem"),I=e.resolveComponent("MenubarContent"),D=e.resolveComponent("Menubar");return e.openBlock(),e.createElementBlock("div",Oe,[e.createElementVNode("div",Ie,[e.createElementVNode("div",De,[e.createVNode(_,{variant:"ghost",onClick:i[0]||(i[0]=Pe=>e.unref(s)(""))},{default:e.withCtx(()=>[e.createVNode(e.unref(g.Tag),{class:"size-4"})]),_:1}),e.createVNode(e.unref(g.ChevronRight),{class:"size-3"}),e.createElementVNode("h1",Me,e.toDisplayString(c.value?"New Option":e.unref(f).title),1)]),c.value?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(D,{key:0,class:"bg-sidebar"},{default:e.withCtx(()=>[e.unref(o)("create-collection")?(e.openBlock(),e.createBlock(C,{key:0},{default:e.withCtx(()=>[e.createVNode(v,{onClick:b},{default:e.withCtx(()=>[...i[1]||(i[1]=[e.createTextVNode("Duplicate",-1)])]),_:1})]),_:1})):e.createCommentVNode("",!0),e.unref(a)("edit-collection","delete-option")?(e.openBlock(),e.createBlock(C,{key:1},{default:e.withCtx(()=>[e.createVNode(v,null,{default:e.withCtx(()=>[...i[2]||(i[2]=[e.createTextVNode("More actions",-1)])]),_:1}),e.createVNode(I,null,{default:e.withCtx(()=>[e.unref(o)("delete-option")?(e.openBlock(),e.createBlock(h,{key:0,variant:"destructive",onClick:O},{default:e.withCtx(()=>[e.createVNode(e.unref(g.Trash),{class:"size-4"}),i[3]||(i[3]=e.createTextVNode(" Delete option ",-1))]),_:1})):e.createCommentVNode("",!0)]),_:1})]),_:1})):e.createCommentVNode("",!0)]),_:1}))]),e.createElementVNode("div",Fe,[e.createElementVNode("div",Le,[e.createVNode(G),e.createVNode(oe),e.createVNode(we)]),e.createElementVNode("div",Re,[e.createVNode(Te)])]),e.unref(a)("create-option","edit-option")?(e.openBlock(),e.createElementBlock("div",ze,[e.createElementVNode("div",Ue,[c.value&&e.unref(o)("create-option")?(e.openBlock(),e.createBlock(_,{key:0,onClick:e.unref(S),disabled:m.value},{default:e.withCtx(()=>[m.value?(e.openBlock(),e.createBlock(e.unref(g.Loader2),{key:0,class:"size-4 animate-spin"})):e.createCommentVNode("",!0),e.createTextVNode(" "+e.toDisplayString(m.value?"Creating":"Create")+" New Option ",1)]),_:1},8,["onClick","disabled"])):e.unref(o)("edit-option")?(e.openBlock(),e.createBlock(_,{key:1,onClick:e.unref(S),disabled:m.value},{default:e.withCtx(()=>[m.value?(e.openBlock(),e.createBlock(e.unref(g.Loader2),{key:0,class:"size-4 animate-spin"})):e.createCommentVNode("",!0),e.createTextVNode(" "+e.toDisplayString(m.value?"Saving":"Save")+" Changes ",1)]),_:1},8,["onClick","disabled"])):e.createCommentVNode("",!0)])])):e.createCommentVNode("",!0)])}}});exports.default=je;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),l=require("./vee-validate-zod-ByykgYKJ.js"),y=require("./countries-CgZ081No.js"),g=require("lucide-vue-next"),$=require("@oneclick.dev/cms-kit"),E=require("./index-ijdf0d9-.js"),M={class:"flex flex-col gap-4"},F={class:"flex flex-col gap-2"},L={key:0,class:"text-red-500 text-sm mt-1"},R={class:"flex flex-col gap-4"},z={class:"flex flex-col gap-2"},U={key:0,class:"text-red-500 text-sm mt-1"},j={class:"flex flex-col gap-4"},P={class:"flex flex-col gap-2"},q={key:0,class:"text-red-500 text-sm mt-1"},G=e.defineComponent({__name:"Main",setup(B){const d=e.inject("isLoadingCompleted",e.ref(!1)),{errors:o}=l.useFormContext(),{value:a}=l.useField("title"),{value:n}=l.useField("description"),{value:s}=l.useField("price");return(u,t)=>{const c=e.resolveComponent("Label"),p=e.resolveComponent("Input"),m=e.resolveComponent("Textarea"),V=e.resolveComponent("CardContent"),w=e.resolveComponent("Card");return e.openBlock(),e.createBlock(w,null,{default:e.withCtx(()=>[e.createVNode(V,{class:"flex flex-col gap-4"},{default:e.withCtx(()=>[e.createElementVNode("div",M,[e.createElementVNode("div",F,[e.createVNode(c,{for:"title",class:"text-sm"},{default:e.withCtx(()=>[...t[3]||(t[3]=[e.createTextVNode("Name",-1)])]),_:1}),e.createVNode(p,{type:"text",id:"title",placeholder:e.unref(d)?"Fast shipping":"",modelValue:e.unref(a),"onUpdate:modelValue":t[0]||(t[0]=N=>e.isRef(a)?a.value=N:null)},null,8,["placeholder","modelValue"]),e.unref(o).title?(e.openBlock(),e.createElementBlock("p",L,e.toDisplayString(e.unref(o).title),1)):e.createCommentVNode("",!0)])]),e.createElementVNode("div",R,[e.createElementVNode("div",z,[e.createVNode(c,{for:"description",class:"text-sm"},{default:e.withCtx(()=>[...t[4]||(t[4]=[e.createTextVNode("Description (optional)",-1)])]),_:1}),e.createVNode(m,{id:"description",placeholder:e.unref(d)?"Ships next day":"",modelValue:e.unref(n),"onUpdate:modelValue":t[1]||(t[1]=N=>e.isRef(n)?n.value=N:null)},null,8,["placeholder","modelValue"]),e.unref(o).description?(e.openBlock(),e.createElementBlock("p",U,e.toDisplayString(e.unref(o).description),1)):e.createCommentVNode("",!0)])]),e.createElementVNode("div",j,[e.createElementVNode("div",P,[e.createVNode(c,{for:"price",class:"text-sm"},{default:e.withCtx(()=>[...t[5]||(t[5]=[e.createTextVNode("Price",-1)])]),_:1}),e.createVNode(p,{type:"number",min:"0",id:"price",placeholder:e.unref(d)?"Free":"",modelValue:e.unref(s),"onUpdate:modelValue":t[2]||(t[2]=N=>e.isRef(s)?s.value=N:null),class:"no-spinner"},null,8,["placeholder","modelValue"]),e.unref(o).price?(e.openBlock(),e.createElementBlock("p",q,e.toDisplayString(e.unref(o).price),1)):e.createCommentVNode("",!0)])])]),_:1})]),_:1})}}}),A={class:"flex flex-col gap-4"},J={class:"flex flex-col gap-2"},K={class:"truncate"},W={class:"relative w-full max-w-sm items-center"},X={class:"absolute start-0 inset-y-0 flex items-center justify-center px-3"},Z={class:"truncate"},H={key:0,class:"text-red-500 text-sm mt-1"},Q={key:0},Y={class:"group flex items-center gap-2 bg-muted/50 rounded-md mb-1 p-2"},ee={class:"w-6"},te={class:"text-muted-foreground group-hover:text-black dark:group-hover:text-white"},oe=e.defineComponent({__name:"Countries",setup(B){const{errors:d}=l.useFormContext(),{value:o}=l.useField("countries");return e.watch(o,a=>{let n=a?.sort((u,t)=>!u||!t?0:y.rawCountries.find(c=>c.cca2===u)?.name.common.localeCompare(y.rawCountries.find(c=>c.cca2===t)?.name.common)),s=!0;for(let u=0;u<a.length;u++)if(a[u]!==o.value[u]){s=!1;break}s||(o.value=n)}),(a,n)=>{const s=e.resolveComponent("Label"),u=e.resolveComponent("Button"),t=e.resolveComponent("ComboboxTrigger"),c=e.resolveComponent("ComboboxAnchor"),p=e.resolveComponent("ComboboxInput"),m=e.resolveComponent("ComboboxEmpty"),V=e.resolveComponent("ComboboxItemIndicator"),w=e.resolveComponent("ComboboxItem"),N=e.resolveComponent("ComboboxGroup"),f=e.resolveComponent("ComboboxList"),T=e.resolveComponent("Combobox"),S=e.resolveComponent("CardContent"),k=e.resolveComponent("Card");return e.openBlock(),e.createBlock(k,null,{default:e.withCtx(()=>[e.createVNode(S,{class:"flex flex-col gap-4"},{default:e.withCtx(()=>[n[3]||(n[3]=e.createElementVNode("h3",{class:"text-lg font-semibold mb-4"},"Countries",-1)),e.createElementVNode("div",A,[e.createElementVNode("div",J,[e.createVNode(s,{class:"text-sm mb-2"},{default:e.withCtx(()=>[...n[1]||(n[1]=[e.createTextVNode("For which countries should this option be available?",-1)])]),_:1}),e.createVNode(T,{modelValue:e.unref(o),"onUpdate:modelValue":n[0]||(n[0]=x=>e.isRef(o)?o.value=x:null),multiple:!0},{default:e.withCtx(()=>[e.createVNode(c,{"as-child":""},{default:e.withCtx(()=>[e.createVNode(t,{"as-child":""},{default:e.withCtx(()=>[e.createVNode(u,{variant:"outline",class:"justify-between"},{default:e.withCtx(()=>[e.createElementVNode("span",K,e.toDisplayString(e.unref(o)?.length>0?e.unref(o).slice(0,4).map(x=>e.unref(y.rawCountries).find(b=>b.cca2===x)?.name.common).join(", "):"Select countries"),1),e.createVNode(e.unref(g.ChevronsUpDown),{class:"ml-2 size-4 shrink-0 opacity-50"})]),_:1})]),_:1})]),_:1}),e.createVNode(f,null,{default:e.withCtx(()=>[e.createElementVNode("div",W,[e.createVNode(p,{class:"pl-9 focus-visible:ring-0 border-0 border-b rounded-none h-10",placeholder:"Find country..."}),e.createElementVNode("span",X,[e.createVNode(e.unref(g.Search),{class:"size-4 text-muted-foreground"})])]),e.createVNode(m,null,{default:e.withCtx(()=>[...n[2]||(n[2]=[e.createTextVNode(" No countries found. ",-1)])]),_:1}),e.createVNode(N,{class:"max-h-72 overflow-y-scroll"},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(y.rawCountries),x=>(e.openBlock(),e.createBlock(w,{key:x.cca2,value:x.cca2},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(x.flag)+" ",1),e.createElementVNode("span",Z,e.toDisplayString(x.name.common),1),e.createVNode(V,null,{default:e.withCtx(()=>[e.createVNode(e.unref(g.Check),{class:"size-4"})]),_:1})]),_:2},1032,["value"]))),128))]),_:1})]),_:1})]),_:1},8,["modelValue"]),e.unref(d).countries?(e.openBlock(),e.createElementBlock("p",H,e.toDisplayString(e.unref(d).countries),1)):e.createCommentVNode("",!0)])]),e.unref(o)?.length>0?(e.openBlock(),e.createElementBlock("div",Q,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(o),x=>(e.openBlock(),e.createElementBlock("div",Y,[e.createElementVNode("div",ee,e.toDisplayString(e.unref(y.rawCountries).find(b=>b.cca2===x)?.flag),1),e.createElementVNode("p",te,e.toDisplayString(e.unref(y.rawCountries).find(b=>b.cca2===x)?.name.common),1),e.createVNode(u,{variant:"ghost",size:"icon",onClick:b=>o.value=e.unref(o).filter(O=>O!==x),class:"hidden group-hover:flex ml-auto size-6"},{default:e.withCtx(()=>[e.createVNode(e.unref(g.X),{class:"size-3"})]),_:1},8,["onClick"])]))),256))])):e.createCommentVNode("",!0)]),_:1})]),_:1})}}}),ne={class:"flex items-center space-x-2"},le={class:"flex items-center space-x-2"},se={class:"flex items-center space-x-2"},ie={key:0,class:"flex gap-2 w-full mt-4"},re={class:"flex flex-col gap-4 w-full"},ae={class:"flex flex-col gap-2"},ce={class:"relative"},de={key:0,class:"text-red-500 text-sm mt-1"},ue={class:"flex flex-col gap-4 w-full"},pe={class:"flex flex-col gap-2"},me={class:"relative"},fe={key:0,class:"text-red-500 text-sm mt-1"},xe={key:1,class:"flex gap-2 w-full mt-4"},_e={class:"flex flex-col gap-4 w-full"},Ce={class:"flex flex-col gap-2"},ve={class:"relative"},Ve={key:0,class:"text-red-500 text-sm mt-1"},Ne={class:"flex flex-col gap-4 w-full"},ge={class:"flex flex-col gap-2"},be={class:"relative"},he={key:0,class:"text-red-500 text-sm mt-1"},we=e.defineComponent({__name:"Condition",setup(B){const d=e.inject("isLoadingCompleted",e.ref(!1)),{errors:o}=l.useFormContext(),{value:a}=l.useField("condition"),{value:n}=l.useField("condition_min"),{value:s}=l.useField("condition_max");return(u,t)=>{const c=e.resolveComponent("RadioGroupItem"),p=e.resolveComponent("Label"),m=e.resolveComponent("RadioGroup"),V=e.resolveComponent("Input"),w=e.resolveComponent("CardContent"),N=e.resolveComponent("Card");return e.openBlock(),e.createBlock(N,null,{default:e.withCtx(()=>[e.createVNode(w,{class:"flex flex-col gap-4"},{default:e.withCtx(()=>[t[16]||(t[16]=e.createElementVNode("h3",{class:"text-lg font-semibold mb-4"},"Condition",-1)),t[17]||(t[17]=e.createElementVNode("p",null," Specify when this option should be available ",-1)),e.createVNode(m,{"default-value":"always",modelValue:e.unref(a),"onUpdate:modelValue":t[0]||(t[0]=f=>e.isRef(a)?a.value=f:null),class:e.normalizeClass(["flex flex-col transition-all duration-300",{"opacity-0 pointer-events-none":!e.unref(d)}])},{default:e.withCtx(()=>[e.createElementVNode("div",ne,[e.createVNode(c,{id:"always",value:"always"}),e.createVNode(p,{for:"always"},{default:e.withCtx(()=>[...t[5]||(t[5]=[e.createTextVNode("Always",-1)])]),_:1})]),e.createElementVNode("div",le,[e.createVNode(c,{id:"weight_based",value:"weight_based"}),e.createVNode(p,{for:"weight_based"},{default:e.withCtx(()=>[...t[6]||(t[6]=[e.createTextVNode("Weight based",-1)])]),_:1})]),e.createElementVNode("div",se,[e.createVNode(c,{id:"price_based",value:"price_based"}),e.createVNode(p,{for:"price_based"},{default:e.withCtx(()=>[...t[7]||(t[7]=[e.createTextVNode("Price based",-1)])]),_:1})])]),_:1},8,["modelValue","class"]),e.unref(a)==="weight_based"?(e.openBlock(),e.createElementBlock("div",ie,[e.createElementVNode("div",re,[e.createElementVNode("div",ae,[e.createVNode(p,{for:"condition_min",class:"text-sm"},{default:e.withCtx(()=>[...t[8]||(t[8]=[e.createTextVNode("Minimum weight",-1)])]),_:1}),e.createElementVNode("div",ce,[e.createVNode(V,{type:"number",id:"condition_min",min:"0",placeholder:"0",modelValue:e.unref(n),"onUpdate:modelValue":t[1]||(t[1]=f=>e.isRef(n)?n.value=f:null),class:"no-spinner pr-10"},null,8,["modelValue"]),t[9]||(t[9]=e.createElementVNode("span",{class:"absolute pointer-events-none top-1/2 right-3 -translate-y-1/2 text-sm text-muted-foreground"},"kg",-1))]),e.unref(o).condition_min?(e.openBlock(),e.createElementBlock("p",de,e.toDisplayString(e.unref(o).condition_min),1)):e.createCommentVNode("",!0)])]),e.createElementVNode("div",ue,[e.createElementVNode("div",pe,[e.createVNode(p,{for:"condition_max",class:"text-sm"},{default:e.withCtx(()=>[...t[10]||(t[10]=[e.createTextVNode("Maximum weight",-1)])]),_:1}),e.createElementVNode("div",me,[e.createVNode(V,{type:"number",id:"condition_max",min:"0",placeholder:"No limit",modelValue:e.unref(s),"onUpdate:modelValue":t[2]||(t[2]=f=>e.isRef(s)?s.value=f:null),class:"no-spinner pr-10"},null,8,["modelValue"]),t[11]||(t[11]=e.createElementVNode("span",{class:"absolute pointer-events-none top-1/2 right-3 -translate-y-1/2 text-sm text-muted-foreground"},"kg",-1))]),e.unref(o).condition_max?(e.openBlock(),e.createElementBlock("p",fe,e.toDisplayString(e.unref(o).condition_max),1)):e.createCommentVNode("",!0)])])])):e.unref(a)==="price_based"?(e.openBlock(),e.createElementBlock("div",xe,[e.createElementVNode("div",_e,[e.createElementVNode("div",Ce,[e.createVNode(p,{for:"condition_min",class:"text-sm"},{default:e.withCtx(()=>[...t[12]||(t[12]=[e.createTextVNode("Minimum price",-1)])]),_:1}),e.createElementVNode("div",ve,[e.createVNode(V,{type:"number",id:"condition_min",min:"0",placeholder:"0, 00",modelValue:e.unref(n),"onUpdate:modelValue":t[3]||(t[3]=f=>e.isRef(n)?n.value=f:null),class:"no-spinner pl-8"},null,8,["modelValue"]),t[13]||(t[13]=e.createElementVNode("span",{class:"absolute pointer-events-none top-1/2 left-3 -translate-y-1/2 text-sm text-muted-foreground"},"€",-1))]),e.unref(o).condition_min?(e.openBlock(),e.createElementBlock("p",Ve,e.toDisplayString(e.unref(o).condition_min),1)):e.createCommentVNode("",!0)])]),e.createElementVNode("div",Ne,[e.createElementVNode("div",ge,[e.createVNode(p,{for:"condition_max",class:"text-sm"},{default:e.withCtx(()=>[...t[14]||(t[14]=[e.createTextVNode("Maximum price",-1)])]),_:1}),e.createElementVNode("div",be,[e.createVNode(V,{type:"number",id:"condition_max",min:"0",placeholder:"No limit",modelValue:e.unref(s),"onUpdate:modelValue":t[4]||(t[4]=f=>e.isRef(s)?s.value=f:null),class:"no-spinner pl-8"},null,8,["modelValue"]),t[15]||(t[15]=e.createElementVNode("span",{class:"absolute pointer-events-none top-1/2 left-3 -translate-y-1/2 text-sm text-muted-foreground"},"€",-1))]),e.unref(o).condition_max?(e.openBlock(),e.createElementBlock("p",he,e.toDisplayString(e.unref(o).condition_max),1)):e.createCommentVNode("",!0)])])])):e.createCommentVNode("",!0)]),_:1})]),_:1})}}}),ke={class:"flex gap-2 rounded-lg p-2 bg-white text-black overflow-hidden shadow border"},ye={class:"w-full overflow-hidden"},Ee={class:"truncate"},Be={key:0,class:"text-sm text-muted-foreground"},$e={class:"ml-auto shrink-0"},Se={class:"font-bold"},Te=e.defineComponent({__name:"Example",setup(B){const{value:d}=l.useField("title"),{value:o}=l.useField("description"),{value:a}=l.useField("price");return(n,s)=>{const u=e.resolveComponent("CardContent"),t=e.resolveComponent("Card");return e.openBlock(),e.createBlock(t,null,{default:e.withCtx(()=>[e.createVNode(u,null,{default:e.withCtx(()=>[s[1]||(s[1]=e.createElementVNode("p",{class:"text-md font-semibold mb-2"},"Example",-1)),e.createElementVNode("div",ke,[s[0]||(s[0]=e.createElementVNode("div",{class:"pt-1 shrink-0"},[e.createElementVNode("div",{class:"size-4 rounded-full bg-primary flex items-center justify-center"},[e.createElementVNode("div",{class:"size-2 rounded-full bg-white"})])],-1)),e.createElementVNode("div",ye,[e.createElementVNode("p",Ee,e.toDisplayString(e.unref(d)||"Option Name"),1),e.unref(o)?(e.openBlock(),e.createElementBlock("p",Be,e.toDisplayString(e.unref(o)),1)):e.createCommentVNode("",!0)]),e.createElementVNode("div",$e,[e.createElementVNode("p",Se,e.toDisplayString(e.unref(a)?"€"+e.unref(a).toFixed(2):"FREE"),1)])])]),_:1})]),_:1})}}}),Oe={class:"relative @container"},Ie={class:"flex flex-row gap-4 justify-between max-w-5xl mx-auto mt-4 mb-6"},De={class:"flex items-center"},Me={class:"text-lg font-semibold mx-2"},Fe={class:"flex flex-col @3xl:flex-row gap-4 max-w-5xl mx-auto pb-24"},Le={class:"flex flex-col gap-4 w-full @3xl:w-2/3"},Re={class:"flex flex-col gap-4 w-full @3xl:w-1/3"},ze={key:0,class:"fixed bottom-4 left-0 md:left-12 right-0 min-w-xs max-w-5xl w-[calc(100%-2rem)] md:w-[calc(100%-5rem)] xl:w-[calc(100%-2rem)] h-16 border border-white/10 backdrop-blur-sm border-t border-border flex items-center justify-center px-4 mx-auto z-[9999] rounded-xl overflow-hidden shadow bg-[radial-gradient(#ffffff80,transparent)] dark:bg-[radial-gradient(#00000080,transparent)]"},Ue={class:"w-full max-w-5xl flex items-center justify-end mx-auto"},je=e.defineComponent({__name:"Detail",props:{config:{type:Object,required:!0}},setup(B){const d=B,{hasPermission:o,hasAnyPermission:a}=$.useModulePermissions(),{params:n,navigateTo:s}=$.useModuleRoute(),{confirm:u}=$.useConfirmation(),t=$.useFirebaseIntegration(d.config.project),c=e.computed(()=>!n.value.optionId||n.value.optionId==="new"),p=e.ref(!1),m=e.ref(!1),V=l.toTypedSchema(l.objectType({id:l.stringType().optional(),status:l.stringType().optional(),title:l.stringType().min(1,"Title is required"),description:l.stringType().optional(),price:l.preprocessType(r=>r===""?void 0:r,l.coerce.number().positive("Must be positive").optional()),countries:l.arrayType(l.stringType()).optional(),condition:l.stringType(),condition_min:l.preprocessType(r=>r===""?void 0:r,l.coerce.number().positive("Must be positive").optional()),condition_max:l.preprocessType(r=>r===""?void 0:r,l.coerce.number().positive("Must be positive").optional())})),{handleSubmit:w,errors:N,values:f,setValues:T}=l.useForm({validationSchema:V,initialValues:{status:"published",countries:[],condition:"always"}});$.useModuleBreadcrumbs(()=>[{text:f.title??"New Option"}]);const S=w(async r=>{m.value=!0;let i=await k()||[];if(c.value){let _=JSON.parse(JSON.stringify(r));_.id=crypto.randomUUID();const v=[...i,_],C=d.config.shippingOptionsCollection.split(":");await t.update(C[0],null,{[C[1]]:v}),s(_.id),E.toast.success("Shipping option created")}else{let _=JSON.parse(JSON.stringify(r));const v=i.map(h=>h.id===n.value.optionId?_:h),C=d.config.shippingOptionsCollection.split(":");await t.update(C[0],null,{[C[1]]:v}),s(`${n.value.optionId}`),E.toast.success("Shipping option updated")}m.value=!1}),k=async()=>{if(!d.config.shippingOptionsCollection)return[];const r=d.config.shippingOptionsCollection.split(":");return r.length!==2?[]:(await t.get(r[0]))?.[r[1]]||[]},x=async()=>{const i=(await k()).find(_=>_.id===n.value.optionId);T(i),p.value=!0},b=async()=>{try{const r=await k();let i={...[...r||[]].find(h=>h.id===n.value.optionId)};console.log(r,n.value.optionId,r.find(h=>h.id===n.value.optionId)),i.id=crypto.randomUUID(),i.status="published",i.title=i.title+" (copy)";const v=[...await k()||[],i],C=d.config.shippingOptionsCollection.split(":");await t.update(C[0],null,{[C[1]]:v}),s(i.id),E.toast.success("Option duplicated")}catch{E.toast.error("Failed to duplicate option")}},O=async()=>{if(await u("Are you sure you want to delete this option?"))try{const i=await k()||[];if(i.length===0||!n.value.optionId)throw new Error("Error loading values");const _=i.filter(C=>C.id!==n.value.optionId),v=d.config.shippingOptionsCollection.split(":");await t.update(v[0],null,{[v[1]]:_}),s(""),E.toast.success("Option deleted")}catch{E.toast.error("Failed to delete option")}};return e.onMounted(()=>{c.value?p.value=!0:x()}),e.provide("isLoadingCompleted",p),(r,i)=>{const _=e.resolveComponent("Button"),v=e.resolveComponent("MenubarTrigger"),C=e.resolveComponent("MenubarMenu"),h=e.resolveComponent("MenubarItem"),I=e.resolveComponent("MenubarContent"),D=e.resolveComponent("Menubar");return e.openBlock(),e.createElementBlock("div",Oe,[e.createElementVNode("div",Ie,[e.createElementVNode("div",De,[e.createVNode(_,{variant:"ghost",onClick:i[0]||(i[0]=Pe=>e.unref(s)(""))},{default:e.withCtx(()=>[e.createVNode(e.unref(g.Tag),{class:"size-4"})]),_:1}),e.createVNode(e.unref(g.ChevronRight),{class:"size-3"}),e.createElementVNode("h1",Me,e.toDisplayString(c.value?"New Option":e.unref(f).title),1)]),c.value?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(D,{key:0,class:"bg-sidebar"},{default:e.withCtx(()=>[e.unref(o)("create-collection")?(e.openBlock(),e.createBlock(C,{key:0},{default:e.withCtx(()=>[e.createVNode(v,{onClick:b},{default:e.withCtx(()=>[...i[1]||(i[1]=[e.createTextVNode("Duplicate",-1)])]),_:1})]),_:1})):e.createCommentVNode("",!0),e.unref(a)("edit-collection","delete-option")?(e.openBlock(),e.createBlock(C,{key:1},{default:e.withCtx(()=>[e.createVNode(v,null,{default:e.withCtx(()=>[...i[2]||(i[2]=[e.createTextVNode("More actions",-1)])]),_:1}),e.createVNode(I,null,{default:e.withCtx(()=>[e.unref(o)("delete-option")?(e.openBlock(),e.createBlock(h,{key:0,variant:"destructive",onClick:O},{default:e.withCtx(()=>[e.createVNode(e.unref(g.Trash),{class:"size-4"}),i[3]||(i[3]=e.createTextVNode(" Delete option ",-1))]),_:1})):e.createCommentVNode("",!0)]),_:1})]),_:1})):e.createCommentVNode("",!0)]),_:1}))]),e.createElementVNode("div",Fe,[e.createElementVNode("div",Le,[e.createVNode(G),e.createVNode(oe),e.createVNode(we)]),e.createElementVNode("div",Re,[e.createVNode(Te)])]),e.unref(a)("create-option","edit-option")?(e.openBlock(),e.createElementBlock("div",ze,[e.createElementVNode("div",Ue,[c.value&&e.unref(o)("create-option")?(e.openBlock(),e.createBlock(_,{key:0,onClick:e.unref(S),disabled:m.value},{default:e.withCtx(()=>[m.value?(e.openBlock(),e.createBlock(e.unref(g.Loader2),{key:0,class:"size-4 animate-spin"})):e.createCommentVNode("",!0),e.createTextVNode(" "+e.toDisplayString(m.value?"Creating":"Create")+" New Option ",1)]),_:1},8,["onClick","disabled"])):e.unref(o)("edit-option")?(e.openBlock(),e.createBlock(_,{key:1,onClick:e.unref(S),disabled:m.value},{default:e.withCtx(()=>[m.value?(e.openBlock(),e.createBlock(e.unref(g.Loader2),{key:0,class:"size-4 animate-spin"})):e.createCommentVNode("",!0),e.createTextVNode(" "+e.toDisplayString(m.value?"Saving":"Save")+" Changes ",1)]),_:1},8,["onClick","disabled"])):e.createCommentVNode("",!0)])])):e.createCommentVNode("",!0)])}}});exports.default=je;
@@ -1,6 +1,6 @@
1
- import { defineComponent as r, onMounted as n, createElementBlock as c, openBlock as s, createVNode as a } from "vue";
1
+ import { defineComponent as r, onMounted as n, openBlock as c, createElementBlock as s, createVNode as a } from "vue";
2
2
  import { useModuleBreadcrumbs as i, useFirebaseIntegration as p } from "@oneclick.dev/cms-kit";
3
- import { _ as m } from "./TemplateList.vue_vue_type_script_setup_true_lang-BiLAkhIA.mjs";
3
+ import { _ as m } from "./TemplateList.vue_vue_type_script_setup_true_lang-Cmovy7kk.mjs";
4
4
  const u = { class: "relative" }, b = /* @__PURE__ */ r({
5
5
  __name: "Detail",
6
6
  props: {
@@ -16,7 +16,7 @@ const u = { class: "relative" }, b = /* @__PURE__ */ r({
16
16
  };
17
17
  return n(() => {
18
18
  o();
19
- }), (_, l) => (s(), c("div", u, [
19
+ }), (_, l) => (c(), s("div", u, [
20
20
  a(m)
21
21
  ]));
22
22
  }
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),s=require("./vee-validate-zod-BPQyEfpF.js"),b=require("lucide-vue-next"),z=require("./google-D4N3gb01.js"),k=require("@oneclick.dev/cms-kit"),w=require("./index-ijdf0d9-.js"),F={class:"flex flex-col gap-4"},j={class:"flex flex-col gap-2"},U={key:0,class:"text-red-500 text-sm mt-1"},q={class:"flex flex-col gap-4"},L={class:"flex flex-col gap-2"},O={key:0,class:"text-red-500 text-sm mt-1"},R={class:"flex flex-col gap-4"},J={class:"flex flex-col gap-2"},A={class:"flex items-center gap-2 mb-2"},G={class:"flex items-center gap-2"},K=["src"],W={key:0,class:"text-red-500 text-sm mt-1"},X=e.defineComponent({__name:"Main",setup(y){const a=e.inject("sources");e.inject("defaultSource");const{errors:c}=s.useFormContext(),{value:p}=s.useField("title"),{value:o}=s.useField("description"),{value:i}=s.useField("thumbnail"),C=l=>{i.value=l};return(l,n)=>{const d=e.resolveComponent("Label"),g=e.resolveComponent("Input"),V=e.resolveComponent("Textarea"),N=e.resolveComponent("Button"),f=e.resolveComponent("MediaPickerDialog"),S=e.resolveComponent("CardContent"),B=e.resolveComponent("Card");return e.openBlock(),e.createBlock(B,null,{default:e.withCtx(()=>[e.createVNode(S,{class:"flex flex-col gap-4"},{default:e.withCtx(()=>[e.createElementVNode("div",F,[e.createElementVNode("div",j,[e.createVNode(d,{for:"title",class:"text-sm mb-2"},{default:e.withCtx(()=>[...n[5]||(n[5]=[e.createTextVNode("Title",-1)])]),_:1}),e.createVNode(g,{type:"text",id:"title",placeholder:"Summer collection",modelValue:e.unref(p),"onUpdate:modelValue":n[0]||(n[0]=_=>e.isRef(p)?p.value=_:null)},null,8,["modelValue"]),e.unref(c).title?(e.openBlock(),e.createElementBlock("p",U,e.toDisplayString(e.unref(c).title),1)):e.createCommentVNode("",!0)])]),e.createElementVNode("div",q,[e.createElementVNode("div",L,[e.createVNode(d,{for:"description",class:"text-sm mb-2"},{default:e.withCtx(()=>[...n[6]||(n[6]=[e.createTextVNode("Description",-1)])]),_:1}),e.createVNode(V,{id:"description",placeholder:"Fresh, vibrant, and bold. The perfect collection for the summer season.",modelValue:e.unref(o),"onUpdate:modelValue":n[1]||(n[1]=_=>e.isRef(o)?o.value=_:null)},null,8,["modelValue"]),e.unref(c).description?(e.openBlock(),e.createElementBlock("p",O,e.toDisplayString(e.unref(c).description),1)):e.createCommentVNode("",!0)])]),e.createElementVNode("div",R,[e.createElementVNode("div",J,[e.createElementVNode("div",A,[e.createVNode(d,{for:"media",class:"text-sm"},{default:e.withCtx(()=>[...n[7]||(n[7]=[e.createTextVNode("Thumbnail",-1)])]),_:1}),e.unref(i)?(e.openBlock(),e.createBlock(N,{key:0,variant:"ghost",size:"icon",onClick:n[2]||(n[2]=_=>i.value="")},{default:e.withCtx(()=>[e.createVNode(e.unref(b.X),{class:"size-4"})]),_:1})):e.createCommentVNode("",!0)]),e.createElementVNode("div",G,[e.createVNode(f,{sources:e.unref(a),maxFiles:1,"initial-value":e.unref(i)?[e.unref(i)]:[],onSubmit:n[4]||(n[4]=_=>C(_))},{default:e.withCtx(()=>[e.createElementVNode("button",{onClick:n[3]||(n[3]=e.withModifiers(()=>{},["stop"])),tabindex:"-1",class:"cursor-pointer block"},[e.unref(i)?(e.openBlock(),e.createElementBlock("img",{key:1,src:e.unref(i),class:"size-42 rounded-md object-cover",draggable:"false"},null,8,K)):(e.openBlock(),e.createBlock(N,{key:0,variant:"outline",class:"size-42 border-dashed cursor-pointer"},{default:e.withCtx(()=>[e.createVNode(e.unref(b.ImagePlus))]),_:1}))])]),_:1},8,["sources","initial-value"]),e.unref(c).thumbnail?(e.openBlock(),e.createElementBlock("p",W,e.toDisplayString(e.unref(c).thumbnail),1)):e.createCommentVNode("",!0)])])])]),_:1})]),_:1})}}}),Z={class:"bg-white dark:bg-gray-50 border-4 dark:border-gray-600 p-4 rounded-lg mb-4"},H={class:"flex items-center gap-2 mb-2"},Q=["src"],Y={class:"text-[#1a0dab] text-lg"},ee={class:"text-[#006621] text-[13px]"},te={class:"text-[#545454] text-[13px]"},oe={class:"flex flex-col gap-4 mb-4"},le={class:"flex flex-col"},ne={key:0,class:"text-red-500 text-sm mt-1"},se={class:"flex flex-col gap-4 mb-4"},re={class:"flex flex-col"},ae={key:0,class:"text-red-500 text-sm mt-1"},ce={class:"flex flex-col gap-4"},ie={class:"flex flex-col"},de={key:0,class:"text-red-500 text-sm mt-1"},ue={key:1,class:"text-[#545454] text-[13px]"},me={key:2,class:"text-orange-500 text-[13px]"},pe=e.defineComponent({__name:"SEO",setup(y){const{errors:a}=s.useFormContext(),{value:c}=s.useField("title"),{value:p}=s.useField("slug"),{value:o}=s.useField("seo");function i(C){return C?C.normalize("NFD").replace(/[̀-ͯ]/g,"").toLowerCase().replace(/[^\w\s-]/g,"").trim().replace(/[-\s]+/g,"-"):""}return e.watch(c,(C,l)=>{(!p.value||i(l)===p.value)&&(p.value=i(C)),(!o.value.title||l===o.value.title)&&(o.value.title=C)}),(C,l)=>{const n=e.resolveComponent("Label"),d=e.resolveComponent("Input"),g=e.resolveComponent("Textarea"),V=e.resolveComponent("CardContent"),N=e.resolveComponent("Card");return e.openBlock(),e.createBlock(N,null,{default:e.withCtx(()=>[e.createVNode(V,null,{default:e.withCtx(()=>[l[7]||(l[7]=e.createElementVNode("h3",{class:"text-lg font-semibold mb-4"},"Search engine listing",-1)),e.createElementVNode("div",Z,[e.createElementVNode("div",H,[e.createElementVNode("img",{src:e.unref(z.googleImg),alt:"Google",class:"w-16 pointer-events-none",draggable:"false"},null,8,Q),l[3]||(l[3]=e.createElementVNode("span",{class:"text-[#4186f5] font-medium text-xs"},"Preview",-1))]),e.createElementVNode("p",Y,e.toDisplayString(e.unref(o).title),1),e.createElementVNode("p",ee,e.toDisplayString(e.unref(p)),1),e.createElementVNode("p",te,e.toDisplayString(e.unref(o).description?.slice(0,155))+e.toDisplayString(e.unref(o).description?.length>155?" ...":""),1)]),e.createElementVNode("div",oe,[e.createElementVNode("div",le,[e.createVNode(n,{for:"slug",class:"text-sm mb-2"},{default:e.withCtx(()=>[...l[4]||(l[4]=[e.createTextVNode("Slug",-1)])]),_:1}),e.createVNode(d,{id:"slug",placeholder:"t-shirt-with-red-heart",modelValue:e.unref(p),"onUpdate:modelValue":l[0]||(l[0]=f=>e.isRef(p)?p.value=f:null)},null,8,["modelValue"]),e.unref(a).slug?(e.openBlock(),e.createElementBlock("p",ne,e.toDisplayString(e.unref(a).slug),1)):e.createCommentVNode("",!0)])]),e.createElementVNode("div",se,[e.createElementVNode("div",re,[e.createVNode(n,{for:"meta-title",class:"text-sm mb-2"},{default:e.withCtx(()=>[...l[5]||(l[5]=[e.createTextVNode("Title",-1)])]),_:1}),e.createVNode(d,{id:"meta-title",placeholder:"T-shirt with red heart",modelValue:e.unref(o).title,"onUpdate:modelValue":l[1]||(l[1]=f=>e.unref(o).title=f)},null,8,["modelValue"]),e.unref(a).seo?.title?(e.openBlock(),e.createElementBlock("p",ae,e.toDisplayString(e.unref(a).seo.title),1)):e.createCommentVNode("",!0)])]),e.createElementVNode("div",ce,[e.createElementVNode("div",ie,[e.createVNode(n,{for:"meta-description",class:"text-sm mb-2"},{default:e.withCtx(()=>[...l[6]||(l[6]=[e.createTextVNode("Description",-1)])]),_:1}),e.createVNode(g,{id:"meta-description",placeholder:"Lovely T-shirt featuring a red heart",modelValue:e.unref(o).description,"onUpdate:modelValue":l[2]||(l[2]=f=>e.unref(o).description=f),class:"mb-1 resize-none"},null,8,["modelValue"]),e.unref(a).seo?.description?(e.openBlock(),e.createElementBlock("p",de,e.toDisplayString(e.unref(a).seo.description),1)):e.unref(o).description.length<155?(e.openBlock(),e.createElementBlock("p",ue,e.toDisplayString(e.unref(o).description.length)+" characters",1)):(e.openBlock(),e.createElementBlock("p",me,"Please keep it under 155 characters"))])])]),_:1})]),_:1})}}}),fe={class:"flex items-center gap-2"},xe={key:0,class:"size-3 rounded-full bg-green-500"},Ce={key:1,class:"size-3 rounded-full bg-blue-500"},_e=e.defineComponent({__name:"Status",setup(y){const{errors:a}=s.useFormContext(),{value:c}=s.useField("status");return(p,o)=>{const i=e.resolveComponent("SelectValue"),C=e.resolveComponent("SelectTrigger"),l=e.resolveComponent("SelectItem"),n=e.resolveComponent("SelectGroup"),d=e.resolveComponent("SelectContent"),g=e.resolveComponent("Select"),V=e.resolveComponent("CardContent"),N=e.resolveComponent("Card");return e.openBlock(),e.createBlock(N,null,{default:e.withCtx(()=>[e.createVNode(V,null,{default:e.withCtx(()=>[o[3]||(o[3]=e.createElementVNode("p",{class:"text-md font-semibold mb-2"},"Status",-1)),e.createVNode(g,{modelValue:e.unref(c),"onUpdate:modelValue":o[0]||(o[0]=f=>e.isRef(c)?c.value=f:null),class:"w-full"},{default:e.withCtx(()=>[e.createVNode(C,{class:"w-full"},{default:e.withCtx(()=>[e.createElementVNode("div",fe,[e.unref(c)==="published"?(e.openBlock(),e.createElementBlock("span",xe)):e.unref(c)==="draft"?(e.openBlock(),e.createElementBlock("span",Ce)):e.createCommentVNode("",!0),e.createVNode(i,{placeholder:"Status"})])]),_:1}),e.createVNode(d,null,{default:e.withCtx(()=>[e.createVNode(n,null,{default:e.withCtx(()=>[e.createVNode(l,{value:"published"},{default:e.withCtx(()=>[...o[1]||(o[1]=[e.createElementVNode("span",{class:"size-3 rounded-full bg-green-500"},null,-1),e.createTextVNode(" Published ",-1)])]),_:1}),e.createVNode(l,{value:"draft"},{default:e.withCtx(()=>[...o[2]||(o[2]=[e.createElementVNode("span",{class:"size-3 rounded-full bg-blue-500"},null,-1),e.createTextVNode(" Draft ",-1)])]),_:1})]),_:1})]),_:1})]),_:1},8,["modelValue"])]),_:1})]),_:1})}}}),ge={class:"relative @container"},Ve={class:"flex flex-row gap-4 justify-between max-w-5xl mx-auto mt-4 mb-6"},Ne={class:"flex items-center"},ve={class:"text-lg font-semibold mx-2"},we={key:0,class:"bg-green-500 text-green-950 px-2 py-1 rounded-lg text-xs"},be={key:1,class:"bg-blue-500 text-blue-950 px-2 py-1 rounded-lg text-xs"},he={class:"flex flex-col @3xl:flex-row gap-4 max-w-5xl mx-auto pb-24"},ke={class:"flex flex-col gap-4 w-full @3xl:w-2/3"},ye={class:"flex flex-col gap-4 w-full @3xl:w-1/3"},Be={key:0,class:"fixed bottom-4 left-0 md:left-12 right-0 min-w-xs max-w-5xl w-[calc(100%-2rem)] md:w-[calc(100%-5rem)] xl:w-[calc(100%-2rem)] h-16 border border-white/10 backdrop-blur-sm border-t border-border flex items-center justify-center px-4 mx-auto z-[9999] rounded-xl overflow-hidden shadow bg-[radial-gradient(#ffffff80,transparent)] dark:bg-[radial-gradient(#00000080,transparent)]"},Se={class:"w-full max-w-5xl flex items-center justify-end mx-auto"},Ee=e.defineComponent({__name:"Detail",props:{config:{type:Object,required:!0}},setup(y){const a=y,{hasPermission:c,hasAnyPermission:p}=k.useModulePermissions(),{params:o,navigateTo:i}=k.useModuleRoute(),{confirm:C}=k.useConfirmation(),l=k.useFirebaseIntegration(a.config.project);e.provide("sources",a.config.allowedMediaSources),e.provide("defaultSource",a.config.defaultUploadMediaSource);const n=e.computed(()=>!o.value.collectionId||o.value.collectionId==="new"),d=e.ref(!1),g=s.toTypedSchema(s.objectType({id:s.stringType().optional(),title:s.stringType().min(1,"Title is required"),type:s.stringType(),description:s.stringType().optional(),thumbnail:s.stringType().optional(),slug:s.stringType(),seo:s.objectType({title:s.stringType().optional(),description:s.stringType().optional()}).optional(),status:s.stringType()})),{handleSubmit:V,errors:N,values:f,setValues:S}=s.useForm({validationSchema:g,initialValues:{status:"draft",type:"manual",seo:{title:"",description:""}}});k.useModuleBreadcrumbs(()=>[{text:n.value?"New Collection":f.title||"Collection"}]);const B=V(async r=>{d.value=!0;let t=await _()||[];if(n.value){let u=JSON.parse(JSON.stringify(r));if(u.id=crypto.randomUUID(),await E(u.slug)){w.toast.error("Collection with this slug already exists"),d.value=!1;return}const x=[...t,u],m=a.config.collectionsCollection.split(":");console.log("collectionParts",m[0],{[m[1]]:x}),await l.update(m[0],null,{[m[1]]:x}),i("/"),w.toast.success("Collection created")}else{let u=JSON.parse(JSON.stringify(r));const x=t.map(v=>v.id===o.value.collectionId?u:v),m=a.config.collectionsCollection.split(":");await l.update(m[0],null,{[m[1]]:x}),i("/"),w.toast.success("Collection updated")}d.value=!1}),_=async()=>{if(!a.config.collectionsCollection)return[];const r=a.config.collectionsCollection.split(":");return r.length!==2?[]:(await l.get(r[0]))?.[r[1]]||[]},M=async()=>{const t=(await _()).find(u=>u.id===o.value.collectionId);S(t)},D=async()=>{try{let r={...f},t=r.slug+"-copy",u=2;for(;await E(t);)t=r.slug+"-copy-"+u,u++;r.id=crypto.randomUUID(),r.slug=t,r.status="draft",r.title=r.title+" (copy)";const m=[...await _()||[],r],v=a.config.collectionsCollection.split(":");await l.update(v[0],null,{[v[1]]:m}),i(r.id),w.toast.success("Collection duplicated")}catch{w.toast.error("Failed to duplicate collection")}},P=async()=>{if(await C("Are you sure you want to delete this collection?"))try{const t=await _()||[];if(t.length===0||!o.value.collectionId)throw new Error("Error loading values");const u=t.filter(m=>m.id!==o.value.collectionId),x=a.config.collectionsCollection.split(":");await l.update(x[0],null,{[x[1]]:u}),i(""),w.toast.success("Collection deleted")}catch{w.toast.error("Failed to delete collection")}},E=async r=>!!(await _()||[]).find(u=>u.slug===r);return e.onMounted(()=>{n.value||M()}),(r,t)=>{const u=e.resolveComponent("Button"),x=e.resolveComponent("MenubarTrigger"),m=e.resolveComponent("MenubarMenu"),v=e.resolveComponent("MenubarShortcut"),h=e.resolveComponent("MenubarItem"),T=e.resolveComponent("MenubarSeparator"),$=e.resolveComponent("MenubarContent"),I=e.resolveComponent("Menubar");return e.openBlock(),e.createElementBlock("div",ge,[e.createElementVNode("div",Ve,[e.createElementVNode("div",Ne,[e.createVNode(u,{variant:"ghost",onClick:t[0]||(t[0]=Te=>e.unref(i)(""))},{default:e.withCtx(()=>[e.createVNode(e.unref(b.Tag),{class:"size-4"})]),_:1}),e.createVNode(e.unref(b.ChevronRight),{class:"size-3"}),e.createElementVNode("h1",ve,e.toDisplayString(n.value?"New Collection":e.unref(f).title),1),e.unref(f).status==="published"?(e.openBlock(),e.createElementBlock("span",we,"Published")):e.unref(f).status==="draft"?(e.openBlock(),e.createElementBlock("span",be,"Draft")):e.createCommentVNode("",!0)]),n.value?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(I,{key:0,class:"bg-sidebar"},{default:e.withCtx(()=>[e.unref(c)("create-collection")?(e.openBlock(),e.createBlock(m,{key:0},{default:e.withCtx(()=>[e.createVNode(x,{onClick:D},{default:e.withCtx(()=>[...t[1]||(t[1]=[e.createTextVNode("Duplicate",-1)])]),_:1})]),_:1})):e.createCommentVNode("",!0),e.createVNode(m,null,{default:e.withCtx(()=>[e.createVNode(x,null,{default:e.withCtx(()=>[...t[2]||(t[2]=[e.createTextVNode("Preview",-1)])]),_:1})]),_:1}),e.createVNode(m,null,{default:e.withCtx(()=>[e.createVNode(x,null,{default:e.withCtx(()=>[...t[3]||(t[3]=[e.createTextVNode("Share",-1)])]),_:1}),e.createVNode($,null,{default:e.withCtx(()=>[e.createVNode(h,null,{default:e.withCtx(()=>[t[5]||(t[5]=e.createTextVNode(" New Tab ",-1)),e.createVNode(v,null,{default:e.withCtx(()=>[...t[4]||(t[4]=[e.createTextVNode("⌘T",-1)])]),_:1})]),_:1}),e.createVNode(h,null,{default:e.withCtx(()=>[...t[6]||(t[6]=[e.createTextVNode("New Window",-1)])]),_:1}),e.createVNode(T),e.createVNode(h,null,{default:e.withCtx(()=>[...t[7]||(t[7]=[e.createTextVNode("Share",-1)])]),_:1}),e.createVNode(T),e.createVNode(h,null,{default:e.withCtx(()=>[...t[8]||(t[8]=[e.createTextVNode("Print",-1)])]),_:1})]),_:1})]),_:1}),e.unref(p)("edit-collection","delete-collection")?(e.openBlock(),e.createBlock(m,{key:1},{default:e.withCtx(()=>[e.createVNode(x,null,{default:e.withCtx(()=>[...t[9]||(t[9]=[e.createTextVNode("More actions",-1)])]),_:1}),e.createVNode($,null,{default:e.withCtx(()=>[e.unref(c)("delete-collection")?(e.openBlock(),e.createBlock(h,{key:0,variant:"destructive",onClick:P},{default:e.withCtx(()=>[e.createVNode(e.unref(b.Trash),{class:"size-4"}),t[10]||(t[10]=e.createTextVNode(" Delete collection ",-1))]),_:1})):e.createCommentVNode("",!0)]),_:1})]),_:1})):e.createCommentVNode("",!0)]),_:1}))]),e.createElementVNode("div",he,[e.createElementVNode("div",ke,[e.createVNode(X),e.createVNode(pe)]),e.createElementVNode("div",ye,[e.createVNode(_e)])]),e.unref(p)("create-collection","edit-collection")?(e.openBlock(),e.createElementBlock("div",Be,[e.createElementVNode("div",Se,[n.value&&e.unref(c)("create-collection")?(e.openBlock(),e.createBlock(u,{key:0,onClick:e.unref(B),disabled:d.value},{default:e.withCtx(()=>[d.value?(e.openBlock(),e.createBlock(e.unref(b.Loader2),{key:0,class:"size-4 animate-spin"})):e.createCommentVNode("",!0),e.createTextVNode(" "+e.toDisplayString(d.value?"Creating":"Create")+" New Collection ",1)]),_:1},8,["onClick","disabled"])):e.unref(c)("edit-collection")?(e.openBlock(),e.createBlock(u,{key:1,onClick:e.unref(B),disabled:d.value},{default:e.withCtx(()=>[d.value?(e.openBlock(),e.createBlock(e.unref(b.Loader2),{key:0,class:"size-4 animate-spin"})):e.createCommentVNode("",!0),e.createTextVNode(" "+e.toDisplayString(d.value?"Saving":"Save")+" Changes ",1)]),_:1},8,["onClick","disabled"])):e.createCommentVNode("",!0)])])):e.createCommentVNode("",!0)])}}});exports.default=Ee;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),s=require("./vee-validate-zod-ByykgYKJ.js"),b=require("lucide-vue-next"),z=require("./google-D4N3gb01.js"),k=require("@oneclick.dev/cms-kit"),w=require("./index-ijdf0d9-.js"),F={class:"flex flex-col gap-4"},j={class:"flex flex-col gap-2"},U={key:0,class:"text-red-500 text-sm mt-1"},q={class:"flex flex-col gap-4"},L={class:"flex flex-col gap-2"},O={key:0,class:"text-red-500 text-sm mt-1"},R={class:"flex flex-col gap-4"},J={class:"flex flex-col gap-2"},A={class:"flex items-center gap-2 mb-2"},G={class:"flex items-center gap-2"},K=["src"],W={key:0,class:"text-red-500 text-sm mt-1"},X=e.defineComponent({__name:"Main",setup(y){const a=e.inject("sources");e.inject("defaultSource");const{errors:c}=s.useFormContext(),{value:p}=s.useField("title"),{value:o}=s.useField("description"),{value:i}=s.useField("thumbnail"),C=l=>{i.value=l};return(l,n)=>{const d=e.resolveComponent("Label"),g=e.resolveComponent("Input"),V=e.resolveComponent("Textarea"),N=e.resolveComponent("Button"),f=e.resolveComponent("MediaPickerDialog"),S=e.resolveComponent("CardContent"),B=e.resolveComponent("Card");return e.openBlock(),e.createBlock(B,null,{default:e.withCtx(()=>[e.createVNode(S,{class:"flex flex-col gap-4"},{default:e.withCtx(()=>[e.createElementVNode("div",F,[e.createElementVNode("div",j,[e.createVNode(d,{for:"title",class:"text-sm mb-2"},{default:e.withCtx(()=>[...n[5]||(n[5]=[e.createTextVNode("Title",-1)])]),_:1}),e.createVNode(g,{type:"text",id:"title",placeholder:"Summer collection",modelValue:e.unref(p),"onUpdate:modelValue":n[0]||(n[0]=_=>e.isRef(p)?p.value=_:null)},null,8,["modelValue"]),e.unref(c).title?(e.openBlock(),e.createElementBlock("p",U,e.toDisplayString(e.unref(c).title),1)):e.createCommentVNode("",!0)])]),e.createElementVNode("div",q,[e.createElementVNode("div",L,[e.createVNode(d,{for:"description",class:"text-sm mb-2"},{default:e.withCtx(()=>[...n[6]||(n[6]=[e.createTextVNode("Description",-1)])]),_:1}),e.createVNode(V,{id:"description",placeholder:"Fresh, vibrant, and bold. The perfect collection for the summer season.",modelValue:e.unref(o),"onUpdate:modelValue":n[1]||(n[1]=_=>e.isRef(o)?o.value=_:null)},null,8,["modelValue"]),e.unref(c).description?(e.openBlock(),e.createElementBlock("p",O,e.toDisplayString(e.unref(c).description),1)):e.createCommentVNode("",!0)])]),e.createElementVNode("div",R,[e.createElementVNode("div",J,[e.createElementVNode("div",A,[e.createVNode(d,{for:"media",class:"text-sm"},{default:e.withCtx(()=>[...n[7]||(n[7]=[e.createTextVNode("Thumbnail",-1)])]),_:1}),e.unref(i)?(e.openBlock(),e.createBlock(N,{key:0,variant:"ghost",size:"icon",onClick:n[2]||(n[2]=_=>i.value="")},{default:e.withCtx(()=>[e.createVNode(e.unref(b.X),{class:"size-4"})]),_:1})):e.createCommentVNode("",!0)]),e.createElementVNode("div",G,[e.createVNode(f,{sources:e.unref(a),maxFiles:1,"initial-value":e.unref(i)?[e.unref(i)]:[],onSubmit:n[4]||(n[4]=_=>C(_))},{default:e.withCtx(()=>[e.createElementVNode("button",{onClick:n[3]||(n[3]=e.withModifiers(()=>{},["stop"])),tabindex:"-1",class:"cursor-pointer block"},[e.unref(i)?(e.openBlock(),e.createElementBlock("img",{key:1,src:e.unref(i),class:"size-42 rounded-md object-cover",draggable:"false"},null,8,K)):(e.openBlock(),e.createBlock(N,{key:0,variant:"outline",class:"size-42 border-dashed cursor-pointer"},{default:e.withCtx(()=>[e.createVNode(e.unref(b.ImagePlus))]),_:1}))])]),_:1},8,["sources","initial-value"]),e.unref(c).thumbnail?(e.openBlock(),e.createElementBlock("p",W,e.toDisplayString(e.unref(c).thumbnail),1)):e.createCommentVNode("",!0)])])])]),_:1})]),_:1})}}}),Z={class:"bg-white dark:bg-gray-50 border-4 dark:border-gray-600 p-4 rounded-lg mb-4"},H={class:"flex items-center gap-2 mb-2"},Q=["src"],Y={class:"text-[#1a0dab] text-lg"},ee={class:"text-[#006621] text-[13px]"},te={class:"text-[#545454] text-[13px]"},oe={class:"flex flex-col gap-4 mb-4"},le={class:"flex flex-col"},ne={key:0,class:"text-red-500 text-sm mt-1"},se={class:"flex flex-col gap-4 mb-4"},re={class:"flex flex-col"},ae={key:0,class:"text-red-500 text-sm mt-1"},ce={class:"flex flex-col gap-4"},ie={class:"flex flex-col"},de={key:0,class:"text-red-500 text-sm mt-1"},ue={key:1,class:"text-[#545454] text-[13px]"},me={key:2,class:"text-orange-500 text-[13px]"},pe=e.defineComponent({__name:"SEO",setup(y){const{errors:a}=s.useFormContext(),{value:c}=s.useField("title"),{value:p}=s.useField("slug"),{value:o}=s.useField("seo");function i(C){return C?C.normalize("NFD").replace(/[̀-ͯ]/g,"").toLowerCase().replace(/[^\w\s-]/g,"").trim().replace(/[-\s]+/g,"-"):""}return e.watch(c,(C,l)=>{(!p.value||i(l)===p.value)&&(p.value=i(C)),(!o.value.title||l===o.value.title)&&(o.value.title=C)}),(C,l)=>{const n=e.resolveComponent("Label"),d=e.resolveComponent("Input"),g=e.resolveComponent("Textarea"),V=e.resolveComponent("CardContent"),N=e.resolveComponent("Card");return e.openBlock(),e.createBlock(N,null,{default:e.withCtx(()=>[e.createVNode(V,null,{default:e.withCtx(()=>[l[7]||(l[7]=e.createElementVNode("h3",{class:"text-lg font-semibold mb-4"},"Search engine listing",-1)),e.createElementVNode("div",Z,[e.createElementVNode("div",H,[e.createElementVNode("img",{src:e.unref(z.googleImg),alt:"Google",class:"w-16 pointer-events-none",draggable:"false"},null,8,Q),l[3]||(l[3]=e.createElementVNode("span",{class:"text-[#4186f5] font-medium text-xs"},"Preview",-1))]),e.createElementVNode("p",Y,e.toDisplayString(e.unref(o).title),1),e.createElementVNode("p",ee,e.toDisplayString(e.unref(p)),1),e.createElementVNode("p",te,e.toDisplayString(e.unref(o).description?.slice(0,155))+e.toDisplayString(e.unref(o).description?.length>155?" ...":""),1)]),e.createElementVNode("div",oe,[e.createElementVNode("div",le,[e.createVNode(n,{for:"slug",class:"text-sm mb-2"},{default:e.withCtx(()=>[...l[4]||(l[4]=[e.createTextVNode("Slug",-1)])]),_:1}),e.createVNode(d,{id:"slug",placeholder:"t-shirt-with-red-heart",modelValue:e.unref(p),"onUpdate:modelValue":l[0]||(l[0]=f=>e.isRef(p)?p.value=f:null)},null,8,["modelValue"]),e.unref(a).slug?(e.openBlock(),e.createElementBlock("p",ne,e.toDisplayString(e.unref(a).slug),1)):e.createCommentVNode("",!0)])]),e.createElementVNode("div",se,[e.createElementVNode("div",re,[e.createVNode(n,{for:"meta-title",class:"text-sm mb-2"},{default:e.withCtx(()=>[...l[5]||(l[5]=[e.createTextVNode("Title",-1)])]),_:1}),e.createVNode(d,{id:"meta-title",placeholder:"T-shirt with red heart",modelValue:e.unref(o).title,"onUpdate:modelValue":l[1]||(l[1]=f=>e.unref(o).title=f)},null,8,["modelValue"]),e.unref(a).seo?.title?(e.openBlock(),e.createElementBlock("p",ae,e.toDisplayString(e.unref(a).seo.title),1)):e.createCommentVNode("",!0)])]),e.createElementVNode("div",ce,[e.createElementVNode("div",ie,[e.createVNode(n,{for:"meta-description",class:"text-sm mb-2"},{default:e.withCtx(()=>[...l[6]||(l[6]=[e.createTextVNode("Description",-1)])]),_:1}),e.createVNode(g,{id:"meta-description",placeholder:"Lovely T-shirt featuring a red heart",modelValue:e.unref(o).description,"onUpdate:modelValue":l[2]||(l[2]=f=>e.unref(o).description=f),class:"mb-1 resize-none"},null,8,["modelValue"]),e.unref(a).seo?.description?(e.openBlock(),e.createElementBlock("p",de,e.toDisplayString(e.unref(a).seo.description),1)):e.unref(o).description.length<155?(e.openBlock(),e.createElementBlock("p",ue,e.toDisplayString(e.unref(o).description.length)+" characters",1)):(e.openBlock(),e.createElementBlock("p",me,"Please keep it under 155 characters"))])])]),_:1})]),_:1})}}}),fe={class:"flex items-center gap-2"},xe={key:0,class:"size-3 rounded-full bg-green-500"},Ce={key:1,class:"size-3 rounded-full bg-blue-500"},_e=e.defineComponent({__name:"Status",setup(y){const{errors:a}=s.useFormContext(),{value:c}=s.useField("status");return(p,o)=>{const i=e.resolveComponent("SelectValue"),C=e.resolveComponent("SelectTrigger"),l=e.resolveComponent("SelectItem"),n=e.resolveComponent("SelectGroup"),d=e.resolveComponent("SelectContent"),g=e.resolveComponent("Select"),V=e.resolveComponent("CardContent"),N=e.resolveComponent("Card");return e.openBlock(),e.createBlock(N,null,{default:e.withCtx(()=>[e.createVNode(V,null,{default:e.withCtx(()=>[o[3]||(o[3]=e.createElementVNode("p",{class:"text-md font-semibold mb-2"},"Status",-1)),e.createVNode(g,{modelValue:e.unref(c),"onUpdate:modelValue":o[0]||(o[0]=f=>e.isRef(c)?c.value=f:null),class:"w-full"},{default:e.withCtx(()=>[e.createVNode(C,{class:"w-full"},{default:e.withCtx(()=>[e.createElementVNode("div",fe,[e.unref(c)==="published"?(e.openBlock(),e.createElementBlock("span",xe)):e.unref(c)==="draft"?(e.openBlock(),e.createElementBlock("span",Ce)):e.createCommentVNode("",!0),e.createVNode(i,{placeholder:"Status"})])]),_:1}),e.createVNode(d,null,{default:e.withCtx(()=>[e.createVNode(n,null,{default:e.withCtx(()=>[e.createVNode(l,{value:"published"},{default:e.withCtx(()=>[...o[1]||(o[1]=[e.createElementVNode("span",{class:"size-3 rounded-full bg-green-500"},null,-1),e.createTextVNode(" Published ",-1)])]),_:1}),e.createVNode(l,{value:"draft"},{default:e.withCtx(()=>[...o[2]||(o[2]=[e.createElementVNode("span",{class:"size-3 rounded-full bg-blue-500"},null,-1),e.createTextVNode(" Draft ",-1)])]),_:1})]),_:1})]),_:1})]),_:1},8,["modelValue"])]),_:1})]),_:1})}}}),ge={class:"relative @container"},Ve={class:"flex flex-row gap-4 justify-between max-w-5xl mx-auto mt-4 mb-6"},Ne={class:"flex items-center"},ve={class:"text-lg font-semibold mx-2"},we={key:0,class:"bg-green-500 text-green-950 px-2 py-1 rounded-lg text-xs"},be={key:1,class:"bg-blue-500 text-blue-950 px-2 py-1 rounded-lg text-xs"},he={class:"flex flex-col @3xl:flex-row gap-4 max-w-5xl mx-auto pb-24"},ke={class:"flex flex-col gap-4 w-full @3xl:w-2/3"},ye={class:"flex flex-col gap-4 w-full @3xl:w-1/3"},Be={key:0,class:"fixed bottom-4 left-0 md:left-12 right-0 min-w-xs max-w-5xl w-[calc(100%-2rem)] md:w-[calc(100%-5rem)] xl:w-[calc(100%-2rem)] h-16 border border-white/10 backdrop-blur-sm border-t border-border flex items-center justify-center px-4 mx-auto z-[9999] rounded-xl overflow-hidden shadow bg-[radial-gradient(#ffffff80,transparent)] dark:bg-[radial-gradient(#00000080,transparent)]"},Se={class:"w-full max-w-5xl flex items-center justify-end mx-auto"},Ee=e.defineComponent({__name:"Detail",props:{config:{type:Object,required:!0}},setup(y){const a=y,{hasPermission:c,hasAnyPermission:p}=k.useModulePermissions(),{params:o,navigateTo:i}=k.useModuleRoute(),{confirm:C}=k.useConfirmation(),l=k.useFirebaseIntegration(a.config.project);e.provide("sources",a.config.allowedMediaSources),e.provide("defaultSource",a.config.defaultUploadMediaSource);const n=e.computed(()=>!o.value.collectionId||o.value.collectionId==="new"),d=e.ref(!1),g=s.toTypedSchema(s.objectType({id:s.stringType().optional(),title:s.stringType().min(1,"Title is required"),type:s.stringType(),description:s.stringType().optional(),thumbnail:s.stringType().optional(),slug:s.stringType(),seo:s.objectType({title:s.stringType().optional(),description:s.stringType().optional()}).optional(),status:s.stringType()})),{handleSubmit:V,errors:N,values:f,setValues:S}=s.useForm({validationSchema:g,initialValues:{status:"draft",type:"manual",seo:{title:"",description:""}}});k.useModuleBreadcrumbs(()=>[{text:n.value?"New Collection":f.title||"Collection"}]);const B=V(async r=>{d.value=!0;let t=await _()||[];if(n.value){let u=JSON.parse(JSON.stringify(r));if(u.id=crypto.randomUUID(),await E(u.slug)){w.toast.error("Collection with this slug already exists"),d.value=!1;return}const x=[...t,u],m=a.config.collectionsCollection.split(":");console.log("collectionParts",m[0],{[m[1]]:x}),await l.update(m[0],null,{[m[1]]:x}),i("/"),w.toast.success("Collection created")}else{let u=JSON.parse(JSON.stringify(r));const x=t.map(v=>v.id===o.value.collectionId?u:v),m=a.config.collectionsCollection.split(":");await l.update(m[0],null,{[m[1]]:x}),i("/"),w.toast.success("Collection updated")}d.value=!1}),_=async()=>{if(!a.config.collectionsCollection)return[];const r=a.config.collectionsCollection.split(":");return r.length!==2?[]:(await l.get(r[0]))?.[r[1]]||[]},M=async()=>{const t=(await _()).find(u=>u.id===o.value.collectionId);S(t)},D=async()=>{try{let r={...f},t=r.slug+"-copy",u=2;for(;await E(t);)t=r.slug+"-copy-"+u,u++;r.id=crypto.randomUUID(),r.slug=t,r.status="draft",r.title=r.title+" (copy)";const m=[...await _()||[],r],v=a.config.collectionsCollection.split(":");await l.update(v[0],null,{[v[1]]:m}),i(r.id),w.toast.success("Collection duplicated")}catch{w.toast.error("Failed to duplicate collection")}},P=async()=>{if(await C("Are you sure you want to delete this collection?"))try{const t=await _()||[];if(t.length===0||!o.value.collectionId)throw new Error("Error loading values");const u=t.filter(m=>m.id!==o.value.collectionId),x=a.config.collectionsCollection.split(":");await l.update(x[0],null,{[x[1]]:u}),i(""),w.toast.success("Collection deleted")}catch{w.toast.error("Failed to delete collection")}},E=async r=>!!(await _()||[]).find(u=>u.slug===r);return e.onMounted(()=>{n.value||M()}),(r,t)=>{const u=e.resolveComponent("Button"),x=e.resolveComponent("MenubarTrigger"),m=e.resolveComponent("MenubarMenu"),v=e.resolveComponent("MenubarShortcut"),h=e.resolveComponent("MenubarItem"),T=e.resolveComponent("MenubarSeparator"),$=e.resolveComponent("MenubarContent"),I=e.resolveComponent("Menubar");return e.openBlock(),e.createElementBlock("div",ge,[e.createElementVNode("div",Ve,[e.createElementVNode("div",Ne,[e.createVNode(u,{variant:"ghost",onClick:t[0]||(t[0]=Te=>e.unref(i)(""))},{default:e.withCtx(()=>[e.createVNode(e.unref(b.Tag),{class:"size-4"})]),_:1}),e.createVNode(e.unref(b.ChevronRight),{class:"size-3"}),e.createElementVNode("h1",ve,e.toDisplayString(n.value?"New Collection":e.unref(f).title),1),e.unref(f).status==="published"?(e.openBlock(),e.createElementBlock("span",we,"Published")):e.unref(f).status==="draft"?(e.openBlock(),e.createElementBlock("span",be,"Draft")):e.createCommentVNode("",!0)]),n.value?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(I,{key:0,class:"bg-sidebar"},{default:e.withCtx(()=>[e.unref(c)("create-collection")?(e.openBlock(),e.createBlock(m,{key:0},{default:e.withCtx(()=>[e.createVNode(x,{onClick:D},{default:e.withCtx(()=>[...t[1]||(t[1]=[e.createTextVNode("Duplicate",-1)])]),_:1})]),_:1})):e.createCommentVNode("",!0),e.createVNode(m,null,{default:e.withCtx(()=>[e.createVNode(x,null,{default:e.withCtx(()=>[...t[2]||(t[2]=[e.createTextVNode("Preview",-1)])]),_:1})]),_:1}),e.createVNode(m,null,{default:e.withCtx(()=>[e.createVNode(x,null,{default:e.withCtx(()=>[...t[3]||(t[3]=[e.createTextVNode("Share",-1)])]),_:1}),e.createVNode($,null,{default:e.withCtx(()=>[e.createVNode(h,null,{default:e.withCtx(()=>[t[5]||(t[5]=e.createTextVNode(" New Tab ",-1)),e.createVNode(v,null,{default:e.withCtx(()=>[...t[4]||(t[4]=[e.createTextVNode("⌘T",-1)])]),_:1})]),_:1}),e.createVNode(h,null,{default:e.withCtx(()=>[...t[6]||(t[6]=[e.createTextVNode("New Window",-1)])]),_:1}),e.createVNode(T),e.createVNode(h,null,{default:e.withCtx(()=>[...t[7]||(t[7]=[e.createTextVNode("Share",-1)])]),_:1}),e.createVNode(T),e.createVNode(h,null,{default:e.withCtx(()=>[...t[8]||(t[8]=[e.createTextVNode("Print",-1)])]),_:1})]),_:1})]),_:1}),e.unref(p)("edit-collection","delete-collection")?(e.openBlock(),e.createBlock(m,{key:1},{default:e.withCtx(()=>[e.createVNode(x,null,{default:e.withCtx(()=>[...t[9]||(t[9]=[e.createTextVNode("More actions",-1)])]),_:1}),e.createVNode($,null,{default:e.withCtx(()=>[e.unref(c)("delete-collection")?(e.openBlock(),e.createBlock(h,{key:0,variant:"destructive",onClick:P},{default:e.withCtx(()=>[e.createVNode(e.unref(b.Trash),{class:"size-4"}),t[10]||(t[10]=e.createTextVNode(" Delete collection ",-1))]),_:1})):e.createCommentVNode("",!0)]),_:1})]),_:1})):e.createCommentVNode("",!0)]),_:1}))]),e.createElementVNode("div",he,[e.createElementVNode("div",ke,[e.createVNode(X),e.createVNode(pe)]),e.createElementVNode("div",ye,[e.createVNode(_e)])]),e.unref(p)("create-collection","edit-collection")?(e.openBlock(),e.createElementBlock("div",Be,[e.createElementVNode("div",Se,[n.value&&e.unref(c)("create-collection")?(e.openBlock(),e.createBlock(u,{key:0,onClick:e.unref(B),disabled:d.value},{default:e.withCtx(()=>[d.value?(e.openBlock(),e.createBlock(e.unref(b.Loader2),{key:0,class:"size-4 animate-spin"})):e.createCommentVNode("",!0),e.createTextVNode(" "+e.toDisplayString(d.value?"Creating":"Create")+" New Collection ",1)]),_:1},8,["onClick","disabled"])):e.unref(c)("edit-collection")?(e.openBlock(),e.createBlock(u,{key:1,onClick:e.unref(B),disabled:d.value},{default:e.withCtx(()=>[d.value?(e.openBlock(),e.createBlock(e.unref(b.Loader2),{key:0,class:"size-4 animate-spin"})):e.createCommentVNode("",!0),e.createTextVNode(" "+e.toDisplayString(d.value?"Saving":"Save")+" Changes ",1)]),_:1},8,["onClick","disabled"])):e.createCommentVNode("",!0)])])):e.createCommentVNode("",!0)])}}});exports.default=Ee;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),c=require("lucide-vue-next"),B=require("./utils-D6CaKJbp.js"),u=require("@oneclick.dev/cms-kit"),d=require("./DateFormatter-BPPBZp1j.js"),G={class:"relative @container"},O={key:0,class:"max-w-5xl mx-auto mt-4"},R={class:"flex flex-row gap-4 justify-between mb-6"},W={class:"flex items-center"},Z={class:"text-lg font-semibold mx-2 uppercase"},K={key:0,class:"bg-green-500 text-green-950 px-2 py-1 rounded-lg text-xs"},Y={key:1,class:"bg-gray-500 text-gray-950 px-2 py-1 rounded-lg text-xs"},H={class:"font-medium mb-2 uppercase"},J={class:"mb-6"},Q={key:0},X={key:1},ee={key:2},te={class:"flex flex-wrap gap-12 mb-6"},oe={key:0,class:"grid gap-2"},le={class:"flex items-center gap-2"},ae={key:0,class:"text-lg"},ne={key:1,class:"text-lg"},se={key:1,class:"grid gap-2"},re={class:"flex items-center space-x-2"},de={class:"flex gap-4 mb-6"},ue={class:"flex flex-col"},ie={key:0,class:"-ml-2"},ce={key:1,class:"text-xs text-muted-foreground mt-2"},me={class:"flex flex-col"},pe={key:0,class:"-ml-2"},ve={key:1,class:"text-xs text-muted-foreground mt-2"},fe={class:"flex justify-end gap-2 mt-6"},xe=e.defineComponent({__name:"Detail",props:{config:{type:Object,required:!0}},async setup(E){let i,x;const m=E,{log:Ve,logWarning:Ce,logError:Ne}=u.useLogs(),{params:V,navigateTo:C}=u.useModuleRoute(),{getModuleData:S}=u.useModuleStorage(),{confirm:T}=useConfirmation(),p=e.ref([]);p.value=([i,x]=e.withAsyncContext(()=>S("promo-types")),i=await i,x(),i||[]);const N=u.useFirebaseIntegration(m.config.project),o=e.ref(null),v=e.ref(!1),a=e.computed(()=>(o.value?.usageCount??0)>0),s=e.computed(()=>p.value.find(f=>f.key===o.value?.type)||null);u.useModuleBreadcrumbs(()=>[{text:"Promo codes list",href:o.value?.code?"/promo-codes":""},{text:o.value?.code||""}]);const g=new d.$fb18d541ea1ad717$export$ad991b66133851cf("en-US",{dateStyle:"long"}),A=async()=>{o.value=await N.get(m.config.promoCodeCollection,V.value.promoCodeId),o.value.startsAt=d.$fae977aafc393c5c$export$588937bcd60ade55(o.value?.startsAt?.replace(/\.\d{3}Z$/,"")),o.value.expiresAt=d.$fae977aafc393c5c$export$588937bcd60ade55(o.value?.expiresAt?.replace(/\.\d{3}Z$/,""))},$=async()=>{await T(`Are you sure you want to delete the code "${o.value?.code}"?`)&&(await N.remove(m.config.promoCodeCollection,V.value.promoCodeId),C("/promo-codes"))};return A(),(f,t)=>{const r=e.resolveComponent("Button"),n=e.resolveComponent("Label"),k=e.resolveComponent("Input"),h=e.resolveComponent("SelectValue"),U=e.resolveComponent("SelectTrigger"),D=e.resolveComponent("SelectItem"),P=e.resolveComponent("SelectGroup"),I=e.resolveComponent("SelectContent"),L=e.resolveComponent("Select"),j=e.resolveComponent("Switch"),_=e.resolveComponent("PopoverTrigger"),b=e.resolveComponent("Calendar"),y=e.resolveComponent("PopoverContent"),w=e.resolveComponent("Popover"),q=e.resolveComponent("Textarea"),z=e.resolveComponent("Loader2"),M=e.resolveComponent("CardContent"),F=e.resolveComponent("Card");return e.openBlock(),e.createElementBlock("div",G,[o.value?(e.openBlock(),e.createElementBlock("div",O,[e.createElementVNode("div",R,[e.createElementVNode("div",W,[e.createVNode(r,{variant:"ghost",onClick:t[0]||(t[0]=l=>e.unref(C)("/promo-codes"))},{default:e.withCtx(()=>[e.createVNode(e.unref(c.Tag),{class:"size-4"})]),_:1}),e.createVNode(e.unref(c.ChevronRight),{class:"size-3"}),e.createElementVNode("h1",Z,e.toDisplayString(o.value.code),1),o.value.expiresAt>new Date?(e.openBlock(),e.createElementBlock("span",K,"Active")):(e.openBlock(),e.createElementBlock("span",Y,"Expired"))])]),e.createVNode(F,null,{default:e.withCtx(()=>[e.createVNode(M,null,{default:e.withCtx(()=>[e.createElementVNode("h3",H,e.toDisplayString(o.value.code),1),e.createElementVNode("p",J,[t[14]||(t[14]=e.createTextVNode(" This promo code has been created on ",-1)),e.createElementVNode("strong",null,e.toDisplayString(new Date(o.value.createdAt).toLocaleString()),1),t[15]||(t[15]=e.createTextVNode(".",-1)),t[16]||(t[16]=e.createElementVNode("br",null,null,-1)),o.value.usageCount===1?(e.openBlock(),e.createElementBlock("span",Q,[...t[11]||(t[11]=[e.createTextVNode("It has been used ",-1),e.createElementVNode("strong",null,"1 time",-1),e.createTextVNode(", so you can't edit it.",-1)])])):o.value.usageCount>1?(e.openBlock(),e.createElementBlock("span",X,[t[12]||(t[12]=e.createTextVNode("It has been used ",-1)),e.createElementVNode("strong",null,e.toDisplayString(o.value.usageCount)+" times",1),t[13]||(t[13]=e.createTextVNode(", so you can't edit it.",-1))])):(e.openBlock(),e.createElementBlock("span",ee,"It has not been used yet."))]),e.createVNode(n,{for:"code",class:"text-muted-foreground mb-2"},{default:e.withCtx(()=>[...t[17]||(t[17]=[e.createTextVNode("Promo Code",-1)])]),_:1}),e.createVNode(k,{id:"code",modelValue:o.value.code,"onUpdate:modelValue":t[1]||(t[1]=l=>o.value.code=l),disabled:a.value,class:"mb-6 uppercase"},null,8,["modelValue","disabled"]),e.createElementVNode("div",null,[t[27]||(t[27]=e.createElementVNode("h3",{class:"font-medium mb-2"},"Value",-1)),e.createVNode(L,{modelValue:o.value.type,"onUpdate:modelValue":t[2]||(t[2]=l=>o.value.type=l)},{default:e.withCtx(()=>[e.createVNode(U,{class:"w-[200px] mb-4",disabled:a.value},{default:e.withCtx(()=>[e.createVNode(h,{placeholder:"Select a promo type"})]),_:1},8,["disabled"]),e.createVNode(I,null,{default:e.withCtx(()=>[e.createVNode(P,null,{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(p.value,l=>(e.openBlock(),e.createBlock(D,{key:l.key,value:l.key},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(l.label),1)]),_:2},1032,["value"]))),128))]),_:1})]),_:1})]),_:1},8,["modelValue"]),e.createElementVNode("div",te,[s.value?.hasValueField?(e.openBlock(),e.createElementBlock("div",oe,[e.createVNode(n,{for:"discountValue",class:"text-muted-foreground"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(s.value?.valueLabel||"Value"),1)]),_:1}),e.createElementVNode("div",le,[s.value?.valuePrefix?(e.openBlock(),e.createElementBlock("span",ae,e.toDisplayString(s.value?.valuePrefix),1)):e.createCommentVNode("",!0),e.createVNode(k,{modelValue:o.value.value,"onUpdate:modelValue":t[3]||(t[3]=l=>o.value.value=l),id:"discountValue",disabled:a.value},null,8,["modelValue","disabled"]),s.value?.valueSuffix?(e.openBlock(),e.createElementBlock("span",ne,e.toDisplayString(s.value?.valueSuffix),1)):e.createCommentVNode("",!0)])])):e.createCommentVNode("",!0),s.value?.allowUnlimitedUses?(e.openBlock(),e.createElementBlock("div",se,[e.createVNode(n,{for:"unlimitedUses",class:"text-muted-foreground"},{default:e.withCtx(()=>[...t[18]||(t[18]=[e.createTextVNode("Unlimited Uses",-1)])]),_:1}),e.createElementVNode("div",re,[e.createVNode(j,{id:"unlimitedUses",modelValue:o.value.unlimitedUses,"onUpdate:modelValue":t[4]||(t[4]=l=>o.value.unlimitedUses=l),disabled:a.value},null,8,["modelValue","disabled"]),e.createVNode(n,{for:"unlimitedUses"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(o.value.unlimitedUses?"Yes":"No"),1)]),_:1})])])):e.createCommentVNode("",!0)]),t[28]||(t[28]=e.createElementVNode("h3",{class:"font-medium"},"Availability",-1)),t[29]||(t[29]=e.createElementVNode("p",{class:"text-sm text-muted-foreground mb-4"},"When will this code be available?",-1)),e.createElementVNode("div",de,[e.createElementVNode("div",ue,[e.createVNode(n,{class:"text-muted-foreground mb-2"},{default:e.withCtx(()=>[...t[19]||(t[19]=[e.createTextVNode("Available from",-1)])]),_:1}),e.createVNode(w,null,{default:e.withCtx(()=>[e.createVNode(_,{"as-child":""},{default:e.withCtx(()=>[e.createVNode(r,{variant:"outline",class:e.normalizeClass(e.unref(B.classNames)("w-[280px] justify-start text-left font-normal",!o.value.startsAt&&"text-muted-foreground")),disabled:a.value},{default:e.withCtx(()=>[e.createVNode(e.unref(c.CalendarIcon),{class:"mr-2 h-4 w-4"}),e.createTextVNode(" "+e.toDisplayString(o.value.startsAt?e.unref(g).format(o.value.startsAt.toDate(e.unref(d.$14e0f24ef4ac5c92$export$aa8b41735afcabd2)())):"Pick a date"),1)]),_:1},8,["class","disabled"])]),_:1}),e.createVNode(y,{class:"w-auto p-0"},{default:e.withCtx(()=>[e.createVNode(b,{modelValue:o.value.startsAt,"onUpdate:modelValue":t[5]||(t[5]=l=>o.value.startsAt=l),"initial-focus":"",minValue:e.unref(d.$14e0f24ef4ac5c92$export$d0bdf45af03a6ea3)()},null,8,["modelValue","minValue"])]),_:1})]),_:1}),o.value.startsAt?(e.openBlock(),e.createElementBlock("div",ie,[a.value?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(r,{key:0,onClick:t[6]||(t[6]=l=>o.value.startsAt=void 0),variant:"link"},{default:e.withCtx(()=>[...t[20]||(t[20]=[e.createTextVNode("Clear",-1)])]),_:1}))])):(e.openBlock(),e.createElementBlock("p",ce,"Not set - codes will be available immediately"))]),e.createElementVNode("div",me,[e.createVNode(n,{class:"text-muted-foreground mb-2"},{default:e.withCtx(()=>[...t[21]||(t[21]=[e.createTextVNode("Until",-1)])]),_:1}),e.createVNode(w,null,{default:e.withCtx(()=>[e.createVNode(_,{"as-child":""},{default:e.withCtx(()=>[e.createVNode(r,{variant:"outline",class:e.normalizeClass(e.unref(B.classNames)("w-[280px] justify-start text-left font-normal",!o.value.expiresAt&&"text-muted-foreground")),disabled:a.value},{default:e.withCtx(()=>[e.createVNode(e.unref(c.CalendarIcon),{class:"mr-2 h-4 w-4"}),e.createTextVNode(" "+e.toDisplayString(o.value.expiresAt?e.unref(g).format(o.value.expiresAt.toDate(e.unref(d.$14e0f24ef4ac5c92$export$aa8b41735afcabd2)())):"Pick a date"),1)]),_:1},8,["class","disabled"])]),_:1}),e.createVNode(y,{class:"w-auto p-0"},{default:e.withCtx(()=>[e.createVNode(b,{modelValue:o.value.expiresAt,"onUpdate:modelValue":t[7]||(t[7]=l=>o.value.expiresAt=l),"initial-focus":"",minValue:o.value.startsAt},null,8,["modelValue","minValue"])]),_:1})]),_:1}),o.value.expiresAt?(e.openBlock(),e.createElementBlock("div",pe,[a.value?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(r,{key:0,onClick:t[8]||(t[8]=l=>o.value.expiresAt=void 0),variant:"link"},{default:e.withCtx(()=>[...t[22]||(t[22]=[e.createTextVNode("Clear",-1)])]),_:1}))])):(e.openBlock(),e.createElementBlock("p",ve,"Not set - codes will never expire"))])]),e.createVNode(n,{for:"note",class:"text-lg font-medium"},{default:e.withCtx(()=>[...t[23]||(t[23]=[e.createTextVNode("Note",-1)])]),_:1}),e.createVNode(n,{for:"note",class:"font-normal text-sm text-muted-foreground mb-2"},{default:e.withCtx(()=>[...t[24]||(t[24]=[e.createTextVNode("Internal note, you can always edit this later",-1)])]),_:1}),e.createVNode(q,{modelValue:o.value.note,"onUpdate:modelValue":t[9]||(t[9]=l=>o.value.note=l),id:"note"},null,8,["modelValue"]),e.createElementVNode("div",fe,[e.createVNode(r,{variant:"destructive",onClick:t[10]||(t[10]=l=>$()),disabled:v.value},{default:e.withCtx(()=>[...t[25]||(t[25]=[e.createTextVNode(" Delete Code ",-1)])]),_:1},8,["disabled"]),e.createVNode(r,{disabled:v.value},{default:e.withCtx(()=>[v.value?(e.openBlock(),e.createBlock(z,{key:0,class:"size-4 animate-spin"})):e.createCommentVNode("",!0),t[26]||(t[26]=e.createTextVNode(" Update Code ",-1))]),_:1},8,["disabled"])])])]),_:1})]),_:1}),e.createTextVNode(" "+e.toDisplayString(o.value),1)])):e.createCommentVNode("",!0)])}}});exports.default=xe;