@chaibuilder/sdk 1.0.13 → 1.0.15

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 (168) hide show
  1. package/dist/{AddBlocks-H7BZYHUC.js → AddBlocks-eoo1CzaK.js} +114 -111
  2. package/dist/AddBlocks-jU0NwP_s.cjs +3 -0
  3. package/dist/BrandingOptions-WSCFnWAf.cjs +1 -0
  4. package/dist/{BrandingOptions-PAgY-kvj.js → BrandingOptions-_Og7VUHA.js} +57 -41
  5. package/dist/{CanvasArea-zn2ox-5h.js → CanvasArea-cky_d2Lu.js} +517 -519
  6. package/dist/CanvasArea-hT9uHhkz.cjs +46 -0
  7. package/dist/Class-RZuPYbUS.cjs +1 -0
  8. package/dist/{Class-l7qYbuoN.js → Class-nQk08vqd.js} +204 -124
  9. package/dist/{CurrentPage-6Jp4xAWK.js → CurrentPage--OlBwyNE.js} +58 -40
  10. package/dist/CurrentPage-x6Ez11gP.cjs +1 -0
  11. package/dist/Layers-gEA0qWYP.cjs +1 -0
  12. package/dist/{Layers-WkZ48AUm.js → Layers-uzA3QA-4.js} +158 -141
  13. package/dist/MarkAsGlobalBlock-lYL8cO9x.cjs +1 -0
  14. package/dist/MarkAsGlobalBlock-ySc-D4SB.js +84 -0
  15. package/dist/PagesPanel-5t0bV9T2.cjs +1 -0
  16. package/dist/PagesPanel-tH6c9Mnv.js +70 -0
  17. package/dist/ProjectPanel-NdrR6a8t.cjs +1 -0
  18. package/dist/ProjectPanel-Q2-15-In.js +91 -0
  19. package/dist/Settings-DBiwm1hY.cjs +1 -0
  20. package/dist/{Settings-fH8fZKpm.js → Settings-LOqpvQ_1.js} +411 -408
  21. package/dist/SidePanels-8JWYXGqN.cjs +1 -0
  22. package/dist/{SidePanels-w8ZHKJaR.js → SidePanels-F7ccs2Xf.js} +106 -88
  23. package/dist/{Topbar-hm1D_5sb.js → Topbar-lX9OMPwj.js} +47 -45
  24. package/dist/Topbar-qi5ab8rR.cjs +1 -0
  25. package/dist/UnsplashImages-a2r7b3kB.cjs +1 -0
  26. package/dist/{UnsplashImages-gPcBLjgB.js → UnsplashImages-u_QTABzi.js} +56 -44
  27. package/dist/{UploadImages-_ZyUU66E.js → UploadImages-gV5xDHIu.js} +55 -34
  28. package/dist/UploadImages-jLQgLujd.cjs +1 -0
  29. package/dist/add-page-modal-U5ramelz.js +110 -0
  30. package/dist/add-page-modal-tIt3N8jH.cjs +1 -0
  31. package/dist/confirm-alert-ZQ-sxX0X.js +58 -0
  32. package/dist/confirm-alert-z74-fGOT.cjs +1 -0
  33. package/dist/core.cjs +1 -1
  34. package/dist/core.js +99 -124
  35. package/dist/delete-page-modal-5XuSfQT0.cjs +1 -0
  36. package/dist/delete-page-modal-_E87bVUZ.js +89 -0
  37. package/dist/form-Osm1AmO5.cjs +1 -0
  38. package/dist/{form-dVpOAyRl.js → form-zZJyZuNH.js} +12 -12
  39. package/dist/index-2EHcmZqL.js +2947 -0
  40. package/dist/index-RVm8Txnj.js +1149 -0
  41. package/dist/index-_jFEo7h5.cjs +206 -0
  42. package/dist/index-c8zW_D2V.cjs +1 -0
  43. package/dist/index-cU5eyVRU.js +40872 -0
  44. package/dist/index-fwo4wa7u.cjs +1 -0
  45. package/dist/index-gmZcUXyn.js +25 -0
  46. package/dist/index-m2muA80V.cjs +9 -0
  47. package/dist/{jsx-runtime-JYMCiFoE.cjs → jsx-runtime-WKRPbKtm.cjs} +7 -7
  48. package/dist/{jsx-runtime-Sp0orL4X.js → jsx-runtime-qAwJ85SY.js} +109 -106
  49. package/dist/lib.cjs +2 -1
  50. package/dist/lib.js +1333 -71
  51. package/dist/page-viewer-BSc-5M4B.cjs +1 -0
  52. package/dist/{page-viewer-Y4YiaZ_m.js → page-viewer-nLqIs_9w.js} +62 -44
  53. package/dist/project-general-setting-14MA_cX5.cjs +1 -0
  54. package/dist/{project-general-setting-U4S_KlhU.js → project-general-setting-kXh5myAr.js} +46 -36
  55. package/dist/project-seo-setting-POGPEJZ8.cjs +1 -0
  56. package/dist/project-seo-setting-nT1qo1Bb.js +89 -0
  57. package/dist/render.cjs +1 -1
  58. package/dist/render.js +23 -19
  59. package/dist/server.cjs +1 -1
  60. package/dist/server.js +1 -1
  61. package/dist/single-page-detail-EgQd9TSA.cjs +1 -0
  62. package/dist/{single-page-detail-pAxCy_Pe.js → single-page-detail-fV-A6vJR.js} +90 -80
  63. package/dist/studio.cjs +1 -1
  64. package/dist/studio.js +45 -25
  65. package/dist/ui.cjs +1 -1
  66. package/dist/ui.js +156 -357
  67. package/package.json +1 -1
  68. package/dist/AddBlocks-7ACJv8LW.cjs +0 -3
  69. package/dist/BrandingOptions-5j-XszLM.cjs +0 -1
  70. package/dist/CanvasArea-Dnm-yeus.cjs +0 -46
  71. package/dist/ChaiBuilderEditor-BoE-sArB.cjs +0 -163
  72. package/dist/ChaiBuilderEditor-hEuUONQ3.js +0 -27094
  73. package/dist/Class-_uCzl5v1.cjs +0 -1
  74. package/dist/CurrentPage-YMpqOqx7.cjs +0 -1
  75. package/dist/ImagesPanel-6us7hiLN.cjs +0 -1
  76. package/dist/ImagesPanel-oaHOD-Ex.js +0 -27
  77. package/dist/Layers-EzOZdWvd.cjs +0 -1
  78. package/dist/MODIFIERS-DsEzQ3aH.js +0 -73
  79. package/dist/MODIFIERS-Fx6WAZcw.cjs +0 -1
  80. package/dist/MarkAsGlobalBlock-0HubcRkY.js +0 -77
  81. package/dist/MarkAsGlobalBlock-HmeIyLCP.cjs +0 -1
  82. package/dist/PagesPanel-6JuwBLFQ.js +0 -50
  83. package/dist/PagesPanel-zJq8p1ja.cjs +0 -1
  84. package/dist/ProjectPanel-Zml2F8b9.cjs +0 -1
  85. package/dist/ProjectPanel-cu2QSDW9.js +0 -73
  86. package/dist/Settings-lc9PfnmG.cjs +0 -1
  87. package/dist/SidePanels-VH72zFE2.cjs +0 -1
  88. package/dist/Topbar-vQPo9xSY.cjs +0 -1
  89. package/dist/UnsplashImages-BoBBSi1a.cjs +0 -1
  90. package/dist/UploadImages-T6kW0s3G.cjs +0 -1
  91. package/dist/accordion-oPUeqPCZ.js +0 -42
  92. package/dist/accordion-ynvFtV_p.cjs +0 -1
  93. package/dist/add-page-modal--qZSwJuB.cjs +0 -1
  94. package/dist/add-page-modal-bj7qbZuK.js +0 -99
  95. package/dist/alert-dialog-GNfnpqFB.js +0 -64
  96. package/dist/alert-dialog-Mv0-wAvS.cjs +0 -1
  97. package/dist/command-ThdTuUxt.cjs +0 -1
  98. package/dist/command-VHca6CcN.js +0 -97
  99. package/dist/confirm-alert-8EHe0OOd.cjs +0 -1
  100. package/dist/confirm-alert-b0e_BLhF.js +0 -36
  101. package/dist/context-menu-8dC9uGXj.js +0 -122
  102. package/dist/context-menu-IgLbIuth.cjs +0 -1
  103. package/dist/controls-Ni5kEzLz.js +0 -103
  104. package/dist/controls-W97-POR_.cjs +0 -1
  105. package/dist/controls-enQY7NI8.js +0 -118
  106. package/dist/controls-xUKa23ic.cjs +0 -1
  107. package/dist/delete-page-modal-2LuDLEiP.cjs +0 -1
  108. package/dist/delete-page-modal-cnrR8tWH.js +0 -69
  109. package/dist/dialog-S_QbL1iq.cjs +0 -1
  110. package/dist/dialog-jrw9DF1f.js +0 -65
  111. package/dist/dropdown-menu-S03K_fNs.js +0 -164
  112. package/dist/dropdown-menu-sMXR59cB.cjs +0 -1
  113. package/dist/form-nRAvKPQj.cjs +0 -1
  114. package/dist/functions-nNTuSTsR.js +0 -1106
  115. package/dist/functions-pcUZhFJM.js +0 -12
  116. package/dist/functions-sCuB7nvZ.cjs +0 -2
  117. package/dist/functions-uw7QP2kT.cjs +0 -1
  118. package/dist/html-to-json-P6GpbcQX.cjs +0 -1
  119. package/dist/html-to-json-pdHQfRkN.js +0 -178
  120. package/dist/index-HAue58ea.cjs +0 -1
  121. package/dist/index-T4_wfKl5.js +0 -2256
  122. package/dist/index-X9ZgD09V.cjs +0 -1
  123. package/dist/index-ehKdBRUK.js +0 -18
  124. package/dist/label-KaP7MRrs.js +0 -10
  125. package/dist/label-tFm8HZdb.cjs +0 -1
  126. package/dist/link-6o6n2Tnd.js +0 -204
  127. package/dist/link-ece8dZGH.cjs +0 -1
  128. package/dist/page-viewer-IARz6OSp.cjs +0 -1
  129. package/dist/popover-a84pbVhQ.js +0 -23
  130. package/dist/popover-fKjgcRUx.cjs +0 -1
  131. package/dist/project-general-setting-eSl3t-VH.cjs +0 -1
  132. package/dist/project-seo-setting-Ga9v_ECU.js +0 -67
  133. package/dist/project-seo-setting-rankm1z3.cjs +0 -1
  134. package/dist/scroll-area-FiHvy-TZ.cjs +0 -1
  135. package/dist/scroll-area-ewXbxc3n.js +0 -30
  136. package/dist/select-7bjg-rr9.cjs +0 -1
  137. package/dist/select-POGdEDHT.js +0 -75
  138. package/dist/separator-3Civ-6hb.cjs +0 -1
  139. package/dist/separator-SctTn0Qi.js +0 -18
  140. package/dist/single-page-detail-yPgnu2AI.cjs +0 -1
  141. package/dist/skeleton-CU_FIbg3.js +0 -239
  142. package/dist/skeleton-JHP9zwL2.cjs +0 -1
  143. package/dist/tabs-Gb9v5dVb.js +0 -46
  144. package/dist/tabs-iWeaaVrg.cjs +0 -1
  145. package/dist/textarea-1kZEh7ki.cjs +0 -1
  146. package/dist/textarea-b2QvVhrK.js +0 -73
  147. package/dist/toggle-ASJRAaGP.js +0 -30
  148. package/dist/toggle-ehNIPmme.cjs +0 -1
  149. package/dist/useAddBlock-WJc3OgG8.js +0 -86
  150. package/dist/useAddBlock-dCKRFPRU.cjs +0 -1
  151. package/dist/useAllBlocks-6hvuNuyw.cjs +0 -1
  152. package/dist/useAllBlocks-PQKYvs-e.js +0 -20
  153. package/dist/useChaiExternalData-4K9WxANa.js +0 -6
  154. package/dist/useChaiExternalData-DkyBJ81C.cjs +0 -1
  155. package/dist/useDarkMode-ZKCO_gkt.js +0 -23
  156. package/dist/useDarkMode-dV6FM6l-.cjs +0 -1
  157. package/dist/useFeatureSupport-OLwNgEZb.js +0 -16
  158. package/dist/useFeatureSupport-c9IgPW2t.cjs +0 -1
  159. package/dist/useHiddenBlocks-3MsGOJ1s.js +0 -15
  160. package/dist/useHiddenBlocks-oJuQDmTy.cjs +0 -1
  161. package/dist/useLanguage-NKKKaxVM.cjs +0 -1
  162. package/dist/useLanguage-gVC5rxO5.js +0 -216
  163. package/dist/useMarkAsGlobalBlock-X73Vny8u.js +0 -25
  164. package/dist/useMarkAsGlobalBlock-ebBVGHg4.cjs +0 -1
  165. package/dist/useUiLibraries-4hPOi8DI.js +0 -12
  166. package/dist/useUiLibraries-9FhQCpKo.cjs +0 -1
  167. package/dist/utils-dze1SGvB.js +0 -6
  168. package/dist/utils-qK_SjzzV.cjs +0 -1
