@budibase/server 2.1.22-alpha.0 → 2.1.22-alpha.1

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 (148) hide show
  1. package/builder/assets/{index.3e17cff2.js → index.7b9fb7e6.js} +2 -2
  2. package/builder/index.html +1 -1
  3. package/coverage/clover.xml +2 -2
  4. package/coverage/lcov-report/api/controllers/apikeys.js.html +1 -1
  5. package/coverage/lcov-report/api/controllers/automation.js.html +1 -1
  6. package/coverage/lcov-report/api/controllers/cloud.js.html +1 -1
  7. package/coverage/lcov-report/api/controllers/datasource.js.html +1 -1
  8. package/coverage/lcov-report/api/controllers/dev.js.html +1 -1
  9. package/coverage/lcov-report/api/controllers/index.html +1 -1
  10. package/coverage/lcov-report/api/controllers/integration.js.html +1 -1
  11. package/coverage/lcov-report/api/controllers/layout.js.html +1 -1
  12. package/coverage/lcov-report/api/controllers/metadata.js.html +1 -1
  13. package/coverage/lcov-report/api/controllers/migrations.js.html +1 -1
  14. package/coverage/lcov-report/api/controllers/permission.js.html +1 -1
  15. package/coverage/lcov-report/api/controllers/query/index.html +1 -1
  16. package/coverage/lcov-report/api/controllers/query/validation.js.html +1 -1
  17. package/coverage/lcov-report/api/controllers/role.js.html +1 -1
  18. package/coverage/lcov-report/api/controllers/routing.js.html +1 -1
  19. package/coverage/lcov-report/api/controllers/row/external.js.html +1 -1
  20. package/coverage/lcov-report/api/controllers/row/index.html +1 -1
  21. package/coverage/lcov-report/api/controllers/row/internal.js.html +1 -1
  22. package/coverage/lcov-report/api/controllers/row/internalSearch.js.html +1 -1
  23. package/coverage/lcov-report/api/controllers/row/staticFormula.js.html +1 -1
  24. package/coverage/lcov-report/api/controllers/row/utils.js.html +1 -1
  25. package/coverage/lcov-report/api/controllers/script.js.html +1 -1
  26. package/coverage/lcov-report/api/controllers/table/bulkFormula.js.html +1 -1
  27. package/coverage/lcov-report/api/controllers/table/external.js.html +1 -1
  28. package/coverage/lcov-report/api/controllers/table/index.html +1 -1
  29. package/coverage/lcov-report/api/controllers/table/index.js.html +1 -1
  30. package/coverage/lcov-report/api/controllers/templates.js.html +1 -1
  31. package/coverage/lcov-report/api/controllers/user.js.html +1 -1
  32. package/coverage/lcov-report/api/controllers/view/exporters.js.html +1 -1
  33. package/coverage/lcov-report/api/controllers/view/index.html +1 -1
  34. package/coverage/lcov-report/api/controllers/view/index.js.html +1 -1
  35. package/coverage/lcov-report/api/controllers/view/utils.js.html +1 -1
  36. package/coverage/lcov-report/api/controllers/view/viewBuilder.js.html +1 -1
  37. package/coverage/lcov-report/api/index.html +1 -1
  38. package/coverage/lcov-report/api/index.js.html +1 -1
  39. package/coverage/lcov-report/api/routes/analytics.js.html +1 -1
  40. package/coverage/lcov-report/api/routes/apikeys.js.html +1 -1
  41. package/coverage/lcov-report/api/routes/automation.js.html +1 -1
  42. package/coverage/lcov-report/api/routes/cloud.js.html +1 -1
  43. package/coverage/lcov-report/api/routes/component.js.html +1 -1
  44. package/coverage/lcov-report/api/routes/datasource.js.html +1 -1
  45. package/coverage/lcov-report/api/routes/deploy.js.html +1 -1
  46. package/coverage/lcov-report/api/routes/dev.js.html +1 -1
  47. package/coverage/lcov-report/api/routes/index.html +1 -1
  48. package/coverage/lcov-report/api/routes/integration.js.html +1 -1
  49. package/coverage/lcov-report/api/routes/layout.js.html +1 -1
  50. package/coverage/lcov-report/api/routes/metadata.js.html +1 -1
  51. package/coverage/lcov-report/api/routes/migrations.js.html +1 -1
  52. package/coverage/lcov-report/api/routes/permission.js.html +1 -1
  53. package/coverage/lcov-report/api/routes/query.js.html +1 -1
  54. package/coverage/lcov-report/api/routes/role.js.html +1 -1
  55. package/coverage/lcov-report/api/routes/routing.js.html +1 -1
  56. package/coverage/lcov-report/api/routes/screen.js.html +1 -1
  57. package/coverage/lcov-report/api/routes/script.js.html +1 -1
  58. package/coverage/lcov-report/api/routes/table.js.html +1 -1
  59. package/coverage/lcov-report/api/routes/templates.js.html +1 -1
  60. package/coverage/lcov-report/api/routes/user.js.html +1 -1
  61. package/coverage/lcov-report/api/routes/utils/index.html +1 -1
  62. package/coverage/lcov-report/api/routes/utils/validators.js.html +1 -1
  63. package/coverage/lcov-report/api/routes/view.js.html +1 -1
  64. package/coverage/lcov-report/automations/actions.js.html +1 -1
  65. package/coverage/lcov-report/automations/automationUtils.js.html +1 -1
  66. package/coverage/lcov-report/automations/bullboard.js.html +1 -1
  67. package/coverage/lcov-report/automations/index.html +1 -1
  68. package/coverage/lcov-report/automations/index.js.html +1 -1
  69. package/coverage/lcov-report/automations/steps/bash.js.html +1 -1
  70. package/coverage/lcov-report/automations/steps/delay.js.html +1 -1
  71. package/coverage/lcov-report/automations/steps/discord.js.html +1 -1
  72. package/coverage/lcov-report/automations/steps/executeQuery.js.html +1 -1
  73. package/coverage/lcov-report/automations/steps/executeScript.js.html +1 -1
  74. package/coverage/lcov-report/automations/steps/filter.js.html +1 -1
  75. package/coverage/lcov-report/automations/steps/index.html +1 -1
  76. package/coverage/lcov-report/automations/steps/integromat.js.html +1 -1
  77. package/coverage/lcov-report/automations/steps/loop.js.html +1 -1
  78. package/coverage/lcov-report/automations/steps/outgoingWebhook.js.html +1 -1
  79. package/coverage/lcov-report/automations/steps/queryRows.js.html +1 -1
  80. package/coverage/lcov-report/automations/steps/sendSmtpEmail.js.html +1 -1
  81. package/coverage/lcov-report/automations/steps/serverLog.js.html +1 -1
  82. package/coverage/lcov-report/automations/steps/slack.js.html +1 -1
  83. package/coverage/lcov-report/automations/steps/updateRow.js.html +1 -1
  84. package/coverage/lcov-report/automations/steps/utils.js.html +1 -1
  85. package/coverage/lcov-report/automations/steps/zapier.js.html +1 -1
  86. package/coverage/lcov-report/automations/triggerInfo/app.js.html +1 -1
  87. package/coverage/lcov-report/automations/triggerInfo/cron.js.html +1 -1
  88. package/coverage/lcov-report/automations/triggerInfo/index.html +1 -1
  89. package/coverage/lcov-report/automations/triggerInfo/index.js.html +1 -1
  90. package/coverage/lcov-report/automations/triggerInfo/rowDeleted.js.html +1 -1
  91. package/coverage/lcov-report/automations/triggerInfo/rowSaved.js.html +1 -1
  92. package/coverage/lcov-report/automations/triggerInfo/rowUpdated.js.html +1 -1
  93. package/coverage/lcov-report/automations/triggerInfo/webhook.js.html +1 -1
  94. package/coverage/lcov-report/automations/triggers.js.html +1 -1
  95. package/coverage/lcov-report/constants/index.html +1 -1
  96. package/coverage/lcov-report/constants/index.js.html +1 -1
  97. package/coverage/lcov-report/constants/layouts.js.html +1 -1
  98. package/coverage/lcov-report/constants/screens.js.html +1 -1
  99. package/coverage/lcov-report/db/inMemoryView.js.html +1 -1
  100. package/coverage/lcov-report/db/index.html +1 -1
  101. package/coverage/lcov-report/db/index.js.html +1 -1
  102. package/coverage/lcov-report/db/linkedRows/LinkController.js.html +1 -1
  103. package/coverage/lcov-report/db/linkedRows/index.html +1 -1
  104. package/coverage/lcov-report/db/linkedRows/index.js.html +1 -1
  105. package/coverage/lcov-report/db/linkedRows/linkUtils.js.html +1 -1
  106. package/coverage/lcov-report/db/newid.js.html +1 -1
  107. package/coverage/lcov-report/db/utils.js.html +1 -1
  108. package/coverage/lcov-report/events/AutomationEmitter.js.html +1 -1
  109. package/coverage/lcov-report/events/index.html +1 -1
  110. package/coverage/lcov-report/events/index.js.html +1 -1
  111. package/coverage/lcov-report/events/utils.js.html +1 -1
  112. package/coverage/lcov-report/index.html +1 -1
  113. package/coverage/lcov-report/integrations/tests/TestConfiguration.js.html +1 -1
  114. package/coverage/lcov-report/integrations/tests/index.html +1 -1
  115. package/coverage/lcov-report/middleware/appInfo.js.html +1 -1
  116. package/coverage/lcov-report/middleware/builder.js.html +1 -1
  117. package/coverage/lcov-report/middleware/currentapp.js.html +1 -1
  118. package/coverage/lcov-report/middleware/index.html +1 -1
  119. package/coverage/lcov-report/middleware/joi-validator.js.html +1 -1
  120. package/coverage/lcov-report/middleware/publicApi.js.html +1 -1
  121. package/coverage/lcov-report/middleware/resourceId.js.html +1 -1
  122. package/coverage/lcov-report/middleware/selfhost.js.html +1 -1
  123. package/coverage/lcov-report/middleware/utils.js.html +1 -1
  124. package/coverage/lcov-report/utilities/budibaseDir.js.html +1 -1
  125. package/coverage/lcov-report/utilities/centralPath.js.html +1 -1
  126. package/coverage/lcov-report/utilities/csvParser.js.html +1 -1
  127. package/coverage/lcov-report/utilities/global.js.html +1 -1
  128. package/coverage/lcov-report/utilities/index.html +1 -1
  129. package/coverage/lcov-report/utilities/index.js.html +1 -1
  130. package/coverage/lcov-report/utilities/plugins.js.html +1 -1
  131. package/coverage/lcov-report/utilities/queue/inMemoryQueue.js.html +1 -1
  132. package/coverage/lcov-report/utilities/queue/index.html +1 -1
  133. package/coverage/lcov-report/utilities/routing/index.html +1 -1
  134. package/coverage/lcov-report/utilities/routing/index.js.html +1 -1
  135. package/coverage/lcov-report/utilities/rowProcessor/index.html +1 -1
  136. package/coverage/lcov-report/utilities/rowProcessor/index.js.html +1 -1
  137. package/coverage/lcov-report/utilities/rowProcessor/utils.js.html +1 -1
  138. package/coverage/lcov-report/utilities/scriptRunner.js.html +1 -1
  139. package/coverage/lcov-report/utilities/security.js.html +1 -1
  140. package/coverage/lcov-report/utilities/statusCodes.js.html +1 -1
  141. package/coverage/lcov-report/utilities/usageQuota/index.html +1 -1
  142. package/coverage/lcov-report/utilities/usageQuota/rows.js.html +1 -1
  143. package/coverage/lcov-report/utilities/usageQuota/usageQuoteReset.js.html +1 -1
  144. package/coverage/lcov-report/utilities/users.js.html +1 -1
  145. package/coverage/lcov-report/utilities/workerRequests.js.html +1 -1
  146. package/dist/package.json +6 -6
  147. package/dist/tsconfig.build.tsbuildinfo +1 -1
  148. package/package.json +7 -7
@@ -870,7 +870,7 @@ Use Save As... to download, then click back to return to this page.`)&&(location
870
870
  This action cannot be undone.`)},m(l,s){C(l,e,s),C(l,t,s),x(t,i),x(t,a),C(l,o,s)},p(l,s){s&1&&r!==(r=l[0].name+"")&&gt(i,r)},d(l){l&&M(e),l&&M(t),l&&M(o)}}}function DWe(n){let e,t,r,i,a,o;e=new ou({props:{$$slots:{control:[EWe],default:[LWe]},$$scope:{ctx:n}}});let l={okText:"Delete Datasource",onOk:n[3],title:"Confirm Deletion",$$slots:{default:[TWe]},$$scope:{ctx:n}};r=new gl({props:l}),n[4](r);let s={datasource:n[0]};return a=new MWe({props:s}),n[5](a),{c(){O(e.$$.fragment),t=q(),O(r.$$.fragment),i=q(),O(a.$$.fragment)},m(u,c){B(e,u,c),C(u,t,c),B(r,u,c),C(u,i,c),B(a,u,c),o=!0},p(u,[c]){const f={};c&1030&&(f.$$scope={dirty:c,ctx:u}),e.$set(f);const h={};c&1025&&(h.$$scope={dirty:c,ctx:u}),r.$set(h);const m={};c&1&&(m.datasource=u[0]),a.$set(m)},i(u){o||(b(e.$$.fragment,u),b(r.$$.fragment,u),b(a.$$.fragment,u),o=!0)},o(u){$(e.$$.fragment,u),$(r.$$.fragment,u),$(a.$$.fragment,u),o=!1},d(u){H(e,u),u&&M(t),n[4](null),H(r,u),u&&M(i),n[5](null),H(a,u)}}}function BWe(n,e,t){let r,i,a,o;Fe(n,ci,m=>t(6,r=m)),Fe(n,Br,m=>t(7,i=m)),Fe(n,Bi,m=>t(8,a=m)),Fe(n,ya,m=>t(9,o=m));let{datasource:l}=e,s,u;async function c(){var m;try{let _=a.selected;if(!_&&o.selected){const A=o.selected;_=(m=a.list.find(S=>A.includes(S._id)))==null?void 0:m._id}const y=i.selected;await Bi.delete(l),$t.success("Datasource deleted");const w=Object.values((l==null?void 0:l.entities)||{});(_===l._id||w&&w.find(A=>A._id===(y==null?void 0:y._id)))&&r("./datasource")}catch{$t.error("Error deleting datasource")}}function f(m){De[m?"unshift":"push"](()=>{s=m,t(1,s)})}function h(m){De[m?"unshift":"push"](()=>{u=m,t(2,u)})}return n.$$set=m=>{"datasource"in m&&t(0,l=m.datasource)},[l,s,u,c,f,h]}class HWe extends Ve{constructor(e){super(),Pe(this,e,BWe,DWe,Ie,{datasource:0})}}function OWe(n){let e;return{c(){e=oe("Delete")},m(t,r){C(t,e,r)},d(t){t&&M(e)}}}function IWe(n){let e;return{c(){e=oe("Duplicate")},m(t,r){C(t,e,r)},d(t){t&&M(e)}}}function PWe(n){let e,t,r,i;return e=new ei({props:{icon:"Delete",$$slots:{default:[OWe]},$$scope:{ctx:n}}}),e.$on("click",function(){kn(n[0].show)&&n[0].show.apply(this,arguments)}),r=new ei({props:{icon:"Duplicate",$$slots:{default:[IWe]},$$scope:{ctx:n}}}),r.$on("click",n[2]),{c(){O(e.$$.fragment),t=q(),O(r.$$.fragment)},m(a,o){B(e,a,o),C(a,t,o),B(r,a,o),i=!0},p(a,o){n=a;const l={};o&256&&(l.$$scope={dirty:o,ctx:n}),e.$set(l);const s={};o&256&&(s.$$scope={dirty:o,ctx:n}),r.$set(s)},i(a){i||(b(e.$$.fragment,a),b(r.$$.fragment,a),i=!0)},o(a){$(e.$$.fragment,a),$(r.$$.fragment,a),i=!1},d(a){H(e,a),a&&M(t),H(r,a)}}}function VWe(n){let e,t,r;return t=new un({props:{size:"S",hoverable:!0,name:"MoreSmallList"}}),{c(){e=X("div"),O(t.$$.fragment),D(e,"slot","control"),D(e,"class","icon svelte-kjkbox")},m(i,a){C(i,e,a),B(t,e,null),r=!0},p:ht,i(i){r||(b(t.$$.fragment,i),r=!0)},o(i){$(t.$$.fragment,i),r=!1},d(i){i&&M(e),H(t)}}}function RWe(n){let e;return{c(){e=oe("Are you sure you wish to delete this query? This action cannot be undone.")},m(t,r){C(t,e,r)},d(t){t&&M(e)}}}function NWe(n){let e,t,r,i;e=new ou({props:{$$slots:{control:[VWe],default:[PWe]},$$scope:{ctx:n}}});let a={okText:"Delete Query",onOk:n[1],title:"Confirm Deletion",$$slots:{default:[RWe]},$$scope:{ctx:n}};return r=new gl({props:a}),n[5](r),{c(){O(e.$$.fragment),t=q(),O(r.$$.fragment)},m(o,l){B(e,o,l),C(o,t,l),B(r,o,l),i=!0},p(o,[l]){const s={};l&257&&(s.$$scope={dirty:l,ctx:o}),e.$set(s);const u={};l&256&&(u.$$scope={dirty:l,ctx:o}),r.$set(u)},i(o){i||(b(e.$$.fragment,o),b(r.$$.fragment,o),i=!0)},o(o){$(e.$$.fragment,o),$(r.$$.fragment,o),i=!1},d(o){H(e,o),o&&M(t),n[5](null),H(r,o)}}}function FWe(n,e,t){let r,i;Fe(n,ci,f=>t(6,r=f)),Fe(n,ya,f=>t(7,i=f));let{query:a}=e,{onClickQuery:o}=e,l;async function s(){try{const h=i.selected===a._id;await ya.delete(a),await Bi.fetch(),h&&(await Bi.select(a.datasourceId),r(`./datasource/${a.datasourceId}`)),$t.success("Query deleted")}catch{$t.error("Error deleting query")}}async function u(){try{const f=await ya.duplicate(a);o(f)}catch{$t.error("Error duplicating query")}}function c(f){De[f?"unshift":"push"](()=>{l=f,t(0,l)})}return n.$$set=f=>{"query"in f&&t(3,a=f.query),"onClickQuery"in f&&t(4,o=f.onClickQuery)},[l,s,u,a,o,c]}class jWe extends Ve{constructor(e){super(),Pe(this,e,FWe,NWe,Ie,{query:3,onClickQuery:4})}}const xWe=n=>({}),HI=n=>({}),UWe=n=>({}),OI=n=>({});function II(n){let e,t,r,i,a;return t=new un({props:{size:"S",name:"ChevronRight"}}),{c(){e=X("div"),O(t.$$.fragment),D(e,"class","icon arrow svelte-1vakwx8"),Te(e,"opened",n[7]),Te(e,"relative",n[3]===0),Te(e,"absolute",n[3]>0)},m(o,l){C(o,e,l),B(t,e,null),r=!0,i||(a=At(e,"click",n[17]),i=!0)},p(o,l){l&128&&Te(e,"opened",o[7]),l&8&&Te(e,"relative",o[3]===0),l&8&&Te(e,"absolute",o[3]>0)},i(o){r||(b(t.$$.fragment,o),r=!0)},o(o){$(t.$$.fragment,o),r=!1},d(o){o&&M(e),H(t),i=!1,a()}}}function qWe(n){let e,t,r;return t=new un({props:{color:n[10],size:"S",name:n[0]}}),{c(){e=X("div"),O(t.$$.fragment),D(e,"class","icon svelte-1vakwx8"),Te(e,"right",n[13])},m(i,a){C(i,e,a),B(t,e,null),r=!0},p(i,a){const o={};a&1024&&(o.color=i[10]),a&1&&(o.name=i[0]),t.$set(o),a&8192&&Te(e,"right",i[13])},i(i){r||(b(t.$$.fragment,i),r=!0)},o(i){$(t.$$.fragment,i),r=!1},d(i){i&&M(e),H(t)}}}function WWe(n){let e,t,r;return{c(){e=X("div"),t=oe(n[9]),D(e,"class","iconText svelte-1vakwx8"),D(e,"style",r=n[10]?`color: ${n[10]};`:"")},m(i,a){C(i,e,a),x(e,t)},p(i,a){a&512&&gt(t,i[9]),a&1024&&r!==(r=i[10]?`color: ${i[10]};`:"")&&D(e,"style",r)},i:ht,o:ht,d(i){i&&M(e)}}}function PI(n){let e,t;const r=n[20].default,i=Xn(r,n,n[19],null);return{c(){e=X("div"),i&&i.c(),D(e,"class","actions svelte-1vakwx8")},m(a,o){C(a,e,o),i&&i.m(e,null),t=!0},p(a,o){i&&i.p&&(!t||o&524288)&&Zn(i,r,a,a[19],t?Jn(r,a[19],o,null):Qn(a[19]),null)},i(a){t||(b(i,a),t=!0)},o(a){$(i,a),t=!1},d(a){a&&M(e),i&&i.d(a)}}}function VI(n){let e,t;const r=n[20].right,i=Xn(r,n,n[19],HI);return{c(){e=X("div"),i&&i.c(),D(e,"class","right svelte-1vakwx8")},m(a,o){C(a,e,o),i&&i.m(e,null),t=!0},p(a,o){i&&i.p&&(!t||o&524288)&&Zn(i,r,a,a[19],t?Jn(r,a[19],o,xWe):Qn(a[19]),HI)},i(a){t||(b(i,a),t=!0)},o(a){$(i,a),t=!1},d(a){a&&M(e),i&&i.d(a)}}}function GWe(n){let e,t,r,i,a,o,l,s,u,c,f,h,m,_,y,w=n[1]&&II(n);const A=n[20].icon,S=Xn(A,n,n[19],OI),T=[WWe,qWe],I=[];function P(U,W){return U[9]?0:U[0]?1:-1}~(a=P(n))&&(o=I[a]=T[a](n));let V=n[2]&&PI(n),j=n[18].right&&VI(n);return{c(){e=X("div"),t=X("div"),w&&w.c(),r=q(),S&&S.c(),i=q(),o&&o.c(),l=q(),s=X("div"),u=oe(n[4]),c=q(),V&&V.c(),f=q(),j&&j.c(),D(s,"class","text svelte-1vakwx8"),D(t,"class","nav-item-content svelte-1vakwx8"),D(e,"class","nav-item svelte-1vakwx8"),D(e,"style",h=`padding-left: calc(${n[3]*14}px)`),D(e,"draggable",n[8]),D(e,"ondragover","return false"),D(e,"ondragenter","return false"),D(e,"id",n[14]),Te(e,"border",n[5]),Te(e,"selected",n[6]),Te(e,"withActions",n[2]),Te(e,"scrollable",n[11]),Te(e,"highlighted",n[12])},m(U,W){C(U,e,W),x(e,t),w&&w.m(t,null),x(t,r),S&&S.m(t,null),x(t,i),~a&&I[a].m(t,null),x(t,l),x(t,s),x(s,u),x(t,c),V&&V.m(t,null),x(t,f),j&&j.m(t,null),n[25](t),m=!0,_||(y=[At(e,"dragend",n[21]),At(e,"dragstart",n[22]),At(e,"dragover",n[23]),At(e,"drop",n[24]),At(e,"click",n[16])],_=!0)},p(U,[W]){U[1]?w?(w.p(U,W),W&2&&b(w,1)):(w=II(U),w.c(),b(w,1),w.m(t,r)):w&&(we(),$(w,1,1,()=>{w=null}),ke()),S&&S.p&&(!m||W&524288)&&Zn(S,A,U,U[19],m?Jn(A,U[19],W,UWe):Qn(U[19]),OI);let te=a;a=P(U),a===te?~a&&I[a].p(U,W):(o&&(we(),$(I[te],1,1,()=>{I[te]=null}),ke()),~a?(o=I[a],o?o.p(U,W):(o=I[a]=T[a](U),o.c()),b(o,1),o.m(t,l)):o=null),(!m||W&16)&&gt(u,U[4]),U[2]?V?(V.p(U,W),W&4&&b(V,1)):(V=PI(U),V.c(),b(V,1),V.m(t,f)):V&&(we(),$(V,1,1,()=>{V=null}),ke()),U[18].right?j?(j.p(U,W),W&262144&&b(j,1)):(j=VI(U),j.c(),b(j,1),j.m(t,null)):j&&(we(),$(j,1,1,()=>{j=null}),ke()),(!m||W&8&&h!==(h=`padding-left: calc(${U[3]*14}px)`))&&D(e,"style",h),(!m||W&256)&&D(e,"draggable",U[8]),(!m||W&16384)&&D(e,"id",U[14]),W&32&&Te(e,"border",U[5]),W&64&&Te(e,"selected",U[6]),W&4&&Te(e,"withActions",U[2]),W&2048&&Te(e,"scrollable",U[11]),W&4096&&Te(e,"highlighted",U[12])},i(U){m||(b(w),b(S,U),b(o),b(V),b(j),m=!0)},o(U){$(w),$(S,U),$(o),$(V),$(j),m=!1},d(U){U&&M(e),w&&w.d(),S&&S.d(U),~a&&I[a].d(),V&&V.d(),j&&j.d(),n[25](null),_=!1,Vi(y)}}}function YWe(n,e,t){let{$$slots:r={},$$scope:i}=e;const a=mp(r);let{icon:o}=e,{withArrow:l=!1}=e,{withActions:s=!0}=e,{indentLevel:u=0}=e,{text:c}=e,{border:f=!0}=e,{selected:h=!1}=e,{opened:m=!1}=e,{draggable:_=!1}=e,{iconText:y}=e,{iconColor:w}=e,{scrollable:A=!1}=e,{highlighted:S=!1}=e,{rightAlignIcon:T=!1}=e,{id:I}=e;const P=A4("scroll"),V=Nn();let j;const U=()=>{te(),V("click")},W=re=>{re.stopPropagation(),V("iconClick")},te=()=>{if(!P||!j)return;const re=j.getBoundingClientRect();P.scrollTo(re)};function Q(re){Hn.call(this,n,re)}function le(re){Hn.call(this,n,re)}function ie(re){Hn.call(this,n,re)}function K(re){Hn.call(this,n,re)}function G(re){De[re?"unshift":"push"](()=>{j=re,t(15,j)})}return n.$$set=re=>{"icon"in re&&t(0,o=re.icon),"withArrow"in re&&t(1,l=re.withArrow),"withActions"in re&&t(2,s=re.withActions),"indentLevel"in re&&t(3,u=re.indentLevel),"text"in re&&t(4,c=re.text),"border"in re&&t(5,f=re.border),"selected"in re&&t(6,h=re.selected),"opened"in re&&t(7,m=re.opened),"draggable"in re&&t(8,_=re.draggable),"iconText"in re&&t(9,y=re.iconText),"iconColor"in re&&t(10,w=re.iconColor),"scrollable"in re&&t(11,A=re.scrollable),"highlighted"in re&&t(12,S=re.highlighted),"rightAlignIcon"in re&&t(13,T=re.rightAlignIcon),"id"in re&&t(14,I=re.id),"$$scope"in re&&t(19,i=re.$$scope)},n.$$.update=()=>{n.$$.dirty&32832&&h&&j&&te()},[o,l,s,u,c,f,h,m,_,y,w,A,S,T,I,j,U,W,a,i,r,Q,le,ie,K,G]}class L5 extends Ve{constructor(e){super(),Pe(this,e,YWe,GWe,Ie,{icon:0,withArrow:1,withActions:2,indentLevel:3,text:4,border:5,selected:6,opened:7,draggable:8,iconText:9,iconColor:10,scrollable:11,highlighted:12,rightAlignIcon:13,id:14})}}function RI(n,e,t){const r=n.slice();return r[22]=e[t],r}function NI(n){let e,t;return e=new ou({props:{$$slots:{control:[ZWe],default:[JWe]},$$scope:{ctx:n}}}),{c(){O(e.$$.fragment)},m(r,i){B(e,r,i),t=!0},p(r,i){const a={};i&33554438&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){t||(b(e.$$.fragment,r),t=!0)},o(r){$(e.$$.fragment,r),t=!1},d(r){H(e,r)}}}function FI(n){let e,t;return e=new ei({props:{icon:"Edit",$$slots:{default:[KWe]},$$scope:{ctx:n}}}),e.$on("click",function(){kn(n[2].show)&&n[2].show.apply(this,arguments)}),{c(){O(e.$$.fragment)},m(r,i){B(e,r,i),t=!0},p(r,i){n=r;const a={};i&33554432&&(a.$$scope={dirty:i,ctx:n}),e.$set(a)},i(r){t||(b(e.$$.fragment,r),t=!0)},o(r){$(e.$$.fragment,r),t=!1},d(r){H(e,r)}}}function KWe(n){let e;return{c(){e=oe("Edit")},m(t,r){C(t,e,r)},d(t){t&&M(e)}}}function XWe(n){let e;return{c(){e=oe("Delete")},m(t,r){C(t,e,r)},d(t){t&&M(e)}}}function JWe(n){let e,t,r,i=!n[1]&&FI(n);return t=new ei({props:{icon:"Delete",$$slots:{default:[XWe]},$$scope:{ctx:n}}}),t.$on("click",n[9]),{c(){i&&i.c(),e=q(),O(t.$$.fragment)},m(a,o){i&&i.m(a,o),C(a,e,o),B(t,a,o),r=!0},p(a,o){a[1]?i&&(we(),$(i,1,1,()=>{i=null}),ke()):i?(i.p(a,o),o&2&&b(i,1)):(i=FI(a),i.c(),b(i,1),i.m(e.parentNode,e));const l={};o&33554432&&(l.$$scope={dirty:o,ctx:a}),t.$set(l)},i(a){r||(b(i),b(t.$$.fragment,a),r=!0)},o(a){$(i),$(t.$$.fragment,a),r=!1},d(a){i&&i.d(a),a&&M(e),H(t,a)}}}function ZWe(n){let e,t,r;return t=new un({props:{s:!0,hoverable:!0,name:"MoreSmallList"}}),{c(){e=X("div"),O(t.$$.fragment),D(e,"slot","control"),D(e,"class","icon svelte-1ogygrq")},m(i,a){C(i,e,a),B(t,e,null),r=!0},p:ht,i(i){r||(b(t.$$.fragment,i),r=!0)},o(i){$(t.$$.fragment,i),r=!1},d(i){i&&M(e),H(t)}}}function QWe(n){let e,t,r;function i(o){n[14](o)}let a={label:"Table Name",thin:!0,error:n[4]};return n[0].name!==void 0&&(a.value=n[0].name),e=new Mn({props:a}),De.push(()=>nt(e,"value",i)),e.$on("input",n[13]),{c(){O(e.$$.fragment)},m(o,l){B(e,o,l),r=!0},p(o,l){const s={};l&16&&(s.error=o[4]),!t&&l&1&&(t=!0,s.value=o[0].name,rt(()=>t=!1)),e.$set(s)},i(o){r||(b(e.$$.fragment,o),r=!0)},o(o){$(e.$$.fragment,o),r=!1},d(o){H(e,o)}}}function eGe(n){let e,t;return e=new gr({props:{title:"Edit Table",confirmText:"Save",onConfirm:n[12],disabled:n[0].name===n[8]||n[4],$$slots:{default:[QWe]},$$scope:{ctx:n}}}),{c(){O(e.$$.fragment)},m(r,i){B(e,r,i),t=!0},p(r,i){const a={};i&17&&(a.disabled=r[0].name===r[8]||r[4]),i&33554449&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){t||(b(e.$$.fragment,r),t=!0)},o(r){$(e.$$.fragment,r),t=!1},d(r){H(e,r)}}}function jI(n){let e,t=n[22]+"",r;return{c(){e=X("div"),r=oe(t),D(e,"class","svelte-1ogygrq")},m(i,a){C(i,e,a),x(e,r)},p(i,a){a&32&&t!==(t=i[22]+"")&&gt(r,t)},d(i){i&&M(e)}}}function tGe(n){let e,t,r,i=n[0].name+"",a,o,l,s,u,c,f,h,m,_,y,w,A=n[5],S=[];for(let P=0;P<A.length;P+=1)S[P]=jI(RI(n,A,P));function T(P){n[16](P)}let I={placeholder:n[0].name,dataCy:"delete-table-confirm"};return n[6]!==void 0&&(I.value=n[6]),_=new Mn({props:I}),De.push(()=>nt(_,"value",T)),{c(){e=X("p"),t=oe(`Are you sure you wish to delete the table
871
871
  `),r=X("b"),a=oe(i),o=oe("?"),l=oe(`
872
872
  The following will also be deleted:`),s=q(),u=X("b"),c=X("div");for(let P=0;P<S.length;P+=1)S[P].c();f=q(),h=X("p"),h.textContent=`This action cannot be undone - to continue please enter the table name below
873
- to confirm.`,m=q(),O(_.$$.fragment),D(c,"class","delete-items svelte-1ogygrq")},m(P,V){C(P,e,V),x(e,t),x(e,r),x(r,a),x(r,o),x(e,l),C(P,s,V),C(P,u,V),x(u,c);for(let j=0;j<S.length;j+=1)S[j].m(c,null);C(P,f,V),C(P,h,V),C(P,m,V),B(_,P,V),w=!0},p(P,V){if((!w||V&1)&&i!==(i=P[0].name+"")&&gt(a,i),V&32){A=P[5];let U;for(U=0;U<A.length;U+=1){const W=RI(P,A,U);S[U]?S[U].p(W,V):(S[U]=jI(W),S[U].c(),S[U].m(c,null))}for(;U<S.length;U+=1)S[U].d(1);S.length=A.length}const j={};V&1&&(j.placeholder=P[0].name),!y&&V&64&&(y=!0,j.value=P[6],rt(()=>y=!1)),_.$set(j)},i(P){w||(b(_.$$.fragment,P),w=!0)},o(P){$(_.$$.fragment,P),w=!1},d(P){P&&M(e),P&&M(s),P&&M(u),Bn(S,P),P&&M(f),P&&M(h),P&&M(m),H(_,P)}}}function nGe(n){let e,t,r,i,a,o=n[7]&&NI(n),l={$$slots:{default:[eGe]},$$scope:{ctx:n}};t=new rr({props:l}),n[15](t);let s={okText:"Delete Table",onOk:n[10],onCancel:n[11],title:"Confirm Deletion",disabled:n[6]!==n[0].name,$$slots:{default:[tGe]},$$scope:{ctx:n}};return i=new gl({props:s}),n[17](i),{c(){o&&o.c(),e=q(),O(t.$$.fragment),r=q(),O(i.$$.fragment)},m(u,c){o&&o.m(u,c),C(u,e,c),B(t,u,c),C(u,r,c),B(i,u,c),a=!0},p(u,[c]){u[7]?o?(o.p(u,c),c&128&&b(o,1)):(o=NI(u),o.c(),b(o,1),o.m(e.parentNode,e)):o&&(we(),$(o,1,1,()=>{o=null}),ke());const f={};c&33554449&&(f.$$scope={dirty:c,ctx:u}),t.$set(f);const h={};c&65&&(h.disabled=u[6]!==u[0].name),c&33554529&&(h.$$scope={dirty:c,ctx:u}),i.$set(h)},i(u){a||(b(o),b(t.$$.fragment,u),b(i.$$.fragment,u),a=!0)},o(u){$(o),$(t.$$.fragment,u),$(i.$$.fragment,u),a=!1},d(u){o&&o.d(u),u&&M(e),n[15](null),H(t,u),u&&M(r),n[17](null),H(i,u)}}}function rGe(n,e,t){let r,i,a,o,l;Fe(n,ci,W=>t(19,a=W)),Fe(n,Br,W=>t(20,o=W)),Fe(n,Xt,W=>t(21,l=W));let{table:s}=e,u,c,f="",h=s.name,m,_,y;function w(){m=l.screens.filter(W=>W.autoTableId===s._id),t(5,_=["All table data"].concat(m.map(W=>`Screen ${W.props._instanceName}`))),c.show()}async function A(){const W=o.selected;try{await Br.delete(s),await Xt.actions.screens.delete(m),await Br.fetch(),s.type==="external"&&await Bi.fetch(),$t.success("Table deleted"),W&&W._id===s._id&&a("./table")}catch{$t.error("Error deleting table")}}function S(){t(6,y="")}async function T(){await Br.save(s),$t.success("Table renamed successfully")}function I(W){const te=W.target.value;t(4,f=h===te?`Table with name ${te} already exists. Please choose another name.`:"")}function P(W){n.$$.not_equal(s.name,W)&&(s.name=W,t(0,s))}function V(W){De[W?"unshift":"push"](()=>{u=W,t(2,u)})}function j(W){y=W,t(6,y)}function U(W){De[W?"unshift":"push"](()=>{c=W,t(3,c)})}return n.$$set=W=>{"table"in W&&t(0,s=W.table)},n.$$.update=()=>{n.$$.dirty&1&&t(1,r=(s==null?void 0:s.type)==="external"),n.$$.dirty&3&&t(7,i=!r||(s==null?void 0:s.created))},[s,r,u,c,f,_,y,i,h,w,A,S,T,I,P,V,j,U]}class iGe extends Ve{constructor(e){super(),Pe(this,e,rGe,nGe,Ie,{table:0})}}function aGe(n){let e;return{c(){e=oe("Edit")},m(t,r){C(t,e,r)},d(t){t&&M(e)}}}function oGe(n){let e;return{c(){e=oe("Delete")},m(t,r){C(t,e,r)},d(t){t&&M(e)}}}function lGe(n){let e,t,r,i;return e=new ei({props:{icon:"Edit",$$slots:{default:[aGe]},$$scope:{ctx:n}}}),e.$on("click",function(){kn(n[1].show)&&n[1].show.apply(this,arguments)}),r=new ei({props:{icon:"Delete",$$slots:{default:[oGe]},$$scope:{ctx:n}}}),r.$on("click",function(){kn(n[2].show)&&n[2].show.apply(this,arguments)}),{c(){O(e.$$.fragment),t=q(),O(r.$$.fragment)},m(a,o){B(e,a,o),C(a,t,o),B(r,a,o),i=!0},p(a,o){n=a;const l={};o&1024&&(l.$$scope={dirty:o,ctx:n}),e.$set(l);const s={};o&1024&&(s.$$scope={dirty:o,ctx:n}),r.$set(s)},i(a){i||(b(e.$$.fragment,a),b(r.$$.fragment,a),i=!0)},o(a){$(e.$$.fragment,a),$(r.$$.fragment,a),i=!1},d(a){H(e,a),a&&M(t),H(r,a)}}}function sGe(n){let e,t,r;return t=new un({props:{s:!0,hoverable:!0,name:"MoreSmallList"}}),{c(){e=X("div"),O(t.$$.fragment),D(e,"slot","control"),D(e,"class","icon open-popover")},m(i,a){C(i,e,a),B(t,e,null),r=!0},p:ht,i(i){r||(b(t.$$.fragment,i),r=!0)},o(i){$(t.$$.fragment,i),r=!1},d(i){i&&M(e),H(t)}}}function uGe(n){let e,t,r;function i(o){n[5](o)}let a={label:"View Name",thin:!0};return n[0].name!==void 0&&(a.value=n[0].name),e=new Mn({props:a}),De.push(()=>nt(e,"value",i)),{c(){O(e.$$.fragment)},m(o,l){B(e,o,l),r=!0},p(o,l){const s={};!t&&l&1&&(t=!0,s.value=o[0].name,rt(()=>t=!1)),e.$set(s)},i(o){r||(b(e.$$.fragment,o),r=!0)},o(o){$(e.$$.fragment,o),r=!1},d(o){H(e,o)}}}function cGe(n){let e,t;return e=new gr({props:{title:"Edit View",onConfirm:n[3],confirmText:"Save",$$slots:{default:[uGe]},$$scope:{ctx:n}}}),{c(){O(e.$$.fragment)},m(r,i){B(e,r,i),t=!0},p(r,i){const a={};i&1025&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){t||(b(e.$$.fragment,r),t=!0)},o(r){$(e.$$.fragment,r),t=!1},d(r){H(e,r)}}}function fGe(n){let e,t,r,i,a,o;e=new ou({props:{$$slots:{control:[sGe],default:[lGe]},$$scope:{ctx:n}}});let l={$$slots:{default:[cGe]},$$scope:{ctx:n}};r=new rr({props:l}),n[6](r);let s={body:`Are you sure you wish to delete the view '${n[0].name}'? Your data will be deleted and this action cannot be undone.`,okText:"Delete View",onOk:n[4],title:"Confirm Deletion"};return a=new gl({props:s}),n[7](a),{c(){O(e.$$.fragment),t=q(),O(r.$$.fragment),i=q(),O(a.$$.fragment)},m(u,c){B(e,u,c),C(u,t,c),B(r,u,c),C(u,i,c),B(a,u,c),o=!0},p(u,[c]){const f={};c&1030&&(f.$$scope={dirty:c,ctx:u}),e.$set(f);const h={};c&1025&&(h.$$scope={dirty:c,ctx:u}),r.$set(h);const m={};c&1&&(m.body=`Are you sure you wish to delete the view '${u[0].name}'? Your data will be deleted and this action cannot be undone.`),a.$set(m)},i(u){o||(b(e.$$.fragment,u),b(r.$$.fragment,u),b(a.$$.fragment,u),o=!0)},o(u){$(e.$$.fragment,u),$(r.$$.fragment,u),$(a.$$.fragment,u),o=!1},d(u){H(e,u),u&&M(t),n[6](null),H(r,u),u&&M(i),n[7](null),H(a,u)}}}function pGe(n,e,t){let r;Fe(n,ci,m=>t(8,r=m));let{view:i}=e,a,o=i.name,l;async function s(){await Nu.save({originalName:o,...i}),$t.success("View renamed successfully")}async function u(){try{const m=i.name,_=i.tableId;await Nu.delete(m),$t.success("View deleted"),r(`./table/${_}`)}catch{$t.error("Error deleting view")}}function c(m){n.$$.not_equal(i.name,m)&&(i.name=m,t(0,i))}function f(m){De[m?"unshift":"push"](()=>{a=m,t(1,a)})}function h(m){De[m?"unshift":"push"](()=>{l=m,t(2,l)})}return n.$$set=m=>{"view"in m&&t(0,i=m.view)},[i,a,l,s,u,c,f,h]}class dGe extends Ve{constructor(e){super(),Pe(this,e,pGe,fGe,Ie,{view:0})}}function xI(n,e,t){const r=n.slice();return r[13]=e[t],r[15]=t,r}function UI(n,e,t){const r=n.slice();return r[16]=e[t],r[15]=t,r}function qI(n){let e,t,r=n[2],i=[];for(let o=0;o<r.length;o+=1)i[o]=YI(xI(n,r,o));const a=o=>$(i[o],1,1,()=>{i[o]=null});return{c(){e=X("div");for(let o=0;o<i.length;o+=1)i[o].c();D(e,"class","hierarchy-items-container")},m(o,l){C(o,e,l);for(let s=0;s<i.length;s+=1)i[s].m(e,null);t=!0},p(o,l){if(l&55){r=o[2];let s;for(s=0;s<r.length;s+=1){const u=xI(o,r,s);i[s]?(i[s].p(u,l),b(i[s],1)):(i[s]=YI(u),i[s].c(),b(i[s],1),i[s].m(e,null))}for(we(),s=r.length;s<i.length;s+=1)a(s);ke()}},i(o){if(!t){for(let l=0;l<r.length;l+=1)b(i[l]);t=!0}},o(o){i=i.filter(Boolean);for(let l=0;l<i.length;l+=1)$(i[l]);t=!1},d(o){o&&M(e),Bn(i,o)}}}function WI(n){let e,t;return e=new iGe({props:{table:n[13]}}),{c(){O(e.$$.fragment)},m(r,i){B(e,r,i),t=!0},p(r,i){const a={};i&4&&(a.table=r[13]),e.$set(a)},i(r){t||(b(e.$$.fragment,r),t=!0)},o(r){$(e.$$.fragment,r),t=!1},d(r){H(e,r)}}}function hGe(n){let e,t,r=n[13]._id!==z4.USERS&&WI(n);return{c(){r&&r.c(),e=yt()},m(i,a){r&&r.m(i,a),C(i,e,a),t=!0},p(i,a){i[13]._id!==z4.USERS?r?(r.p(i,a),a&4&&b(r,1)):(r=WI(i),r.c(),b(r,1),r.m(e.parentNode,e)):r&&(we(),$(r,1,1,()=>{r=null}),ke())},i(i){t||(b(r),t=!0)},o(i){$(r),t=!1},d(i){r&&r.d(i),i&&M(e)}}}function mGe(n){let e,t,r;return e=new dGe({props:{view:{name:n[16],...n[13].views[n[16]]}}}),{c(){O(e.$$.fragment),t=q()},m(i,a){B(e,i,a),C(i,t,a),r=!0},p(i,a){const o={};a&4&&(o.view={name:i[16],...i[13].views[i[16]]}),e.$set(o)},i(i){r||(b(e.$$.fragment,i),r=!0)},o(i){$(e.$$.fragment,i),r=!1},d(i){H(e,i),i&&M(t)}}}function GI(n,e){let t,r,i;function a(){return e[9](e[13],e[16])}return r=new L5({props:{indentLevel:2,icon:"Remove",text:e[16],selected:e[1]===e[16],$$slots:{default:[mGe]},$$scope:{ctx:e}}}),r.$on("click",a),{key:n,first:null,c(){t=yt(),O(r.$$.fragment),this.first=t},m(o,l){C(o,t,l),B(r,o,l),i=!0},p(o,l){e=o;const s={};l&4&&(s.text=e[16]),l&6&&(s.selected=e[1]===e[16]),l&262148&&(s.$$scope={dirty:l,ctx:e}),r.$set(s)},i(o){i||(b(r.$$.fragment,o),i=!0)},o(o){$(r.$$.fragment,o),i=!1},d(o){o&&M(t),H(r,o)}}}function YI(n){var c;let e,t,r=[],i=new Map,a,o;function l(){return n[8](n[13])}e=new L5({props:{indentLevel:1,border:n[15]>0,icon:n[13]._id===z4.USERS?"UserGroup":"Table",text:n[13].name,selected:((c=n[0].selected)==null?void 0:c._id)===n[13]._id,$$slots:{default:[hGe]},$$scope:{ctx:n}}}),e.$on("click",l);let s=[...Object.keys(n[13].views||{})].sort();const u=f=>f[15];for(let f=0;f<s.length;f+=1){let h=UI(n,s,f),m=u(h);i.set(m,r[f]=GI(m,h))}return{c(){O(e.$$.fragment),t=q();for(let f=0;f<r.length;f+=1)r[f].c();a=yt()},m(f,h){B(e,f,h),C(f,t,h);for(let m=0;m<r.length;m+=1)r[m].m(f,h);C(f,a,h),o=!0},p(f,h){var _;n=f;const m={};h&4&&(m.icon=n[13]._id===z4.USERS?"UserGroup":"Table"),h&4&&(m.text=n[13].name),h&5&&(m.selected=((_=n[0].selected)==null?void 0:_._id)===n[13]._id),h&262148&&(m.$$scope={dirty:h,ctx:n}),e.$set(m),h&38&&(s=[...Object.keys(n[13].views||{})].sort(),we(),r=Pl(r,h,u,1,n,s,i,a.parentNode,Mc,GI,a,UI),ke())},i(f){if(!o){b(e.$$.fragment,f);for(let h=0;h<s.length;h+=1)b(r[h]);o=!0}},o(f){$(e.$$.fragment,f);for(let h=0;h<r.length;h+=1)$(r[h]);o=!1},d(f){H(e,f),f&&M(t);for(let h=0;h<r.length;h+=1)r[h].d(f);f&&M(a)}}}function gGe(n){var i;let e,t,r=((i=n[3])==null?void 0:i._id)&&qI(n);return{c(){r&&r.c(),e=yt()},m(a,o){r&&r.m(a,o),C(a,e,o),t=!0},p(a,[o]){var l;(l=a[3])!=null&&l._id?r?(r.p(a,o),o&8&&b(r,1)):(r=qI(a),r.c(),b(r,1),r.m(e.parentNode,e)):r&&(we(),$(r,1,1,()=>{r=null}),ke())},i(a){t||(b(r),t=!0)},o(a){$(r),t=!1},d(a){r&&r.d(a),a&&M(e)}}}function vGe(n,e,t){let r,i,a,o,l,s;Fe(n,ci,w=>t(10,a=w)),Fe(n,Br,w=>t(0,o=w)),Fe(n,Nu,w=>t(7,l=w)),Fe(n,Wd,w=>t(3,s=w));const u=(w,A)=>{var S,T;return((S=w.name)==null?void 0:S.toLowerCase())>((T=A.name)==null?void 0:T.toLowerCase())};let{sourceId:c}=e;function f(w){Br.select(w),a(`./table/${w._id}`)}function h(w){Nu.select(w),a(`./view/${w.name}`)}function m(w,A){r!==A&&h({name:A,...w.views[A]})}const _=w=>f(w),y=(w,A)=>m(w,A);return n.$$set=w=>{"sourceId"in w&&t(6,c=w.sourceId)},n.$$.update=()=>{n.$$.dirty&128&&t(1,r=l.selected&&l.selected.name),n.$$.dirty&65&&t(2,i=o.list.filter(w=>w.sourceId===c).sort(u))},[o,r,i,s,f,m,c,l,_,y]}class _Ge extends Ve{constructor(e){super(),Pe(this,e,vGe,gGe,Ie,{sourceId:6})}}function KI(n,e,t){const r=n.slice();return r[18]=e[t],r[20]=t,r}function XI(n,e,t){const r=n.slice();return r[21]=e[t],r}function JI(n){let e,t,r=n[0],i=[];for(let o=0;o<r.length;o+=1)i[o]=tP(KI(n,r,o));const a=o=>$(i[o],1,1,()=>{i[o]=null});return{c(){e=X("div");for(let o=0;o<i.length;o+=1)i[o].c();D(e,"class","hierarchy-items-container")},m(o,l){C(o,e,l);for(let s=0;s<i.length;s+=1)i[s].m(e,null);t=!0},p(o,l){if(l&61){r=o[0];let s;for(s=0;s<r.length;s+=1){const u=KI(o,r,s);i[s]?(i[s].p(u,l),b(i[s],1)):(i[s]=tP(u),i[s].c(),b(i[s],1),i[s].m(e,null))}for(we(),s=r.length;s<i.length;s+=1)a(s);ke()}},i(o){if(!t){for(let l=0;l<r.length;l+=1)b(i[l]);t=!0}},o(o){i=i.filter(Boolean);for(let l=0;l<i.length;l+=1)$(i[l]);t=!1},d(o){o&&M(e),Bn(i,o)}}}function ZI(n){let e,t;return e=new HWe({props:{datasource:n[18]}}),{c(){O(e.$$.fragment)},m(r,i){B(e,r,i),t=!0},p(r,i){const a={};i&1&&(a.datasource=r[18]),e.$set(a)},i(r){t||(b(e.$$.fragment,r),t=!0)},o(r){$(e.$$.fragment,r),t=!1},d(r){H(e,r)}}}function bGe(n){let e,t,r=n[18]._id!==iw&&ZI(n);return{c(){r&&r.c(),e=yt()},m(i,a){r&&r.m(i,a),C(i,e,a),t=!0},p(i,a){i[18]._id!==iw?r?(r.p(i,a),a&1&&b(r,1)):(r=ZI(i),r.c(),b(r,1),r.m(e.parentNode,e)):r&&(we(),$(r,1,1,()=>{r=null}),ke())},i(i){t||(b(r),t=!0)},o(i){$(r),t=!1},d(i){r&&r.d(i),i&&M(e)}}}function yGe(n){let e,t,r;return t=new kJ({props:{integrationType:n[18].source,schema:n[18].schema,size:"18"}}),{c(){e=X("div"),O(t.$$.fragment),D(e,"class","datasource-icon svelte-11am1jd"),D(e,"slot","icon")},m(i,a){C(i,e,a),B(t,e,null),r=!0},p(i,a){const o={};a&1&&(o.integrationType=i[18].source),a&1&&(o.schema=i[18].schema),t.$set(o)},i(i){r||(b(t.$$.fragment,i),r=!0)},o(i){$(t.$$.fragment,i),r=!1},d(i){i&&M(e),H(t)}}}function QI(n){let e,t,r,i;e=new _Ge({props:{sourceId:n[18]._id}});function a(...u){return n[11](n[18],...u)}let o=n[2].list.filter(a),l=[];for(let u=0;u<o.length;u+=1)l[u]=eP(XI(n,o,u));const s=u=>$(l[u],1,1,()=>{l[u]=null});return{c(){O(e.$$.fragment),t=q();for(let u=0;u<l.length;u+=1)l[u].c();r=yt()},m(u,c){B(e,u,c),C(u,t,c);for(let f=0;f<l.length;f+=1)l[f].m(u,c);C(u,r,c),i=!0},p(u,c){n=u;const f={};if(c&1&&(f.sourceId=n[18]._id),e.$set(f),c&21){o=n[2].list.filter(a);let h;for(h=0;h<o.length;h+=1){const m=XI(n,o,h);l[h]?(l[h].p(m,c),b(l[h],1)):(l[h]=eP(m),l[h].c(),b(l[h],1),l[h].m(r.parentNode,r))}for(we(),h=o.length;h<l.length;h+=1)s(h);ke()}},i(u){if(!i){b(e.$$.fragment,u);for(let c=0;c<o.length;c+=1)b(l[c]);i=!0}},o(u){$(e.$$.fragment,u),l=l.filter(Boolean);for(let c=0;c<l.length;c+=1)$(l[c]);i=!1},d(u){H(e,u),u&&M(t),Bn(l,u),u&&M(r)}}}function $Ge(n){let e,t,r;return e=new jWe({props:{query:n[21],onClickQuery:n[4]}}),{c(){O(e.$$.fragment),t=q()},m(i,a){B(e,i,a),C(i,t,a),r=!0},p(i,a){const o={};a&5&&(o.query=i[21]),e.$set(o)},i(i){r||(b(e.$$.fragment,i),r=!0)},o(i){$(e.$$.fragment,i),r=!1},d(i){H(e,i),i&&M(t)}}}function eP(n){let e,t;function r(){return n[12](n[21])}return e=new L5({props:{indentLevel:1,icon:"SQLQuery",iconText:fH(n[18],n[21]),iconColor:pH(n[18],n[21]),text:dH(n[18],n[21]),opened:n[2].selected===n[21]._id,selected:n[2].selected===n[21]._id,$$slots:{default:[$Ge]},$$scope:{ctx:n}}}),e.$on("click",r),{c(){O(e.$$.fragment)},m(i,a){B(e,i,a),t=!0},p(i,a){n=i;const o={};a&5&&(o.iconText=fH(n[18],n[21])),a&5&&(o.iconColor=pH(n[18],n[21])),a&5&&(o.text=dH(n[18],n[21])),a&5&&(o.opened=n[2].selected===n[21]._id),a&5&&(o.selected=n[2].selected===n[21]._id),a&16777221&&(o.$$scope={dirty:a,ctx:n}),e.$set(o)},i(i){t||(b(e.$$.fragment,i),t=!0)},o(i){$(e.$$.fragment,i),t=!1},d(i){H(e,i)}}}function tP(n){let e,t,r,i;function a(){return n[9](n[18])}function o(){return n[10](n[18])}e=new L5({props:{border:n[20]>0,text:n[18].name,opened:n[18].open,selected:n[18].selected,withArrow:!0,$$slots:{icon:[yGe],default:[bGe]},$$scope:{ctx:n}}}),e.$on("click",a),e.$on("iconClick",o);let l=n[18].open&&QI(n);return{c(){O(e.$$.fragment),t=q(),l&&l.c(),r=yt()},m(s,u){B(e,s,u),C(s,t,u),l&&l.m(s,u),C(s,r,u),i=!0},p(s,u){n=s;const c={};u&1&&(c.text=n[18].name),u&1&&(c.opened=n[18].open),u&1&&(c.selected=n[18].selected),u&16777217&&(c.$$scope={dirty:u,ctx:n}),e.$set(c),n[18].open?l?(l.p(n,u),u&1&&b(l,1)):(l=QI(n),l.c(),b(l,1),l.m(r.parentNode,r)):l&&(we(),$(l,1,1,()=>{l=null}),ke())},i(s){i||(b(e.$$.fragment,s),b(l),i=!0)},o(s){$(e.$$.fragment,s),$(l),i=!1},d(s){H(e,s),s&&M(t),l&&l.d(s),s&&M(r)}}}function wGe(n){var i;let e,t,r=((i=n[1])==null?void 0:i._id)&&JI(n);return{c(){r&&r.c(),e=yt()},m(a,o){r&&r.m(a,o),C(a,e,o),t=!0},p(a,[o]){var l;(l=a[1])!=null&&l._id?r?(r.p(a,o),o&2&&b(r,1)):(r=JI(a),r.c(),b(r,1),r.m(e.parentNode,e)):r&&(we(),$(r,1,1,()=>{r=null}),ke())},i(a){t||(b(r),t=!0)},o(a){$(r),t=!1},d(a){r&&r.d(a),a&&M(e)}}}function kGe(n,e,t){let r,i,a,o,l,s,u;Fe(n,Cc,P=>t(13,a=P)),Fe(n,ci,P=>t(14,o=P)),Fe(n,Bi,P=>t(8,l=P)),Fe(n,Wd,P=>t(1,s=P)),Fe(n,ya,P=>t(2,u=P));let c=[];function f(P){_(P),Bi.select(P._id),o(`./datasource/${P._id}`)}function h(P){ya.select(P),o(`./datasource/${P.datasourceId}/${P._id}`)}function m(P){t(6,c=c.filter(V=>P._id!==V))}function _(P){c.includes(P._id)||t(6,c=[...c,P._id])}function y(P){c.includes(P._id)?m(P):_(P)}ar(async()=>{try{await Bi.fetch(),await ya.fetch()}catch{$t.error("Error fetching datasources and queries")}});const w=P=>{var W,te;if(a.selectedDatasource===P._id)return!0;if(!P.entities)return!1;let V=P.entities;if(Array.isArray(V)||(V=Object.values(V)),a.selectedTable){const Q=(W=pn(Br).selected)==null?void 0:W._id;return V.find(le=>le._id===Q)!=null}const j=(te=pn(Nu).selected)==null?void 0:te.name;return V.find(Q=>{var le;return((le=Q.views)==null?void 0:le[j])!=null})!=null},A=P=>f(P),S=P=>y(P),T=(P,V)=>V.datasourceId===P._id,I=P=>h(P);return n.$$.update=()=>{n.$$.dirty&320&&t(0,r=Array.isArray(l.list)?l.list.map(P=>{const V=l.selected===P._id,j=c.includes(P._id),U=w(P),W=l.list.length===1;return{...P,selected:V,open:V||j||U||W}}):[]),n.$$.dirty&1&&t(7,i=r.find(P=>P.open)),n.$$.dirty&128&&i&&_(i)},[r,s,u,f,h,y,c,i,l,A,S,T,I]}class zGe extends Ve{constructor(e){super(),Pe(this,e,kGe,wGe,Ie,{})}}function AGe(n){let e,t,r,i,a;e=new zGe({});function o(s){n[5](s)}let l={};return n[0]!==void 0&&(l.modal=n[0]),r=new AJ({props:l}),De.push(()=>nt(r,"modal",o)),{c(){O(e.$$.fragment),t=q(),O(r.$$.fragment)},m(s,u){B(e,s,u),C(s,t,u),B(r,s,u),a=!0},p(s,u){const c={};!i&&u&1&&(i=!0,c.modal=s[0],rt(()=>i=!1)),r.$set(c)},i(s){a||(b(e.$$.fragment,s),b(r.$$.fragment,s),a=!0)},o(s){$(e.$$.fragment,s),$(r.$$.fragment,s),a=!1},d(s){H(e,s),s&&M(t),H(r,s)}}}function MGe(n){let e,t;return e=new B1({props:{title:"Sources",$$slots:{default:[AGe]},$$scope:{ctx:n}}}),{c(){O(e.$$.fragment)},m(r,i){B(e,r,i),t=!0},p(r,i){const a={};i&65&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){t||(b(e.$$.fragment,r),t=!0)},o(r){$(e.$$.fragment,r),t=!1},d(r){H(e,r)}}}function nP(n){let e,t;return e=new un({props:{hoverable:!0,name:"AddCircle"}}),e.$on("click",function(){kn(n[0].show)&&n[0].show.apply(this,arguments)}),{c(){O(e.$$.fragment)},m(r,i){B(e,r,i),t=!0},p(r,i){n=r},i(r){t||(b(e.$$.fragment,r),t=!0)},o(r){$(e.$$.fragment,r),t=!1},d(r){H(e,r)}}}function CGe(n){let e,t,r,i,a,o,l,s,u;r=new X2({props:{selected:SGe,$$slots:{default:[MGe]},$$scope:{ctx:n}}}),r.$on("select",n[2]);let c=n[0]&&nP(n);const f=n[4].default,h=Xn(f,n,n[6],null);return{c(){e=X("div"),t=X("div"),O(r.$$.fragment),i=q(),a=X("div"),c&&c.c(),l=q(),s=X("div"),h&&h.c(),D(a,"class","add-button svelte-1oe3r6d"),D(a,"data-cy",o=`new-${n[1]?"datasource":"table"}`),D(t,"class","nav svelte-1oe3r6d"),D(s,"class","content svelte-1oe3r6d"),D(e,"class","root svelte-1oe3r6d")},m(m,_){C(m,e,_),x(e,t),B(r,t,null),x(t,i),x(t,a),c&&c.m(a,null),x(e,l),x(e,s),h&&h.m(s,null),u=!0},p(m,[_]){const y={};_&65&&(y.$$scope={dirty:_,ctx:m}),r.$set(y),m[0]?c?(c.p(m,_),_&1&&b(c,1)):(c=nP(m),c.c(),b(c,1),c.m(a,null)):c&&(we(),$(c,1,1,()=>{c=null}),ke()),(!u||_&2&&o!==(o=`new-${m[1]?"datasource":"table"}`))&&D(a,"data-cy",o),h&&h.p&&(!u||_&64)&&Zn(h,f,m,m[6],u?Jn(f,m[6],_,null):Qn(m[6]),null)},i(m){u||(b(r.$$.fragment,m),b(c),b(h,m),u=!0)},o(m){$(r.$$.fragment,m),$(c),$(h,m),u=!1},d(m){m&&M(e),H(r),c&&c.d(),h&&h.d(m)}}}let SGe="Sources";function LGe(n,e,t){let r,i,a;Fe(n,ca,f=>t(7,i=f)),Fe(n,Cc,f=>t(3,a=f));let{$$slots:o={},$$scope:l}=e,s;function u(){i("./table")}function c(f){s=f,t(0,s)}return n.$$set=f=>{"$$scope"in f&&t(6,l=f.$$scope)},n.$$.update=()=>{n.$$.dirty&8&&t(1,r=a.selectedDatasource&&a.selectedDatasource!==iw)},[s,r,u,a,o,c,l]}class EGe extends Ve{constructor(e){super(),Pe(this,e,LGe,CGe,Ie,{})}}function TGe(n,e,t){let r;return Fe(n,ca,i=>t(0,r=i)),r("../screens"),[]}class DGe extends Ve{constructor(e){super(),Pe(this,e,TGe,null,Ie,{})}}class BGe extends Ve{constructor(e){super(),Pe(this,e,null,null,Ie,{})}}function rP(n){let e,t;return e=new un({props:{name:"ArrowLeft",hoverable:!0}}),e.$on("click",function(){kn(n[7])&&n[7].apply(this,arguments)}),{c(){O(e.$$.fragment)},m(r,i){B(e,r,i),t=!0},p(r,i){n=r},i(r){t||(b(e.$$.fragment,r),t=!0)},o(r){$(e.$$.fragment,r),t=!1},d(r){H(e,r)}}}function iP(n){let e,t;return e=new un({props:{name:n[1]}}),{c(){O(e.$$.fragment)},m(r,i){B(e,r,i),t=!0},p(r,i){const a={};i&2&&(a.name=r[1]),e.$set(a)},i(r){t||(b(e.$$.fragment,r),t=!0)},o(r){$(e.$$.fragment,r),t=!1},d(r){H(e,r)}}}function HGe(n){let e=(n[0]||"")+"",t;return{c(){t=oe(e)},m(r,i){C(r,t,i)},p(r,i){i&1&&e!==(e=(r[0]||"")+"")&&gt(t,e)},d(r){r&&M(t)}}}function aP(n){let e,t;return e=new un({props:{name:n[11]?"Minimize":"Maximize",hoverable:!0}}),e.$on("click",n[13]),{c(){O(e.$$.fragment)},m(r,i){B(e,r,i),t=!0},p(r,i){const a={};i&2048&&(a.name=r[11]?"Minimize":"Maximize"),e.$set(a)},i(r){t||(b(e.$$.fragment,r),t=!0)},o(r){$(e.$$.fragment,r),t=!1},d(r){H(e,r)}}}function oP(n){let e,t,r,i,a;return t=new un({props:{name:"Add"}}),{c(){e=X("div"),O(t.$$.fragment),D(e,"class","add-button svelte-1bxbycf")},m(o,l){C(o,e,l),B(t,e,null),r=!0,i||(a=At(e,"click",function(){kn(n[6])&&n[6].apply(this,arguments)}),i=!0)},p(o,l){n=o},i(o){r||(b(t.$$.fragment,o),r=!0)},o(o){$(t.$$.fragment,o),r=!1},d(o){o&&M(e),H(t),i=!1,a()}}}function lP(n){let e,t;return e=new un({props:{name:"Close",hoverable:!0}}),e.$on("click",function(){kn(n[8])&&n[8].apply(this,arguments)}),{c(){O(e.$$.fragment)},m(r,i){B(e,r,i),t=!0},p(r,i){n=r},i(r){t||(b(e.$$.fragment,r),t=!0)},o(r){$(e.$$.fragment,r),t=!1},d(r){H(e,r)}}}function OGe(n){let e,t,r,i,a,o,l,s,u,c,f,h,m=n[4]&&rP(n),_=n[1]&&iP(n);o=new In({props:{size:"XXS",$$slots:{default:[HGe]},$$scope:{ctx:n}}});let y=n[2]&&aP(n),w=n[3]&&oP(n),A=n[5]&&lP(n);const S=n[12].default,T=Xn(S,n,n[14],null);return{c(){e=X("div"),t=X("div"),m&&m.c(),r=q(),_&&_.c(),i=q(),a=X("div"),O(o.$$.fragment),l=q(),y&&y.c(),s=q(),w&&w.c(),u=q(),A&&A.c(),c=q(),f=X("div"),T&&T.c(),D(a,"class","title svelte-1bxbycf"),D(t,"class","header svelte-1bxbycf"),D(f,"class","body svelte-1bxbycf"),D(e,"class","panel svelte-1bxbycf"),Te(e,"wide",n[11]),Te(e,"borderLeft",n[9]),Te(e,"borderRight",n[10])},m(I,P){C(I,e,P),x(e,t),m&&m.m(t,null),x(t,r),_&&_.m(t,null),x(t,i),x(t,a),B(o,a,null),x(t,l),y&&y.m(t,null),x(t,s),w&&w.m(t,null),x(t,u),A&&A.m(t,null),x(e,c),x(e,f),T&&T.m(f,null),h=!0},p(I,[P]){I[4]?m?(m.p(I,P),P&16&&b(m,1)):(m=rP(I),m.c(),b(m,1),m.m(t,r)):m&&(we(),$(m,1,1,()=>{m=null}),ke()),I[1]?_?(_.p(I,P),P&2&&b(_,1)):(_=iP(I),_.c(),b(_,1),_.m(t,i)):_&&(we(),$(_,1,1,()=>{_=null}),ke());const V={};P&16385&&(V.$$scope={dirty:P,ctx:I}),o.$set(V),I[2]?y?(y.p(I,P),P&4&&b(y,1)):(y=aP(I),y.c(),b(y,1),y.m(t,s)):y&&(we(),$(y,1,1,()=>{y=null}),ke()),I[3]?w?(w.p(I,P),P&8&&b(w,1)):(w=oP(I),w.c(),b(w,1),w.m(t,u)):w&&(we(),$(w,1,1,()=>{w=null}),ke()),I[5]?A?(A.p(I,P),P&32&&b(A,1)):(A=lP(I),A.c(),b(A,1),A.m(t,null)):A&&(we(),$(A,1,1,()=>{A=null}),ke()),T&&T.p&&(!h||P&16384)&&Zn(T,S,I,I[14],h?Jn(S,I[14],P,null):Qn(I[14]),null),P&2048&&Te(e,"wide",I[11]),P&512&&Te(e,"borderLeft",I[9]),P&1024&&Te(e,"borderRight",I[10])},i(I){h||(b(m),b(_),b(o.$$.fragment,I),b(y),b(w),b(A),b(T,I),h=!0)},o(I){$(m),$(_),$(o.$$.fragment,I),$(y),$(w),$(A),$(T,I),h=!1},d(I){I&&M(e),m&&m.d(),_&&_.d(),H(o),y&&y.d(),w&&w.d(),A&&A.d(),T&&T.d(I)}}}function IGe(n,e,t){let{$$slots:r={},$$scope:i}=e,{title:a}=e,{icon:o}=e,{expandable:l=!1}=e,{showAddButton:s=!1}=e,{showBackButton:u=!1}=e,{showCloseButton:c=!1}=e,{onClickAddButton:f}=e,{onClickBackButton:h}=e,{onClickCloseButton:m}=e,{borderLeft:_=!1}=e,{borderRight:y=!1}=e,w=!1;const A=()=>t(11,w=!w);return n.$$set=S=>{"title"in S&&t(0,a=S.title),"icon"in S&&t(1,o=S.icon),"expandable"in S&&t(2,l=S.expandable),"showAddButton"in S&&t(3,s=S.showAddButton),"showBackButton"in S&&t(4,u=S.showBackButton),"showCloseButton"in S&&t(5,c=S.showCloseButton),"onClickAddButton"in S&&t(6,f=S.onClickAddButton),"onClickBackButton"in S&&t(7,h=S.onClickBackButton),"onClickCloseButton"in S&&t(8,m=S.onClickCloseButton),"borderLeft"in S&&t(9,_=S.borderLeft),"borderRight"in S&&t(10,y=S.borderRight),"$$scope"in S&&t(14,i=S.$$scope)},[a,o,l,s,u,c,f,h,m,_,y,w,r,A,i]}class G3 extends Ve{constructor(e){super(),Pe(this,e,IGe,OGe,Ie,{title:0,icon:1,expandable:2,showAddButton:3,showBackButton:4,showCloseButton:5,onClickAddButton:6,onClickBackButton:7,onClickCloseButton:8,borderLeft:9,borderRight:10})}}const PGe=[{name:"Blocks",icon:"Article",children:["tableblock","cardsblock","repeaterblock","formblock","chartblock"]},{name:"Layout",icon:"ClassicGridView",children:["container","section","grid"]},{name:"Data",icon:"Data",children:["dataprovider","repeater","table","dynamicfilter","daterangepicker"]},{name:"Basic",icon:"TextParagraph",children:["heading","text","button","tag","spectrumcard","cardstat","divider","image","link","icon","embed","markdownviewer","backgroundimage","embeddedmap"]},{name:"Form",icon:"Form",children:["form","formstep","fieldgroup","stringfield","numberfield","passwordfield","optionsfield","booleanfield","longformfield","attachmentfield","jsonfield","relationshipfield","datetimefield","multifieldselect","s3upload","codescanner"]},{name:"Chart",icon:"GraphBarVertical",children:["bar","line","area","candlestick","pie","donut"]}];function sP(n,e,t){const r=n.slice();return r[38]=e[t],r}function uP(n,e,t){const r=n.slice();return r[32]=e[t],r}function cP(n,e,t){const r=n.slice();return r[35]=e[t],r}function fP(n){let e,t;return e=new $7({props:{compact:!0,justified:!0,$$slots:{default:[NGe]},$$scope:{ctx:n}}}),{c(){O(e.$$.fragment)},m(r,i){B(e,r,i),t=!0},p(r,i){const a={};i[0]&2|i[1]&1024&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){t||(b(e.$$.fragment,r),t=!0)},o(r){$(e.$$.fragment,r),t=!1},d(r){H(e,r)}}}function VGe(n){let e;return{c(){e=oe("Components")},m(t,r){C(t,e,r)},d(t){t&&M(e)}}}function RGe(n){let e;return{c(){e=oe("Blocks")},m(t,r){C(t,e,r)},d(t){t&&M(e)}}}function NGe(n){let e,t,r,i;return e=new Sr({props:{fullWidth:!0,selected:n[1]==="components",$$slots:{default:[VGe]},$$scope:{ctx:n}}}),e.$on("click",n[19]),r=new Sr({props:{fullWidth:!0,selected:n[1]==="blocks",$$slots:{default:[RGe]},$$scope:{ctx:n}}}),r.$on("click",n[20]),{c(){O(e.$$.fragment),t=q(),O(r.$$.fragment)},m(a,o){B(e,a,o),C(a,t,o),B(r,a,o),i=!0},p(a,o){const l={};o[0]&2&&(l.selected=a[1]==="components"),o[1]&1024&&(l.$$scope={dirty:o,ctx:a}),e.$set(l);const s={};o[0]&2&&(s.selected=a[1]==="blocks"),o[1]&1024&&(s.$$scope={dirty:o,ctx:a}),r.$set(s)},i(a){i||(b(e.$$.fragment,a),b(r.$$.fragment,a),i=!0)},o(a){$(e.$$.fragment,a),$(r.$$.fragment,a),i=!1},d(a){H(e,a),a&&M(t),H(r,a)}}}function FGe(n){let e,t,r,i;return e=new jt({props:{size:"S",$$slots:{default:[xGe]},$$scope:{ctx:n}}}),r=new Pt({props:{noPadding:!0,gap:"XS",$$slots:{default:[qGe]},$$scope:{ctx:n}}}),{c(){O(e.$$.fragment),t=q(),O(r.$$.fragment)},m(a,o){B(e,a,o),C(a,t,o),B(r,a,o),i=!0},p(a,o){const l={};o[1]&1024&&(l.$$scope={dirty:o,ctx:a}),e.$set(l);const s={};o[0]&32|o[1]&1024&&(s.$$scope={dirty:o,ctx:a}),r.$set(s)},i(a){i||(b(e.$$.fragment,a),b(r.$$.fragment,a),i=!0)},o(a){$(e.$$.fragment,a),$(r.$$.fragment,a),i=!1},d(a){H(e,a),a&&M(t),H(r,a)}}}function jGe(n){let e,t,r,i;const a=[GGe,WGe],o=[];function l(s,u){return s[6].length?0:1}return e=l(n),t=o[e]=a[e](n),{c(){t.c(),r=yt()},m(s,u){o[e].m(s,u),C(s,r,u),i=!0},p(s,u){let c=e;e=l(s),e===c?o[e].p(s,u):(we(),$(o[c],1,1,()=>{o[c]=null}),ke(),t=o[e],t?t.p(s,u):(t=o[e]=a[e](s),t.c()),b(t,1),t.m(r.parentNode,r))},i(s){i||(b(t),i=!0)},o(s){$(t),i=!1},d(s){o[e].d(s),s&&M(r)}}}function xGe(n){let e;return{c(){e=oe("Blocks are collections of pre-built components")},m(t,r){C(t,e,r)},d(t){t&&M(e)}}}function UGe(n){let e=n[38].name+"",t;return{c(){t=oe(e)},m(r,i){C(r,t,i)},p(r,i){i[0]&32&&e!==(e=r[38].name+"")&&gt(t,e)},d(r){r&&M(t)}}}function pP(n){let e,t,r,i,a,o,l,s;t=new un({props:{name:n[38].icon}}),i=new jt({props:{size:"XS",$$slots:{default:[UGe]},$$scope:{ctx:n}}});function u(){return n[24](n[38])}function c(){return n[25](n[38])}return{c(){e=X("div"),O(t.$$.fragment),r=q(),O(i.$$.fragment),a=q(),D(e,"draggable","true"),D(e,"class","component svelte-63iy97")},m(f,h){C(f,e,h),B(t,e,null),x(e,r),B(i,e,null),x(e,a),o=!0,l||(s=[At(e,"click",u),At(e,"dragstart",c),At(e,"dragend",n[10])],l=!0)},p(f,h){n=f;const m={};h[0]&32&&(m.name=n[38].icon),t.$set(m);const _={};h[0]&32|h[1]&1024&&(_.$$scope={dirty:h,ctx:n}),i.$set(_)},i(f){o||(b(t.$$.fragment,f),b(i.$$.fragment,f),o=!0)},o(f){$(t.$$.fragment,f),$(i.$$.fragment,f),o=!1},d(f){f&&M(e),H(t),H(i),l=!1,Vi(s)}}}function qGe(n){let e,t,r=n[5],i=[];for(let o=0;o<r.length;o+=1)i[o]=pP(sP(n,r,o));const a=o=>$(i[o],1,1,()=>{i[o]=null});return{c(){for(let o=0;o<i.length;o+=1)i[o].c();e=yt()},m(o,l){for(let s=0;s<i.length;s+=1)i[s].m(o,l);C(o,e,l),t=!0},p(o,l){if(l[0]&1824){r=o[5];let s;for(s=0;s<r.length;s+=1){const u=sP(o,r,s);i[s]?(i[s].p(u,l),b(i[s],1)):(i[s]=pP(u),i[s].c(),b(i[s],1),i[s].m(e.parentNode,e))}for(we(),s=r.length;s<i.length;s+=1)a(s);ke()}},i(o){if(!t){for(let l=0;l<r.length;l+=1)b(i[l]);t=!0}},o(o){i=i.filter(Boolean);for(let l=0;l<i.length;l+=1)$(i[l]);t=!1},d(o){Bn(i,o),o&&M(e)}}}function WGe(n){let e,t;return e=new jt({props:{size:"S",$$slots:{default:[YGe]},$$scope:{ctx:n}}}),{c(){O(e.$$.fragment)},m(r,i){B(e,r,i),t=!0},p(r,i){const a={};i[1]&1024&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){t||(b(e.$$.fragment,r),t=!0)},o(r){$(e.$$.fragment,r),t=!1},d(r){H(e,r)}}}function GGe(n){let e,t,r=n[6],i=[];for(let o=0;o<r.length;o+=1)i[o]=hP(uP(n,r,o));const a=o=>$(i[o],1,1,()=>{i[o]=null});return{c(){for(let o=0;o<i.length;o+=1)i[o].c();e=yt()},m(o,l){for(let s=0;s<i.length;s+=1)i[s].m(o,l);C(o,e,l),t=!0},p(o,l){if(l[0]&1880){r=o[6];let s;for(s=0;s<r.length;s+=1){const u=uP(o,r,s);i[s]?(i[s].p(u,l),b(i[s],1)):(i[s]=hP(u),i[s].c(),b(i[s],1),i[s].m(e.parentNode,e))}for(we(),s=r.length;s<i.length;s+=1)a(s);ke()}},i(o){if(!t){for(let l=0;l<r.length;l+=1)b(i[l]);t=!0}},o(o){i=i.filter(Boolean);for(let l=0;l<i.length;l+=1)$(i[l]);t=!1},d(o){Bn(i,o),o&&M(e)}}}function YGe(n){let e;return{c(){e=oe("There aren't any components matching the current filter")},m(t,r){C(t,e,r)},d(t){t&&M(e)}}}function KGe(n){let e=n[35].name+"",t;return{c(){t=oe(e)},m(r,i){C(r,t,i)},p(r,i){i[0]&64&&e!==(e=r[35].name+"")&&gt(t,e)},d(r){r&&M(t)}}}function dP(n){let e,t,r,i,a,o,l,s;t=new un({props:{name:n[35].icon}}),i=new jt({props:{size:"XS",$$slots:{default:[KGe]},$$scope:{ctx:n}}});function u(){return n[21](n[35])}function c(){return n[22](n[35])}return{c(){e=X("div"),O(t.$$.fragment),r=q(),O(i.$$.fragment),D(e,"draggable","true"),D(e,"data-cy",a=`component-${n[35].name}`),D(e,"class","component svelte-63iy97"),Te(e,"selected",n[3]===n[4][n[35].component])},m(f,h){C(f,e,h),B(t,e,null),x(e,r),B(i,e,null),o=!0,l||(s=[At(e,"dragstart",u),At(e,"dragend",n[10]),At(e,"click",c),At(e,"mouseover",n[23])],l=!0)},p(f,h){n=f;const m={};h[0]&64&&(m.name=n[35].icon),t.$set(m);const _={};h[0]&64|h[1]&1024&&(_.$$scope={dirty:h,ctx:n}),i.$set(_),(!o||h[0]&64&&a!==(a=`component-${n[35].name}`))&&D(e,"data-cy",a),h[0]&88&&Te(e,"selected",n[3]===n[4][n[35].component])},i(f){o||(b(t.$$.fragment,f),b(i.$$.fragment,f),o=!0)},o(f){$(t.$$.fragment,f),$(i.$$.fragment,f),o=!1},d(f){f&&M(e),H(t),H(i),l=!1,Vi(s)}}}function XGe(n){let e,t=n[32].name+"",r,i,a,o,l=n[32].children,s=[];for(let c=0;c<l.length;c+=1)s[c]=dP(cP(n,l,c));const u=c=>$(s[c],1,1,()=>{s[c]=null});return{c(){e=X("div"),r=oe(t),i=q();for(let c=0;c<s.length;c+=1)s[c].c();a=q(),D(e,"class","category-label svelte-63iy97")},m(c,f){C(c,e,f),x(e,r),C(c,i,f);for(let h=0;h<s.length;h+=1)s[h].m(c,f);C(c,a,f),o=!0},p(c,f){if((!o||f[0]&64)&&t!==(t=c[32].name+"")&&gt(r,t),f[0]&1880){l=c[32].children;let h;for(h=0;h<l.length;h+=1){const m=cP(c,l,h);s[h]?(s[h].p(m,f),b(s[h],1)):(s[h]=dP(m),s[h].c(),b(s[h],1),s[h].m(a.parentNode,a))}for(we(),h=l.length;h<s.length;h+=1)u(h);ke()}},i(c){if(!o){for(let f=0;f<l.length;f+=1)b(s[f]);o=!0}},o(c){s=s.filter(Boolean);for(let f=0;f<s.length;f+=1)$(s[f]);o=!1},d(c){c&&M(e),c&&M(i),Bn(s,c),c&&M(a)}}}function hP(n){let e,t;return e=new Pt({props:{noPadding:!0,gap:"XS",$$slots:{default:[XGe]},$$scope:{ctx:n}}}),{c(){O(e.$$.fragment)},m(r,i){B(e,r,i),t=!0},p(r,i){const a={};i[0]&88|i[1]&1024&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){t||(b(e.$$.fragment,r),t=!0)},o(r){$(e.$$.fragment,r),t=!1},d(r){H(e,r)}}}function JGe(n){let e,t,r,i,a,o,l,s;function u(y){n[17](y)}let c={placeholder:"Search",value:n[0]};n[2]!==void 0&&(c.inputRef=n[2]),e=new $5({props:c}),De.push(()=>nt(e,"inputRef",u)),e.$on("change",n[18]);let f=!n[0]&&fP(n);const h=[jGe,FGe],m=[];function _(y,w){return y[0]||y[1]==="components"?0:1}return a=_(n),o=m[a]=h[a](n),{c(){O(e.$$.fragment),r=q(),f&&f.c(),i=q(),o.c(),l=yt()},m(y,w){B(e,y,w),C(y,r,w),f&&f.m(y,w),C(y,i,w),m[a].m(y,w),C(y,l,w),s=!0},p(y,w){const A={};w[0]&1&&(A.value=y[0]),!t&&w[0]&4&&(t=!0,A.inputRef=y[2],rt(()=>t=!1)),e.$set(A),y[0]?f&&(we(),$(f,1,1,()=>{f=null}),ke()):f?(f.p(y,w),w[0]&1&&b(f,1)):(f=fP(y),f.c(),b(f,1),f.m(i.parentNode,i));let S=a;a=_(y),a===S?m[a].p(y,w):(we(),$(m[S],1,1,()=>{m[S]=null}),ke(),o=m[a],o?o.p(y,w):(o=m[a]=h[a](y),o.c()),b(o,1),o.m(l.parentNode,l))},i(y){s||(b(e.$$.fragment,y),b(f),b(o),s=!0)},o(y){$(e.$$.fragment,y),$(f),$(o),s=!1},d(y){H(e,y),y&&M(r),f&&f.d(y),y&&M(i),m[a].d(y),y&&M(l)}}}function ZGe(n){let e,t;return e=new Pt({props:{paddingX:"L",paddingY:"XL",gap:"S",$$slots:{default:[JGe]},$$scope:{ctx:n}}}),{c(){O(e.$$.fragment)},m(r,i){B(e,r,i),t=!0},p(r,i){const a={};i[0]&127|i[1]&1024&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){t||(b(e.$$.fragment,r),t=!0)},o(r){$(e.$$.fragment,r),t=!1},d(r){H(e,r)}}}function QGe(n){let e,t,r,i;return t=new G3({props:{title:"Add component",showCloseButton:!0,onClickCloseButton:n[26],borderLeft:!0,$$slots:{default:[ZGe]},$$scope:{ctx:n}}}),{c(){e=X("div"),O(t.$$.fragment),D(e,"class","container svelte-63iy97")},m(a,o){C(a,e,o),B(t,e,null),i=!0},p(a,o){const l={};o[0]&128&&(l.onClickCloseButton=a[26]),o[0]&127|o[1]&1024&&(l.$$scope={dirty:o,ctx:a}),t.$set(l)},i(a){i||(b(t.$$.fragment,a),a&&Po(()=>{r||(r=w0(e,k0,{x:260,duration:300},!0)),r.run(1)}),i=!0)},o(a){$(t.$$.fragment,a),a&&(r||(r=w0(e,k0,{x:260,duration:300},!1)),r.run(0)),i=!1},d(a){a&&M(e),H(t),a&&r&&r.end()}}}function eYe(n,e,t){let r,i,a,o,l,s,u,c,f;Fe(n,ci,be=>t(7,s=be)),Fe(n,Xt,be=>t(14,u=be)),Fe(n,I3,be=>t(15,c=be)),Fe(n,ja,be=>t(16,f=be));let h="components",m,_,y,w=[];const A=(be,pe,_e)=>{var Me;const Ae=T4(pe==null?void 0:pe.props,_e==null?void 0:_e._id);if(!(Ae!=null&&Ae.length))return[];let me=[];const it=Xt.actions.components.getDefinition(_e==null?void 0:_e._component);(Me=it.legalDirectChildren)!=null&&Me.length?me=it.legalDirectChildren.map(Be=>`@budibase/standard-components/${Be}`):me=Object.keys(be);let $e=it.illegalChildren||[];return Ae.forEach(Be=>{var st;const xe=Xt.actions.components.getDefinition(Be._component),ve=(st=xe==null?void 0:xe.illegalChildren)==null?void 0:st.map(dt=>`@budibase/standard-components/${dt}`);$e=[...$e,...ve||[]]}),$e=[...new Set($e)],me=me.filter(Be=>!$e.includes(Be)),me},S=be=>{let pe={};return be.forEach((_e,Ae)=>{pe[_e]=Ae}),pe},T=(be,pe,_e)=>{let Ae=[];return _e!=null&&_e.length&&Ae.push({name:"Plugins",isCategory:!0,children:_e.map(me=>({...pe[me],name:pe[me].friendlyName||pe[me].name})).sort((me,it)=>me.name.toLowerCase()<it.name.toLowerCase()?-1:1)}),be.forEach(me=>{if(typeof me=="string"){const it=pe[`@budibase/standard-components/${me}`];it&&Ae.push({...it,isCategory:!1})}else Ae.push({...me,isCategory:!0,children:T(me.children||[],pe)})}),Ae},I=(be,pe,_e)=>{if(t(3,y=_e?0:null),t(11,w=[]),!(be!=null&&be.length))return[];_e||(be=be.filter(me=>me.name!=="Blocks"));let Ae=[];return be.forEach(me=>{let it=me.children.filter($e=>{const Me=$e.name.toLowerCase();return _e&&!Me.includes(_e.toLowerCase())?!1:pe.includes($e.component)});it.length&&(Ae.push({...me,children:it}),t(11,w=w.concat(it.map($e=>$e.component))))}),be=Ae,be},P=async be=>{try{await Xt.actions.components.create(be),s("../")}catch(pe){$t.error(pe||"Error creating component")}},V=be=>{if(be.key==="Tab")return y==null?t(3,y=0):t(3,y=(y+1)%w.length),be.preventDefault(),be.stopPropagation(),!1;be.key==="Enter"&&w[y]&&P(w[y])};ar(()=>(_.focus(),window.addEventListener("keydown",V),()=>{window.removeEventListener("keydown",V)}));const j=be=>{Xt.actions.dnd.start(be)},U=()=>{Xt.actions.dnd.stop()};function W(be){_=be,t(2,_)}const te=be=>t(0,m=be.detail),Q=()=>t(1,h="components"),le=()=>t(1,h="blocks"),ie=be=>j(be.component),K=be=>P(be.component),G=()=>t(3,y=null),re=be=>P(be.component),se=be=>j(be.component),de=()=>s("../");return n.$$.update=()=>{n.$$.dirty[0]&114688&&t(13,r=A(u.components,f,c)),n.$$.dirty[0]&16384&&t(12,i=T(PGe,u.components,u.customComponents)),n.$$.dirty[0]&12289&&t(6,a=I(i,r,m)),n.$$.dirty[0]&4096&&t(5,o=i.find(be=>be.name==="Blocks").children),n.$$.dirty[0]&2048&&t(4,l=S(w))},[m,h,_,y,l,o,a,s,P,j,U,w,i,r,u,c,f,W,te,Q,le,ie,K,G,re,se,de]}class tYe extends Ve{constructor(e){super(),Pe(this,e,eYe,QGe,Ie,{},null,[-1,-1])}}function nYe(n){let e,t;return e=new tYe({}),{c(){O(e.$$.fragment)},m(r,i){B(e,r,i),t=!0},p:ht,i(r){t||(b(e.$$.fragment,r),t=!0)},o(r){$(e.$$.fragment,r),t=!1},d(r){H(e,r)}}}class rYe extends Ve{constructor(e){super(),Pe(this,e,null,nYe,Ie,{})}}const nA=n=>{var j,U,W,te;const{urlParam:e,stateKey:t,validate:r,baseUrl:i="..",fallbackUrl:a,store:o,routify:l,beforeNavigate:s}=n||{};if(!e||!t||!i||!e||!(o!=null&&o.subscribe)||!l||!((j=l.params)!=null&&j.subscribe)||!((U=l.goto)!=null&&U.subscribe)||!((W=l.redirect)!=null&&W.subscribe)||!((te=l.page)!=null&&te.subscribe)){console.warn("syncURLToState invoked with missing parameters");return}let u=pn(l.params),c=pn(l.goto),f=pn(l.redirect),h=pn(l.page),m=null;const _=(Q,le)=>{if(s){const ie=s(Q,le);ie!=null&&ie.url&&(Q=ie.url),ie!=null&&ie.params&&(le=ie.params)}c(Q,le)},y=Q=>{f(Q)},w=Q=>{var re;const le=JSON.stringify(Q),ie=le!==m;m=le;const K=Q==null?void 0:Q[e],G=(re=pn(o))==null?void 0:re[t];if(!(!ie||!K)){if(r&&a&&!r(K)){y(a);return}K!==G&&o.update(se=>(se[t]=K,se))}},A=Q=>{let le=!1;const ie=u==null?void 0:u[e],K=Q==null?void 0:Q[t];if(K!==ie&&(le=!0,r&&a&&!r(K))){y(a);return}if(!!le&&!pn(f_)){const G={...u,[e]:K};_(h.path,G)}};w(u);const S=l.params.subscribe(Q=>{u=Q,w(Q)}),T=l.goto.subscribe(Q=>{c=Q}),I=l.redirect.subscribe(Q=>{f=Q}),P=l.page.subscribe(Q=>{h=Q}),V=o.subscribe(A);return()=>{S(),T(),I(),P(),V()}};function iYe(n){let e;return{c(){e=oe("Delete")},m(t,r){C(t,e,r)},d(t){t&&M(e)}}}function mP(n){let e,t;return e=new ei({props:{icon:"Export",keyBind:"Ctrl+E",$$slots:{default:[aYe]},$$scope:{ctx:n}}}),e.$on("click",n[7]),{c(){O(e.$$.fragment)},m(r,i){B(e,r,i),t=!0},p(r,i){const a={};i&16384&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){t||(b(e.$$.fragment,r),t=!0)},o(r){$(e.$$.fragment,r),t=!1},d(r){H(e,r)}}}function aYe(n){let e;return{c(){e=oe("Eject block")},m(t,r){C(t,e,r)},d(t){t&&M(e)}}}function oYe(n){let e;return{c(){e=oe("Move up")},m(t,r){C(t,e,r)},d(t){t&&M(e)}}}function lYe(n){let e;return{c(){e=oe("Move down")},m(t,r){C(t,e,r)},d(t){t&&M(e)}}}function sYe(n){let e;return{c(){e=oe("Duplicate")},m(t,r){C(t,e,r)},d(t){t&&M(e)}}}function uYe(n){let e;return{c(){e=oe("Cut")},m(t,r){C(t,e,r)},d(t){t&&M(e)}}}function cYe(n){let e;return{c(){e=oe("Copy")},m(t,r){C(t,e,r)},d(t){t&&M(e)}}}function fYe(n){let e;return{c(){e=oe("Paste")},m(t,r){C(t,e,r)},d(t){t&&M(e)}}}function pYe(n){let e,t,r,i,a,o,l,s,u,c,f,h,m,_,y;e=new ei({props:{icon:"Delete",keyBind:"!BackAndroid",$$slots:{default:[iYe]},$$scope:{ctx:n}}}),e.$on("click",n[6]);let w=n[0]&&mP(n);return i=new ei({props:{icon:"ChevronUp",keyBind:"Ctrl+!ArrowUp",$$slots:{default:[oYe]},$$scope:{ctx:n}}}),i.$on("click",n[8]),o=new ei({props:{icon:"ChevronDown",keyBind:"Ctrl+!ArrowDown",$$slots:{default:[lYe]},$$scope:{ctx:n}}}),o.$on("click",n[9]),s=new ei({props:{icon:"Duplicate",keyBind:"Ctrl+D",$$slots:{default:[sYe]},$$scope:{ctx:n}}}),s.$on("click",n[10]),c=new ei({props:{icon:"Cut",keyBind:"Ctrl+X",$$slots:{default:[uYe]},$$scope:{ctx:n}}}),c.$on("click",n[11]),h=new ei({props:{icon:"Copy",keyBind:"Ctrl+C",$$slots:{default:[cYe]},$$scope:{ctx:n}}}),h.$on("click",n[12]),_=new ei({props:{icon:"LayersSendToBack",keyBind:"Ctrl+V",disabled:n[1],$$slots:{default:[fYe]},$$scope:{ctx:n}}}),_.$on("click",n[13]),{c(){O(e.$$.fragment),t=q(),w&&w.c(),r=q(),O(i.$$.fragment),a=q(),O(o.$$.fragment),l=q(),O(s.$$.fragment),u=q(),O(c.$$.fragment),f=q(),O(h.$$.fragment),m=q(),O(_.$$.fragment)},m(A,S){B(e,A,S),C(A,t,S),w&&w.m(A,S),C(A,r,S),B(i,A,S),C(A,a,S),B(o,A,S),C(A,l,S),B(s,A,S),C(A,u,S),B(c,A,S),C(A,f,S),B(h,A,S),C(A,m,S),B(_,A,S),y=!0},p(A,S){const T={};S&16384&&(T.$$scope={dirty:S,ctx:A}),e.$set(T),A[0]?w?(w.p(A,S),S&1&&b(w,1)):(w=mP(A),w.c(),b(w,1),w.m(r.parentNode,r)):w&&(we(),$(w,1,1,()=>{w=null}),ke());const I={};S&16384&&(I.$$scope={dirty:S,ctx:A}),i.$set(I);const P={};S&16384&&(P.$$scope={dirty:S,ctx:A}),o.$set(P);const V={};S&16384&&(V.$$scope={dirty:S,ctx:A}),s.$set(V);const j={};S&16384&&(j.$$scope={dirty:S,ctx:A}),c.$set(j);const U={};S&16384&&(U.$$scope={dirty:S,ctx:A}),h.$set(U);const W={};S&2&&(W.disabled=A[1]),S&16384&&(W.$$scope={dirty:S,ctx:A}),_.$set(W)},i(A){y||(b(e.$$.fragment,A),b(w),b(i.$$.fragment,A),b(o.$$.fragment,A),b(s.$$.fragment,A),b(c.$$.fragment,A),b(h.$$.fragment,A),b(_.$$.fragment,A),y=!0)},o(A){$(e.$$.fragment,A),$(w),$(i.$$.fragment,A),$(o.$$.fragment,A),$(s.$$.fragment,A),$(c.$$.fragment,A),$(h.$$.fragment,A),$(_.$$.fragment,A),y=!1},d(A){H(e,A),A&&M(t),w&&w.d(A),A&&M(r),H(i,A),A&&M(a),H(o,A),A&&M(l),H(s,A),A&&M(u),H(c,A),A&&M(f),H(h,A),A&&M(m),H(_,A)}}}function dYe(n){let e,t,r;return t=new un({props:{size:"S",hoverable:!0,name:"MoreSmallList"}}),{c(){e=X("div"),O(t.$$.fragment),D(e,"slot","control"),D(e,"class","icon svelte-u6s22l")},m(i,a){C(i,e,a),B(t,e,null),r=!0},p:ht,i(i){r||(b(t.$$.fragment,i),r=!0)},o(i){$(t.$$.fragment,i),r=!1},d(i){i&&M(e),H(t)}}}function hYe(n){let e,t;return e=new ou({props:{$$slots:{control:[dYe],default:[pYe]},$$scope:{ctx:n}}}),{c(){O(e.$$.fragment)},m(r,i){B(e,r,i),t=!0},p(r,[i]){const a={};i&16387&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){t||(b(e.$$.fragment,r),t=!0)},o(r){$(e.$$.fragment,r),t=!1},d(r){H(e,r)}}}function mYe(n,e,t){let r,i,a,o;Fe(n,Xt,A=>t(5,o=A));let{component:l}=e;const s=(A,S=!1)=>{document.dispatchEvent(new CustomEvent("component-menu",{detail:{key:A,ctrlKey:S,id:l==null?void 0:l._id}}))},u=()=>s("Delete"),c=()=>s("e",!0),f=()=>s("ArrowUp",!0),h=()=>s("ArrowDown",!0),m=()=>s("d",!0),_=()=>s("x",!0),y=()=>s("c",!0),w=()=>s("v",!0);return n.$$set=A=>{"component"in A&&t(3,l=A.component)},n.$$.update=()=>{n.$$.dirty&8&&t(4,r=Xt.actions.components.getDefinition(l==null?void 0:l._component)),n.$$.dirty&32&&t(1,i=!o.componentToPaste),n.$$.dirty&16&&t(0,a=(r==null?void 0:r.block)===!0)},[a,i,s,l,r,o,u,c,f,h,m,_,y,w]}class gYe extends Ve{constructor(e){super(),Pe(this,e,mYe,hYe,Ie,{component:3})}}const $c={ABOVE:"above",BELOW:"below",INSIDE:"inside"},gP={source:null,target:null,targetParent:null,dropPosition:null,dragging:!1,valid:!1},vYe=()=>{const n=gi(gP),e={dragstart:t=>{!t||n.set({source:t,target:null,dropPosition:null,dragging:!0,valid:!1})},dragover:({component:t,mousePosition:r})=>{var f,h;const i=Xt.actions.components.getDefinition(t._component),a=i==null?void 0:i.hasChildren,o=((f=t._children)==null?void 0:f.length)>0;let l,s,u;a?r<=.33?l=$c.ABOVE:r>=.66?l=$c.BELOW:l=$c.INSIDE:l=r>.5?$c.BELOW:$c.ABOVE,l===$c.BELOW&&o?(s=t._children[0],l=$c.ABOVE):s=t;const c=pn(n);l===c.dropPosition&&(s==null?void 0:s._id)===((h=c.target)==null?void 0:h._id)||(s&&(u=vc(pn(ja).props,s._id)),n.update(m=>{var _;return{...m,dropPosition:l,target:s,targetParent:u,valid:((_=T4(m.source,s._id))==null?void 0:_.length)===0}}))},reset:()=>{n.set(gP)},drop:async()=>{const t=pn(n);!t.valid||!t.source||!t.target||(e.reset(),Xt.actions.components.copy(t.source,!0,!1),await Xt.actions.components.paste(t.target,t.dropPosition))}};return{subscribe:n.subscribe,actions:e}},rp=vYe();function vP(n,e,t){const r=n.slice();r[20]=e[t],r[23]=t;const i=r[11](r[20],r[4],r[2]);return r[21]=i,r}function _Ye(n){let e,t;return e=new gYe({props:{component:n[20]}}),{c(){O(e.$$.fragment)},m(r,i){B(e,r,i),t=!0},p(r,i){const a={};i&8&&(a.component=r[20]),e.$set(a)},i(r){t||(b(e.$$.fragment,r),t=!0)},o(r){$(e.$$.fragment,r),t=!1},d(r){H(e,r)}}}function _P(n){let e,t;return e=new EJ({props:{components:n[20]._children,dndStore:rp,level:n[0]+1}}),{c(){O(e.$$.fragment)},m(r,i){B(e,r,i),t=!0},p(r,i){const a={};i&8&&(a.components=r[20]._children),i&1&&(a.level=r[0]+1),e.$set(a)},i(r){t||(b(e.$$.fragment,r),t=!0)},o(r){$(e.$$.fragment,r),t=!1},d(r){H(e,r)}}}function bP(n,e){let t,r,i,a,o,l,s,u;function c(){return e[14](e[20])}function f(){return e[15](e[20])}r=new L5({props:{scrollable:!0,draggable:!0,text:e[6](e[20]),icon:e[7](e[20]),withArrow:e[8](e[20]),indentLevel:e[0]+1,selected:e[1].selectedComponentId===e[20]._id,opened:e[21],highlighted:e[12](e[20]),$$slots:{default:[_Ye]},$$scope:{ctx:e}}}),r.$on("dragend",rp.actions.reset),r.$on("dragstart",c),r.$on("dragover",function(){kn(e[5](e[20],e[23]))&&e[5](e[20],e[23]).apply(this,arguments)}),r.$on("iconClick",f),r.$on("drop",e[10]);let h=e[21]&&_P(e);function m(){return e[16](e[20])}return{key:n,first:null,c(){t=X("li"),O(r.$$.fragment),i=q(),h&&h.c(),a=q(),D(t,"id",o=`component-${e[20]._id}`),D(t,"class","svelte-kv7hxn"),this.first=t},m(_,y){C(_,t,y),B(r,t,null),x(t,i),h&&h.m(t,null),x(t,a),l=!0,s||(u=At(t,"click",c_(m)),s=!0)},p(_,y){e=_;const w={};y&8&&(w.text=e[6](e[20])),y&8&&(w.icon=e[7](e[20])),y&8&&(w.withArrow=e[8](e[20])),y&1&&(w.indentLevel=e[0]+1),y&10&&(w.selected=e[1].selectedComponentId===e[20]._id),y&28&&(w.opened=e[21]),y&8&&(w.highlighted=e[12](e[20])),y&16777224&&(w.$$scope={dirty:y,ctx:e}),r.$set(w),e[21]?h?(h.p(e,y),y&28&&b(h,1)):(h=_P(e),h.c(),b(h,1),h.m(t,a)):h&&(we(),$(h,1,1,()=>{h=null}),ke()),(!l||y&8&&o!==(o=`component-${e[20]._id}`))&&D(t,"id",o)},i(_){l||(b(r.$$.fragment,_),b(h),l=!0)},o(_){$(r.$$.fragment,_),$(h),l=!1},d(_){_&&M(t),H(r),h&&h.d(),s=!1,u()}}}function bYe(n){let e,t=[],r=new Map,i,a=n[3]||[];const o=l=>l[20]._id;for(let l=0;l<a.length;l+=1){let s=vP(n,a,l),u=o(s);r.set(u,t[l]=bP(u,s))}return{c(){e=X("ul");for(let l=0;l<t.length;l+=1)t[l].c();D(e,"class","svelte-kv7hxn")},m(l,s){C(l,e,s);for(let u=0;u<t.length;u+=1)t[u].m(e,null);i=!0},p(l,[s]){s&8191&&(a=l[3]||[],we(),t=Pl(t,s,o,1,l,a,r,e,Mc,bP,null,vP),ke())},i(l){if(!i){for(let s=0;s<a.length;s+=1)b(t[s]);i=!0}},o(l){for(let s=0;s<t.length;s+=1)$(t[s]);i=!1},d(l){l&&M(e);for(let s=0;s<t.length;s+=1)t[s].d()}}}function yYe(n,e,t){let r,i,a,o;Fe(n,I3,V=>t(18,i=V)),Fe(n,Xt,V=>t(1,a=V)),Fe(n,q4e,V=>t(4,o=V));let{components:l=[]}=e,{level:s=0}=e,u={};const c=(V,j)=>U=>{const W=U.offsetY/U.currentTarget.offsetHeight;return rp.actions.dragover({component:V,index:j,mousePosition:W}),!1},f=V=>{if(V._instanceName)return V._instanceName;const j=V._component.replace("@budibase/standard-components/","")||"component";return Ac(j)},h=V=>{const j=Xt.actions.components.getDefinition(V==null?void 0:V._component);return j==null?void 0:j.icon},m=V=>{const j=Xt.actions.components.getDefinition(V==null?void 0:V._component);return j==null?void 0:j.hasChildren},_=V=>{var j;return m(V)&&((j=V._children)==null?void 0:j.length)};function y(V){u[V]?delete u[V]:t(2,u[V]=!0,u),t(2,u)}const w=async V=>{V.stopPropagation();try{await rp.actions.drop()}catch(j){$t.error(j||"Error saving component")}},A=(V,j,U)=>{var W;return(W=V==null?void 0:V._children)!=null&&W.length?j.includes(V._id)?!0:!U[V._id]:!1},S=V=>{var W,te,Q;const j=(W=pn(I3))==null?void 0:W._id,U=(te=pn(ja))==null?void 0:te.props._id;return!j||j===U?!1:((Q=T4(i,V._id))==null?void 0:Q.length)>0},T=V=>rp.actions.dragstart(V),I=V=>y(V._id),P=V=>{G1(Xt,a.selectedComponentId=V._id,a)};return n.$$set=V=>{"components"in V&&t(13,l=V.components),"level"in V&&t(0,s=V.level)},n.$$.update=()=>{n.$$.dirty&8194&&t(3,r=l==null?void 0:l.filter(V=>{var j,U;return!((j=a.componentToPaste)!=null&&j.isCut)||V._id!==((U=a.componentToPaste)==null?void 0:U._id)}))},pn(ja),[s,a,u,r,o,c,f,h,_,y,w,A,S,l,T,I,P]}class EJ extends Ve{constructor(e){super(),Pe(this,e,yYe,bYe,Ie,{components:13,level:0})}}function yP(n){let e,t;return e=new ou({props:{$$slots:{control:[zYe],default:[kYe]},$$scope:{ctx:n}}}),{c(){O(e.$$.fragment)},m(r,i){B(e,r,i),t=!0},p(r,i){const a={};i&514&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){t||(b(e.$$.fragment,r),t=!0)},o(r){$(e.$$.fragment,r),t=!1},d(r){H(e,r)}}}function $Ye(n){let e;return{c(){e=oe("Copy")},m(t,r){C(t,e,r)},d(t){t&&M(e)}}}function wYe(n){let e;return{c(){e=oe("Paste")},m(t,r){C(t,e,r)},d(t){t&&M(e)}}}function kYe(n){let e,t,r,i;return e=new ei({props:{icon:"Copy",keyBind:"Ctrl+C",$$slots:{default:[$Ye]},$$scope:{ctx:n}}}),e.$on("click",n[7]),r=new ei({props:{icon:"LayersSendToBack",keyBind:"Ctrl+V",disabled:n[1],$$slots:{default:[wYe]},$$scope:{ctx:n}}}),r.$on("click",n[8]),{c(){O(e.$$.fragment),t=q(),O(r.$$.fragment)},m(a,o){B(e,a,o),C(a,t,o),B(r,a,o),i=!0},p(a,o){const l={};o&512&&(l.$$scope={dirty:o,ctx:a}),e.$set(l);const s={};o&2&&(s.disabled=a[1]),o&512&&(s.$$scope={dirty:o,ctx:a}),r.$set(s)},i(a){i||(b(e.$$.fragment,a),b(r.$$.fragment,a),i=!0)},o(a){$(e.$$.fragment,a),$(r.$$.fragment,a),i=!1},d(a){H(e,a),a&&M(t),H(r,a)}}}function zYe(n){let e,t,r;return t=new un({props:{size:"S",hoverable:!0,name:"MoreSmallList"}}),{c(){e=X("div"),O(t.$$.fragment),D(e,"slot","control"),D(e,"class","icon svelte-u6s22l")},m(i,a){C(i,e,a),B(t,e,null),r=!0},p:ht,i(i){r||(b(t.$$.fragment,i),r=!0)},o(i){$(t.$$.fragment,i),r=!1},d(i){i&&M(e),H(t)}}}function AYe(n){let e,t,r=n[0]&&yP(n);return{c(){r&&r.c(),e=yt()},m(i,a){r&&r.m(i,a),C(i,e,a),t=!0},p(i,[a]){i[0]?r?(r.p(i,a),a&1&&b(r,1)):(r=yP(i),r.c(),b(r,1),r.m(e.parentNode,e)):r&&(we(),$(r,1,1,()=>{r=null}),ke())},i(i){t||(b(r),t=!0)},o(i){$(r),t=!1},d(i){r&&r.d(i),i&&M(e)}}}function MYe(n,e,t){let r,i,a,o;Fe(n,Xt,h=>t(6,o=h));let{component:l}=e;const s=(h=!1)=>{Xt.actions.components.copy(l,h)},u=h=>{try{Xt.actions.components.paste(l,h)}catch{$t.error("Error saving component")}},c=()=>s(!1),f=()=>u("inside");return n.$$set=h=>{"component"in h&&t(4,l=h.component)},n.$$.update=()=>{n.$$.dirty&16&&t(5,r=Xt.actions.components.getDefinition(l==null?void 0:l._component)),n.$$.dirty&64&&t(1,i=!o.componentToPaste),n.$$.dirty&32&&t(0,a=(r==null?void 0:r.editable)!==!1&&(r==null?void 0:r.static)!==!0)},[a,i,s,u,l,r,o,c,f]}class CYe extends Ve{constructor(e){super(),Pe(this,e,MYe,AYe,Ie,{component:4})}}function $P(n){let e,t;return{c(){e=X("div"),D(e,"class","indicator svelte-9uy3y5"),$n(e,"--x",n[2]+"px"),$n(e,"--y",n[3]+"px"),$n(e,"--width",n[4]+"px"),$n(e,"--height",n[5]+"px"),Te(e,"above",n[1]===$c.ABOVE),Te(e,"below",n[1]===$c.BELOW),Te(e,"inside",n[1]===$c.INSIDE)},m(r,i){C(r,e,i)},p(r,i){i&4&&$n(e,"--x",r[2]+"px"),i&8&&$n(e,"--y",r[3]+"px"),i&16&&$n(e,"--width",r[4]+"px"),i&32&&$n(e,"--height",r[5]+"px"),i&2&&Te(e,"above",r[1]===$c.ABOVE),i&2&&Te(e,"below",r[1]===$c.BELOW),i&2&&Te(e,"inside",r[1]===$c.INSIDE)},i(r){t||Po(()=>{t=Sd(e,ip,{duration:130}),t.start()})},o:ht,d(r){r&&M(e)}}}function SYe(n){let e,t=n[0]&&n[1]&&$P(n);return{c(){t&&t.c(),e=yt()},m(r,i){t&&t.m(r,i),C(r,e,i)},p(r,[i]){r[0]&&r[1]?t?(t.p(r,i),i&3&&b(t,1)):(t=$P(r),t.c(),b(t,1),t.m(e.parentNode,e)):t&&(t.d(1),t=null)},i(r){b(t)},o:ht,d(r){t&&t.d(r),r&&M(e)}}}function LYe(n,e,t){let{component:r}=e,{position:i}=e,a,o,l,s;const u=c=>{var m;const f=document.getElementById(`component-${c==null?void 0:c._id}`),h=(m=f==null?void 0:f.children[0])==null?void 0:m.children[0];!f||(t(2,a=h.offsetLeft),t(3,o=h.offsetTop),t(4,l=h.clientWidth),t(5,s=h.clientHeight))};return n.$$set=c=>{"component"in c&&t(0,r=c.component),"position"in c&&t(1,i=c.position)},n.$$.update=()=>{n.$$.dirty&1&&u(r)},[r,i,a,o,l,s]}class TJ extends Ve{constructor(e){super(),Pe(this,e,LYe,SYe,Ie,{component:0,position:1})}}function EYe(n){var l,s;let e,t,r,i,a={title:"Confirm Deletion",body:`Are you sure you want to delete "${(l=n[2])==null?void 0:l._instanceName}"?`,okText:"Delete Component",onOk:n[4]};e=new gl({props:a}),n[5](e);let o={title:"Eject block",body:`Ejecting a block breaks it down into multiple components and cannot be undone. Are you sure you want to eject "${(s=n[3])==null?void 0:s._instanceName}"?`,onOk:n[6],okText:"Eject block"};return r=new gl({props:o}),n[7](r),{c(){O(e.$$.fragment),t=q(),O(r.$$.fragment)},m(u,c){B(e,u,c),C(u,t,c),B(r,u,c),i=!0},p(u,[c]){var m,_;const f={};c&4&&(f.body=`Are you sure you want to delete "${(m=u[2])==null?void 0:m._instanceName}"?`),c&4&&(f.onOk=u[4]),e.$set(f);const h={};c&8&&(h.body=`Ejecting a block breaks it down into multiple components and cannot be undone. Are you sure you want to eject "${(_=u[3])==null?void 0:_._instanceName}"?`),c&8&&(h.onOk=u[6]),r.$set(h)},i(u){i||(b(e.$$.fragment,u),b(r.$$.fragment,u),i=!0)},o(u){$(e.$$.fragment,u),$(r.$$.fragment,u),i=!1},d(u){n[5](null),H(e,u),u&&M(t),n[7](null),H(r,u)}}}function TYe(n,e,t){let r,i,a,o;Fe(n,ja,T=>t(8,r=T)),Fe(n,I3,T=>t(9,i=T)),Fe(n,ci,T=>t(10,a=T)),Fe(n,k6,T=>t(11,o=T));let l,s,u,c;const f={["^ArrowUp"]:async T=>{await Xt.actions.components.moveUp(T)},["^ArrowDown"]:async T=>{await Xt.actions.components.moveDown(T)},["^c"]:T=>{Xt.actions.components.copy(T,!1)},["^x"]:T=>{Xt.actions.components.copy(T,!0)},["^v"]:async T=>{await Xt.actions.components.paste(T,"inside")},["^d"]:async T=>{Xt.actions.components.copy(T),await Xt.actions.components.paste(T,"below")},["^e"]:T=>{t(3,c=T),s.show()},["^Enter"]:()=>{a("./new")},Delete:T=>{if((T==null?void 0:T._id)===r.props._id)return!1;t(2,u=T),l.show()},ArrowUp:()=>{Xt.actions.components.selectPrevious()},ArrowDown:()=>{Xt.actions.components.selectNext()},Escape:()=>{if(!o("/new"))return!1;a("./")}},h=async(T,I,P,V=!1)=>{if(!I||!P)return!1;try{P==="Backspace"&&(P="Delete"),V&&(P="^"+P);const j=f[P];if(j)T&&(T.preventDefault(),T.stopPropagation());else return!1;return await j(I)}catch(j){$t.error(j||"Error handling key press")}},m=async T=>{var P;if(T.repeat)return;const I=(P=document.activeElement)==null?void 0:P.tagName.toLowerCase();if(!(["input","textarea"].indexOf(I)!==-1&&T.key!=="Escape"))return await h(T,i,T.key,T.ctrlKey||T.metaKey)},_=async T=>{const{id:I,key:P,ctrlKey:V}=T.detail,j=ru(r.props,I);return await h(null,j,P,V)};ar(()=>(document.addEventListener("keydown",m),document.addEventListener("component-menu",_),()=>{document.removeEventListener("keydown",m),document.removeEventListener("component-menu",_)}));const y=()=>Xt.actions.components.delete(u);function w(T){De[T?"unshift":"push"](()=>{l=T,t(0,l)})}const A=()=>Xt.actions.components.requestEjectBlock(c==null?void 0:c._id);function S(T){De[T?"unshift":"push"](()=>{s=T,t(1,s)})}return[l,s,u,c,y,w,A,S]}class DYe extends Ve{constructor(e){super(),Pe(this,e,TYe,EYe,Ie,{})}}function BYe(n){let e,t,r,i;const a=n[3].default,o=Xn(a,n,n[2],null);return{c(){e=X("div"),o&&o.c(),D(e,"ondragover","return false"),D(e,"ondragenter","return false"),D(e,"class","svelte-1vzr6kt")},m(l,s){C(l,e,s),o&&o.m(e,null),n[4](e),t=!0,r||(i=At(e,"drop",n[1]),r=!0)},p(l,[s]){o&&o.p&&(!t||s&4)&&Zn(o,a,l,l[2],t?Jn(a,l[2],s,null):Qn(l[2]),null)},i(l){t||(b(o,l),t=!0)},o(l){$(o,l),t=!1},d(l){l&&M(e),o&&o.d(l),n[4](null),r=!1,i()}}}function HYe(n,e,t){let{$$slots:r={},$$scope:i}=e,a;Vd("scroll",{scrollTo:u=>{if(!u)return;const c=259,f=32,{scrollLeft:h,scrollTop:m,offsetHeight:_}=a;let y=a.getBoundingClientRect(),w={};const A=u.left+u.width+h-36;A>c?w.left=A-c:w.left=0,w.left===h&&delete w.left;const S=u.top-(y==null?void 0:y.top)+m;S>m+_-2*f?w.top=S-_+2*f:S<m+f?w.top=S-f:delete w.top,!(w.left==null&&w.top==null)&&a.scroll({...w,behavior:"smooth"})}});const l=async()=>{try{await rp.actions.drop()}catch(u){console.error(u),$t.error("Error saving component")}};function s(u){De[u?"unshift":"push"](()=>{a=u,t(0,a)})}return n.$$set=u=>{"$$scope"in u&&t(2,i=u.$$scope)},[a,l,i,r,s]}class OYe extends Ve{constructor(e){super(),Pe(this,e,HYe,BYe,Ie,{})}}function IYe(n){let e;return{c(){e=oe("Add component")},m(t,r){C(t,e,r)},d(t){t&&M(e)}}}function PYe(n){var r;let e,t;return e=new CYe({props:{component:(r=n[2])==null?void 0:r.props}}),{c(){O(e.$$.fragment)},m(i,a){B(e,i,a),t=!0},p(i,a){var l;const o={};a&4&&(o.component=(l=i[2])==null?void 0:l.props),e.$set(o)},i(i){t||(b(e.$$.fragment,i),t=!0)},o(i){$(e.$$.fragment,i),t=!1},d(i){H(e,i)}}}function wP(n){let e,t,r,i;e=new TJ({props:{component:n[3].target,position:n[3].dropPosition}});let a=n[3].dropPosition!==$c.INSIDE&&kP(n);return{c(){O(e.$$.fragment),t=q(),a&&a.c(),r=yt()},m(o,l){B(e,o,l),C(o,t,l),a&&a.m(o,l),C(o,r,l),i=!0},p(o,l){const s={};l&8&&(s.component=o[3].target),l&8&&(s.position=o[3].dropPosition),e.$set(s),o[3].dropPosition!==$c.INSIDE?a?(a.p(o,l),l&8&&b(a,1)):(a=kP(o),a.c(),b(a,1),a.m(r.parentNode,r)):a&&(we(),$(a,1,1,()=>{a=null}),ke())},i(o){i||(b(e.$$.fragment,o),b(a),i=!0)},o(o){$(e.$$.fragment,o),$(a),i=!1},d(o){H(e,o),o&&M(t),a&&a.d(o),o&&M(r)}}}function kP(n){let e,t;return e=new TJ({props:{component:n[3].targetParent,position:$c.INSIDE}}),{c(){O(e.$$.fragment)},m(r,i){B(e,r,i),t=!0},p(r,i){const a={};i&8&&(a.component=r[3].targetParent),e.$set(a)},i(r){t||(b(e.$$.fragment,r),t=!0)},o(r){$(e.$$.fragment,r),t=!1},d(r){H(e,r)}}}function VYe(n){var u,c,f;let e,t,r,i,a,o,l;r=new L5({props:{text:"Screen",indentLevel:0,selected:n[1].selectedComponentId===((u=n[2])==null?void 0:u.props._id),opened:!0,scrollable:!0,icon:"WebPage",id:`component-${(c=n[2])==null?void 0:c.props._id}`,$$slots:{default:[PYe]},$$scope:{ctx:n}}}),r.$on("drop",n[4]),r.$on("click",n[6]),a=new EJ({props:{level:0,components:(f=n[2])==null?void 0:f.props._children}});let s=n[3].dragging&&n[3].valid&&wP(n);return{c(){e=X("ul"),t=X("li"),O(r.$$.fragment),i=q(),O(a.$$.fragment),o=q(),s&&s.c(),D(t,"class","svelte-1ohljq5"),D(e,"class","svelte-1ohljq5")},m(h,m){C(h,e,m),x(e,t),B(r,t,null),x(t,i),B(a,t,null),x(t,o),s&&s.m(t,null),l=!0},p(h,m){var w,A,S;const _={};m&6&&(_.selected=h[1].selectedComponentId===((w=h[2])==null?void 0:w.props._id)),m&4&&(_.id=`component-${(A=h[2])==null?void 0:A.props._id}`),m&132&&(_.$$scope={dirty:m,ctx:h}),r.$set(_);const y={};m&4&&(y.components=(S=h[2])==null?void 0:S.props._children),a.$set(y),h[3].dragging&&h[3].valid?s?(s.p(h,m),m&8&&b(s,1)):(s=wP(h),s.c(),b(s,1),s.m(t,null)):s&&(we(),$(s,1,1,()=>{s=null}),ke())},i(h){l||(b(r.$$.fragment,h),b(a.$$.fragment,h),b(s),l=!0)},o(h){$(r.$$.fragment,h),$(a.$$.fragment,h),$(s),l=!1},d(h){h&&M(e),H(r),H(a),s&&s.d()}}}function RYe(n){let e,t,r,i,a;return t=new _n({props:{cta:!0,$$slots:{default:[IYe]},$$scope:{ctx:n}}}),t.$on("click",n[5]),i=new OYe({props:{$$slots:{default:[VYe]},$$scope:{ctx:n}}}),{c(){e=X("div"),O(t.$$.fragment),r=q(),O(i.$$.fragment),D(e,"class","add-component svelte-1ohljq5")},m(o,l){C(o,e,l),B(t,e,null),C(o,r,l),B(i,o,l),a=!0},p(o,l){const s={};l&128&&(s.$$scope={dirty:l,ctx:o}),t.$set(s);const u={};l&142&&(u.$$scope={dirty:l,ctx:o}),i.$set(u)},i(o){a||(b(t.$$.fragment,o),b(i.$$.fragment,o),a=!0)},o(o){$(t.$$.fragment,o),$(i.$$.fragment,o),a=!1},d(o){o&&M(e),H(t),o&&M(r),H(i,o)}}}function NYe(n){let e,t,r,i;return e=new G3({props:{title:"Components",showExpandIcon:!0,borderRight:!0,$$slots:{default:[RYe]},$$scope:{ctx:n}}}),r=new DYe({}),{c(){O(e.$$.fragment),t=q(),O(r.$$.fragment)},m(a,o){B(e,a,o),C(a,t,o),B(r,a,o),i=!0},p(a,[o]){const l={};o&143&&(l.$$scope={dirty:o,ctx:a}),e.$set(l)},i(a){i||(b(e.$$.fragment,a),b(r.$$.fragment,a),i=!0)},o(a){$(e.$$.fragment,a),$(r.$$.fragment,a),i=!1},d(a){H(e,a),a&&M(t),H(r,a)}}}function FYe(n,e,t){let r,i,a,o;return Fe(n,ci,c=>t(0,r=c)),Fe(n,Xt,c=>t(1,i=c)),Fe(n,ja,c=>t(2,a=c)),Fe(n,rp,c=>t(3,o=c)),[r,i,a,o,async()=>{try{await rp.actions.drop()}catch(c){console.error(c),$t.error("Error saving component")}},()=>r("./new"),()=>{G1(Xt,i.selectedComponentId=a==null?void 0:a.props._id,i)}]}class jYe extends Ve{constructor(e){super(),Pe(this,e,FYe,NYe,Ie,{})}}function zP(n){let e,t,r;return t=new sn({props:{$$slots:{default:[xYe]},$$scope:{ctx:n}}}),{c(){e=X("div"),O(t.$$.fragment),D(e,"class","label svelte-12naooy")},m(i,a){C(i,e,a),B(t,e,null),r=!0},p(i,a){const o={};a&4194305&&(o.$$scope={dirty:a,ctx:i}),t.$set(o)},i(i){r||(b(t.$$.fragment,i),r=!0)},o(i){$(t.$$.fragment,i),r=!1},d(i){i&&M(e),H(t)}}}function xYe(n){let e;return{c(){e=oe(n[0])},m(t,r){C(t,e,r)},p(t,r){r&1&&gt(e,t[0])},d(t){t&&M(e)}}}function AP(n){let e;return{c(){e=X("div"),D(e,"class","text svelte-12naooy")},m(t,r){C(t,e,r),e.innerHTML=n[8]},p(t,r){r&256&&(e.innerHTML=t[8])},d(t){t&&M(e)}}}function UYe(n){let e,t,r,i,a,o,l,s,u=n[4]!=="boolean"&&n[0]&&zP(n);const c=[{componentInstance:n[1]},{value:n[10]},{updateOnChange:!1},{onChange:n[12]},{bindings:n[9]},{name:n[3]},{text:n[0]},{nested:n[6]},{key:n[3]},{type:n[4]},n[5]];var f=n[2];function h(_){let y={};for(let w=0;w<c.length;w+=1)y=au(y,c[w]);return{props:y}}f&&(i=new f(h()),i.$on("change",n[12]));let m=n[8]&&AP(n);return{c(){e=X("div"),u&&u.c(),t=q(),r=X("div"),i&&O(i.$$.fragment),o=q(),m&&m.c(),D(r,"data-cy",a=`${n[3]}-prop-control`),D(r,"class","control svelte-12naooy"),D(e,"class","property-control svelte-12naooy"),D(e,"data-cy",l=`setting-${n[3]}`),Te(e,"highlighted",n[7]&&n[11])},m(_,y){C(_,e,y),u&&u.m(e,null),x(e,t),x(e,r),i&&B(i,r,null),x(e,o),m&&m.m(e,null),s=!0},p(_,[y]){_[4]!=="boolean"&&_[0]?u?(u.p(_,y),y&17&&b(u,1)):(u=zP(_),u.c(),b(u,1),u.m(e,t)):u&&(we(),$(u,1,1,()=>{u=null}),ke());const w=y&5755?Rd(c,[y&2&&{componentInstance:_[1]},y&1024&&{value:_[10]},c[2],y&4096&&{onChange:_[12]},y&512&&{bindings:_[9]},y&8&&{name:_[3]},y&1&&{text:_[0]},y&64&&{nested:_[6]},y&8&&{key:_[3]},y&16&&{type:_[4]},y&32&&$6(_[5])]):{};if(f!==(f=_[2])){if(i){we();const A=i;$(A.$$.fragment,1,0,()=>{H(A,1)}),ke()}f?(i=new f(h()),i.$on("change",_[12]),O(i.$$.fragment),b(i.$$.fragment,1),B(i,r,null)):i=null}else f&&i.$set(w);(!s||y&8&&a!==(a=`${_[3]}-prop-control`))&&D(r,"data-cy",a),_[8]?m?m.p(_,y):(m=AP(_),m.c(),m.m(e,null)):m&&(m.d(1),m=null),(!s||y&8&&l!==(l=`setting-${_[3]}`))&&D(e,"data-cy",l),y&2176&&Te(e,"highlighted",_[7]&&_[11])},i(_){s||(b(u),i&&b(i.$$.fragment,_),s=!0)},o(_){$(u),i&&$(i.$$.fragment,_),s=!1},d(_){_&&M(e),u&&u.d(),i&&H(i),m&&m.d()}}}function qYe(n,e,t){let r,i,a,o,{label:l=""}=e,{componentInstance:s={}}=e,{control:u=null}=e,{key:c=""}=e,{type:f=""}=e,{value:h=null}=e,{defaultValue:m=null}=e,{props:_={}}=e,{onChange:y=()=>{}}=e,{bindings:w=[]}=e,{componentBindings:A=[]}=e,{nested:S=!1}=e,{highlighted:T=!1}=e,{info:I=null}=e;const P=(U,W,te)=>te?[...W||[],...U||[]]:U,V=U=>{let W=U;U&&typeof U=="object"&&("detail"in U?W=U.detail:"target"in U&&(W=U.target.value)),f==="number"&&(W=parseInt(W)),y(typeof W=="string"?o(W):W)},j=(U,W,te)=>{const Q=P3(te,U);return Q==null&&W!==void 0?W:Q};return g5(()=>{T&&Xt.actions.settings.highlight(null)}),n.$$set=U=>{"label"in U&&t(0,l=U.label),"componentInstance"in U&&t(1,s=U.componentInstance),"control"in U&&t(2,u=U.control),"key"in U&&t(3,c=U.key),"type"in U&&t(4,f=U.type),"value"in U&&t(13,h=U.value),"defaultValue"in U&&t(14,m=U.defaultValue),"props"in U&&t(5,_=U.props),"onChange"in U&&t(15,y=U.onChange),"bindings"in U&&t(16,w=U.bindings),"componentBindings"in U&&t(17,A=U.componentBindings),"nested"in U&&t(6,S=U.nested),"highlighted"in U&&t(7,T=U.highlighted),"info"in U&&t(8,I=U.info)},n.$$.update=()=>{n.$$.dirty&8192&&t(11,r=h==null||h===""),n.$$.dirty&196672&&t(9,i=P(w,A,S)),n.$$.dirty&25088&&t(10,a=j(h,m,i)),n.$$.dirty&1024,n.$$.dirty&512&&(o=U=>Bf(i,U))},[l,s,u,c,f,_,S,T,I,i,a,r,V,h,m,y,w,A]}class F7 extends Ve{constructor(e){super(),Pe(this,e,qYe,UYe,Ie,{label:0,componentInstance:1,control:2,key:3,type:4,value:13,defaultValue:14,props:5,onChange:15,bindings:16,componentBindings:17,nested:6,highlighted:7,info:8})}}class DJ{constructor(e){this._isScreen=e,this._children=[],this._json={}}addChild(e){return this._children.push(e),this}customProps(e){for(let t of Object.keys(e))this._json[t]=e[t];return this}json(){const e=$1.cloneDeep(this._json);if(this._children.length!==0)for(let t of this._children)this._isScreen?e.props._children.push(t.json()):e._children.push(t.json());return e}}class c5 extends DJ{constructor(e){super(!1),this._children=[],this._json={_id:C4(),_component:e,_styles:{normal:{},hover:{},active:{},selected:{}},_instanceName:"",_children:[]}}normalStyle(e){return this._json._styles.normal=e,this}hoverStyle(e){return this._json._styles.hover=e,this}customStyle(e){return this._json._styles.custom=e,this}instanceName(e){return this._json._instanceName=e,this}type(e){return this._json.type=e,this}text(e){return this._json.text=e,this}}function E5(n){return n.split("/").map(e=>(e=decodeURIComponent(e),e=e.replace(/ /g,"-"),e.startsWith(":")||(e=encodeURIComponent(e)),e)).join("/").toLowerCase()}class j7 extends DJ{constructor(){super(!0),this._json={showNavigation:!0,width:"Large",props:{_id:C4(),_component:"@budibase/standard-components/container",_styles:{normal:{},hover:{},active:{},selected:{}},_children:[],_instanceName:"",direction:"column",hAlign:"stretch",vAlign:"top",size:"grow",gap:"M"},routing:{route:"",roleId:"BASIC",homeScreen:!1},name:"screen-id"}}normalStyle(e){return this._json.props._styles.normal=e,this}component(e){return this._json.props._component=e,this}table(e){return this._json.props.table=e,this}route(e){return this._json.routing.route=e,this}name(e){return this._json.name=e,this}instanceName(e){return this._json.props._instanceName=e,this}customProps(e){for(let t of Object.keys(e))this._json.props[t]=e[t];return this}}function WYe(n){return n.map(e=>({name:`${e.name} - New`,create:()=>JYe(e),id:GYe,table:e._id}))}const BJ=n=>E5(`/${n.name}/new/row`),GYe="NEW_ROW_TEMPLATE",YYe=n=>E5(`/${n.name}`),KYe=n=>{let e=[];return Object.entries(n||{}).forEach(([t,r])=>{!t||!r||r!=null&&r.autocolumn||e.push(t)}),e},XYe=n=>{const e={type:"table",tableId:n._id},{schema:t}=h2(null,e,{formSchema:!0}),r=new c5("@budibase/standard-components/formblock");return r.customProps({title:"New row",actionType:"Create",actionUrl:YYe(n),showDeleteButton:!1,showSaveButton:!0,fields:KYe(t),dataSource:{label:n.name,tableId:n._id,type:"table"},labelPosition:"left",size:"spectrum--medium"}).instanceName(`${n.name} - Form block`),r},JYe=n=>{const e=XYe(n);return new j7().instanceName(`${n.name} - New`).route(BJ(n)).addChild(OJ(n.name,"New row")).addChild(e).json()};function ZYe(n){return n.map(e=>({name:`${e.name} - List`,create:()=>tKe(e),id:QYe,table:e._id}))}const QYe="ROW_LIST_TEMPLATE",HJ=n=>E5(`/${n.name}`),eKe=n=>{const e=new c5("@budibase/standard-components/tableblock");return e.customProps({linkRows:!0,linkURL:`${HJ(n)}/:id`,showAutoColumns:!1,showTitleButton:!0,titleButtonText:"Create new",titleButtonURL:BJ(n),title:n.name,dataSource:{label:n.name,name:n._id,tableId:n._id,type:"table"},size:"spectrum--medium",paginate:!0,rowCount:8}).instanceName(`${n.name} - Table block`),e},tKe=n=>new j7().route(HJ(n)).instanceName(`${n.name} - List`).addChild(eKe(n)).json();function Aw(n){return`var(--spectrum-global-color-gray-${n})`}function nKe(n){return new c5("@budibase/standard-components/link").text(n).customProps({url:`/${n.toLowerCase()}`,openInNewTab:!1,color:Aw(700),size:"S",align:"left"})}function OJ(n,e){const t=nKe(n).instanceName("Back Link"),r=new c5("@budibase/standard-components/text").type("none").normalStyle({"margin-right":"4px","margin-left":"4px"}).text(">").instanceName("Arrow").customProps({color:Aw(700),size:"S",align:"left"}),i=new c5("@budibase/standard-components/text").text(e).instanceName("Identifier").customProps({color:Aw(700),size:"S",align:"left"});return new c5("@budibase/standard-components/container").customProps({gap:"N",direction:"row",hAlign:"left",vAlign:"middle",size:"shrink"}).normalStyle({width:"600px","margin-right":"auto","margin-left":"auto"}).instanceName("Breadcrumbs").addChild(t).addChild(r).addChild(i)}const rKe={string:"stringfield",number:"numberfield",options:"optionsfield",array:"multifieldselect",boolean:"booleanfield",longform:"longformfield",datetime:"datetimefield",attachment:"attachmentfield",link:"relationshipfield",json:"jsonfield",barcodeqr:"codescanner"};function iKe(n){const{schema:e}=h2(null,n,{formSchema:!0});let t=[];return Object.keys(e||{}).forEach(i=>{const a=e[i];if(a.autocolumn||a.nestedJSON)return;const o=typeof a=="object"?a.type:a,l=rKe[o],s=`@budibase/standard-components/${l}`;if(l){const u=new c5(s).instanceName(i).customProps({field:i,label:i,placeholder:i});if(o==="options")u.customProps({placeholder:"Choose an option",optionsType:"select",optionsSource:"schema"});else if(o==="longform")u.customProps({format:"auto"});else if(o==="array")u.customProps({placeholder:"Choose an option",optionsSource:"schema"});else if(o==="link"){let c=a.relationshipType==="one-to-many"?"Choose an option":"Choose some options";u.customProps({placeholder:c})}else o==="boolean"?u.customProps({text:i,label:""}):o==="datetime"&&u.customProps({enableTime:!(a!=null&&a.dateOnly),timeOnly:a==null?void 0:a.timeOnly,ignoreTimezones:a.ignoreTimezones});t.push(u)}}),t}function aKe(n){let e;return{c(){e=oe("Update form fields")},m(t,r){C(t,e,r)},d(t){t&&M(e)}}}function oKe(n){let e,t,r,i,a;t=new Sr({props:{secondary:!0,wide:!0,$$slots:{default:[aKe]},$$scope:{ctx:n}}}),t.$on("click",n[3]);let o={body:"All components inside this group will be deleted and replaced with fields to match the schema. Are you sure you want to update this Field Group?",okText:"Update",onOk:n[1],title:"Confirm Form Field Update"};return i=new gl({props:o}),n[4](i),{c(){e=X("div"),O(t.$$.fragment),r=q(),O(i.$$.fragment)},m(l,s){C(l,e,s),B(t,e,null),C(l,r,s),B(i,l,s),a=!0},p(l,[s]){const u={};s&64&&(u.$$scope={dirty:s,ctx:l}),t.$set(u);const c={};i.$set(c)},i(l){a||(b(t.$$.fragment,l),b(i.$$.fragment,l),a=!0)},o(l){$(t.$$.fragment,l),$(i.$$.fragment,l),a=!1},d(l){l&&M(e),H(t),l&&M(r),n[4](null),H(i,l)}}}function lKe(n,e,t){let r;Fe(n,j0,u=>t(5,r=u));let{componentInstance:i}=e,a;const o=async()=>{const u=q_(r==null?void 0:r.props,i._id,h=>h._component.endsWith("/form")),c=u==null?void 0:u.dataSource,f=iKe(c);try{await Xt.actions.components.updateSetting("_children",f.map(h=>h.json()))}catch{$t.error("Error resetting form fields")}},l=()=>a==null?void 0:a.show();function s(u){De[u?"unshift":"push"](()=>{a=u,t(0,a)})}return n.$$set=u=>{"componentInstance"in u&&t(2,i=u.componentInstance)},[a,o,i,l,s]}class sKe extends Ve{constructor(e){super(),Pe(this,e,lKe,oKe,Ie,{componentInstance:2})}}function uKe(n){let e;return{c(){e=oe("Eject block")},m(t,r){C(t,e,r)},d(t){t&&M(e)}}}function cKe(n){let e,t,r;return t=new Sr({props:{secondary:!0,$$slots:{default:[uKe]},$$scope:{ctx:n}}}),t.$on("click",n[0]),{c(){e=X("div"),O(t.$$.fragment)},m(i,a){C(i,e,a),B(t,e,null),r=!0},p(i,[a]){const o={};a&2&&(o.$$scope={dirty:a,ctx:i}),t.$set(o)},i(i){r||(b(t.$$.fragment,i),r=!0)},o(i){$(t.$$.fragment,i),r=!1},d(i){i&&M(e),H(t)}}}function fKe(n){return[()=>{document.dispatchEvent(new KeyboardEvent("keydown",{key:"e",ctrlKey:!0}))}]}class pKe extends Ve{constructor(e){super(),Pe(this,e,fKe,cKe,Ie,{})}}function MP(n,e,t){const r=n.slice();return r[12]=e[t],r[13]=e,r[14]=t,r}function dKe(n){let e;return{c(){e=oe("Bindings")},m(t,r){C(t,e,r)},d(t){t&&M(e)}}}function CP(n){let e,t;return e=new _n({props:{secondary:!0,$$slots:{default:[hKe]},$$scope:{ctx:n}}}),e.$on("click",n[4]),{c(){O(e.$$.fragment)},m(r,i){B(e,r,i),t=!0},p(r,i){const a={};i&32768&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){t||(b(e.$$.fragment,r),t=!0)},o(r){$(e.$$.fragment,r),t=!1},d(r){H(e,r)}}}function hKe(n){let e;return{c(){e=oe("Add Binding")},m(t,r){C(t,e,r)},d(t){t&&M(e)}}}function mKe(n){let e;return{c(){e=oe(`Enter a value for each binding. The default values will be used for any
873
+ to confirm.`,m=q(),O(_.$$.fragment),D(c,"class","delete-items svelte-1ogygrq")},m(P,V){C(P,e,V),x(e,t),x(e,r),x(r,a),x(r,o),x(e,l),C(P,s,V),C(P,u,V),x(u,c);for(let j=0;j<S.length;j+=1)S[j].m(c,null);C(P,f,V),C(P,h,V),C(P,m,V),B(_,P,V),w=!0},p(P,V){if((!w||V&1)&&i!==(i=P[0].name+"")&&gt(a,i),V&32){A=P[5];let U;for(U=0;U<A.length;U+=1){const W=RI(P,A,U);S[U]?S[U].p(W,V):(S[U]=jI(W),S[U].c(),S[U].m(c,null))}for(;U<S.length;U+=1)S[U].d(1);S.length=A.length}const j={};V&1&&(j.placeholder=P[0].name),!y&&V&64&&(y=!0,j.value=P[6],rt(()=>y=!1)),_.$set(j)},i(P){w||(b(_.$$.fragment,P),w=!0)},o(P){$(_.$$.fragment,P),w=!1},d(P){P&&M(e),P&&M(s),P&&M(u),Bn(S,P),P&&M(f),P&&M(h),P&&M(m),H(_,P)}}}function nGe(n){let e,t,r,i,a,o=n[7]&&NI(n),l={$$slots:{default:[eGe]},$$scope:{ctx:n}};t=new rr({props:l}),n[15](t);let s={okText:"Delete Table",onOk:n[10],onCancel:n[11],title:"Confirm Deletion",disabled:n[6]!==n[0].name,$$slots:{default:[tGe]},$$scope:{ctx:n}};return i=new gl({props:s}),n[17](i),{c(){o&&o.c(),e=q(),O(t.$$.fragment),r=q(),O(i.$$.fragment)},m(u,c){o&&o.m(u,c),C(u,e,c),B(t,u,c),C(u,r,c),B(i,u,c),a=!0},p(u,[c]){u[7]?o?(o.p(u,c),c&128&&b(o,1)):(o=NI(u),o.c(),b(o,1),o.m(e.parentNode,e)):o&&(we(),$(o,1,1,()=>{o=null}),ke());const f={};c&33554449&&(f.$$scope={dirty:c,ctx:u}),t.$set(f);const h={};c&65&&(h.disabled=u[6]!==u[0].name),c&33554529&&(h.$$scope={dirty:c,ctx:u}),i.$set(h)},i(u){a||(b(o),b(t.$$.fragment,u),b(i.$$.fragment,u),a=!0)},o(u){$(o),$(t.$$.fragment,u),$(i.$$.fragment,u),a=!1},d(u){o&&o.d(u),u&&M(e),n[15](null),H(t,u),u&&M(r),n[17](null),H(i,u)}}}function rGe(n,e,t){let r,i,a,o,l;Fe(n,ci,W=>t(19,a=W)),Fe(n,Br,W=>t(20,o=W)),Fe(n,Xt,W=>t(21,l=W));let{table:s}=e,u,c,f="",h=s.name,m,_,y;function w(){m=l.screens.filter(W=>W.autoTableId===s._id),t(5,_=["All table data"].concat(m.map(W=>`Screen ${W.props._instanceName}`))),c.show()}async function A(){const W=o.selected;try{await Br.delete(s),await Xt.actions.screens.delete(m),await Br.fetch(),s.type==="external"&&await Bi.fetch(),$t.success("Table deleted"),W&&W._id===s._id&&a("./table")}catch{$t.error("Error deleting table")}}function S(){t(6,y="")}async function T(){await Br.save(s),$t.success("Table renamed successfully")}function I(W){const te=W.target.value;t(4,f=h===te?`Table with name ${te} already exists. Please choose another name.`:"")}function P(W){n.$$.not_equal(s.name,W)&&(s.name=W,t(0,s))}function V(W){De[W?"unshift":"push"](()=>{u=W,t(2,u)})}function j(W){y=W,t(6,y)}function U(W){De[W?"unshift":"push"](()=>{c=W,t(3,c)})}return n.$$set=W=>{"table"in W&&t(0,s=W.table)},n.$$.update=()=>{n.$$.dirty&1&&t(1,r=(s==null?void 0:s.type)==="external"),n.$$.dirty&3&&t(7,i=!r||(s==null?void 0:s.created))},[s,r,u,c,f,_,y,i,h,w,A,S,T,I,P,V,j,U]}class iGe extends Ve{constructor(e){super(),Pe(this,e,rGe,nGe,Ie,{table:0})}}function aGe(n){let e;return{c(){e=oe("Edit")},m(t,r){C(t,e,r)},d(t){t&&M(e)}}}function oGe(n){let e;return{c(){e=oe("Delete")},m(t,r){C(t,e,r)},d(t){t&&M(e)}}}function lGe(n){let e,t,r,i;return e=new ei({props:{icon:"Edit",$$slots:{default:[aGe]},$$scope:{ctx:n}}}),e.$on("click",function(){kn(n[1].show)&&n[1].show.apply(this,arguments)}),r=new ei({props:{icon:"Delete",$$slots:{default:[oGe]},$$scope:{ctx:n}}}),r.$on("click",function(){kn(n[2].show)&&n[2].show.apply(this,arguments)}),{c(){O(e.$$.fragment),t=q(),O(r.$$.fragment)},m(a,o){B(e,a,o),C(a,t,o),B(r,a,o),i=!0},p(a,o){n=a;const l={};o&1024&&(l.$$scope={dirty:o,ctx:n}),e.$set(l);const s={};o&1024&&(s.$$scope={dirty:o,ctx:n}),r.$set(s)},i(a){i||(b(e.$$.fragment,a),b(r.$$.fragment,a),i=!0)},o(a){$(e.$$.fragment,a),$(r.$$.fragment,a),i=!1},d(a){H(e,a),a&&M(t),H(r,a)}}}function sGe(n){let e,t,r;return t=new un({props:{s:!0,hoverable:!0,name:"MoreSmallList"}}),{c(){e=X("div"),O(t.$$.fragment),D(e,"slot","control"),D(e,"class","icon open-popover")},m(i,a){C(i,e,a),B(t,e,null),r=!0},p:ht,i(i){r||(b(t.$$.fragment,i),r=!0)},o(i){$(t.$$.fragment,i),r=!1},d(i){i&&M(e),H(t)}}}function uGe(n){let e,t,r;function i(o){n[5](o)}let a={label:"View Name",thin:!0};return n[0].name!==void 0&&(a.value=n[0].name),e=new Mn({props:a}),De.push(()=>nt(e,"value",i)),{c(){O(e.$$.fragment)},m(o,l){B(e,o,l),r=!0},p(o,l){const s={};!t&&l&1&&(t=!0,s.value=o[0].name,rt(()=>t=!1)),e.$set(s)},i(o){r||(b(e.$$.fragment,o),r=!0)},o(o){$(e.$$.fragment,o),r=!1},d(o){H(e,o)}}}function cGe(n){let e,t;return e=new gr({props:{title:"Edit View",onConfirm:n[3],confirmText:"Save",$$slots:{default:[uGe]},$$scope:{ctx:n}}}),{c(){O(e.$$.fragment)},m(r,i){B(e,r,i),t=!0},p(r,i){const a={};i&1025&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){t||(b(e.$$.fragment,r),t=!0)},o(r){$(e.$$.fragment,r),t=!1},d(r){H(e,r)}}}function fGe(n){let e,t,r,i,a,o;e=new ou({props:{$$slots:{control:[sGe],default:[lGe]},$$scope:{ctx:n}}});let l={$$slots:{default:[cGe]},$$scope:{ctx:n}};r=new rr({props:l}),n[6](r);let s={body:`Are you sure you wish to delete the view '${n[0].name}'? Your data will be deleted and this action cannot be undone.`,okText:"Delete View",onOk:n[4],title:"Confirm Deletion"};return a=new gl({props:s}),n[7](a),{c(){O(e.$$.fragment),t=q(),O(r.$$.fragment),i=q(),O(a.$$.fragment)},m(u,c){B(e,u,c),C(u,t,c),B(r,u,c),C(u,i,c),B(a,u,c),o=!0},p(u,[c]){const f={};c&1030&&(f.$$scope={dirty:c,ctx:u}),e.$set(f);const h={};c&1025&&(h.$$scope={dirty:c,ctx:u}),r.$set(h);const m={};c&1&&(m.body=`Are you sure you wish to delete the view '${u[0].name}'? Your data will be deleted and this action cannot be undone.`),a.$set(m)},i(u){o||(b(e.$$.fragment,u),b(r.$$.fragment,u),b(a.$$.fragment,u),o=!0)},o(u){$(e.$$.fragment,u),$(r.$$.fragment,u),$(a.$$.fragment,u),o=!1},d(u){H(e,u),u&&M(t),n[6](null),H(r,u),u&&M(i),n[7](null),H(a,u)}}}function pGe(n,e,t){let r;Fe(n,ci,m=>t(8,r=m));let{view:i}=e,a,o=i.name,l;async function s(){await Nu.save({originalName:o,...i}),$t.success("View renamed successfully")}async function u(){try{const m=i.name,_=i.tableId;await Nu.delete(m),$t.success("View deleted"),r(`./table/${_}`)}catch{$t.error("Error deleting view")}}function c(m){n.$$.not_equal(i.name,m)&&(i.name=m,t(0,i))}function f(m){De[m?"unshift":"push"](()=>{a=m,t(1,a)})}function h(m){De[m?"unshift":"push"](()=>{l=m,t(2,l)})}return n.$$set=m=>{"view"in m&&t(0,i=m.view)},[i,a,l,s,u,c,f,h]}class dGe extends Ve{constructor(e){super(),Pe(this,e,pGe,fGe,Ie,{view:0})}}function xI(n,e,t){const r=n.slice();return r[13]=e[t],r[15]=t,r}function UI(n,e,t){const r=n.slice();return r[16]=e[t],r[15]=t,r}function qI(n){let e,t,r=n[2],i=[];for(let o=0;o<r.length;o+=1)i[o]=YI(xI(n,r,o));const a=o=>$(i[o],1,1,()=>{i[o]=null});return{c(){e=X("div");for(let o=0;o<i.length;o+=1)i[o].c();D(e,"class","hierarchy-items-container")},m(o,l){C(o,e,l);for(let s=0;s<i.length;s+=1)i[s].m(e,null);t=!0},p(o,l){if(l&55){r=o[2];let s;for(s=0;s<r.length;s+=1){const u=xI(o,r,s);i[s]?(i[s].p(u,l),b(i[s],1)):(i[s]=YI(u),i[s].c(),b(i[s],1),i[s].m(e,null))}for(we(),s=r.length;s<i.length;s+=1)a(s);ke()}},i(o){if(!t){for(let l=0;l<r.length;l+=1)b(i[l]);t=!0}},o(o){i=i.filter(Boolean);for(let l=0;l<i.length;l+=1)$(i[l]);t=!1},d(o){o&&M(e),Bn(i,o)}}}function WI(n){let e,t;return e=new iGe({props:{table:n[13]}}),{c(){O(e.$$.fragment)},m(r,i){B(e,r,i),t=!0},p(r,i){const a={};i&4&&(a.table=r[13]),e.$set(a)},i(r){t||(b(e.$$.fragment,r),t=!0)},o(r){$(e.$$.fragment,r),t=!1},d(r){H(e,r)}}}function hGe(n){let e,t,r=n[13]._id!==z4.USERS&&WI(n);return{c(){r&&r.c(),e=yt()},m(i,a){r&&r.m(i,a),C(i,e,a),t=!0},p(i,a){i[13]._id!==z4.USERS?r?(r.p(i,a),a&4&&b(r,1)):(r=WI(i),r.c(),b(r,1),r.m(e.parentNode,e)):r&&(we(),$(r,1,1,()=>{r=null}),ke())},i(i){t||(b(r),t=!0)},o(i){$(r),t=!1},d(i){r&&r.d(i),i&&M(e)}}}function mGe(n){let e,t,r;return e=new dGe({props:{view:{name:n[16],...n[13].views[n[16]]}}}),{c(){O(e.$$.fragment),t=q()},m(i,a){B(e,i,a),C(i,t,a),r=!0},p(i,a){const o={};a&4&&(o.view={name:i[16],...i[13].views[i[16]]}),e.$set(o)},i(i){r||(b(e.$$.fragment,i),r=!0)},o(i){$(e.$$.fragment,i),r=!1},d(i){H(e,i),i&&M(t)}}}function GI(n,e){let t,r,i;function a(){return e[9](e[13],e[16])}return r=new L5({props:{indentLevel:2,icon:"Remove",text:e[16],selected:e[1]===e[16],$$slots:{default:[mGe]},$$scope:{ctx:e}}}),r.$on("click",a),{key:n,first:null,c(){t=yt(),O(r.$$.fragment),this.first=t},m(o,l){C(o,t,l),B(r,o,l),i=!0},p(o,l){e=o;const s={};l&4&&(s.text=e[16]),l&6&&(s.selected=e[1]===e[16]),l&262148&&(s.$$scope={dirty:l,ctx:e}),r.$set(s)},i(o){i||(b(r.$$.fragment,o),i=!0)},o(o){$(r.$$.fragment,o),i=!1},d(o){o&&M(t),H(r,o)}}}function YI(n){var c;let e,t,r=[],i=new Map,a,o;function l(){return n[8](n[13])}e=new L5({props:{indentLevel:1,border:n[15]>0,icon:n[13]._id===z4.USERS?"UserGroup":"Table",text:n[13].name,selected:((c=n[0].selected)==null?void 0:c._id)===n[13]._id,$$slots:{default:[hGe]},$$scope:{ctx:n}}}),e.$on("click",l);let s=[...Object.keys(n[13].views||{})].sort();const u=f=>f[15];for(let f=0;f<s.length;f+=1){let h=UI(n,s,f),m=u(h);i.set(m,r[f]=GI(m,h))}return{c(){O(e.$$.fragment),t=q();for(let f=0;f<r.length;f+=1)r[f].c();a=yt()},m(f,h){B(e,f,h),C(f,t,h);for(let m=0;m<r.length;m+=1)r[m].m(f,h);C(f,a,h),o=!0},p(f,h){var _;n=f;const m={};h&4&&(m.icon=n[13]._id===z4.USERS?"UserGroup":"Table"),h&4&&(m.text=n[13].name),h&5&&(m.selected=((_=n[0].selected)==null?void 0:_._id)===n[13]._id),h&262148&&(m.$$scope={dirty:h,ctx:n}),e.$set(m),h&38&&(s=[...Object.keys(n[13].views||{})].sort(),we(),r=Pl(r,h,u,1,n,s,i,a.parentNode,Mc,GI,a,UI),ke())},i(f){if(!o){b(e.$$.fragment,f);for(let h=0;h<s.length;h+=1)b(r[h]);o=!0}},o(f){$(e.$$.fragment,f);for(let h=0;h<r.length;h+=1)$(r[h]);o=!1},d(f){H(e,f),f&&M(t);for(let h=0;h<r.length;h+=1)r[h].d(f);f&&M(a)}}}function gGe(n){var i;let e,t,r=((i=n[3])==null?void 0:i._id)&&qI(n);return{c(){r&&r.c(),e=yt()},m(a,o){r&&r.m(a,o),C(a,e,o),t=!0},p(a,[o]){var l;(l=a[3])!=null&&l._id?r?(r.p(a,o),o&8&&b(r,1)):(r=qI(a),r.c(),b(r,1),r.m(e.parentNode,e)):r&&(we(),$(r,1,1,()=>{r=null}),ke())},i(a){t||(b(r),t=!0)},o(a){$(r),t=!1},d(a){r&&r.d(a),a&&M(e)}}}function vGe(n,e,t){let r,i,a,o,l,s;Fe(n,ci,w=>t(10,a=w)),Fe(n,Br,w=>t(0,o=w)),Fe(n,Nu,w=>t(7,l=w)),Fe(n,Wd,w=>t(3,s=w));const u=(w,A)=>{var S,T;return((S=w.name)==null?void 0:S.toLowerCase())>((T=A.name)==null?void 0:T.toLowerCase())};let{sourceId:c}=e;function f(w){Br.select(w),a(`./table/${w._id}`)}function h(w){Nu.select(w),a(`./view/${w.name}`)}function m(w,A){r!==A&&h({name:A,...w.views[A]})}const _=w=>f(w),y=(w,A)=>m(w,A);return n.$$set=w=>{"sourceId"in w&&t(6,c=w.sourceId)},n.$$.update=()=>{n.$$.dirty&128&&t(1,r=l.selected&&l.selected.name),n.$$.dirty&65&&t(2,i=o.list.filter(w=>w.sourceId===c).sort(u))},[o,r,i,s,f,m,c,l,_,y]}class _Ge extends Ve{constructor(e){super(),Pe(this,e,vGe,gGe,Ie,{sourceId:6})}}function KI(n,e,t){const r=n.slice();return r[18]=e[t],r[20]=t,r}function XI(n,e,t){const r=n.slice();return r[21]=e[t],r}function JI(n){let e,t,r=n[0],i=[];for(let o=0;o<r.length;o+=1)i[o]=tP(KI(n,r,o));const a=o=>$(i[o],1,1,()=>{i[o]=null});return{c(){e=X("div");for(let o=0;o<i.length;o+=1)i[o].c();D(e,"class","hierarchy-items-container")},m(o,l){C(o,e,l);for(let s=0;s<i.length;s+=1)i[s].m(e,null);t=!0},p(o,l){if(l&61){r=o[0];let s;for(s=0;s<r.length;s+=1){const u=KI(o,r,s);i[s]?(i[s].p(u,l),b(i[s],1)):(i[s]=tP(u),i[s].c(),b(i[s],1),i[s].m(e,null))}for(we(),s=r.length;s<i.length;s+=1)a(s);ke()}},i(o){if(!t){for(let l=0;l<r.length;l+=1)b(i[l]);t=!0}},o(o){i=i.filter(Boolean);for(let l=0;l<i.length;l+=1)$(i[l]);t=!1},d(o){o&&M(e),Bn(i,o)}}}function ZI(n){let e,t;return e=new HWe({props:{datasource:n[18]}}),{c(){O(e.$$.fragment)},m(r,i){B(e,r,i),t=!0},p(r,i){const a={};i&1&&(a.datasource=r[18]),e.$set(a)},i(r){t||(b(e.$$.fragment,r),t=!0)},o(r){$(e.$$.fragment,r),t=!1},d(r){H(e,r)}}}function bGe(n){let e,t,r=n[18]._id!==iw&&ZI(n);return{c(){r&&r.c(),e=yt()},m(i,a){r&&r.m(i,a),C(i,e,a),t=!0},p(i,a){i[18]._id!==iw?r?(r.p(i,a),a&1&&b(r,1)):(r=ZI(i),r.c(),b(r,1),r.m(e.parentNode,e)):r&&(we(),$(r,1,1,()=>{r=null}),ke())},i(i){t||(b(r),t=!0)},o(i){$(r),t=!1},d(i){r&&r.d(i),i&&M(e)}}}function yGe(n){let e,t,r;return t=new kJ({props:{integrationType:n[18].source,schema:n[18].schema,size:"18"}}),{c(){e=X("div"),O(t.$$.fragment),D(e,"class","datasource-icon svelte-11am1jd"),D(e,"slot","icon")},m(i,a){C(i,e,a),B(t,e,null),r=!0},p(i,a){const o={};a&1&&(o.integrationType=i[18].source),a&1&&(o.schema=i[18].schema),t.$set(o)},i(i){r||(b(t.$$.fragment,i),r=!0)},o(i){$(t.$$.fragment,i),r=!1},d(i){i&&M(e),H(t)}}}function QI(n){let e,t,r,i;e=new _Ge({props:{sourceId:n[18]._id}});function a(...u){return n[11](n[18],...u)}let o=n[2].list.filter(a),l=[];for(let u=0;u<o.length;u+=1)l[u]=eP(XI(n,o,u));const s=u=>$(l[u],1,1,()=>{l[u]=null});return{c(){O(e.$$.fragment),t=q();for(let u=0;u<l.length;u+=1)l[u].c();r=yt()},m(u,c){B(e,u,c),C(u,t,c);for(let f=0;f<l.length;f+=1)l[f].m(u,c);C(u,r,c),i=!0},p(u,c){n=u;const f={};if(c&1&&(f.sourceId=n[18]._id),e.$set(f),c&21){o=n[2].list.filter(a);let h;for(h=0;h<o.length;h+=1){const m=XI(n,o,h);l[h]?(l[h].p(m,c),b(l[h],1)):(l[h]=eP(m),l[h].c(),b(l[h],1),l[h].m(r.parentNode,r))}for(we(),h=o.length;h<l.length;h+=1)s(h);ke()}},i(u){if(!i){b(e.$$.fragment,u);for(let c=0;c<o.length;c+=1)b(l[c]);i=!0}},o(u){$(e.$$.fragment,u),l=l.filter(Boolean);for(let c=0;c<l.length;c+=1)$(l[c]);i=!1},d(u){H(e,u),u&&M(t),Bn(l,u),u&&M(r)}}}function $Ge(n){let e,t,r;return e=new jWe({props:{query:n[21],onClickQuery:n[4]}}),{c(){O(e.$$.fragment),t=q()},m(i,a){B(e,i,a),C(i,t,a),r=!0},p(i,a){const o={};a&5&&(o.query=i[21]),e.$set(o)},i(i){r||(b(e.$$.fragment,i),r=!0)},o(i){$(e.$$.fragment,i),r=!1},d(i){H(e,i),i&&M(t)}}}function eP(n){let e,t;function r(){return n[12](n[21])}return e=new L5({props:{indentLevel:1,icon:"SQLQuery",iconText:fH(n[18],n[21]),iconColor:pH(n[18],n[21]),text:dH(n[18],n[21]),opened:n[2].selected===n[21]._id,selected:n[2].selected===n[21]._id,$$slots:{default:[$Ge]},$$scope:{ctx:n}}}),e.$on("click",r),{c(){O(e.$$.fragment)},m(i,a){B(e,i,a),t=!0},p(i,a){n=i;const o={};a&5&&(o.iconText=fH(n[18],n[21])),a&5&&(o.iconColor=pH(n[18],n[21])),a&5&&(o.text=dH(n[18],n[21])),a&5&&(o.opened=n[2].selected===n[21]._id),a&5&&(o.selected=n[2].selected===n[21]._id),a&16777221&&(o.$$scope={dirty:a,ctx:n}),e.$set(o)},i(i){t||(b(e.$$.fragment,i),t=!0)},o(i){$(e.$$.fragment,i),t=!1},d(i){H(e,i)}}}function tP(n){let e,t,r,i;function a(){return n[9](n[18])}function o(){return n[10](n[18])}e=new L5({props:{border:n[20]>0,text:n[18].name,opened:n[18].open,selected:n[18].selected,withArrow:!0,$$slots:{icon:[yGe],default:[bGe]},$$scope:{ctx:n}}}),e.$on("click",a),e.$on("iconClick",o);let l=n[18].open&&QI(n);return{c(){O(e.$$.fragment),t=q(),l&&l.c(),r=yt()},m(s,u){B(e,s,u),C(s,t,u),l&&l.m(s,u),C(s,r,u),i=!0},p(s,u){n=s;const c={};u&1&&(c.text=n[18].name),u&1&&(c.opened=n[18].open),u&1&&(c.selected=n[18].selected),u&16777217&&(c.$$scope={dirty:u,ctx:n}),e.$set(c),n[18].open?l?(l.p(n,u),u&1&&b(l,1)):(l=QI(n),l.c(),b(l,1),l.m(r.parentNode,r)):l&&(we(),$(l,1,1,()=>{l=null}),ke())},i(s){i||(b(e.$$.fragment,s),b(l),i=!0)},o(s){$(e.$$.fragment,s),$(l),i=!1},d(s){H(e,s),s&&M(t),l&&l.d(s),s&&M(r)}}}function wGe(n){var i;let e,t,r=((i=n[1])==null?void 0:i._id)&&JI(n);return{c(){r&&r.c(),e=yt()},m(a,o){r&&r.m(a,o),C(a,e,o),t=!0},p(a,[o]){var l;(l=a[1])!=null&&l._id?r?(r.p(a,o),o&2&&b(r,1)):(r=JI(a),r.c(),b(r,1),r.m(e.parentNode,e)):r&&(we(),$(r,1,1,()=>{r=null}),ke())},i(a){t||(b(r),t=!0)},o(a){$(r),t=!1},d(a){r&&r.d(a),a&&M(e)}}}function kGe(n,e,t){let r,i,a,o,l,s,u;Fe(n,Cc,P=>t(13,a=P)),Fe(n,ci,P=>t(14,o=P)),Fe(n,Bi,P=>t(8,l=P)),Fe(n,Wd,P=>t(1,s=P)),Fe(n,ya,P=>t(2,u=P));let c=[];function f(P){_(P),Bi.select(P._id),o(`./datasource/${P._id}`)}function h(P){ya.select(P),o(`./datasource/${P.datasourceId}/${P._id}`)}function m(P){t(6,c=c.filter(V=>P._id!==V))}function _(P){c.includes(P._id)||t(6,c=[...c,P._id])}function y(P){c.includes(P._id)?m(P):_(P)}ar(async()=>{try{await Bi.fetch(),await ya.fetch()}catch{$t.error("Error fetching datasources and queries")}});const w=P=>{var W,te;if(a.selectedDatasource===P._id)return!0;if(!P.entities)return!1;let V=P.entities;if(Array.isArray(V)||(V=Object.values(V)),a.selectedTable){const Q=(W=pn(Br).selected)==null?void 0:W._id;return V.find(le=>le._id===Q)!=null}const j=(te=pn(Nu).selected)==null?void 0:te.name;return V.find(Q=>{var le;return((le=Q.views)==null?void 0:le[j])!=null})!=null},A=P=>f(P),S=P=>y(P),T=(P,V)=>V.datasourceId===P._id,I=P=>h(P);return n.$$.update=()=>{n.$$.dirty&320&&t(0,r=Array.isArray(l.list)?l.list.map(P=>{const V=l.selected===P._id,j=c.includes(P._id),U=w(P),W=l.list.length===1;return{...P,selected:V,open:V||j||U||W}}):[]),n.$$.dirty&1&&t(7,i=r.find(P=>P.open)),n.$$.dirty&128&&i&&_(i)},[r,s,u,f,h,y,c,i,l,A,S,T,I]}class zGe extends Ve{constructor(e){super(),Pe(this,e,kGe,wGe,Ie,{})}}function AGe(n){let e,t,r,i,a;e=new zGe({});function o(s){n[5](s)}let l={};return n[0]!==void 0&&(l.modal=n[0]),r=new AJ({props:l}),De.push(()=>nt(r,"modal",o)),{c(){O(e.$$.fragment),t=q(),O(r.$$.fragment)},m(s,u){B(e,s,u),C(s,t,u),B(r,s,u),a=!0},p(s,u){const c={};!i&&u&1&&(i=!0,c.modal=s[0],rt(()=>i=!1)),r.$set(c)},i(s){a||(b(e.$$.fragment,s),b(r.$$.fragment,s),a=!0)},o(s){$(e.$$.fragment,s),$(r.$$.fragment,s),a=!1},d(s){H(e,s),s&&M(t),H(r,s)}}}function MGe(n){let e,t;return e=new B1({props:{title:"Sources",$$slots:{default:[AGe]},$$scope:{ctx:n}}}),{c(){O(e.$$.fragment)},m(r,i){B(e,r,i),t=!0},p(r,i){const a={};i&65&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){t||(b(e.$$.fragment,r),t=!0)},o(r){$(e.$$.fragment,r),t=!1},d(r){H(e,r)}}}function nP(n){let e,t;return e=new un({props:{hoverable:!0,name:"AddCircle"}}),e.$on("click",function(){kn(n[0].show)&&n[0].show.apply(this,arguments)}),{c(){O(e.$$.fragment)},m(r,i){B(e,r,i),t=!0},p(r,i){n=r},i(r){t||(b(e.$$.fragment,r),t=!0)},o(r){$(e.$$.fragment,r),t=!1},d(r){H(e,r)}}}function CGe(n){let e,t,r,i,a,o,l,s,u;r=new X2({props:{selected:SGe,$$slots:{default:[MGe]},$$scope:{ctx:n}}}),r.$on("select",n[2]);let c=n[0]&&nP(n);const f=n[4].default,h=Xn(f,n,n[6],null);return{c(){e=X("div"),t=X("div"),O(r.$$.fragment),i=q(),a=X("div"),c&&c.c(),l=q(),s=X("div"),h&&h.c(),D(a,"class","add-button svelte-1oe3r6d"),D(a,"data-cy",o=`new-${n[1]?"datasource":"table"}`),D(t,"class","nav svelte-1oe3r6d"),D(s,"class","content svelte-1oe3r6d"),D(e,"class","root svelte-1oe3r6d")},m(m,_){C(m,e,_),x(e,t),B(r,t,null),x(t,i),x(t,a),c&&c.m(a,null),x(e,l),x(e,s),h&&h.m(s,null),u=!0},p(m,[_]){const y={};_&65&&(y.$$scope={dirty:_,ctx:m}),r.$set(y),m[0]?c?(c.p(m,_),_&1&&b(c,1)):(c=nP(m),c.c(),b(c,1),c.m(a,null)):c&&(we(),$(c,1,1,()=>{c=null}),ke()),(!u||_&2&&o!==(o=`new-${m[1]?"datasource":"table"}`))&&D(a,"data-cy",o),h&&h.p&&(!u||_&64)&&Zn(h,f,m,m[6],u?Jn(f,m[6],_,null):Qn(m[6]),null)},i(m){u||(b(r.$$.fragment,m),b(c),b(h,m),u=!0)},o(m){$(r.$$.fragment,m),$(c),$(h,m),u=!1},d(m){m&&M(e),H(r),c&&c.d(),h&&h.d(m)}}}let SGe="Sources";function LGe(n,e,t){let r,i,a;Fe(n,ca,f=>t(7,i=f)),Fe(n,Cc,f=>t(3,a=f));let{$$slots:o={},$$scope:l}=e,s;function u(){i("./table")}function c(f){s=f,t(0,s)}return n.$$set=f=>{"$$scope"in f&&t(6,l=f.$$scope)},n.$$.update=()=>{n.$$.dirty&8&&t(1,r=a.selectedDatasource&&a.selectedDatasource!==iw)},[s,r,u,a,o,c,l]}class EGe extends Ve{constructor(e){super(),Pe(this,e,LGe,CGe,Ie,{})}}function TGe(n,e,t){let r;return Fe(n,ca,i=>t(0,r=i)),r("../screens"),[]}class DGe extends Ve{constructor(e){super(),Pe(this,e,TGe,null,Ie,{})}}class BGe extends Ve{constructor(e){super(),Pe(this,e,null,null,Ie,{})}}function rP(n){let e,t;return e=new un({props:{name:"ArrowLeft",hoverable:!0}}),e.$on("click",function(){kn(n[7])&&n[7].apply(this,arguments)}),{c(){O(e.$$.fragment)},m(r,i){B(e,r,i),t=!0},p(r,i){n=r},i(r){t||(b(e.$$.fragment,r),t=!0)},o(r){$(e.$$.fragment,r),t=!1},d(r){H(e,r)}}}function iP(n){let e,t;return e=new un({props:{name:n[1]}}),{c(){O(e.$$.fragment)},m(r,i){B(e,r,i),t=!0},p(r,i){const a={};i&2&&(a.name=r[1]),e.$set(a)},i(r){t||(b(e.$$.fragment,r),t=!0)},o(r){$(e.$$.fragment,r),t=!1},d(r){H(e,r)}}}function HGe(n){let e=(n[0]||"")+"",t;return{c(){t=oe(e)},m(r,i){C(r,t,i)},p(r,i){i&1&&e!==(e=(r[0]||"")+"")&&gt(t,e)},d(r){r&&M(t)}}}function aP(n){let e,t;return e=new un({props:{name:n[11]?"Minimize":"Maximize",hoverable:!0}}),e.$on("click",n[13]),{c(){O(e.$$.fragment)},m(r,i){B(e,r,i),t=!0},p(r,i){const a={};i&2048&&(a.name=r[11]?"Minimize":"Maximize"),e.$set(a)},i(r){t||(b(e.$$.fragment,r),t=!0)},o(r){$(e.$$.fragment,r),t=!1},d(r){H(e,r)}}}function oP(n){let e,t,r,i,a;return t=new un({props:{name:"Add"}}),{c(){e=X("div"),O(t.$$.fragment),D(e,"class","add-button svelte-1bxbycf")},m(o,l){C(o,e,l),B(t,e,null),r=!0,i||(a=At(e,"click",function(){kn(n[6])&&n[6].apply(this,arguments)}),i=!0)},p(o,l){n=o},i(o){r||(b(t.$$.fragment,o),r=!0)},o(o){$(t.$$.fragment,o),r=!1},d(o){o&&M(e),H(t),i=!1,a()}}}function lP(n){let e,t;return e=new un({props:{name:"Close",hoverable:!0}}),e.$on("click",function(){kn(n[8])&&n[8].apply(this,arguments)}),{c(){O(e.$$.fragment)},m(r,i){B(e,r,i),t=!0},p(r,i){n=r},i(r){t||(b(e.$$.fragment,r),t=!0)},o(r){$(e.$$.fragment,r),t=!1},d(r){H(e,r)}}}function OGe(n){let e,t,r,i,a,o,l,s,u,c,f,h,m=n[4]&&rP(n),_=n[1]&&iP(n);o=new In({props:{size:"XXS",$$slots:{default:[HGe]},$$scope:{ctx:n}}});let y=n[2]&&aP(n),w=n[3]&&oP(n),A=n[5]&&lP(n);const S=n[12].default,T=Xn(S,n,n[14],null);return{c(){e=X("div"),t=X("div"),m&&m.c(),r=q(),_&&_.c(),i=q(),a=X("div"),O(o.$$.fragment),l=q(),y&&y.c(),s=q(),w&&w.c(),u=q(),A&&A.c(),c=q(),f=X("div"),T&&T.c(),D(a,"class","title svelte-1bxbycf"),D(t,"class","header svelte-1bxbycf"),D(f,"class","body svelte-1bxbycf"),D(e,"class","panel svelte-1bxbycf"),Te(e,"wide",n[11]),Te(e,"borderLeft",n[9]),Te(e,"borderRight",n[10])},m(I,P){C(I,e,P),x(e,t),m&&m.m(t,null),x(t,r),_&&_.m(t,null),x(t,i),x(t,a),B(o,a,null),x(t,l),y&&y.m(t,null),x(t,s),w&&w.m(t,null),x(t,u),A&&A.m(t,null),x(e,c),x(e,f),T&&T.m(f,null),h=!0},p(I,[P]){I[4]?m?(m.p(I,P),P&16&&b(m,1)):(m=rP(I),m.c(),b(m,1),m.m(t,r)):m&&(we(),$(m,1,1,()=>{m=null}),ke()),I[1]?_?(_.p(I,P),P&2&&b(_,1)):(_=iP(I),_.c(),b(_,1),_.m(t,i)):_&&(we(),$(_,1,1,()=>{_=null}),ke());const V={};P&16385&&(V.$$scope={dirty:P,ctx:I}),o.$set(V),I[2]?y?(y.p(I,P),P&4&&b(y,1)):(y=aP(I),y.c(),b(y,1),y.m(t,s)):y&&(we(),$(y,1,1,()=>{y=null}),ke()),I[3]?w?(w.p(I,P),P&8&&b(w,1)):(w=oP(I),w.c(),b(w,1),w.m(t,u)):w&&(we(),$(w,1,1,()=>{w=null}),ke()),I[5]?A?(A.p(I,P),P&32&&b(A,1)):(A=lP(I),A.c(),b(A,1),A.m(t,null)):A&&(we(),$(A,1,1,()=>{A=null}),ke()),T&&T.p&&(!h||P&16384)&&Zn(T,S,I,I[14],h?Jn(S,I[14],P,null):Qn(I[14]),null),P&2048&&Te(e,"wide",I[11]),P&512&&Te(e,"borderLeft",I[9]),P&1024&&Te(e,"borderRight",I[10])},i(I){h||(b(m),b(_),b(o.$$.fragment,I),b(y),b(w),b(A),b(T,I),h=!0)},o(I){$(m),$(_),$(o.$$.fragment,I),$(y),$(w),$(A),$(T,I),h=!1},d(I){I&&M(e),m&&m.d(),_&&_.d(),H(o),y&&y.d(),w&&w.d(),A&&A.d(),T&&T.d(I)}}}function IGe(n,e,t){let{$$slots:r={},$$scope:i}=e,{title:a}=e,{icon:o}=e,{expandable:l=!1}=e,{showAddButton:s=!1}=e,{showBackButton:u=!1}=e,{showCloseButton:c=!1}=e,{onClickAddButton:f}=e,{onClickBackButton:h}=e,{onClickCloseButton:m}=e,{borderLeft:_=!1}=e,{borderRight:y=!1}=e,w=!1;const A=()=>t(11,w=!w);return n.$$set=S=>{"title"in S&&t(0,a=S.title),"icon"in S&&t(1,o=S.icon),"expandable"in S&&t(2,l=S.expandable),"showAddButton"in S&&t(3,s=S.showAddButton),"showBackButton"in S&&t(4,u=S.showBackButton),"showCloseButton"in S&&t(5,c=S.showCloseButton),"onClickAddButton"in S&&t(6,f=S.onClickAddButton),"onClickBackButton"in S&&t(7,h=S.onClickBackButton),"onClickCloseButton"in S&&t(8,m=S.onClickCloseButton),"borderLeft"in S&&t(9,_=S.borderLeft),"borderRight"in S&&t(10,y=S.borderRight),"$$scope"in S&&t(14,i=S.$$scope)},[a,o,l,s,u,c,f,h,m,_,y,w,r,A,i]}class G3 extends Ve{constructor(e){super(),Pe(this,e,IGe,OGe,Ie,{title:0,icon:1,expandable:2,showAddButton:3,showBackButton:4,showCloseButton:5,onClickAddButton:6,onClickBackButton:7,onClickCloseButton:8,borderLeft:9,borderRight:10})}}const PGe=[{name:"Blocks",icon:"Article",children:["tableblock","cardsblock","repeaterblock","formblock","chartblock","rowexplorer"]},{name:"Layout",icon:"ClassicGridView",children:["container","section","grid"]},{name:"Data",icon:"Data",children:["dataprovider","repeater","table","dynamicfilter","daterangepicker"]},{name:"Basic",icon:"TextParagraph",children:["heading","text","button","tag","spectrumcard","cardstat","divider","image","link","icon","embed","markdownviewer","backgroundimage","embeddedmap"]},{name:"Form",icon:"Form",children:["form","formstep","fieldgroup","stringfield","numberfield","passwordfield","optionsfield","booleanfield","longformfield","attachmentfield","jsonfield","relationshipfield","datetimefield","multifieldselect","s3upload","codescanner"]},{name:"Chart",icon:"GraphBarVertical",children:["bar","line","area","candlestick","pie","donut"]}];function sP(n,e,t){const r=n.slice();return r[38]=e[t],r}function uP(n,e,t){const r=n.slice();return r[32]=e[t],r}function cP(n,e,t){const r=n.slice();return r[35]=e[t],r}function fP(n){let e,t;return e=new $7({props:{compact:!0,justified:!0,$$slots:{default:[NGe]},$$scope:{ctx:n}}}),{c(){O(e.$$.fragment)},m(r,i){B(e,r,i),t=!0},p(r,i){const a={};i[0]&2|i[1]&1024&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){t||(b(e.$$.fragment,r),t=!0)},o(r){$(e.$$.fragment,r),t=!1},d(r){H(e,r)}}}function VGe(n){let e;return{c(){e=oe("Components")},m(t,r){C(t,e,r)},d(t){t&&M(e)}}}function RGe(n){let e;return{c(){e=oe("Blocks")},m(t,r){C(t,e,r)},d(t){t&&M(e)}}}function NGe(n){let e,t,r,i;return e=new Sr({props:{fullWidth:!0,selected:n[1]==="components",$$slots:{default:[VGe]},$$scope:{ctx:n}}}),e.$on("click",n[19]),r=new Sr({props:{fullWidth:!0,selected:n[1]==="blocks",$$slots:{default:[RGe]},$$scope:{ctx:n}}}),r.$on("click",n[20]),{c(){O(e.$$.fragment),t=q(),O(r.$$.fragment)},m(a,o){B(e,a,o),C(a,t,o),B(r,a,o),i=!0},p(a,o){const l={};o[0]&2&&(l.selected=a[1]==="components"),o[1]&1024&&(l.$$scope={dirty:o,ctx:a}),e.$set(l);const s={};o[0]&2&&(s.selected=a[1]==="blocks"),o[1]&1024&&(s.$$scope={dirty:o,ctx:a}),r.$set(s)},i(a){i||(b(e.$$.fragment,a),b(r.$$.fragment,a),i=!0)},o(a){$(e.$$.fragment,a),$(r.$$.fragment,a),i=!1},d(a){H(e,a),a&&M(t),H(r,a)}}}function FGe(n){let e,t,r,i;return e=new jt({props:{size:"S",$$slots:{default:[xGe]},$$scope:{ctx:n}}}),r=new Pt({props:{noPadding:!0,gap:"XS",$$slots:{default:[qGe]},$$scope:{ctx:n}}}),{c(){O(e.$$.fragment),t=q(),O(r.$$.fragment)},m(a,o){B(e,a,o),C(a,t,o),B(r,a,o),i=!0},p(a,o){const l={};o[1]&1024&&(l.$$scope={dirty:o,ctx:a}),e.$set(l);const s={};o[0]&32|o[1]&1024&&(s.$$scope={dirty:o,ctx:a}),r.$set(s)},i(a){i||(b(e.$$.fragment,a),b(r.$$.fragment,a),i=!0)},o(a){$(e.$$.fragment,a),$(r.$$.fragment,a),i=!1},d(a){H(e,a),a&&M(t),H(r,a)}}}function jGe(n){let e,t,r,i;const a=[GGe,WGe],o=[];function l(s,u){return s[6].length?0:1}return e=l(n),t=o[e]=a[e](n),{c(){t.c(),r=yt()},m(s,u){o[e].m(s,u),C(s,r,u),i=!0},p(s,u){let c=e;e=l(s),e===c?o[e].p(s,u):(we(),$(o[c],1,1,()=>{o[c]=null}),ke(),t=o[e],t?t.p(s,u):(t=o[e]=a[e](s),t.c()),b(t,1),t.m(r.parentNode,r))},i(s){i||(b(t),i=!0)},o(s){$(t),i=!1},d(s){o[e].d(s),s&&M(r)}}}function xGe(n){let e;return{c(){e=oe("Blocks are collections of pre-built components")},m(t,r){C(t,e,r)},d(t){t&&M(e)}}}function UGe(n){let e=n[38].name+"",t;return{c(){t=oe(e)},m(r,i){C(r,t,i)},p(r,i){i[0]&32&&e!==(e=r[38].name+"")&&gt(t,e)},d(r){r&&M(t)}}}function pP(n){let e,t,r,i,a,o,l,s;t=new un({props:{name:n[38].icon}}),i=new jt({props:{size:"XS",$$slots:{default:[UGe]},$$scope:{ctx:n}}});function u(){return n[24](n[38])}function c(){return n[25](n[38])}return{c(){e=X("div"),O(t.$$.fragment),r=q(),O(i.$$.fragment),a=q(),D(e,"draggable","true"),D(e,"class","component svelte-63iy97")},m(f,h){C(f,e,h),B(t,e,null),x(e,r),B(i,e,null),x(e,a),o=!0,l||(s=[At(e,"click",u),At(e,"dragstart",c),At(e,"dragend",n[10])],l=!0)},p(f,h){n=f;const m={};h[0]&32&&(m.name=n[38].icon),t.$set(m);const _={};h[0]&32|h[1]&1024&&(_.$$scope={dirty:h,ctx:n}),i.$set(_)},i(f){o||(b(t.$$.fragment,f),b(i.$$.fragment,f),o=!0)},o(f){$(t.$$.fragment,f),$(i.$$.fragment,f),o=!1},d(f){f&&M(e),H(t),H(i),l=!1,Vi(s)}}}function qGe(n){let e,t,r=n[5],i=[];for(let o=0;o<r.length;o+=1)i[o]=pP(sP(n,r,o));const a=o=>$(i[o],1,1,()=>{i[o]=null});return{c(){for(let o=0;o<i.length;o+=1)i[o].c();e=yt()},m(o,l){for(let s=0;s<i.length;s+=1)i[s].m(o,l);C(o,e,l),t=!0},p(o,l){if(l[0]&1824){r=o[5];let s;for(s=0;s<r.length;s+=1){const u=sP(o,r,s);i[s]?(i[s].p(u,l),b(i[s],1)):(i[s]=pP(u),i[s].c(),b(i[s],1),i[s].m(e.parentNode,e))}for(we(),s=r.length;s<i.length;s+=1)a(s);ke()}},i(o){if(!t){for(let l=0;l<r.length;l+=1)b(i[l]);t=!0}},o(o){i=i.filter(Boolean);for(let l=0;l<i.length;l+=1)$(i[l]);t=!1},d(o){Bn(i,o),o&&M(e)}}}function WGe(n){let e,t;return e=new jt({props:{size:"S",$$slots:{default:[YGe]},$$scope:{ctx:n}}}),{c(){O(e.$$.fragment)},m(r,i){B(e,r,i),t=!0},p(r,i){const a={};i[1]&1024&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){t||(b(e.$$.fragment,r),t=!0)},o(r){$(e.$$.fragment,r),t=!1},d(r){H(e,r)}}}function GGe(n){let e,t,r=n[6],i=[];for(let o=0;o<r.length;o+=1)i[o]=hP(uP(n,r,o));const a=o=>$(i[o],1,1,()=>{i[o]=null});return{c(){for(let o=0;o<i.length;o+=1)i[o].c();e=yt()},m(o,l){for(let s=0;s<i.length;s+=1)i[s].m(o,l);C(o,e,l),t=!0},p(o,l){if(l[0]&1880){r=o[6];let s;for(s=0;s<r.length;s+=1){const u=uP(o,r,s);i[s]?(i[s].p(u,l),b(i[s],1)):(i[s]=hP(u),i[s].c(),b(i[s],1),i[s].m(e.parentNode,e))}for(we(),s=r.length;s<i.length;s+=1)a(s);ke()}},i(o){if(!t){for(let l=0;l<r.length;l+=1)b(i[l]);t=!0}},o(o){i=i.filter(Boolean);for(let l=0;l<i.length;l+=1)$(i[l]);t=!1},d(o){Bn(i,o),o&&M(e)}}}function YGe(n){let e;return{c(){e=oe("There aren't any components matching the current filter")},m(t,r){C(t,e,r)},d(t){t&&M(e)}}}function KGe(n){let e=n[35].name+"",t;return{c(){t=oe(e)},m(r,i){C(r,t,i)},p(r,i){i[0]&64&&e!==(e=r[35].name+"")&&gt(t,e)},d(r){r&&M(t)}}}function dP(n){let e,t,r,i,a,o,l,s;t=new un({props:{name:n[35].icon}}),i=new jt({props:{size:"XS",$$slots:{default:[KGe]},$$scope:{ctx:n}}});function u(){return n[21](n[35])}function c(){return n[22](n[35])}return{c(){e=X("div"),O(t.$$.fragment),r=q(),O(i.$$.fragment),D(e,"draggable","true"),D(e,"data-cy",a=`component-${n[35].name}`),D(e,"class","component svelte-63iy97"),Te(e,"selected",n[3]===n[4][n[35].component])},m(f,h){C(f,e,h),B(t,e,null),x(e,r),B(i,e,null),o=!0,l||(s=[At(e,"dragstart",u),At(e,"dragend",n[10]),At(e,"click",c),At(e,"mouseover",n[23])],l=!0)},p(f,h){n=f;const m={};h[0]&64&&(m.name=n[35].icon),t.$set(m);const _={};h[0]&64|h[1]&1024&&(_.$$scope={dirty:h,ctx:n}),i.$set(_),(!o||h[0]&64&&a!==(a=`component-${n[35].name}`))&&D(e,"data-cy",a),h[0]&88&&Te(e,"selected",n[3]===n[4][n[35].component])},i(f){o||(b(t.$$.fragment,f),b(i.$$.fragment,f),o=!0)},o(f){$(t.$$.fragment,f),$(i.$$.fragment,f),o=!1},d(f){f&&M(e),H(t),H(i),l=!1,Vi(s)}}}function XGe(n){let e,t=n[32].name+"",r,i,a,o,l=n[32].children,s=[];for(let c=0;c<l.length;c+=1)s[c]=dP(cP(n,l,c));const u=c=>$(s[c],1,1,()=>{s[c]=null});return{c(){e=X("div"),r=oe(t),i=q();for(let c=0;c<s.length;c+=1)s[c].c();a=q(),D(e,"class","category-label svelte-63iy97")},m(c,f){C(c,e,f),x(e,r),C(c,i,f);for(let h=0;h<s.length;h+=1)s[h].m(c,f);C(c,a,f),o=!0},p(c,f){if((!o||f[0]&64)&&t!==(t=c[32].name+"")&&gt(r,t),f[0]&1880){l=c[32].children;let h;for(h=0;h<l.length;h+=1){const m=cP(c,l,h);s[h]?(s[h].p(m,f),b(s[h],1)):(s[h]=dP(m),s[h].c(),b(s[h],1),s[h].m(a.parentNode,a))}for(we(),h=l.length;h<s.length;h+=1)u(h);ke()}},i(c){if(!o){for(let f=0;f<l.length;f+=1)b(s[f]);o=!0}},o(c){s=s.filter(Boolean);for(let f=0;f<s.length;f+=1)$(s[f]);o=!1},d(c){c&&M(e),c&&M(i),Bn(s,c),c&&M(a)}}}function hP(n){let e,t;return e=new Pt({props:{noPadding:!0,gap:"XS",$$slots:{default:[XGe]},$$scope:{ctx:n}}}),{c(){O(e.$$.fragment)},m(r,i){B(e,r,i),t=!0},p(r,i){const a={};i[0]&88|i[1]&1024&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){t||(b(e.$$.fragment,r),t=!0)},o(r){$(e.$$.fragment,r),t=!1},d(r){H(e,r)}}}function JGe(n){let e,t,r,i,a,o,l,s;function u(y){n[17](y)}let c={placeholder:"Search",value:n[0]};n[2]!==void 0&&(c.inputRef=n[2]),e=new $5({props:c}),De.push(()=>nt(e,"inputRef",u)),e.$on("change",n[18]);let f=!n[0]&&fP(n);const h=[jGe,FGe],m=[];function _(y,w){return y[0]||y[1]==="components"?0:1}return a=_(n),o=m[a]=h[a](n),{c(){O(e.$$.fragment),r=q(),f&&f.c(),i=q(),o.c(),l=yt()},m(y,w){B(e,y,w),C(y,r,w),f&&f.m(y,w),C(y,i,w),m[a].m(y,w),C(y,l,w),s=!0},p(y,w){const A={};w[0]&1&&(A.value=y[0]),!t&&w[0]&4&&(t=!0,A.inputRef=y[2],rt(()=>t=!1)),e.$set(A),y[0]?f&&(we(),$(f,1,1,()=>{f=null}),ke()):f?(f.p(y,w),w[0]&1&&b(f,1)):(f=fP(y),f.c(),b(f,1),f.m(i.parentNode,i));let S=a;a=_(y),a===S?m[a].p(y,w):(we(),$(m[S],1,1,()=>{m[S]=null}),ke(),o=m[a],o?o.p(y,w):(o=m[a]=h[a](y),o.c()),b(o,1),o.m(l.parentNode,l))},i(y){s||(b(e.$$.fragment,y),b(f),b(o),s=!0)},o(y){$(e.$$.fragment,y),$(f),$(o),s=!1},d(y){H(e,y),y&&M(r),f&&f.d(y),y&&M(i),m[a].d(y),y&&M(l)}}}function ZGe(n){let e,t;return e=new Pt({props:{paddingX:"L",paddingY:"XL",gap:"S",$$slots:{default:[JGe]},$$scope:{ctx:n}}}),{c(){O(e.$$.fragment)},m(r,i){B(e,r,i),t=!0},p(r,i){const a={};i[0]&127|i[1]&1024&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){t||(b(e.$$.fragment,r),t=!0)},o(r){$(e.$$.fragment,r),t=!1},d(r){H(e,r)}}}function QGe(n){let e,t,r,i;return t=new G3({props:{title:"Add component",showCloseButton:!0,onClickCloseButton:n[26],borderLeft:!0,$$slots:{default:[ZGe]},$$scope:{ctx:n}}}),{c(){e=X("div"),O(t.$$.fragment),D(e,"class","container svelte-63iy97")},m(a,o){C(a,e,o),B(t,e,null),i=!0},p(a,o){const l={};o[0]&128&&(l.onClickCloseButton=a[26]),o[0]&127|o[1]&1024&&(l.$$scope={dirty:o,ctx:a}),t.$set(l)},i(a){i||(b(t.$$.fragment,a),a&&Po(()=>{r||(r=w0(e,k0,{x:260,duration:300},!0)),r.run(1)}),i=!0)},o(a){$(t.$$.fragment,a),a&&(r||(r=w0(e,k0,{x:260,duration:300},!1)),r.run(0)),i=!1},d(a){a&&M(e),H(t),a&&r&&r.end()}}}function eYe(n,e,t){let r,i,a,o,l,s,u,c,f;Fe(n,ci,be=>t(7,s=be)),Fe(n,Xt,be=>t(14,u=be)),Fe(n,I3,be=>t(15,c=be)),Fe(n,ja,be=>t(16,f=be));let h="components",m,_,y,w=[];const A=(be,pe,_e)=>{var Me;const Ae=T4(pe==null?void 0:pe.props,_e==null?void 0:_e._id);if(!(Ae!=null&&Ae.length))return[];let me=[];const it=Xt.actions.components.getDefinition(_e==null?void 0:_e._component);(Me=it.legalDirectChildren)!=null&&Me.length?me=it.legalDirectChildren.map(Be=>`@budibase/standard-components/${Be}`):me=Object.keys(be);let $e=it.illegalChildren||[];return Ae.forEach(Be=>{var st;const xe=Xt.actions.components.getDefinition(Be._component),ve=(st=xe==null?void 0:xe.illegalChildren)==null?void 0:st.map(dt=>`@budibase/standard-components/${dt}`);$e=[...$e,...ve||[]]}),$e=[...new Set($e)],me=me.filter(Be=>!$e.includes(Be)),me},S=be=>{let pe={};return be.forEach((_e,Ae)=>{pe[_e]=Ae}),pe},T=(be,pe,_e)=>{let Ae=[];return _e!=null&&_e.length&&Ae.push({name:"Plugins",isCategory:!0,children:_e.map(me=>({...pe[me],name:pe[me].friendlyName||pe[me].name})).sort((me,it)=>me.name.toLowerCase()<it.name.toLowerCase()?-1:1)}),be.forEach(me=>{if(typeof me=="string"){const it=pe[`@budibase/standard-components/${me}`];it&&Ae.push({...it,isCategory:!1})}else Ae.push({...me,isCategory:!0,children:T(me.children||[],pe)})}),Ae},I=(be,pe,_e)=>{if(t(3,y=_e?0:null),t(11,w=[]),!(be!=null&&be.length))return[];_e||(be=be.filter(me=>me.name!=="Blocks"));let Ae=[];return be.forEach(me=>{let it=me.children.filter($e=>{const Me=$e.name.toLowerCase();return _e&&!Me.includes(_e.toLowerCase())?!1:pe.includes($e.component)});it.length&&(Ae.push({...me,children:it}),t(11,w=w.concat(it.map($e=>$e.component))))}),be=Ae,be},P=async be=>{try{await Xt.actions.components.create(be),s("../")}catch(pe){$t.error(pe||"Error creating component")}},V=be=>{if(be.key==="Tab")return y==null?t(3,y=0):t(3,y=(y+1)%w.length),be.preventDefault(),be.stopPropagation(),!1;be.key==="Enter"&&w[y]&&P(w[y])};ar(()=>(_.focus(),window.addEventListener("keydown",V),()=>{window.removeEventListener("keydown",V)}));const j=be=>{Xt.actions.dnd.start(be)},U=()=>{Xt.actions.dnd.stop()};function W(be){_=be,t(2,_)}const te=be=>t(0,m=be.detail),Q=()=>t(1,h="components"),le=()=>t(1,h="blocks"),ie=be=>j(be.component),K=be=>P(be.component),G=()=>t(3,y=null),re=be=>P(be.component),se=be=>j(be.component),de=()=>s("../");return n.$$.update=()=>{n.$$.dirty[0]&114688&&t(13,r=A(u.components,f,c)),n.$$.dirty[0]&16384&&t(12,i=T(PGe,u.components,u.customComponents)),n.$$.dirty[0]&12289&&t(6,a=I(i,r,m)),n.$$.dirty[0]&4096&&t(5,o=i.find(be=>be.name==="Blocks").children),n.$$.dirty[0]&2048&&t(4,l=S(w))},[m,h,_,y,l,o,a,s,P,j,U,w,i,r,u,c,f,W,te,Q,le,ie,K,G,re,se,de]}class tYe extends Ve{constructor(e){super(),Pe(this,e,eYe,QGe,Ie,{},null,[-1,-1])}}function nYe(n){let e,t;return e=new tYe({}),{c(){O(e.$$.fragment)},m(r,i){B(e,r,i),t=!0},p:ht,i(r){t||(b(e.$$.fragment,r),t=!0)},o(r){$(e.$$.fragment,r),t=!1},d(r){H(e,r)}}}class rYe extends Ve{constructor(e){super(),Pe(this,e,null,nYe,Ie,{})}}const nA=n=>{var j,U,W,te;const{urlParam:e,stateKey:t,validate:r,baseUrl:i="..",fallbackUrl:a,store:o,routify:l,beforeNavigate:s}=n||{};if(!e||!t||!i||!e||!(o!=null&&o.subscribe)||!l||!((j=l.params)!=null&&j.subscribe)||!((U=l.goto)!=null&&U.subscribe)||!((W=l.redirect)!=null&&W.subscribe)||!((te=l.page)!=null&&te.subscribe)){console.warn("syncURLToState invoked with missing parameters");return}let u=pn(l.params),c=pn(l.goto),f=pn(l.redirect),h=pn(l.page),m=null;const _=(Q,le)=>{if(s){const ie=s(Q,le);ie!=null&&ie.url&&(Q=ie.url),ie!=null&&ie.params&&(le=ie.params)}c(Q,le)},y=Q=>{f(Q)},w=Q=>{var re;const le=JSON.stringify(Q),ie=le!==m;m=le;const K=Q==null?void 0:Q[e],G=(re=pn(o))==null?void 0:re[t];if(!(!ie||!K)){if(r&&a&&!r(K)){y(a);return}K!==G&&o.update(se=>(se[t]=K,se))}},A=Q=>{let le=!1;const ie=u==null?void 0:u[e],K=Q==null?void 0:Q[t];if(K!==ie&&(le=!0,r&&a&&!r(K))){y(a);return}if(!!le&&!pn(f_)){const G={...u,[e]:K};_(h.path,G)}};w(u);const S=l.params.subscribe(Q=>{u=Q,w(Q)}),T=l.goto.subscribe(Q=>{c=Q}),I=l.redirect.subscribe(Q=>{f=Q}),P=l.page.subscribe(Q=>{h=Q}),V=o.subscribe(A);return()=>{S(),T(),I(),P(),V()}};function iYe(n){let e;return{c(){e=oe("Delete")},m(t,r){C(t,e,r)},d(t){t&&M(e)}}}function mP(n){let e,t;return e=new ei({props:{icon:"Export",keyBind:"Ctrl+E",$$slots:{default:[aYe]},$$scope:{ctx:n}}}),e.$on("click",n[7]),{c(){O(e.$$.fragment)},m(r,i){B(e,r,i),t=!0},p(r,i){const a={};i&16384&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){t||(b(e.$$.fragment,r),t=!0)},o(r){$(e.$$.fragment,r),t=!1},d(r){H(e,r)}}}function aYe(n){let e;return{c(){e=oe("Eject block")},m(t,r){C(t,e,r)},d(t){t&&M(e)}}}function oYe(n){let e;return{c(){e=oe("Move up")},m(t,r){C(t,e,r)},d(t){t&&M(e)}}}function lYe(n){let e;return{c(){e=oe("Move down")},m(t,r){C(t,e,r)},d(t){t&&M(e)}}}function sYe(n){let e;return{c(){e=oe("Duplicate")},m(t,r){C(t,e,r)},d(t){t&&M(e)}}}function uYe(n){let e;return{c(){e=oe("Cut")},m(t,r){C(t,e,r)},d(t){t&&M(e)}}}function cYe(n){let e;return{c(){e=oe("Copy")},m(t,r){C(t,e,r)},d(t){t&&M(e)}}}function fYe(n){let e;return{c(){e=oe("Paste")},m(t,r){C(t,e,r)},d(t){t&&M(e)}}}function pYe(n){let e,t,r,i,a,o,l,s,u,c,f,h,m,_,y;e=new ei({props:{icon:"Delete",keyBind:"!BackAndroid",$$slots:{default:[iYe]},$$scope:{ctx:n}}}),e.$on("click",n[6]);let w=n[0]&&mP(n);return i=new ei({props:{icon:"ChevronUp",keyBind:"Ctrl+!ArrowUp",$$slots:{default:[oYe]},$$scope:{ctx:n}}}),i.$on("click",n[8]),o=new ei({props:{icon:"ChevronDown",keyBind:"Ctrl+!ArrowDown",$$slots:{default:[lYe]},$$scope:{ctx:n}}}),o.$on("click",n[9]),s=new ei({props:{icon:"Duplicate",keyBind:"Ctrl+D",$$slots:{default:[sYe]},$$scope:{ctx:n}}}),s.$on("click",n[10]),c=new ei({props:{icon:"Cut",keyBind:"Ctrl+X",$$slots:{default:[uYe]},$$scope:{ctx:n}}}),c.$on("click",n[11]),h=new ei({props:{icon:"Copy",keyBind:"Ctrl+C",$$slots:{default:[cYe]},$$scope:{ctx:n}}}),h.$on("click",n[12]),_=new ei({props:{icon:"LayersSendToBack",keyBind:"Ctrl+V",disabled:n[1],$$slots:{default:[fYe]},$$scope:{ctx:n}}}),_.$on("click",n[13]),{c(){O(e.$$.fragment),t=q(),w&&w.c(),r=q(),O(i.$$.fragment),a=q(),O(o.$$.fragment),l=q(),O(s.$$.fragment),u=q(),O(c.$$.fragment),f=q(),O(h.$$.fragment),m=q(),O(_.$$.fragment)},m(A,S){B(e,A,S),C(A,t,S),w&&w.m(A,S),C(A,r,S),B(i,A,S),C(A,a,S),B(o,A,S),C(A,l,S),B(s,A,S),C(A,u,S),B(c,A,S),C(A,f,S),B(h,A,S),C(A,m,S),B(_,A,S),y=!0},p(A,S){const T={};S&16384&&(T.$$scope={dirty:S,ctx:A}),e.$set(T),A[0]?w?(w.p(A,S),S&1&&b(w,1)):(w=mP(A),w.c(),b(w,1),w.m(r.parentNode,r)):w&&(we(),$(w,1,1,()=>{w=null}),ke());const I={};S&16384&&(I.$$scope={dirty:S,ctx:A}),i.$set(I);const P={};S&16384&&(P.$$scope={dirty:S,ctx:A}),o.$set(P);const V={};S&16384&&(V.$$scope={dirty:S,ctx:A}),s.$set(V);const j={};S&16384&&(j.$$scope={dirty:S,ctx:A}),c.$set(j);const U={};S&16384&&(U.$$scope={dirty:S,ctx:A}),h.$set(U);const W={};S&2&&(W.disabled=A[1]),S&16384&&(W.$$scope={dirty:S,ctx:A}),_.$set(W)},i(A){y||(b(e.$$.fragment,A),b(w),b(i.$$.fragment,A),b(o.$$.fragment,A),b(s.$$.fragment,A),b(c.$$.fragment,A),b(h.$$.fragment,A),b(_.$$.fragment,A),y=!0)},o(A){$(e.$$.fragment,A),$(w),$(i.$$.fragment,A),$(o.$$.fragment,A),$(s.$$.fragment,A),$(c.$$.fragment,A),$(h.$$.fragment,A),$(_.$$.fragment,A),y=!1},d(A){H(e,A),A&&M(t),w&&w.d(A),A&&M(r),H(i,A),A&&M(a),H(o,A),A&&M(l),H(s,A),A&&M(u),H(c,A),A&&M(f),H(h,A),A&&M(m),H(_,A)}}}function dYe(n){let e,t,r;return t=new un({props:{size:"S",hoverable:!0,name:"MoreSmallList"}}),{c(){e=X("div"),O(t.$$.fragment),D(e,"slot","control"),D(e,"class","icon svelte-u6s22l")},m(i,a){C(i,e,a),B(t,e,null),r=!0},p:ht,i(i){r||(b(t.$$.fragment,i),r=!0)},o(i){$(t.$$.fragment,i),r=!1},d(i){i&&M(e),H(t)}}}function hYe(n){let e,t;return e=new ou({props:{$$slots:{control:[dYe],default:[pYe]},$$scope:{ctx:n}}}),{c(){O(e.$$.fragment)},m(r,i){B(e,r,i),t=!0},p(r,[i]){const a={};i&16387&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){t||(b(e.$$.fragment,r),t=!0)},o(r){$(e.$$.fragment,r),t=!1},d(r){H(e,r)}}}function mYe(n,e,t){let r,i,a,o;Fe(n,Xt,A=>t(5,o=A));let{component:l}=e;const s=(A,S=!1)=>{document.dispatchEvent(new CustomEvent("component-menu",{detail:{key:A,ctrlKey:S,id:l==null?void 0:l._id}}))},u=()=>s("Delete"),c=()=>s("e",!0),f=()=>s("ArrowUp",!0),h=()=>s("ArrowDown",!0),m=()=>s("d",!0),_=()=>s("x",!0),y=()=>s("c",!0),w=()=>s("v",!0);return n.$$set=A=>{"component"in A&&t(3,l=A.component)},n.$$.update=()=>{n.$$.dirty&8&&t(4,r=Xt.actions.components.getDefinition(l==null?void 0:l._component)),n.$$.dirty&32&&t(1,i=!o.componentToPaste),n.$$.dirty&16&&t(0,a=(r==null?void 0:r.block)===!0)},[a,i,s,l,r,o,u,c,f,h,m,_,y,w]}class gYe extends Ve{constructor(e){super(),Pe(this,e,mYe,hYe,Ie,{component:3})}}const $c={ABOVE:"above",BELOW:"below",INSIDE:"inside"},gP={source:null,target:null,targetParent:null,dropPosition:null,dragging:!1,valid:!1},vYe=()=>{const n=gi(gP),e={dragstart:t=>{!t||n.set({source:t,target:null,dropPosition:null,dragging:!0,valid:!1})},dragover:({component:t,mousePosition:r})=>{var f,h;const i=Xt.actions.components.getDefinition(t._component),a=i==null?void 0:i.hasChildren,o=((f=t._children)==null?void 0:f.length)>0;let l,s,u;a?r<=.33?l=$c.ABOVE:r>=.66?l=$c.BELOW:l=$c.INSIDE:l=r>.5?$c.BELOW:$c.ABOVE,l===$c.BELOW&&o?(s=t._children[0],l=$c.ABOVE):s=t;const c=pn(n);l===c.dropPosition&&(s==null?void 0:s._id)===((h=c.target)==null?void 0:h._id)||(s&&(u=vc(pn(ja).props,s._id)),n.update(m=>{var _;return{...m,dropPosition:l,target:s,targetParent:u,valid:((_=T4(m.source,s._id))==null?void 0:_.length)===0}}))},reset:()=>{n.set(gP)},drop:async()=>{const t=pn(n);!t.valid||!t.source||!t.target||(e.reset(),Xt.actions.components.copy(t.source,!0,!1),await Xt.actions.components.paste(t.target,t.dropPosition))}};return{subscribe:n.subscribe,actions:e}},rp=vYe();function vP(n,e,t){const r=n.slice();r[20]=e[t],r[23]=t;const i=r[11](r[20],r[4],r[2]);return r[21]=i,r}function _Ye(n){let e,t;return e=new gYe({props:{component:n[20]}}),{c(){O(e.$$.fragment)},m(r,i){B(e,r,i),t=!0},p(r,i){const a={};i&8&&(a.component=r[20]),e.$set(a)},i(r){t||(b(e.$$.fragment,r),t=!0)},o(r){$(e.$$.fragment,r),t=!1},d(r){H(e,r)}}}function _P(n){let e,t;return e=new EJ({props:{components:n[20]._children,dndStore:rp,level:n[0]+1}}),{c(){O(e.$$.fragment)},m(r,i){B(e,r,i),t=!0},p(r,i){const a={};i&8&&(a.components=r[20]._children),i&1&&(a.level=r[0]+1),e.$set(a)},i(r){t||(b(e.$$.fragment,r),t=!0)},o(r){$(e.$$.fragment,r),t=!1},d(r){H(e,r)}}}function bP(n,e){let t,r,i,a,o,l,s,u;function c(){return e[14](e[20])}function f(){return e[15](e[20])}r=new L5({props:{scrollable:!0,draggable:!0,text:e[6](e[20]),icon:e[7](e[20]),withArrow:e[8](e[20]),indentLevel:e[0]+1,selected:e[1].selectedComponentId===e[20]._id,opened:e[21],highlighted:e[12](e[20]),$$slots:{default:[_Ye]},$$scope:{ctx:e}}}),r.$on("dragend",rp.actions.reset),r.$on("dragstart",c),r.$on("dragover",function(){kn(e[5](e[20],e[23]))&&e[5](e[20],e[23]).apply(this,arguments)}),r.$on("iconClick",f),r.$on("drop",e[10]);let h=e[21]&&_P(e);function m(){return e[16](e[20])}return{key:n,first:null,c(){t=X("li"),O(r.$$.fragment),i=q(),h&&h.c(),a=q(),D(t,"id",o=`component-${e[20]._id}`),D(t,"class","svelte-kv7hxn"),this.first=t},m(_,y){C(_,t,y),B(r,t,null),x(t,i),h&&h.m(t,null),x(t,a),l=!0,s||(u=At(t,"click",c_(m)),s=!0)},p(_,y){e=_;const w={};y&8&&(w.text=e[6](e[20])),y&8&&(w.icon=e[7](e[20])),y&8&&(w.withArrow=e[8](e[20])),y&1&&(w.indentLevel=e[0]+1),y&10&&(w.selected=e[1].selectedComponentId===e[20]._id),y&28&&(w.opened=e[21]),y&8&&(w.highlighted=e[12](e[20])),y&16777224&&(w.$$scope={dirty:y,ctx:e}),r.$set(w),e[21]?h?(h.p(e,y),y&28&&b(h,1)):(h=_P(e),h.c(),b(h,1),h.m(t,a)):h&&(we(),$(h,1,1,()=>{h=null}),ke()),(!l||y&8&&o!==(o=`component-${e[20]._id}`))&&D(t,"id",o)},i(_){l||(b(r.$$.fragment,_),b(h),l=!0)},o(_){$(r.$$.fragment,_),$(h),l=!1},d(_){_&&M(t),H(r),h&&h.d(),s=!1,u()}}}function bYe(n){let e,t=[],r=new Map,i,a=n[3]||[];const o=l=>l[20]._id;for(let l=0;l<a.length;l+=1){let s=vP(n,a,l),u=o(s);r.set(u,t[l]=bP(u,s))}return{c(){e=X("ul");for(let l=0;l<t.length;l+=1)t[l].c();D(e,"class","svelte-kv7hxn")},m(l,s){C(l,e,s);for(let u=0;u<t.length;u+=1)t[u].m(e,null);i=!0},p(l,[s]){s&8191&&(a=l[3]||[],we(),t=Pl(t,s,o,1,l,a,r,e,Mc,bP,null,vP),ke())},i(l){if(!i){for(let s=0;s<a.length;s+=1)b(t[s]);i=!0}},o(l){for(let s=0;s<t.length;s+=1)$(t[s]);i=!1},d(l){l&&M(e);for(let s=0;s<t.length;s+=1)t[s].d()}}}function yYe(n,e,t){let r,i,a,o;Fe(n,I3,V=>t(18,i=V)),Fe(n,Xt,V=>t(1,a=V)),Fe(n,q4e,V=>t(4,o=V));let{components:l=[]}=e,{level:s=0}=e,u={};const c=(V,j)=>U=>{const W=U.offsetY/U.currentTarget.offsetHeight;return rp.actions.dragover({component:V,index:j,mousePosition:W}),!1},f=V=>{if(V._instanceName)return V._instanceName;const j=V._component.replace("@budibase/standard-components/","")||"component";return Ac(j)},h=V=>{const j=Xt.actions.components.getDefinition(V==null?void 0:V._component);return j==null?void 0:j.icon},m=V=>{const j=Xt.actions.components.getDefinition(V==null?void 0:V._component);return j==null?void 0:j.hasChildren},_=V=>{var j;return m(V)&&((j=V._children)==null?void 0:j.length)};function y(V){u[V]?delete u[V]:t(2,u[V]=!0,u),t(2,u)}const w=async V=>{V.stopPropagation();try{await rp.actions.drop()}catch(j){$t.error(j||"Error saving component")}},A=(V,j,U)=>{var W;return(W=V==null?void 0:V._children)!=null&&W.length?j.includes(V._id)?!0:!U[V._id]:!1},S=V=>{var W,te,Q;const j=(W=pn(I3))==null?void 0:W._id,U=(te=pn(ja))==null?void 0:te.props._id;return!j||j===U?!1:((Q=T4(i,V._id))==null?void 0:Q.length)>0},T=V=>rp.actions.dragstart(V),I=V=>y(V._id),P=V=>{G1(Xt,a.selectedComponentId=V._id,a)};return n.$$set=V=>{"components"in V&&t(13,l=V.components),"level"in V&&t(0,s=V.level)},n.$$.update=()=>{n.$$.dirty&8194&&t(3,r=l==null?void 0:l.filter(V=>{var j,U;return!((j=a.componentToPaste)!=null&&j.isCut)||V._id!==((U=a.componentToPaste)==null?void 0:U._id)}))},pn(ja),[s,a,u,r,o,c,f,h,_,y,w,A,S,l,T,I,P]}class EJ extends Ve{constructor(e){super(),Pe(this,e,yYe,bYe,Ie,{components:13,level:0})}}function yP(n){let e,t;return e=new ou({props:{$$slots:{control:[zYe],default:[kYe]},$$scope:{ctx:n}}}),{c(){O(e.$$.fragment)},m(r,i){B(e,r,i),t=!0},p(r,i){const a={};i&514&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){t||(b(e.$$.fragment,r),t=!0)},o(r){$(e.$$.fragment,r),t=!1},d(r){H(e,r)}}}function $Ye(n){let e;return{c(){e=oe("Copy")},m(t,r){C(t,e,r)},d(t){t&&M(e)}}}function wYe(n){let e;return{c(){e=oe("Paste")},m(t,r){C(t,e,r)},d(t){t&&M(e)}}}function kYe(n){let e,t,r,i;return e=new ei({props:{icon:"Copy",keyBind:"Ctrl+C",$$slots:{default:[$Ye]},$$scope:{ctx:n}}}),e.$on("click",n[7]),r=new ei({props:{icon:"LayersSendToBack",keyBind:"Ctrl+V",disabled:n[1],$$slots:{default:[wYe]},$$scope:{ctx:n}}}),r.$on("click",n[8]),{c(){O(e.$$.fragment),t=q(),O(r.$$.fragment)},m(a,o){B(e,a,o),C(a,t,o),B(r,a,o),i=!0},p(a,o){const l={};o&512&&(l.$$scope={dirty:o,ctx:a}),e.$set(l);const s={};o&2&&(s.disabled=a[1]),o&512&&(s.$$scope={dirty:o,ctx:a}),r.$set(s)},i(a){i||(b(e.$$.fragment,a),b(r.$$.fragment,a),i=!0)},o(a){$(e.$$.fragment,a),$(r.$$.fragment,a),i=!1},d(a){H(e,a),a&&M(t),H(r,a)}}}function zYe(n){let e,t,r;return t=new un({props:{size:"S",hoverable:!0,name:"MoreSmallList"}}),{c(){e=X("div"),O(t.$$.fragment),D(e,"slot","control"),D(e,"class","icon svelte-u6s22l")},m(i,a){C(i,e,a),B(t,e,null),r=!0},p:ht,i(i){r||(b(t.$$.fragment,i),r=!0)},o(i){$(t.$$.fragment,i),r=!1},d(i){i&&M(e),H(t)}}}function AYe(n){let e,t,r=n[0]&&yP(n);return{c(){r&&r.c(),e=yt()},m(i,a){r&&r.m(i,a),C(i,e,a),t=!0},p(i,[a]){i[0]?r?(r.p(i,a),a&1&&b(r,1)):(r=yP(i),r.c(),b(r,1),r.m(e.parentNode,e)):r&&(we(),$(r,1,1,()=>{r=null}),ke())},i(i){t||(b(r),t=!0)},o(i){$(r),t=!1},d(i){r&&r.d(i),i&&M(e)}}}function MYe(n,e,t){let r,i,a,o;Fe(n,Xt,h=>t(6,o=h));let{component:l}=e;const s=(h=!1)=>{Xt.actions.components.copy(l,h)},u=h=>{try{Xt.actions.components.paste(l,h)}catch{$t.error("Error saving component")}},c=()=>s(!1),f=()=>u("inside");return n.$$set=h=>{"component"in h&&t(4,l=h.component)},n.$$.update=()=>{n.$$.dirty&16&&t(5,r=Xt.actions.components.getDefinition(l==null?void 0:l._component)),n.$$.dirty&64&&t(1,i=!o.componentToPaste),n.$$.dirty&32&&t(0,a=(r==null?void 0:r.editable)!==!1&&(r==null?void 0:r.static)!==!0)},[a,i,s,u,l,r,o,c,f]}class CYe extends Ve{constructor(e){super(),Pe(this,e,MYe,AYe,Ie,{component:4})}}function $P(n){let e,t;return{c(){e=X("div"),D(e,"class","indicator svelte-9uy3y5"),$n(e,"--x",n[2]+"px"),$n(e,"--y",n[3]+"px"),$n(e,"--width",n[4]+"px"),$n(e,"--height",n[5]+"px"),Te(e,"above",n[1]===$c.ABOVE),Te(e,"below",n[1]===$c.BELOW),Te(e,"inside",n[1]===$c.INSIDE)},m(r,i){C(r,e,i)},p(r,i){i&4&&$n(e,"--x",r[2]+"px"),i&8&&$n(e,"--y",r[3]+"px"),i&16&&$n(e,"--width",r[4]+"px"),i&32&&$n(e,"--height",r[5]+"px"),i&2&&Te(e,"above",r[1]===$c.ABOVE),i&2&&Te(e,"below",r[1]===$c.BELOW),i&2&&Te(e,"inside",r[1]===$c.INSIDE)},i(r){t||Po(()=>{t=Sd(e,ip,{duration:130}),t.start()})},o:ht,d(r){r&&M(e)}}}function SYe(n){let e,t=n[0]&&n[1]&&$P(n);return{c(){t&&t.c(),e=yt()},m(r,i){t&&t.m(r,i),C(r,e,i)},p(r,[i]){r[0]&&r[1]?t?(t.p(r,i),i&3&&b(t,1)):(t=$P(r),t.c(),b(t,1),t.m(e.parentNode,e)):t&&(t.d(1),t=null)},i(r){b(t)},o:ht,d(r){t&&t.d(r),r&&M(e)}}}function LYe(n,e,t){let{component:r}=e,{position:i}=e,a,o,l,s;const u=c=>{var m;const f=document.getElementById(`component-${c==null?void 0:c._id}`),h=(m=f==null?void 0:f.children[0])==null?void 0:m.children[0];!f||(t(2,a=h.offsetLeft),t(3,o=h.offsetTop),t(4,l=h.clientWidth),t(5,s=h.clientHeight))};return n.$$set=c=>{"component"in c&&t(0,r=c.component),"position"in c&&t(1,i=c.position)},n.$$.update=()=>{n.$$.dirty&1&&u(r)},[r,i,a,o,l,s]}class TJ extends Ve{constructor(e){super(),Pe(this,e,LYe,SYe,Ie,{component:0,position:1})}}function EYe(n){var l,s;let e,t,r,i,a={title:"Confirm Deletion",body:`Are you sure you want to delete "${(l=n[2])==null?void 0:l._instanceName}"?`,okText:"Delete Component",onOk:n[4]};e=new gl({props:a}),n[5](e);let o={title:"Eject block",body:`Ejecting a block breaks it down into multiple components and cannot be undone. Are you sure you want to eject "${(s=n[3])==null?void 0:s._instanceName}"?`,onOk:n[6],okText:"Eject block"};return r=new gl({props:o}),n[7](r),{c(){O(e.$$.fragment),t=q(),O(r.$$.fragment)},m(u,c){B(e,u,c),C(u,t,c),B(r,u,c),i=!0},p(u,[c]){var m,_;const f={};c&4&&(f.body=`Are you sure you want to delete "${(m=u[2])==null?void 0:m._instanceName}"?`),c&4&&(f.onOk=u[4]),e.$set(f);const h={};c&8&&(h.body=`Ejecting a block breaks it down into multiple components and cannot be undone. Are you sure you want to eject "${(_=u[3])==null?void 0:_._instanceName}"?`),c&8&&(h.onOk=u[6]),r.$set(h)},i(u){i||(b(e.$$.fragment,u),b(r.$$.fragment,u),i=!0)},o(u){$(e.$$.fragment,u),$(r.$$.fragment,u),i=!1},d(u){n[5](null),H(e,u),u&&M(t),n[7](null),H(r,u)}}}function TYe(n,e,t){let r,i,a,o;Fe(n,ja,T=>t(8,r=T)),Fe(n,I3,T=>t(9,i=T)),Fe(n,ci,T=>t(10,a=T)),Fe(n,k6,T=>t(11,o=T));let l,s,u,c;const f={["^ArrowUp"]:async T=>{await Xt.actions.components.moveUp(T)},["^ArrowDown"]:async T=>{await Xt.actions.components.moveDown(T)},["^c"]:T=>{Xt.actions.components.copy(T,!1)},["^x"]:T=>{Xt.actions.components.copy(T,!0)},["^v"]:async T=>{await Xt.actions.components.paste(T,"inside")},["^d"]:async T=>{Xt.actions.components.copy(T),await Xt.actions.components.paste(T,"below")},["^e"]:T=>{t(3,c=T),s.show()},["^Enter"]:()=>{a("./new")},Delete:T=>{if((T==null?void 0:T._id)===r.props._id)return!1;t(2,u=T),l.show()},ArrowUp:()=>{Xt.actions.components.selectPrevious()},ArrowDown:()=>{Xt.actions.components.selectNext()},Escape:()=>{if(!o("/new"))return!1;a("./")}},h=async(T,I,P,V=!1)=>{if(!I||!P)return!1;try{P==="Backspace"&&(P="Delete"),V&&(P="^"+P);const j=f[P];if(j)T&&(T.preventDefault(),T.stopPropagation());else return!1;return await j(I)}catch(j){$t.error(j||"Error handling key press")}},m=async T=>{var P;if(T.repeat)return;const I=(P=document.activeElement)==null?void 0:P.tagName.toLowerCase();if(!(["input","textarea"].indexOf(I)!==-1&&T.key!=="Escape"))return await h(T,i,T.key,T.ctrlKey||T.metaKey)},_=async T=>{const{id:I,key:P,ctrlKey:V}=T.detail,j=ru(r.props,I);return await h(null,j,P,V)};ar(()=>(document.addEventListener("keydown",m),document.addEventListener("component-menu",_),()=>{document.removeEventListener("keydown",m),document.removeEventListener("component-menu",_)}));const y=()=>Xt.actions.components.delete(u);function w(T){De[T?"unshift":"push"](()=>{l=T,t(0,l)})}const A=()=>Xt.actions.components.requestEjectBlock(c==null?void 0:c._id);function S(T){De[T?"unshift":"push"](()=>{s=T,t(1,s)})}return[l,s,u,c,y,w,A,S]}class DYe extends Ve{constructor(e){super(),Pe(this,e,TYe,EYe,Ie,{})}}function BYe(n){let e,t,r,i;const a=n[3].default,o=Xn(a,n,n[2],null);return{c(){e=X("div"),o&&o.c(),D(e,"ondragover","return false"),D(e,"ondragenter","return false"),D(e,"class","svelte-1vzr6kt")},m(l,s){C(l,e,s),o&&o.m(e,null),n[4](e),t=!0,r||(i=At(e,"drop",n[1]),r=!0)},p(l,[s]){o&&o.p&&(!t||s&4)&&Zn(o,a,l,l[2],t?Jn(a,l[2],s,null):Qn(l[2]),null)},i(l){t||(b(o,l),t=!0)},o(l){$(o,l),t=!1},d(l){l&&M(e),o&&o.d(l),n[4](null),r=!1,i()}}}function HYe(n,e,t){let{$$slots:r={},$$scope:i}=e,a;Vd("scroll",{scrollTo:u=>{if(!u)return;const c=259,f=32,{scrollLeft:h,scrollTop:m,offsetHeight:_}=a;let y=a.getBoundingClientRect(),w={};const A=u.left+u.width+h-36;A>c?w.left=A-c:w.left=0,w.left===h&&delete w.left;const S=u.top-(y==null?void 0:y.top)+m;S>m+_-2*f?w.top=S-_+2*f:S<m+f?w.top=S-f:delete w.top,!(w.left==null&&w.top==null)&&a.scroll({...w,behavior:"smooth"})}});const l=async()=>{try{await rp.actions.drop()}catch(u){console.error(u),$t.error("Error saving component")}};function s(u){De[u?"unshift":"push"](()=>{a=u,t(0,a)})}return n.$$set=u=>{"$$scope"in u&&t(2,i=u.$$scope)},[a,l,i,r,s]}class OYe extends Ve{constructor(e){super(),Pe(this,e,HYe,BYe,Ie,{})}}function IYe(n){let e;return{c(){e=oe("Add component")},m(t,r){C(t,e,r)},d(t){t&&M(e)}}}function PYe(n){var r;let e,t;return e=new CYe({props:{component:(r=n[2])==null?void 0:r.props}}),{c(){O(e.$$.fragment)},m(i,a){B(e,i,a),t=!0},p(i,a){var l;const o={};a&4&&(o.component=(l=i[2])==null?void 0:l.props),e.$set(o)},i(i){t||(b(e.$$.fragment,i),t=!0)},o(i){$(e.$$.fragment,i),t=!1},d(i){H(e,i)}}}function wP(n){let e,t,r,i;e=new TJ({props:{component:n[3].target,position:n[3].dropPosition}});let a=n[3].dropPosition!==$c.INSIDE&&kP(n);return{c(){O(e.$$.fragment),t=q(),a&&a.c(),r=yt()},m(o,l){B(e,o,l),C(o,t,l),a&&a.m(o,l),C(o,r,l),i=!0},p(o,l){const s={};l&8&&(s.component=o[3].target),l&8&&(s.position=o[3].dropPosition),e.$set(s),o[3].dropPosition!==$c.INSIDE?a?(a.p(o,l),l&8&&b(a,1)):(a=kP(o),a.c(),b(a,1),a.m(r.parentNode,r)):a&&(we(),$(a,1,1,()=>{a=null}),ke())},i(o){i||(b(e.$$.fragment,o),b(a),i=!0)},o(o){$(e.$$.fragment,o),$(a),i=!1},d(o){H(e,o),o&&M(t),a&&a.d(o),o&&M(r)}}}function kP(n){let e,t;return e=new TJ({props:{component:n[3].targetParent,position:$c.INSIDE}}),{c(){O(e.$$.fragment)},m(r,i){B(e,r,i),t=!0},p(r,i){const a={};i&8&&(a.component=r[3].targetParent),e.$set(a)},i(r){t||(b(e.$$.fragment,r),t=!0)},o(r){$(e.$$.fragment,r),t=!1},d(r){H(e,r)}}}function VYe(n){var u,c,f;let e,t,r,i,a,o,l;r=new L5({props:{text:"Screen",indentLevel:0,selected:n[1].selectedComponentId===((u=n[2])==null?void 0:u.props._id),opened:!0,scrollable:!0,icon:"WebPage",id:`component-${(c=n[2])==null?void 0:c.props._id}`,$$slots:{default:[PYe]},$$scope:{ctx:n}}}),r.$on("drop",n[4]),r.$on("click",n[6]),a=new EJ({props:{level:0,components:(f=n[2])==null?void 0:f.props._children}});let s=n[3].dragging&&n[3].valid&&wP(n);return{c(){e=X("ul"),t=X("li"),O(r.$$.fragment),i=q(),O(a.$$.fragment),o=q(),s&&s.c(),D(t,"class","svelte-1ohljq5"),D(e,"class","svelte-1ohljq5")},m(h,m){C(h,e,m),x(e,t),B(r,t,null),x(t,i),B(a,t,null),x(t,o),s&&s.m(t,null),l=!0},p(h,m){var w,A,S;const _={};m&6&&(_.selected=h[1].selectedComponentId===((w=h[2])==null?void 0:w.props._id)),m&4&&(_.id=`component-${(A=h[2])==null?void 0:A.props._id}`),m&132&&(_.$$scope={dirty:m,ctx:h}),r.$set(_);const y={};m&4&&(y.components=(S=h[2])==null?void 0:S.props._children),a.$set(y),h[3].dragging&&h[3].valid?s?(s.p(h,m),m&8&&b(s,1)):(s=wP(h),s.c(),b(s,1),s.m(t,null)):s&&(we(),$(s,1,1,()=>{s=null}),ke())},i(h){l||(b(r.$$.fragment,h),b(a.$$.fragment,h),b(s),l=!0)},o(h){$(r.$$.fragment,h),$(a.$$.fragment,h),$(s),l=!1},d(h){h&&M(e),H(r),H(a),s&&s.d()}}}function RYe(n){let e,t,r,i,a;return t=new _n({props:{cta:!0,$$slots:{default:[IYe]},$$scope:{ctx:n}}}),t.$on("click",n[5]),i=new OYe({props:{$$slots:{default:[VYe]},$$scope:{ctx:n}}}),{c(){e=X("div"),O(t.$$.fragment),r=q(),O(i.$$.fragment),D(e,"class","add-component svelte-1ohljq5")},m(o,l){C(o,e,l),B(t,e,null),C(o,r,l),B(i,o,l),a=!0},p(o,l){const s={};l&128&&(s.$$scope={dirty:l,ctx:o}),t.$set(s);const u={};l&142&&(u.$$scope={dirty:l,ctx:o}),i.$set(u)},i(o){a||(b(t.$$.fragment,o),b(i.$$.fragment,o),a=!0)},o(o){$(t.$$.fragment,o),$(i.$$.fragment,o),a=!1},d(o){o&&M(e),H(t),o&&M(r),H(i,o)}}}function NYe(n){let e,t,r,i;return e=new G3({props:{title:"Components",showExpandIcon:!0,borderRight:!0,$$slots:{default:[RYe]},$$scope:{ctx:n}}}),r=new DYe({}),{c(){O(e.$$.fragment),t=q(),O(r.$$.fragment)},m(a,o){B(e,a,o),C(a,t,o),B(r,a,o),i=!0},p(a,[o]){const l={};o&143&&(l.$$scope={dirty:o,ctx:a}),e.$set(l)},i(a){i||(b(e.$$.fragment,a),b(r.$$.fragment,a),i=!0)},o(a){$(e.$$.fragment,a),$(r.$$.fragment,a),i=!1},d(a){H(e,a),a&&M(t),H(r,a)}}}function FYe(n,e,t){let r,i,a,o;return Fe(n,ci,c=>t(0,r=c)),Fe(n,Xt,c=>t(1,i=c)),Fe(n,ja,c=>t(2,a=c)),Fe(n,rp,c=>t(3,o=c)),[r,i,a,o,async()=>{try{await rp.actions.drop()}catch(c){console.error(c),$t.error("Error saving component")}},()=>r("./new"),()=>{G1(Xt,i.selectedComponentId=a==null?void 0:a.props._id,i)}]}class jYe extends Ve{constructor(e){super(),Pe(this,e,FYe,NYe,Ie,{})}}function zP(n){let e,t,r;return t=new sn({props:{$$slots:{default:[xYe]},$$scope:{ctx:n}}}),{c(){e=X("div"),O(t.$$.fragment),D(e,"class","label svelte-12naooy")},m(i,a){C(i,e,a),B(t,e,null),r=!0},p(i,a){const o={};a&4194305&&(o.$$scope={dirty:a,ctx:i}),t.$set(o)},i(i){r||(b(t.$$.fragment,i),r=!0)},o(i){$(t.$$.fragment,i),r=!1},d(i){i&&M(e),H(t)}}}function xYe(n){let e;return{c(){e=oe(n[0])},m(t,r){C(t,e,r)},p(t,r){r&1&&gt(e,t[0])},d(t){t&&M(e)}}}function AP(n){let e;return{c(){e=X("div"),D(e,"class","text svelte-12naooy")},m(t,r){C(t,e,r),e.innerHTML=n[8]},p(t,r){r&256&&(e.innerHTML=t[8])},d(t){t&&M(e)}}}function UYe(n){let e,t,r,i,a,o,l,s,u=n[4]!=="boolean"&&n[0]&&zP(n);const c=[{componentInstance:n[1]},{value:n[10]},{updateOnChange:!1},{onChange:n[12]},{bindings:n[9]},{name:n[3]},{text:n[0]},{nested:n[6]},{key:n[3]},{type:n[4]},n[5]];var f=n[2];function h(_){let y={};for(let w=0;w<c.length;w+=1)y=au(y,c[w]);return{props:y}}f&&(i=new f(h()),i.$on("change",n[12]));let m=n[8]&&AP(n);return{c(){e=X("div"),u&&u.c(),t=q(),r=X("div"),i&&O(i.$$.fragment),o=q(),m&&m.c(),D(r,"data-cy",a=`${n[3]}-prop-control`),D(r,"class","control svelte-12naooy"),D(e,"class","property-control svelte-12naooy"),D(e,"data-cy",l=`setting-${n[3]}`),Te(e,"highlighted",n[7]&&n[11])},m(_,y){C(_,e,y),u&&u.m(e,null),x(e,t),x(e,r),i&&B(i,r,null),x(e,o),m&&m.m(e,null),s=!0},p(_,[y]){_[4]!=="boolean"&&_[0]?u?(u.p(_,y),y&17&&b(u,1)):(u=zP(_),u.c(),b(u,1),u.m(e,t)):u&&(we(),$(u,1,1,()=>{u=null}),ke());const w=y&5755?Rd(c,[y&2&&{componentInstance:_[1]},y&1024&&{value:_[10]},c[2],y&4096&&{onChange:_[12]},y&512&&{bindings:_[9]},y&8&&{name:_[3]},y&1&&{text:_[0]},y&64&&{nested:_[6]},y&8&&{key:_[3]},y&16&&{type:_[4]},y&32&&$6(_[5])]):{};if(f!==(f=_[2])){if(i){we();const A=i;$(A.$$.fragment,1,0,()=>{H(A,1)}),ke()}f?(i=new f(h()),i.$on("change",_[12]),O(i.$$.fragment),b(i.$$.fragment,1),B(i,r,null)):i=null}else f&&i.$set(w);(!s||y&8&&a!==(a=`${_[3]}-prop-control`))&&D(r,"data-cy",a),_[8]?m?m.p(_,y):(m=AP(_),m.c(),m.m(e,null)):m&&(m.d(1),m=null),(!s||y&8&&l!==(l=`setting-${_[3]}`))&&D(e,"data-cy",l),y&2176&&Te(e,"highlighted",_[7]&&_[11])},i(_){s||(b(u),i&&b(i.$$.fragment,_),s=!0)},o(_){$(u),i&&$(i.$$.fragment,_),s=!1},d(_){_&&M(e),u&&u.d(),i&&H(i),m&&m.d()}}}function qYe(n,e,t){let r,i,a,o,{label:l=""}=e,{componentInstance:s={}}=e,{control:u=null}=e,{key:c=""}=e,{type:f=""}=e,{value:h=null}=e,{defaultValue:m=null}=e,{props:_={}}=e,{onChange:y=()=>{}}=e,{bindings:w=[]}=e,{componentBindings:A=[]}=e,{nested:S=!1}=e,{highlighted:T=!1}=e,{info:I=null}=e;const P=(U,W,te)=>te?[...W||[],...U||[]]:U,V=U=>{let W=U;U&&typeof U=="object"&&("detail"in U?W=U.detail:"target"in U&&(W=U.target.value)),f==="number"&&(W=parseInt(W)),y(typeof W=="string"?o(W):W)},j=(U,W,te)=>{const Q=P3(te,U);return Q==null&&W!==void 0?W:Q};return g5(()=>{T&&Xt.actions.settings.highlight(null)}),n.$$set=U=>{"label"in U&&t(0,l=U.label),"componentInstance"in U&&t(1,s=U.componentInstance),"control"in U&&t(2,u=U.control),"key"in U&&t(3,c=U.key),"type"in U&&t(4,f=U.type),"value"in U&&t(13,h=U.value),"defaultValue"in U&&t(14,m=U.defaultValue),"props"in U&&t(5,_=U.props),"onChange"in U&&t(15,y=U.onChange),"bindings"in U&&t(16,w=U.bindings),"componentBindings"in U&&t(17,A=U.componentBindings),"nested"in U&&t(6,S=U.nested),"highlighted"in U&&t(7,T=U.highlighted),"info"in U&&t(8,I=U.info)},n.$$.update=()=>{n.$$.dirty&8192&&t(11,r=h==null||h===""),n.$$.dirty&196672&&t(9,i=P(w,A,S)),n.$$.dirty&25088&&t(10,a=j(h,m,i)),n.$$.dirty&1024,n.$$.dirty&512&&(o=U=>Bf(i,U))},[l,s,u,c,f,_,S,T,I,i,a,r,V,h,m,y,w,A]}class F7 extends Ve{constructor(e){super(),Pe(this,e,qYe,UYe,Ie,{label:0,componentInstance:1,control:2,key:3,type:4,value:13,defaultValue:14,props:5,onChange:15,bindings:16,componentBindings:17,nested:6,highlighted:7,info:8})}}class DJ{constructor(e){this._isScreen=e,this._children=[],this._json={}}addChild(e){return this._children.push(e),this}customProps(e){for(let t of Object.keys(e))this._json[t]=e[t];return this}json(){const e=$1.cloneDeep(this._json);if(this._children.length!==0)for(let t of this._children)this._isScreen?e.props._children.push(t.json()):e._children.push(t.json());return e}}class c5 extends DJ{constructor(e){super(!1),this._children=[],this._json={_id:C4(),_component:e,_styles:{normal:{},hover:{},active:{},selected:{}},_instanceName:"",_children:[]}}normalStyle(e){return this._json._styles.normal=e,this}hoverStyle(e){return this._json._styles.hover=e,this}customStyle(e){return this._json._styles.custom=e,this}instanceName(e){return this._json._instanceName=e,this}type(e){return this._json.type=e,this}text(e){return this._json.text=e,this}}function E5(n){return n.split("/").map(e=>(e=decodeURIComponent(e),e=e.replace(/ /g,"-"),e.startsWith(":")||(e=encodeURIComponent(e)),e)).join("/").toLowerCase()}class j7 extends DJ{constructor(){super(!0),this._json={showNavigation:!0,width:"Large",props:{_id:C4(),_component:"@budibase/standard-components/container",_styles:{normal:{},hover:{},active:{},selected:{}},_children:[],_instanceName:"",direction:"column",hAlign:"stretch",vAlign:"top",size:"grow",gap:"M"},routing:{route:"",roleId:"BASIC",homeScreen:!1},name:"screen-id"}}normalStyle(e){return this._json.props._styles.normal=e,this}component(e){return this._json.props._component=e,this}table(e){return this._json.props.table=e,this}route(e){return this._json.routing.route=e,this}name(e){return this._json.name=e,this}instanceName(e){return this._json.props._instanceName=e,this}customProps(e){for(let t of Object.keys(e))this._json.props[t]=e[t];return this}}function WYe(n){return n.map(e=>({name:`${e.name} - New`,create:()=>JYe(e),id:GYe,table:e._id}))}const BJ=n=>E5(`/${n.name}/new/row`),GYe="NEW_ROW_TEMPLATE",YYe=n=>E5(`/${n.name}`),KYe=n=>{let e=[];return Object.entries(n||{}).forEach(([t,r])=>{!t||!r||r!=null&&r.autocolumn||e.push(t)}),e},XYe=n=>{const e={type:"table",tableId:n._id},{schema:t}=h2(null,e,{formSchema:!0}),r=new c5("@budibase/standard-components/formblock");return r.customProps({title:"New row",actionType:"Create",actionUrl:YYe(n),showDeleteButton:!1,showSaveButton:!0,fields:KYe(t),dataSource:{label:n.name,tableId:n._id,type:"table"},labelPosition:"left",size:"spectrum--medium"}).instanceName(`${n.name} - Form block`),r},JYe=n=>{const e=XYe(n);return new j7().instanceName(`${n.name} - New`).route(BJ(n)).addChild(OJ(n.name,"New row")).addChild(e).json()};function ZYe(n){return n.map(e=>({name:`${e.name} - List`,create:()=>tKe(e),id:QYe,table:e._id}))}const QYe="ROW_LIST_TEMPLATE",HJ=n=>E5(`/${n.name}`),eKe=n=>{const e=new c5("@budibase/standard-components/tableblock");return e.customProps({linkRows:!0,linkURL:`${HJ(n)}/:id`,showAutoColumns:!1,showTitleButton:!0,titleButtonText:"Create new",titleButtonURL:BJ(n),title:n.name,dataSource:{label:n.name,name:n._id,tableId:n._id,type:"table"},size:"spectrum--medium",paginate:!0,rowCount:8}).instanceName(`${n.name} - Table block`),e},tKe=n=>new j7().route(HJ(n)).instanceName(`${n.name} - List`).addChild(eKe(n)).json();function Aw(n){return`var(--spectrum-global-color-gray-${n})`}function nKe(n){return new c5("@budibase/standard-components/link").text(n).customProps({url:`/${n.toLowerCase()}`,openInNewTab:!1,color:Aw(700),size:"S",align:"left"})}function OJ(n,e){const t=nKe(n).instanceName("Back Link"),r=new c5("@budibase/standard-components/text").type("none").normalStyle({"margin-right":"4px","margin-left":"4px"}).text(">").instanceName("Arrow").customProps({color:Aw(700),size:"S",align:"left"}),i=new c5("@budibase/standard-components/text").text(e).instanceName("Identifier").customProps({color:Aw(700),size:"S",align:"left"});return new c5("@budibase/standard-components/container").customProps({gap:"N",direction:"row",hAlign:"left",vAlign:"middle",size:"shrink"}).normalStyle({width:"600px","margin-right":"auto","margin-left":"auto"}).instanceName("Breadcrumbs").addChild(t).addChild(r).addChild(i)}const rKe={string:"stringfield",number:"numberfield",options:"optionsfield",array:"multifieldselect",boolean:"booleanfield",longform:"longformfield",datetime:"datetimefield",attachment:"attachmentfield",link:"relationshipfield",json:"jsonfield",barcodeqr:"codescanner"};function iKe(n){const{schema:e}=h2(null,n,{formSchema:!0});let t=[];return Object.keys(e||{}).forEach(i=>{const a=e[i];if(a.autocolumn||a.nestedJSON)return;const o=typeof a=="object"?a.type:a,l=rKe[o],s=`@budibase/standard-components/${l}`;if(l){const u=new c5(s).instanceName(i).customProps({field:i,label:i,placeholder:i});if(o==="options")u.customProps({placeholder:"Choose an option",optionsType:"select",optionsSource:"schema"});else if(o==="longform")u.customProps({format:"auto"});else if(o==="array")u.customProps({placeholder:"Choose an option",optionsSource:"schema"});else if(o==="link"){let c=a.relationshipType==="one-to-many"?"Choose an option":"Choose some options";u.customProps({placeholder:c})}else o==="boolean"?u.customProps({text:i,label:""}):o==="datetime"&&u.customProps({enableTime:!(a!=null&&a.dateOnly),timeOnly:a==null?void 0:a.timeOnly,ignoreTimezones:a.ignoreTimezones});t.push(u)}}),t}function aKe(n){let e;return{c(){e=oe("Update form fields")},m(t,r){C(t,e,r)},d(t){t&&M(e)}}}function oKe(n){let e,t,r,i,a;t=new Sr({props:{secondary:!0,wide:!0,$$slots:{default:[aKe]},$$scope:{ctx:n}}}),t.$on("click",n[3]);let o={body:"All components inside this group will be deleted and replaced with fields to match the schema. Are you sure you want to update this Field Group?",okText:"Update",onOk:n[1],title:"Confirm Form Field Update"};return i=new gl({props:o}),n[4](i),{c(){e=X("div"),O(t.$$.fragment),r=q(),O(i.$$.fragment)},m(l,s){C(l,e,s),B(t,e,null),C(l,r,s),B(i,l,s),a=!0},p(l,[s]){const u={};s&64&&(u.$$scope={dirty:s,ctx:l}),t.$set(u);const c={};i.$set(c)},i(l){a||(b(t.$$.fragment,l),b(i.$$.fragment,l),a=!0)},o(l){$(t.$$.fragment,l),$(i.$$.fragment,l),a=!1},d(l){l&&M(e),H(t),l&&M(r),n[4](null),H(i,l)}}}function lKe(n,e,t){let r;Fe(n,j0,u=>t(5,r=u));let{componentInstance:i}=e,a;const o=async()=>{const u=q_(r==null?void 0:r.props,i._id,h=>h._component.endsWith("/form")),c=u==null?void 0:u.dataSource,f=iKe(c);try{await Xt.actions.components.updateSetting("_children",f.map(h=>h.json()))}catch{$t.error("Error resetting form fields")}},l=()=>a==null?void 0:a.show();function s(u){De[u?"unshift":"push"](()=>{a=u,t(0,a)})}return n.$$set=u=>{"componentInstance"in u&&t(2,i=u.componentInstance)},[a,o,i,l,s]}class sKe extends Ve{constructor(e){super(),Pe(this,e,lKe,oKe,Ie,{componentInstance:2})}}function uKe(n){let e;return{c(){e=oe("Eject block")},m(t,r){C(t,e,r)},d(t){t&&M(e)}}}function cKe(n){let e,t,r;return t=new Sr({props:{secondary:!0,$$slots:{default:[uKe]},$$scope:{ctx:n}}}),t.$on("click",n[0]),{c(){e=X("div"),O(t.$$.fragment)},m(i,a){C(i,e,a),B(t,e,null),r=!0},p(i,[a]){const o={};a&2&&(o.$$scope={dirty:a,ctx:i}),t.$set(o)},i(i){r||(b(t.$$.fragment,i),r=!0)},o(i){$(t.$$.fragment,i),r=!1},d(i){i&&M(e),H(t)}}}function fKe(n){return[()=>{document.dispatchEvent(new KeyboardEvent("keydown",{key:"e",ctrlKey:!0}))}]}class pKe extends Ve{constructor(e){super(),Pe(this,e,fKe,cKe,Ie,{})}}function MP(n,e,t){const r=n.slice();return r[12]=e[t],r[13]=e,r[14]=t,r}function dKe(n){let e;return{c(){e=oe("Bindings")},m(t,r){C(t,e,r)},d(t){t&&M(e)}}}function CP(n){let e,t;return e=new _n({props:{secondary:!0,$$slots:{default:[hKe]},$$scope:{ctx:n}}}),e.$on("click",n[4]),{c(){O(e.$$.fragment)},m(r,i){B(e,r,i),t=!0},p(r,i){const a={};i&32768&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){t||(b(e.$$.fragment,r),t=!0)},o(r){$(e.$$.fragment,r),t=!1},d(r){H(e,r)}}}function hKe(n){let e;return{c(){e=oe("Add Binding")},m(t,r){C(t,e,r)},d(t){t&&M(e)}}}function mKe(n){let e;return{c(){e=oe(`Enter a value for each binding. The default values will be used for any
874
874
  values left blank.`)},m(t,r){C(t,e,r)},d(t){t&&M(e)}}}function gKe(n){let e;return{c(){e=oe(`Bindings come in two parts: the binding name, and a default/fallback
875
875
  value. These bindings can be used as Handlebars expressions throughout the
876
876
  query.`)},m(t,r){C(t,e,r)},d(t){t&&M(e)}}}function vKe(n){let e;function t(a,o){return a[2]?mKe:gKe}let r=t(n),i=r(n);return{c(){i.c(),e=yt()},m(a,o){i.m(a,o),C(a,e,o)},p(a,o){r!==(r=t(a))&&(i.d(1),i=r(a),i&&(i.c(),i.m(e.parentNode,e)))},d(a){i.d(a),a&&M(e)}}}function _Ke(n){let e,t;function r(){return n[11](n[14])}return e=new un({props:{hoverable:!0,name:"Close"}}),e.$on("click",r),{c(){O(e.$$.fragment)},m(i,a){B(e,i,a),t=!0},p(i,a){n=i},i(i){t||(b(e.$$.fragment,i),t=!0)},o(i){$(e.$$.fragment,i),t=!1},d(i){H(e,i)}}}function bKe(n){var i;let e,t;function r(...a){return n[10](n[12],...a)}return e=new Za({props:{title:`Query binding "${n[12].name}"`,placeholder:"Value",thin:!0,value:P3(n[3],(i=n[1])==null?void 0:i[n[12].name]),bindings:n[3]}}),e.$on("change",r),{c(){O(e.$$.fragment)},m(a,o){B(e,a,o),t=!0},p(a,o){var s;n=a;const l={};o&1&&(l.title=`Query binding "${n[12].name}"`),o&11&&(l.value=P3(n[3],(s=n[1])==null?void 0:s[n[12].name])),o&8&&(l.bindings=n[3]),e.$set(l)},i(a){t||(b(e.$$.fragment,a),t=!0)},o(a){$(e.$$.fragment,a),t=!1},d(a){H(e,a)}}}function SP(n){let e,t,r,i,a,o,l,s,u,c;function f(T){n[7](T,n[12])}let h={placeholder:"Binding Name",thin:!0,disabled:n[2]};n[12].name!==void 0&&(h.value=n[12].name),e=new Mn({props:h}),De.push(()=>nt(e,"value",f));function m(T){n[8](T,n[12])}function _(...T){return n[9](n[12],...T)}let y={placeholder:"Default",thin:!0,disabled:n[2]};n[12].default!==void 0&&(y.value=n[12].default),i=new Mn({props:y}),De.push(()=>nt(i,"value",m)),i.$on("change",_);const w=[bKe,_Ke],A=[];function S(T,I){return T[2]?0:1}return l=S(n),s=A[l]=w[l](n),{c(){O(e.$$.fragment),r=q(),O(i.$$.fragment),o=q(),s.c(),u=yt()},m(T,I){B(e,T,I),C(T,r,I),B(i,T,I),C(T,o,I),A[l].m(T,I),C(T,u,I),c=!0},p(T,I){n=T;const P={};I&4&&(P.disabled=n[2]),!t&&I&1&&(t=!0,P.value=n[12].name,rt(()=>t=!1)),e.$set(P);const V={};I&4&&(V.disabled=n[2]),!a&&I&1&&(a=!0,V.value=n[12].default,rt(()=>a=!1)),i.$set(V);let j=l;l=S(n),l===j?A[l].p(n,I):(we(),$(A[j],1,1,()=>{A[j]=null}),ke(),s=A[l],s?s.p(n,I):(s=A[l]=w[l](n),s.c()),b(s,1),s.m(u.parentNode,u))},i(T){c||(b(e.$$.fragment,T),b(i.$$.fragment,T),b(s),c=!0)},o(T){$(e.$$.fragment,T),$(i.$$.fragment,T),$(s),c=!1},d(T){H(e,T),T&&M(r),H(i,T),T&&M(o),A[l].d(T),T&&M(u)}}}function yKe(n){let e,t,r,i,a,o,l,s;t=new In({props:{size:"XS",$$slots:{default:[dKe]},$$scope:{ctx:n}}});let u=!n[2]&&CP(n);a=new jt({props:{size:"S",$$slots:{default:[vKe]},$$scope:{ctx:n}}});let c=n[0],f=[];for(let m=0;m<c.length;m+=1)f[m]=SP(MP(n,c,m));const h=m=>$(f[m],1,1,()=>{f[m]=null});return{c(){e=X("div"),O(t.$$.fragment),r=q(),u&&u.c(),i=q(),O(a.$$.fragment),o=q(),l=X("div");for(let m=0;m<f.length;m+=1)f[m].c();D(e,"class","controls svelte-bpqao2"),Te(e,"height",!n[2]),D(l,"class","bindings svelte-bpqao2"),Te(l,"bindable",n[2])},m(m,_){C(m,e,_),B(t,e,null),x(e,r),u&&u.m(e,null),C(m,i,_),B(a,m,_),C(m,o,_),C(m,l,_);for(let y=0;y<f.length;y+=1)f[y].m(l,null);s=!0},p(m,_){const y={};_&32768&&(y.$$scope={dirty:_,ctx:m}),t.$set(y),m[2]?u&&(we(),$(u,1,1,()=>{u=null}),ke()):u?(u.p(m,_),_&4&&b(u,1)):(u=CP(m),u.c(),b(u,1),u.m(e,null)),_&4&&Te(e,"height",!m[2]);const w={};if(_&32772&&(w.$$scope={dirty:_,ctx:m}),a.$set(w),_&111){c=m[0];let A;for(A=0;A<c.length;A+=1){const S=MP(m,c,A);f[A]?(f[A].p(S,_),b(f[A],1)):(f[A]=SP(S),f[A].c(),b(f[A],1),f[A].m(l,null))}for(we(),A=c.length;A<f.length;A+=1)h(A);ke()}_&4&&Te(l,"bindable",m[2])},i(m){if(!s){b(t.$$.fragment,m),b(u),b(a.$$.fragment,m);for(let _=0;_<c.length;_+=1)b(f[_]);s=!0}},o(m){$(t.$$.fragment,m),$(u),$(a.$$.fragment,m),f=f.filter(Boolean);for(let _=0;_<f.length;_+=1)$(f[_]);s=!1},d(m){m&&M(e),H(t),u&&u.d(),m&&M(i),H(a,m),m&&M(o),m&&M(l),Bn(f,m)}}}function $Ke(n){let e,t;return e=new Pt({props:{noPadding:n[2],gap:"S",$$slots:{default:[yKe]},$$scope:{ctx:n}}}),{c(){O(e.$$.fragment)},m(r,i){B(e,r,i),t=!0},p(r,[i]){const a={};i&4&&(a.noPadding=r[2]),i&32783&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){t||(b(e.$$.fragment,r),t=!0)},o(r){$(e.$$.fragment,r),t=!1},d(r){H(e,r)}}}function wKe(n,e,t){let{bindable:r=!0}=e,{queryBindings:i=[]}=e,{bindings:a=[]}=e,{customParams:o={}}=e;function l(){t(0,i=[...i,{}])}function s(y){i.splice(y,1),t(0,i)}function u(y,w){t(1,o[y]=Bf(a,w),o)}function c(y,w){n.$$.not_equal(w.name,y)&&(w.name=y,t(0,i))}function f(y,w){n.$$.not_equal(w.default,y)&&(w.default=y,t(0,i))}const h=(y,w)=>u(y.name,w.detail),m=(y,w)=>u(y.name,w.detail),_=y=>s(y);return n.$$set=y=>{"bindable"in y&&t(2,r=y.bindable),"queryBindings"in y&&t(0,i=y.queryBindings),"bindings"in y&&t(3,a=y.bindings),"customParams"in y&&t(1,o=y.customParams)},[i,o,r,a,l,s,u,c,f,h,m,_]}class IJ extends Ve{constructor(e){super(),Pe(this,e,wKe,$Ke,Ie,{bindable:2,queryBindings:0,bindings:3,customParams:1})}}function LP(n,e,t){const r=n.slice();return r[45]=e[t],r}function EP(n,e,t){const r=n.slice();return r[48]=e[t],r}function TP(n,e,t){const r=n.slice();return r[51]=e[t],r}function DP(n,e,t){const r=n.slice();return r[51]=e[t],r}function BP(n,e,t){const r=n.slice();return r[56]=e[t],r}function HP(n,e,t){const r=n.slice();return r[59]=e[t],r}function OP(n,e,t){const r=n.slice();return r[62]=e[t],r}function IP(n,e,t){const r=n.slice();return r[65]=e[t],r}function PP(n){let e,t,r,i,a,o,l={title:"Query Bindings",$$slots:{body:[CKe],buttons:[zKe]},$$scope:{ctx:n}};return r=new Hf({props:l}),n[30](r),{c(){e=X("i"),t=q(),O(r.$$.fragment),D(e,"class","ri-settings-5-line svelte-xmd5g6")},m(s,u){C(s,e,u),C(s,t,u),B(r,s,u),i=!0,a||(o=At(e,"click",n[21]),a=!0)},p(s,u){const c={};u[0]&259|u[2]&64&&(c.$$scope={dirty:u,ctx:s}),r.$set(c)},i(s){i||(b(r.$$.fragment,s),i=!0)},o(s){$(r.$$.fragment,s),i=!1},d(s){s&&M(e),s&&M(t),n[30](null),H(r,s),a=!1,o()}}}function kKe(n){let e;return{c(){e=oe("Save")},m(t,r){C(t,e,r)},d(t){t&&M(e)}}}function zKe(n){let e,t;return e=new _n({props:{slot:"buttons",cta:!0,$$slots:{default:[kKe]},$$scope:{ctx:n}}}),e.$on("click",n[22]),{c(){O(e.$$.fragment)},m(r,i){B(e,r,i),t=!0},p(r,i){const a={};i[2]&64&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){t||(b(e.$$.fragment,r),t=!0)},o(r){$(e.$$.fragment,r),t=!1},d(r){H(e,r)}}}function VP(n){let e,t,r,i;function a(s){n[28](s)}function o(s){n[29](s)}let l={queryBindings:n[19](n[1])};return n[8]!==void 0&&(l.customParams=n[8]),n[0]!==void 0&&(l.bindings=n[0]),e=new IJ({props:l}),De.push(()=>nt(e,"customParams",a)),De.push(()=>nt(e,"bindings",o)),{c(){O(e.$$.fragment)},m(s,u){B(e,s,u),i=!0},p(s,u){const c={};u[0]&2&&(c.queryBindings=s[19](s[1])),!t&&u[0]&256&&(t=!0,c.customParams=s[8],rt(()=>t=!1)),!r&&u[0]&1&&(r=!0,c.bindings=s[0],rt(()=>r=!1)),e.$set(c)},i(s){i||(b(e.$$.fragment,s),i=!0)},o(s){$(e.$$.fragment,s),i=!1},d(s){H(e,s)}}}function AKe(n){let e=n[19](n[1]).length>0,t,r,i,a=e&&VP(n);return r=new Ez({props:{height:200,query:n[1],schema:n[18](n[1]),datasource:n[20](n[1]),editable:!1}}),{c(){a&&a.c(),t=q(),O(r.$$.fragment)},m(o,l){a&&a.m(o,l),C(o,t,l),B(r,o,l),i=!0},p(o,l){l[0]&2&&(e=o[19](o[1]).length>0),e?a?(a.p(o,l),l[0]&2&&b(a,1)):(a=VP(o),a.c(),b(a,1),a.m(t.parentNode,t)):a&&(we(),$(a,1,1,()=>{a=null}),ke());const s={};l[0]&2&&(s.query=o[1]),l[0]&2&&(s.schema=o[18](o[1])),l[0]&2&&(s.datasource=o[20](o[1])),r.$set(s)},i(o){i||(b(a),b(r.$$.fragment,o),i=!0)},o(o){$(a),$(r.$$.fragment,o),i=!1},d(o){a&&a.d(o),o&&M(t),H(r,o)}}}function MKe(n){let e,t;return e=new Pt({props:{noPadding:!0,gap:"XS",$$slots:{default:[AKe]},$$scope:{ctx:n}}}),{c(){O(e.$$.fragment)},m(r,i){B(e,r,i),t=!0},p(r,i){const a={};i[0]&259|i[2]&64&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){t||(b(e.$$.fragment,r),t=!0)},o(r){$(e.$$.fragment,r),t=!1},d(r){H(e,r)}}}function CKe(n){let e,t;return e=new S4({props:{slot:"body",$$slots:{default:[MKe]},$$scope:{ctx:n}}}),{c(){O(e.$$.fragment)},m(r,i){B(e,r,i),t=!0},p(r,i){const a={};i[0]&259|i[2]&64&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){t||(b(e.$$.fragment,r),t=!0)},o(r){$(e.$$.fragment,r),t=!1},d(r){H(e,r)}}}function SKe(n){let e;return{c(){e=oe("Tables")},m(t,r){C(t,e,r)},d(t){t&&M(e)}}}function RP(n){let e,t=n[65].label+"",r,i,a;function o(){return n[32](n[65])}return{c(){e=X("li"),r=oe(t),D(e,"class","svelte-xmd5g6")},m(l,s){C(l,e,s),x(e,r),i||(a=At(e,"click",o),i=!0)},p(l,s){n=l,s[0]&32768&&t!==(t=n[65].label+"")&&gt(r,t)},d(l){l&&M(e),i=!1,a()}}}function NP(n){let e,t,r,i,a,o,l;e=new ui({}),i=new In({props:{size:"XS",$$slots:{default:[LKe]},$$scope:{ctx:n}}});let s=n[14],u=[];for(let c=0;c<s.length;c+=1)u[c]=FP(OP(n,s,c));return{c(){O(e.$$.fragment),t=q(),r=X("div"),O(i.$$.fragment),a=q(),o=X("ul");for(let c=0;c<u.length;c+=1)u[c].c();D(r,"class","title svelte-xmd5g6"),D(o,"class","svelte-xmd5g6")},m(c,f){B(e,c,f),C(c,t,f),C(c,r,f),B(i,r,null),C(c,a,f),C(c,o,f);for(let h=0;h<u.length;h+=1)u[h].m(o,null);l=!0},p(c,f){const h={};if(f[2]&64&&(h.$$scope={dirty:f,ctx:c}),i.$set(h),f[0]&147456){s=c[14];let m;for(m=0;m<s.length;m+=1){const _=OP(c,s,m);u[m]?u[m].p(_,f):(u[m]=FP(_),u[m].c(),u[m].m(o,null))}for(;m<u.length;m+=1)u[m].d(1);u.length=s.length}},i(c){l||(b(e.$$.fragment,c),b(i.$$.fragment,c),l=!0)},o(c){$(e.$$.fragment,c),$(i.$$.fragment,c),l=!1},d(c){H(e,c),c&&M(t),c&&M(r),H(i),c&&M(a),c&&M(o),Bn(u,c)}}}function LKe(n){let e;return{c(){e=oe("Views")},m(t,r){C(t,e,r)},d(t){t&&M(e)}}}function FP(n){let e,t=n[62].label+"",r,i,a;function o(){return n[33](n[62])}return{c(){e=X("li"),r=oe(t),D(e,"class","svelte-xmd5g6")},m(l,s){C(l,e,s),x(e,r),i||(a=At(e,"click",o),i=!0)},p(l,s){n=l,s[0]&16384&&t!==(t=n[62].label+"")&&gt(r,t)},d(l){l&&M(e),i=!1,a()}}}function jP(n){let e,t,r,i,a,o,l;e=new ui({}),i=new In({props:{size:"XS",$$slots:{default:[EKe]},$$scope:{ctx:n}}});let s=n[13],u=[];for(let c=0;c<s.length;c+=1)u[c]=xP(HP(n,s,c));return{c(){O(e.$$.fragment),t=q(),r=X("div"),O(i.$$.fragment),a=q(),o=X("ul");for(let c=0;c<u.length;c+=1)u[c].c();D(r,"class","title svelte-xmd5g6"),D(o,"class","svelte-xmd5g6")},m(c,f){B(e,c,f),C(c,t,f),C(c,r,f),B(i,r,null),C(c,a,f),C(c,o,f);for(let h=0;h<u.length;h+=1)u[h].m(o,null);l=!0},p(c,f){const h={};if(f[2]&64&&(h.$$scope={dirty:f,ctx:c}),i.$set(h),f[0]&139266){s=c[13];let m;for(m=0;m<s.length;m+=1){const _=HP(c,s,m);u[m]?u[m].p(_,f):(u[m]=xP(_),u[m].c(),u[m].m(o,null))}for(;m<u.length;m+=1)u[m].d(1);u.length=s.length}},i(c){l||(b(e.$$.fragment,c),b(i.$$.fragment,c),l=!0)},o(c){$(e.$$.fragment,c),$(i.$$.fragment,c),l=!1},d(c){H(e,c),c&&M(t),c&&M(r),H(i),c&&M(a),c&&M(o),Bn(u,c)}}}function EKe(n){let e;return{c(){e=oe("Queries")},m(t,r){C(t,e,r)},d(t){t&&M(e)}}}function xP(n){let e,t=n[59].label+"",r,i,a,o;function l(){return n[34](n[59])}return{c(){e=X("li"),r=oe(t),i=q(),D(e,"class","svelte-xmd5g6"),Te(e,"selected",n[1]===n[59])},m(s,u){C(s,e,u),x(e,r),x(e,i),a||(o=At(e,"click",l),a=!0)},p(s,u){n=s,u[0]&8192&&t!==(t=n[59].label+"")&&gt(r,t),u[0]&8194&&Te(e,"selected",n[1]===n[59])},d(s){s&&M(e),a=!1,o()}}}function UP(n){let e,t,r,i,a,o,l;e=new ui({}),i=new In({props:{size:"XS",$$slots:{default:[TKe]},$$scope:{ctx:n}}});let s=n[11],u=[];for(let c=0;c<s.length;c+=1)u[c]=qP(BP(n,s,c));return{c(){O(e.$$.fragment),t=q(),r=X("div"),O(i.$$.fragment),a=q(),o=X("ul");for(let c=0;c<u.length;c+=1)u[c].c();D(r,"class","title svelte-xmd5g6"),D(o,"class","svelte-xmd5g6")},m(c,f){B(e,c,f),C(c,t,f),C(c,r,f),B(i,r,null),C(c,a,f),C(c,o,f);for(let h=0;h<u.length;h+=1)u[h].m(o,null);l=!0},p(c,f){const h={};if(f[2]&64&&(h.$$scope={dirty:f,ctx:c}),i.$set(h),f[0]&133120){s=c[11];let m;for(m=0;m<s.length;m+=1){const _=BP(c,s,m);u[m]?u[m].p(_,f):(u[m]=qP(_),u[m].c(),u[m].m(o,null))}for(;m<u.length;m+=1)u[m].d(1);u.length=s.length}},i(c){l||(b(e.$$.fragment,c),b(i.$$.fragment,c),l=!0)},o(c){$(e.$$.fragment,c),$(i.$$.fragment,c),l=!1},d(c){H(e,c),c&&M(t),c&&M(r),H(i),c&&M(a),c&&M(o),Bn(u,c)}}}function TKe(n){let e;return{c(){e=oe("Relationships")},m(t,r){C(t,e,r)},d(t){t&&M(e)}}}function qP(n){let e,t=n[56].label+"",r,i,a;function o(){return n[35](n[56])}return{c(){e=X("li"),r=oe(t),D(e,"class","svelte-xmd5g6")},m(l,s){C(l,e,s),x(e,r),i||(a=At(e,"click",o),i=!0)},p(l,s){n=l,s[0]&2048&&t!==(t=n[56].label+"")&&gt(r,t)},d(l){l&&M(e),i=!1,a()}}}function WP(n){let e,t,r,i,a,o,l;e=new ui({}),i=new In({props:{size:"XS",$$slots:{default:[DKe]},$$scope:{ctx:n}}});let s=n[10],u=[];for(let c=0;c<s.length;c+=1)u[c]=GP(DP(n,s,c));return{c(){O(e.$$.fragment),t=q(),r=X("div"),O(i.$$.fragment),a=q(),o=X("ul");for(let c=0;c<u.length;c+=1)u[c].c();D(r,"class","title svelte-xmd5g6"),D(o,"class","svelte-xmd5g6")},m(c,f){B(e,c,f),C(c,t,f),C(c,r,f),B(i,r,null),C(c,a,f),C(c,o,f);for(let h=0;h<u.length;h+=1)u[h].m(o,null);l=!0},p(c,f){const h={};if(f[2]&64&&(h.$$scope={dirty:f,ctx:c}),i.$set(h),f[0]&132096){s=c[10];let m;for(m=0;m<s.length;m+=1){const _=DP(c,s,m);u[m]?u[m].p(_,f):(u[m]=GP(_),u[m].c(),u[m].m(o,null))}for(;m<u.length;m+=1)u[m].d(1);u.length=s.length}},i(c){l||(b(e.$$.fragment,c),b(i.$$.fragment,c),l=!0)},o(c){$(e.$$.fragment,c),$(i.$$.fragment,c),l=!1},d(c){H(e,c),c&&M(t),c&&M(r),H(i),c&&M(a),c&&M(o),Bn(u,c)}}}function DKe(n){let e;return{c(){e=oe("Fields")},m(t,r){C(t,e,r)},d(t){t&&M(e)}}}function GP(n){let e,t=n[51].label+"",r,i,a;function o(){return n[36](n[51])}return{c(){e=X("li"),r=oe(t),D(e,"class","svelte-xmd5g6")},m(l,s){C(l,e,s),x(e,r),i||(a=At(e,"click",o),i=!0)},p(l,s){n=l,s[0]&1024&&t!==(t=n[51].label+"")&&gt(r,t)},d(l){l&&M(e),i=!1,a()}}}function YP(n){let e,t,r,i,a,o,l;e=new ui({}),i=new In({props:{size:"XS",$$slots:{default:[BKe]},$$scope:{ctx:n}}});let s=n[9],u=[];for(let c=0;c<s.length;c+=1)u[c]=KP(TP(n,s,c));return{c(){O(e.$$.fragment),t=q(),r=X("div"),O(i.$$.fragment),a=q(),o=X("ul");for(let c=0;c<u.length;c+=1)u[c].c();D(r,"class","title svelte-xmd5g6"),D(o,"class","svelte-xmd5g6")},m(c,f){B(e,c,f),C(c,t,f),C(c,r,f),B(i,r,null),C(c,a,f),C(c,o,f);for(let h=0;h<u.length;h+=1)u[h].m(o,null);l=!0},p(c,f){const h={};if(f[2]&64&&(h.$$scope={dirty:f,ctx:c}),i.$set(h),f[0]&131584){s=c[9];let m;for(m=0;m<s.length;m+=1){const _=TP(c,s,m);u[m]?u[m].p(_,f):(u[m]=KP(_),u[m].c(),u[m].m(o,null))}for(;m<u.length;m+=1)u[m].d(1);u.length=s.length}},i(c){l||(b(e.$$.fragment,c),b(i.$$.fragment,c),l=!0)},o(c){$(e.$$.fragment,c),$(i.$$.fragment,c),l=!1},d(c){H(e,c),c&&M(t),c&&M(r),H(i),c&&M(a),c&&M(o),Bn(u,c)}}}function BKe(n){let e;return{c(){e=oe("JSON Arrays")},m(t,r){C(t,e,r)},d(t){t&&M(e)}}}function KP(n){let e,t=n[51].label+"",r,i,a;function o(){return n[37](n[51])}return{c(){e=X("li"),r=oe(t),D(e,"class","svelte-xmd5g6")},m(l,s){C(l,e,s),x(e,r),i||(a=At(e,"click",o),i=!0)},p(l,s){n=l,s[0]&512&&t!==(t=n[51].label+"")&&gt(r,t)},d(l){l&&M(e),i=!1,a()}}}function XP(n){let e,t,r,i,a,o,l;e=new ui({}),i=new In({props:{size:"XS",$$slots:{default:[HKe]},$$scope:{ctx:n}}});let s=n[12],u=[];for(let c=0;c<s.length;c+=1)u[c]=JP(EP(n,s,c));return{c(){O(e.$$.fragment),t=q(),r=X("div"),O(i.$$.fragment),a=q(),o=X("ul");for(let c=0;c<u.length;c+=1)u[c].c();D(r,"class","title svelte-xmd5g6"),D(o,"class","svelte-xmd5g6")},m(c,f){B(e,c,f),C(c,t,f),C(c,r,f),B(i,r,null),C(c,a,f),C(c,o,f);for(let h=0;h<u.length;h+=1)u[h].m(o,null);l=!0},p(c,f){const h={};if(f[2]&64&&(h.$$scope={dirty:f,ctx:c}),i.$set(h),f[0]&135170){s=c[12];let m;for(m=0;m<s.length;m+=1){const _=EP(c,s,m);u[m]?u[m].p(_,f):(u[m]=JP(_),u[m].c(),u[m].m(o,null))}for(;m<u.length;m+=1)u[m].d(1);u.length=s.length}},i(c){l||(b(e.$$.fragment,c),b(i.$$.fragment,c),l=!0)},o(c){$(e.$$.fragment,c),$(i.$$.fragment,c),l=!1},d(c){H(e,c),c&&M(t),c&&M(r),H(i),c&&M(a),c&&M(o),Bn(u,c)}}}function HKe(n){let e;return{c(){e=oe("Data Providers")},m(t,r){C(t,e,r)},d(t){t&&M(e)}}}function JP(n){let e,t=n[48].label+"",r,i,a,o;function l(){return n[38](n[48])}return{c(){e=X("li"),r=oe(t),i=q(),D(e,"class","svelte-xmd5g6"),Te(e,"selected",n[1]===n[48])},m(s,u){C(s,e,u),x(e,r),x(e,i),a||(o=At(e,"click",l),a=!0)},p(s,u){n=s,u[0]&4096&&t!==(t=n[48].label+"")&&gt(r,t),u[0]&4098&&Te(e,"selected",n[1]===n[48])},d(s){s&&M(e),a=!1,o()}}}function ZP(n){let e,t,r,i,a,o,l;e=new ui({}),i=new In({props:{size:"XS",$$slots:{default:[OKe]},$$scope:{ctx:n}}});let s=n[2],u=[];for(let c=0;c<s.length;c+=1)u[c]=QP(LP(n,s,c));return{c(){O(e.$$.fragment),t=q(),r=X("div"),O(i.$$.fragment),a=q(),o=X("ul");for(let c=0;c<u.length;c+=1)u[c].c();D(r,"class","title svelte-xmd5g6"),D(o,"class","svelte-xmd5g6")},m(c,f){B(e,c,f),C(c,t,f),C(c,r,f),B(i,r,null),C(c,a,f),C(c,o,f);for(let h=0;h<u.length;h+=1)u[h].m(o,null);l=!0},p(c,f){const h={};if(f[2]&64&&(h.$$scope={dirty:f,ctx:c}),i.$set(h),f[0]&131076){s=c[2];let m;for(m=0;m<s.length;m+=1){const _=LP(c,s,m);u[m]?u[m].p(_,f):(u[m]=QP(_),u[m].c(),u[m].m(o,null))}for(;m<u.length;m+=1)u[m].d(1);u.length=s.length}},i(c){l||(b(e.$$.fragment,c),b(i.$$.fragment,c),l=!0)},o(c){$(e.$$.fragment,c),$(i.$$.fragment,c),l=!1},d(c){H(e,c),c&&M(t),c&&M(r),H(i),c&&M(a),c&&M(o),Bn(u,c)}}}function OKe(n){let e;return{c(){e=oe("Other")},m(t,r){C(t,e,r)},d(t){t&&M(e)}}}function QP(n){let e,t=n[45].label+"",r,i,a;function o(){return n[39](n[45])}return{c(){e=X("li"),r=oe(t),D(e,"class","svelte-xmd5g6")},m(l,s){C(l,e,s),x(e,r),i||(a=At(e,"click",o),i=!0)},p(l,s){n=l,s[0]&4&&t!==(t=n[45].label+"")&&gt(r,t)},d(l){l&&M(e),i=!1,a()}}}function IKe(n){var j,U,W,te,Q,le,ie;let e,t,r,i,a,o,l,s,u,c,f,h,m;r=new In({props:{size:"XS",$$slots:{default:[SKe]},$$scope:{ctx:n}}});let _=n[15],y=[];for(let K=0;K<_.length;K+=1)y[K]=RP(IP(n,_,K));let w=((j=n[14])==null?void 0:j.length)&&NP(n),A=((U=n[13])==null?void 0:U.length)&&jP(n),S=((W=n[11])==null?void 0:W.length)&&UP(n),T=((te=n[10])==null?void 0:te.length)&&WP(n),I=((Q=n[9])==null?void 0:Q.length)&&YP(n),P=n[3]&&((le=n[12])==null?void 0:le.length)&&XP(n),V=((ie=n[2])==null?void 0:ie.length)&&ZP(n);return{c(){e=X("div"),t=X("div"),O(r.$$.fragment),i=q(),a=X("ul");for(let K=0;K<y.length;K+=1)y[K].c();o=q(),w&&w.c(),l=q(),A&&A.c(),s=q(),S&&S.c(),u=q(),T&&T.c(),c=q(),I&&I.c(),f=q(),P&&P.c(),h=q(),V&&V.c(),D(t,"class","title svelte-xmd5g6"),D(a,"class","svelte-xmd5g6"),D(e,"class","dropdown svelte-xmd5g6")},m(K,G){C(K,e,G),x(e,t),B(r,t,null),x(e,i),x(e,a);for(let re=0;re<y.length;re+=1)y[re].m(a,null);x(e,o),w&&w.m(e,null),x(e,l),A&&A.m(e,null),x(e,s),S&&S.m(e,null),x(e,u),T&&T.m(e,null),x(e,c),I&&I.m(e,null),x(e,f),P&&P.m(e,null),x(e,h),V&&V.m(e,null),m=!0},p(K,G){var se,de,be,pe,_e,Ae,me;const re={};if(G[2]&64&&(re.$$scope={dirty:G,ctx:K}),r.$set(re),G[0]&163840){_=K[15];let it;for(it=0;it<_.length;it+=1){const $e=IP(K,_,it);y[it]?y[it].p($e,G):(y[it]=RP($e),y[it].c(),y[it].m(a,null))}for(;it<y.length;it+=1)y[it].d(1);y.length=_.length}(se=K[14])!=null&&se.length?w?(w.p(K,G),G[0]&16384&&b(w,1)):(w=NP(K),w.c(),b(w,1),w.m(e,l)):w&&(we(),$(w,1,1,()=>{w=null}),ke()),(de=K[13])!=null&&de.length?A?(A.p(K,G),G[0]&8192&&b(A,1)):(A=jP(K),A.c(),b(A,1),A.m(e,s)):A&&(we(),$(A,1,1,()=>{A=null}),ke()),(be=K[11])!=null&&be.length?S?(S.p(K,G),G[0]&2048&&b(S,1)):(S=UP(K),S.c(),b(S,1),S.m(e,u)):S&&(we(),$(S,1,1,()=>{S=null}),ke()),(pe=K[10])!=null&&pe.length?T?(T.p(K,G),G[0]&1024&&b(T,1)):(T=WP(K),T.c(),b(T,1),T.m(e,c)):T&&(we(),$(T,1,1,()=>{T=null}),ke()),(_e=K[9])!=null&&_e.length?I?(I.p(K,G),G[0]&512&&b(I,1)):(I=YP(K),I.c(),b(I,1),I.m(e,f)):I&&(we(),$(I,1,1,()=>{I=null}),ke()),K[3]&&((Ae=K[12])==null?void 0:Ae.length)?P?(P.p(K,G),G[0]&4104&&b(P,1)):(P=XP(K),P.c(),b(P,1),P.m(e,h)):P&&(we(),$(P,1,1,()=>{P=null}),ke()),(me=K[2])!=null&&me.length?V?(V.p(K,G),G[0]&4&&b(V,1)):(V=ZP(K),V.c(),b(V,1),V.m(e,null)):V&&(we(),$(V,1,1,()=>{V=null}),ke())},i(K){m||(b(r.$$.fragment,K),b(w),b(A),b(S),b(T),b(I),b(P),b(V),m=!0)},o(K){$(r.$$.fragment,K),$(w),$(A),$(S),$(T),$(I),$(P),$(V),m=!1},d(K){K&&M(e),H(r),Bn(y,K),w&&w.d(),A&&A.d(),S&&S.d(),T&&T.d(),I&&I.d(),P&&P.d(),V&&V.d()}}}function PKe(n){var u;let e,t,r,i,a,o;t=new hn({props:{readonly:!0,value:n[16],options:[n[16]]}}),t.$on("click",function(){kn(n[6].show)&&n[6].show.apply(this,arguments)});let l=((u=n[1])==null?void 0:u.type)==="query"&&PP(n),s={anchor:n[5],dataCy:`dataSource-popover-${n[4].selectedComponentId}`,$$slots:{default:[IKe]},$$scope:{ctx:n}};return a=new jd({props:s}),n[40](a),{c(){e=X("div"),O(t.$$.fragment),r=q(),l&&l.c(),i=q(),O(a.$$.fragment),D(e,"class","container svelte-xmd5g6")},m(c,f){C(c,e,f),B(t,e,null),x(e,r),l&&l.m(e,null),n[31](e),C(c,i,f),B(a,c,f),o=!0},p(c,f){var _;n=c;const h={};f[0]&65536&&(h.value=n[16]),f[0]&65536&&(h.options=[n[16]]),t.$set(h),((_=n[1])==null?void 0:_.type)==="query"?l?(l.p(n,f),f[0]&2&&b(l,1)):(l=PP(n),l.c(),b(l,1),l.m(e,null)):l&&(we(),$(l,1,1,()=>{l=null}),ke());const m={};f[0]&32&&(m.anchor=n[5]),f[0]&16&&(m.dataCy=`dataSource-popover-${n[4].selectedComponentId}`),f[0]&65038|f[2]&64&&(m.$$scope={dirty:f,ctx:n}),a.$set(m)},i(c){o||(b(t.$$.fragment,c),b(l),b(a.$$.fragment,c),o=!0)},o(c){$(t.$$.fragment,c),$(l),$(a.$$.fragment,c),o=!1},d(c){c&&M(e),H(t),l&&l.d(),n[31](null),c&&M(i),n[40](null),H(a,c)}}}function VKe(n,e,t){let r,i,a,o,l,s,u,c,f,h,m,_,y,w,A;Fe(n,Bi,vt=>t(41,h=vt)),Fe(n,ya,vt=>t(25,m=vt)),Fe(n,z5,vt=>t(42,_=vt)),Fe(n,Xt,vt=>t(4,y=vt)),Fe(n,j0,vt=>t(26,w=vt)),Fe(n,Br,vt=>t(27,A=vt));let{value:S={}}=e,{otherSources:T}=e,{showAllQueries:I}=e,{bindings:P=[]}=e,{showDataProviders:V=!0}=e;const j=Nn(),U=["attachment","array"];let W,te,Q,le;const ie=vt=>{j("change",vt),te.hide()},K=vt=>{const Ze=h.list.find(Ge=>Ge._id===vt.datasourceId).source;return _[Ze].query[vt.queryVerb]},G=vt=>{var Ze;return((Ze=m.list.find(Ge=>Ge._id===(vt==null?void 0:vt._id)))==null?void 0:Ze.parameters)||[]},re=vt=>h.list.find(Ze=>Ze._id===(vt==null?void 0:vt.datasourceId)),se=()=>{t(8,le=S.queryParams),Q.show()},de=()=>{ie({...S,queryParams:le}),Q.hide()};function be(vt){le=vt,t(8,le)}function pe(vt){P=vt,t(0,P)}function _e(vt){De[vt?"unshift":"push"](()=>{Q=vt,t(7,Q)})}function Ae(vt){De[vt?"unshift":"push"](()=>{W=vt,t(5,W)})}const me=vt=>ie(vt),it=vt=>ie(vt),$e=vt=>ie(vt),Me=vt=>ie(vt),Be=vt=>ie(vt),xe=vt=>ie(vt),ve=vt=>ie(vt),st=vt=>ie(vt);function dt(vt){De[vt?"unshift":"push"](()=>{te=vt,t(6,te)})}return n.$$set=vt=>{"value"in vt&&t(1,S=vt.value),"otherSources"in vt&&t(2,T=vt.otherSources),"showAllQueries"in vt&&t(23,I=vt.showAllQueries),"bindings"in vt&&t(0,P=vt.bindings),"showDataProviders"in vt&&t(3,V=vt.showDataProviders)},n.$$.update=()=>{var vt;n.$$.dirty[0]&2&&t(16,r=(vt=S==null?void 0:S.label)!=null?vt:"Choose an option"),n.$$.dirty[0]&134217728&&t(15,i=A.list.map(Ze=>({label:Ze.name,tableId:Ze._id,type:"table"}))),n.$$.dirty[0]&134217728&&t(14,a=A.list.reduce((Ze,Ge)=>{let et=Object.entries(Ge.views||{}).map(([Ht,an])=>({label:Ht,name:Ht,...an,type:"view"}));return[...Ze,...et]},[])),n.$$.dirty[0]&41943040&&t(13,o=m.list.filter(Ze=>I||Ze.queryVerb==="read"||Ze.readable).map(Ze=>({label:Ze.name,name:Ze.name,...Ze,type:"query"}))),n.$$.dirty[0]&67108880&&t(24,l=c6(w,y.selectedComponentId)),n.$$.dirty[0]&16777216&&t(12,s=l.filter(Ze=>{var Ge;return(Ge=Ze._component)==null?void 0:Ge.endsWith("/dataprovider")}).map(Ze=>({label:Ze._instanceName,name:Ze._instanceName,providerId:Ze._id,value:`{{ literal ${Mo(Ze._id)} }}`,type:"provider"}))),n.$$.dirty[0]&1&&t(11,u=P.filter(Ze=>{var Ge;return((Ge=Ze.fieldSchema)==null?void 0:Ge.type)==="link"}).map(Ze=>{const{providerId:Ge,readableBinding:et,fieldSchema:Ht}=Ze||{},{name:an,tableId:Tt}=Ht||{},he=Mo(Ge);return{providerId:Ge,label:et,fieldName:an,tableId:Tt,type:"link",rowId:`{{ ${he}.${Mo("_id")} }}`,rowTableId:`{{ ${he}.${Mo("tableId")} }}`}})),n.$$.dirty[0]&1&&t(10,c=P.filter(Ze=>{var Ge;return U.includes((Ge=Ze.fieldSchema)==null?void 0:Ge.type)}).map(Ze=>{const{providerId:Ge,readableBinding:et,runtimeBinding:Ht}=Ze,{name:an,type:Tt,tableId:he}=Ze.fieldSchema;return{providerId:Ge,label:et,fieldName:an,fieldType:Tt,tableId:he,type:"field",value:`{{ literal ${Ht} }}`}})),n.$$.dirty[0]&1&&t(9,f=P.filter(Ze=>{var Ge;return((Ge=Ze.fieldSchema)==null?void 0:Ge.type)==="jsonarray"}).map(Ze=>{const{providerId:Ge,readableBinding:et,runtimeBinding:Ht,tableId:an}=Ze,{name:Tt,type:he,prefixKeys:Xe}=Ze.fieldSchema;return{providerId:Ge,label:et,fieldName:Tt,fieldType:he,tableId:an,prefixKeys:Xe,type:"jsonarray",value:`{{ literal ${Ht} }}`}}))},[P,S,T,V,y,W,te,Q,le,f,c,u,s,o,a,i,r,ie,K,G,re,se,de,I,l,m,w,A,be,pe,_e,Ae,me,it,$e,Me,Be,xe,ve,st,dt]}class PJ extends Ve{constructor(e){super(),Pe(this,e,VKe,PKe,Ie,{value:1,otherSources:2,showAllQueries:23,bindings:0,showDataProviders:3},null,[-1,-1,-1])}}function RKe(n){let e,t;return e=new hn({props:{options:n[1],value:n[0]}}),e.$on("change",n[3]),{c(){O(e.$$.fragment)},m(r,i){B(e,r,i),t=!0},p(r,[i]){const a={};i&2&&(a.options=r[1]),i&1&&(a.value=r[0]),e.$set(a)},i(r){t||(b(e.$$.fragment,r),t=!0)},o(r){$(e.$$.fragment,r),t=!1},d(r){H(e,r)}}}function NKe(n,e,t){let r,i;Fe(n,Bi,l=>t(2,i=l));let{value:a=null}=e;function o(l){Hn.call(this,n,l)}return n.$$set=l=>{"value"in l&&t(0,a=l.value)},n.$$.update=()=>{n.$$.dirty&4&&t(1,r=i.list.filter(l=>{var s;return l.source==="S3"&&!((s=l.config)!=null&&s.endpoint)}).map(l=>({label:l.name,value:l._id})))},[a,r,i,o]}class FKe extends Ve{constructor(e){super(),Pe(this,e,NKe,RKe,Ie,{value:0})}}function jKe(n){let e,t;return e=new hn({props:{value:n[0],placeholder:null,options:n[1],getOptionLabel:xKe,getOptionValue:n[2]}}),e.$on("change",n[6]),{c(){O(e.$$.fragment)},m(r,i){B(e,r,i),t=!0},p(r,[i]){const a={};i&1&&(a.value=r[0]),i&2&&(a.options=r[1]),e.$set(a)},i(r){t||(b(e.$$.fragment,r),t=!0)},o(r){$(e.$$.fragment,r),t=!1},d(r){H(e,r)}}}const xKe=n=>n._instanceName;function UKe(n,e,t){let r,i,a,o;Fe(n,Xt,f=>t(4,a=f)),Fe(n,j0,f=>t(5,o=f));let{value:l}=e;const s=Nn(),u=f=>`{{ literal ${Mo(f._id)} }}`;ar(()=>{!(l&&i.find(h=>u(h)===l)!=null)&&i.length&&s("change",u(i[i.length-1]))});function c(f){Hn.call(this,n,f)}return n.$$set=f=>{"value"in f&&t(0,l=f.value)},n.$$.update=()=>{n.$$.dirty&48&&t(3,r=T4(o==null?void 0:o.props,a.selectedComponentId)),n.$$.dirty&8&&t(1,i=r.filter(f=>{var h;return(h=f._component)==null?void 0:h.endsWith("/dataprovider")}))},[l,i,u,r,a,o,c]}class qKe extends Ve{constructor(e){super(),Pe(this,e,UKe,jKe,Ie,{value:0})}}function x7(n,{from:e,to:t},r={}){const i=getComputedStyle(n),a=i.transform==="none"?"":i.transform,[o,l]=i.transformOrigin.split(" ").map(parseFloat),s=e.left+e.width*o/t.width-(t.left+o),u=e.top+e.height*l/t.height-(t.top+l),{delay:c=0,duration:f=m=>Math.sqrt(m)*120,easing:h=Yw}=r;return{delay:c,duration:kn(f)?f(Math.sqrt(s*s+u*u)):f,easing:h,css:(m,_)=>{const y=_*s,w=_*u,A=m+_*e.width/t.width,S=m+_*e.height/t.height;return`transform: ${a} translate(${y}px, ${w}px) scale(${A}, ${S});`}}}const WKe="finalize",GKe="consider";function m6(n,e,t){n.dispatchEvent(new CustomEvent(WKe,{detail:{items:e,info:t}}))}function hp(n,e,t){n.dispatchEvent(new CustomEvent(GKe,{detail:{items:e,info:t}}))}const fb="draggedEntered",U7="draggedLeft",pb="draggedOverIndex",rA="draggedLeftDocument",Qv={LEFT_FOR_ANOTHER:"leftForAnother",OUTSIDE_OF_ANY:"outsideOfAny"};function YKe(n,e,t){n.dispatchEvent(new CustomEvent(fb,{detail:{indexObj:e,draggedEl:t}}))}function KKe(n,e,t){n.dispatchEvent(new CustomEvent(U7,{detail:{draggedEl:e,type:Qv.LEFT_FOR_ANOTHER,theOtherDz:t}}))}function XKe(n,e){n.dispatchEvent(new CustomEvent(U7,{detail:{draggedEl:e,type:Qv.OUTSIDE_OF_ANY}}))}function JKe(n,e,t){n.dispatchEvent(new CustomEvent(pb,{detail:{indexObj:e,draggedEl:t}}))}function ZKe(n){window.dispatchEvent(new CustomEvent(rA,{detail:{draggedEl:n}}))}const f2={DRAG_STARTED:"dragStarted",DRAGGED_ENTERED:fb,DRAGGED_ENTERED_ANOTHER:"dragEnteredAnother",DRAGGED_OVER_INDEX:pb,DRAGGED_LEFT:U7,DRAGGED_LEFT_ALL:"draggedLeftAll",DROPPED_INTO_ZONE:"droppedIntoZone",DROPPED_INTO_ANOTHER:"droppedIntoAnother",DROPPED_OUTSIDE_OF_ANY:"droppedOutsideOfAny",DRAG_STOPPED:"dragStopped"},Y2={POINTER:"pointer",KEYBOARD:"keyboard"},db="isDndShadowItem",iA="data-is-dnd-shadow-item",aA="id:dnd-shadow-placeholder-0000",QKe="dnd-action-dragged-el";let iu="id",Mw=0;function VJ(){Mw++}function RJ(){if(Mw===0)throw new Error("Bug! trying to decrement when there are no dropzones");Mw--}const eXe=typeof window>"u";function NJ(n){let e;const t=n.getBoundingClientRect(),r=getComputedStyle(n),i=r.transform;if(i){let a,o,l,s;if(i.startsWith("matrix3d("))e=i.slice(9,-1).split(/, /),a=+e[0],o=+e[5],l=+e[12],s=+e[13];else if(i.startsWith("matrix("))e=i.slice(7,-1).split(/, /),a=+e[0],o=+e[3],l=+e[4],s=+e[5];else return t;const u=r.transformOrigin,c=t.x-l-(1-a)*parseFloat(u),f=t.y-s-(1-o)*parseFloat(u.slice(u.indexOf(" ")+1)),h=a?t.width/a:n.offsetWidth,m=o?t.height/o:n.offsetHeight;return{x:c,y:f,width:h,height:m,top:f,right:c+h,bottom:f+m,left:c}}else return t}function FJ(n){const e=NJ(n);return{top:e.top+window.scrollY,bottom:e.bottom+window.scrollY,left:e.left+window.scrollX,right:e.right+window.scrollX}}function oA(n){const e=n.getBoundingClientRect();return{top:e.top+window.scrollY,bottom:e.bottom+window.scrollY,left:e.left+window.scrollX,right:e.right+window.scrollX}}function jJ(n){return{x:(n.left+n.right)/2,y:(n.top+n.bottom)/2}}function tXe(n,e){return Math.sqrt(Math.pow(n.x-e.x,2)+Math.pow(n.y-e.y,2))}function lA(n,e){return n.y<=e.bottom&&n.y>=e.top&&n.x>=e.left&&n.x<=e.right}function f7(n){return jJ(oA(n))}function eV(n,e){const t=f7(n),r=FJ(e);return lA(t,r)}function nXe(n,e){const t=f7(n),r=f7(e);return tXe(t,r)}function rXe(n){const e=oA(n);return e.right<0||e.left>document.documentElement.scrollWidth||e.bottom<0||e.top>document.documentElement.scrollHeight}function iXe(n,e){const t=oA(e);return lA(n,t)?{top:n.y-t.top,bottom:t.bottom-n.y,left:n.x-t.left,right:Math.min(t.right,document.documentElement.clientWidth)-n.x}:null}let Gh;function xJ(){Gh=new Map}xJ();function aXe(n){const e=Array.from(n.children).findIndex(t=>t.getAttribute(iA));if(e>=0)return Gh.has(n)||Gh.set(n,new Map),Gh.get(n).set(e,FJ(n.children[e])),e}function oXe(n,e){if(!eV(n,e))return null;const t=e.children;if(t.length===0)return{index:0,isProximityBased:!0};const r=aXe(e);for(let o=0;o<t.length;o++)if(eV(n,t[o])){const l=Gh.has(e)&&Gh.get(e).get(o);return l&&!lA(f7(n),l)?{index:r,isProximityBased:!1}:{index:o,isProximityBased:!1}}let i=Number.MAX_VALUE,a;for(let o=0;o<t.length;o++){const l=nXe(n,t[o]);l<i&&(i=l,a=o)}return{index:a,isProximityBased:!0}}const ag=25;function UJ(){let n;function e(){n={directionObj:void 0,stepPx:0}}e();function t(a){const{directionObj:o,stepPx:l}=n;o&&(a.scrollBy(o.x*l,o.y*l),window.requestAnimationFrame(()=>t(a)))}function r(a){return ag-a}function i(a,o){if(!o)return!1;const l=iXe(a,o);if(l===null)return e(),!1;const s=!!n.directionObj;let[u,c]=[!1,!1];return o.scrollHeight>o.clientHeight&&(l.bottom<ag?(u=!0,n.directionObj={x:0,y:1},n.stepPx=r(l.bottom)):l.top<ag&&(u=!0,n.directionObj={x:0,y:-1},n.stepPx=r(l.top)),!s&&u)||o.scrollWidth>o.clientWidth&&(l.right<ag?(c=!0,n.directionObj={x:1,y:0},n.stepPx=r(l.right)):l.left<ag&&(c=!0,n.directionObj={x:-1,y:0},n.stepPx=r(l.left)),!s&&c)?(t(o),!0):(e(),!1)}return{scrollIfNeeded:i,resetScrolling:e}}function Ky(n){return JSON.stringify(n,null,2)}function tV(n){if(!n)throw new Error("cannot get depth of a falsy node");return qJ(n,0)}function qJ(n,e=0){return n.parentElement?qJ(n.parentElement,e+1):e-1}function lXe(n,e){if(Object.keys(n).length!==Object.keys(e).length)return!1;for(const t in n)if(!{}.hasOwnProperty.call(e,t)||e[t]!==n[t])return!1;return!0}function sXe(n,e){if(n.length!==e.length)return!1;for(let t=0;t<n.length;t++)if(n[t]!==e[t])return!1;return!0}const uXe=200,nV=10,{scrollIfNeeded:cXe,resetScrolling:fXe}=UJ();let Cw;function pXe(n,e,t=uXe){let r,i,a=!1,o;const l=Array.from(e).sort((u,c)=>tV(c)-tV(u));function s(){const u=f7(n);if(!cXe(u,r)&&o&&Math.abs(o.x-u.x)<nV&&Math.abs(o.y-u.y)<nV){Cw=window.setTimeout(s,t);return}if(rXe(n)){ZKe(n);return}o=u;let f=!1;for(const h of l){const m=oXe(n,h);if(m===null)continue;const{index:_}=m;f=!0,h!==r?(r&&KKe(r,n,h),YKe(h,m,n),r=h):_!==i&&(JKe(h,m,n),i=_);break}!f&&a&&r?(XKe(r,n),r=void 0,i=void 0,a=!1):a=!0,Cw=window.setTimeout(s,t)}s()}function dXe(){clearTimeout(Cw),fXe(),xJ()}const hXe=300;let e_;function t_(n){const e=n.touches?n.touches[0]:n;e_={x:e.clientX,y:e.clientY}}const{scrollIfNeeded:mXe,resetScrolling:gXe}=UJ();let WJ;function GJ(){e_&&mXe(e_,document.documentElement),WJ=window.setTimeout(GJ,hXe)}function vXe(){window.addEventListener("mousemove",t_),window.addEventListener("touchmove",t_),GJ()}function _Xe(){window.removeEventListener("mousemove",t_),window.removeEventListener("touchmove",t_),e_=void 0,window.clearTimeout(WJ),gXe()}const bXe=.2;function sd(n){return`${n} ${bXe}s ease`}function yXe(n,e){const t=n.getBoundingClientRect(),r=n.cloneNode(!0);YJ(n,r),r.id=QKe,r.style.position="fixed";let i=t.top,a=t.left;if(r.style.top=`${i}px`,r.style.left=`${a}px`,e){const o=jJ(t);i-=o.y-e.y,a-=o.x-e.x,window.setTimeout(()=>{r.style.top=`${i}px`,r.style.left=`${a}px`},0)}return r.style.margin="0",r.style.boxSizing="border-box",r.style.height=`${t.height}px`,r.style.width=`${t.width}px`,r.style.transition=`${sd("top")}, ${sd("left")}, ${sd("background-color")}, ${sd("opacity")}, ${sd("color")} `,window.setTimeout(()=>r.style.transition+=`, ${sd("width")}, ${sd("height")}`,0),r.style.zIndex="9999",r.style.cursor="grabbing",r}function $Xe(n){n.style.cursor="grab"}function wXe(n,e,t,r,i){const a=e.getBoundingClientRect(),o=n.getBoundingClientRect(),l=a.width-o.width,s=a.height-o.height;if(l||s){const u={left:(t-o.left)/o.width,top:(r-o.top)/o.height};n.style.height=`${a.height}px`,n.style.width=`${a.width}px`,n.style.left=`${parseFloat(n.style.left)-u.left*l}px`,n.style.top=`${parseFloat(n.style.top)-u.top*s}px`}YJ(e,n),i()}function YJ(n,e){const t=window.getComputedStyle(n);Array.from(t).filter(r=>r.startsWith("background")||r.startsWith("padding")||r.startsWith("font")||r.startsWith("text")||r.startsWith("align")||r.startsWith("justify")||r.startsWith("display")||r.startsWith("flex")||r.startsWith("border")||r==="opacity"||r==="color"||r==="list-style-type").forEach(r=>e.style.setProperty(r,t.getPropertyValue(r),t.getPropertyPriority(r)))}function kXe(n,e){n.draggable=!1,n.ondragstart=()=>!1,e?(n.style.userSelect="",n.style.WebkitUserSelect="",n.style.cursor=""):(n.style.userSelect="none",n.style.WebkitUserSelect="none",n.style.cursor="grab")}function zXe(n){n.style.display="none",n.style.position="fixed",n.style.zIndex="-5"}function AXe(n){n.style.visibility="hidden",n.setAttribute(iA,"true")}function MXe(n){n.style.visibility="",n.removeAttribute(iA)}function Z9(n,e=()=>{},t=()=>[]){n.forEach(r=>{const i=e(r);Object.keys(i).forEach(a=>{r.style[a]=i[a]}),t(r).forEach(a=>r.classList.add(a))})}function n_(n,e=()=>{},t=()=>[]){n.forEach(r=>{const i=e(r);Object.keys(i).forEach(a=>{r.style[a]=""}),t(r).forEach(a=>r.classList.contains(a)&&r.classList.remove(a))})}function CXe(n){const e=n.style.minHeight;n.style.minHeight=window.getComputedStyle(n).getPropertyValue("height");const t=n.style.minWidth;return n.style.minWidth=window.getComputedStyle(n).getPropertyValue("width"),function(){n.style.minHeight=e,n.style.minWidth=t}}const SXe="--any--",LXe=100,rV=3,iV={outline:"rgba(255, 255, 102, 0.7) solid 2px"};let Q4,Pu,Tf,hb,as,mb,g6,Lf,X5,Kf,Ih=!1,sA=!1,uA,q7=!1;const D3=new Map,Ds=new Map,Xy=new WeakMap;function EXe(n,e){D3.has(e)||D3.set(e,new Set),D3.get(e).has(n)||(D3.get(e).add(n),VJ())}function aV(n,e){D3.get(e).delete(n),RJ(),D3.get(e).size===0&&D3.delete(e)}function TXe(){vXe();const n=D3.get(hb);for(const t of n)t.addEventListener(fb,KJ),t.addEventListener(U7,XJ),t.addEventListener(pb,JJ);window.addEventListener(rA,v6);const e=Math.max(LXe,...Array.from(n.keys()).map(t=>Ds.get(t).dropAnimationDurationMs));pXe(Pu,n,e*1.07)}function DXe(){_Xe();const n=D3.get(hb);for(const e of n)e.removeEventListener(fb,KJ),e.removeEventListener(U7,XJ),e.removeEventListener(pb,JJ);window.removeEventListener(rA,v6),dXe()}function BXe(n){return n.findIndex(e=>e[iu]===aA)}function gb(n){return n.findIndex(e=>!!e[db]&&e[iu]!==aA)}function KJ(n){let{items:e,dropFromOthersDisabled:t}=Ds.get(n.currentTarget);if(t&&n.currentTarget!==as)return;if(q7=!1,e=e.filter(o=>o[iu]!==g6[iu]),as!==n.currentTarget){const l=Ds.get(as).items.filter(s=>!s[db]);hp(as,l,{trigger:f2.DRAGGED_ENTERED_ANOTHER,id:Tf[iu],source:Y2.POINTER})}else{const o=BXe(e);o!==-1&&e.splice(o,1)}const{index:r,isProximityBased:i}=n.detail.indexObj,a=i&&r===n.currentTarget.children.length-1?r+1:r;Lf=n.currentTarget,e.splice(a,0,g6),hp(n.currentTarget,e,{trigger:f2.DRAGGED_ENTERED,id:Tf[iu],source:Y2.POINTER})}function XJ(n){if(!Ih)return;const{items:e,dropFromOthersDisabled:t}=Ds.get(n.currentTarget);if(t&&n.currentTarget!==as&&n.currentTarget!==Lf)return;const r=gb(e),i=e.splice(r,1)[0];Lf=void 0;const{type:a,theOtherDz:o}=n.detail;if(a===Qv.OUTSIDE_OF_ANY||a===Qv.LEFT_FOR_ANOTHER&&o!==as&&Ds.get(o).dropFromOthersDisabled){q7=!0,Lf=as;const l=Ds.get(as).items;l.splice(mb,0,i),hp(as,l,{trigger:f2.DRAGGED_LEFT_ALL,id:Tf[iu],source:Y2.POINTER})}hp(n.currentTarget,e,{trigger:f2.DRAGGED_LEFT,id:Tf[iu],source:Y2.POINTER})}function JJ(n){const{items:e,dropFromOthersDisabled:t}=Ds.get(n.currentTarget);if(t&&n.currentTarget!==as)return;q7=!1;const{index:r}=n.detail.indexObj,i=gb(e);e.splice(i,1),e.splice(r,0,g6),hp(n.currentTarget,e,{trigger:f2.DRAGGED_OVER_INDEX,id:Tf[iu],source:Y2.POINTER})}function r_(n){n.preventDefault();const e=n.touches?n.touches[0]:n;Kf={x:e.clientX,y:e.clientY},Pu.style.transform=`translate3d(${Kf.x-X5.x}px, ${Kf.y-X5.y}px, 0)`}function v6(){sA=!0,window.removeEventListener("mousemove",r_),window.removeEventListener("touchmove",r_),window.removeEventListener("mouseup",v6),window.removeEventListener("touchend",v6),DXe(),$Xe(Pu),Lf||(Lf=as);let{items:n,type:e}=Ds.get(Lf);n_(D3.get(e),i=>Ds.get(i).dropTargetStyle,i=>Ds.get(i).dropTargetClasses);let t=gb(n);t===-1&&(t=mb),n=n.map(i=>i[db]?Tf:i);function r(){uA(),m6(Lf,n,{trigger:q7?f2.DROPPED_OUTSIDE_OF_ANY:f2.DROPPED_INTO_ZONE,id:Tf[iu],source:Y2.POINTER}),Lf!==as&&m6(as,Ds.get(as).items,{trigger:f2.DROPPED_INTO_ANOTHER,id:Tf[iu],source:Y2.POINTER}),MXe(Lf.children[t]),OXe()}HXe(t,r)}function HXe(n,e){const t=NJ(Lf.children[n]),r={x:t.left-parseFloat(Pu.style.left),y:t.top-parseFloat(Pu.style.top)},{dropAnimationDurationMs:i}=Ds.get(Lf),a=`transform ${i}ms ease`;Pu.style.transition=Pu.style.transition?Pu.style.transition+","+a:a,Pu.style.transform=`translate3d(${r.x}px, ${r.y}px, 0)`,window.setTimeout(e,i)}function OXe(){Pu.remove(),Q4.remove(),Pu=void 0,Q4=void 0,Tf=void 0,hb=void 0,as=void 0,mb=void 0,g6=void 0,Lf=void 0,X5=void 0,Kf=void 0,Ih=!1,sA=!1,uA=void 0,q7=!1}function IXe(n,e){const t={items:void 0,type:void 0,flipDurationMs:0,dragDisabled:!1,morphDisabled:!1,dropFromOthersDisabled:!1,dropTargetStyle:iV,dropTargetClasses:[],transformDraggedElement:()=>{},centreDraggedOnCursor:!1};let r=new Map;function i(){window.addEventListener("mousemove",l,{passive:!1}),window.addEventListener("touchmove",l,{passive:!1,capture:!1}),window.addEventListener("mouseup",o,{passive:!1}),window.addEventListener("touchend",o,{passive:!1})}function a(){window.removeEventListener("mousemove",l),window.removeEventListener("touchmove",l),window.removeEventListener("mouseup",o),window.removeEventListener("touchend",o)}function o(){a(),Q4=void 0,X5=void 0,Kf=void 0}function l(f){f.preventDefault();const h=f.touches?f.touches[0]:f;Kf={x:h.clientX,y:h.clientY},(Math.abs(Kf.x-X5.x)>=rV||Math.abs(Kf.y-X5.y)>=rV)&&(a(),u())}function s(f){if(f.target!==f.currentTarget&&(f.target.value!==void 0||f.target.isContentEditable)||f.button||Ih)return;f.stopPropagation();const h=f.touches?f.touches[0]:f;X5={x:h.clientX,y:h.clientY},Kf={...X5},Q4=f.currentTarget,i()}function u(){Ih=!0;const f=r.get(Q4);mb=f,as=Q4.parentElement;const h=as.getRootNode(),m=h.body||h,{items:_,type:y,centreDraggedOnCursor:w}=t;Tf={..._[f]},hb=y,g6={...Tf,[db]:!0};const A={...g6,[iu]:aA};Pu=yXe(Q4,w&&Kf);function S(){Pu.parentElement?window.requestAnimationFrame(S):(m.appendChild(Pu),Pu.focus(),TXe(),zXe(Q4),m.appendChild(Q4))}window.requestAnimationFrame(S),Z9(Array.from(D3.get(t.type)).filter(T=>T===as||!Ds.get(T).dropFromOthersDisabled),T=>Ds.get(T).dropTargetStyle,T=>Ds.get(T).dropTargetClasses),_.splice(f,1,A),uA=CXe(as),hp(as,_,{trigger:f2.DRAG_STARTED,id:Tf[iu],source:Y2.POINTER}),window.addEventListener("mousemove",r_,{passive:!1}),window.addEventListener("touchmove",r_,{passive:!1,capture:!1}),window.addEventListener("mouseup",v6,{passive:!1}),window.addEventListener("touchend",v6,{passive:!1})}function c({items:f=void 0,flipDurationMs:h=0,type:m=SXe,dragDisabled:_=!1,morphDisabled:y=!1,dropFromOthersDisabled:w=!1,dropTargetStyle:A=iV,dropTargetClasses:S=[],transformDraggedElement:T=()=>{},centreDraggedOnCursor:I=!1}){t.dropAnimationDurationMs=h,t.type&&m!==t.type&&aV(n,t.type),t.type=m,EXe(n,m),t.items=[...f],t.dragDisabled=_,t.morphDisabled=y,t.transformDraggedElement=T,t.centreDraggedOnCursor=I,Ih&&!sA&&(!lXe(A,t.dropTargetStyle)||!sXe(S,t.dropTargetClasses))&&(n_([n],()=>t.dropTargetStyle,()=>S),Z9([n],()=>A,()=>S)),t.dropTargetStyle=A,t.dropTargetClasses=[...S];function P(j,U){return Ds.get(j)?Ds.get(j)[U]:t[U]}Ih&&t.dropFromOthersDisabled!==w&&(w?n_([n],j=>P(j,"dropTargetStyle"),j=>P(j,"dropTargetClasses")):Z9([n],j=>P(j,"dropTargetStyle"),j=>P(j,"dropTargetClasses"))),t.dropFromOthersDisabled=w,Ds.set(n,t);const V=gb(t.items);for(let j=0;j<n.children.length;j++){const U=n.children[j];if(kXe(U,_),j===V){y||wXe(Pu,U,Kf.x,Kf.y,()=>t.transformDraggedElement(Pu,Tf,j)),AXe(U);continue}U.removeEventListener("mousedown",Xy.get(U)),U.removeEventListener("touchstart",Xy.get(U)),_||(U.addEventListener("mousedown",s),U.addEventListener("touchstart",s),Xy.set(U,s)),r.set(U,j)}}return c(e),{update:f=>{c(f)},destroy:()=>{aV(n,t.type),Ds.delete(n)}}}const Sw={DND_ZONE_ACTIVE:"dnd-zone-active",DND_ZONE_DRAG_DISABLED:"dnd-zone-drag-disabled"},PXe={[Sw.DND_ZONE_ACTIVE]:"Tab to one the items and press space-bar or enter to start dragging it",[Sw.DND_ZONE_DRAG_DISABLED]:"This is a disabled drag and drop list"},VXe="dnd-action-aria-alert";let o2;function oV(){o2=document.createElement("div"),function(){o2.id=VXe,o2.style.position="fixed",o2.style.bottom="0",o2.style.left="0",o2.style.zIndex="-5",o2.style.opacity="0",o2.style.height="0",o2.style.width="0",o2.setAttribute("role","alert")}(),document.body.prepend(o2),Object.entries(PXe).forEach(([n,e])=>document.body.prepend(NXe(n,e)))}function RXe(){return eXe?null:(document.readyState==="complete"?oV():window.addEventListener("DOMContentLoaded",oV),{...Sw})}function NXe(n,e){const t=document.createElement("div");return t.id=n,t.innerHTML=`<p>${e}</p>`,t.style.display="none",t.style.position="fixed",t.style.zIndex="-5",t}function Yh(n){o2.innerHTML="";const e=document.createTextNode(n);o2.appendChild(e),o2.style.display="none",o2.style.display="inline"}const FXe="--any--",lV={outline:"rgba(255, 255, 102, 0.7) solid 2px"};let Xf=!1,Lw,kc,Cd="",md,v4,Q5="";const i_=new WeakSet,sV=new WeakMap,uV=new WeakMap,Ew=new Map,Iu=new Map,E3=new Map,cV=RXe();function jXe(n,e){E3.size===0&&(window.addEventListener("keydown",ZJ),window.addEventListener("click",QJ)),E3.has(e)||E3.set(e,new Set),E3.get(e).has(n)||(E3.get(e).add(n),VJ())}function fV(n,e){kc===n&&p7(),E3.get(e).delete(n),RJ(),E3.get(e).size===0&&E3.delete(e),E3.size===0&&(window.removeEventListener("keydown",ZJ),window.removeEventListener("click",QJ))}function ZJ(n){if(!!Xf)switch(n.key){case"Escape":{p7();break}}}function QJ(){!Xf||i_.has(document.activeElement)||p7()}function xXe(n){if(!Xf)return;const e=n.currentTarget;if(e===kc)return;Cd=e.getAttribute("aria-label")||"";const{items:t}=Iu.get(kc),r=t.find(u=>u[iu]===v4),i=t.indexOf(r),a=t.splice(i,1)[0],{items:o,autoAriaDisabled:l}=Iu.get(e);e.getBoundingClientRect().top<kc.getBoundingClientRect().top||e.getBoundingClientRect().left<kc.getBoundingClientRect().left?(o.push(a),l||Yh(`Moved item ${Q5} to the end of the list ${Cd}`)):(o.unshift(a),l||Yh(`Moved item ${Q5} to the beginning of the list ${Cd}`)),m6(kc,t,{trigger:f2.DROPPED_INTO_ANOTHER,id:v4,source:Y2.KEYBOARD}),m6(e,o,{trigger:f2.DROPPED_INTO_ZONE,id:v4,source:Y2.KEYBOARD}),kc=e}function eZ(){Ew.forEach(({update:n},e)=>n(Iu.get(e)))}function p7(n=!0){Iu.get(kc).autoAriaDisabled||Yh(`Stopped dragging item ${Q5}`),i_.has(document.activeElement)&&document.activeElement.blur(),n&&hp(kc,Iu.get(kc).items,{trigger:f2.DRAG_STOPPED,id:v4,source:Y2.KEYBOARD}),n_(E3.get(Lw),e=>Iu.get(e).dropTargetStyle,e=>Iu.get(e).dropTargetClasses),md=null,v4=null,Q5="",Lw=null,kc=null,Cd="",Xf=!1,eZ()}function UXe(n,e){const t={items:void 0,type:void 0,dragDisabled:!1,zoneTabIndex:0,dropFromOthersDisabled:!1,dropTargetStyle:lV,dropTargetClasses:[],autoAriaDisabled:!1};function r(c,f,h){c.length<=1||c.splice(h,1,c.splice(f,1,c[h])[0])}function i(c){switch(c.key){case"Enter":case" ":{if((c.target.disabled!==void 0||c.target.href||c.target.isContentEditable)&&!i_.has(c.target))return;c.preventDefault(),c.stopPropagation(),Xf?p7():a(c);break}case"ArrowDown":case"ArrowRight":{if(!Xf)return;c.preventDefault(),c.stopPropagation();const{items:f}=Iu.get(n),h=Array.from(n.children),m=h.indexOf(c.currentTarget);m<h.length-1&&(t.autoAriaDisabled||Yh(`Moved item ${Q5} to position ${m+2} in the list ${Cd}`),r(f,m,m+1),m6(n,f,{trigger:f2.DROPPED_INTO_ZONE,id:v4,source:Y2.KEYBOARD}));break}case"ArrowUp":case"ArrowLeft":{if(!Xf)return;c.preventDefault(),c.stopPropagation();const{items:f}=Iu.get(n),m=Array.from(n.children).indexOf(c.currentTarget);m>0&&(t.autoAriaDisabled||Yh(`Moved item ${Q5} to position ${m} in the list ${Cd}`),r(f,m,m-1),m6(n,f,{trigger:f2.DROPPED_INTO_ZONE,id:v4,source:Y2.KEYBOARD}));break}}}function a(c){l(c.currentTarget),kc=n,Lw=t.type,Xf=!0;const f=Array.from(E3.get(t.type)).filter(h=>h===kc||!Iu.get(h).dropFromOthersDisabled);if(Z9(f,h=>Iu.get(h).dropTargetStyle,h=>Iu.get(h).dropTargetClasses),!t.autoAriaDisabled){let h=`Started dragging item ${Q5}. Use the arrow keys to move it within its list ${Cd}`;f.length>1&&(h+=", or tab to another list in order to move the item into it"),Yh(h)}hp(n,Iu.get(n).items,{trigger:f2.DRAG_STARTED,id:v4,source:Y2.KEYBOARD}),eZ()}function o(c){!Xf||c.currentTarget!==md&&(c.stopPropagation(),p7(!1),a(c))}function l(c){const{items:f}=Iu.get(n),h=Array.from(n.children),m=h.indexOf(c);md=c,md.tabIndex=0,v4=f[m][iu],Q5=h[m].getAttribute("aria-label")||""}function s({items:c=[],type:f=FXe,dragDisabled:h=!1,zoneTabIndex:m=0,dropFromOthersDisabled:_=!1,dropTargetStyle:y=lV,dropTargetClasses:w=[],autoAriaDisabled:A=!1}){t.items=[...c],t.dragDisabled=h,t.dropFromOthersDisabled=_,t.zoneTabIndex=m,t.dropTargetStyle=y,t.dropTargetClasses=w,t.autoAriaDisabled=A,A||(n.setAttribute("aria-disabled",h),n.setAttribute("role","list"),n.setAttribute("aria-describedby",h?cV.DND_ZONE_DRAG_DISABLED:cV.DND_ZONE_ACTIVE)),t.type&&f!==t.type&&fV(n,t.type),t.type=f,jXe(n,f),Iu.set(n,t),Xf?n.tabIndex=n===kc||md.contains(n)||t.dropFromOthersDisabled||kc&&t.type!==Iu.get(kc).type?-1:0:n.tabIndex=t.zoneTabIndex,n.addEventListener("focus",xXe);for(let S=0;S<n.children.length;S++){const T=n.children[S];i_.add(T),T.tabIndex=Xf?-1:0,A||T.setAttribute("role","listitem"),T.removeEventListener("keydown",sV.get(T)),T.removeEventListener("click",uV.get(T)),h||(T.addEventListener("keydown",i),sV.set(T,i),T.addEventListener("click",o),uV.set(T,o)),Xf&&t.items[S][iu]===v4&&(md=T,md.tabIndex=0,T.focus())}}s(e);const u={update:c=>{s(c)},destroy:()=>{fV(n,t.type),Iu.delete(n),Ew.delete(n)}};return Ew.set(n,u),u}function vb(n,e){pV(e);const t=IXe(n,e),r=UXe(n,e);return{update:i=>{pV(i),t.update(i),r.update(i)},destroy:()=>{t.destroy(),r.destroy()}}}function pV(n){const{items:e,flipDurationMs:t,type:r,dragDisabled:i,morphDisabled:a,dropFromOthersDisabled:o,zoneTabIndex:l,dropTargetStyle:s,dropTargetClasses:u,transformDraggedElement:c,autoAriaDisabled:f,centreDraggedOnCursor:h,...m}=n;if(Object.keys(m).length>0&&console.warn("dndzone will ignore unknown options",m),!e)throw new Error("no 'items' key provided to dndzone");const _=e.find(y=>!{}.hasOwnProperty.call(y,iu));if(_)throw new Error(`missing '${iu}' property for item ${Ky(_)}`);if(u&&!Array.isArray(u))throw new Error(`dropTargetClasses should be an array but instead it is a ${typeof u}, ${Ky(u)}`);if(l&&!qXe(l))throw new Error(`zoneTabIndex should be a number but instead it is a ${typeof l}, ${Ky(l)}`)}function qXe(n){return!isNaN(n)&&function(e){return(e|0)===e}(parseFloat(n))}function WXe(n){let e;return{c(){e=oe("Screen")},m(t,r){C(t,e,r)},d(t){t&&M(e)}}}function GXe(n){let e,t,r,i,a,o,l,s,u,c;t=new sn({props:{small:!0,$$slots:{default:[WXe]},$$scope:{ctx:n}}}),i=new Za({props:{title:"Destination URL",placeholder:"/screen",value:n[0].url,bindings:n[1]}}),i.$on("change",n[2]);function f(m){n[3](m)}let h={text:"Open screen in modal"};return n[0].peek!==void 0&&(h.value=n[0].peek),s=new ju({props:h}),De.push(()=>nt(s,"value",f)),{c(){e=X("div"),O(t.$$.fragment),r=q(),O(i.$$.fragment),a=q(),o=X("div"),l=q(),O(s.$$.fragment),D(e,"class","root svelte-15fuuda")},m(m,_){C(m,e,_),B(t,e,null),x(e,r),B(i,e,null),x(e,a),x(e,o),x(e,l),B(s,e,null),c=!0},p(m,[_]){const y={};_&16&&(y.$$scope={dirty:_,ctx:m}),t.$set(y);const w={};_&1&&(w.value=m[0].url),_&2&&(w.bindings=m[1]),i.$set(w);const A={};!u&&_&1&&(u=!0,A.value=m[0].peek,rt(()=>u=!1)),s.$set(A)},i(m){c||(b(t.$$.fragment,m),b(i.$$.fragment,m),b(s.$$.fragment,m),c=!0)},o(m){$(t.$$.fragment,m),$(i.$$.fragment,m),$(s.$$.fragment,m),c=!1},d(m){m&&M(e),H(t),H(i),H(s)}}}function YXe(n,e,t){let{parameters:r}=e,{bindings:i=[]}=e;const a=l=>t(0,r.url=l.detail,r);function o(l){n.$$.not_equal(r.peek,l)&&(r.peek=l,t(0,r))}return n.$$set=l=>{"parameters"in l&&t(0,r=l.parameters),"bindings"in l&&t(1,i=l.bindings)},[r,i,a,o]}class KXe extends Ve{constructor(e){super(),Pe(this,e,YXe,GXe,Ie,{parameters:0,bindings:1})}}function dV(n,e,t){const r=n.slice();return r[16]=e[t],r[18]=t,r}function hV(n){let e,t,r,i,a=n[4],o=[];for(let s=0;s<a.length;s+=1)o[s]=mV(dV(n,a,s));const l=s=>$(o[s],1,1,()=>{o[s]=null});return r=new _n({props:{icon:"AddCircle",secondary:!0,$$slots:{default:[eJe]},$$scope:{ctx:n}}}),r.$on("click",n[5]),{c(){for(let s=0;s<o.length;s+=1)o[s].c();e=q(),t=X("div"),O(r.$$.fragment),$n(t,"margin-top","10px")},m(s,u){for(let c=0;c<o.length;c+=1)o[c].m(s,u);C(s,e,u),C(s,t,u),B(r,t,null),i=!0},p(s,u){if(u&479){a=s[4];let f;for(f=0;f<a.length;f+=1){const h=dV(s,a,f);o[f]?(o[f].p(h,u),b(o[f],1)):(o[f]=mV(h),o[f].c(),b(o[f],1),o[f].m(e.parentNode,e))}for(we(),f=a.length;f<o.length;f+=1)l(f);ke()}const c={};u&524290&&(c.$$scope={dirty:u,ctx:s}),r.$set(c)},i(s){if(!i){for(let u=0;u<a.length;u+=1)b(o[u]);b(r.$$.fragment,s),i=!0}},o(s){o=o.filter(Boolean);for(let u=0;u<o.length;u+=1)$(o[u]);$(r.$$.fragment,s),i=!1},d(s){Bn(o,s),s&&M(e),s&&M(t),H(r)}}}function XXe(n){let e;return{c(){e=oe(n[1])},m(t,r){C(t,e,r)},p(t,r){r&2&&gt(e,t[1])},d(t){t&&M(e)}}}function JXe(n){let e,t;function r(...i){return n[11](n[18],...i)}return e=new Mn({props:{thin:!0,secondary:!0,value:n[16][0]}}),e.$on("change",r),{c(){O(e.$$.fragment)},m(i,a){B(e,i,a),t=!0},p(i,a){n=i;const o={};a&16&&(o.value=n[16][0]),e.$set(o)},i(i){t||(b(e.$$.fragment,i),t=!0)},o(i){$(e.$$.fragment,i),t=!1},d(i){H(e,i)}}}function ZXe(n){let e,t;function r(...i){return n[10](n[18],...i)}return e=new hn({props:{value:n[16][0],options:n[0].map(gV)}}),e.$on("change",r),{c(){O(e.$$.fragment)},m(i,a){B(e,i,a),t=!0},p(i,a){n=i;const o={};a&16&&(o.value=n[16][0]),a&1&&(o.options=n[0].map(gV)),e.$set(o)},i(i){t||(b(e.$$.fragment,i),t=!0)},o(i){$(e.$$.fragment,i),t=!1},d(i){H(e,i)}}}function QXe(n){let e;return{c(){e=oe(n[2])},m(t,r){C(t,e,r)},p(t,r){r&4&&gt(e,t[2])},d(t){t&&M(e)}}}function mV(n){let e,t,r,i,a,o,l,s,u,c,f;e=new sn({props:{small:!0,$$slots:{default:[XXe]},$$scope:{ctx:n}}});const h=[ZXe,JXe],m=[];function _(A,S){return A[0]?0:1}r=_(n),i=m[r]=h[r](n),o=new sn({props:{small:!0,$$slots:{default:[QXe]},$$scope:{ctx:n}}});function y(...A){return n[12](n[18],...A)}s=new Za({props:{title:`Value for "${n[16][0]}"`,value:n[16][1],bindings:n[3]}}),s.$on("change",y);function w(){return n[13](n[16])}return c=new Sr({props:{size:"S",quiet:!0,icon:"Delete"}}),c.$on("click",w),{c(){O(e.$$.fragment),t=q(),i.c(),a=q(),O(o.$$.fragment),l=q(),O(s.$$.fragment),u=q(),O(c.$$.fragment)},m(A,S){B(e,A,S),C(A,t,S),m[r].m(A,S),C(A,a,S),B(o,A,S),C(A,l,S),B(s,A,S),C(A,u,S),B(c,A,S),f=!0},p(A,S){n=A;const T={};S&524290&&(T.$$scope={dirty:S,ctx:n}),e.$set(T);let I=r;r=_(n),r===I?m[r].p(n,S):(we(),$(m[I],1,1,()=>{m[I]=null}),ke(),i=m[r],i?i.p(n,S):(i=m[r]=h[r](n),i.c()),b(i,1),i.m(a.parentNode,a));const P={};S&524292&&(P.$$scope={dirty:S,ctx:n}),o.$set(P);const V={};S&16&&(V.title=`Value for "${n[16][0]}"`),S&16&&(V.value=n[16][1]),S&8&&(V.bindings=n[3]),s.$set(V)},i(A){f||(b(e.$$.fragment,A),b(i),b(o.$$.fragment,A),b(s.$$.fragment,A),b(c.$$.fragment,A),f=!0)},o(A){$(e.$$.fragment,A),$(i),$(o.$$.fragment,A),$(s.$$.fragment,A),$(c.$$.fragment,A),f=!1},d(A){H(e,A),A&&M(t),m[r].d(A),A&&M(a),H(o,A),A&&M(l),H(s,A),A&&M(u),H(c,A)}}}function eJe(n){let e,t;return{c(){e=oe(`Add
@@ -940,7 +940,7 @@ Use Save As... to download, then click back to return to this page.`)&&(location
940
940
  `),t=X("i"),i=oe(r),a=oe("?"),o=oe(`
941
941
  This action cannot be undone.`)},m(l,s){C(l,e,s),C(l,t,s),x(t,i),x(t,a),C(l,o,s)},p(l,s){s&1&&r!==(r=l[0].name+"")&&gt(i,r)},d(l){l&&M(e),l&&M(t),l&&M(o)}}}function Ast(n){let e,t,r,i,a,o;e=new ou({props:{$$slots:{control:[kst],default:[wst]},$$scope:{ctx:n}}});let l={okText:"Delete Automation",onOk:n[3],title:"Confirm Deletion",$$slots:{default:[zst]},$$scope:{ctx:n}};r=new gl({props:l}),n[5](r);let s={automation:n[0]};return a=new _st({props:s}),n[6](a),{c(){O(e.$$.fragment),t=q(),O(r.$$.fragment),i=q(),O(a.$$.fragment)},m(u,c){B(e,u,c),C(u,t,c),B(r,u,c),C(u,i,c),B(a,u,c),o=!0},p(u,[c]){const f={};c&518&&(f.$$scope={dirty:c,ctx:u}),e.$set(f);const h={};c&513&&(h.$$scope={dirty:c,ctx:u}),r.$set(h);const m={};c&1&&(m.automation=u[0]),a.$set(m)},i(u){o||(b(e.$$.fragment,u),b(r.$$.fragment,u),b(a.$$.fragment,u),o=!0)},o(u){$(e.$$.fragment,u),$(r.$$.fragment,u),$(a.$$.fragment,u),o=!1},d(u){H(e,u),u&&M(t),n[5](null),H(r,u),u&&M(i),n[6](null),H(a,u)}}}function Mst(n,e,t){let r,i;Fe(n,Or,h=>t(7,r=h)),Fe(n,ci,h=>t(8,i=h));let{automation:a}=e,o,l;async function s(){try{await Or.actions.delete(a),$t.success("Automation deleted successfully"),i("../automate")}catch{$t.error("Error deleting automation")}}async function u(){try{await Or.actions.duplicate(a),$t.success("Automation has been duplicated successfully"),i(`./${r.selectedAutomation.automation._id}`)}catch{$t.error("Error duplicating automation")}}function c(h){De[h?"unshift":"push"](()=>{o=h,t(1,o)})}function f(h){De[h?"unshift":"push"](()=>{l=h,t(2,l)})}return n.$$set=h=>{"automation"in h&&t(0,a=h.automation)},[a,o,l,s,u,c,f]}class Cst extends Ve{constructor(e){super(),Pe(this,e,Mst,Ast,Ie,{automation:0})}}function lF(n,e,t){const r=n.slice();return r[5]=e[t],r[7]=t,r}function Sst(n){let e,t,r;return e=new Cst({props:{automation:n[5]}}),{c(){O(e.$$.fragment),t=q()},m(i,a){B(e,i,a),C(i,t,a),r=!0},p(i,a){const o={};a&1&&(o.automation=i[5]),e.$set(o)},i(i){r||(b(e.$$.fragment,i),r=!0)},o(i){$(e.$$.fragment,i),r=!1},d(i){H(e,i),i&&M(t)}}}function sF(n){let e,t;function r(){return n[3](n[5])}return e=new L5({props:{border:n[7]>0,icon:"ShareAndroid",text:n[5].name,selected:n[5]._id===n[1],$$slots:{default:[Sst]},$$scope:{ctx:n}}}),e.$on("click",r),{c(){O(e.$$.fragment)},m(i,a){B(e,i,a),t=!0},p(i,a){n=i;const o={};a&1&&(o.text=n[5].name),a&3&&(o.selected=n[5]._id===n[1]),a&257&&(o.$$scope={dirty:a,ctx:n}),e.$set(o)},i(i){t||(b(e.$$.fragment,i),t=!0)},o(i){$(e.$$.fragment,i),t=!1},d(i){H(e,i)}}}function Lst(n){let e,t,r=n[0].automations.sort(uF),i=[];for(let o=0;o<r.length;o+=1)i[o]=sF(lF(n,r,o));const a=o=>$(i[o],1,1,()=>{i[o]=null});return{c(){e=X("div");for(let o=0;o<i.length;o+=1)i[o].c();D(e,"class","automations-list svelte-g64vb")},m(o,l){C(o,e,l);for(let s=0;s<i.length;s+=1)i[s].m(e,null);t=!0},p(o,[l]){if(l&7){r=o[0].automations.sort(uF);let s;for(s=0;s<r.length;s+=1){const u=lF(o,r,s);i[s]?(i[s].p(u,l),b(i[s],1)):(i[s]=sF(u),i[s].c(),b(i[s],1),i[s].m(e,null))}for(we(),s=r.length;s<i.length;s+=1)a(s);ke()}},i(o){if(!t){for(let l=0;l<r.length;l+=1)b(i[l]);t=!0}},o(o){i=i.filter(Boolean);for(let l=0;l<i.length;l+=1)$(i[l]);t=!1},d(o){o&&M(e),Bn(i,o)}}}const uF=n=>n.name;function Est(n,e,t){let r,i,a;Fe(n,ci,s=>t(4,i=s)),Fe(n,Or,s=>t(0,a=s)),ar(async()=>{try{await Or.actions.fetch()}catch{$t.error("Error getting automations list")}});function o(s){Or.actions.select(s),i(`./${s._id}`)}const l=s=>o(s);return n.$$.update=()=>{var s,u;n.$$.dirty&1&&t(1,r=(u=(s=a.selectedAutomation)==null?void 0:s.automation)==null?void 0:u._id)},[a,r,o,l]}class Tst extends Ve{constructor(e){super(),Pe(this,e,Est,Lst,Ie,{})}}function cF(n,e,t){const r=n.slice();return r[17]=e[t][0],r[18]=e[t][1],r}function Dst(n){let e;return{c(){e=oe(`Please name your automation, then select a trigger. Every automation must
942
942
  start with a trigger.`)},m(t,r){C(t,e,r)},d(t){t&&M(e)}}}function Bst(n){let e;return{c(){e=oe("Triggers")},m(t,r){C(t,e,r)},d(t){t&&M(e)}}}function Hst(n){let e=n[18].name+"",t;return{c(){t=oe(e)},m(r,i){C(r,t,i)},p(r,i){i&8&&e!==(e=r[18].name+"")&&gt(t,e)},d(r){r&&M(t)}}}function fF(n){let e,t,r,i,a,o,l,s,u,c;r=new un({props:{name:n[18].icon}}),o=new jt({props:{size:"S",$$slots:{default:[Hst]},$$scope:{ctx:n}}});function f(){return n[13](n[18])}return{c(){e=X("div"),t=X("div"),O(r.$$.fragment),i=q(),a=X("span"),O(o.$$.fragment),l=q(),D(a,"class","icon-spacing svelte-d3iboa"),D(t,"class","item-body svelte-d3iboa"),D(e,"class","item svelte-d3iboa"),Te(e,"selected",n[2]===n[18].name)},m(h,m){C(h,e,m),x(e,t),B(r,t,null),x(t,i),x(t,a),B(o,a,null),x(e,l),s=!0,u||(c=At(e,"click",f),u=!0)},p(h,m){n=h;const _={};m&8&&(_.name=n[18].icon),r.$set(_);const y={};m&2097160&&(y.$$scope={dirty:m,ctx:n}),o.$set(y),m&12&&Te(e,"selected",n[2]===n[18].name)},i(h){s||(b(r.$$.fragment,h),b(o.$$.fragment,h),s=!0)},o(h){$(r.$$.fragment,h),$(o.$$.fragment,h),s=!1},d(h){h&&M(e),H(r),H(o),u=!1,c()}}}function Ost(n){let e,t,r,i;e=new jt({props:{size:"S",$$slots:{default:[Bst]},$$scope:{ctx:n}}});let a=n[3],o=[];for(let s=0;s<a.length;s+=1)o[s]=fF(cF(n,a,s));const l=s=>$(o[s],1,1,()=>{o[s]=null});return{c(){O(e.$$.fragment),t=q(),r=X("div");for(let s=0;s<o.length;s+=1)o[s].c();D(r,"class","item-list svelte-d3iboa")},m(s,u){B(e,s,u),C(s,t,u),C(s,r,u);for(let c=0;c<o.length;c+=1)o[c].m(r,null);i=!0},p(s,u){const c={};if(u&2097152&&(c.$$scope={dirty:u,ctx:s}),e.$set(c),u&76){a=s[3];let f;for(f=0;f<a.length;f+=1){const h=cF(s,a,f);o[f]?(o[f].p(h,u),b(o[f],1)):(o[f]=fF(h),o[f].c(),b(o[f],1),o[f].m(r,null))}for(we(),f=a.length;f<o.length;f+=1)l(f);ke()}},i(s){if(!i){b(e.$$.fragment,s);for(let u=0;u<a.length;u+=1)b(o[u]);i=!0}},o(s){$(e.$$.fragment,s),o=o.filter(Boolean);for(let u=0;u<o.length;u+=1)$(o[u]);i=!1},d(s){H(e,s),s&&M(t),s&&M(r),Bn(o,s)}}}function Ist(n){let e,t,r,i,a,o,l,s,u,c;e=new b_({props:{header:"You must publish your app to activate your automations.",message:"To test your automation before publishing, you can use the 'Run Test' functionality on the next screen."}}),r=new jt({props:{size:"XS",$$slots:{default:[Dst]},$$scope:{ctx:n}}});function f(_){n[10](_)}function h(_){n[11](_)}let m={label:"Name"};return n[0]!==void 0&&(m.value=n[0]),n[4]!==void 0&&(m.error=n[4]),a=new Mn({props:m}),De.push(()=>nt(a,"value",f)),De.push(()=>nt(a,"error",h)),a.$on("change",n[12]),u=new Pt({props:{noPadding:!0,$$slots:{default:[Ost]},$$scope:{ctx:n}}}),{c(){O(e.$$.fragment),t=q(),O(r.$$.fragment),i=q(),O(a.$$.fragment),s=q(),O(u.$$.fragment)},m(_,y){B(e,_,y),C(_,t,y),B(r,_,y),C(_,i,y),B(a,_,y),C(_,s,y),B(u,_,y),c=!0},p(_,y){const w={};y&2097152&&(w.$$scope={dirty:y,ctx:_}),r.$set(w);const A={};!o&&y&1&&(o=!0,A.value=_[0],rt(()=>o=!1)),!l&&y&16&&(l=!0,A.error=_[4],rt(()=>l=!1)),a.$set(A);const S={};y&2097164&&(S.$$scope={dirty:y,ctx:_}),u.$set(S)},i(_){c||(b(e.$$.fragment,_),b(r.$$.fragment,_),b(a.$$.fragment,_),b(u.$$.fragment,_),c=!0)},o(_){$(e.$$.fragment,_),$(r.$$.fragment,_),$(a.$$.fragment,_),$(u.$$.fragment,_),c=!1},d(_){H(e,_),_&&M(t),H(r,_),_&&M(i),H(a,_),_&&M(s),H(u,_)}}}function Pst(n){let e,t;return e=new gr({props:{title:"Create Automation",confirmText:"Save",size:"M",onConfirm:n[5],disabled:!n[2]||!n[0],$$slots:{default:[Ist]},$$scope:{ctx:n}}}),{c(){O(e.$$.fragment)},m(r,i){B(e,r,i),t=!0},p(r,[i]){const a={};i&5&&(a.disabled=!r[2]||!r[0]),i&2097183&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){t||(b(e.$$.fragment,r),t=!0)},o(r){$(e.$$.fragment,r),t=!1},d(r){H(e,r)}}}function Vst(n,e,t){let r,i,a,o,l,s;Fe(n,Or,I=>t(8,o=I)),Fe(n,ci,I=>t(16,l=I)),Fe(n,Wd,I=>t(9,s=I));let u,c,f=!1,h,{webhookModal:m}=e;async function _(){var I;try{await Or.actions.create({name:u,instanceId:r});const P=o.selectedAutomation.constructBlock("TRIGGER",h.stepId,h);Or.actions.addBlockToAutomation(P),h.stepId===_6.WEBHOOK&&m.show,await Or.actions.save((I=o.selectedAutomation)==null?void 0:I.automation),$t.success(`Automation ${u} created`),l(`./${o.selectedAutomation.automation._id}`)}catch{$t.error("Error creating automation")}}const y=I=>{h=I,t(2,c=I.name)};function w(I){u=I,t(0,u)}function A(I){i=I,t(4,i),t(1,f),t(0,u)}const S=()=>t(1,f=!0),T=I=>y(I);return n.$$set=I=>{"webhookModal"in I&&t(7,m=I.webhookModal)},n.$$.update=()=>{n.$$.dirty&512&&(r=s._id),n.$$.dirty&3&&t(4,i=f&&!u?"Please specify a name for the automation.":null),n.$$.dirty&256&&t(3,a=Object.entries(o.blockDefinitions.TRIGGER))},[u,f,c,a,i,_,y,m,o,s,w,A,S,T]}class cZ extends Ve{constructor(e){super(),Pe(this,e,Vst,Pst,Ie,{webhookModal:7})}}function Rst(n){let e,t;return e=new cZ({props:{webhookModal:n[1]}}),{c(){O(e.$$.fragment)},m(r,i){B(e,r,i),t=!0},p(r,i){const a={};i&2&&(a.webhookModal=r[1]),e.$set(a)},i(r){t||(b(e.$$.fragment,r),t=!0)},o(r){$(e.$$.fragment,r),t=!1},d(r){H(e,r)}}}function Nst(n){let e,t,r,i;e=new Tst({});let a={$$slots:{default:[Rst]},$$scope:{ctx:n}};return r=new rr({props:a}),n[2](r),{c(){O(e.$$.fragment),t=q(),O(r.$$.fragment)},m(o,l){B(e,o,l),C(o,t,l),B(r,o,l),i=!0},p(o,l){const s={};l&10&&(s.$$scope={dirty:l,ctx:o}),r.$set(s)},i(o){i||(b(e.$$.fragment,o),b(r.$$.fragment,o),i=!0)},o(o){$(e.$$.fragment,o),$(r.$$.fragment,o),i=!1},d(o){H(e,o),o&&M(t),n[2](null),H(r,o)}}}function Fst(n){let e,t;return e=new B1({props:{title:"Automations",$$slots:{default:[Nst]},$$scope:{ctx:n}}}),{c(){O(e.$$.fragment)},m(r,i){B(e,r,i),t=!0},p(r,i){const a={};i&11&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){t||(b(e.$$.fragment,r),t=!0)},o(r){$(e.$$.fragment,r),t=!1},d(r){H(e,r)}}}function jst(n){let e,t,r,i,a,o;return t=new X2({props:{selected:"Automations",$$slots:{default:[Fst]},$$scope:{ctx:n}}}),a=new un({props:{hoverable:!0,name:"AddCircle"}}),a.$on("click",function(){kn(n[0].show)&&n[0].show.apply(this,arguments)}),{c(){e=X("div"),O(t.$$.fragment),r=q(),i=X("div"),O(a.$$.fragment),D(i,"class","add-button svelte-1dlf15l"),D(e,"class","nav svelte-1dlf15l")},m(l,s){C(l,e,s),B(t,e,null),x(e,r),x(e,i),B(a,i,null),o=!0},p(l,[s]){n=l;const u={};s&11&&(u.$$scope={dirty:s,ctx:n}),t.$set(u)},i(l){o||(b(t.$$.fragment,l),b(a.$$.fragment,l),o=!0)},o(l){$(t.$$.fragment,l),$(a.$$.fragment,l),o=!1},d(l){l&&M(e),H(t),H(a)}}}function xst(n,e,t){let{modal:r}=e,{webhookModal:i}=e;function a(o){De[o?"unshift":"push"](()=>{r=o,t(0,r)})}return n.$$set=o=>{"modal"in o&&t(0,r=o.modal),"webhookModal"in o&&t(1,i=o.webhookModal)},[r,i,a]}class Ust extends Ve{constructor(e){super(),Pe(this,e,xst,jst,Ie,{modal:0,webhookModal:1})}}function pF(n,e,t){const r=n.slice();return r[8]=e[t],r[10]=t,r}function dF(n){var u;let e,t,r,i,a;function o(c){n[6](c)}let l={showTestStatus:!0,block:n[8],isTrigger:n[10]===0,testResult:(u=n[2])==null?void 0:u[n[10]]};n[3]!==void 0&&(l.showParameters=n[3]),e=new uZ({props:l}),De.push(()=>nt(e,"showParameters",o));let s=n[3]&&n[3][n[8].id]&&hF(n);return{c(){O(e.$$.fragment),r=q(),s&&s.c(),i=yt()},m(c,f){B(e,c,f),C(c,r,f),s&&s.m(c,f),C(c,i,f),a=!0},p(c,f){var m;const h={};f&2&&(h.block=c[8]),f&4&&(h.testResult=(m=c[2])==null?void 0:m[c[10]]),!t&&f&8&&(t=!0,h.showParameters=c[3],rt(()=>t=!1)),e.$set(h),c[3]&&c[3][c[8].id]?s?(s.p(c,f),f&10&&b(s,1)):(s=hF(c),s.c(),b(s,1),s.m(i.parentNode,i)):s&&(we(),$(s,1,1,()=>{s=null}),ke())},i(c){a||(b(e.$$.fragment,c),b(s),a=!0)},o(c){$(e.$$.fragment,c),$(s),a=!1},d(c){H(e,c),c&&M(r),s&&s.d(c),c&&M(i)}}}function hF(n){var s,u;let e,t,r,i,a,o;e=new ui({props:{noMargin:!0}});let l=((u=(s=n[2])==null?void 0:s[n[10]])==null?void 0:u.outputs.iterations)&&mF(n);return a=new X2({props:{noHorizPadding:!0,selected:"Input",$$slots:{default:[Yst]},$$scope:{ctx:n}}}),{c(){O(e.$$.fragment),t=q(),l&&l.c(),r=q(),i=X("div"),O(a.$$.fragment),D(i,"class","tabs svelte-1iblsnb")},m(c,f){B(e,c,f),C(c,t,f),l&&l.m(c,f),C(c,r,f),C(c,i,f),B(a,i,null),o=!0},p(c,f){var m,_;(_=(m=c[2])==null?void 0:m[c[10]])!=null&&_.outputs.iterations?l?(l.p(c,f),f&4&&b(l,1)):(l=mF(c),l.c(),b(l,1),l.m(r.parentNode,r)):l&&(we(),$(l,1,1,()=>{l=null}),ke());const h={};f&2052&&(h.$$scope={dirty:f,ctx:c}),a.$set(h)},i(c){o||(b(e.$$.fragment,c),b(l),b(a.$$.fragment,c),o=!0)},o(c){$(e.$$.fragment,c),$(l),$(a.$$.fragment,c),o=!1},d(c){H(e,c),c&&M(t),l&&l.d(c),c&&M(r),c&&M(i),H(a)}}}function mF(n){let e,t,r,i,a,o;return t=new un({props:{name:"Reuse"}}),a=new sn({props:{$$slots:{default:[qst]},$$scope:{ctx:n}}}),{c(){e=X("div"),O(t.$$.fragment),r=q(),i=X("div"),O(a.$$.fragment),$n(i,"margin-left","10px"),$n(e,"display","flex"),$n(e,"padding","10px 10px 0px 12px")},m(l,s){C(l,e,s),B(t,e,null),x(e,r),x(e,i),B(a,i,null),o=!0},p(l,s){const u={};s&2052&&(u.$$scope={dirty:s,ctx:l}),a.$set(u)},i(l){o||(b(t.$$.fragment,l),b(a.$$.fragment,l),o=!0)},o(l){$(t.$$.fragment,l),$(a.$$.fragment,l),o=!1},d(l){l&&M(e),H(t),H(a)}}}function qst(n){var a,o;let e,t=((o=(a=n[2])==null?void 0:a[n[10]])==null?void 0:o.outputs.iterations)+"",r,i;return{c(){e=oe("This loop ran "),r=oe(t),i=oe(" times.")},m(l,s){C(l,e,s),C(l,r,s),C(l,i,s)},p(l,s){var u,c;s&4&&t!==(t=((c=(u=l[2])==null?void 0:u[l[10]])==null?void 0:c.outputs.iterations)+"")&&gt(r,t)},d(l){l&&M(e),l&&M(r),l&&M(i)}}}function Wst(n){var r,i;let e,t;return e=new F3({props:{minHeight:"80px",disabled:!0,value:o_((i=(r=n[2])==null?void 0:r[n[10]])==null?void 0:i.inputs,"No input")}}),{c(){O(e.$$.fragment)},m(a,o){B(e,a,o),t=!0},p(a,o){var s,u;const l={};o&4&&(l.value=o_((u=(s=a[2])==null?void 0:s[a[10]])==null?void 0:u.inputs,"No input")),e.$set(l)},i(a){t||(b(e.$$.fragment,a),t=!0)},o(a){$(e.$$.fragment,a),t=!1},d(a){H(e,a)}}}function Gst(n){var r,i;let e,t;return e=new F3({props:{minHeight:"100px",disabled:!0,value:o_((i=(r=n[2])==null?void 0:r[n[10]])==null?void 0:i.outputs,"No output")}}),{c(){O(e.$$.fragment)},m(a,o){B(e,a,o),t=!0},p(a,o){var s,u;const l={};o&4&&(l.value=o_((u=(s=a[2])==null?void 0:s[a[10]])==null?void 0:u.outputs,"No output")),e.$set(l)},i(a){t||(b(e.$$.fragment,a),t=!0)},o(a){$(e.$$.fragment,a),t=!1},d(a){H(e,a)}}}function Yst(n){let e,t,r,i;return e=new B1({props:{title:"Input",$$slots:{default:[Wst]},$$scope:{ctx:n}}}),r=new B1({props:{title:"Output",$$slots:{default:[Gst]},$$scope:{ctx:n}}}),{c(){O(e.$$.fragment),t=q(),O(r.$$.fragment)},m(a,o){B(e,a,o),C(a,t,o),B(r,a,o),i=!0},p(a,o){const l={};o&2052&&(l.$$scope={dirty:o,ctx:a}),e.$set(l);const s={};o&2052&&(s.$$scope={dirty:o,ctx:a}),r.$set(s)},i(a){i||(b(e.$$.fragment,a),b(r.$$.fragment,a),i=!0)},o(a){$(e.$$.fragment,a),$(r.$$.fragment,a),i=!1},d(a){H(e,a),a&&M(t),H(r,a)}}}function gF(n){let e;return{c(){e=X("div"),D(e,"class","separator svelte-1iblsnb")},m(t,r){C(t,e,r)},d(t){t&&M(e)}}}function vF(n){let e,t,r,i,a,o=n[8].stepId!==N3.LOOP&&dF(n),l=n[1].length-1!==n[10]&&gF();return{c(){e=X("div"),o&&o.c(),r=q(),l&&l.c(),i=yt(),D(e,"class","block svelte-1iblsnb"),D(e,"style",t=n[0]?`width: ${n[0]}`:"")},m(s,u){C(s,e,u),o&&o.m(e,null),C(s,r,u),l&&l.m(s,u),C(s,i,u),a=!0},p(s,u){s[8].stepId!==N3.LOOP?o?(o.p(s,u),u&2&&b(o,1)):(o=dF(s),o.c(),b(o,1),o.m(e,null)):o&&(we(),$(o,1,1,()=>{o=null}),ke()),(!a||u&1&&t!==(t=s[0]?`width: ${s[0]}`:""))&&D(e,"style",t),s[1].length-1!==s[10]?l||(l=gF(),l.c(),l.m(i.parentNode,i)):l&&(l.d(1),l=null)},i(s){a||(b(o),a=!0)},o(s){$(o),a=!1},d(s){s&&M(e),o&&o.d(),s&&M(r),l&&l.d(s),s&&M(i)}}}function Kst(n){let e,t,r=n[1],i=[];for(let o=0;o<r.length;o+=1)i[o]=vF(pF(n,r,o));const a=o=>$(i[o],1,1,()=>{i[o]=null});return{c(){e=X("div");for(let o=0;o<i.length;o+=1)i[o].c();D(e,"class","container svelte-1iblsnb")},m(o,l){C(o,e,l);for(let s=0;s<i.length;s+=1)i[s].m(e,null);t=!0},p(o,[l]){if(l&15){r=o[1];let s;for(s=0;s<r.length;s+=1){const u=pF(o,r,s);i[s]?(i[s].p(u,l),b(i[s],1)):(i[s]=vF(u),i[s].c(),b(i[s],1),i[s].m(e,null))}for(we(),s=r.length;s<i.length;s+=1)a(s);ke()}},i(o){if(!t){for(let l=0;l<r.length;l+=1)b(i[l]);t=!0}},o(o){i=i.filter(Boolean);for(let l=0;l<i.length;l+=1)$(i[l]);t=!1},d(o){o&&M(e),Bn(i,o)}}}function o_(n,e){return n?JSON.stringify(n,null,2):e}function Xst(n,e,t){let r,{automation:i}=e,{testResults:a}=e,{width:o="400px"}=e,l,s;function u(f){return f==null?void 0:f.steps.filter(h=>h.stepId!==N3.LOOP||[])}function c(f){l=f,t(3,l)}return n.$$set=f=>{"automation"in f&&t(4,i=f.automation),"testResults"in f&&t(5,a=f.testResults),"width"in f&&t(0,o=f.width)},n.$$.update=()=>{if(n.$$.dirty&32&&t(2,r=u(a)),n.$$.dirty&22){if(t(1,s=[]),i)i.definition.trigger&&s.push(i.definition.trigger),t(1,s=s.concat(i.definition.steps||[]).filter(f=>f.stepId!==N3.LOOP));else if(r){t(1,s=r||[]);let f=0;for(let h of s)h.id=f++}}},[o,s,r,l,i,a,c]}class fZ extends Ve{constructor(e){super(),Pe(this,e,Xst,Kst,Ie,{automation:4,testResults:5,width:0})}}function Jst(n){let e,t,r,i,a,o,l,s,u,c,f,h,m;return r=new un({props:{name:"MultipleCheck"}}),s=new un({props:{hoverable:!0,name:"Close"}}),s.$on("click",n[4]),c=new ui({}),h=new fZ({props:{automation:n[0],testResults:n[2]}}),{c(){e=X("div"),t=X("div"),O(r.$$.fragment),i=q(),a=X("div"),a.textContent="Test Details",o=q(),l=X("div"),O(s.$$.fragment),u=q(),O(c.$$.fragment),f=q(),O(h.$$.fragment),$n(a,"padding-left","var(--spacing-l)"),D(t,"class","title-text svelte-nwwj95"),$n(l,"padding-right","var(--spacing-xl)"),D(e,"class","title svelte-nwwj95")},m(_,y){C(_,e,y),x(e,t),B(r,t,null),x(t,i),x(t,a),x(e,o),x(e,l),B(s,l,null),C(_,u,y),B(c,_,y),C(_,f,y),B(h,_,y),m=!0},p(_,[y]){const w={};y&1&&(w.automation=_[0]),y&4&&(w.testResults=_[2]),h.$set(w)},i(_){m||(b(r.$$.fragment,_),b(s.$$.fragment,_),b(c.$$.fragment,_),b(h.$$.fragment,_),m=!0)},o(_){$(r.$$.fragment,_),$(s.$$.fragment,_),$(c.$$.fragment,_),$(h.$$.fragment,_),m=!1},d(_){_&&M(e),H(r),H(s),_&&M(u),H(c,_),_&&M(f),H(h,_)}}}function Zst(n,e,t){let r;Fe(n,Or,s=>t(1,r=s));let{automation:i}=e,a,o;const l=async()=>{G1(Or,r.showTestPanel=!1,r)};return n.$$set=s=>{"automation"in s&&t(0,i=s.automation)},n.$$.update=()=>{var s;n.$$.dirty&11&&(t(3,a=[]),i?(i.definition.trigger&&a.push(i.definition.trigger),t(3,a=a.concat(i.definition.steps||[]).filter(u=>u.stepId!==N3.LOOP))):r.selectedAutomation&&t(0,i=r.selectedAutomation)),n.$$.dirty&2&&t(2,o=(s=r.selectedAutomation)==null?void 0:s.testResults)},[i,r,o,a,l]}class Qst extends Ve{constructor(e){super(),Pe(this,e,Zst,Jst,Ie,{automation:0})}}function eut(n){let e,t,r,i;return r=new Pt({props:{gap:"S",justifyItems:"center",$$slots:{default:[aut]},$$scope:{ctx:n}}}),{c(){e=X("div"),t=X("div"),O(r.$$.fragment),D(t,"class","main svelte-374m3f"),D(e,"class","centered svelte-374m3f")},m(a,o){C(a,e,o),x(e,t),B(r,t,null),i=!0},p(a,o){const l={};o&258&&(l.$$scope={dirty:o,ctx:a}),r.$set(l)},i(a){i||(b(r.$$.fragment,a),i=!0)},o(a){$(r.$$.fragment,a),i=!1},d(a){a&&M(e),H(r)}}}function tut(n){let e;const t=n[4].default,r=Xn(t,n,n[8],null);return{c(){r&&r.c()},m(i,a){r&&r.m(i,a),e=!0},p(i,a){r&&r.p&&(!e||a&256)&&Zn(r,t,i,i[8],e?Jn(t,i[8],a,null):Qn(i[8]),null)},i(i){e||(b(r,i),e=!0)},o(i){$(r,i),e=!1},d(i){r&&r.d(i)}}}function nut(n){let e;return{c(){e=oe("You have no automations")},m(t,r){C(t,e,r)},d(t){t&&M(e)}}}function rut(n){let e;return{c(){e=oe("Let's fix that. Call the bots!")},m(t,r){C(t,e,r)},d(t){t&&M(e)}}}function iut(n){let e;return{c(){e=oe("Create automation")},m(t,r){C(t,e,r)},d(t){t&&M(e)}}}function aut(n){let e,t,r,i,a,o,l,s,u;return i=new In({props:{size:"M",$$slots:{default:[nut]},$$scope:{ctx:n}}}),o=new jt({props:{size:"M",$$slots:{default:[rut]},$$scope:{ctx:n}}}),s=new _n({props:{size:"M",cta:!0,$$slots:{default:[iut]},$$scope:{ctx:n}}}),s.$on("click",n[5]),{c(){e=ut("svg"),t=ut("use"),r=q(),O(i.$$.fragment),a=q(),O(o.$$.fragment),l=q(),O(s.$$.fragment),Gr(t,"xlink:href","#spectrum-icon-18-WorkflowAdd"),D(e,"width","60px"),D(e,"height","60px"),D(e,"class","spectrum-Icon"),D(e,"focusable","false")},m(c,f){C(c,e,f),x(e,t),C(c,r,f),B(i,c,f),C(c,a,f),B(o,c,f),C(c,l,f),B(s,c,f),u=!0},p(c,f){const h={};f&256&&(h.$$scope={dirty:f,ctx:c}),i.$set(h);const m={};f&256&&(m.$$scope={dirty:f,ctx:c}),o.$set(m);const _={};f&256&&(_.$$scope={dirty:f,ctx:c}),s.$set(_)},i(c){u||(b(i.$$.fragment,c),b(o.$$.fragment,c),b(s.$$.fragment,c),u=!0)},o(c){$(i.$$.fragment,c),$(o.$$.fragment,c),$(s.$$.fragment,c),u=!1},d(c){c&&M(e),c&&M(r),H(i,c),c&&M(a),H(o,c),c&&M(l),H(s,c)}}}function _F(n){let e,t,r;return t=new Qst({props:{automation:n[3]}}),{c(){e=X("div"),O(t.$$.fragment),D(e,"class","setup svelte-374m3f")},m(i,a){C(i,e,a),B(t,e,null),r=!0},p(i,a){const o={};a&8&&(o.automation=i[3]),t.$set(o)},i(i){r||(b(t.$$.fragment,i),r=!0)},o(i){$(t.$$.fragment,i),r=!1},d(i){i&&M(e),H(t)}}}function out(n){let e,t;return e=new cZ({props:{webhookModal:n[2]}}),{c(){O(e.$$.fragment)},m(r,i){B(e,r,i),t=!0},p(r,i){const a={};i&4&&(a.webhookModal=r[2]),e.$set(a)},i(r){t||(b(e.$$.fragment,r),t=!0)},o(r){$(e.$$.fragment,r),t=!1},d(r){H(e,r)}}}function lut(n){let e,t;return e=new gA({}),{c(){O(e.$$.fragment)},m(r,i){B(e,r,i),t=!0},i(r){t||(b(e.$$.fragment,r),t=!0)},o(r){$(e.$$.fragment,r),t=!1},d(r){H(e,r)}}}function sut(n){let e,t,r,i,a,o,l,s,u,c,f,h,m;r=new Ust({props:{modal:n[1],webhookModal:n[2]}});const _=[tut,eut],y=[];function w(I,P){return I[3]?0:1}o=w(n),l=y[o]=_[o](n);let A=n[0].showTestPanel&&_F(n),S={$$slots:{default:[out]},$$scope:{ctx:n}};c=new rr({props:S}),n[6](c);let T={width:"30%",$$slots:{default:[lut]},$$scope:{ctx:n}};return h=new rr({props:T}),n[7](h),{c(){e=X("div"),t=X("div"),O(r.$$.fragment),i=q(),a=X("div"),l.c(),s=q(),A&&A.c(),u=q(),O(c.$$.fragment),f=q(),O(h.$$.fragment),D(t,"class","nav svelte-374m3f"),D(a,"class","content svelte-374m3f"),D(e,"class","root svelte-374m3f")},m(I,P){C(I,e,P),x(e,t),B(r,t,null),x(e,i),x(e,a),y[o].m(a,null),x(e,s),A&&A.m(e,null),x(e,u),B(c,e,null),x(e,f),B(h,e,null),m=!0},p(I,[P]){const V={};P&2&&(V.modal=I[1]),P&4&&(V.webhookModal=I[2]),r.$set(V);let j=o;o=w(I),o===j?y[o].p(I,P):(we(),$(y[j],1,1,()=>{y[j]=null}),ke(),l=y[o],l?l.p(I,P):(l=y[o]=_[o](I),l.c()),b(l,1),l.m(a,null)),I[0].showTestPanel?A?(A.p(I,P),P&1&&b(A,1)):(A=_F(I),A.c(),b(A,1),A.m(e,u)):A&&(we(),$(A,1,1,()=>{A=null}),ke());const U={};P&260&&(U.$$scope={dirty:P,ctx:I}),c.$set(U);const W={};P&256&&(W.$$scope={dirty:P,ctx:I}),h.$set(W)},i(I){m||(b(r.$$.fragment,I),b(l),b(A),b(c.$$.fragment,I),b(h.$$.fragment,I),m=!0)},o(I){$(r.$$.fragment,I),$(l),$(A),$(c.$$.fragment,I),$(h.$$.fragment,I),m=!1},d(I){I&&M(e),H(r),y[o].d(),A&&A.d(),n[6](null),H(c),n[7](null),H(h)}}}function uut(n,e,t){let r,i;Fe(n,Or,h=>t(0,i=h));let{$$slots:a={},$$scope:o}=e,l,s;ar(()=>{G1(Or,i.showTestPanel=!1,i)});const u=()=>l.show();function c(h){De[h?"unshift":"push"](()=>{l=h,t(1,l)})}function f(h){De[h?"unshift":"push"](()=>{s=h,t(2,s)})}return n.$$set=h=>{"$$scope"in h&&t(8,o=h.$$scope)},n.$$.update=()=>{var h;n.$$.dirty&1&&t(3,r=((h=i.selectedAutomation)==null?void 0:h.automation)||i.automations[0])},[i,l,s,r,a,u,c,f,o]}class cut extends Ve{constructor(e){super(),Pe(this,e,uut,sut,Ie,{})}}function fut(n){let e,t,r,i,a,o,l;function s(c){n[4](c)}let u={};return n[2]!==void 0&&(u.value=n[2]),a=new Mn({props:u}),De.push(()=>nt(a,"value",s)),{c(){e=X("span"),e.textContent=`The changes you have made will be deleted and the application reverted
943
- back to its production state.`,t=q(),r=X("span"),r.textContent="Please enter your app name to continue.",i=q(),O(a.$$.fragment)},m(c,f){C(c,e,f),C(c,t,f),C(c,r,f),C(c,i,f),B(a,c,f),l=!0},p(c,f){const h={};!o&&f&4&&(o=!0,h.value=c[2],rt(()=>o=!1)),a.$set(h)},i(c){l||(b(a.$$.fragment,c),l=!0)},o(c){$(a.$$.fragment,c),l=!1},d(c){c&&M(e),c&&M(t),c&&M(r),c&&M(i),H(a,c)}}}function put(n){let e,t;return e=new gr({props:{title:"Revert Changes",confirmText:"Revert",onConfirm:n[3],disabled:n[2]!==n[0].name,$$slots:{default:[fut]},$$scope:{ctx:n}}}),{c(){O(e.$$.fragment)},m(r,i){B(e,r,i),t=!0},p(r,i){const a={};i&5&&(a.disabled=r[2]!==r[0].name),i&132&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){t||(b(e.$$.fragment,r),t=!0)},o(r){$(e.$$.fragment,r),t=!1},d(r){H(e,r)}}}function dut(n){let e,t,r,i;e=new un({props:{name:"Revert",hoverable:!0,tooltip:"Revert changes",dataCy:"revert-application-topnav"}}),e.$on("click",function(){kn(n[1].show)&&n[1].show.apply(this,arguments)});let a={$$slots:{default:[put]},$$scope:{ctx:n}};return r=new rr({props:a}),n[5](r),{c(){O(e.$$.fragment),t=q(),O(r.$$.fragment)},m(o,l){B(e,o,l),C(o,t,l),B(r,o,l),i=!0},p(o,[l]){n=o;const s={};l&133&&(s.$$scope={dirty:l,ctx:n}),r.$set(s)},i(o){i||(b(e.$$.fragment,o),b(r.$$.fragment,o),i=!0)},o(o){$(e.$$.fragment,o),$(r.$$.fragment,o),i=!1},d(o){H(e,o),o&&M(t),n[5](null),H(r,o)}}}function hut(n,e,t){let r,i;Fe(n,Xt,c=>t(0,i=c));let a,o;const l=async()=>{try{await Zt.revertAppChanges(r);const c=await Zt.fetchAppPackage(r);await Xt.actions.initialise(c),$t.info("Changes reverted successfully")}catch(c){$t.error(`Error reverting changes: ${c}`)}};function s(c){o=c,t(2,o)}function u(c){De[c?"unshift":"push"](()=>{a=c,t(1,a)})}return n.$$.update=()=>{n.$$.dirty&1&&(r=i.appId)},[i,a,o,l,s,u]}class mut extends Ve{constructor(e){super(),Pe(this,e,hut,dut,Ie,{})}}const gut="@budibase/client",vut="2.1.21",_ut="MPL-2.0",but="dist/budibase-client.js",yut="dist/budibase-client.js",$ut="module",wut="src/index.js",kut={".":{import:"./dist/budibase-client.js",require:"./dist/budibase-client.js"},"./package.json":"./package.json","./manifest.json":"./manifest.json"},zut={build:"rollup -c","dev:builder":"rollup -cw"},Aut={"@budibase/bbui":"^2.1.21","@budibase/frontend-core":"^2.1.21","@budibase/string-templates":"^2.1.21","@spectrum-css/button":"^3.0.3","@spectrum-css/card":"^3.0.3","@spectrum-css/divider":"^1.0.3","@spectrum-css/link":"^3.1.3","@spectrum-css/page":"^3.0.1","@spectrum-css/tag":"^3.1.4","@spectrum-css/typography":"^3.0.2","@spectrum-css/vars":"^3.0.1",apexcharts:"^3.22.1",dayjs:"^1.10.5",downloadjs:"1.4.7","html5-qrcode":"^2.2.1",leaflet:"^1.7.1",regexparam:"^1.3.0","sanitize-html":"^2.7.0",screenfull:"^6.0.1",shortid:"^2.2.15","socket.io-client":"^4.5.1",svelte:"^3.49.0","svelte-apexcharts":"^1.0.2","svelte-flatpickr":"^3.1.0","svelte-spa-router":"^3.0.5"},Mut={"@rollup/plugin-alias":"^3.1.5","@rollup/plugin-commonjs":"^18.0.0","@rollup/plugin-node-resolve":"^11.2.1",postcss:"^8.2.10",rollup:"^2.44.0","rollup-plugin-json":"^4.0.0","rollup-plugin-polyfill-node":"^0.8.0","rollup-plugin-postcss":"^4.0.0","rollup-plugin-svelte":"^7.1.0","rollup-plugin-svg":"^2.0.0","rollup-plugin-terser":"^7.0.2","rollup-plugin-visualizer":"^5.5.4"},Cut="d1836a898cab3f8ab80ee6d8f42be1a9eed7dcdc",Pd={name:gut,version:vut,license:_ut,module:but,main:yut,type:$ut,svelte:wut,exports:kut,scripts:zut,dependencies:Aut,devDependencies:Mut,gitHead:Cut};function bF(n){let e,t;return e=new j3({props:{hoverable:!0,notice:!0,$$slots:{default:[Sut]},$$scope:{ctx:n}}}),e.$on("click",function(){kn(n[2].show)&&n[2].show.apply(this,arguments)}),{c(){O(e.$$.fragment)},m(r,i){B(e,r,i),t=!0},p(r,i){n=r;const a={};i&4096&&(a.$$scope={dirty:i,ctx:n}),e.$set(a)},i(r){t||(b(e.$$.fragment,r),t=!0)},o(r){$(e.$$.fragment,r),t=!1},d(r){H(e,r)}}}function Sut(n){let e;return{c(){e=oe("Update available")},m(t,r){C(t,e,r)},d(t){t&&M(e)}}}function Lut(n){let e,t;return e=new jt({props:{size:"S",$$slots:{default:[Tut]},$$scope:{ctx:n}}}),{c(){O(e.$$.fragment)},m(r,i){B(e,r,i),t=!0},p(r,i){const a={};i&4098&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){t||(b(e.$$.fragment,r),t=!0)},o(r){$(e.$$.fragment,r),t=!1},d(r){H(e,r)}}}function Eut(n){let e,t;return e=new jt({props:{size:"S",$$slots:{default:[Dut]},$$scope:{ctx:n}}}),{c(){O(e.$$.fragment)},m(r,i){B(e,r,i),t=!0},p(r,i){const a={};i&4098&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){t||(b(e.$$.fragment,r),t=!0)},o(r){$(e.$$.fragment,r),t=!1},d(r){H(e,r)}}}function Tut(n){let e,t,r=n[1].version+"",i,a;return{c(){e=oe("This app is currently using version "),t=X("b"),i=oe(r),a=oe(` which is the
943
+ back to its production state.`,t=q(),r=X("span"),r.textContent="Please enter your app name to continue.",i=q(),O(a.$$.fragment)},m(c,f){C(c,e,f),C(c,t,f),C(c,r,f),C(c,i,f),B(a,c,f),l=!0},p(c,f){const h={};!o&&f&4&&(o=!0,h.value=c[2],rt(()=>o=!1)),a.$set(h)},i(c){l||(b(a.$$.fragment,c),l=!0)},o(c){$(a.$$.fragment,c),l=!1},d(c){c&&M(e),c&&M(t),c&&M(r),c&&M(i),H(a,c)}}}function put(n){let e,t;return e=new gr({props:{title:"Revert Changes",confirmText:"Revert",onConfirm:n[3],disabled:n[2]!==n[0].name,$$slots:{default:[fut]},$$scope:{ctx:n}}}),{c(){O(e.$$.fragment)},m(r,i){B(e,r,i),t=!0},p(r,i){const a={};i&5&&(a.disabled=r[2]!==r[0].name),i&132&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){t||(b(e.$$.fragment,r),t=!0)},o(r){$(e.$$.fragment,r),t=!1},d(r){H(e,r)}}}function dut(n){let e,t,r,i;e=new un({props:{name:"Revert",hoverable:!0,tooltip:"Revert changes",dataCy:"revert-application-topnav"}}),e.$on("click",function(){kn(n[1].show)&&n[1].show.apply(this,arguments)});let a={$$slots:{default:[put]},$$scope:{ctx:n}};return r=new rr({props:a}),n[5](r),{c(){O(e.$$.fragment),t=q(),O(r.$$.fragment)},m(o,l){B(e,o,l),C(o,t,l),B(r,o,l),i=!0},p(o,[l]){n=o;const s={};l&133&&(s.$$scope={dirty:l,ctx:n}),r.$set(s)},i(o){i||(b(e.$$.fragment,o),b(r.$$.fragment,o),i=!0)},o(o){$(e.$$.fragment,o),$(r.$$.fragment,o),i=!1},d(o){H(e,o),o&&M(t),n[5](null),H(r,o)}}}function hut(n,e,t){let r,i;Fe(n,Xt,c=>t(0,i=c));let a,o;const l=async()=>{try{await Zt.revertAppChanges(r);const c=await Zt.fetchAppPackage(r);await Xt.actions.initialise(c),$t.info("Changes reverted successfully")}catch(c){$t.error(`Error reverting changes: ${c}`)}};function s(c){o=c,t(2,o)}function u(c){De[c?"unshift":"push"](()=>{a=c,t(1,a)})}return n.$$.update=()=>{n.$$.dirty&1&&(r=i.appId)},[i,a,o,l,s,u]}class mut extends Ve{constructor(e){super(),Pe(this,e,hut,dut,Ie,{})}}const gut="@budibase/client",vut="2.1.22-alpha.0",_ut="MPL-2.0",but="dist/budibase-client.js",yut="dist/budibase-client.js",$ut="module",wut="src/index.js",kut={".":{import:"./dist/budibase-client.js",require:"./dist/budibase-client.js"},"./package.json":"./package.json","./manifest.json":"./manifest.json"},zut={build:"rollup -c","dev:builder":"rollup -cw"},Aut={"@budibase/bbui":"2.1.22-alpha.0","@budibase/frontend-core":"2.1.22-alpha.0","@budibase/string-templates":"2.1.22-alpha.0","@spectrum-css/button":"^3.0.3","@spectrum-css/card":"^3.0.3","@spectrum-css/divider":"^1.0.3","@spectrum-css/link":"^3.1.3","@spectrum-css/page":"^3.0.1","@spectrum-css/tag":"^3.1.4","@spectrum-css/typography":"^3.0.2","@spectrum-css/vars":"^3.0.1",apexcharts:"^3.22.1",dayjs:"^1.10.5",downloadjs:"1.4.7","html5-qrcode":"^2.2.1",leaflet:"^1.7.1",regexparam:"^1.3.0","sanitize-html":"^2.7.0",screenfull:"^6.0.1",shortid:"^2.2.15","socket.io-client":"^4.5.1",svelte:"^3.49.0","svelte-apexcharts":"^1.0.2","svelte-flatpickr":"^3.1.0","svelte-spa-router":"^3.0.5"},Mut={"@rollup/plugin-alias":"^3.1.5","@rollup/plugin-commonjs":"^18.0.0","@rollup/plugin-node-resolve":"^11.2.1",postcss:"^8.2.10",rollup:"^2.44.0","rollup-plugin-json":"^4.0.0","rollup-plugin-polyfill-node":"^0.8.0","rollup-plugin-postcss":"^4.0.0","rollup-plugin-svelte":"^7.1.0","rollup-plugin-svg":"^2.0.0","rollup-plugin-terser":"^7.0.2","rollup-plugin-visualizer":"^5.5.4"},Cut="d1836a898cab3f8ab80ee6d8f42be1a9eed7dcdc",Pd={name:gut,version:vut,license:_ut,module:but,main:yut,type:$ut,svelte:wut,exports:kut,scripts:zut,dependencies:Aut,devDependencies:Mut,gitHead:Cut};function bF(n){let e,t;return e=new j3({props:{hoverable:!0,notice:!0,$$slots:{default:[Sut]},$$scope:{ctx:n}}}),e.$on("click",function(){kn(n[2].show)&&n[2].show.apply(this,arguments)}),{c(){O(e.$$.fragment)},m(r,i){B(e,r,i),t=!0},p(r,i){n=r;const a={};i&4096&&(a.$$scope={dirty:i,ctx:n}),e.$set(a)},i(r){t||(b(e.$$.fragment,r),t=!0)},o(r){$(e.$$.fragment,r),t=!1},d(r){H(e,r)}}}function Sut(n){let e;return{c(){e=oe("Update available")},m(t,r){C(t,e,r)},d(t){t&&M(e)}}}function Lut(n){let e,t;return e=new jt({props:{size:"S",$$slots:{default:[Tut]},$$scope:{ctx:n}}}),{c(){O(e.$$.fragment)},m(r,i){B(e,r,i),t=!0},p(r,i){const a={};i&4098&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){t||(b(e.$$.fragment,r),t=!0)},o(r){$(e.$$.fragment,r),t=!1},d(r){H(e,r)}}}function Eut(n){let e,t;return e=new jt({props:{size:"S",$$slots:{default:[Dut]},$$scope:{ctx:n}}}),{c(){O(e.$$.fragment)},m(r,i){B(e,r,i),t=!0},p(r,i){const a={};i&4098&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){t||(b(e.$$.fragment,r),t=!0)},o(r){$(e.$$.fragment,r),t=!1},d(r){H(e,r)}}}function Tut(n){let e,t,r=n[1].version+"",i,a;return{c(){e=oe("This app is currently using version "),t=X("b"),i=oe(r),a=oe(` which is the
944
944
  latest version available.`)},m(o,l){C(o,e,l),C(o,t,l),x(t,i),C(o,a,l)},p(o,l){l&2&&r!==(r=o[1].version+"")&&gt(i,r)},d(o){o&&M(e),o&&M(t),o&&M(a)}}}function Dut(n){let e,t,r=n[1].version+"",i,a,o,l;return{c(){e=oe("This app is currently using version "),t=X("b"),i=oe(r),a=oe(`, but version
945
945
  `),o=X("b"),o.textContent=`${Pd.version}`,l=oe(` is available. Updates can contain new features,
946
946
  performance improvements and bug fixes.`)},m(s,u){C(s,e,u),C(s,t,u),x(t,i),C(s,a,u),C(s,o,u),C(s,l,u)},p(s,u){u&2&&r!==(r=s[1].version+"")&&gt(i,r)},d(s){s&&M(e),s&&M(t),s&&M(a),s&&M(o),s&&M(l)}}}function yF(n){let e,t;return e=new jt({props:{size:"S",$$slots:{default:[But]},$$scope:{ctx:n}}}),{c(){O(e.$$.fragment)},m(r,i){B(e,r,i),t=!0},p(r,i){const a={};i&4098&&(a.$$scope={dirty:i,ctx:r}),e.$set(a)},i(r){t||(b(e.$$.fragment,r),t=!0)},o(r){$(e.$$.fragment,r),t=!1},d(r){H(e,r)}}}function But(n){let e,t,r=n[1].revertableVersion+"",i,a;return{c(){e=oe(`You can revert this app to version