@@ -1 +0,0 @@
1
- "use strict";var mt=(t,e,s)=>{if(!e.has(t))throw TypeError("Cannot "+s)};var n=(t,e,s)=>(mt(t,e,"read from private field"),s?s.call(t):e.get(t)),l=(t,e,s)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,s)},o=(t,e,s,r)=>(mt(t,e,"write to private field"),r?r.call(t,s):e.set(t,s),s);var ot=(t,e,s,r)=>({set _(i){o(t,e,i,s)},get _(){return n(t,e,r)}}),p=(t,e,s)=>(mt(t,e,"access private method"),s);const u=require("./jsx-runtime-JYMCiFoE.cjs"),C=require("react"),rs=require("./ChaiBuilderEditor-BoE-sArB.cjs");require("react-i18next");const xt=require("./skeleton-JHP9zwL2.cjs"),lt=require("@radix-ui/react-icons"),ee=require("sonner"),Es=require("./html-to-json-P6GpbcQX.cjs"),te=require("lodash"),kt=require("lucide-react"),ie=require("./alert-dialog-Mv0-wAvS.cjs");function Rs(t){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const s in t)if(s!=="default"){const r=Object.getOwnPropertyDescriptor(t,s);Object.defineProperty(e,s,r.get?r:{enumerable:!0,get:()=>t[s]})}}return e.default=t,Object.freeze(e)}const q=Rs(C);var _e=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(t){return this.listeners.add(t),this.onSubscribe(),()=>{this.listeners.delete(t),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},Be=typeof window>"u"||"Deno"in window;function G(){}function Ps(t,e){return typeof t=="function"?t(e):t}function bt(t){return typeof t=="number"&&t>=0&&t!==1/0}function ns(t,e){return Math.max(t+(e||0)-Date.now(),0)}function Nt(t,e){const{type:s="all",exact:r,fetchStatus:i,predicate:a,queryKey:c,stale:d}=t;if(c){if(r){if(e.queryHash!==Mt(c,e.options))return!1}else if(!He(e.queryKey,c))return!1}if(s!=="all"){const y=e.isActive();if(s==="active"&&!y||s==="inactive"&&y)return!1}return!(typeof d=="boolean"&&e.isStale()!==d||typeof i<"u"&&i!==e.state.fetchStatus||a&&!a(e))}function Tt(t,e){const{exact:s,status:r,predicate:i,mutationKey:a}=t;if(a){if(!e.options.mutationKey)return!1;if(s){if(ze(e.options.mutationKey)!==ze(a))return!1}else if(!He(e.options.mutationKey,a))return!1}return!(r&&e.state.status!==r||i&&!i(e))}function Mt(t,e){return((e==null?void 0:e.queryKeyHashFn)||ze)(t)}function ze(t){return JSON.stringify(t,(e,s)=>vt(s)?Object.keys(s).sort().reduce((r,i)=>(r[i]=s[i],r),{}):s)}function He(t,e){return t===e?!0:typeof t!=typeof e?!1:t&&e&&typeof t=="object"&&typeof e=="object"?!Object.keys(e).some(s=>!He(t[s],e[s])):!1}function is(t,e){if(t===e)return t;const s=It(t)&&It(e);if(s||vt(t)&&vt(e)){const r=s?t.length:Object.keys(t).length,i=s?e:Object.keys(e),a=i.length,c=s?[]:{};let d=0;for(let y=0;y<a;y++){const x=s?y:i[y];c[x]=is(t[x],e[x]),c[x]===t[x]&&d++}return r===a&&d===r?t:c}return e}function ht(t,e){if(t&&!e||e&&!t)return!1;for(const s in t)if(t[s]!==e[s])return!1;return!0}function It(t){return Array.isArray(t)&&t.length===Object.keys(t).length}function vt(t){if(!Lt(t))return!1;const e=t.constructor;if(typeof e>"u")return!0;const s=e.prototype;return!(!Lt(s)||!s.hasOwnProperty("isPrototypeOf"))}function Lt(t){return Object.prototype.toString.call(t)==="[object Object]"}function as(t){return new Promise(e=>{setTimeout(e,t)})}function Kt(t){as(0).then(t)}function jt(t,e,s){return typeof s.structuralSharing=="function"?s.structuralSharing(t,e):s.structuralSharing!==!1?is(t,e):e}function Cs(t,e,s=0){const r=[...t,e];return s&&r.length>s?r.slice(1):r}function Os(t,e,s=0){const r=[e,...t];return s&&r.length>s?r.slice(0,-1):r}var ge,oe,Ce,Gt,Ss=(Gt=class extends _e{constructor(){super();l(this,ge,void 0);l(this,oe,void 0);l(this,Ce,void 0);o(this,Ce,e=>{if(!Be&&window.addEventListener){const s=()=>e();return window.addEventListener("visibilitychange",s,!1),()=>{window.removeEventListener("visibilitychange",s)}}})}onSubscribe(){n(this,oe)||this.setEventListener(n(this,Ce))}onUnsubscribe(){var e;this.hasListeners()||((e=n(this,oe))==null||e.call(this),o(this,oe,void 0))}setEventListener(e){var s;o(this,Ce,e),(s=n(this,oe))==null||s.call(this),o(this,oe,e(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(e){n(this,ge)!==e&&(o(this,ge,e),this.onFocus())}onFocus(){this.listeners.forEach(e=>{e()})}isFocused(){var e;return typeof n(this,ge)=="boolean"?n(this,ge):((e=globalThis.document)==null?void 0:e.visibilityState)!=="hidden"}},ge=new WeakMap,oe=new WeakMap,Ce=new WeakMap,Gt),dt=new Ss,Oe,ue,Se,Vt,Fs=(Vt=class extends _e{constructor(){super();l(this,Oe,!0);l(this,ue,void 0);l(this,Se,void 0);o(this,Se,e=>{if(!Be&&window.addEventListener){const s=()=>e(!0),r=()=>e(!1);return window.addEventListener("online",s,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",s),window.removeEventListener("offline",r)}}})}onSubscribe(){n(this,ue)||this.setEventListener(n(this,Se))}onUnsubscribe(){var e;this.hasListeners()||((e=n(this,ue))==null||e.call(this),o(this,ue,void 0))}setEventListener(e){var s;o(this,Se,e),(s=n(this,ue))==null||s.call(this),o(this,ue,e(this.setOnline.bind(this)))}setOnline(e){n(this,Oe)!==e&&(o(this,Oe,e),this.listeners.forEach(r=>{r(e)}))}isOnline(){return n(this,Oe)}},Oe=new WeakMap,ue=new WeakMap,Se=new WeakMap,Vt),ft=new Fs;function As(t){return Math.min(1e3*2**t,3e4)}function yt(t){return(t??"online")==="online"?ft.isOnline():!0}var os=class{constructor(t){this.revert=t==null?void 0:t.revert,this.silent=t==null?void 0:t.silent}};function gt(t){return t instanceof os}function us(t){let e=!1,s=0,r=!1,i,a,c;const d=new Promise((f,g)=>{a=f,c=g}),y=f=>{var g;r||(m(new os(f)),(g=t.abort)==null||g.call(t))},x=()=>{e=!0},h=()=>{e=!1},E=()=>!dt.isFocused()||t.networkMode!=="always"&&!ft.isOnline(),M=f=>{var g;r||(r=!0,(g=t.onSuccess)==null||g.call(t,f),i==null||i(),a(f))},m=f=>{var g;r||(r=!0,(g=t.onError)==null||g.call(t,f),i==null||i(),c(f))},b=()=>new Promise(f=>{var g;i=j=>{const v=r||!E();return v&&f(j),v},(g=t.onPause)==null||g.call(t)}).then(()=>{var f;i=void 0,r||(f=t.onContinue)==null||f.call(t)}),P=()=>{if(r)return;let f;try{f=t.fn()}catch(g){f=Promise.reject(g)}Promise.resolve(f).then(M).catch(g=>{var I;if(r)return;const j=t.retry??(Be?0:3),v=t.retryDelay??As,F=typeof v=="function"?v(s,g):v,Q=j===!0||typeof j=="number"&&s<j||typeof j=="function"&&j(s,g);if(e||!Q){m(g);return}s++,(I=t.onFail)==null||I.call(t,s,g),as(F).then(()=>{if(E())return b()}).then(()=>{e?m(g):P()})})};return yt(t.networkMode)?P():b().then(P),{promise:d,cancel:y,continue:()=>(i==null?void 0:i())?d:Promise.resolve(),cancelRetry:x,continueRetry:h}}function qs(){let t=[],e=0,s=h=>{h()},r=h=>{h()};const i=h=>{let E;e++;try{E=h()}finally{e--,e||d()}return E},a=h=>{e?t.push(h):Kt(()=>{s(h)})},c=h=>(...E)=>{a(()=>{h(...E)})},d=()=>{const h=t;t=[],h.length&&Kt(()=>{r(()=>{h.forEach(E=>{s(E)})})})};return{batch:i,batchCalls:c,schedule:a,setNotifyFunction:h=>{s=h},setBatchNotifyFunction:h=>{r=h}}}var S=qs(),xe,Jt,cs=(Jt=class{constructor(){l(this,xe,void 0)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),bt(this.gcTime)&&o(this,xe,setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(t){this.gcTime=Math.max(this.gcTime||0,t??(Be?1/0:5*60*1e3))}clearGcTimeout(){n(this,xe)&&(clearTimeout(n(this,xe)),o(this,xe,void 0))}},xe=new WeakMap,Jt),Fe,Ae,_,ce,$,A,Ge,be,qe,ut,V,re,Wt,ks=(Wt=class extends cs{constructor(e){super();l(this,qe);l(this,V);l(this,Fe,void 0);l(this,Ae,void 0);l(this,_,void 0);l(this,ce,void 0);l(this,$,void 0);l(this,A,void 0);l(this,Ge,void 0);l(this,be,void 0);o(this,be,!1),o(this,Ge,e.defaultOptions),p(this,qe,ut).call(this,e.options),o(this,A,[]),o(this,_,e.cache),this.queryKey=e.queryKey,this.queryHash=e.queryHash,o(this,Fe,e.state||Ms(this.options)),this.state=n(this,Fe),this.scheduleGc()}get meta(){return this.options.meta}optionalRemove(){!n(this,A).length&&this.state.fetchStatus==="idle"&&n(this,_).remove(this)}setData(e,s){const r=jt(this.state.data,e,this.options);return p(this,V,re).call(this,{data:r,type:"success",dataUpdatedAt:s==null?void 0:s.updatedAt,manual:s==null?void 0:s.manual}),r}setState(e,s){p(this,V,re).call(this,{type:"setState",state:e,setStateOptions:s})}cancel(e){var r;const s=n(this,ce);return(r=n(this,$))==null||r.cancel(e),s?s.then(G).catch(G):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(n(this,Fe))}isActive(){return n(this,A).some(e=>e.options.enabled!==!1)}isDisabled(){return this.getObserversCount()>0&&!this.isActive()}isStale(){return this.state.isInvalidated||!this.state.dataUpdatedAt||n(this,A).some(e=>e.getCurrentResult().isStale)}isStaleByTime(e=0){return this.state.isInvalidated||!this.state.dataUpdatedAt||!ns(this.state.dataUpdatedAt,e)}onFocus(){var s;const e=n(this,A).find(r=>r.shouldFetchOnWindowFocus());e==null||e.refetch({cancelRefetch:!1}),(s=n(this,$))==null||s.continue()}onOnline(){var s;const e=n(this,A).find(r=>r.shouldFetchOnReconnect());e==null||e.refetch({cancelRefetch:!1}),(s=n(this,$))==null||s.continue()}addObserver(e){n(this,A).includes(e)||(n(this,A).push(e),this.clearGcTimeout(),n(this,_).notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){n(this,A).includes(e)&&(o(this,A,n(this,A).filter(s=>s!==e)),n(this,A).length||(n(this,$)&&(n(this,be)?n(this,$).cancel({revert:!0}):n(this,$).cancelRetry()),this.scheduleGc()),n(this,_).notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return n(this,A).length}invalidate(){this.state.isInvalidated||p(this,V,re).call(this,{type:"invalidate"})}fetch(e,s){var x,h,E,M;if(this.state.fetchStatus!=="idle"){if(this.state.dataUpdatedAt&&(s!=null&&s.cancelRefetch))this.cancel({silent:!0});else if(n(this,ce))return(x=n(this,$))==null||x.continueRetry(),n(this,ce)}if(e&&p(this,qe,ut).call(this,e),!this.options.queryFn){const m=n(this,A).find(b=>b.options.queryFn);m&&p(this,qe,ut).call(this,m.options)}process.env.NODE_ENV!=="production"&&(Array.isArray(this.options.queryKey)||console.error("As of v4, queryKey needs to be an Array. If you are using a string like 'repoData', please change it to an Array, e.g. ['repoData']"));const r=new AbortController,i={queryKey:this.queryKey,meta:this.meta},a=m=>{Object.defineProperty(m,"signal",{enumerable:!0,get:()=>(o(this,be,!0),r.signal)})};a(i);const c=()=>this.options.queryFn?(o(this,be,!1),this.options.persister?this.options.persister(this.options.queryFn,i,this):this.options.queryFn(i)):Promise.reject(new Error(`Missing queryFn: '${this.options.queryHash}'`)),d={fetchOptions:s,options:this.options,queryKey:this.queryKey,state:this.state,fetchFn:c};a(d),(h=this.options.behavior)==null||h.onFetch(d,this),o(this,Ae,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((E=d.fetchOptions)==null?void 0:E.meta))&&p(this,V,re).call(this,{type:"fetch",meta:(M=d.fetchOptions)==null?void 0:M.meta});const y=m=>{var b,P,f,g;gt(m)&&m.silent||p(this,V,re).call(this,{type:"error",error:m}),gt(m)||((P=(b=n(this,_).config).onError)==null||P.call(b,m,this),(g=(f=n(this,_).config).onSettled)==null||g.call(f,this.state.data,m,this)),this.isFetchingOptimistic||this.scheduleGc(),this.isFetchingOptimistic=!1};return o(this,$,us({fn:d.fetchFn,abort:r.abort.bind(r),onSuccess:m=>{var b,P,f,g;if(typeof m>"u"){process.env.NODE_ENV!=="production"&&console.error(`Query data cannot be undefined. Please make sure to return a value other than undefined from your query function. Affected query key: ${this.queryHash}`),y(new Error(`${this.queryHash} data is undefined`));return}this.setData(m),(P=(b=n(this,_).config).onSuccess)==null||P.call(b,m,this),(g=(f=n(this,_).config).onSettled)==null||g.call(f,m,this.state.error,this),this.isFetchingOptimistic||this.scheduleGc(),this.isFetchingOptimistic=!1},onError:y,onFail:(m,b)=>{p(this,V,re).call(this,{type:"failed",failureCount:m,error:b})},onPause:()=>{p(this,V,re).call(this,{type:"pause"})},onContinue:()=>{p(this,V,re).call(this,{type:"continue"})},retry:d.options.retry,retryDelay:d.options.retryDelay,networkMode:d.options.networkMode})),o(this,ce,n(this,$).promise),n(this,ce)}},Fe=new WeakMap,Ae=new WeakMap,_=new WeakMap,ce=new WeakMap,$=new WeakMap,A=new WeakMap,Ge=new WeakMap,be=new WeakMap,qe=new WeakSet,ut=function(e){this.options={...n(this,Ge),...e},this.updateGcTime(this.options.gcTime)},V=new WeakSet,re=function(e){const s=r=>{switch(e.type){case"failed":return{...r,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case"pause":return{...r,fetchStatus:"paused"};case"continue":return{...r,fetchStatus:"fetching"};case"fetch":return{...r,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:e.meta??null,fetchStatus:yt(this.options.networkMode)?"fetching":"paused",...!r.dataUpdatedAt&&{error:null,status:"pending"}};case"success":return{...r,data:e.data,dataUpdateCount:r.dataUpdateCount+1,dataUpdatedAt:e.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};case"error":const i=e.error;return gt(i)&&i.revert&&n(this,Ae)?{...n(this,Ae),fetchStatus:"idle"}:{...r,error:i,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:i,fetchStatus:"idle",status:"error"};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...e.state}}};this.state=s(this.state),S.batch(()=>{n(this,A).forEach(r=>{r.onQueryUpdate()}),n(this,_).notify({query:this,type:"updated",action:e})})},Wt);function Ms(t){const e=typeof t.initialData=="function"?t.initialData():t.initialData,s=typeof e<"u",r=s?typeof t.initialDataUpdatedAt=="function"?t.initialDataUpdatedAt():t.initialDataUpdatedAt:0;return{data:e,dataUpdateCount:0,dataUpdatedAt:s?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:s?"success":"pending",fetchStatus:"idle"}}var W,Yt,Us=(Yt=class extends _e{constructor(e={}){super();l(this,W,void 0);this.config=e,o(this,W,new Map)}build(e,s,r){const i=s.queryKey,a=s.queryHash??Mt(i,s);let c=this.get(a);return c||(c=new ks({cache:this,queryKey:i,queryHash:a,options:e.defaultQueryOptions(s),state:r,defaultOptions:e.getQueryDefaults(i)}),this.add(c)),c}add(e){n(this,W).has(e.queryHash)||(n(this,W).set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){const s=n(this,W).get(e.queryHash);s&&(e.destroy(),s===e&&n(this,W).delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){S.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return n(this,W).get(e)}getAll(){return[...n(this,W).values()]}find(e){const s={exact:!0,...e};return this.getAll().find(r=>Nt(s,r))}findAll(e={}){const s=this.getAll();return Object.keys(e).length>0?s.filter(r=>Nt(e,r)):s}notify(e){S.batch(()=>{this.listeners.forEach(s=>{s(e)})})}onFocus(){S.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){S.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},W=new WeakMap,Yt),Y,Ve,L,ke,X,ae,Xt,Ds=(Xt=class extends cs{constructor(e){super();l(this,X);l(this,Y,void 0);l(this,Ve,void 0);l(this,L,void 0);l(this,ke,void 0);this.mutationId=e.mutationId,o(this,Ve,e.defaultOptions),o(this,L,e.mutationCache),o(this,Y,[]),this.state=e.state||ls(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options={...n(this,Ve),...e},this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){n(this,Y).includes(e)||(n(this,Y).push(e),this.clearGcTimeout(),n(this,L).notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){o(this,Y,n(this,Y).filter(s=>s!==e)),this.scheduleGc(),n(this,L).notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){n(this,Y).length||(this.state.status==="pending"?this.scheduleGc():n(this,L).remove(this))}continue(){var e;return((e=n(this,ke))==null?void 0:e.continue())??this.execute(this.state.variables)}async execute(e){var i,a,c,d,y,x,h,E,M,m,b,P,f,g,j,v,F,Q,I,k;const s=()=>(o(this,ke,us({fn:()=>this.options.mutationFn?this.options.mutationFn(e):Promise.reject(new Error("No mutationFn found")),onFail:(R,se)=>{p(this,X,ae).call(this,{type:"failed",failureCount:R,error:se})},onPause:()=>{p(this,X,ae).call(this,{type:"pause"})},onContinue:()=>{p(this,X,ae).call(this,{type:"continue"})},retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode})),n(this,ke).promise),r=this.state.status==="pending";try{if(!r){p(this,X,ae).call(this,{type:"pending",variables:e}),await((a=(i=n(this,L).config).onMutate)==null?void 0:a.call(i,e,this));const se=await((d=(c=this.options).onMutate)==null?void 0:d.call(c,e));se!==this.state.context&&p(this,X,ae).call(this,{type:"pending",context:se,variables:e})}const R=await s();return await((x=(y=n(this,L).config).onSuccess)==null?void 0:x.call(y,R,e,this.state.context,this)),await((E=(h=this.options).onSuccess)==null?void 0:E.call(h,R,e,this.state.context)),await((m=(M=n(this,L).config).onSettled)==null?void 0:m.call(M,R,null,this.state.variables,this.state.context,this)),await((P=(b=this.options).onSettled)==null?void 0:P.call(b,R,null,e,this.state.context)),p(this,X,ae).call(this,{type:"success",data:R}),R}catch(R){try{throw await((g=(f=n(this,L).config).onError)==null?void 0:g.call(f,R,e,this.state.context,this)),await((v=(j=this.options).onError)==null?void 0:v.call(j,R,e,this.state.context)),await((Q=(F=n(this,L).config).onSettled)==null?void 0:Q.call(F,void 0,R,this.state.variables,this.state.context,this)),await((k=(I=this.options).onSettled)==null?void 0:k.call(I,void 0,R,e,this.state.context)),R}finally{p(this,X,ae).call(this,{type:"error",error:R})}}}},Y=new WeakMap,Ve=new WeakMap,L=new WeakMap,ke=new WeakMap,X=new WeakSet,ae=function(e){const s=r=>{switch(e.type){case"failed":return{...r,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...r,isPaused:!0};case"continue":return{...r,isPaused:!1};case"pending":return{...r,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:!yt(this.options.networkMode),status:"pending",variables:e.variables,submittedAt:Date.now()};case"success":return{...r,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...r,data:void 0,error:e.error,failureCount:r.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}};this.state=s(this.state),S.batch(()=>{n(this,Y).forEach(r=>{r.onMutationUpdate(e)}),n(this,L).notify({mutation:this,type:"updated",action:e})})},Xt);function ls(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var z,Je,ve,Zt,Qs=(Zt=class extends _e{constructor(e={}){super();l(this,z,void 0);l(this,Je,void 0);l(this,ve,void 0);this.config=e,o(this,z,[]),o(this,Je,0)}build(e,s,r){const i=new Ds({mutationCache:this,mutationId:++ot(this,Je)._,options:e.defaultMutationOptions(s),state:r});return this.add(i),i}add(e){n(this,z).push(e),this.notify({type:"added",mutation:e})}remove(e){o(this,z,n(this,z).filter(s=>s!==e)),this.notify({type:"removed",mutation:e})}clear(){S.batch(()=>{n(this,z).forEach(e=>{this.remove(e)})})}getAll(){return n(this,z)}find(e){const s={exact:!0,...e};return n(this,z).find(r=>Tt(s,r))}findAll(e={}){return n(this,z).filter(s=>Tt(e,s))}notify(e){S.batch(()=>{this.listeners.forEach(s=>{s(e)})})}resumePausedMutations(){return o(this,ve,(n(this,ve)??Promise.resolve()).then(()=>{const e=n(this,z).filter(s=>s.state.isPaused);return S.batch(()=>e.reduce((s,r)=>s.then(()=>r.continue().catch(G)),Promise.resolve()))}).then(()=>{o(this,ve,void 0)})),n(this,ve)}},z=new WeakMap,Je=new WeakMap,ve=new WeakMap,Zt);function Ns(t){return{onFetch:(e,s)=>{const r=async()=>{var b,P,f,g,j;const i=e.options,a=(f=(P=(b=e.fetchOptions)==null?void 0:b.meta)==null?void 0:P.fetchMore)==null?void 0:f.direction,c=((g=e.state.data)==null?void 0:g.pages)||[],d=((j=e.state.data)==null?void 0:j.pageParams)||[],y={pages:[],pageParams:[]};let x=!1;const h=v=>{Object.defineProperty(v,"signal",{enumerable:!0,get:()=>(e.signal.aborted?x=!0:e.signal.addEventListener("abort",()=>{x=!0}),e.signal)})},E=e.options.queryFn||(()=>Promise.reject(new Error(`Missing queryFn: '${e.options.queryHash}'`))),M=async(v,F,Q)=>{if(x)return Promise.reject();if(F==null&&v.pages.length)return Promise.resolve(v);const I={queryKey:e.queryKey,pageParam:F,direction:Q?"backward":"forward",meta:e.options.meta};h(I);const k=await E(I),{maxPages:R}=e.options,se=Q?Os:Cs;return{pages:se(v.pages,k,R),pageParams:se(v.pageParams,F,R)}};let m;if(a&&c.length){const v=a==="backward",F=v?Ts:Bt,Q={pages:c,pageParams:d},I=F(i,Q);m=await M(Q,I,v)}else{m=await M(y,d[0]??i.initialPageParam);const v=t??c.length;for(let F=1;F<v;F++){const Q=Bt(i,m);m=await M(m,Q)}}return m};e.options.persister?e.fetchFn=()=>{var i,a;return(a=(i=e.options).persister)==null?void 0:a.call(i,r,{queryKey:e.queryKey,meta:e.options.meta,signal:e.signal},s)}:e.fetchFn=r}}}function Bt(t,{pages:e,pageParams:s}){const r=e.length-1;return t.getNextPageParam(e[r],e,s[r],s)}function Ts(t,{pages:e,pageParams:s}){var r;return(r=t.getPreviousPageParam)==null?void 0:r.call(t,e[0],e,s[0],s)}var O,le,he,Me,Ue,de,De,Qe,es,Is=(es=class{constructor(t={}){l(this,O,void 0);l(this,le,void 0);l(this,he,void 0);l(this,Me,void 0);l(this,Ue,void 0);l(this,de,void 0);l(this,De,void 0);l(this,Qe,void 0);o(this,O,t.queryCache||new Us),o(this,le,t.mutationCache||new Qs),o(this,he,t.defaultOptions||{}),o(this,Me,new Map),o(this,Ue,new Map),o(this,de,0)}mount(){ot(this,de)._++,n(this,de)===1&&(o(this,De,dt.subscribe(()=>{dt.isFocused()&&(this.resumePausedMutations(),n(this,O).onFocus())})),o(this,Qe,ft.subscribe(()=>{ft.isOnline()&&(this.resumePausedMutations(),n(this,O).onOnline())})))}unmount(){var t,e;ot(this,de)._--,n(this,de)===0&&((t=n(this,De))==null||t.call(this),o(this,De,void 0),(e=n(this,Qe))==null||e.call(this),o(this,Qe,void 0))}isFetching(t){return n(this,O).findAll({...t,fetchStatus:"fetching"}).length}isMutating(t){return n(this,le).findAll({...t,status:"pending"}).length}getQueryData(t){var e;return(e=n(this,O).find({queryKey:t}))==null?void 0:e.state.data}ensureQueryData(t){const e=this.getQueryData(t.queryKey);return e!==void 0?Promise.resolve(e):this.fetchQuery(t)}getQueriesData(t){return this.getQueryCache().findAll(t).map(({queryKey:e,state:s})=>{const r=s.data;return[e,r]})}setQueryData(t,e,s){const r=n(this,O).find({queryKey:t}),i=r==null?void 0:r.state.data,a=Ps(e,i);if(typeof a>"u")return;const c=this.defaultQueryOptions({queryKey:t});return n(this,O).build(this,c).setData(a,{...s,manual:!0})}setQueriesData(t,e,s){return S.batch(()=>this.getQueryCache().findAll(t).map(({queryKey:r})=>[r,this.setQueryData(r,e,s)]))}getQueryState(t){var e;return(e=n(this,O).find({queryKey:t}))==null?void 0:e.state}removeQueries(t){const e=n(this,O);S.batch(()=>{e.findAll(t).forEach(s=>{e.remove(s)})})}resetQueries(t,e){const s=n(this,O),r={type:"active",...t};return S.batch(()=>(s.findAll(t).forEach(i=>{i.reset()}),this.refetchQueries(r,e)))}cancelQueries(t={},e={}){const s={revert:!0,...e},r=S.batch(()=>n(this,O).findAll(t).map(i=>i.cancel(s)));return Promise.all(r).then(G).catch(G)}invalidateQueries(t={},e={}){return S.batch(()=>{if(n(this,O).findAll(t).forEach(r=>{r.invalidate()}),t.refetchType==="none")return Promise.resolve();const s={...t,type:t.refetchType??t.type??"active"};return this.refetchQueries(s,e)})}refetchQueries(t={},e){const s={...e,cancelRefetch:(e==null?void 0:e.cancelRefetch)??!0},r=S.batch(()=>n(this,O).findAll(t).filter(i=>!i.isDisabled()).map(i=>{let a=i.fetch(void 0,s);return s.throwOnError||(a=a.catch(G)),i.state.fetchStatus==="paused"?Promise.resolve():a}));return Promise.all(r).then(G)}fetchQuery(t){const e=this.defaultQueryOptions(t);typeof e.retry>"u"&&(e.retry=!1);const s=n(this,O).build(this,e);return s.isStaleByTime(e.staleTime)?s.fetch(e):Promise.resolve(s.state.data)}prefetchQuery(t){return this.fetchQuery(t).then(G).catch(G)}fetchInfiniteQuery(t){return t.behavior=Ns(t.pages),this.fetchQuery(t)}prefetchInfiniteQuery(t){return this.fetchInfiniteQuery(t).then(G).catch(G)}resumePausedMutations(){return n(this,le).resumePausedMutations()}getQueryCache(){return n(this,O)}getMutationCache(){return n(this,le)}getDefaultOptions(){return n(this,he)}setDefaultOptions(t){o(this,he,t)}setQueryDefaults(t,e){n(this,Me).set(ze(t),{queryKey:t,defaultOptions:e})}getQueryDefaults(t){const e=[...n(this,Me).values()];let s={};return e.forEach(r=>{He(t,r.queryKey)&&(s={...s,...r.defaultOptions})}),s}setMutationDefaults(t,e){n(this,Ue).set(ze(t),{mutationKey:t,defaultOptions:e})}getMutationDefaults(t){const e=[...n(this,Ue).values()];let s={};return e.forEach(r=>{He(t,r.mutationKey)&&(s={...s,...r.defaultOptions})}),s}defaultQueryOptions(t){if(t!=null&&t._defaulted)return t;const e={...n(this,he).queries,...(t==null?void 0:t.queryKey)&&this.getQueryDefaults(t.queryKey),...t,_defaulted:!0};return e.queryHash||(e.queryHash=Mt(e.queryKey,e)),typeof e.refetchOnReconnect>"u"&&(e.refetchOnReconnect=e.networkMode!=="always"),typeof e.throwOnError>"u"&&(e.throwOnError=!!e.suspense),typeof e.networkMode>"u"&&e.persister&&(e.networkMode="offlineFirst"),e}defaultMutationOptions(t){return t!=null&&t._defaulted?t:{...n(this,he).mutations,...(t==null?void 0:t.mutationKey)&&this.getMutationDefaults(t.mutationKey),...t,_defaulted:!0}}clear(){n(this,O).clear(),n(this,le).clear()}},O=new WeakMap,le=new WeakMap,he=new WeakMap,Me=new WeakMap,Ue=new WeakMap,de=new WeakMap,De=new WeakMap,Qe=new WeakMap,es),T,w,Ne,U,je,Te,Z,We,Ie,Le,we,Ee,fe,Re,Pe,$e,Ye,wt,Xe,Et,Ze,Rt,et,Pt,tt,Ct,st,Ot,rt,St,pt,hs,ts,Ls=(ts=class extends _e{constructor(e,s){super();l(this,Pe);l(this,Ye);l(this,Xe);l(this,Ze);l(this,et);l(this,tt);l(this,st);l(this,rt);l(this,pt);l(this,T,void 0);l(this,w,void 0);l(this,Ne,void 0);l(this,U,void 0);l(this,je,void 0);l(this,Te,void 0);l(this,Z,void 0);l(this,We,void 0);l(this,Ie,void 0);l(this,Le,void 0);l(this,we,void 0);l(this,Ee,void 0);l(this,fe,void 0);l(this,Re,void 0);o(this,w,void 0),o(this,Ne,void 0),o(this,U,void 0),o(this,Re,new Set),o(this,T,e),this.options=s,o(this,Z,null),this.bindMethods(),this.setOptions(s)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(n(this,w).addObserver(this),_t(n(this,w),this.options)?p(this,Pe,$e).call(this):this.updateResult(),p(this,et,Pt).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Ft(n(this,w),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Ft(n(this,w),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,p(this,tt,Ct).call(this),p(this,st,Ot).call(this),n(this,w).removeObserver(this)}setOptions(e,s){const r=this.options,i=n(this,w);if(this.options=n(this,T).defaultQueryOptions(e),ht(r,this.options)||n(this,T).getQueryCache().notify({type:"observerOptionsUpdated",query:n(this,w),observer:this}),typeof this.options.enabled<"u"&&typeof this.options.enabled!="boolean")throw new Error("Expected enabled to be a boolean");this.options.queryKey||(this.options.queryKey=r.queryKey),p(this,rt,St).call(this);const a=this.hasListeners();a&&$t(n(this,w),i,this.options,r)&&p(this,Pe,$e).call(this),this.updateResult(s),a&&(n(this,w)!==i||this.options.enabled!==r.enabled||this.options.staleTime!==r.staleTime)&&p(this,Ye,wt).call(this);const c=p(this,Xe,Et).call(this);a&&(n(this,w)!==i||this.options.enabled!==r.enabled||c!==n(this,fe))&&p(this,Ze,Rt).call(this,c)}getOptimisticResult(e){const s=n(this,T).getQueryCache().build(n(this,T),e),r=this.createResult(s,e);return Bs(this,r)&&(o(this,U,r),o(this,Te,this.options),o(this,je,n(this,w).state)),r}getCurrentResult(){return n(this,U)}trackResult(e){const s={};return Object.keys(e).forEach(r=>{Object.defineProperty(s,r,{configurable:!1,enumerable:!0,get:()=>(n(this,Re).add(r),e[r])})}),s}getCurrentQuery(){return n(this,w)}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){const s=n(this,T).defaultQueryOptions(e),r=n(this,T).getQueryCache().build(n(this,T),s);return r.isFetchingOptimistic=!0,r.fetch().then(()=>this.createResult(r,s))}fetch(e){return p(this,Pe,$e).call(this,{...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),n(this,U)))}createResult(e,s){var I;const r=n(this,w),i=this.options,a=n(this,U),c=n(this,je),d=n(this,Te),x=e!==r?e.state:n(this,Ne),{state:h}=e;let{error:E,errorUpdatedAt:M,fetchStatus:m,status:b}=h,P=!1,f;if(s._optimisticResults){const k=this.hasListeners(),R=!k&&_t(e,s),se=k&&$t(e,r,s,i);(R||se)&&(m=yt(e.options.networkMode)?"fetching":"paused",h.dataUpdatedAt||(b="pending")),s._optimisticResults==="isRestoring"&&(m="idle")}if(s.select&&typeof h.data<"u")if(a&&h.data===(c==null?void 0:c.data)&&s.select===n(this,We))f=n(this,Ie);else try{o(this,We,s.select),f=s.select(h.data),f=jt(a==null?void 0:a.data,f,s),o(this,Ie,f),o(this,Z,null)}catch(k){o(this,Z,k)}else f=h.data;if(typeof s.placeholderData<"u"&&typeof f>"u"&&b==="pending"){let k;if(a!=null&&a.isPlaceholderData&&s.placeholderData===(d==null?void 0:d.placeholderData))k=a.data;else if(k=typeof s.placeholderData=="function"?s.placeholderData((I=n(this,Le))==null?void 0:I.state.data,n(this,Le)):s.placeholderData,s.select&&typeof k<"u")try{k=s.select(k),o(this,Z,null)}catch(R){o(this,Z,R)}typeof k<"u"&&(b="success",f=jt(a==null?void 0:a.data,k,s),P=!0)}n(this,Z)&&(E=n(this,Z),f=n(this,Ie),M=Date.now(),b="error");const g=m==="fetching",j=b==="pending",v=b==="error",F=j&&g;return{status:b,fetchStatus:m,isPending:j,isSuccess:b==="success",isError:v,isInitialLoading:F,isLoading:F,data:f,dataUpdatedAt:h.dataUpdatedAt,error:E,errorUpdatedAt:M,failureCount:h.fetchFailureCount,failureReason:h.fetchFailureReason,errorUpdateCount:h.errorUpdateCount,isFetched:h.dataUpdateCount>0||h.errorUpdateCount>0,isFetchedAfterMount:h.dataUpdateCount>x.dataUpdateCount||h.errorUpdateCount>x.errorUpdateCount,isFetching:g,isRefetching:g&&!j,isLoadingError:v&&h.dataUpdatedAt===0,isPaused:m==="paused",isPlaceholderData:P,isRefetchError:v&&h.dataUpdatedAt!==0,isStale:Ut(e,s),refetch:this.refetch}}updateResult(e){const s=n(this,U),r=this.createResult(n(this,w),this.options);if(o(this,je,n(this,w).state),o(this,Te,this.options),n(this,je).data!==void 0&&o(this,Le,n(this,w)),ht(r,s))return;o(this,U,r);const i={},a=()=>{if(!s)return!0;const{notifyOnChangeProps:c}=this.options,d=typeof c=="function"?c():c;if(d==="all"||!d&&!n(this,Re).size)return!0;const y=new Set(d??n(this,Re));return this.options.throwOnError&&y.add("error"),Object.keys(n(this,U)).some(x=>{const h=x;return n(this,U)[h]!==s[h]&&y.has(h)})};(e==null?void 0:e.listeners)!==!1&&a()&&(i.listeners=!0),p(this,pt,hs).call(this,{...i,...e})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&p(this,et,Pt).call(this)}},T=new WeakMap,w=new WeakMap,Ne=new WeakMap,U=new WeakMap,je=new WeakMap,Te=new WeakMap,Z=new WeakMap,We=new WeakMap,Ie=new WeakMap,Le=new WeakMap,we=new WeakMap,Ee=new WeakMap,fe=new WeakMap,Re=new WeakMap,Pe=new WeakSet,$e=function(e){p(this,rt,St).call(this);let s=n(this,w).fetch(this.options,e);return e!=null&&e.throwOnError||(s=s.catch(G)),s},Ye=new WeakSet,wt=function(){if(p(this,tt,Ct).call(this),Be||n(this,U).isStale||!bt(this.options.staleTime))return;const s=ns(n(this,U).dataUpdatedAt,this.options.staleTime)+1;o(this,we,setTimeout(()=>{n(this,U).isStale||this.updateResult()},s))},Xe=new WeakSet,Et=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(n(this,w)):this.options.refetchInterval)??!1},Ze=new WeakSet,Rt=function(e){p(this,st,Ot).call(this),o(this,fe,e),!(Be||this.options.enabled===!1||!bt(n(this,fe))||n(this,fe)===0)&&o(this,Ee,setInterval(()=>{(this.options.refetchIntervalInBackground||dt.isFocused())&&p(this,Pe,$e).call(this)},n(this,fe)))},et=new WeakSet,Pt=function(){p(this,Ye,wt).call(this),p(this,Ze,Rt).call(this,p(this,Xe,Et).call(this))},tt=new WeakSet,Ct=function(){n(this,we)&&(clearTimeout(n(this,we)),o(this,we,void 0))},st=new WeakSet,Ot=function(){n(this,Ee)&&(clearInterval(n(this,Ee)),o(this,Ee,void 0))},rt=new WeakSet,St=function(){const e=n(this,T).getQueryCache().build(n(this,T),this.options);if(e===n(this,w))return;const s=n(this,w);o(this,w,e),o(this,Ne,e.state),this.hasListeners()&&(s==null||s.removeObserver(this),e.addObserver(this))},pt=new WeakSet,hs=function(e){S.batch(()=>{e.listeners&&this.listeners.forEach(s=>{s(n(this,U))}),n(this,T).getQueryCache().notify({query:n(this,w),type:"observerResultsUpdated"})})},ts);function Ks(t,e){return e.enabled!==!1&&!t.state.dataUpdatedAt&&!(t.state.status==="error"&&e.retryOnMount===!1)}function _t(t,e){return Ks(t,e)||t.state.dataUpdatedAt>0&&Ft(t,e,e.refetchOnMount)}function Ft(t,e,s){if(e.enabled!==!1){const r=typeof s=="function"?s(t):s;return r==="always"||r!==!1&&Ut(t,e)}return!1}function $t(t,e,s,r){return s.enabled!==!1&&(t!==e||r.enabled===!1)&&(!s.suspense||t.state.status!=="error")&&Ut(t,s)}function Ut(t,e){return t.isStaleByTime(e.staleTime)}function Bs(t,e){return!ht(t.getCurrentResult(),e)}var pe,N,H,ne,Ke,ct,nt,At,ss,_s=(ss=class extends _e{constructor(e,s){super();l(this,Ke);l(this,nt);l(this,pe,void 0);l(this,N,void 0);l(this,H,void 0);l(this,ne,void 0);o(this,N,void 0),o(this,pe,e),this.setOptions(s),this.bindMethods(),p(this,Ke,ct).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){var r;const s=this.options;this.options=n(this,pe).defaultMutationOptions(e),ht(s,this.options)||n(this,pe).getMutationCache().notify({type:"observerOptionsUpdated",mutation:n(this,H),observer:this}),(r=n(this,H))==null||r.setOptions(this.options)}onUnsubscribe(){var e;this.hasListeners()||(e=n(this,H))==null||e.removeObserver(this)}onMutationUpdate(e){p(this,Ke,ct).call(this),p(this,nt,At).call(this,e)}getCurrentResult(){return n(this,N)}reset(){o(this,H,void 0),p(this,Ke,ct).call(this),p(this,nt,At).call(this)}mutate(e,s){var r;return o(this,ne,s),(r=n(this,H))==null||r.removeObserver(this),o(this,H,n(this,pe).getMutationCache().build(n(this,pe),this.options)),n(this,H).addObserver(this),n(this,H).execute(e)}},pe=new WeakMap,N=new WeakMap,H=new WeakMap,ne=new WeakMap,Ke=new WeakSet,ct=function(){var s;const e=((s=n(this,H))==null?void 0:s.state)??ls();o(this,N,{...e,isPending:e.status==="pending",isSuccess:e.status==="success",isError:e.status==="error",isIdle:e.status==="idle",mutate:this.mutate,reset:this.reset})},nt=new WeakSet,At=function(e){S.batch(()=>{var s,r,i,a,c,d,y,x;n(this,ne)&&this.hasListeners()&&((e==null?void 0:e.type)==="success"?((r=(s=n(this,ne)).onSuccess)==null||r.call(s,e.data,n(this,N).variables,n(this,N).context),(a=(i=n(this,ne)).onSettled)==null||a.call(i,e.data,null,n(this,N).variables,n(this,N).context)):(e==null?void 0:e.type)==="error"&&((d=(c=n(this,ne)).onError)==null||d.call(c,e.error,n(this,N).variables,n(this,N).context),(x=(y=n(this,ne)).onSettled)==null||x.call(y,void 0,e.error,n(this,N).variables,n(this,N).context))),this.listeners.forEach(h=>{h(n(this,N))})})},ss),ds=q.createContext(void 0),K=t=>{const e=q.useContext(ds);if(t)return t;if(!e)throw new Error("No QueryClient set, use QueryClientProvider to set one");return e},$s=({client:t,children:e})=>(q.useEffect(()=>(t.mount(),()=>{t.unmount()}),[t]),q.createElement(ds.Provider,{value:t},e)),fs=q.createContext(!1),zs=()=>q.useContext(fs);fs.Provider;function Hs(){let t=!1;return{clearReset:()=>{t=!1},reset:()=>{t=!0},isReset:()=>t}}var Gs=q.createContext(Hs()),Vs=()=>q.useContext(Gs);function ps(t,e){return typeof t=="function"?t(...e):!!t}var Js=(t,e)=>{(t.suspense||t.throwOnError)&&(e.isReset()||(t.retryOnMount=!1))},Ws=t=>{q.useEffect(()=>{t.clearReset()},[t])},Ys=({result:t,errorResetBoundary:e,throwOnError:s,query:r})=>t.isError&&!e.isReset()&&!t.isFetching&&ps(s,[t.error,r]),Xs=t=>{t.suspense&&typeof t.staleTime!="number"&&(t.staleTime=1e3)},Zs=(t,e)=>(t==null?void 0:t.suspense)&&e.isPending,er=(t,e,s)=>e.fetchOptimistic(t).catch(()=>{s.clearReset()});function tr(t,e,s){if(process.env.NODE_ENV!=="production"&&(typeof t!="object"||Array.isArray(t)))throw new Error('Bad argument type. Starting with v5, only the "Object" form is allowed when calling query related functions. Please use the error stack to find the culprit call. More info here: https://tanstack.com/query/latest/docs/react/guides/migrating-to-v5#supports-a-single-signature-one-object');const r=K(s),i=zs(),a=Vs(),c=r.defaultQueryOptions(t);c._optimisticResults=i?"isRestoring":"optimistic",Xs(c),Js(c,a),Ws(a);const[d]=q.useState(()=>new e(r,c)),y=d.getOptimisticResult(c);if(q.useSyncExternalStore(q.useCallback(x=>{const h=i?()=>{}:d.subscribe(S.batchCalls(x));return d.updateResult(),h},[d,i]),()=>d.getCurrentResult(),()=>d.getCurrentResult()),q.useEffect(()=>{d.setOptions(c,{listeners:!1})},[c,d]),Zs(c,y))throw er(c,d,a);if(Ys({result:y,errorResetBoundary:a,throwOnError:c.throwOnError,query:d.getCurrentQuery()}))throw y.error;return c.notifyOnChangeProps?y:d.trackResult(y)}function it(t,e){return tr(t,Ls,e)}function J(t,e){const s=K(e),[r]=q.useState(()=>new _s(s,t));q.useEffect(()=>{r.setOptions(t)},[r,t]);const i=q.useSyncExternalStore(q.useCallback(c=>r.subscribe(S.batchCalls(c)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),a=q.useCallback((c,d)=>{r.mutate(c,d).catch(sr)},[r]);if(i.error&&ps(r.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:a,mutateAsync:i.mutate}}function sr(){}function D(){return K().getQueryData(["apiBaseUrl"])||"/api/chaibuilder"}const me=()=>{const{data:t,refetch:e}=it({queryKey:["currentPage"],queryFn:()=>localStorage.getItem("currentPage")||""});return[t,s=>{s&&(localStorage.setItem("currentPage",s||""),e())}]};let zt="";const at=()=>(zt=localStorage.getItem("__chai_at"),zt);function rr(t){const e={method:"GET",headers:{"x-chai-access-token":at()}};return fetch(t,e)}function nr(t,e){const s={method:"POST",headers:{"x-chai-access-token":at()},body:JSON.stringify(e)};return fetch(t,s)}function ir(t,e){const s={method:"PUT",headers:{"x-chai-access-token":at()},body:JSON.stringify(e)};return fetch(t,s)}function ar(t,e){const s={method:"DELETE",headers:{"x-chai-access-token":at()},body:JSON.stringify(e)};return fetch(t,s)}const B={get:rr,post:nr,put:ir,delete:ar},Dt=()=>{const[t,e]=me(),s=D();return it({queryKey:["project"],queryFn:async()=>{const{data:r}=await B.get(`${s}/project`).then(i=>i.json());if(!t&&r){const i=localStorage.getItem("currentPage");e(i||(r==null?void 0:r.homepage))}return r}})},Qt=()=>{const t=D();return it({queryKey:["pages"],queryFn:async()=>{const{data:e}=await B.get(`${t}/pages`).then(s=>s.json());return e||[]}})},ys=()=>{const[t]=me(),e=D();return it({queryKey:["page_data",t],queryFn:async()=>{const{data:s}=await B.get(`${e}/page?uuid=${t}`).then(r=>r.json());return s},enabled:!!t,staleTime:3e3})},qt=()=>u.jsxRuntimeExports.jsx("div",{className:"h-screen w-screen bg-gray-200",children:u.jsxRuntimeExports.jsxs("div",{className:"flex flex-col h-full w-full justify-center items-center",children:[u.jsxRuntimeExports.jsxs("div",{className:"flex flex-row gap-2",children:[u.jsxRuntimeExports.jsx("div",{className:"w-4 h-4 rounded-full bg-orange-600 animate-bounce [animation-delay:.6s]"}),u.jsxRuntimeExports.jsx("div",{className:"w-4 h-4 rounded-full bg-blue-600 animate-bounce [animation-delay:.4s]"}),u.jsxRuntimeExports.jsx("div",{className:"w-4 h-4 rounded-full bg-green-600 animate-bounce [animation-delay:.2s]"}),u.jsxRuntimeExports.jsx("div",{className:"w-4 h-4 rounded-full bg-yellow-600 animate-bounce [animation-delay:.0s]"})]}),u.jsxRuntimeExports.jsx("div",{className:"text-gray-700 font-thin",children:"Loading Builder..."})]})}),ms=(t="Project updated successfully.")=>{const e=K(),s=D();return J({mutationFn:async r=>await B.put(`${s}/project`,r).then(i=>i.json()),onSuccess:()=>{e.invalidateQueries({queryKey:["project"]}),ee.toast.success(t)}})},gs=()=>{const[t]=["SAVED"],[e,s]=me(),r=rs.useBuilderReset();return i=>t!=="SAVED"?(ee.toast.error("You have unsaved changes. Please save before changing the page."),!1):e===i.uuid?!1:(r(),setTimeout(()=>{s(i.uuid)},100),!0)},or=()=>{const t=K(),e=gs(),s=D();return J({mutationFn:async r=>B.post(`${s}/pages`,r).then(i=>i.json()),onSuccess:r=>{t.invalidateQueries({queryKey:["pages"]}),e({uuid:r.uuid,slug:r.slug}),ee.toast.success("Page added successfully.")}})},xs=()=>{const t=D(),[e]=me(),s=K();return J({mutationFn:async r=>B.put(`${t}/page`,r).then(i=>i.json()),onSuccess:async r=>{var i;if(r.result==="error"&&((i=r.error)==null?void 0:i.code)=="PAGE_LOCKED"){s.invalidateQueries({queryKey:["page_data",e]});return}ee.toast.success("Page saved successfully.")}})},ur=()=>{const t=D(),{data:e}=Qt(),[s]=me(),{data:r}=Dt(),i=K();return J({mutationFn:async()=>{const a=e.find(c=>c.uuid===s).slug;return await B.post(`${t}/publish`,{slug:a,uuid:s,isHomepage:(r==null?void 0:r.homepage)===s}).then(c=>c.json())},onSuccess:async a=>{var c;if(a.result==="error"&&((c=a.error)==null?void 0:c.code)=="PAGE_LOCKED"){i.invalidateQueries({queryKey:["page_data",s]});return}ee.toast.success("Page published successfully.",{position:"top-right",duration:2e3})}})},cr=()=>{const t=K(),e=D();return J({mutationFn:async s=>B.delete(`${e}/page`,s).then(r=>r.json()),onSuccess:()=>{ee.toast.success("Page deleted successfully."),t.invalidateQueries({queryKey:["pages"]})}})},lr=()=>{const t=K(),e=D();return J({mutationFn:async s=>B.post(`${e}/take-control`,{uuid:s}).then(r=>r.json()),onSuccess:(s,r)=>{t.invalidateQueries({queryKey:["page_data",r]})}})},hr=()=>{const t=D();return J({mutationFn:async()=>{const{data:e}=await B.get(`${t}/library`).then(s=>s.json());return te.sortBy(te.filter(e,s=>!te.has(s,"hidden")),"group")}})},dr=()=>{const t=D();return J({mutationFn:async e=>{if(!e||!e.uuid)return[];try{const{data:s}=await B.get(`${t}/block?uuid=${e.uuid}&format=${e.format}`).then(async r=>e.format==="html"?Es.getBlocksFromHTML(await r.text()):await r.json());return te.set(s,"0._name",te.capitalize(e.group)),s||[]}catch{return[]}}})},fr=()=>{const t=D();return J({mutationFn:async e=>{const s=new FormData;s.append("file",e);const{data:r}=await fetch(`${t}/upload`,{method:"POST",headers:{"x-chai-access-token":at()},body:s}).then(i=>i.json());return r}})};var bs={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},Ht=C.createContext&&C.createContext(bs),ye=function(){return ye=Object.assign||function(t){for(var e,s=1,r=arguments.length;s<r;s++){e=arguments[s];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])}return t},ye.apply(this,arguments)},pr=function(t,e){var s={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(s[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(s[r[i]]=t[r[i]]);return s};function vs(t){return t&&t.map(function(e,s){return C.createElement(e.tag,ye({key:s},e.attr),vs(e.child))})}function js(t){return function(e){return C.createElement(yr,ye({attr:ye({},t.attr)},e),vs(t.child))}}function yr(t){var e=function(s){var r=t.attr,i=t.size,a=t.title,c=pr(t,["attr","size","title"]),d=i||s.size||"1em",y;return s.className&&(y=s.className),t.className&&(y=(y?y+" ":"")+t.className),C.createElement("svg",ye({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},s.attr,r,c,{className:y,style:ye(ye({color:t.color||s.color},s.style),t.style),height:d,width:d,xmlns:"http://www.w3.org/2000/svg"}),a&&C.createElement("title",null,a),t.children)};return Ht!==void 0?C.createElement(Ht.Consumer,null,function(s){return e(s)}):e(bs)}function ws(t){return js({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M20 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm0 4l-8 5-8-5V6l8 5 8-5v2z"}}]})(t)}function mr(t){return js({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z"}}]})(t)}const gr=()=>{const{mutate:t,isPending:e}=lr(),[s]=me(),{data:r}=ys(),i=te.get(r,"lockedBy.name",""),a=te.get(r,"lockedBy.email","");return u.jsxRuntimeExports.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg drop-shadow-2xl mx-auto p-10 space-y-4 text-center max-w-xl",children:[u.jsxRuntimeExports.jsxs("h2",{className:"text-2xl font-bold",children:["Page is ",u.jsxRuntimeExports.jsx("span",{className:"text-red-500",children:"locked"})]}),u.jsxRuntimeExports.jsxs("div",{className:"text-gray-500 dark:text-gray-400 font-light",children:["This page is currently being edited by ",u.jsxRuntimeExports.jsx("br",{}),u.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-x-3 w-max mx-auto font-medium text-gray-700 mt-2 text-sm",children:[u.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-x-2 bg-gray-100 py-1 px-2 rounded-md",children:[u.jsxRuntimeExports.jsx(mr,{className:"w-4 h-4 text-gray-500"})," ",i]}),u.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-x-2 bg-gray-100 py-1 px-2 rounded-md lowercase",children:[u.jsxRuntimeExports.jsx(ws,{className:"w-4 h-4 text-gray-500"})," ",a]})]}),u.jsxRuntimeExports.jsxs("div",{className:"pt-4",children:["If you take control, ",i," will be ",u.jsxRuntimeExports.jsx("span",{className:"text-red-500",children:"restricted"})," from making additional edits."]})]}),u.jsxRuntimeExports.jsx(xt.Button,{disabled:e,onClick:()=>t(s),className:`w-36 ${e?"bg-transparent shadow-none hover:bg-transparent":""}`,children:e?u.jsxRuntimeExports.jsx(kt.Loader,{className:"text-sm animate-spin text-gray-500"}):"Take Over"})]})},xr=()=>{const t=D(),e=K();return J({mutationFn:async s=>{const r=await fetch(`${t}/login`,{method:"POST",body:JSON.stringify(s)});if(r.ok)return await r.json();throw r.status===401?new Error("Invalid login credentials"):new Error("Invalid")},onSuccess:s=>{const{data:r}=s;if(!r.accessToken){ee.toast.error("Something went wrong. Please try again.",{position:"top-center"});return}localStorage.setItem("__chai_at",r.accessToken),localStorage.setItem("__chai_ur",JSON.stringify(te.omit(r,["accessToken"]))),e.invalidateQueries({queryKey:["verify"]}),ee.toast.success("Logged in successfully.")},onError:()=>{ee.toast.error("Invalid login credentials. Please try again.",{position:"top-center"})}})},br=()=>{const t=D();return it({queryKey:["verify"],queryFn:async()=>{const e=await B.get(`${t}/verify`);return e.ok?(await e.json()).result==="success"?{valid:!0}:(localStorage.removeItem("__chai_at"),{valid:!1}):(localStorage.removeItem("__chai_at"),{valid:!0})}})},vr=()=>{const t=D(),e=K();return J({mutationFn:async()=>{const{result:s}=await B.post(`${t}/logout`).then(r=>r.json());if(s==="success")return localStorage.clear(),e.invalidateQueries({queryKey:["verify"]}),{logout:!0};throw new Error("Invalid session")}})},jr=({children:t})=>{const e=vr();return u.jsxRuntimeExports.jsxs(ie.AlertDialog,{children:[u.jsxRuntimeExports.jsx(ie.AlertDialogTrigger,{asChild:!0,children:t}),u.jsxRuntimeExports.jsxs(ie.AlertDialogContent,{children:[u.jsxRuntimeExports.jsxs(ie.AlertDialogHeader,{children:[u.jsxRuntimeExports.jsxs(ie.AlertDialogTitle,{children:["Are you sure, you want to ",u.jsxRuntimeExports.jsx("span",{className:"text-red-500",children:"Sign Out"}),"?"]}),u.jsxRuntimeExports.jsx(ie.AlertDialogDescription,{children:"Kindly ensure that all your data is saved before proceeding with the sign-out process to prevent any potential loss of unsaved information"})]}),u.jsxRuntimeExports.jsxs(ie.AlertDialogFooter,{children:[u.jsxRuntimeExports.jsx(ie.AlertDialogCancel,{disabled:e.isPending,children:"Cancel"}),u.jsxRuntimeExports.jsxs("button",{disabled:e.isPending,onClick:()=>e.mutate(),className:"rounded-md text-white w-28 text-center justify-center bg-red-600 hover:bg-red-700 flex items-center gap-x-2",children:[e.isPending&&u.jsxRuntimeExports.jsx(kt.Loader2,{className:"animate-spin w-5 h-5"}),"Sign Out"]})]})]})]})},wr=()=>u.jsxRuntimeExports.jsx(jr,{children:u.jsxRuntimeExports.jsx("button",{className:"border-gray-200 rounded-md p-2 mb-2 border",children:u.jsxRuntimeExports.jsx(kt.LogOutIcon,{className:"w-4 h-4 text-red-500 cursor-pointer hover:text-red-300 duration-300"})})}),Er=wr,Rr=C.lazy(()=>Promise.resolve().then(()=>require("./PagesPanel-zJq8p1ja.cjs"))),Pr=C.lazy(()=>Promise.resolve().then(()=>require("./ProjectPanel-Zml2F8b9.cjs"))),Cr=C.lazy(()=>Promise.resolve().then(()=>require("./CurrentPage-YMpqOqx7.cjs"))),Or=()=>u.jsxRuntimeExports.jsx("h2",{children:"Your Logo"}),Sr=()=>{const{mutate:t}=ur();return xt.useBuilderProp("editable",!0)?u.jsxRuntimeExports.jsx(xt.Button,{onClick:t,className:"bg-blue-600 text-white",children:"Publish"}):null},Fr=t=>{const{data:e,isLoading:s}=Dt(),{data:r,isLoading:i}=Qt(),{data:a}=ys(),{mutate:c}=ms(),{mutate:d}=xs(),[y]=me(),x=fr(),h=hr(),E=dr(),M=D(),m=C.useCallback(async j=>await x.mutateAsync(j),[x]),b=C.useCallback(async()=>await h.mutateAsync(),[h]),P=C.useCallback(async j=>await E.mutateAsync(j),[E]),f=async(j=20,v=0)=>{const F=`limit=${j}&offset=${v}`;return await fetch(`${M}/assets?${F}`).then(Q=>Q.json())},{logo:g=Or}=t;return s||!e?u.jsxRuntimeExports.jsx(qt,{}):i||!r?u.jsxRuntimeExports.jsx(qt,{}):u.jsxRuntimeExports.jsx("div",{className:"bg-background text-foreground",children:u.jsxRuntimeExports.jsx(rs.ChaiBuilderEditor,{editable:a!=null&&a.lockedBy?a==null?void 0:a.lockedBy.self:!0,nonEditableComponent:gr,blocks:(a==null?void 0:a.blocks)||[],brandingOptions:e.brandingOptions,darkMode:t.darkMode||!1,dataProviders:(a==null?void 0:a.providers)||[],onSavePage:async({blocks:j,providers:v})=>(await d({blocks:j,providers:v,uuid:y}),!0),onSaveBrandingOptions:async j=>(await c({brandingOptions:j}),!0),topBarComponents:{left:[g],center:[Cr],right:[Sr]},sideBarComponents:{top:[{icon:lt.FileTextIcon,name:"pages",panel:Rr},{icon:lt.GearIcon,name:"settings",panel:Pr}],bottom:[Er]},uploadMediaCallback:m,fetchMediaCallback:f,getUILibraryBlocks:b,getExternalPredefinedBlock:P,getPages:()=>r,unsplashAccessKey:t.unsplashAccessKey||""})})},Ar=({logo:t})=>{const[e,s]=C.useState(!1),[r,i]=C.useState(""),[a,c]=C.useState(""),{mutate:d,isPending:y}=xr(),x=h=>{h.preventDefault(),d({email:r,password:a})};return u.jsxRuntimeExports.jsx("section",{className:"h-screen w-screen flex items-center justify-center bg-[radial-gradient(#AAA,transparent_0.5px)] duration-300 [background-size:6px_6px]",children:u.jsxRuntimeExports.jsx("div",{className:"overflow-hidden bg-white rounded-xl w-96 drop-shadow-2xl duration-300",children:u.jsxRuntimeExports.jsxs("div",{className:"p-12",children:[u.jsxRuntimeExports.jsxs("div",{className:"max-w-2xl mx-auto text-center",children:[u.jsxRuntimeExports.jsx(C.Suspense,{children:t?C.createElement(t):""}),u.jsxRuntimeExports.jsx("p",{className:"max-w-xl mx-auto text-base leading-relaxed text-gray-700 font-thin",children:"Enter your login credential to continue"})]}),u.jsxRuntimeExports.jsx("div",{className:"mt-8",children:u.jsxRuntimeExports.jsxs("form",{method:"POST",onSubmit:x,className:"space-y-5",children:[u.jsxRuntimeExports.jsx("div",{children:u.jsxRuntimeExports.jsxs("div",{className:"mt-2.5 relative text-gray-400 focus-within:text-gray-600",children:[u.jsxRuntimeExports.jsx("div",{className:"absolute inset-y-0 left-0 flex items-center pl-3 pointer-events-none",children:u.jsxRuntimeExports.jsx(ws,{})}),u.jsxRuntimeExports.jsx("input",{value:r,onChange:h=>i(h.target.value),type:"email",id:"email",placeholder:"Enter email",className:"block w-full py-4 px-10 text-black placeholder-gray-500 transition-all duration-200 bg-white border border-gray-200 rounded-md focus:outline-none focus:border-blue-600 caret-blue-600"})]})}),u.jsxRuntimeExports.jsx("div",{children:u.jsxRuntimeExports.jsxs("div",{className:"mt-2.5 relative text-gray-400 focus-within:text-gray-600",children:[u.jsxRuntimeExports.jsx("div",{className:"absolute inset-y-0 left-0 flex items-center pl-3 pointer-events-none",children:u.jsxRuntimeExports.jsx("svg",{className:"w-5 h-5",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:u.jsxRuntimeExports.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M12 11c0 3.517-1.009 6.799-2.753 9.571m-3.44-2.04l.054-.09A13.916 13.916 0 008 11a4 4 0 118 0c0 1.017-.07 2.019-.203 3m-2.118 6.844A21.88 21.88 0 0015.171 17m3.839 1.132c.645-2.266.99-4.659.99-7.132A8 8 0 008 4.07M3 15.364c.64-1.319 1-2.8 1-4.364 0-1.457.39-2.823 1.07-4"})})}),u.jsxRuntimeExports.jsx("input",{value:a,onChange:h=>c(h.target.value),type:e?"text":"password",id:"pwd",placeholder:"Enter password",className:"block w-full py-4 px-10 text-black placeholder-gray-500 transition-all duration-200 bg-white border border-gray-200 rounded-md focus:outline-none focus:border-blue-600 caret-blue-600"}),u.jsxRuntimeExports.jsx("button",{type:"button",className:"absolute inset-y-0 right-4 flex items-center pl-3 cursor-pointer",onClick:()=>s(!e),children:e?u.jsxRuntimeExports.jsx(lt.EyeClosedIcon,{}):u.jsxRuntimeExports.jsx(lt.EyeOpenIcon,{})})]})}),u.jsxRuntimeExports.jsx("div",{children:u.jsxRuntimeExports.jsx("button",{disabled:y||te.size(r)<2||te.size(a)<2,type:"submit",className:"inline-flex disabled:bg-gray-400 items-center justify-center w-full px-4 py-4 text-base font-semibold text-white transition-all duration-200 bg-blue-600 border border-transparent rounded-md focus:outline-none hover:bg-blue-700 focus:bg-blue-700",children:y?"Signing in...":"Login"})})]})}),u.jsxRuntimeExports.jsx("div",{className:"mt-4 flex items-center justify-end gap-x-2 text-sm",children:u.jsxRuntimeExports.jsx("a",{href:"https://apps.chaibuilder.com/settings",target:"_blank",className:"text-gray-500 hover:text-blue-400",children:"Forget your password?"})})]})})})},qr=t=>{const{data:e,isLoading:s}=br(),r=K();return C.useEffect(()=>{r.setQueryData(["apiBaseUrl"],t.apiBaseUrl||"/api/chaibuilder")},[t.apiBaseUrl,r]),s?u.jsxRuntimeExports.jsx(qt,{}):e!=null&&e.valid?u.jsxRuntimeExports.jsx(Fr,{...t}):u.jsxRuntimeExports.jsx(Ar,{logo:t.logo})},kr=new Is,Mr=t=>u.jsxRuntimeExports.jsxs($s,{client:kr,children:[u.jsxRuntimeExports.jsx(ee.Toaster,{richColors:!0}),u.jsxRuntimeExports.jsx(qr,{...t})]});exports.ChaiBuilderStudio=Mr;exports.useAddPage=or;exports.useChangePage=gs;exports.useCurrentPage=me;exports.useDeletePage=cr;exports.usePages=Qt;exports.useProject=Dt;exports.useQueryClient=K;exports.useUpdatePage=xs;exports.useUpdateProject=ms;
@@ -1,18 +0,0 @@
1
- import { get as s, values as _, pick as a, keys as i, pickBy as o, endsWith as u, mapValues as y } from "lodash";
2
- const r = {}, f = () => r, k = (t) => s(r, t, null), l = (t) => y(r[t].props, "default"), g = (t) => t.map((p) => {
3
- if (r[p._type]) {
4
- const e = l(p._type);
5
- return {
6
- ...e,
7
- ...a(p, [...i(e), "_type", "_id", "_name", "_parent", "_bindings"]),
8
- ...o(p, (c, n) => u(n, "_attrs"))
9
- };
10
- }
11
- return p;
12
- }), m = {}, h = () => _(m);
13
- export {
14
- h as A,
15
- f as C,
16
- g as P,
17
- k as h
18
- };
@@ -1,10 +0,0 @@
1
- import { j as t } from "./jsx-runtime-Sp0orL4X.js";
2
- import * as s from "react";
3
- import * as o from "@radix-ui/react-label";
4
- import { cva as m } from "class-variance-authority";
5
- import { c as i } from "./utils-dze1SGvB.js";
6
- const l = m("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"), p = s.forwardRef(({ className: a, ...e }, r) => /* @__PURE__ */ t.jsx(o.Root, { ref: r, className: i(l(), a), ...e }));
7
- p.displayName = o.Root.displayName;
8
- export {
9
- p as L
10
- };
@@ -1 +0,0 @@
1
- "use strict";const i=require("./jsx-runtime-JYMCiFoE.cjs"),c=require("react"),l=require("@radix-ui/react-label"),u=require("class-variance-authority"),d=require("./utils-qK_SjzzV.cjs");function n(e){const a=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const r=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(a,t,r.get?r:{enumerable:!0,get:()=>e[t]})}}return a.default=e,Object.freeze(a)}const m=n(c),o=n(l),b=u.cva("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),s=m.forwardRef(({className:e,...a},t)=>i.jsxRuntimeExports.jsx(o.Root,{ref:t,className:d.cn(b(),e),...a}));s.displayName=o.Root.displayName;exports.Label=s;
@@ -1,204 +0,0 @@
1
- import { j as e } from "./jsx-runtime-Sp0orL4X.js";
2
- import m, { IconPickerItem as g } from "react-icons-picker";
3
- import x from "react-dom";
4
- import { isEmpty as h, map as f } from "lodash";
5
- import { useState as u, useEffect as b } from "react";
6
- import { D as j, a as v, b as k } from "./dialog-jrw9DF1f.js";
7
- import y from "./ImagesPanel-oaHOD-Ex.js";
8
- import w from "react-quill";
9
- import "react-i18next";
10
- import { u as N } from "./skeleton-CU_FIbg3.js";
11
- const B = (t) => {
12
- try {
13
- const r = document.getElementById("icon-picker-field"), s = document.createElement("div");
14
- x.render(/* @__PURE__ */ e.jsx(g, { value: t }), s), r.appendChild(s), s.hidden = !0;
15
- let a = s.innerHTML;
16
- setTimeout(() => r.removeChild(s), 1e3);
17
- const n = new DOMParser().parseFromString(a, "image/svg+xml"), l = n.querySelector("svg");
18
- return l && (l.removeAttribute("width"), l.removeAttribute("height")), new XMLSerializer().serializeToString(n);
19
- } catch {
20
- return "";
21
- }
22
- }, z = ({ value: t, onChange: r, onBlur: s, id: a }) => {
23
- const i = (n) => {
24
- r("<svg />");
25
- const l = B(n);
26
- r(l), s(a, l);
27
- };
28
- return /* @__PURE__ */ e.jsxs("div", { className: "mt-1 flex h-20 items-center gap-x-2", id: "icon-picker-field", children: [
29
- /* @__PURE__ */ e.jsxs("div", { className: "relative h-12 w-12 group", children: [
30
- /* @__PURE__ */ e.jsx(
31
- "div",
32
- {
33
- dangerouslySetInnerHTML: { __html: t == null ? void 0 : t.replace("<svg", '<svg class="h-5 w-5"') },
34
- className: "absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 transform cursor-pointer bg-white z-0"
35
- }
36
- ),
37
- /* @__PURE__ */ e.jsx(
38
- m,
39
- {
40
- value: t ? "BiSolidGrid" : null,
41
- onChange: i,
42
- pickButtonStyle: {
43
- position: "relative",
44
- height: "48px",
45
- width: "48px",
46
- border: "1px solid #BBBBBB",
47
- display: "flex",
48
- alignItems: "center",
49
- justifyContent: "center",
50
- borderRadius: "6px",
51
- backgroundColor: "transparent",
52
- zIndex: 1
53
- },
54
- searchInputStyle: {
55
- backgroundColor: "transparent",
56
- width: "100%",
57
- border: "1px solid #BBBBBB",
58
- margin: "0px 10px",
59
- padding: "10px"
60
- }
61
- }
62
- )
63
- ] }),
64
- /* @__PURE__ */ e.jsx(
65
- "textarea",
66
- {
67
- value: t,
68
- onChange: (n) => r(n.target.value),
69
- className: "h-full border w-full rounded-sm border-foreground/20 px-2 py-1 text-xs shadow-sm focus:border-gray-500/80 focus:outline-none focus:ring-0",
70
- placeholder: "Choose icon or enter svg"
71
- }
72
- )
73
- ] });
74
- }, C = ({ children: t, onSelect: r }) => {
75
- const [s, a] = u(!1), i = (...n) => {
76
- r.call(void 0, ...n), a(!1);
77
- };
78
- return /* @__PURE__ */ e.jsxs(j, { open: s, onOpenChange: (n) => a(n), children: [
79
- /* @__PURE__ */ e.jsx(v, { asChild: !0, children: t }),
80
- /* @__PURE__ */ e.jsx(k, { className: "flex h-3/4 max-w-5xl", children: /* @__PURE__ */ e.jsx("div", { className: "h-full w-full", children: /* @__PURE__ */ e.jsx(y, { isModalView: !0, onSelect: i }) }) })
81
- ] });
82
- }, p = C, A = ({ value: t, onChange: r, id: s, onBlur: a }) => /* @__PURE__ */ e.jsxs("div", { className: "mt-1.5 flex items-center gap-x-3", children: [
83
- t ? /* @__PURE__ */ e.jsx("img", { src: t, className: "h-20 w-20 overflow-hidden rounded-md border object-cover", alt: "" }) : /* @__PURE__ */ e.jsx(p, { onSelect: r, children: /* @__PURE__ */ e.jsx("div", { className: "h-20 w-20 cursor-pointer rounded-md border bg-[radial-gradient(#AAA,transparent_1px)] duration-300 [background-size:10px_10px] hover:border-gray-400" }) }),
84
- /* @__PURE__ */ e.jsxs("div", { className: "flex w-3/5 flex-col", children: [
85
- /* @__PURE__ */ e.jsx(p, { onSelect: r, children: /* @__PURE__ */ e.jsx("small", { className: "cursor-pointer rounded-full bg-gray-600 px-2 py-1 text-center text-xs text-white hover:bg-gray-500 dark:bg-gray-700", children: t || !h(t) ? "Replace Image" : "Choose Image" }) }),
86
- /* @__PURE__ */ e.jsx("small", { className: "-pl-4 pt-2 text-center text-xs text-gray-600", children: "OR" }),
87
- /* @__PURE__ */ e.jsx(
88
- "input",
89
- {
90
- type: "url",
91
- className: "text-xs",
92
- placeholder: "Enter image URL",
93
- value: t,
94
- onBlur: ({ target: { value: i } }) => a(s, i),
95
- onChange: (i) => r(i.target.value)
96
- }
97
- )
98
- ] })
99
- ] }), F = ({ id: t, placeholder: r, value: s, onChange: a, onBlur: i }) => {
100
- const n = {
101
- toolbar: [
102
- ["bold", "italic", "underline", "strike", "blockquote"],
103
- [{ list: "ordered" }, { list: "bullet" }],
104
- [{ color: [] }, { background: [] }, { align: [] }],
105
- ["link", "clean"]
106
- ]
107
- }, l = [
108
- "header",
109
- "font",
110
- "list",
111
- "bold",
112
- "italic",
113
- "underline",
114
- "strike",
115
- "blockquote",
116
- "color",
117
- "background",
118
- "align",
119
- "link",
120
- "image"
121
- ];
122
- return typeof window > "u" ? null : /* @__PURE__ */ e.jsx(
123
- w,
124
- {
125
- id: t,
126
- value: s,
127
- onBlur: (c) => i(t, c),
128
- onChange: (c) => a(c),
129
- modules: n,
130
- formats: l,
131
- placeholder: r,
132
- className: "mt-1 rounded-md"
133
- }
134
- );
135
- }, D = ({ schema: t, formData: r, onChange: s }) => {
136
- const [a, i] = u([]), n = N("getPages", () => []), { type: l = "page", href: c = "", target: d = "self" } = r;
137
- return b(() => {
138
- (async () => {
139
- const o = await n();
140
- i(o || []);
141
- })();
142
- }, [n]), /* @__PURE__ */ e.jsxs("div", { children: [
143
- /* @__PURE__ */ e.jsx("span", { className: "text-xs font-medium", children: (t == null ? void 0 : t.title) ?? "Link" }),
144
- /* @__PURE__ */ e.jsxs("div", { className: "flex flex-col gap-y-1.5", children: [
145
- /* @__PURE__ */ e.jsx(
146
- "select",
147
- {
148
- name: "type",
149
- defaultValue: "page",
150
- value: l,
151
- onChange: (o) => s({ ...r, type: o.target.value }),
152
- children: [
153
- { const: "page", title: "Open Page" },
154
- { const: "url", title: "Open URL" },
155
- { const: "email", title: "Compose Email" },
156
- { const: "telephone", title: "Call Phone" },
157
- { const: "scroll", title: "Scroll to element" }
158
- ].map((o) => /* @__PURE__ */ e.jsx("option", { value: o.const, children: o.title }, o.const))
159
- }
160
- ),
161
- l === "page" ? /* @__PURE__ */ e.jsxs(
162
- "select",
163
- {
164
- name: "href",
165
- defaultValue: "",
166
- placeholder: "Choose Page",
167
- value: c,
168
- onChange: (o) => s({ ...r, href: o.target.value }),
169
- children: [
170
- /* @__PURE__ */ e.jsx("option", { value: "", children: "Choose page" }),
171
- f(a, (o) => /* @__PURE__ */ e.jsx("option", { value: o.slug, children: o.name }, o.uuid))
172
- ]
173
- }
174
- ) : /* @__PURE__ */ e.jsx(
175
- "input",
176
- {
177
- name: "href",
178
- type: "text",
179
- value: c,
180
- onChange: (o) => s({ ...r, href: o.target.value }),
181
- placeholder: l === "page" || l === "url" ? "Enter URL" : l === "scroll" ? "#ElementID" : "Enter detail"
182
- }
183
- ),
184
- (l === "page" || l === "url") && /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-x-2", children: [
185
- /* @__PURE__ */ e.jsx(
186
- "input",
187
- {
188
- type: "checkbox",
189
- defaultChecked: d === "_blank",
190
- className: "cursor-pointer rounded-md border border-border",
191
- onChange: () => s({ ...r, target: d === "_blank" ? "_self" : "_blank" })
192
- }
193
- ),
194
- /* @__PURE__ */ e.jsx("span", { className: "pt-1 text-xs", children: "Open in new tab" })
195
- ] })
196
- ] })
197
- ] });
198
- };
199
- export {
200
- z as I,
201
- D as L,
202
- F as R,
203
- A as a
204
- };
@@ -1 +0,0 @@
1
- "use strict";const e=require("./jsx-runtime-JYMCiFoE.cjs"),m=require("react-icons-picker"),h=require("react-dom"),g=require("lodash"),d=require("react"),x=require("./dialog-S_QbL1iq.cjs"),j=require("./ImagesPanel-6us7hiLN.cjs"),E=require("react-quill");require("react-i18next");const R=require("./skeleton-JHP9zwL2.cjs"),f=t=>{try{const s=document.getElementById("icon-picker-field"),r=document.createElement("div");h.render(e.jsxRuntimeExports.jsx(m.IconPickerItem,{value:t}),r),s.appendChild(r),r.hidden=!0;let l=r.innerHTML;setTimeout(()=>s.removeChild(r),1e3);const o=new DOMParser().parseFromString(l,"image/svg+xml"),n=o.querySelector("svg");return n&&(n.removeAttribute("width"),n.removeAttribute("height")),new XMLSerializer().serializeToString(o)}catch{return""}},b=({value:t,onChange:s,onBlur:r,id:l})=>{const a=o=>{s("<svg />");const n=f(o);s(n),r(l,n)};return e.jsxRuntimeExports.jsxs("div",{className:"mt-1 flex h-20 items-center gap-x-2",id:"icon-picker-field",children:[e.jsxRuntimeExports.jsxs("div",{className:"relative h-12 w-12 group",children:[e.jsxRuntimeExports.jsx("div",{dangerouslySetInnerHTML:{__html:t==null?void 0:t.replace("<svg",'<svg class="h-5 w-5"')},className:"absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 transform cursor-pointer bg-white z-0"}),e.jsxRuntimeExports.jsx(m,{value:t?"BiSolidGrid":null,onChange:a,pickButtonStyle:{position:"relative",height:"48px",width:"48px",border:"1px solid #BBBBBB",display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"6px",backgroundColor:"transparent",zIndex:1},searchInputStyle:{backgroundColor:"transparent",width:"100%",border:"1px solid #BBBBBB",margin:"0px 10px",padding:"10px"}})]}),e.jsxRuntimeExports.jsx("textarea",{value:t,onChange:o=>s(o.target.value),className:"h-full border w-full rounded-sm border-foreground/20 px-2 py-1 text-xs shadow-sm focus:border-gray-500/80 focus:outline-none focus:ring-0",placeholder:"Choose icon or enter svg"})]})},k=({children:t,onSelect:s})=>{const[r,l]=d.useState(!1),a=(...o)=>{s.call(void 0,...o),l(!1)};return e.jsxRuntimeExports.jsxs(x.Dialog,{open:r,onOpenChange:o=>l(o),children:[e.jsxRuntimeExports.jsx(x.DialogTrigger,{asChild:!0,children:t}),e.jsxRuntimeExports.jsx(x.DialogContent,{className:"flex h-3/4 max-w-5xl",children:e.jsxRuntimeExports.jsx("div",{className:"h-full w-full",children:e.jsxRuntimeExports.jsx(j.default,{isModalView:!0,onSelect:a})})})]})},p=k,v=({value:t,onChange:s,id:r,onBlur:l})=>e.jsxRuntimeExports.jsxs("div",{className:"mt-1.5 flex items-center gap-x-3",children:[t?e.jsxRuntimeExports.jsx("img",{src:t,className:"h-20 w-20 overflow-hidden rounded-md border object-cover",alt:""}):e.jsxRuntimeExports.jsx(p,{onSelect:s,children:e.jsxRuntimeExports.jsx("div",{className:"h-20 w-20 cursor-pointer rounded-md border bg-[radial-gradient(#AAA,transparent_1px)] duration-300 [background-size:10px_10px] hover:border-gray-400"})}),e.jsxRuntimeExports.jsxs("div",{className:"flex w-3/5 flex-col",children:[e.jsxRuntimeExports.jsx(p,{onSelect:s,children:e.jsxRuntimeExports.jsx("small",{className:"cursor-pointer rounded-full bg-gray-600 px-2 py-1 text-center text-xs text-white hover:bg-gray-500 dark:bg-gray-700",children:t||!g.isEmpty(t)?"Replace Image":"Choose Image"})}),e.jsxRuntimeExports.jsx("small",{className:"-pl-4 pt-2 text-center text-xs text-gray-600",children:"OR"}),e.jsxRuntimeExports.jsx("input",{type:"url",className:"text-xs",placeholder:"Enter image URL",value:t,onBlur:({target:{value:a}})=>l(r,a),onChange:a=>s(a.target.value)})]})]}),y=({id:t,placeholder:s,value:r,onChange:l,onBlur:a})=>{const o={toolbar:[["bold","italic","underline","strike","blockquote"],[{list:"ordered"},{list:"bullet"}],[{color:[]},{background:[]},{align:[]}],["link","clean"]]},n=["header","font","list","bold","italic","underline","strike","blockquote","color","background","align","link","image"];return typeof window>"u"?null:e.jsxRuntimeExports.jsx(E,{id:t,value:r,onBlur:c=>a(t,c),onChange:c=>l(c),modules:o,formats:n,placeholder:s,className:"mt-1 rounded-md"})},w=({schema:t,formData:s,onChange:r})=>{const[l,a]=d.useState([]),o=R.useBuilderProp("getPages",()=>[]),{type:n="page",href:c="",target:u="self"}=s;return d.useEffect(()=>{(async()=>{const i=await o();a(i||[])})()},[o]),e.jsxRuntimeExports.jsxs("div",{children:[e.jsxRuntimeExports.jsx("span",{className:"text-xs font-medium",children:(t==null?void 0:t.title)??"Link"}),e.jsxRuntimeExports.jsxs("div",{className:"flex flex-col gap-y-1.5",children:[e.jsxRuntimeExports.jsx("select",{name:"type",defaultValue:"page",value:n,onChange:i=>r({...s,type:i.target.value}),children:[{const:"page",title:"Open Page"},{const:"url",title:"Open URL"},{const:"email",title:"Compose Email"},{const:"telephone",title:"Call Phone"},{const:"scroll",title:"Scroll to element"}].map(i=>e.jsxRuntimeExports.jsx("option",{value:i.const,children:i.title},i.const))}),n==="page"?e.jsxRuntimeExports.jsxs("select",{name:"href",defaultValue:"",placeholder:"Choose Page",value:c,onChange:i=>r({...s,href:i.target.value}),children:[e.jsxRuntimeExports.jsx("option",{value:"",children:"Choose page"}),g.map(l,i=>e.jsxRuntimeExports.jsx("option",{value:i.slug,children:i.name},i.uuid))]}):e.jsxRuntimeExports.jsx("input",{name:"href",type:"text",value:c,onChange:i=>r({...s,href:i.target.value}),placeholder:n==="page"||n==="url"?"Enter URL":n==="scroll"?"#ElementID":"Enter detail"}),(n==="page"||n==="url")&&e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-x-2",children:[e.jsxRuntimeExports.jsx("input",{type:"checkbox",defaultChecked:u==="_blank",className:"cursor-pointer rounded-md border border-border",onChange:()=>r({...s,target:u==="_blank"?"_self":"_blank"})}),e.jsxRuntimeExports.jsx("span",{className:"pt-1 text-xs",children:"Open in new tab"})]})]})]})};exports.IconPickerField=b;exports.ImagePickerField=v;exports.LinkField=w;exports.RichTextEditorField=y;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-JYMCiFoE.cjs"),u=require("react"),n=require("@radix-ui/react-icons"),o=require("./popover-fKjgcRUx.cjs"),x=require("./index-X9ZgD09V.cjs");require("@radix-ui/react-popover");require("./utils-qK_SjzzV.cjs");require("clsx");require("tailwind-merge");require("./ChaiBuilderEditor-BoE-sArB.cjs");require("./MODIFIERS-Fx6WAZcw.cjs");require("@radix-ui/react-scroll-area");require("react-dom");require("@floating-ui/react-dom");require("jotai");require("i18next");require("react-i18next");require("flagged");require("react-dnd");require("lodash");require("@minoru/react-dnd-treeview");require("./skeleton-JHP9zwL2.cjs");require("@radix-ui/react-slot");require("class-variance-authority");require("@radix-ui/react-tooltip");require("@radix-ui/react-toast");require("react-hotkeys-hook");require("flat-to-nested");require("./functions-uw7QP2kT.cjs");require("redux-undo");require("@react-hookz/web");require("./index-HAue58ea.cjs");require("sonner");require("./html-to-json-P6GpbcQX.cjs");require("himalaya");require("lucide-react");require("./alert-dialog-Mv0-wAvS.cjs");require("@radix-ui/react-alert-dialog");const m=u.lazy(()=>Promise.resolve().then(()=>require("./single-page-detail-yPgnu2AI.cjs"))),j=({pageData:s})=>{const[r,t]=u.useState("CLOSE");return e.jsxRuntimeExports.jsxs(o.Popover,{open:r==="OPEN"||r==="ALERT"||r==="PENDING",onOpenChange:i=>{t(r==="PENDING"?"ALERT":i?"OPEN":"CLOSE")},children:[e.jsxRuntimeExports.jsx(o.PopoverTrigger,{asChild:!0,onClick:i=>{i.stopPropagation(),t("OPEN")},children:e.jsxRuntimeExports.jsx("div",{className:"flex items-center justify-between",children:r==="OPEN"||r==="ALERT"||r==="PENDING"?e.jsxRuntimeExports.jsx(n.ChevronRightIcon,{}):e.jsxRuntimeExports.jsx("div",{className:"hidden hover:text-blue-600 group-hover:flex",children:e.jsxRuntimeExports.jsx(n.GearIcon,{})})})}),e.jsxRuntimeExports.jsx(o.PopoverContent,{side:"right",align:"start",alignOffset:-35,className:"h-screen w-96",children:e.jsxRuntimeExports.jsx(u.Suspense,{fallback:e.jsxRuntimeExports.jsxs("div",{className:"flex w-full animate-pulse flex-col gap-y-3",children:[e.jsxRuntimeExports.jsx("div",{className:"bg-background-300 h-6 w-1/2"}),e.jsxRuntimeExports.jsx("div",{className:"bg-background-300 h-20 w-full"}),e.jsxRuntimeExports.jsx("div",{className:"bg-background-300 h-20 w-full"})]}),children:e.jsxRuntimeExports.jsx(m,{pageData:s,open:r,setOpen:t})})})]})},p=s=>{const[r]=x.useCurrentPage(),{data:t}=x.useProject(),i=x.useChangePage(),l=(t==null?void 0:t.homepage)===s.uuid,a=r===s.uuid,c=()=>i(s);return t?e.jsxRuntimeExports.jsxs("button",{className:`group relative flex w-full cursor-pointer items-center justify-between px-2.5 py-2 ${a?"bg-blue-200 ":""}`,onClick:c,type:"button",children:[e.jsxRuntimeExports.jsxs("div",{className:"flex text-sm items-center gap-x-1.5",children:[l?e.jsxRuntimeExports.jsx(n.HomeIcon,{}):e.jsxRuntimeExports.jsx(n.FileTextIcon,{})," ",s.name]}),e.jsxRuntimeExports.jsx(j,{pageData:s})]}):null},d=({pages:s,isLoading:r})=>r?e.jsxRuntimeExports.jsxs("div",{className:"flex animate-pulse flex-col gap-y-1 px-2.5 pt-2",children:[e.jsxRuntimeExports.jsx("div",{className:"bg-background-200 h-7 w-full"}),e.jsxRuntimeExports.jsx("div",{className:"bg-background-200 h-7 w-full"}),e.jsxRuntimeExports.jsx("div",{className:"bg-background-200 h-7 w-full"})]}):s.length===0?e.jsxRuntimeExports.jsx("div",{className:"px-2.5 pb-2 pt-4",children:"No pages"}):e.jsxRuntimeExports.jsx("div",{className:"-mb-2",children:u.Children.toArray(s.map(t=>e.jsxRuntimeExports.jsx(p,{...t})))});exports.default=d;
@@ -1,23 +0,0 @@
1
- import { j as t } from "./jsx-runtime-Sp0orL4X.js";
2
- import * as i from "react";
3
- import * as o from "@radix-ui/react-popover";
4
- import { c as n } from "./utils-dze1SGvB.js";
5
- const l = o.Root, c = o.Trigger, m = i.forwardRef(({ className: e, align: a = "center", sideOffset: r = 4, ...s }, d) => /* @__PURE__ */ t.jsx(o.Portal, { children: /* @__PURE__ */ t.jsx(
6
- o.Content,
7
- {
8
- ref: d,
9
- align: a,
10
- sideOffset: r,
11
- className: n(
12
- "z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
13
- e
14
- ),
15
- ...s
16
- }
17
- ) }));
18
- m.displayName = o.Content.displayName;
19
- export {
20
- l as P,
21
- c as a,
22
- m as b
23
- };
@@ -1 +0,0 @@
1
- "use strict";const n=require("./jsx-runtime-JYMCiFoE.cjs"),c=require("react"),p=require("@radix-ui/react-popover"),l=require("./utils-qK_SjzzV.cjs");function i(e){const o=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const a=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(o,t,a.get?a:{enumerable:!0,get:()=>e[t]})}}return o.default=e,Object.freeze(o)}const m=i(c),r=i(p),u=r.Root,f=r.Trigger,s=m.forwardRef(({className:e,align:o="center",sideOffset:t=4,...a},d)=>n.jsxRuntimeExports.jsx(r.Portal,{children:n.jsxRuntimeExports.jsx(r.Content,{ref:d,align:o,sideOffset:t,className:l.cn("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...a})}));s.displayName=r.Content.displayName;exports.Popover=u;exports.PopoverContent=s;exports.PopoverTrigger=f;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const q=require("./jsx-runtime-JYMCiFoE.cjs"),a=require("react"),f=require("./scroll-area-FiHvy-TZ.cjs"),o=require("./controls-W97-POR_.cjs"),d=require("./form-nRAvKPQj.cjs"),m=require("./index-X9ZgD09V.cjs");require("@radix-ui/react-scroll-area");require("./utils-qK_SjzzV.cjs");require("clsx");require("tailwind-merge");require("lodash");require("@rjsf/core");require("@rjsf/validator-ajv8");require("./link-ece8dZGH.cjs");require("react-icons-picker");require("react-dom");require("./dialog-S_QbL1iq.cjs");require("@radix-ui/react-dialog");require("@radix-ui/react-icons");require("./ImagesPanel-6us7hiLN.cjs");require("./tabs-iWeaaVrg.cjs");require("@radix-ui/react-tabs");require("react-quill");require("react-i18next");require("./skeleton-JHP9zwL2.cjs");require("jotai");require("@radix-ui/react-slot");require("class-variance-authority");require("@radix-ui/react-tooltip");require("@radix-ui/react-toast");require("./ChaiBuilderEditor-BoE-sArB.cjs");require("./MODIFIERS-Fx6WAZcw.cjs");require("@floating-ui/react-dom");require("i18next");require("flagged");require("react-dnd");require("@minoru/react-dnd-treeview");require("react-hotkeys-hook");require("flat-to-nested");require("./functions-uw7QP2kT.cjs");require("redux-undo");require("@react-hookz/web");require("./index-HAue58ea.cjs");require("sonner");require("./html-to-json-P6GpbcQX.cjs");require("himalaya");require("lucide-react");require("./alert-dialog-Mv0-wAvS.cjs");require("@radix-ui/react-alert-dialog");function j(r){const i=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const e in r)if(e!=="default"){const u=Object.getOwnPropertyDescriptor(r,e);Object.defineProperty(i,e,u.get?u:{enumerable:!0,get:()=>r[e]})}}return i.default=r,Object.freeze(i)}const g=j(a),b=({_projectData:r,seany:i})=>{const{data:e,isLoading:u}=m.useProject();g.useEffect(()=>{e&&i(e)},[e,i]);const n=({formData:s},t)=>{i(l=>({...l,[t]:s[t]}))},c={name:o.u({title:"Project Name",default:e==null?void 0:e.name}),favicon:o.o({title:"Favicon",default:e==null?void 0:e.favicon})};return q.jsxRuntimeExports.jsx(f.ScrollArea,{className:"flex h-full select-none flex-col",children:q.jsxRuntimeExports.jsx(d.Form,{properties:c,disabled:u,formData:r,onChange:n})})};exports.default=b;
@@ -1,67 +0,0 @@
1
- import { j as p } from "./jsx-runtime-Sp0orL4X.js";
2
- import { b as D, u as c, g, o as x } from "./controls-enQY7NI8.js";
3
- import { F as v } from "./form-dVpOAyRl.js";
4
- import "react";
5
- import "lodash";
6
- import "@rjsf/core";
7
- import "@rjsf/validator-ajv8";
8
- import "./link-6o6n2Tnd.js";
9
- import "react-icons-picker";
10
- import "react-dom";
11
- import "./dialog-jrw9DF1f.js";
12
- import "@radix-ui/react-dialog";
13
- import "@radix-ui/react-icons";
14
- import "./utils-dze1SGvB.js";
15
- import "clsx";
16
- import "tailwind-merge";
17
- import "./ImagesPanel-oaHOD-Ex.js";
18
- import "./tabs-Gb9v5dVb.js";
19
- import "@radix-ui/react-tabs";
20
- import "react-quill";
21
- import "react-i18next";
22
- import "./skeleton-CU_FIbg3.js";
23
- import "jotai";
24
- import "@radix-ui/react-slot";
25
- import "class-variance-authority";
26
- import "@radix-ui/react-tooltip";
27
- import "@radix-ui/react-toast";
28
- const V = ({
29
- _projectData: t,
30
- seany: l
31
- }) => {
32
- var o, e, r, m, a, s;
33
- const n = ({ formData: f }) => {
34
- const i = { ...f };
35
- i.seoData.title === void 0 && (i.seoData.title = ""), i.seoData.description === void 0 && (i.seoData.description = ""), i.seoData.image === void 0 && (i.seoData.image = ""), l((u) => ({
36
- ...u,
37
- ...i
38
- }));
39
- }, d = {
40
- seoData: D({
41
- title: "",
42
- default: {
43
- title: ((o = t.seoData) == null ? void 0 : o.title) || "",
44
- description: ((e = t.seoData) == null ? void 0 : e.description) || "",
45
- image: ((r = t.seoData) == null ? void 0 : r.image) || ""
46
- },
47
- properties: {
48
- title: c({
49
- title: "Default Title",
50
- default: ((m = t.seoData) == null ? void 0 : m.title) || ""
51
- }),
52
- description: g({
53
- title: "Default Description",
54
- default: ((a = t.seoData) == null ? void 0 : a.description) || ""
55
- }),
56
- image: x({
57
- title: "Social Media Image",
58
- default: ((s = t.seoData) == null ? void 0 : s.image) || ""
59
- })
60
- }
61
- })
62
- };
63
- return /* @__PURE__ */ p.jsx("div", { className: "flex h-full select-none flex-col", children: /* @__PURE__ */ p.jsx(v, { properties: d, formData: t, onChange: n }) });
64
- };
65
- export {
66
- V as default
67
- };
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("./jsx-runtime-JYMCiFoE.cjs"),r=require("./controls-W97-POR_.cjs"),g=require("./form-nRAvKPQj.cjs");require("react");require("lodash");require("@rjsf/core");require("@rjsf/validator-ajv8");require("./link-ece8dZGH.cjs");require("react-icons-picker");require("react-dom");require("./dialog-S_QbL1iq.cjs");require("@radix-ui/react-dialog");require("@radix-ui/react-icons");require("./utils-qK_SjzzV.cjs");require("clsx");require("tailwind-merge");require("./ImagesPanel-6us7hiLN.cjs");require("./tabs-iWeaaVrg.cjs");require("@radix-ui/react-tabs");require("react-quill");require("react-i18next");require("./skeleton-JHP9zwL2.cjs");require("jotai");require("@radix-ui/react-slot");require("class-variance-authority");require("@radix-ui/react-tooltip");require("@radix-ui/react-toast");const D=({_projectData:e,seany:q})=>{var t,o,u,s,a,l;const d=({formData:f})=>{const i={...f};i.seoData.title===void 0&&(i.seoData.title=""),i.seoData.description===void 0&&(i.seoData.description=""),i.seoData.image===void 0&&(i.seoData.image=""),q(m=>({...m,...i}))},c={seoData:r.b({title:"",default:{title:((t=e.seoData)==null?void 0:t.title)||"",description:((o=e.seoData)==null?void 0:o.description)||"",image:((u=e.seoData)==null?void 0:u.image)||""},properties:{title:r.u({title:"Default Title",default:((s=e.seoData)==null?void 0:s.title)||""}),description:r.g({title:"Default Description",default:((a=e.seoData)==null?void 0:a.description)||""}),image:r.o({title:"Social Media Image",default:((l=e.seoData)==null?void 0:l.image)||""})}})};return n.jsxRuntimeExports.jsx("div",{className:"flex h-full select-none flex-col",children:n.jsxRuntimeExports.jsx(g.Form,{properties:c,formData:e,onChange:d})})};exports.default=D;
@@ -1 +0,0 @@
1
- "use strict";const s=require("./jsx-runtime-JYMCiFoE.cjs"),d=require("react"),x=require("@radix-ui/react-scroll-area"),c=require("./utils-qK_SjzzV.cjs");function n(e){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const o=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,o.get?o:{enumerable:!0,get:()=>e[t]})}}return r.default=e,Object.freeze(r)}const i=n(d),l=n(x),u=i.forwardRef(({className:e,children:r,...t},o)=>s.jsxRuntimeExports.jsxs(l.Root,{ref:o,className:c.cn("relative overflow-hidden",e),...t,children:[s.jsxRuntimeExports.jsx(l.Viewport,{className:"h-full w-full rounded-[inherit]",children:r}),s.jsxRuntimeExports.jsx(a,{}),s.jsxRuntimeExports.jsx(l.Corner,{})]}));u.displayName=l.Root.displayName;const a=i.forwardRef(({className:e,orientation:r="vertical",...t},o)=>s.jsxRuntimeExports.jsx(l.ScrollAreaScrollbar,{ref:o,orientation:r,className:c.cn("flex touch-none select-none transition-colors",r==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-[1px]",r==="horizontal"&&"h-2.5 border-t border-t-transparent p-[1px]",e),...t,children:s.jsxRuntimeExports.jsx(l.ScrollAreaThumb,{className:"relative flex-1 rounded-full bg-border"})}));a.displayName=l.ScrollAreaScrollbar.displayName;exports.ScrollArea=u;exports.ScrollBar=a;
@@ -1,30 +0,0 @@
1
- import { j as l } from "./jsx-runtime-Sp0orL4X.js";
2
- import * as t from "react";
3
- import * as r from "@radix-ui/react-scroll-area";
4
- import { c } from "./utils-dze1SGvB.js";
5
- const i = t.forwardRef(({ className: a, children: e, ...o }, s) => /* @__PURE__ */ l.jsxs(r.Root, { ref: s, className: c("relative overflow-hidden", a), ...o, children: [
6
- /* @__PURE__ */ l.jsx(r.Viewport, { className: "h-full w-full rounded-[inherit]", children: e }),
7
- /* @__PURE__ */ l.jsx(d, {}),
8
- /* @__PURE__ */ l.jsx(r.Corner, {})
9
- ] }));
10
- i.displayName = r.Root.displayName;
11
- const d = t.forwardRef(({ className: a, orientation: e = "vertical", ...o }, s) => /* @__PURE__ */ l.jsx(
12
- r.ScrollAreaScrollbar,
13
- {
14
- ref: s,
15
- orientation: e,
16
- className: c(
17
- "flex touch-none select-none transition-colors",
18
- e === "vertical" && "h-full w-2.5 border-l border-l-transparent p-[1px]",
19
- e === "horizontal" && "h-2.5 border-t border-t-transparent p-[1px]",
20
- a
21
- ),
22
- ...o,
23
- children: /* @__PURE__ */ l.jsx(r.ScrollAreaThumb, { className: "relative flex-1 rounded-full bg-border" })
24
- }
25
- ));
26
- d.displayName = r.ScrollAreaScrollbar.displayName;
27
- export {
28
- i as S,
29
- d as a
30
- };
@@ -1 +0,0 @@
1
- "use strict";const r=require("./jsx-runtime-JYMCiFoE.cjs"),g=require("react"),l=require("@radix-ui/react-icons"),j=require("@radix-ui/react-select"),n=require("./utils-qK_SjzzV.cjs");function c(a){const s=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(a){for(const t in a)if(t!=="default"){const o=Object.getOwnPropertyDescriptor(a,t);Object.defineProperty(s,t,o.get?o:{enumerable:!0,get:()=>a[t]})}}return s.default=a,Object.freeze(s)}const i=c(g),e=c(j),b=e.Root,h=e.Group,S=e.Value,d=i.forwardRef(({className:a,children:s,...t},o)=>r.jsxRuntimeExports.jsxs(e.Trigger,{ref:o,className:n.cn("flex h-9 w-full items-center justify-between rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50",a),...t,children:[s,r.jsxRuntimeExports.jsx(e.Icon,{asChild:!0,children:r.jsxRuntimeExports.jsx(l.CaretSortIcon,{className:"h-4 w-4 opacity-50"})})]}));d.displayName=e.Trigger.displayName;const m=i.forwardRef(({className:a,children:s,position:t="popper",...o},f)=>r.jsxRuntimeExports.jsx(e.Portal,{children:r.jsxRuntimeExports.jsx(e.Content,{ref:f,className:n.cn("relative z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",a),position:t,...o,children:r.jsxRuntimeExports.jsx(e.Viewport,{className:n.cn("p-1",t==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:s})})}));m.displayName=e.Content.displayName;const p=i.forwardRef(({className:a,...s},t)=>r.jsxRuntimeExports.jsx(e.Label,{ref:t,className:n.cn("px-2 py-1.5 text-sm font-semibold",a),...s}));p.displayName=e.Label.displayName;const u=i.forwardRef(({className:a,children:s,...t},o)=>r.jsxRuntimeExports.jsxs(e.Item,{ref:o,className:n.cn("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",a),...t,children:[r.jsxRuntimeExports.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:r.jsxRuntimeExports.jsx(e.ItemIndicator,{children:r.jsxRuntimeExports.jsx(l.CheckIcon,{className:"h-4 w-4"})})}),r.jsxRuntimeExports.jsx(e.ItemText,{children:s})]}));u.displayName=e.Item.displayName;const x=i.forwardRef(({className:a,...s},t)=>r.jsxRuntimeExports.jsx(e.Separator,{ref:t,className:n.cn("-mx-1 my-1 h-px bg-muted",a),...s}));x.displayName=e.Separator.displayName;exports.Select=b;exports.SelectContent=m;exports.SelectGroup=h;exports.SelectItem=u;exports.SelectLabel=p;exports.SelectSeparator=x;exports.SelectTrigger=d;exports.SelectValue=S;