@budibase/server 1.1.18 → 1.1.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/builder/assets/{index.7a81de30.js → index.06425e50.js} +2 -2
- package/builder/index.html +1 -1
- package/coverage/clover.xml +2 -2
- package/coverage/lcov-report/api/controllers/apikeys.js.html +1 -1
- package/coverage/lcov-report/api/controllers/auth.js.html +1 -1
- package/coverage/lcov-report/api/controllers/automation.js.html +1 -1
- package/coverage/lcov-report/api/controllers/backup.js.html +1 -1
- package/coverage/lcov-report/api/controllers/cloud.js.html +1 -1
- package/coverage/lcov-report/api/controllers/component.js.html +1 -1
- package/coverage/lcov-report/api/controllers/datasource.js.html +1 -1
- package/coverage/lcov-report/api/controllers/dev.js.html +1 -1
- package/coverage/lcov-report/api/controllers/index.html +1 -1
- package/coverage/lcov-report/api/controllers/integration.js.html +1 -1
- package/coverage/lcov-report/api/controllers/layout.js.html +1 -1
- package/coverage/lcov-report/api/controllers/metadata.js.html +1 -1
- package/coverage/lcov-report/api/controllers/migrations.js.html +1 -1
- package/coverage/lcov-report/api/controllers/permission.js.html +1 -1
- package/coverage/lcov-report/api/controllers/query/index.html +1 -1
- package/coverage/lcov-report/api/controllers/query/validation.js.html +1 -1
- package/coverage/lcov-report/api/controllers/role.js.html +1 -1
- package/coverage/lcov-report/api/controllers/routing.js.html +1 -1
- package/coverage/lcov-report/api/controllers/row/external.js.html +1 -1
- package/coverage/lcov-report/api/controllers/row/index.html +1 -1
- package/coverage/lcov-report/api/controllers/row/internal.js.html +1 -1
- package/coverage/lcov-report/api/controllers/row/internalSearch.js.html +1 -1
- package/coverage/lcov-report/api/controllers/row/staticFormula.js.html +1 -1
- package/coverage/lcov-report/api/controllers/row/utils.js.html +1 -1
- package/coverage/lcov-report/api/controllers/screen.js.html +1 -1
- package/coverage/lcov-report/api/controllers/script.js.html +1 -1
- package/coverage/lcov-report/api/controllers/table/bulkFormula.js.html +1 -1
- package/coverage/lcov-report/api/controllers/table/external.js.html +1 -1
- package/coverage/lcov-report/api/controllers/table/index.html +1 -1
- package/coverage/lcov-report/api/controllers/table/index.js.html +1 -1
- package/coverage/lcov-report/api/controllers/templates.js.html +1 -1
- package/coverage/lcov-report/api/controllers/user.js.html +1 -1
- package/coverage/lcov-report/api/controllers/view/exporters.js.html +1 -1
- package/coverage/lcov-report/api/controllers/view/index.html +1 -1
- package/coverage/lcov-report/api/controllers/view/index.js.html +1 -1
- package/coverage/lcov-report/api/controllers/view/utils.js.html +1 -1
- package/coverage/lcov-report/api/controllers/view/viewBuilder.js.html +1 -1
- package/coverage/lcov-report/api/controllers/webhook.js.html +1 -1
- package/coverage/lcov-report/api/index.html +1 -1
- package/coverage/lcov-report/api/index.js.html +1 -1
- package/coverage/lcov-report/api/routes/analytics.js.html +1 -1
- package/coverage/lcov-report/api/routes/apikeys.js.html +1 -1
- package/coverage/lcov-report/api/routes/auth.js.html +1 -1
- package/coverage/lcov-report/api/routes/automation.js.html +1 -1
- package/coverage/lcov-report/api/routes/backup.js.html +1 -1
- package/coverage/lcov-report/api/routes/cloud.js.html +1 -1
- package/coverage/lcov-report/api/routes/component.js.html +1 -1
- package/coverage/lcov-report/api/routes/datasource.js.html +1 -1
- package/coverage/lcov-report/api/routes/deploy.js.html +1 -1
- package/coverage/lcov-report/api/routes/dev.js.html +1 -1
- package/coverage/lcov-report/api/routes/index.html +1 -1
- package/coverage/lcov-report/api/routes/integration.js.html +1 -1
- package/coverage/lcov-report/api/routes/layout.js.html +1 -1
- package/coverage/lcov-report/api/routes/metadata.js.html +1 -1
- package/coverage/lcov-report/api/routes/migrations.js.html +1 -1
- package/coverage/lcov-report/api/routes/permission.js.html +1 -1
- package/coverage/lcov-report/api/routes/query.js.html +1 -1
- package/coverage/lcov-report/api/routes/role.js.html +1 -1
- package/coverage/lcov-report/api/routes/routing.js.html +1 -1
- package/coverage/lcov-report/api/routes/screen.js.html +1 -1
- package/coverage/lcov-report/api/routes/script.js.html +1 -1
- package/coverage/lcov-report/api/routes/table.js.html +1 -1
- package/coverage/lcov-report/api/routes/templates.js.html +1 -1
- package/coverage/lcov-report/api/routes/user.js.html +1 -1
- package/coverage/lcov-report/api/routes/utils/index.html +1 -1
- package/coverage/lcov-report/api/routes/utils/validators.js.html +1 -1
- package/coverage/lcov-report/api/routes/view.js.html +1 -1
- package/coverage/lcov-report/api/routes/webhook.js.html +1 -1
- package/coverage/lcov-report/automations/actions.js.html +1 -1
- package/coverage/lcov-report/automations/automationUtils.js.html +1 -1
- package/coverage/lcov-report/automations/bullboard.js.html +1 -1
- package/coverage/lcov-report/automations/index.html +1 -1
- package/coverage/lcov-report/automations/index.js.html +1 -1
- package/coverage/lcov-report/automations/steps/bash.js.html +1 -1
- package/coverage/lcov-report/automations/steps/delay.js.html +1 -1
- package/coverage/lcov-report/automations/steps/discord.js.html +1 -1
- package/coverage/lcov-report/automations/steps/executeQuery.js.html +1 -1
- package/coverage/lcov-report/automations/steps/executeScript.js.html +1 -1
- package/coverage/lcov-report/automations/steps/filter.js.html +1 -1
- package/coverage/lcov-report/automations/steps/index.html +1 -1
- package/coverage/lcov-report/automations/steps/integromat.js.html +1 -1
- package/coverage/lcov-report/automations/steps/loop.js.html +1 -1
- package/coverage/lcov-report/automations/steps/outgoingWebhook.js.html +1 -1
- package/coverage/lcov-report/automations/steps/queryRows.js.html +1 -1
- package/coverage/lcov-report/automations/steps/sendSmtpEmail.js.html +1 -1
- package/coverage/lcov-report/automations/steps/serverLog.js.html +1 -1
- package/coverage/lcov-report/automations/steps/slack.js.html +1 -1
- package/coverage/lcov-report/automations/steps/updateRow.js.html +1 -1
- package/coverage/lcov-report/automations/steps/utils.js.html +1 -1
- package/coverage/lcov-report/automations/steps/zapier.js.html +1 -1
- package/coverage/lcov-report/automations/triggerInfo/app.js.html +1 -1
- package/coverage/lcov-report/automations/triggerInfo/cron.js.html +1 -1
- package/coverage/lcov-report/automations/triggerInfo/index.html +1 -1
- package/coverage/lcov-report/automations/triggerInfo/index.js.html +1 -1
- package/coverage/lcov-report/automations/triggerInfo/rowDeleted.js.html +1 -1
- package/coverage/lcov-report/automations/triggerInfo/rowSaved.js.html +1 -1
- package/coverage/lcov-report/automations/triggerInfo/rowUpdated.js.html +1 -1
- package/coverage/lcov-report/automations/triggerInfo/webhook.js.html +1 -1
- package/coverage/lcov-report/automations/triggers.js.html +1 -1
- package/coverage/lcov-report/constants/index.html +1 -1
- package/coverage/lcov-report/constants/index.js.html +1 -1
- package/coverage/lcov-report/constants/layouts.js.html +1 -1
- package/coverage/lcov-report/constants/screens.js.html +1 -1
- package/coverage/lcov-report/db/inMemoryView.js.html +1 -1
- package/coverage/lcov-report/db/index.html +1 -1
- package/coverage/lcov-report/db/index.js.html +1 -1
- package/coverage/lcov-report/db/linkedRows/LinkController.js.html +1 -1
- package/coverage/lcov-report/db/linkedRows/index.html +1 -1
- package/coverage/lcov-report/db/linkedRows/index.js.html +1 -1
- package/coverage/lcov-report/db/linkedRows/linkUtils.js.html +1 -1
- package/coverage/lcov-report/db/newid.js.html +1 -1
- package/coverage/lcov-report/db/utils.js.html +1 -1
- package/coverage/lcov-report/events/AutomationEmitter.js.html +1 -1
- package/coverage/lcov-report/events/index.html +1 -1
- package/coverage/lcov-report/events/index.js.html +1 -1
- package/coverage/lcov-report/events/utils.js.html +1 -1
- package/coverage/lcov-report/index.html +1 -1
- package/coverage/lcov-report/integrations/tests/TestConfiguration.js.html +1 -1
- package/coverage/lcov-report/integrations/tests/index.html +1 -1
- package/coverage/lcov-report/middleware/appInfo.js.html +1 -1
- package/coverage/lcov-report/middleware/builder.js.html +1 -1
- package/coverage/lcov-report/middleware/currentapp.js.html +1 -1
- package/coverage/lcov-report/middleware/index.html +1 -1
- package/coverage/lcov-report/middleware/joi-validator.js.html +1 -1
- package/coverage/lcov-report/middleware/publicApi.js.html +1 -1
- package/coverage/lcov-report/middleware/resourceId.js.html +1 -1
- package/coverage/lcov-report/middleware/selfhost.js.html +1 -1
- package/coverage/lcov-report/middleware/utils.js.html +1 -1
- package/coverage/lcov-report/threads/automation.js.html +1 -1
- package/coverage/lcov-report/threads/index.html +1 -1
- package/coverage/lcov-report/threads/query.js.html +1 -1
- package/coverage/lcov-report/threads/utils.js.html +1 -1
- package/coverage/lcov-report/utilities/budibaseDir.js.html +1 -1
- package/coverage/lcov-report/utilities/centralPath.js.html +1 -1
- package/coverage/lcov-report/utilities/csvParser.js.html +1 -1
- package/coverage/lcov-report/utilities/global.js.html +1 -1
- package/coverage/lcov-report/utilities/index.html +1 -1
- package/coverage/lcov-report/utilities/index.js.html +1 -1
- package/coverage/lcov-report/utilities/queue/inMemoryQueue.js.html +1 -1
- package/coverage/lcov-report/utilities/queue/index.html +1 -1
- package/coverage/lcov-report/utilities/routing/index.html +1 -1
- package/coverage/lcov-report/utilities/routing/index.js.html +1 -1
- package/coverage/lcov-report/utilities/rowProcessor/index.html +1 -1
- package/coverage/lcov-report/utilities/rowProcessor/index.js.html +1 -1
- package/coverage/lcov-report/utilities/rowProcessor/utils.js.html +1 -1
- package/coverage/lcov-report/utilities/scriptRunner.js.html +1 -1
- package/coverage/lcov-report/utilities/security.js.html +1 -1
- package/coverage/lcov-report/utilities/statusCodes.js.html +1 -1
- package/coverage/lcov-report/utilities/usageQuota/index.html +1 -1
- package/coverage/lcov-report/utilities/usageQuota/rows.js.html +1 -1
- package/coverage/lcov-report/utilities/usageQuota/usageQuoteReset.js.html +1 -1
- package/coverage/lcov-report/utilities/users.js.html +1 -1
- package/coverage/lcov-report/utilities/workerRequests.js.html +1 -1
- package/dist/package.json +6 -6
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +7 -7
|
@@ -746,7 +746,7 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
746
746
|
This action cannot be undone.`)},m(o,a){b(o,e,a),b(o,t,a),L(t,i),L(t,l),b(o,s,a)},p(o,a){a&1&&n!==(n=o[0].name+"")&&Se(i,n)},d(o){o&&v(e),o&&v(t),o&&v(s)}}}function Rte(r){let e,t,n,i,l,s;e=new Pr({props:{$$slots:{control:[Pte],default:[Lte]},$$scope:{ctx:r}}});let o={okText:"Delete Datasource",onOk:r[3],title:"Confirm Deletion",$$slots:{default:[Nte]},$$scope:{ctx:r}};n=new wr({props:o}),r[4](n);let a={datasource:r[0]};return l=new Ete({props:a}),r[5](l),{c(){k(e.$$.fragment),t=R(),k(n.$$.fragment),i=R(),k(l.$$.fragment)},m(u,f){C(e,u,f),b(u,t,f),C(n,u,f),b(u,i,f),C(l,u,f),s=!0},p(u,[f]){const c={};f&1030&&(c.$$scope={dirty:f,ctx:u}),e.$set(c);const p={};f&1025&&(p.$$scope={dirty:f,ctx:u}),n.$set(p);const d={};f&1&&(d.datasource=u[0]),l.$set(d)},i(u){s||(m(e.$$.fragment,u),m(n.$$.fragment,u),m(l.$$.fragment,u),s=!0)},o(u){_(e.$$.fragment,u),_(n.$$.fragment,u),_(l.$$.fragment,u),s=!1},d(u){S(e,u),u&&v(t),r[4](null),S(n,u),u&&v(i),r[5](null),S(l,u)}}}function Mte(r,e,t){let n,i,l,s;ae(r,Qt,d=>t(6,n=d)),ae(r,Tt,d=>t(7,i=d)),ae(r,Zt,d=>t(8,l=d)),ae(r,Sn,d=>t(9,s=d));let{datasource:o}=e,a,u;async function f(){var d;try{let g=l.selected;if(!g&&s.selected){const w=s.selected;g=(d=l.list.find(A=>w.includes(A._id)))==null?void 0:d._id}const h=i.selected;await Zt.delete(o),be.success("Datasource deleted");const $=Object.values((o==null?void 0:o.entities)||{});(g===o._id||$&&$.find(w=>w._id===(h==null?void 0:h._id)))&&n("./datasource")}catch{be.error("Error deleting datasource")}}function c(d){x[d?"unshift":"push"](()=>{a=d,t(1,a)})}function p(d){x[d?"unshift":"push"](()=>{u=d,t(2,u)})}return r.$$set=d=>{"datasource"in d&&t(0,o=d.datasource)},[o,a,u,f,c,p]}class Dte extends se{constructor(e){super();oe(this,e,Mte,Rte,ie,{datasource:0})}}function Bte(r){let e;return{c(){e=U("Delete")},m(t,n){b(t,e,n)},d(t){t&&v(e)}}}function jte(r){let e;return{c(){e=U("Duplicate")},m(t,n){b(t,e,n)},d(t){t&&v(e)}}}function zte(r){let e,t,n,i;return e=new rn({props:{icon:"Delete",$$slots:{default:[Bte]},$$scope:{ctx:r}}}),e.$on("click",function(){pt(r[0].show)&&r[0].show.apply(this,arguments)}),n=new rn({props:{icon:"Duplicate",$$slots:{default:[jte]},$$scope:{ctx:r}}}),n.$on("click",r[2]),{c(){k(e.$$.fragment),t=R(),k(n.$$.fragment)},m(l,s){C(e,l,s),b(l,t,s),C(n,l,s),i=!0},p(l,s){r=l;const o={};s&256&&(o.$$scope={dirty:s,ctx:r}),e.$set(o);const a={};s&256&&(a.$$scope={dirty:s,ctx:r}),n.$set(a)},i(l){i||(m(e.$$.fragment,l),m(n.$$.fragment,l),i=!0)},o(l){_(e.$$.fragment,l),_(n.$$.fragment,l),i=!1},d(l){S(e,l),l&&v(t),S(n,l)}}}function qte(r){let e,t,n;return t=new tt({props:{size:"S",hoverable:!0,name:"MoreSmallList"}}),{c(){e=D("div"),k(t.$$.fragment),y(e,"slot","control"),y(e,"class","icon svelte-kjkbox")},m(i,l){b(i,e,l),C(t,e,null),n=!0},p:we,i(i){n||(m(t.$$.fragment,i),n=!0)},o(i){_(t.$$.fragment,i),n=!1},d(i){i&&v(e),S(t)}}}function Ute(r){let e;return{c(){e=U("Are you sure you wish to delete this query? This action cannot be undone.")},m(t,n){b(t,e,n)},d(t){t&&v(e)}}}function Fte(r){let e,t,n,i;e=new Pr({props:{$$slots:{control:[qte],default:[zte]},$$scope:{ctx:r}}});let l={okText:"Delete Query",onOk:r[1],title:"Confirm Deletion",$$slots:{default:[Ute]},$$scope:{ctx:r}};return n=new wr({props:l}),r[5](n),{c(){k(e.$$.fragment),t=R(),k(n.$$.fragment)},m(s,o){C(e,s,o),b(s,t,o),C(n,s,o),i=!0},p(s,[o]){const a={};o&257&&(a.$$scope={dirty:o,ctx:s}),e.$set(a);const u={};o&256&&(u.$$scope={dirty:o,ctx:s}),n.$set(u)},i(s){i||(m(e.$$.fragment,s),m(n.$$.fragment,s),i=!0)},o(s){_(e.$$.fragment,s),_(n.$$.fragment,s),i=!1},d(s){S(e,s),s&&v(t),r[5](null),S(n,s)}}}function Vte(r,e,t){let n,i;ae(r,Qt,c=>t(6,n=c)),ae(r,Sn,c=>t(7,i=c));let{query:l}=e,{onClickQuery:s}=e,o;async function a(){try{const p=i.selected===l._id;await Sn.delete(l),await Zt.fetch(),p&&(await Zt.select(l.datasourceId),n(`./datasource/${l.datasourceId}`)),be.success("Query deleted")}catch{be.error("Error deleting query")}}async function u(){try{const c=await Sn.duplicate(l);s(c)}catch{be.error("Error duplicating query")}}function f(c){x[c?"unshift":"push"](()=>{o=c,t(0,o)})}return r.$$set=c=>{"query"in c&&t(3,l=c.query),"onClickQuery"in c&&t(4,s=c.onClickQuery)},[o,a,u,l,s,f]}class Hte extends se{constructor(e){super();oe(this,e,Vte,Fte,ie,{query:3,onClickQuery:4})}}const Wte=r=>({}),L5=r=>({});function P5(r){let e,t,n,i,l;return t=new tt({props:{size:"S",name:"ChevronRight"}}),{c(){e=D("div"),k(t.$$.fragment),y(e,"class","icon arrow svelte-1herd4j"),te(e,"opened",r[7]),te(e,"relative",r[3]===0),te(e,"absolute",r[3]>0)},m(s,o){b(s,e,o),C(t,e,null),n=!0,i||(l=Le(e,"click",r[16]),i=!0)},p(s,o){o&128&&te(e,"opened",s[7]),o&8&&te(e,"relative",s[3]===0),o&8&&te(e,"absolute",s[3]>0)},i(s){n||(m(t.$$.fragment,s),n=!0)},o(s){_(t.$$.fragment,s),n=!1},d(s){s&&v(e),S(t),i=!1,l()}}}function Gte(r){let e,t,n;return t=new tt({props:{color:r[10],size:"S",name:r[0]}}),{c(){e=D("div"),k(t.$$.fragment),y(e,"class","icon svelte-1herd4j")},m(i,l){b(i,e,l),C(t,e,null),n=!0},p(i,l){const s={};l&1024&&(s.color=i[10]),l&1&&(s.name=i[0]),t.$set(s)},i(i){n||(m(t.$$.fragment,i),n=!0)},o(i){_(t.$$.fragment,i),n=!1},d(i){i&&v(e),S(t)}}}function Yte(r){let e,t,n;return{c(){e=D("div"),t=U(r[9]),y(e,"class","iconText svelte-1herd4j"),y(e,"style",n=r[10]?`color: ${r[10]};`:"")},m(i,l){b(i,e,l),L(e,t)},p(i,l){l&512&&Se(t,i[9]),l&1024&&n!==(n=i[10]?`color: ${i[10]};`:"")&&y(e,"style",n)},i:we,o:we,d(i){i&&v(e)}}}function N5(r){let e,t;const n=r[18].default,i=ht(n,r,r[17],null);return{c(){e=D("div"),i&&i.c(),y(e,"class","actions svelte-1herd4j")},m(l,s){b(l,e,s),i&&i.m(e,null),t=!0},p(l,s){i&&i.p&&(!t||s&131072)&&$t(i,n,l,l[17],t?vt(n,l[17],s,null):bt(l[17]),null)},i(l){t||(m(i,l),t=!0)},o(l){_(i,l),t=!1},d(l){l&&v(e),i&&i.d(l)}}}function R5(r){let e,t,n;return t=new mf({props:{size:"L",color:r[12]}}),{c(){e=D("div"),k(t.$$.fragment),y(e,"class","light svelte-1herd4j")},m(i,l){b(i,e,l),C(t,e,null),n=!0},p(i,l){const s={};l&4096&&(s.color=i[12]),t.$set(s)},i(i){n||(m(t.$$.fragment,i),n=!0)},o(i){_(t.$$.fragment,i),n=!1},d(i){i&&v(e),S(t)}}}function Jte(r){let e,t,n,i,l,s,o,a,u,f,c,p,d,g,h,$=r[1]&&P5(r);const w=r[18].icon,A=ht(w,r,r[17],L5),E=[Yte,Gte],I=[];function T(B,j){return B[9]?0:B[0]?1:-1}~(l=T(r))&&(s=I[l]=E[l](r));let P=r[2]&&N5(r),M=r[12]&&R5(r);return{c(){e=D("div"),t=D("div"),$&&$.c(),n=R(),A&&A.c(),i=R(),s&&s.c(),o=R(),a=D("div"),u=U(r[4]),f=R(),P&&P.c(),c=R(),M&&M.c(),y(a,"class","text svelte-1herd4j"),y(t,"class","nav-item-content svelte-1herd4j"),y(e,"class","nav-item svelte-1herd4j"),y(e,"style",p=`padding-left: calc(${r[3]*14}px)`),y(e,"draggable",r[8]),y(e,"ondragover","return false"),y(e,"ondragenter","return false"),te(e,"border",r[5]),te(e,"selected",r[6]),te(e,"withActions",r[2]),te(e,"scrollable",r[11]),te(e,"highlighted",r[13])},m(B,j){b(B,e,j),L(e,t),$&&$.m(t,null),L(t,n),A&&A.m(t,null),L(t,i),~l&&I[l].m(t,null),L(t,o),L(t,a),L(a,u),L(t,f),P&&P.m(t,null),L(t,c),M&&M.m(t,null),r[23](t),d=!0,g||(h=[Le(e,"dragend",r[19]),Le(e,"dragstart",r[20]),Le(e,"dragover",r[21]),Le(e,"drop",r[22]),Le(e,"click",r[15])],g=!0)},p(B,[j]){B[1]?$?($.p(B,j),j&2&&m($,1)):($=P5(B),$.c(),m($,1),$.m(t,n)):$&&(K(),_($,1,1,()=>{$=null}),Z()),A&&A.p&&(!d||j&131072)&&$t(A,w,B,B[17],d?vt(w,B[17],j,Wte):bt(B[17]),L5);let H=l;l=T(B),l===H?~l&&I[l].p(B,j):(s&&(K(),_(I[H],1,1,()=>{I[H]=null}),Z()),~l?(s=I[l],s?s.p(B,j):(s=I[l]=E[l](B),s.c()),m(s,1),s.m(t,o)):s=null),(!d||j&16)&&Se(u,B[4]),B[2]?P?(P.p(B,j),j&4&&m(P,1)):(P=N5(B),P.c(),m(P,1),P.m(t,c)):P&&(K(),_(P,1,1,()=>{P=null}),Z()),B[12]?M?(M.p(B,j),j&4096&&m(M,1)):(M=R5(B),M.c(),m(M,1),M.m(t,null)):M&&(K(),_(M,1,1,()=>{M=null}),Z()),(!d||j&8&&p!==(p=`padding-left: calc(${B[3]*14}px)`))&&y(e,"style",p),(!d||j&256)&&y(e,"draggable",B[8]),j&32&&te(e,"border",B[5]),j&64&&te(e,"selected",B[6]),j&4&&te(e,"withActions",B[2]),j&2048&&te(e,"scrollable",B[11]),j&8192&&te(e,"highlighted",B[13])},i(B){d||(m($),m(A,B),m(s),m(P),m(M),d=!0)},o(B){_($),_(A,B),_(s),_(P),_(M),d=!1},d(B){B&&v(e),$&&$.d(),A&&A.d(B),~l&&I[l].d(),P&&P.d(),M&&M.d(),r[23](null),g=!1,On(h)}}}function Xte(r,e,t){let{$$slots:n={},$$scope:i}=e,{icon:l}=e,{withArrow:s=!1}=e,{withActions:o=!0}=e,{indentLevel:a=0}=e,{text:u}=e,{border:f=!0}=e,{selected:c=!1}=e,{opened:p=!1}=e,{draggable:d=!1}=e,{iconText:g}=e,{iconColor:h}=e,{scrollable:$=!1}=e,{color:w}=e,{highlighted:A=!1}=e;const E=fo("scroll"),I=gt();let T;const P=()=>{B(),I("click")},M=z=>{z.stopPropagation(),I("iconClick")},B=()=>{if(!E||!T)return;const z=T.getBoundingClientRect();E.scrollTo(z)};function j(z){mt.call(this,r,z)}function H(z){mt.call(this,r,z)}function W(z){mt.call(this,r,z)}function Y(z){mt.call(this,r,z)}function G(z){x[z?"unshift":"push"](()=>{T=z,t(14,T)})}return r.$$set=z=>{"icon"in z&&t(0,l=z.icon),"withArrow"in z&&t(1,s=z.withArrow),"withActions"in z&&t(2,o=z.withActions),"indentLevel"in z&&t(3,a=z.indentLevel),"text"in z&&t(4,u=z.text),"border"in z&&t(5,f=z.border),"selected"in z&&t(6,c=z.selected),"opened"in z&&t(7,p=z.opened),"draggable"in z&&t(8,d=z.draggable),"iconText"in z&&t(9,g=z.iconText),"iconColor"in z&&t(10,h=z.iconColor),"scrollable"in z&&t(11,$=z.scrollable),"color"in z&&t(12,w=z.color),"highlighted"in z&&t(13,A=z.highlighted),"$$scope"in z&&t(17,i=z.$$scope)},r.$$.update=()=>{r.$$.dirty&16448&&c&&T&&B()},[l,s,o,a,u,f,c,p,d,g,h,$,w,A,T,P,M,i,n,j,H,W,Y,G]}class Fl extends se{constructor(e){super();oe(this,e,Xte,Jte,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,color:12,highlighted:13})}}function M5(r,e,t){const n=r.slice();return n[22]=e[t],n}function D5(r){let e,t;return e=new Pr({props:{$$slots:{control:[xte],default:[Zte]},$$scope:{ctx:r}}}),{c(){k(e.$$.fragment)},m(n,i){C(e,n,i),t=!0},p(n,i){const l={};i&33554438&&(l.$$scope={dirty:i,ctx:n}),e.$set(l)},i(n){t||(m(e.$$.fragment,n),t=!0)},o(n){_(e.$$.fragment,n),t=!1},d(n){S(e,n)}}}function B5(r){let e,t;return e=new rn({props:{icon:"Edit",$$slots:{default:[Qte]},$$scope:{ctx:r}}}),e.$on("click",function(){pt(r[2].show)&&r[2].show.apply(this,arguments)}),{c(){k(e.$$.fragment)},m(n,i){C(e,n,i),t=!0},p(n,i){r=n;const l={};i&33554432&&(l.$$scope={dirty:i,ctx:r}),e.$set(l)},i(n){t||(m(e.$$.fragment,n),t=!0)},o(n){_(e.$$.fragment,n),t=!1},d(n){S(e,n)}}}function Qte(r){let e;return{c(){e=U("Edit")},m(t,n){b(t,e,n)},d(t){t&&v(e)}}}function Kte(r){let e;return{c(){e=U("Delete")},m(t,n){b(t,e,n)},d(t){t&&v(e)}}}function Zte(r){let e,t,n,i=!r[1]&&B5(r);return t=new rn({props:{icon:"Delete",$$slots:{default:[Kte]},$$scope:{ctx:r}}}),t.$on("click",r[9]),{c(){i&&i.c(),e=R(),k(t.$$.fragment)},m(l,s){i&&i.m(l,s),b(l,e,s),C(t,l,s),n=!0},p(l,s){l[1]?i&&(K(),_(i,1,1,()=>{i=null}),Z()):i?(i.p(l,s),s&2&&m(i,1)):(i=B5(l),i.c(),m(i,1),i.m(e.parentNode,e));const o={};s&33554432&&(o.$$scope={dirty:s,ctx:l}),t.$set(o)},i(l){n||(m(i),m(t.$$.fragment,l),n=!0)},o(l){_(i),_(t.$$.fragment,l),n=!1},d(l){i&&i.d(l),l&&v(e),S(t,l)}}}function xte(r){let e,t,n;return t=new tt({props:{s:!0,hoverable:!0,name:"MoreSmallList"}}),{c(){e=D("div"),k(t.$$.fragment),y(e,"slot","control"),y(e,"class","icon svelte-1ogygrq")},m(i,l){b(i,e,l),C(t,e,null),n=!0},p:we,i(i){n||(m(t.$$.fragment,i),n=!0)},o(i){_(t.$$.fragment,i),n=!1},d(i){i&&v(e),S(t)}}}function ene(r){let e,t,n;function i(s){r[14](s)}let l={label:"Table Name",thin:!0,error:r[4]};return r[0].name!==void 0&&(l.value=r[0].name),e=new et({props:l}),x.push(()=>pe(e,"value",i)),e.$on("input",r[13]),{c(){k(e.$$.fragment)},m(s,o){C(e,s,o),n=!0},p(s,o){const a={};o&16&&(a.error=s[4]),!t&&o&1&&(t=!0,a.value=s[0].name,de(()=>t=!1)),e.$set(a)},i(s){n||(m(e.$$.fragment,s),n=!0)},o(s){_(e.$$.fragment,s),n=!1},d(s){S(e,s)}}}function tne(r){let e,t;return e=new zt({props:{title:"Edit Table",confirmText:"Save",onConfirm:r[12],disabled:r[0].name===r[8]||r[4],$$slots:{default:[ene]},$$scope:{ctx:r}}}),{c(){k(e.$$.fragment)},m(n,i){C(e,n,i),t=!0},p(n,i){const l={};i&17&&(l.disabled=n[0].name===n[8]||n[4]),i&33554449&&(l.$$scope={dirty:i,ctx:n}),e.$set(l)},i(n){t||(m(e.$$.fragment,n),t=!0)},o(n){_(e.$$.fragment,n),t=!1},d(n){S(e,n)}}}function j5(r){let e,t=r[22]+"",n;return{c(){e=D("div"),n=U(t),y(e,"class","svelte-1ogygrq")},m(i,l){b(i,e,l),L(e,n)},p(i,l){l&32&&t!==(t=i[22]+"")&&Se(n,t)},d(i){i&&v(e)}}}function nne(r){let e,t,n,i=r[0].name+"",l,s,o,a,u,f,c,p,d,g,h,$,w=r[5],A=[];for(let T=0;T<w.length;T+=1)A[T]=j5(M5(r,w,T));function E(T){r[16](T)}let I={placeholder:r[0].name,dataCy:"delete-table-confirm"};return r[6]!==void 0&&(I.value=r[6]),g=new et({props:I}),x.push(()=>pe(g,"value",E)),{c(){e=D("p"),t=U(`Are you sure you wish to delete the table
|
|
747
747
|
`),n=D("b"),l=U(i),s=U("?"),o=U(`
|
|
748
748
|
The following will also be deleted:`),a=R(),u=D("b"),f=D("div");for(let T=0;T<A.length;T+=1)A[T].c();c=R(),p=D("p"),p.textContent=`This action cannot be undone - to continue please enter the table name below
|
|
749
|
-
to confirm.`,d=R(),k(g.$$.fragment),y(f,"class","delete-items svelte-1ogygrq")},m(T,P){b(T,e,P),L(e,t),L(e,n),L(n,l),L(n,s),L(e,o),b(T,a,P),b(T,u,P),L(u,f);for(let M=0;M<A.length;M+=1)A[M].m(f,null);b(T,c,P),b(T,p,P),b(T,d,P),C(g,T,P),$=!0},p(T,P){if((!$||P&1)&&i!==(i=T[0].name+"")&&Se(l,i),P&32){w=T[5];let B;for(B=0;B<w.length;B+=1){const j=M5(T,w,B);A[B]?A[B].p(j,P):(A[B]=j5(j),A[B].c(),A[B].m(f,null))}for(;B<A.length;B+=1)A[B].d(1);A.length=w.length}const M={};P&1&&(M.placeholder=T[0].name),!h&&P&64&&(h=!0,M.value=T[6],de(()=>h=!1)),g.$set(M)},i(T){$||(m(g.$$.fragment,T),$=!0)},o(T){_(g.$$.fragment,T),$=!1},d(T){T&&v(e),T&&v(a),T&&v(u),dt(A,T),T&&v(c),T&&v(p),T&&v(d),S(g,T)}}}function rne(r){let e,t,n,i,l,s=r[7]&&D5(r),o={$$slots:{default:[tne]},$$scope:{ctx:r}};t=new Ct({props:o}),r[15](t);let a={okText:"Delete Table",onOk:r[10],onCancel:r[11],title:"Confirm Deletion",disabled:r[6]!==r[0].name,$$slots:{default:[nne]},$$scope:{ctx:r}};return i=new wr({props:a}),r[17](i),{c(){s&&s.c(),e=R(),k(t.$$.fragment),n=R(),k(i.$$.fragment)},m(u,f){s&&s.m(u,f),b(u,e,f),C(t,u,f),b(u,n,f),C(i,u,f),l=!0},p(u,[f]){u[7]?s?(s.p(u,f),f&128&&m(s,1)):(s=D5(u),s.c(),m(s,1),s.m(e.parentNode,e)):s&&(K(),_(s,1,1,()=>{s=null}),Z());const c={};f&33554449&&(c.$$scope={dirty:f,ctx:u}),t.$set(c);const p={};f&65&&(p.disabled=u[6]!==u[0].name),f&33554529&&(p.$$scope={dirty:f,ctx:u}),i.$set(p)},i(u){l||(m(s),m(t.$$.fragment,u),m(i.$$.fragment,u),l=!0)},o(u){_(s),_(t.$$.fragment,u),_(i.$$.fragment,u),l=!1},d(u){s&&s.d(u),u&&v(e),r[15](null),S(t,u),u&&v(n),r[17](null),S(i,u)}}}function ine(r,e,t){let n,i,l,s,o;ae(r,Qt,j=>t(19,l=j)),ae(r,Tt,j=>t(20,s=j)),ae(r,qe,j=>t(21,o=j));let{table:a}=e,u,f,c="",p=a.name,d,g,h;function $(){d=o.screens.filter(j=>j.autoTableId===a._id),t(5,g=["All table data"].concat(d.map(j=>`Screen ${j.props._instanceName}`))),f.show()}async function w(){const j=s.selected;try{await Tt.delete(a),await qe.actions.screens.delete(d),await Tt.fetch(),a.type==="external"&&await Zt.fetch(),be.success("Table deleted"),j&&j._id===a._id&&l("./table")}catch{be.error("Error deleting table")}}function A(){t(6,h="")}async function E(){await Tt.save(a),be.success("Table renamed successfully")}function I(j){const H=j.target.value;t(4,c=p===H?`Table with name ${H} already exists. Please choose another name.`:"")}function T(j){r.$$.not_equal(a.name,j)&&(a.name=j,t(0,a))}function P(j){x[j?"unshift":"push"](()=>{u=j,t(2,u)})}function M(j){h=j,t(6,h)}function B(j){x[j?"unshift":"push"](()=>{f=j,t(3,f)})}return r.$$set=j=>{"table"in j&&t(0,a=j.table)},r.$$.update=()=>{r.$$.dirty&1&&t(1,n=(a==null?void 0:a.type)==="external"),r.$$.dirty&3&&t(7,i=!n||(a==null?void 0:a.created))},[a,n,u,f,c,g,h,i,p,$,w,A,E,I,T,P,M,B]}class lne extends se{constructor(e){super();oe(this,e,ine,rne,ie,{table:0})}}function sne(r){let e;return{c(){e=U("Edit")},m(t,n){b(t,e,n)},d(t){t&&v(e)}}}function one(r){let e;return{c(){e=U("Delete")},m(t,n){b(t,e,n)},d(t){t&&v(e)}}}function ane(r){let e,t,n,i;return e=new rn({props:{icon:"Edit",$$slots:{default:[sne]},$$scope:{ctx:r}}}),e.$on("click",function(){pt(r[1].show)&&r[1].show.apply(this,arguments)}),n=new rn({props:{icon:"Delete",$$slots:{default:[one]},$$scope:{ctx:r}}}),n.$on("click",function(){pt(r[2].show)&&r[2].show.apply(this,arguments)}),{c(){k(e.$$.fragment),t=R(),k(n.$$.fragment)},m(l,s){C(e,l,s),b(l,t,s),C(n,l,s),i=!0},p(l,s){r=l;const o={};s&1024&&(o.$$scope={dirty:s,ctx:r}),e.$set(o);const a={};s&1024&&(a.$$scope={dirty:s,ctx:r}),n.$set(a)},i(l){i||(m(e.$$.fragment,l),m(n.$$.fragment,l),i=!0)},o(l){_(e.$$.fragment,l),_(n.$$.fragment,l),i=!1},d(l){S(e,l),l&&v(t),S(n,l)}}}function une(r){let e,t,n;return t=new tt({props:{s:!0,hoverable:!0,name:"MoreSmallList"}}),{c(){e=D("div"),k(t.$$.fragment),y(e,"slot","control"),y(e,"class","icon open-popover")},m(i,l){b(i,e,l),C(t,e,null),n=!0},p:we,i(i){n||(m(t.$$.fragment,i),n=!0)},o(i){_(t.$$.fragment,i),n=!1},d(i){i&&v(e),S(t)}}}function fne(r){let e,t,n;function i(s){r[5](s)}let l={label:"View Name",thin:!0};return r[0].name!==void 0&&(l.value=r[0].name),e=new et({props:l}),x.push(()=>pe(e,"value",i)),{c(){k(e.$$.fragment)},m(s,o){C(e,s,o),n=!0},p(s,o){const a={};!t&&o&1&&(t=!0,a.value=s[0].name,de(()=>t=!1)),e.$set(a)},i(s){n||(m(e.$$.fragment,s),n=!0)},o(s){_(e.$$.fragment,s),n=!1},d(s){S(e,s)}}}function cne(r){let e,t;return e=new zt({props:{title:"Edit View",onConfirm:r[3],confirmText:"Save",$$slots:{default:[fne]},$$scope:{ctx:r}}}),{c(){k(e.$$.fragment)},m(n,i){C(e,n,i),t=!0},p(n,i){const l={};i&1025&&(l.$$scope={dirty:i,ctx:n}),e.$set(l)},i(n){t||(m(e.$$.fragment,n),t=!0)},o(n){_(e.$$.fragment,n),t=!1},d(n){S(e,n)}}}function pne(r){let e,t,n,i,l,s;e=new Pr({props:{$$slots:{control:[une],default:[ane]},$$scope:{ctx:r}}});let o={$$slots:{default:[cne]},$$scope:{ctx:r}};n=new Ct({props:o}),r[6](n);let a={body:`Are you sure you wish to delete the view '${r[0].name}'? Your data will be deleted and this action cannot be undone.`,okText:"Delete View",onOk:r[4],title:"Confirm Deletion"};return l=new wr({props:a}),r[7](l),{c(){k(e.$$.fragment),t=R(),k(n.$$.fragment),i=R(),k(l.$$.fragment)},m(u,f){C(e,u,f),b(u,t,f),C(n,u,f),b(u,i,f),C(l,u,f),s=!0},p(u,[f]){const c={};f&1030&&(c.$$scope={dirty:f,ctx:u}),e.$set(c);const p={};f&1025&&(p.$$scope={dirty:f,ctx:u}),n.$set(p);const d={};f&1&&(d.body=`Are you sure you wish to delete the view '${u[0].name}'? Your data will be deleted and this action cannot be undone.`),l.$set(d)},i(u){s||(m(e.$$.fragment,u),m(n.$$.fragment,u),m(l.$$.fragment,u),s=!0)},o(u){_(e.$$.fragment,u),_(n.$$.fragment,u),_(l.$$.fragment,u),s=!1},d(u){S(e,u),u&&v(t),r[6](null),S(n,u),u&&v(i),r[7](null),S(l,u)}}}function dne(r,e,t){let n;ae(r,Qt,d=>t(8,n=d));let{view:i}=e,l,s=i.name,o;async function a(){await $r.save(Ee({originalName:s},i)),be.success("View renamed successfully")}async function u(){try{const d=i.name,g=i.tableId;await $r.delete(d),be.success("View deleted"),n(`./table/${g}`)}catch{be.error("Error deleting view")}}function f(d){r.$$.not_equal(i.name,d)&&(i.name=d,t(0,i))}function c(d){x[d?"unshift":"push"](()=>{l=d,t(1,l)})}function p(d){x[d?"unshift":"push"](()=>{o=d,t(2,o)})}return r.$$set=d=>{"view"in d&&t(0,i=d.view)},[i,l,o,a,u,f,c,p]}class mne extends se{constructor(e){super();oe(this,e,dne,pne,ie,{view:0})}}function z5(r,e,t){const n=r.slice();return n[13]=e[t],n[15]=t,n}function q5(r,e,t){const n=r.slice();return n[16]=e[t],n[15]=t,n}function U5(r){let e,t,n=r[2],i=[];for(let s=0;s<n.length;s+=1)i[s]=H5(z5(r,n,s));const l=s=>_(i[s],1,1,()=>{i[s]=null});return{c(){e=D("div");for(let s=0;s<i.length;s+=1)i[s].c();y(e,"class","hierarchy-items-container")},m(s,o){b(s,e,o);for(let a=0;a<i.length;a+=1)i[a].m(e,null);t=!0},p(s,o){if(o&55){n=s[2];let a;for(a=0;a<n.length;a+=1){const u=z5(s,n,a);i[a]?(i[a].p(u,o),m(i[a],1)):(i[a]=H5(u),i[a].c(),m(i[a],1),i[a].m(e,null))}for(K(),a=n.length;a<i.length;a+=1)l(a);Z()}},i(s){if(!t){for(let o=0;o<n.length;o+=1)m(i[o]);t=!0}},o(s){i=i.filter(Boolean);for(let o=0;o<i.length;o+=1)_(i[o]);t=!1},d(s){s&&v(e),dt(i,s)}}}function F5(r){let e,t;return e=new lne({props:{table:r[13]}}),{c(){k(e.$$.fragment)},m(n,i){C(e,n,i),t=!0},p(n,i){const l={};i&4&&(l.table=n[13]),e.$set(l)},i(n){t||(m(e.$$.fragment,n),t=!0)},o(n){_(e.$$.fragment,n),t=!1},d(n){S(e,n)}}}function gne(r){let e,t,n=r[13]._id!==fl.USERS&&F5(r);return{c(){n&&n.c(),e=Oe()},m(i,l){n&&n.m(i,l),b(i,e,l),t=!0},p(i,l){i[13]._id!==fl.USERS?n?(n.p(i,l),l&4&&m(n,1)):(n=F5(i),n.c(),m(n,1),n.m(e.parentNode,e)):n&&(K(),_(n,1,1,()=>{n=null}),Z())},i(i){t||(m(n),t=!0)},o(i){_(n),t=!1},d(i){n&&n.d(i),i&&v(e)}}}function _ne(r){let e,t,n;return e=new mne({props:{view:Ee({name:r[16]},r[13].views[r[16]])}}),{c(){k(e.$$.fragment),t=R()},m(i,l){C(e,i,l),b(i,t,l),n=!0},p(i,l){const s={};l&4&&(s.view=Ee({name:i[16]},i[13].views[i[16]])),e.$set(s)},i(i){n||(m(e.$$.fragment,i),n=!0)},o(i){_(e.$$.fragment,i),n=!1},d(i){S(e,i),i&&v(t)}}}function V5(r,e){let t,n,i;function l(){return e[9](e[13],e[16])}return n=new Fl({props:{indentLevel:2,icon:"Remove",text:e[16],selected:e[1]===e[16],$$slots:{default:[_ne]},$$scope:{ctx:e}}}),n.$on("click",l),{key:r,first:null,c(){t=Oe(),k(n.$$.fragment),this.first=t},m(s,o){b(s,t,o),C(n,s,o),i=!0},p(s,o){e=s;const a={};o&4&&(a.text=e[16]),o&6&&(a.selected=e[1]===e[16]),o&262148&&(a.$$scope={dirty:o,ctx:e}),n.$set(a)},i(s){i||(m(n.$$.fragment,s),i=!0)},o(s){_(n.$$.fragment,s),i=!1},d(s){s&&v(t),S(n,s)}}}function H5(r){var f;let e,t,n=[],i=new Map,l,s;function o(){return r[8](r[13])}e=new Fl({props:{indentLevel:1,border:r[15]>0,icon:r[13]._id===fl.USERS?"UserGroup":"Table",text:r[13].name,selected:((f=r[0].selected)==null?void 0:f._id)===r[13]._id,$$slots:{default:[gne]},$$scope:{ctx:r}}}),e.$on("click",o);let a=[...Object.keys(r[13].views||{})].sort();const u=c=>c[15];for(let c=0;c<a.length;c+=1){let p=q5(r,a,c),d=u(p);i.set(d,n[c]=V5(d,p))}return{c(){k(e.$$.fragment),t=R();for(let c=0;c<n.length;c+=1)n[c].c();l=Oe()},m(c,p){C(e,c,p),b(c,t,p);for(let d=0;d<n.length;d+=1)n[d].m(c,p);b(c,l,p),s=!0},p(c,p){var g;r=c;const d={};p&4&&(d.icon=r[13]._id===fl.USERS?"UserGroup":"Table"),p&4&&(d.text=r[13].name),p&5&&(d.selected=((g=r[0].selected)==null?void 0:g._id)===r[13]._id),p&262148&&(d.$$scope={dirty:p,ctx:r}),e.$set(d),p&38&&(a=[...Object.keys(r[13].views||{})].sort(),K(),n=ur(n,p,u,1,r,a,i,l.parentNode,ni,V5,l,q5),Z())},i(c){if(!s){m(e.$$.fragment,c);for(let p=0;p<a.length;p+=1)m(n[p]);s=!0}},o(c){_(e.$$.fragment,c);for(let p=0;p<n.length;p+=1)_(n[p]);s=!1},d(c){S(e,c),c&&v(t);for(let p=0;p<n.length;p+=1)n[p].d(c);c&&v(l)}}}function hne(r){var i;let e,t,n=((i=r[3])==null?void 0:i._id)&&U5(r);return{c(){n&&n.c(),e=Oe()},m(l,s){n&&n.m(l,s),b(l,e,s),t=!0},p(l,[s]){var o;((o=l[3])==null?void 0:o._id)?n?(n.p(l,s),s&8&&m(n,1)):(n=U5(l),n.c(),m(n,1),n.m(e.parentNode,e)):n&&(K(),_(n,1,1,()=>{n=null}),Z())},i(l){t||(m(n),t=!0)},o(l){_(n),t=!1},d(l){n&&n.d(l),l&&v(e)}}}function $ne(r,e,t){let n,i,l,s,o,a;ae(r,Qt,$=>t(10,l=$)),ae(r,Tt,$=>t(0,s=$)),ae(r,$r,$=>t(7,o=$)),ae(r,Hs,$=>t(3,a=$));const u=($,w)=>{var A,E;return((A=$.name)==null?void 0:A.toLowerCase())>((E=w.name)==null?void 0:E.toLowerCase())};let{sourceId:f}=e;function c($){Tt.select($),l(`./table/${$._id}`)}function p($){$r.select($),l(`./view/${$.name}`)}function d($,w){n!==w&&p(Ee({name:w},$.views[w]))}const g=$=>c($),h=($,w)=>d($,w);return r.$$set=$=>{"sourceId"in $&&t(6,f=$.sourceId)},r.$$.update=()=>{r.$$.dirty&128&&t(1,n=o.selected&&o.selected.name),r.$$.dirty&65&&t(2,i=s.list.filter($=>$.sourceId===f).sort(u))},[s,n,i,a,c,d,f,o,g,h]}class bne extends se{constructor(e){super();oe(this,e,$ne,hne,ie,{sourceId:6})}}function W5(r,e,t){const n=r.slice();return n[18]=e[t],n[20]=t,n}function G5(r,e,t){const n=r.slice();return n[21]=e[t],n}function Y5(r){let e,t,n=r[0],i=[];for(let s=0;s<n.length;s+=1)i[s]=K5(W5(r,n,s));const l=s=>_(i[s],1,1,()=>{i[s]=null});return{c(){e=D("div");for(let s=0;s<i.length;s+=1)i[s].c();y(e,"class","hierarchy-items-container")},m(s,o){b(s,e,o);for(let a=0;a<i.length;a+=1)i[a].m(e,null);t=!0},p(s,o){if(o&61){n=s[0];let a;for(a=0;a<n.length;a+=1){const u=W5(s,n,a);i[a]?(i[a].p(u,o),m(i[a],1)):(i[a]=K5(u),i[a].c(),m(i[a],1),i[a].m(e,null))}for(K(),a=n.length;a<i.length;a+=1)l(a);Z()}},i(s){if(!t){for(let o=0;o<n.length;o+=1)m(i[o]);t=!0}},o(s){i=i.filter(Boolean);for(let o=0;o<i.length;o+=1)_(i[o]);t=!1},d(s){s&&v(e),dt(i,s)}}}function J5(r){let e,t;return e=new Dte({props:{datasource:r[18]}}),{c(){k(e.$$.fragment)},m(n,i){C(e,n,i),t=!0},p(n,i){const l={};i&1&&(l.datasource=n[18]),e.$set(l)},i(n){t||(m(e.$$.fragment,n),t=!0)},o(n){_(e.$$.fragment,n),t=!1},d(n){S(e,n)}}}function vne(r){let e,t,n=r[18]._id!==Rm&&J5(r);return{c(){n&&n.c(),e=Oe()},m(i,l){n&&n.m(i,l),b(i,e,l),t=!0},p(i,l){i[18]._id!==Rm?n?(n.p(i,l),l&1&&m(n,1)):(n=J5(i),n.c(),m(n,1),n.m(e.parentNode,e)):n&&(K(),_(n,1,1,()=>{n=null}),Z())},i(i){t||(m(n),t=!0)},o(i){_(n),t=!1},d(i){n&&n.d(i),i&&v(e)}}}function wne(r){let e,t,n;var i=Li[r[18].source];function l(s){return{props:{height:"18",width:"18"}}}return i&&(t=new i(l())),{c(){e=D("div"),t&&k(t.$$.fragment),y(e,"class","datasource-icon svelte-11am1jd"),y(e,"slot","icon")},m(s,o){b(s,e,o),t&&C(t,e,null),n=!0},p(s,o){if(i!==(i=Li[s[18].source])){if(t){K();const a=t;_(a.$$.fragment,1,0,()=>{S(a,1)}),Z()}i?(t=new i(l()),k(t.$$.fragment),m(t.$$.fragment,1),C(t,e,null)):t=null}},i(s){n||(t&&m(t.$$.fragment,s),n=!0)},o(s){t&&_(t.$$.fragment,s),n=!1},d(s){s&&v(e),t&&S(t)}}}function X5(r){let e,t,n,i;e=new bne({props:{sourceId:r[18]._id}});function l(...u){return r[11](r[18],...u)}let s=r[2].list.filter(l),o=[];for(let u=0;u<s.length;u+=1)o[u]=Q5(G5(r,s,u));const a=u=>_(o[u],1,1,()=>{o[u]=null});return{c(){k(e.$$.fragment),t=R();for(let u=0;u<o.length;u+=1)o[u].c();n=Oe()},m(u,f){C(e,u,f),b(u,t,f);for(let c=0;c<o.length;c+=1)o[c].m(u,f);b(u,n,f),i=!0},p(u,f){r=u;const c={};if(f&1&&(c.sourceId=r[18]._id),e.$set(c),f&21){s=r[2].list.filter(l);let p;for(p=0;p<s.length;p+=1){const d=G5(r,s,p);o[p]?(o[p].p(d,f),m(o[p],1)):(o[p]=Q5(d),o[p].c(),m(o[p],1),o[p].m(n.parentNode,n))}for(K(),p=s.length;p<o.length;p+=1)a(p);Z()}},i(u){if(!i){m(e.$$.fragment,u);for(let f=0;f<s.length;f+=1)m(o[f]);i=!0}},o(u){_(e.$$.fragment,u),o=o.filter(Boolean);for(let f=0;f<o.length;f+=1)_(o[f]);i=!1},d(u){S(e,u),u&&v(t),dt(o,u),u&&v(n)}}}function yne(r){let e,t,n;return e=new Hte({props:{query:r[21],onClickQuery:r[4]}}),{c(){k(e.$$.fragment),t=R()},m(i,l){C(e,i,l),b(i,t,l),n=!0},p(i,l){const s={};l&5&&(s.query=i[21]),e.$set(s)},i(i){n||(m(e.$$.fragment,i),n=!0)},o(i){_(e.$$.fragment,i),n=!1},d(i){S(e,i),i&&v(t)}}}function Q5(r){let e,t;function n(){return r[12](r[21])}return e=new Fl({props:{indentLevel:1,icon:"SQLQuery",iconText:r4(r[18],r[21]),iconColor:i4(r[18],r[21]),text:l4(r[18],r[21]),opened:r[2].selected===r[21]._id,selected:r[2].selected===r[21]._id,$$slots:{default:[yne]},$$scope:{ctx:r}}}),e.$on("click",n),{c(){k(e.$$.fragment)},m(i,l){C(e,i,l),t=!0},p(i,l){r=i;const s={};l&5&&(s.iconText=r4(r[18],r[21])),l&5&&(s.iconColor=i4(r[18],r[21])),l&5&&(s.text=l4(r[18],r[21])),l&5&&(s.opened=r[2].selected===r[21]._id),l&5&&(s.selected=r[2].selected===r[21]._id),l&16777221&&(s.$$scope={dirty:l,ctx:r}),e.$set(s)},i(i){t||(m(e.$$.fragment,i),t=!0)},o(i){_(e.$$.fragment,i),t=!1},d(i){S(e,i)}}}function K5(r){let e,t,n,i;function l(){return r[9](r[18])}function s(){return r[10](r[18])}e=new Fl({props:{border:r[20]>0,text:r[18].name,opened:r[18].open,selected:r[18].selected,withArrow:!0,$$slots:{icon:[wne],default:[vne]},$$scope:{ctx:r}}}),e.$on("click",l),e.$on("iconClick",s);let o=r[18].open&&X5(r);return{c(){k(e.$$.fragment),t=R(),o&&o.c(),n=Oe()},m(a,u){C(e,a,u),b(a,t,u),o&&o.m(a,u),b(a,n,u),i=!0},p(a,u){r=a;const f={};u&1&&(f.text=r[18].name),u&1&&(f.opened=r[18].open),u&1&&(f.selected=r[18].selected),u&16777217&&(f.$$scope={dirty:u,ctx:r}),e.$set(f),r[18].open?o?(o.p(r,u),u&1&&m(o,1)):(o=X5(r),o.c(),m(o,1),o.m(n.parentNode,n)):o&&(K(),_(o,1,1,()=>{o=null}),Z())},i(a){i||(m(e.$$.fragment,a),m(o),i=!0)},o(a){_(e.$$.fragment,a),_(o),i=!1},d(a){S(e,a),a&&v(t),o&&o.d(a),a&&v(n)}}}function kne(r){var i;let e,t,n=((i=r[1])==null?void 0:i._id)&&Y5(r);return{c(){n&&n.c(),e=Oe()},m(l,s){n&&n.m(l,s),b(l,e,s),t=!0},p(l,[s]){var o;((o=l[1])==null?void 0:o._id)?n?(n.p(l,s),s&2&&m(n,1)):(n=Y5(l),n.c(),m(n,1),n.m(e.parentNode,e)):n&&(K(),_(n,1,1,()=>{n=null}),Z())},i(l){t||(m(n),t=!0)},o(l){_(n),t=!1},d(l){n&&n.d(l),l&&v(e)}}}function Cne(r,e,t){let n,i,l,s,o,a,u;ae(r,Lr,T=>t(13,l=T)),ae(r,Qt,T=>t(14,s=T)),ae(r,Zt,T=>t(8,o=T)),ae(r,Hs,T=>t(1,a=T)),ae(r,Sn,T=>t(2,u=T));let f=[];function c(T){g(T),Zt.select(T._id),s(`./datasource/${T._id}`)}function p(T){Sn.select(T),s(`./datasource/${T.datasourceId}/${T._id}`)}function d(T){t(6,f=f.filter(P=>T._id!==P))}function g(T){f.includes(T._id)||t(6,f=[...f,T._id])}function h(T){f.includes(T._id)?d(T):g(T)}Et(async()=>{try{await Zt.fetch(),await Sn.fetch()}catch{be.error("Error fetching datasources and queries")}});const $=T=>{var j,H;if(l.selectedDatasource===T._id)return!0;if(!T.entities)return!1;let P=T.entities;if(Array.isArray(P)||(P=Object.values(P)),l.selectedTable){const W=(j=st(Tt).selected)==null?void 0:j._id;return P.find(Y=>Y._id===W)!=null}const M=(H=st($r).selected)==null?void 0:H.name;return P.find(W=>{var Y;return((Y=W.views)==null?void 0:Y[M])!=null})!=null},w=T=>c(T),A=T=>h(T),E=(T,P)=>P.datasourceId===T._id,I=T=>p(T);return r.$$.update=()=>{r.$$.dirty&320&&t(0,n=Array.isArray(o.list)?o.list.map(T=>{const P=o.selected===T._id,M=f.includes(T._id),B=$(T),j=o.list.length===1;return xe(Ee({},T),{selected:P,open:P||M||B||j})}):[]),r.$$.dirty&1&&t(7,i=n.find(T=>T.open)),r.$$.dirty&128&&i&&g(i)},[n,a,u,c,p,h,f,i,o,w,A,E,I]}class Sne extends se{constructor(e){super();oe(this,e,Cne,kne,ie,{})}}function Ane(r){let e,t,n,i,l;e=new Sne({});function s(a){r[5](a)}let o={};return r[0]!==void 0&&(o.modal=r[0]),n=new o5({props:o}),x.push(()=>pe(n,"modal",s)),{c(){k(e.$$.fragment),t=R(),k(n.$$.fragment)},m(a,u){C(e,a,u),b(a,t,u),C(n,a,u),l=!0},p(a,u){const f={};!i&&u&1&&(i=!0,f.modal=a[0],de(()=>i=!1)),n.$set(f)},i(a){l||(m(e.$$.fragment,a),m(n.$$.fragment,a),l=!0)},o(a){_(e.$$.fragment,a),_(n.$$.fragment,a),l=!1},d(a){S(e,a),a&&v(t),S(n,a)}}}function One(r){let e,t;return e=new hn({props:{title:"Sources",$$slots:{default:[Ane]},$$scope:{ctx:r}}}),{c(){k(e.$$.fragment)},m(n,i){C(e,n,i),t=!0},p(n,i){const l={};i&65&&(l.$$scope={dirty:i,ctx:n}),e.$set(l)},i(n){t||(m(e.$$.fragment,n),t=!0)},o(n){_(e.$$.fragment,n),t=!1},d(n){S(e,n)}}}function Ene(r){let e,t,n,i,l,s,o,a,u,f;n=new Kr({props:{selected:Ine,$$slots:{default:[One]},$$scope:{ctx:r}}}),n.$on("select",r[2]),s=new tt({props:{hoverable:!0,name:"AddCircle"}}),s.$on("click",function(){pt(r[0].show)&&r[0].show.apply(this,arguments)});const c=r[4].default,p=ht(c,r,r[6],null);return{c(){e=D("div"),t=D("div"),k(n.$$.fragment),i=R(),l=D("div"),k(s.$$.fragment),a=R(),u=D("div"),p&&p.c(),y(l,"class","add-button svelte-1oe3r6d"),y(l,"data-cy",o=`new-${r[1]?"datasource":"table"}`),y(t,"class","nav svelte-1oe3r6d"),y(u,"class","content svelte-1oe3r6d"),y(e,"class","root svelte-1oe3r6d")},m(d,g){b(d,e,g),L(e,t),C(n,t,null),L(t,i),L(t,l),C(s,l,null),L(e,a),L(e,u),p&&p.m(u,null),f=!0},p(d,[g]){r=d;const h={};g&65&&(h.$$scope={dirty:g,ctx:r}),n.$set(h),(!f||g&2&&o!==(o=`new-${r[1]?"datasource":"table"}`))&&y(l,"data-cy",o),p&&p.p&&(!f||g&64)&&$t(p,c,r,r[6],f?vt(c,r[6],g,null):bt(r[6]),null)},i(d){f||(m(n.$$.fragment,d),m(s.$$.fragment,d),m(p,d),f=!0)},o(d){_(n.$$.fragment,d),_(s.$$.fragment,d),_(p,d),f=!1},d(d){d&&v(e),S(n),S(s),p&&p.d(d)}}}let Ine="Sources";function Tne(r,e,t){let n,i,l;ae(r,kn,c=>t(7,i=c)),ae(r,Lr,c=>t(3,l=c));let{$$slots:s={},$$scope:o}=e,a;function u(){i("./table")}function f(c){a=c,t(0,a)}return r.$$set=c=>{"$$scope"in c&&t(6,o=c.$$scope)},r.$$.update=()=>{r.$$.dirty&8&&t(1,n=l.selectedDatasource&&l.selectedDatasource!==Rm)},[a,n,u,l,s,f,o]}class Lne extends se{constructor(e){super();oe(this,e,Tne,Ene,ie,{})}}function Pne(r,e,t){let n;return ae(r,kn,i=>t(0,n=i)),n("../screens"),[]}class Nne extends se{constructor(e){super();oe(this,e,Pne,null,ie,{})}}function Z5(r){let e,t;return e=new tt({props:{name:"ArrowLeft",hoverable:!0}}),e.$on("click",function(){pt(r[6])&&r[6].apply(this,arguments)}),{c(){k(e.$$.fragment)},m(n,i){C(e,n,i),t=!0},p(n,i){r=n},i(n){t||(m(e.$$.fragment,n),t=!0)},o(n){_(e.$$.fragment,n),t=!1},d(n){S(e,n)}}}function x5(r){let e,t;return e=new tt({props:{name:r[1]}}),{c(){k(e.$$.fragment)},m(n,i){C(e,n,i),t=!0},p(n,i){const l={};i&2&&(l.name=n[1]),e.$set(l)},i(n){t||(m(e.$$.fragment,n),t=!0)},o(n){_(e.$$.fragment,n),t=!1},d(n){S(e,n)}}}function Rne(r){let e=(r[0]||"")+"",t;return{c(){t=U(e)},m(n,i){b(n,t,i)},p(n,i){i&1&&e!==(e=(n[0]||"")+"")&&Se(t,e)},d(n){n&&v(t)}}}function ey(r){let e,t;return e=new tt({props:{name:r[9]?"Minimize":"Maximize",hoverable:!0}}),e.$on("click",r[11]),{c(){k(e.$$.fragment)},m(n,i){C(e,n,i),t=!0},p(n,i){const l={};i&512&&(l.name=n[9]?"Minimize":"Maximize"),e.$set(l)},i(n){t||(m(e.$$.fragment,n),t=!0)},o(n){_(e.$$.fragment,n),t=!1},d(n){S(e,n)}}}function ty(r){let e,t,n,i,l;return t=new tt({props:{name:"Add"}}),{c(){e=D("div"),k(t.$$.fragment),y(e,"class","add-button svelte-1bxbycf")},m(s,o){b(s,e,o),C(t,e,null),n=!0,i||(l=Le(e,"click",function(){pt(r[5])&&r[5].apply(this,arguments)}),i=!0)},p(s,o){r=s},i(s){n||(m(t.$$.fragment,s),n=!0)},o(s){_(t.$$.fragment,s),n=!1},d(s){s&&v(e),S(t),i=!1,l()}}}function Mne(r){let e,t,n,i,l,s,o,a,u,f,c,p=r[3]&&Z5(r),d=r[1]&&x5(r);s=new ut({props:{size:"XXS",$$slots:{default:[Rne]},$$scope:{ctx:r}}});let g=r[4]&&ey(r),h=r[2]&&ty(r);const $=r[10].default,w=ht($,r,r[12],null);return{c(){e=D("div"),t=D("div"),p&&p.c(),n=R(),d&&d.c(),i=R(),l=D("div"),k(s.$$.fragment),o=R(),g&&g.c(),a=R(),h&&h.c(),u=R(),f=D("div"),w&&w.c(),y(l,"class","title svelte-1bxbycf"),y(t,"class","header svelte-1bxbycf"),y(f,"class","body svelte-1bxbycf"),y(e,"class","panel svelte-1bxbycf"),te(e,"wide",r[9]),te(e,"borderLeft",r[7]),te(e,"borderRight",r[8])},m(A,E){b(A,e,E),L(e,t),p&&p.m(t,null),L(t,n),d&&d.m(t,null),L(t,i),L(t,l),C(s,l,null),L(t,o),g&&g.m(t,null),L(t,a),h&&h.m(t,null),L(e,u),L(e,f),w&&w.m(f,null),c=!0},p(A,[E]){A[3]?p?(p.p(A,E),E&8&&m(p,1)):(p=Z5(A),p.c(),m(p,1),p.m(t,n)):p&&(K(),_(p,1,1,()=>{p=null}),Z()),A[1]?d?(d.p(A,E),E&2&&m(d,1)):(d=x5(A),d.c(),m(d,1),d.m(t,i)):d&&(K(),_(d,1,1,()=>{d=null}),Z());const I={};E&4097&&(I.$$scope={dirty:E,ctx:A}),s.$set(I),A[4]?g?(g.p(A,E),E&16&&m(g,1)):(g=ey(A),g.c(),m(g,1),g.m(t,a)):g&&(K(),_(g,1,1,()=>{g=null}),Z()),A[2]?h?(h.p(A,E),E&4&&m(h,1)):(h=ty(A),h.c(),m(h,1),h.m(t,null)):h&&(K(),_(h,1,1,()=>{h=null}),Z()),w&&w.p&&(!c||E&4096)&&$t(w,$,A,A[12],c?vt($,A[12],E,null):bt(A[12]),null),E&512&&te(e,"wide",A[9]),E&128&&te(e,"borderLeft",A[7]),E&256&&te(e,"borderRight",A[8])},i(A){c||(m(p),m(d),m(s.$$.fragment,A),m(g),m(h),m(w,A),c=!0)},o(A){_(p),_(d),_(s.$$.fragment,A),_(g),_(h),_(w,A),c=!1},d(A){A&&v(e),p&&p.d(),d&&d.d(),S(s),g&&g.d(),h&&h.d(),w&&w.d(A)}}}function Dne(r,e,t){let{$$slots:n={},$$scope:i}=e,{title:l}=e,{icon:s}=e,{showAddButton:o=!1}=e,{showBackButton:a=!1}=e,{showExpandIcon:u=!1}=e,{onClickAddButton:f}=e,{onClickBackButton:c}=e,{borderLeft:p=!1}=e,{borderRight:d=!1}=e,g=!1;const h=()=>t(9,g=!g);return r.$$set=$=>{"title"in $&&t(0,l=$.title),"icon"in $&&t(1,s=$.icon),"showAddButton"in $&&t(2,o=$.showAddButton),"showBackButton"in $&&t(3,a=$.showBackButton),"showExpandIcon"in $&&t(4,u=$.showExpandIcon),"onClickAddButton"in $&&t(5,f=$.onClickAddButton),"onClickBackButton"in $&&t(6,c=$.onClickBackButton),"borderLeft"in $&&t(7,p=$.borderLeft),"borderRight"in $&&t(8,d=$.borderRight),"$$scope"in $&&t(12,i=$.$$scope)},[l,s,o,a,u,f,c,p,d,g,n,h,i]}class Pi extends se{constructor(e){super();oe(this,e,Dne,Mne,ie,{title:0,icon:1,showAddButton:2,showBackButton:3,showExpandIcon:4,onClickAddButton:5,onClickBackButton:6,borderLeft:7,borderRight:8})}}function ny(r){var s;let e,t,n,i;e=new Pr({props:{$$slots:{control:[Yne],default:[Gne]},$$scope:{ctx:r}}});let l={title:"Confirm Deletion",body:`Are you sure you wish to delete this '${(s=r[0])==null?void 0:s.name}' component?`,okText:"Delete Component",onOk:r[8]};return n=new wr({props:l}),r[18](n),{c(){k(e.$$.fragment),t=R(),k(n.$$.fragment)},m(o,a){C(e,o,a),b(o,t,a),C(n,o,a),i=!0},p(o,a){var c;const u={};a&524314&&(u.$$scope={dirty:a,ctx:o}),e.$set(u);const f={};a&1&&(f.body=`Are you sure you wish to delete this '${(c=o[0])==null?void 0:c.name}' component?`),n.$set(f)},i(o){i||(m(e.$$.fragment,o),m(n.$$.fragment,o),i=!0)},o(o){_(e.$$.fragment,o),_(n.$$.fragment,o),i=!1},d(o){S(e,o),o&&v(t),r[18](null),S(n,o)}}}function Bne(r){let e;return{c(){e=U("Delete")},m(t,n){b(t,e,n)},d(t){t&&v(e)}}}function jne(r){let e;return{c(){e=U("Move up")},m(t,n){b(t,e,n)},d(t){t&&v(e)}}}function zne(r){let e;return{c(){e=U("Move down")},m(t,n){b(t,e,n)},d(t){t&&v(e)}}}function qne(r){let e;return{c(){e=U("Duplicate")},m(t,n){b(t,e,n)},d(t){t&&v(e)}}}function Une(r){let e;return{c(){e=U("Cut")},m(t,n){b(t,e,n)},d(t){t&&v(e)}}}function Fne(r){let e;return{c(){e=U("Copy")},m(t,n){b(t,e,n)},d(t){t&&v(e)}}}function Vne(r){let e;return{c(){e=U("Paste above")},m(t,n){b(t,e,n)},d(t){t&&v(e)}}}function Hne(r){let e;return{c(){e=U("Paste below")},m(t,n){b(t,e,n)},d(t){t&&v(e)}}}function Wne(r){let e;return{c(){e=U("Paste inside")},m(t,n){b(t,e,n)},d(t){t&&v(e)}}}function Gne(r){let e,t,n,i,l,s,o,a,u,f,c,p,d,g,h,$,w,A;return e=new rn({props:{icon:"Delete",$$slots:{default:[Bne]},$$scope:{ctx:r}}}),e.$on("click",function(){pt(r[1].show)&&r[1].show.apply(this,arguments)}),n=new rn({props:{noClose:!0,icon:"ChevronUp",$$slots:{default:[jne]},$$scope:{ctx:r}}}),n.$on("click",r[5]),l=new rn({props:{noClose:!0,icon:"ChevronDown",$$slots:{default:[zne]},$$scope:{ctx:r}}}),l.$on("click",r[6]),o=new rn({props:{noClose:!0,icon:"Duplicate",$$slots:{default:[qne]},$$scope:{ctx:r}}}),o.$on("click",r[7]),u=new rn({props:{icon:"Cut",$$slots:{default:[Une]},$$scope:{ctx:r}}}),u.$on("click",r[13]),c=new rn({props:{icon:"Copy",$$slots:{default:[Fne]},$$scope:{ctx:r}}}),c.$on("click",r[14]),d=new rn({props:{icon:"LayersBringToFront",disabled:r[3],$$slots:{default:[Vne]},$$scope:{ctx:r}}}),d.$on("click",r[15]),h=new rn({props:{icon:"LayersSendToBack",disabled:r[3],$$slots:{default:[Hne]},$$scope:{ctx:r}}}),h.$on("click",r[16]),w=new rn({props:{icon:"ShowOneLayer",disabled:r[3]||r[4],$$slots:{default:[Wne]},$$scope:{ctx:r}}}),w.$on("click",r[17]),{c(){k(e.$$.fragment),t=R(),k(n.$$.fragment),i=R(),k(l.$$.fragment),s=R(),k(o.$$.fragment),a=R(),k(u.$$.fragment),f=R(),k(c.$$.fragment),p=R(),k(d.$$.fragment),g=R(),k(h.$$.fragment),$=R(),k(w.$$.fragment)},m(E,I){C(e,E,I),b(E,t,I),C(n,E,I),b(E,i,I),C(l,E,I),b(E,s,I),C(o,E,I),b(E,a,I),C(u,E,I),b(E,f,I),C(c,E,I),b(E,p,I),C(d,E,I),b(E,g,I),C(h,E,I),b(E,$,I),C(w,E,I),A=!0},p(E,I){r=E;const T={};I&524288&&(T.$$scope={dirty:I,ctx:r}),e.$set(T);const P={};I&524288&&(P.$$scope={dirty:I,ctx:r}),n.$set(P);const M={};I&524288&&(M.$$scope={dirty:I,ctx:r}),l.$set(M);const B={};I&524288&&(B.$$scope={dirty:I,ctx:r}),o.$set(B);const j={};I&524288&&(j.$$scope={dirty:I,ctx:r}),u.$set(j);const H={};I&524288&&(H.$$scope={dirty:I,ctx:r}),c.$set(H);const W={};I&8&&(W.disabled=r[3]),I&524288&&(W.$$scope={dirty:I,ctx:r}),d.$set(W);const Y={};I&8&&(Y.disabled=r[3]),I&524288&&(Y.$$scope={dirty:I,ctx:r}),h.$set(Y);const G={};I&24&&(G.disabled=r[3]||r[4]),I&524288&&(G.$$scope={dirty:I,ctx:r}),w.$set(G)},i(E){A||(m(e.$$.fragment,E),m(n.$$.fragment,E),m(l.$$.fragment,E),m(o.$$.fragment,E),m(u.$$.fragment,E),m(c.$$.fragment,E),m(d.$$.fragment,E),m(h.$$.fragment,E),m(w.$$.fragment,E),A=!0)},o(E){_(e.$$.fragment,E),_(n.$$.fragment,E),_(l.$$.fragment,E),_(o.$$.fragment,E),_(u.$$.fragment,E),_(c.$$.fragment,E),_(d.$$.fragment,E),_(h.$$.fragment,E),_(w.$$.fragment,E),A=!1},d(E){S(e,E),E&&v(t),S(n,E),E&&v(i),S(l,E),E&&v(s),S(o,E),E&&v(a),S(u,E),E&&v(f),S(c,E),E&&v(p),S(d,E),E&&v(g),S(h,E),E&&v($),S(w,E)}}}function Yne(r){let e,t,n;return t=new tt({props:{size:"S",hoverable:!0,name:"MoreSmallList"}}),{c(){e=D("div"),k(t.$$.fragment),y(e,"slot","control"),y(e,"class","icon svelte-u6s22l")},m(i,l){b(i,e,l),C(t,e,null),n=!0},p:we,i(i){n||(m(t.$$.fragment,i),n=!0)},o(i){_(t.$$.fragment,i),n=!1},d(i){i&&v(e),S(t)}}}function Jne(r){let e,t,n=r[2]&&ny(r);return{c(){n&&n.c(),e=Oe()},m(i,l){n&&n.m(i,l),b(i,e,l),t=!0},p(i,[l]){i[2]?n?(n.p(i,l),l&4&&m(n,1)):(n=ny(i),n.c(),m(n,1),n.m(e.parentNode,e)):n&&(K(),_(n,1,1,()=>{n=null}),Z())},i(i){t||(m(n),t=!0)},o(i){_(n),t=!1},d(i){n&&n.d(i),i&&v(e)}}}function Xne(r,e,t){let n,i,l,s,o;ae(r,qe,P=>t(12,o=P));let{component:a}=e,u;const f=async()=>{try{await qe.actions.components.moveUp(a)}catch{be.error("Error moving component up")}},c=async()=>{try{await qe.actions.components.moveDown(a)}catch{be.error("Error moving component down")}},p=()=>{g(!1),h("below")},d=async()=>{try{await qe.actions.components.delete(a)}catch{be.error("Error deleting component")}},g=(P=!1)=>{qe.actions.components.copy(a,P)},h=P=>{try{qe.actions.components.paste(a,P)}catch{be.error("Error saving component")}},$=()=>g(!0),w=()=>g(!1),A=()=>h("above"),E=()=>h("below"),I=()=>h("inside");function T(P){x[P?"unshift":"push"](()=>{u=P,t(1,u)})}return r.$$set=P=>{"component"in P&&t(11,a=P.component)},r.$$.update=()=>{r.$$.dirty&2048&&t(0,n=qe.actions.components.getDefinition(a==null?void 0:a._component)),r.$$.dirty&2049&&t(4,i=!a||!(n==null?void 0:n.hasChildren)),r.$$.dirty&4096&&t(3,l=!o.componentToPaste),r.$$.dirty&1&&t(2,s=(n==null?void 0:n.editable)!==!1&&(n==null?void 0:n.static)!==!0)},[n,u,s,l,i,f,c,p,d,g,h,a,o,$,w,A,E,I,T]}class Qne extends se{constructor(e){super();oe(this,e,Xne,Jne,ie,{component:11})}}const Or={ABOVE:"above",BELOW:"below",INSIDE:"inside"},ry={source:null,target:null,targetParent:null,dropPosition:null,dragging:!1,valid:!1},Kne=()=>{const r=cn(ry),e={dragstart:t=>{!t||r.set({source:t,target:null,dropPosition:null,dragging:!0,valid:!1})},dragover:({component:t,mousePosition:n})=>{var c,p;const i=qe.actions.components.getDefinition(t._component),l=i==null?void 0:i.hasChildren,s=((c=t._children)==null?void 0:c.length)>0;let o,a,u;l?n<=.33?o=Or.ABOVE:n>=.66?o=Or.BELOW:o=Or.INSIDE:o=n>.5?Or.BELOW:Or.ABOVE,o===Or.BELOW&&s?(a=t._children[0],o=Or.ABOVE):a=t;const f=st(r);o===f.dropPosition&&(a==null?void 0:a._id)===((p=f.target)==null?void 0:p._id)||(a&&(u=jl(st(Nn).props,a._id)),r.update(d=>{var g;return xe(Ee({},d),{dropPosition:o,target:a,targetParent:u,valid:((g=zl(d.source,a._id))==null?void 0:g.length)===0})}))},reset:()=>{r.set(ry)},drop:async()=>{const t=st(r);!t.valid||!t.source||!t.target||(e.reset(),qe.actions.components.copy(t.source,!0,!1),await qe.actions.components.paste(t.target,t.dropPosition))}};return{subscribe:r.subscribe,actions:e}},Uo=Kne();function iy(r,e,t){const n=r.slice();n[19]=e[t],n[22]=t;const i=n[11](n[19],n[4],n[2]);return n[20]=i,n}function Zne(r){let e,t;return e=new Qne({props:{component:r[19]}}),{c(){k(e.$$.fragment)},m(n,i){C(e,n,i),t=!0},p(n,i){const l={};i&8&&(l.component=n[19]),e.$set(l)},i(n){t||(m(e.$$.fragment,n),t=!0)},o(n){_(e.$$.fragment,n),t=!1},d(n){S(e,n)}}}function ly(r){let e,t;return e=new oy({props:{components:r[19]._children,dndStore:Uo,level:r[0]+1}}),{c(){k(e.$$.fragment)},m(n,i){C(e,n,i),t=!0},p(n,i){const l={};i&8&&(l.components=n[19]._children),i&1&&(l.level=n[0]+1),e.$set(l)},i(n){t||(m(e.$$.fragment,n),t=!0)},o(n){_(e.$$.fragment,n),t=!1},d(n){S(e,n)}}}function sy(r,e){let t,n,i,l,s,o,a,u;function f(){return e[14](e[19])}function c(){return e[15](e[19])}n=new Fl({props:{scrollable:!0,draggable:!0,text:e[6](e[19]),icon:e[7](e[19]),withArrow:e[8](e[19]),indentLevel:e[0]+1,selected:e[1].selectedComponentId===e[19]._id,opened:e[20],highlighted:e[12](e[19]),$$slots:{default:[Zne]},$$scope:{ctx:e}}}),n.$on("dragend",Uo.actions.reset),n.$on("dragstart",f),n.$on("dragover",function(){pt(e[5](e[19],e[22]))&&e[5](e[19],e[22]).apply(this,arguments)}),n.$on("iconClick",c),n.$on("drop",e[10]);let p=e[20]&&ly(e);function d(){return e[16](e[19])}return{key:r,first:null,c(){t=D("li"),k(n.$$.fragment),i=R(),p&&p.c(),l=R(),y(t,"id",s=`component-${e[19]._id}`),y(t,"class","svelte-kv7hxn"),this.first=t},m(g,h){b(g,t,h),C(n,t,null),L(t,i),p&&p.m(t,null),L(t,l),o=!0,a||(u=Le(t,"click",qp(d)),a=!0)},p(g,h){e=g;const $={};h&8&&($.text=e[6](e[19])),h&8&&($.icon=e[7](e[19])),h&8&&($.withArrow=e[8](e[19])),h&1&&($.indentLevel=e[0]+1),h&10&&($.selected=e[1].selectedComponentId===e[19]._id),h&28&&($.opened=e[20]),h&8&&($.highlighted=e[12](e[19])),h&8388616&&($.$$scope={dirty:h,ctx:e}),n.$set($),e[20]?p?(p.p(e,h),h&28&&m(p,1)):(p=ly(e),p.c(),m(p,1),p.m(t,l)):p&&(K(),_(p,1,1,()=>{p=null}),Z()),(!o||h&8&&s!==(s=`component-${e[19]._id}`))&&y(t,"id",s)},i(g){o||(m(n.$$.fragment,g),m(p),o=!0)},o(g){_(n.$$.fragment,g),_(p),o=!1},d(g){g&&v(t),S(n),p&&p.d(),a=!1,u()}}}function xne(r){let e,t=[],n=new Map,i,l=r[3]||[];const s=o=>o[19]._id;for(let o=0;o<l.length;o+=1){let a=iy(r,l,o),u=s(a);n.set(u,t[o]=sy(u,a))}return{c(){e=D("ul");for(let o=0;o<t.length;o+=1)t[o].c();y(e,"class","svelte-kv7hxn")},m(o,a){b(o,e,a);for(let u=0;u<t.length;u+=1)t[u].m(e,null);i=!0},p(o,[a]){a&8191&&(l=o[3]||[],K(),t=ur(t,a,s,1,o,l,n,e,ni,sy,null,iy),Z())},i(o){if(!i){for(let a=0;a<l.length;a+=1)m(t[a]);i=!0}},o(o){for(let a=0;a<t.length;a+=1)_(t[a]);i=!1},d(o){o&&v(e);for(let a=0;a<t.length;a+=1)t[a].d()}}}function ere(r,e,t){let n,i,l,s;ae(r,pl,P=>t(17,i=P)),ae(r,qe,P=>t(1,l=P)),ae(r,Mq,P=>t(4,s=P));let{components:o=[]}=e,{level:a=0}=e,u={};const f=(P,M)=>B=>{const j=B.offsetY/B.currentTarget.offsetHeight;return Uo.actions.dragover({component:P,index:M,mousePosition:j}),!1},c=P=>{if(P._instanceName)return P._instanceName;const M=P._component.replace("@budibase/standard-components/","")||"component";return vr(M)},p=P=>{const M=qe.actions.components.getDefinition(P==null?void 0:P._component);return M==null?void 0:M.icon},d=P=>{const M=qe.actions.components.getDefinition(P==null?void 0:P._component);return M==null?void 0:M.hasChildren},g=P=>{var M;return d(P)&&((M=P._children)==null?void 0:M.length)};function h(P){u[P]?delete u[P]:t(2,u[P]=!0,u),t(2,u)}const $=async()=>{try{await Uo.actions.drop()}catch(P){console.error(P),be.error("Error saving component")}},w=(P,M,B)=>{var j;return((j=P==null?void 0:P._children)==null?void 0:j.length)?M.includes(P._id)?!0:!B[P._id]:!1},A=P=>{var j,H,W;const M=(j=st(pl))==null?void 0:j._id,B=(H=st(Nn))==null?void 0:H.props._id;return!M||M===B?!1:((W=zl(i,P._id))==null?void 0:W.length)>0},E=P=>Uo.actions.dragstart(P),I=P=>h(P._id),T=P=>{gn(qe,l.selectedComponentId=P._id,l)};return r.$$set=P=>{"components"in P&&t(13,o=P.components),"level"in P&&t(0,a=P.level)},r.$$.update=()=>{r.$$.dirty&8194&&t(3,n=o==null?void 0:o.filter(P=>{var M,B;return!((M=l.componentToPaste)==null?void 0:M.isCut)||P._id!==((B=l.componentToPaste)==null?void 0:B._id)}))},[a,l,u,n,s,f,c,p,g,h,$,w,A,o,E,I,T]}class oy extends se{constructor(e){super();oe(this,e,ere,xne,ie,{components:13,level:0})}}function ay(r){let e,t;return e=new Pr({props:{$$slots:{control:[ire],default:[rre]},$$scope:{ctx:r}}}),{c(){k(e.$$.fragment)},m(n,i){C(e,n,i),t=!0},p(n,i){const l={};i&514&&(l.$$scope={dirty:i,ctx:n}),e.$set(l)},i(n){t||(m(e.$$.fragment,n),t=!0)},o(n){_(e.$$.fragment,n),t=!1},d(n){S(e,n)}}}function tre(r){let e;return{c(){e=U("Copy")},m(t,n){b(t,e,n)},d(t){t&&v(e)}}}function nre(r){let e;return{c(){e=U("Paste inside")},m(t,n){b(t,e,n)},d(t){t&&v(e)}}}function rre(r){let e,t,n,i;return e=new rn({props:{icon:"Copy",$$slots:{default:[tre]},$$scope:{ctx:r}}}),e.$on("click",r[7]),n=new rn({props:{icon:"ShowOneLayer",disabled:r[1],$$slots:{default:[nre]},$$scope:{ctx:r}}}),n.$on("click",r[8]),{c(){k(e.$$.fragment),t=R(),k(n.$$.fragment)},m(l,s){C(e,l,s),b(l,t,s),C(n,l,s),i=!0},p(l,s){const o={};s&512&&(o.$$scope={dirty:s,ctx:l}),e.$set(o);const a={};s&2&&(a.disabled=l[1]),s&512&&(a.$$scope={dirty:s,ctx:l}),n.$set(a)},i(l){i||(m(e.$$.fragment,l),m(n.$$.fragment,l),i=!0)},o(l){_(e.$$.fragment,l),_(n.$$.fragment,l),i=!1},d(l){S(e,l),l&&v(t),S(n,l)}}}function ire(r){let e,t,n;return t=new tt({props:{size:"S",hoverable:!0,name:"MoreSmallList"}}),{c(){e=D("div"),k(t.$$.fragment),y(e,"slot","control"),y(e,"class","icon svelte-u6s22l")},m(i,l){b(i,e,l),C(t,e,null),n=!0},p:we,i(i){n||(m(t.$$.fragment,i),n=!0)},o(i){_(t.$$.fragment,i),n=!1},d(i){i&&v(e),S(t)}}}function lre(r){let e,t,n=r[0]&&ay(r);return{c(){n&&n.c(),e=Oe()},m(i,l){n&&n.m(i,l),b(i,e,l),t=!0},p(i,[l]){i[0]?n?(n.p(i,l),l&1&&m(n,1)):(n=ay(i),n.c(),m(n,1),n.m(e.parentNode,e)):n&&(K(),_(n,1,1,()=>{n=null}),Z())},i(i){t||(m(n),t=!0)},o(i){_(n),t=!1},d(i){n&&n.d(i),i&&v(e)}}}function sre(r,e,t){let n,i,l,s;ae(r,qe,p=>t(6,s=p));let{component:o}=e;const a=(p=!1)=>{qe.actions.components.copy(o,p)},u=p=>{try{qe.actions.components.paste(o,p)}catch{be.error("Error saving component")}},f=()=>a(!1),c=()=>u("inside");return r.$$set=p=>{"component"in p&&t(4,o=p.component)},r.$$.update=()=>{r.$$.dirty&16&&t(5,n=qe.actions.components.getDefinition(o==null?void 0:o._component)),r.$$.dirty&64&&t(1,i=!s.componentToPaste),r.$$.dirty&32&&t(0,l=(n==null?void 0:n.editable)!==!1&&(n==null?void 0:n.static)!==!0)},[l,i,a,u,o,n,s,f,c]}class ore extends se{constructor(e){super();oe(this,e,sre,lre,ie,{component:4})}}function uy(r){let e,t;return{c(){e=D("div"),y(e,"class","indicator svelte-9uy3y5"),ft(e,"--x",r[2]+"px"),ft(e,"--y",r[3]+"px"),ft(e,"--width",r[4]+"px"),ft(e,"--height",r[5]+"px"),te(e,"above",r[1]===Or.ABOVE),te(e,"below",r[1]===Or.BELOW),te(e,"inside",r[1]===Or.INSIDE)},m(n,i){b(n,e,i)},p(n,i){i&4&&ft(e,"--x",n[2]+"px"),i&8&&ft(e,"--y",n[3]+"px"),i&16&&ft(e,"--width",n[4]+"px"),i&32&&ft(e,"--height",n[5]+"px"),i&2&&te(e,"above",n[1]===Or.ABOVE),i&2&&te(e,"below",n[1]===Or.BELOW),i&2&&te(e,"inside",n[1]===Or.INSIDE)},i(n){t||Tr(()=>{t=Is(e,Kl,{duration:130}),t.start()})},o:we,d(n){n&&v(e)}}}function are(r){let e,t=r[0]&&r[1]&&uy(r);return{c(){t&&t.c(),e=Oe()},m(n,i){t&&t.m(n,i),b(n,e,i)},p(n,[i]){n[0]&&n[1]?t?(t.p(n,i),i&3&&m(t,1)):(t=uy(n),t.c(),m(t,1),t.m(e.parentNode,e)):t&&(t.d(1),t=null)},i(n){m(t)},o:we,d(n){t&&t.d(n),n&&v(e)}}}function ure(r,e,t){let{component:n}=e,{position:i}=e,l,s,o,a;const u=f=>{var d;const c=document.getElementById(`component-${f==null?void 0:f._id}`),p=(d=c==null?void 0:c.childNodes[0])==null?void 0:d.childNodes[0];!c||(t(2,l=p.offsetLeft),t(3,s=p.offsetTop),t(4,o=p.clientWidth),t(5,a=p.clientHeight))};return r.$$set=f=>{"component"in f&&t(0,n=f.component),"position"in f&&t(1,i=f.position)},r.$$.update=()=>{r.$$.dirty&1&&u(n)},[n,i,l,s,o,a]}class fy extends se{constructor(e){super();oe(this,e,ure,are,ie,{component:0,position:1})}}function fre(r){var n;let e,t;return e=new ore({props:{component:(n=r[3])==null?void 0:n.props}}),{c(){k(e.$$.fragment)},m(i,l){C(e,i,l),t=!0},p(i,l){var o;const s={};l&8&&(s.component=(o=i[3])==null?void 0:o.props),e.$set(s)},i(i){t||(m(e.$$.fragment,i),t=!0)},o(i){_(e.$$.fragment,i),t=!1},d(i){S(e,i)}}}function cy(r){let e,t,n,i;e=new fy({props:{component:r[4].target,position:r[4].dropPosition}});let l=r[4].dropPosition!==Or.INSIDE&&py(r);return{c(){k(e.$$.fragment),t=R(),l&&l.c(),n=Oe()},m(s,o){C(e,s,o),b(s,t,o),l&&l.m(s,o),b(s,n,o),i=!0},p(s,o){const a={};o&16&&(a.component=s[4].target),o&16&&(a.position=s[4].dropPosition),e.$set(a),s[4].dropPosition!==Or.INSIDE?l?(l.p(s,o),o&16&&m(l,1)):(l=py(s),l.c(),m(l,1),l.m(n.parentNode,n)):l&&(K(),_(l,1,1,()=>{l=null}),Z())},i(s){i||(m(e.$$.fragment,s),m(l),i=!0)},o(s){_(e.$$.fragment,s),_(l),i=!1},d(s){S(e,s),s&&v(t),l&&l.d(s),s&&v(n)}}}function py(r){let e,t;return e=new fy({props:{component:r[4].targetParent,position:Or.INSIDE}}),{c(){k(e.$$.fragment)},m(n,i){C(e,n,i),t=!0},p(n,i){const l={};i&16&&(l.component=n[4].targetParent),e.$set(l)},i(n){t||(m(e.$$.fragment,n),t=!0)},o(n){_(e.$$.fragment,n),t=!1},d(n){S(e,n)}}}function cre(r){var d,g;let e,t,n,i,l,s,o,a,u,f,c;i=new Fl({props:{text:"Screen",indentLevel:0,selected:r[2].selectedComponentId===((d=r[3])==null?void 0:d.props._id),opened:!0,scrollable:!0,icon:"WebPage",$$slots:{default:[fre]},$$scope:{ctx:r}}}),s=new oy({props:{level:0,components:(g=r[3])==null?void 0:g.props._children}});let p=r[4].dragging&&r[4].valid&&cy(r);return{c(){var h;e=D("div"),t=D("ul"),n=D("li"),k(i.$$.fragment),l=R(),k(s.$$.fragment),o=R(),p&&p.c(),y(n,"id",a=`component-${(h=r[3])==null?void 0:h.props._id}`),y(n,"class","svelte-1mjydjr"),y(t,"class","svelte-1mjydjr"),y(e,"class","nav-items-container svelte-1mjydjr")},m(h,$){b(h,e,$),L(e,t),L(t,n),C(i,n,null),L(n,l),C(s,n,null),L(n,o),p&&p.m(n,null),r[6](e),u=!0,f||(c=Le(n,"click",r[5]),f=!0)},p(h,$){var E,I,T;const w={};$&12&&(w.selected=h[2].selectedComponentId===((E=h[3])==null?void 0:E.props._id)),$&520&&(w.$$scope={dirty:$,ctx:h}),i.$set(w);const A={};$&8&&(A.components=(I=h[3])==null?void 0:I.props._children),s.$set(A),h[4].dragging&&h[4].valid?p?(p.p(h,$),$&16&&m(p,1)):(p=cy(h),p.c(),m(p,1),p.m(n,null)):p&&(K(),_(p,1,1,()=>{p=null}),Z()),(!u||$&8&&a!==(a=`component-${(T=h[3])==null?void 0:T.props._id}`))&&y(n,"id",a)},i(h){u||(m(i.$$.fragment,h),m(s.$$.fragment,h),m(p),u=!0)},o(h){_(i.$$.fragment,h),_(s.$$.fragment,h),_(p),u=!1},d(h){h&&v(e),S(i),S(s),p&&p.d(),r[6](null),f=!1,c()}}}function pre(r){let e,t;return e=new Pi({props:{title:"Components",showAddButton:!0,onClickAddButton:r[7],showExpandIcon:!0,borderRight:!0,$$slots:{default:[cre]},$$scope:{ctx:r}}}),{c(){k(e.$$.fragment)},m(n,i){C(e,n,i),t=!0},p(n,[i]){const l={};i&2&&(l.onClickAddButton=n[7]),i&541&&(l.$$scope={dirty:i,ctx:n}),e.$set(l)},i(n){t||(m(e.$$.fragment,n),t=!0)},o(n){_(e.$$.fragment,n),t=!1},d(n){S(e,n)}}}function dre(r,e,t){let n,i,l,s;ae(r,Qt,p=>t(1,n=p)),ae(r,qe,p=>t(2,i=p)),ae(r,Nn,p=>t(3,l=p)),ae(r,Uo,p=>t(4,s=p));let o;oa("scroll",{scrollTo:p=>{if(!p)return;const d=259,g=32,{scrollLeft:h,scrollTop:$,offsetHeight:w}=o;let A=o.getBoundingClientRect(),E={};const I=p.left+p.width+h-58;I>d?E.left=I-d:E.left=0,E.left===h&&delete E.left;const T=p.top-(A==null?void 0:A.top)+$;T>$+w-2*g?E.top=T-w+2*g:T<$+g?E.top=T-g:delete E.top,!(E.left==null&&E.top==null)&&o.scroll(xe(Ee({},E),{behavior:"smooth"}))}});const u=()=>{gn(qe,i.selectedComponentId=l==null?void 0:l.props._id,i)};function f(p){x[p?"unshift":"push"](()=>{o=p,t(0,o)})}return[o,n,i,l,s,u,f,()=>n("../new")]}class mre extends se{constructor(e){super();oe(this,e,dre,pre,ie,{})}}function dy(r){let e,t,n;return t=new Ge({props:{$$slots:{default:[gre]},$$scope:{ctx:r}}}),{c(){e=D("div"),k(t.$$.fragment),y(e,"class","label svelte-1r4xeml")},m(i,l){b(i,e,l),C(t,e,null),n=!0},p(i,l){const s={};l&2097153&&(s.$$scope={dirty:l,ctx:i}),t.$set(s)},i(i){n||(m(t.$$.fragment,i),n=!0)},o(i){_(t.$$.fragment,i),n=!1},d(i){i&&v(e),S(t)}}}function gre(r){let e;return{c(){e=U(r[0])},m(t,n){b(t,e,n)},p(t,n){n&1&&Se(e,t[0])},d(t){t&&v(e)}}}function _re(r){let e,t,n,i,l,s,o,a=r[4]!=="boolean"&&r[0]&&dy(r);const u=[{componentInstance:r[1]},{value:r[8]},{updateOnChange:!1},{onChange:r[10]},{bindings:r[7]},{name:r[3]},{text:r[0]},{key:r[3]},{type:r[4]},r[5]];var f=r[2];function c(p){let d={};for(let g=0;g<u.length;g+=1)d=Zi(d,u[g]);return{props:d}}return f&&(i=new f(c()),i.$on("change",r[10])),{c(){e=D("div"),a&&a.c(),t=R(),n=D("div"),i&&k(i.$$.fragment),y(n,"data-cy",l=`${r[3]}-prop-control`),y(n,"class","control svelte-1r4xeml"),y(e,"class","property-control svelte-1r4xeml"),y(e,"data-cy",s=`setting-${r[3]}`),te(e,"highlighted",r[6]&&r[9])},m(p,d){b(p,e,d),a&&a.m(e,null),L(e,t),L(e,n),i&&C(i,n,null),o=!0},p(p,[d]){p[4]!=="boolean"&&p[0]?a?(a.p(p,d),d&17&&m(a,1)):(a=dy(p),a.c(),m(a,1),a.m(e,t)):a&&(K(),_(a,1,1,()=>{a=null}),Z());const g=d&1467?rf(u,[d&2&&{componentInstance:p[1]},d&256&&{value:p[8]},u[2],d&1024&&{onChange:p[10]},d&128&&{bindings:p[7]},d&8&&{name:p[3]},d&1&&{text:p[0]},d&8&&{key:p[3]},d&16&&{type:p[4]},d&32&&lf(p[5])]):{};if(f!==(f=p[2])){if(i){K();const h=i;_(h.$$.fragment,1,0,()=>{S(h,1)}),Z()}f?(i=new f(c()),i.$on("change",p[10]),k(i.$$.fragment),m(i.$$.fragment,1),C(i,n,null)):i=null}else f&&i.$set(g);(!o||d&8&&l!==(l=`${p[3]}-prop-control`))&&y(n,"data-cy",l),(!o||d&8&&s!==(s=`setting-${p[3]}`))&&y(e,"data-cy",s),d&576&&te(e,"highlighted",p[6]&&p[9])},i(p){o||(m(a),i&&m(i.$$.fragment,p),o=!0)},o(p){_(a),i&&_(i.$$.fragment,p),o=!1},d(p){p&&v(e),a&&a.d(),i&&S(i)}}}function hre(r,e,t){let n,i,l,s,{label:o=""}=e,{componentInstance:a={}}=e,{control:u=null}=e,{key:f=""}=e,{type:c=""}=e,{value:p=null}=e,{defaultValue:d=null}=e,{props:g={}}=e,{onChange:h=()=>{}}=e,{bindings:$=[]}=e,{componentBindings:w=[]}=e,{nested:A=!1}=e,{highlighted:E=!1}=e;const I=(M,B,j)=>j?[...B||[],...M||[]]:M,T=M=>{let B=M;M&&typeof M=="object"&&("detail"in M?B=M.detail:"target"in M&&(B=M.target.value)),c==="number"&&(B=parseInt(B)),h(typeof B=="string"?s(B):B)},P=(M,B,j)=>{const H=Gi(j,M);return H==null&&B!==void 0?B:H};return Zl(()=>{E&&qe.actions.settings.highlight(null)}),r.$$set=M=>{"label"in M&&t(0,o=M.label),"componentInstance"in M&&t(1,a=M.componentInstance),"control"in M&&t(2,u=M.control),"key"in M&&t(3,f=M.key),"type"in M&&t(4,c=M.type),"value"in M&&t(11,p=M.value),"defaultValue"in M&&t(12,d=M.defaultValue),"props"in M&&t(5,g=M.props),"onChange"in M&&t(13,h=M.onChange),"bindings"in M&&t(14,$=M.bindings),"componentBindings"in M&&t(15,w=M.componentBindings),"nested"in M&&t(16,A=M.nested),"highlighted"in M&&t(6,E=M.highlighted)},r.$$.update=()=>{r.$$.dirty&2048&&t(9,n=p==null||p===""),r.$$.dirty&114688&&t(7,i=I($,w,A)),r.$$.dirty&6272&&t(8,l=P(p,d,i)),r.$$.dirty&256,r.$$.dirty&128&&(s=M=>Wi(i,M))},[o,a,u,f,c,g,E,i,l,n,T,p,d,h,$,w,A]}class iu extends se{constructor(e){super();oe(this,e,hre,_re,ie,{label:0,componentInstance:1,control:2,key:3,type:4,value:11,defaultValue:12,props:5,onChange:13,bindings:14,componentBindings:15,nested:16,highlighted:6})}}class my{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=_n.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 Qn extends my{constructor(e){super(!1);this._children=[],this._json={_id:Al(),_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 Gs(r){return r.split("/").map(e=>(e=decodeURIComponent(e),e=e.replace(/ /g,"-"),e.startsWith(":")||(e=encodeURIComponent(e)),e)).join("/").toLowerCase()}class lu extends my{constructor(){super(!0);this._json={showNavigation:!0,width:"Large",props:{_id:Al(),_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 $re(r){return r.map(e=>({name:`${e.name} - New`,create:()=>wre(e),id:bre,table:e._id}))}const gy=r=>Gs(`/${r.name}/new/row`),bre="NEW_ROW_TEMPLATE";function vre(r,e){return by("New Row").addChild($y(r,e))}const wre=r=>{const e=new lu().instanceName(`${r.name} - New`).customProps({hAlign:"center"}).route(gy(r)),t=_y().instanceName("Form").customProps({actionType:"Create",dataSource:{label:r.name,tableId:r._id,type:"table"},size:"spectrum--medium"}),n=new Qn("@budibase/standard-components/fieldgroup").instanceName("Field Group").customProps({labelPosition:"left"}),i={type:"table",tableId:r._id};Qm(i).forEach(s=>{n.addChild(s)});const l=t._json._id;return t.addChild(hy(r.name,"New")).addChild(vre(r,l)).addChild(n),e.addChild(t).json()};function yre(r){return r.map(e=>({name:`${e.name} - List`,create:()=>Sre(e),id:kre,table:e._id}))}const kre="ROW_LIST_TEMPLATE",Lc=r=>Gs(`/${r.name}`);function Cre(r){const e=new Qn("@budibase/standard-components/button").text("Create New").customProps({size:"M",type:"primary",onClick:[{parameters:{url:gy(r)},"##eventHandlerType":"Navigate To"}]}).instanceName("New Button"),t=new Qn("@budibase/standard-components/heading").instanceName("Title").text(r.name).customProps({size:"M",align:"left"});return new Qn("@budibase/standard-components/container").customProps({direction:"row",hAlign:"stretch",vAlign:"middle",size:"shrink",gap:"M"}).instanceName("Title Container").addChild(t).addChild(e)}const Sre=r=>{const e=new Qn("@budibase/standard-components/dataprovider").instanceName("Data Provider").customProps({dataSource:{label:r.name,name:r._id,tableId:r._id,type:"table"},size:"spectrum--medium",paginate:!0,limit:8}),t=new Qn("@budibase/standard-components/table").customProps({dataProvider:`{{ literal ${fn(e._json._id)} }}`,showAutoColumns:!1,quiet:!1,rowCount:8}).instanceName(`${r.name} Table`),n=fn(t._json._id),i=fn("_id"),l=new Qn("@budibase/standard-components/link").customProps({text:"View",url:`${Lc(r)}/{{ ${n}.${i} }}`,size:"S",color:"var(--spectrum-global-color-gray-600)",align:"left"}).normalStyle({["margin-left"]:"16px",["margin-right"]:"16px"}).instanceName("View Link");return t.addChild(l),e.addChild(t),new lu().route(Lc(r)).instanceName(`${r.name} - List`).addChild(Cre(r)).addChild(e).json()};function Xm(r){return`var(--spectrum-global-color-gray-${r})`}function Are(r){return new Qn("@budibase/standard-components/link").text(r).customProps({url:`/${r.toLowerCase()}`,openInNewTab:!1,color:Xm(700),size:"S",align:"left"})}function _y(){return new Qn("@budibase/standard-components/form").normalStyle({width:"600px"}).instanceName("Form")}function hy(r,e){const t=Are(r).instanceName("Back Link"),n=new Qn("@budibase/standard-components/text").type("none").normalStyle({"margin-right":"4px","margin-left":"4px"}).text(">").instanceName("Arrow").customProps({color:Xm(700),size:"S",align:"left"}),i=new Qn("@budibase/standard-components/text").text(e).instanceName("Identifier").customProps({color:Xm(700),size:"S",align:"left"});return new Qn("@budibase/standard-components/container").customProps({gap:"N",direction:"row",hAlign:"left",vAlign:"middle",size:"shrink"}).instanceName("Breadcrumbs").addChild(t).addChild(n).addChild(i)}function $y(r,e){return new Qn("@budibase/standard-components/button").text("Save").customProps({type:"primary",size:"M",onClick:[{"##eventHandlerType":"Validate Form",parameters:{componentId:e}},{parameters:{providerId:e,tableId:r._id},"##eventHandlerType":"Save Row"},{parameters:{url:Lc(r)},"##eventHandlerType":"Navigate To"}]}).instanceName("Save Button")}function by(r){const e=new Qn("@budibase/standard-components/heading").instanceName("Title").text(r).customProps({size:"M",align:"left"});return new Qn("@budibase/standard-components/container").normalStyle({"margin-top":"32px","margin-bottom":"32px"}).customProps({direction:"row",hAlign:"stretch",vAlign:"middle",size:"shrink",gap:"M"}).instanceName("Title Container").addChild(e)}const Ore={string:"stringfield",number:"numberfield",options:"optionsfield",array:"multifieldselect",boolean:"booleanfield",longform:"longformfield",datetime:"datetimefield",attachment:"attachmentfield",link:"relationshipfield",json:"jsonfield"};function Qm(r){const{schema:e}=Ei(null,r,{formSchema:!0});let t=[];return Object.keys(e||{}).forEach(i=>{const l=e[i];if(l.autocolumn||l.nestedJSON)return;const s=typeof l=="object"?l.type:l,o=Ore[s],a=`@budibase/standard-components/${o}`;if(o){const u=new Qn(a).instanceName(i).customProps({field:i,label:i,placeholder:i});if(s==="options")u.customProps({placeholder:"Choose an option",optionsType:"select",optionsSource:"schema"});else if(s==="longform")u.customProps({format:"auto"});else if(s==="array")u.customProps({placeholder:"Choose an option",optionsSource:"schema"});else if(s==="link"){let f=l.relationshipType==="one-to-many"?"Choose an option":"Choose some options";u.customProps({placeholder:f})}else s==="boolean"?u.customProps({text:i,label:""}):s==="datetime"&&u.customProps({enableTime:!(l==null?void 0:l.dateOnly),timeOnly:l==null?void 0:l.timeOnly,ignoreTimezones:l.ignoreTimezones});t.push(u)}}),t}function Ere(r){let e;return{c(){e=U("Update form fields")},m(t,n){b(t,e,n)},d(t){t&&v(e)}}}function Ire(r){let e,t,n,i,l;t=new Rt({props:{secondary:!0,wide:!0,$$slots:{default:[Ere]},$$scope:{ctx:r}}}),t.$on("click",r[3]);let s={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:r[1],title:"Confirm Form Field Update"};return i=new wr({props:s}),r[4](i),{c(){e=D("div"),k(t.$$.fragment),n=R(),k(i.$$.fragment)},m(o,a){b(o,e,a),C(t,e,null),b(o,n,a),C(i,o,a),l=!0},p(o,[a]){const u={};a&64&&(u.$$scope={dirty:a,ctx:o}),t.$set(u);const f={};i.$set(f)},i(o){l||(m(t.$$.fragment,o),m(i.$$.fragment,o),l=!0)},o(o){_(t.$$.fragment,o),_(i.$$.fragment,o),l=!1},d(o){o&&v(e),S(t),o&&v(n),r[4](null),S(i,o)}}}function Tre(r,e,t){let n;ae(r,Xn,u=>t(5,n=u));let{componentInstance:i}=e,l;const s=async()=>{const u=yc(n==null?void 0:n.props,i._id,p=>p._component.endsWith("/form")),f=u==null?void 0:u.dataSource,c=Qm(f);try{await qe.actions.components.updateSetting("_children",c.map(p=>p.json()))}catch{be.error("Error resetting form fields")}},o=()=>l==null?void 0:l.show();function a(u){x[u?"unshift":"push"](()=>{l=u,t(0,l)})}return r.$$set=u=>{"componentInstance"in u&&t(2,i=u.componentInstance)},[l,s,i,o,a]}class Lre extends se{constructor(e){super();oe(this,e,Tre,Ire,ie,{componentInstance:2})}}function vy(r,e,t){const n=r.slice();return n[44]=e[t],n}function wy(r,e,t){const n=r.slice();return n[47]=e[t],n}function yy(r,e,t){const n=r.slice();return n[50]=e[t],n}function ky(r,e,t){const n=r.slice();return n[50]=e[t],n}function Cy(r,e,t){const n=r.slice();return n[55]=e[t],n}function Sy(r,e,t){const n=r.slice();return n[58]=e[t],n}function Ay(r,e,t){const n=r.slice();return n[61]=e[t],n}function Oy(r,e,t){const n=r.slice();return n[64]=e[t],n}function Ey(r){let e,t,n,i,l,s,o={title:"Query Bindings",$$slots:{body:[Dre],buttons:[Nre]},$$scope:{ctx:r}};return n=new ii({props:o}),r[29](n),{c(){e=D("i"),t=R(),k(n.$$.fragment),y(e,"class","ri-settings-5-line svelte-xmd5g6")},m(a,u){b(a,e,u),b(a,t,u),C(n,a,u),i=!0,l||(s=Le(e,"click",r[20]),l=!0)},p(a,u){const f={};u[0]&131|u[2]&32&&(f.$$scope={dirty:u,ctx:a}),n.$set(f)},i(a){i||(m(n.$$.fragment,a),i=!0)},o(a){_(n.$$.fragment,a),i=!1},d(a){a&&v(e),a&&v(t),r[29](null),S(n,a),l=!1,s()}}}function Pre(r){let e;return{c(){e=U("Save")},m(t,n){b(t,e,n)},d(t){t&&v(e)}}}function Nre(r){let e,t;return e=new nt({props:{slot:"buttons",cta:!0,$$slots:{default:[Pre]},$$scope:{ctx:r}}}),e.$on("click",r[21]),{c(){k(e.$$.fragment)},m(n,i){C(e,n,i),t=!0},p(n,i){const l={};i[2]&32&&(l.$$scope={dirty:i,ctx:n}),e.$set(l)},i(n){t||(m(e.$$.fragment,n),t=!0)},o(n){_(e.$$.fragment,n),t=!1},d(n){S(e,n)}}}function Iy(r){let e,t,n,i;function l(a){r[27](a)}function s(a){r[28](a)}let o={queryBindings:r[18](r[1])};return r[7]!==void 0&&(o.customParams=r[7]),r[0]!==void 0&&(o.bindings=r[0]),e=new Wm({props:o}),x.push(()=>pe(e,"customParams",l)),x.push(()=>pe(e,"bindings",s)),{c(){k(e.$$.fragment)},m(a,u){C(e,a,u),i=!0},p(a,u){const f={};u[0]&2&&(f.queryBindings=a[18](a[1])),!t&&u[0]&128&&(t=!0,f.customParams=a[7],de(()=>t=!1)),!n&&u[0]&1&&(n=!0,f.bindings=a[0],de(()=>n=!1)),e.$set(f)},i(a){i||(m(e.$$.fragment,a),i=!0)},o(a){_(e.$$.fragment,a),i=!1},d(a){S(e,a)}}}function Rre(r){let e=r[18](r[1]).length>0,t,n,i,l=e&&Iy(r);return n=new Um({props:{height:200,query:r[1],schema:r[17](r[1]),datasource:r[19](r[1]),editable:!1}}),{c(){l&&l.c(),t=R(),k(n.$$.fragment)},m(s,o){l&&l.m(s,o),b(s,t,o),C(n,s,o),i=!0},p(s,o){o[0]&2&&(e=s[18](s[1]).length>0),e?l?(l.p(s,o),o[0]&2&&m(l,1)):(l=Iy(s),l.c(),m(l,1),l.m(t.parentNode,t)):l&&(K(),_(l,1,1,()=>{l=null}),Z());const a={};o[0]&2&&(a.query=s[1]),o[0]&2&&(a.schema=s[17](s[1])),o[0]&2&&(a.datasource=s[19](s[1])),n.$set(a)},i(s){i||(m(l),m(n.$$.fragment,s),i=!0)},o(s){_(l),_(n.$$.fragment,s),i=!1},d(s){l&&l.d(s),s&&v(t),S(n,s)}}}function Mre(r){let e,t;return e=new Me({props:{noPadding:!0,gap:"XS",$$slots:{default:[Rre]},$$scope:{ctx:r}}}),{c(){k(e.$$.fragment)},m(n,i){C(e,n,i),t=!0},p(n,i){const l={};i[0]&131|i[2]&32&&(l.$$scope={dirty:i,ctx:n}),e.$set(l)},i(n){t||(m(e.$$.fragment,n),t=!0)},o(n){_(e.$$.fragment,n),t=!1},d(n){S(e,n)}}}function Dre(r){let e,t;return e=new Bi({props:{slot:"body",$$slots:{default:[Mre]},$$scope:{ctx:r}}}),{c(){k(e.$$.fragment)},m(n,i){C(e,n,i),t=!0},p(n,i){const l={};i[0]&131|i[2]&32&&(l.$$scope={dirty:i,ctx:n}),e.$set(l)},i(n){t||(m(e.$$.fragment,n),t=!0)},o(n){_(e.$$.fragment,n),t=!1},d(n){S(e,n)}}}function Bre(r){let e;return{c(){e=U("Tables")},m(t,n){b(t,e,n)},d(t){t&&v(e)}}}function Ty(r){let e,t=r[64].label+"",n,i,l;function s(){return r[31](r[64])}return{c(){e=D("li"),n=U(t),y(e,"class","svelte-xmd5g6")},m(o,a){b(o,e,a),L(e,n),i||(l=Le(e,"click",s),i=!0)},p(o,a){r=o,a[0]&16384&&t!==(t=r[64].label+"")&&Se(n,t)},d(o){o&&v(e),i=!1,l()}}}function Ly(r){let e,t,n,i,l,s,o;e=new Gt({props:{size:"S"}}),i=new ut({props:{size:"XS",$$slots:{default:[jre]},$$scope:{ctx:r}}});let a=r[13],u=[];for(let f=0;f<a.length;f+=1)u[f]=Py(Ay(r,a,f));return{c(){k(e.$$.fragment),t=R(),n=D("div"),k(i.$$.fragment),l=R(),s=D("ul");for(let f=0;f<u.length;f+=1)u[f].c();y(n,"class","title svelte-xmd5g6"),y(s,"class","svelte-xmd5g6")},m(f,c){C(e,f,c),b(f,t,c),b(f,n,c),C(i,n,null),b(f,l,c),b(f,s,c);for(let p=0;p<u.length;p+=1)u[p].m(s,null);o=!0},p(f,c){const p={};if(c[2]&32&&(p.$$scope={dirty:c,ctx:f}),i.$set(p),c[0]&73728){a=f[13];let d;for(d=0;d<a.length;d+=1){const g=Ay(f,a,d);u[d]?u[d].p(g,c):(u[d]=Py(g),u[d].c(),u[d].m(s,null))}for(;d<u.length;d+=1)u[d].d(1);u.length=a.length}},i(f){o||(m(e.$$.fragment,f),m(i.$$.fragment,f),o=!0)},o(f){_(e.$$.fragment,f),_(i.$$.fragment,f),o=!1},d(f){S(e,f),f&&v(t),f&&v(n),S(i),f&&v(l),f&&v(s),dt(u,f)}}}function jre(r){let e;return{c(){e=U("Views")},m(t,n){b(t,e,n)},d(t){t&&v(e)}}}function Py(r){let e,t=r[61].label+"",n,i,l;function s(){return r[32](r[61])}return{c(){e=D("li"),n=U(t),y(e,"class","svelte-xmd5g6")},m(o,a){b(o,e,a),L(e,n),i||(l=Le(e,"click",s),i=!0)},p(o,a){r=o,a[0]&8192&&t!==(t=r[61].label+"")&&Se(n,t)},d(o){o&&v(e),i=!1,l()}}}function Ny(r){let e,t,n,i,l,s,o;e=new Gt({props:{size:"S"}}),i=new ut({props:{size:"XS",$$slots:{default:[zre]},$$scope:{ctx:r}}});let a=r[12],u=[];for(let f=0;f<a.length;f+=1)u[f]=Ry(Sy(r,a,f));return{c(){k(e.$$.fragment),t=R(),n=D("div"),k(i.$$.fragment),l=R(),s=D("ul");for(let f=0;f<u.length;f+=1)u[f].c();y(n,"class","title svelte-xmd5g6"),y(s,"class","svelte-xmd5g6")},m(f,c){C(e,f,c),b(f,t,c),b(f,n,c),C(i,n,null),b(f,l,c),b(f,s,c);for(let p=0;p<u.length;p+=1)u[p].m(s,null);o=!0},p(f,c){const p={};if(c[2]&32&&(p.$$scope={dirty:c,ctx:f}),i.$set(p),c[0]&69634){a=f[12];let d;for(d=0;d<a.length;d+=1){const g=Sy(f,a,d);u[d]?u[d].p(g,c):(u[d]=Ry(g),u[d].c(),u[d].m(s,null))}for(;d<u.length;d+=1)u[d].d(1);u.length=a.length}},i(f){o||(m(e.$$.fragment,f),m(i.$$.fragment,f),o=!0)},o(f){_(e.$$.fragment,f),_(i.$$.fragment,f),o=!1},d(f){S(e,f),f&&v(t),f&&v(n),S(i),f&&v(l),f&&v(s),dt(u,f)}}}function zre(r){let e;return{c(){e=U("Queries")},m(t,n){b(t,e,n)},d(t){t&&v(e)}}}function Ry(r){let e,t=r[58].label+"",n,i,l,s;function o(){return r[33](r[58])}return{c(){e=D("li"),n=U(t),i=R(),y(e,"class","svelte-xmd5g6"),te(e,"selected",r[1]===r[58])},m(a,u){b(a,e,u),L(e,n),L(e,i),l||(s=Le(e,"click",o),l=!0)},p(a,u){r=a,u[0]&4096&&t!==(t=r[58].label+"")&&Se(n,t),u[0]&4098&&te(e,"selected",r[1]===r[58])},d(a){a&&v(e),l=!1,s()}}}function My(r){let e,t,n,i,l,s,o;e=new Gt({props:{size:"S"}}),i=new ut({props:{size:"XS",$$slots:{default:[qre]},$$scope:{ctx:r}}});let a=r[10],u=[];for(let f=0;f<a.length;f+=1)u[f]=Dy(Cy(r,a,f));return{c(){k(e.$$.fragment),t=R(),n=D("div"),k(i.$$.fragment),l=R(),s=D("ul");for(let f=0;f<u.length;f+=1)u[f].c();y(n,"class","title svelte-xmd5g6"),y(s,"class","svelte-xmd5g6")},m(f,c){C(e,f,c),b(f,t,c),b(f,n,c),C(i,n,null),b(f,l,c),b(f,s,c);for(let p=0;p<u.length;p+=1)u[p].m(s,null);o=!0},p(f,c){const p={};if(c[2]&32&&(p.$$scope={dirty:c,ctx:f}),i.$set(p),c[0]&66560){a=f[10];let d;for(d=0;d<a.length;d+=1){const g=Cy(f,a,d);u[d]?u[d].p(g,c):(u[d]=Dy(g),u[d].c(),u[d].m(s,null))}for(;d<u.length;d+=1)u[d].d(1);u.length=a.length}},i(f){o||(m(e.$$.fragment,f),m(i.$$.fragment,f),o=!0)},o(f){_(e.$$.fragment,f),_(i.$$.fragment,f),o=!1},d(f){S(e,f),f&&v(t),f&&v(n),S(i),f&&v(l),f&&v(s),dt(u,f)}}}function qre(r){let e;return{c(){e=U("Relationships")},m(t,n){b(t,e,n)},d(t){t&&v(e)}}}function Dy(r){let e,t=r[55].label+"",n,i,l;function s(){return r[34](r[55])}return{c(){e=D("li"),n=U(t),y(e,"class","svelte-xmd5g6")},m(o,a){b(o,e,a),L(e,n),i||(l=Le(e,"click",s),i=!0)},p(o,a){r=o,a[0]&1024&&t!==(t=r[55].label+"")&&Se(n,t)},d(o){o&&v(e),i=!1,l()}}}function By(r){let e,t,n,i,l,s,o;e=new Gt({props:{size:"S"}}),i=new ut({props:{size:"XS",$$slots:{default:[Ure]},$$scope:{ctx:r}}});let a=r[9],u=[];for(let f=0;f<a.length;f+=1)u[f]=jy(ky(r,a,f));return{c(){k(e.$$.fragment),t=R(),n=D("div"),k(i.$$.fragment),l=R(),s=D("ul");for(let f=0;f<u.length;f+=1)u[f].c();y(n,"class","title svelte-xmd5g6"),y(s,"class","svelte-xmd5g6")},m(f,c){C(e,f,c),b(f,t,c),b(f,n,c),C(i,n,null),b(f,l,c),b(f,s,c);for(let p=0;p<u.length;p+=1)u[p].m(s,null);o=!0},p(f,c){const p={};if(c[2]&32&&(p.$$scope={dirty:c,ctx:f}),i.$set(p),c[0]&66048){a=f[9];let d;for(d=0;d<a.length;d+=1){const g=ky(f,a,d);u[d]?u[d].p(g,c):(u[d]=jy(g),u[d].c(),u[d].m(s,null))}for(;d<u.length;d+=1)u[d].d(1);u.length=a.length}},i(f){o||(m(e.$$.fragment,f),m(i.$$.fragment,f),o=!0)},o(f){_(e.$$.fragment,f),_(i.$$.fragment,f),o=!1},d(f){S(e,f),f&&v(t),f&&v(n),S(i),f&&v(l),f&&v(s),dt(u,f)}}}function Ure(r){let e;return{c(){e=U("Fields")},m(t,n){b(t,e,n)},d(t){t&&v(e)}}}function jy(r){let e,t=r[50].label+"",n,i,l;function s(){return r[35](r[50])}return{c(){e=D("li"),n=U(t),y(e,"class","svelte-xmd5g6")},m(o,a){b(o,e,a),L(e,n),i||(l=Le(e,"click",s),i=!0)},p(o,a){r=o,a[0]&512&&t!==(t=r[50].label+"")&&Se(n,t)},d(o){o&&v(e),i=!1,l()}}}function zy(r){let e,t,n,i,l,s,o;e=new Gt({props:{size:"S"}}),i=new ut({props:{size:"XS",$$slots:{default:[Fre]},$$scope:{ctx:r}}});let a=r[8],u=[];for(let f=0;f<a.length;f+=1)u[f]=qy(yy(r,a,f));return{c(){k(e.$$.fragment),t=R(),n=D("div"),k(i.$$.fragment),l=R(),s=D("ul");for(let f=0;f<u.length;f+=1)u[f].c();y(n,"class","title svelte-xmd5g6"),y(s,"class","svelte-xmd5g6")},m(f,c){C(e,f,c),b(f,t,c),b(f,n,c),C(i,n,null),b(f,l,c),b(f,s,c);for(let p=0;p<u.length;p+=1)u[p].m(s,null);o=!0},p(f,c){const p={};if(c[2]&32&&(p.$$scope={dirty:c,ctx:f}),i.$set(p),c[0]&65792){a=f[8];let d;for(d=0;d<a.length;d+=1){const g=yy(f,a,d);u[d]?u[d].p(g,c):(u[d]=qy(g),u[d].c(),u[d].m(s,null))}for(;d<u.length;d+=1)u[d].d(1);u.length=a.length}},i(f){o||(m(e.$$.fragment,f),m(i.$$.fragment,f),o=!0)},o(f){_(e.$$.fragment,f),_(i.$$.fragment,f),o=!1},d(f){S(e,f),f&&v(t),f&&v(n),S(i),f&&v(l),f&&v(s),dt(u,f)}}}function Fre(r){let e;return{c(){e=U("JSON Arrays")},m(t,n){b(t,e,n)},d(t){t&&v(e)}}}function qy(r){let e,t=r[50].label+"",n,i,l;function s(){return r[36](r[50])}return{c(){e=D("li"),n=U(t),y(e,"class","svelte-xmd5g6")},m(o,a){b(o,e,a),L(e,n),i||(l=Le(e,"click",s),i=!0)},p(o,a){r=o,a[0]&256&&t!==(t=r[50].label+"")&&Se(n,t)},d(o){o&&v(e),i=!1,l()}}}function Uy(r){let e,t,n,i,l,s,o;e=new Gt({props:{size:"S"}}),i=new ut({props:{size:"XS",$$slots:{default:[Vre]},$$scope:{ctx:r}}});let a=r[11],u=[];for(let f=0;f<a.length;f+=1)u[f]=Fy(wy(r,a,f));return{c(){k(e.$$.fragment),t=R(),n=D("div"),k(i.$$.fragment),l=R(),s=D("ul");for(let f=0;f<u.length;f+=1)u[f].c();y(n,"class","title svelte-xmd5g6"),y(s,"class","svelte-xmd5g6")},m(f,c){C(e,f,c),b(f,t,c),b(f,n,c),C(i,n,null),b(f,l,c),b(f,s,c);for(let p=0;p<u.length;p+=1)u[p].m(s,null);o=!0},p(f,c){const p={};if(c[2]&32&&(p.$$scope={dirty:c,ctx:f}),i.$set(p),c[0]&67586){a=f[11];let d;for(d=0;d<a.length;d+=1){const g=wy(f,a,d);u[d]?u[d].p(g,c):(u[d]=Fy(g),u[d].c(),u[d].m(s,null))}for(;d<u.length;d+=1)u[d].d(1);u.length=a.length}},i(f){o||(m(e.$$.fragment,f),m(i.$$.fragment,f),o=!0)},o(f){_(e.$$.fragment,f),_(i.$$.fragment,f),o=!1},d(f){S(e,f),f&&v(t),f&&v(n),S(i),f&&v(l),f&&v(s),dt(u,f)}}}function Vre(r){let e;return{c(){e=U("Data Providers")},m(t,n){b(t,e,n)},d(t){t&&v(e)}}}function Fy(r){let e,t=r[47].label+"",n,i,l,s;function o(){return r[37](r[47])}return{c(){e=D("li"),n=U(t),i=R(),y(e,"class","svelte-xmd5g6"),te(e,"selected",r[1]===r[47])},m(a,u){b(a,e,u),L(e,n),L(e,i),l||(s=Le(e,"click",o),l=!0)},p(a,u){r=a,u[0]&2048&&t!==(t=r[47].label+"")&&Se(n,t),u[0]&2050&&te(e,"selected",r[1]===r[47])},d(a){a&&v(e),l=!1,s()}}}function Vy(r){let e,t,n,i,l,s,o;e=new Gt({props:{size:"S"}}),i=new ut({props:{size:"XS",$$slots:{default:[Hre]},$$scope:{ctx:r}}});let a=r[2],u=[];for(let f=0;f<a.length;f+=1)u[f]=Hy(vy(r,a,f));return{c(){k(e.$$.fragment),t=R(),n=D("div"),k(i.$$.fragment),l=R(),s=D("ul");for(let f=0;f<u.length;f+=1)u[f].c();y(n,"class","title svelte-xmd5g6"),y(s,"class","svelte-xmd5g6")},m(f,c){C(e,f,c),b(f,t,c),b(f,n,c),C(i,n,null),b(f,l,c),b(f,s,c);for(let p=0;p<u.length;p+=1)u[p].m(s,null);o=!0},p(f,c){const p={};if(c[2]&32&&(p.$$scope={dirty:c,ctx:f}),i.$set(p),c[0]&65540){a=f[2];let d;for(d=0;d<a.length;d+=1){const g=vy(f,a,d);u[d]?u[d].p(g,c):(u[d]=Hy(g),u[d].c(),u[d].m(s,null))}for(;d<u.length;d+=1)u[d].d(1);u.length=a.length}},i(f){o||(m(e.$$.fragment,f),m(i.$$.fragment,f),o=!0)},o(f){_(e.$$.fragment,f),_(i.$$.fragment,f),o=!1},d(f){S(e,f),f&&v(t),f&&v(n),S(i),f&&v(l),f&&v(s),dt(u,f)}}}function Hre(r){let e;return{c(){e=U("Other")},m(t,n){b(t,e,n)},d(t){t&&v(e)}}}function Hy(r){let e,t=r[44].label+"",n,i,l;function s(){return r[38](r[44])}return{c(){e=D("li"),n=U(t),y(e,"class","svelte-xmd5g6")},m(o,a){b(o,e,a),L(e,n),i||(l=Le(e,"click",s),i=!0)},p(o,a){r=o,a[0]&4&&t!==(t=r[44].label+"")&&Se(n,t)},d(o){o&&v(e),i=!1,l()}}}function Wre(r){var M,B,j,H,W,Y,G;let e,t,n,i,l,s,o,a,u,f,c,p,d;n=new ut({props:{size:"XS",$$slots:{default:[Bre]},$$scope:{ctx:r}}});let g=r[14],h=[];for(let z=0;z<g.length;z+=1)h[z]=Ty(Oy(r,g,z));let $=((M=r[13])==null?void 0:M.length)&&Ly(r),w=((B=r[12])==null?void 0:B.length)&&Ny(r),A=((j=r[10])==null?void 0:j.length)&&My(r),E=((H=r[9])==null?void 0:H.length)&&By(r),I=((W=r[8])==null?void 0:W.length)&&zy(r),T=((Y=r[11])==null?void 0:Y.length)&&Uy(r),P=((G=r[2])==null?void 0:G.length)&&Vy(r);return{c(){e=D("div"),t=D("div"),k(n.$$.fragment),i=R(),l=D("ul");for(let z=0;z<h.length;z+=1)h[z].c();s=R(),$&&$.c(),o=R(),w&&w.c(),a=R(),A&&A.c(),u=R(),E&&E.c(),f=R(),I&&I.c(),c=R(),T&&T.c(),p=R(),P&&P.c(),y(t,"class","title svelte-xmd5g6"),y(l,"class","svelte-xmd5g6"),y(e,"class","dropdown svelte-xmd5g6")},m(z,F){b(z,e,F),L(e,t),C(n,t,null),L(e,i),L(e,l);for(let V=0;V<h.length;V+=1)h[V].m(l,null);L(e,s),$&&$.m(e,null),L(e,o),w&&w.m(e,null),L(e,a),A&&A.m(e,null),L(e,u),E&&E.m(e,null),L(e,f),I&&I.m(e,null),L(e,c),T&&T.m(e,null),L(e,p),P&&P.m(e,null),d=!0},p(z,F){var X,Q,re,ne,ce,ke,Re;const V={};if(F[2]&32&&(V.$$scope={dirty:F,ctx:z}),n.$set(V),F[0]&81920){g=z[14];let Ce;for(Ce=0;Ce<g.length;Ce+=1){const _e=Oy(z,g,Ce);h[Ce]?h[Ce].p(_e,F):(h[Ce]=Ty(_e),h[Ce].c(),h[Ce].m(l,null))}for(;Ce<h.length;Ce+=1)h[Ce].d(1);h.length=g.length}((X=z[13])==null?void 0:X.length)?$?($.p(z,F),F[0]&8192&&m($,1)):($=Ly(z),$.c(),m($,1),$.m(e,o)):$&&(K(),_($,1,1,()=>{$=null}),Z()),((Q=z[12])==null?void 0:Q.length)?w?(w.p(z,F),F[0]&4096&&m(w,1)):(w=Ny(z),w.c(),m(w,1),w.m(e,a)):w&&(K(),_(w,1,1,()=>{w=null}),Z()),((re=z[10])==null?void 0:re.length)?A?(A.p(z,F),F[0]&1024&&m(A,1)):(A=My(z),A.c(),m(A,1),A.m(e,u)):A&&(K(),_(A,1,1,()=>{A=null}),Z()),((ne=z[9])==null?void 0:ne.length)?E?(E.p(z,F),F[0]&512&&m(E,1)):(E=By(z),E.c(),m(E,1),E.m(e,f)):E&&(K(),_(E,1,1,()=>{E=null}),Z()),((ce=z[8])==null?void 0:ce.length)?I?(I.p(z,F),F[0]&256&&m(I,1)):(I=zy(z),I.c(),m(I,1),I.m(e,c)):I&&(K(),_(I,1,1,()=>{I=null}),Z()),((ke=z[11])==null?void 0:ke.length)?T?(T.p(z,F),F[0]&2048&&m(T,1)):(T=Uy(z),T.c(),m(T,1),T.m(e,p)):T&&(K(),_(T,1,1,()=>{T=null}),Z()),((Re=z[2])==null?void 0:Re.length)?P?(P.p(z,F),F[0]&4&&m(P,1)):(P=Vy(z),P.c(),m(P,1),P.m(e,null)):P&&(K(),_(P,1,1,()=>{P=null}),Z())},i(z){d||(m(n.$$.fragment,z),m($),m(w),m(A),m(E),m(I),m(T),m(P),d=!0)},o(z){_(n.$$.fragment,z),_($),_(w),_(A),_(E),_(I),_(T),_(P),d=!1},d(z){z&&v(e),S(n),dt(h,z),$&&$.d(),w&&w.d(),A&&A.d(),E&&E.d(),I&&I.d(),T&&T.d(),P&&P.d()}}}function Gre(r){var u;let e,t,n,i,l,s;t=new Ye({props:{readonly:!0,value:r[15],options:[r[15]]}}),t.$on("click",function(){pt(r[5].show)&&r[5].show.apply(this,arguments)});let o=((u=r[1])==null?void 0:u.type)==="query"&&Ey(r),a={anchor:r[4],dataCy:`dataSource-popover-${r[3].selectedComponentId}`,$$slots:{default:[Wre]},$$scope:{ctx:r}};return l=new _f({props:a}),r[39](l),{c(){e=D("div"),k(t.$$.fragment),n=R(),o&&o.c(),i=R(),k(l.$$.fragment),y(e,"class","container svelte-xmd5g6")},m(f,c){b(f,e,c),C(t,e,null),L(e,n),o&&o.m(e,null),r[30](e),b(f,i,c),C(l,f,c),s=!0},p(f,c){var g;r=f;const p={};c[0]&32768&&(p.value=r[15]),c[0]&32768&&(p.options=[r[15]]),t.$set(p),((g=r[1])==null?void 0:g.type)==="query"?o?(o.p(r,c),c[0]&2&&m(o,1)):(o=Ey(r),o.c(),m(o,1),o.m(e,null)):o&&(K(),_(o,1,1,()=>{o=null}),Z());const d={};c[0]&16&&(d.anchor=r[4]),c[0]&8&&(d.dataCy=`dataSource-popover-${r[3].selectedComponentId}`),c[0]&32518|c[2]&32&&(d.$$scope={dirty:c,ctx:r}),l.$set(d)},i(f){s||(m(t.$$.fragment,f),m(o),m(l.$$.fragment,f),s=!0)},o(f){_(t.$$.fragment,f),_(o),_(l.$$.fragment,f),s=!1},d(f){f&&v(e),S(t),o&&o.d(),r[30](null),f&&v(i),r[39](null),S(l,f)}}}function Yre(r,e,t){let n,i,l,s,o,a,u,f,c,p,d,g,h,$,w;ae(r,Zt,ue=>t(40,p=ue)),ae(r,Sn,ue=>t(24,d=ue)),ae(r,ms,ue=>t(41,g=ue)),ae(r,qe,ue=>t(3,h=ue)),ae(r,Xn,ue=>t(25,$=ue)),ae(r,Tt,ue=>t(26,w=ue));let{value:A={}}=e,{otherSources:E}=e,{showAllQueries:I}=e,{bindings:T=[]}=e;const P=gt(),M=["attachment","array"];let B,j,H,W;const Y=ue=>{P("change",ue),j.hide()},G=ue=>{const Ae=p.list.find(ye=>ye._id===ue.datasourceId).source;return g[Ae].query[ue.queryVerb]},z=ue=>{var Ae;return((Ae=d.list.find(ye=>ye._id===(ue==null?void 0:ue._id)))==null?void 0:Ae.parameters)||[]},F=ue=>p.list.find(Ae=>Ae._id===(ue==null?void 0:ue.datasourceId)),V=()=>{t(7,W=A.queryParams),H.show()},X=()=>{Y(xe(Ee({},A),{queryParams:W})),H.hide()};function Q(ue){W=ue,t(7,W)}function re(ue){T=ue,t(0,T)}function ne(ue){x[ue?"unshift":"push"](()=>{H=ue,t(6,H)})}function ce(ue){x[ue?"unshift":"push"](()=>{B=ue,t(4,B)})}const ke=ue=>Y(ue),Re=ue=>Y(ue),Ce=ue=>Y(ue),_e=ue=>Y(ue),$e=ue=>Y(ue),Pe=ue=>Y(ue),We=ue=>Y(ue),fe=ue=>Y(ue);function Xe(ue){x[ue?"unshift":"push"](()=>{j=ue,t(5,j)})}return r.$$set=ue=>{"value"in ue&&t(1,A=ue.value),"otherSources"in ue&&t(2,E=ue.otherSources),"showAllQueries"in ue&&t(22,I=ue.showAllQueries),"bindings"in ue&&t(0,T=ue.bindings)},r.$$.update=()=>{var ue;r.$$.dirty[0]&2&&t(15,n=(ue=A==null?void 0:A.label)!=null?ue:"Choose an option"),r.$$.dirty[0]&67108864&&t(14,i=w.list.map(Ae=>({label:Ae.name,tableId:Ae._id,type:"table"}))),r.$$.dirty[0]&67108864&&t(13,l=w.list.reduce((Ae,ye)=>{let he=Object.entries(ye.views||{}).map(([ze,At])=>xe(Ee({label:ze,name:ze},At),{type:"view"}));return[...Ae,...he]},[])),r.$$.dirty[0]&20971520&&t(12,s=d.list.filter(Ae=>I||Ae.queryVerb==="read"||Ae.readable).map(Ae=>xe(Ee({label:Ae.name,name:Ae.name},Ae),{type:"query"}))),r.$$.dirty[0]&33554440&&t(23,o=qo($,h.selectedComponentId)),r.$$.dirty[0]&8388608&&t(11,a=o.filter(Ae=>{var ye;return(ye=Ae._component)==null?void 0:ye.endsWith("/dataprovider")}).map(Ae=>({label:Ae._instanceName,name:Ae._instanceName,providerId:Ae._id,value:`{{ literal ${fn(Ae._id)} }}`,type:"provider"}))),r.$$.dirty[0]&1&&t(10,u=T.filter(Ae=>{var ye;return((ye=Ae.fieldSchema)==null?void 0:ye.type)==="link"}).map(Ae=>{const{providerId:ye,readableBinding:he,fieldSchema:ze}=Ae||{},{name:At,tableId:It}=ze||{},Lt=fn(ye);return{providerId:ye,label:he,fieldName:At,tableId:It,type:"link",rowId:`{{ ${Lt}.${fn("_id")} }}`,rowTableId:`{{ ${Lt}.${fn("tableId")} }}`}})),r.$$.dirty[0]&1&&t(9,f=T.filter(Ae=>{var ye;return M.includes((ye=Ae.fieldSchema)==null?void 0:ye.type)}).map(Ae=>{const{providerId:ye,readableBinding:he,runtimeBinding:ze}=Ae,{name:At,type:It,tableId:Lt}=Ae.fieldSchema;return{providerId:ye,label:he,fieldName:At,fieldType:It,tableId:Lt,type:"field",value:`{{ literal ${ze} }}`}})),r.$$.dirty[0]&1&&t(8,c=T.filter(Ae=>{var ye;return((ye=Ae.fieldSchema)==null?void 0:ye.type)==="jsonarray"}).map(Ae=>{const{providerId:ye,readableBinding:he,runtimeBinding:ze,tableId:At}=Ae,{name:It,type:Lt,prefixKeys:Xt}=Ae.fieldSchema;return{providerId:ye,label:he,fieldName:It,fieldType:Lt,tableId:At,prefixKeys:Xt,type:"jsonarray",value:`{{ literal ${ze} }}`}}))},[T,A,E,h,B,j,H,W,c,f,u,a,s,l,i,n,Y,G,z,F,V,X,I,o,d,$,w,Q,re,ne,ce,ke,Re,Ce,_e,$e,Pe,We,fe,Xe]}class Wy extends se{constructor(e){super();oe(this,e,Yre,Gre,ie,{value:1,otherSources:2,showAllQueries:22,bindings:0},null,[-1,-1,-1])}}function Jre(r){let e,t;return e=new Ye({props:{options:r[1],value:r[0]}}),e.$on("change",r[3]),{c(){k(e.$$.fragment)},m(n,i){C(e,n,i),t=!0},p(n,[i]){const l={};i&2&&(l.options=n[1]),i&1&&(l.value=n[0]),e.$set(l)},i(n){t||(m(e.$$.fragment,n),t=!0)},o(n){_(e.$$.fragment,n),t=!1},d(n){S(e,n)}}}function Xre(r,e,t){let n,i;ae(r,Zt,o=>t(2,i=o));let{value:l=null}=e;function s(o){mt.call(this,r,o)}return r.$$set=o=>{"value"in o&&t(0,l=o.value)},r.$$.update=()=>{r.$$.dirty&4&&t(1,n=i.list.filter(o=>{var a;return o.source==="S3"&&!((a=o.config)==null?void 0:a.endpoint)}).map(o=>({label:o.name,value:o._id})))},[l,n,i,s]}class Qre extends se{constructor(e){super();oe(this,e,Xre,Jre,ie,{value:0})}}function Kre(r){let e,t;return e=new Ye({props:{value:r[0],placeholder:null,options:r[1],getOptionLabel:Zre,getOptionValue:r[2]}}),e.$on("change",r[6]),{c(){k(e.$$.fragment)},m(n,i){C(e,n,i),t=!0},p(n,[i]){const l={};i&1&&(l.value=n[0]),i&2&&(l.options=n[1]),e.$set(l)},i(n){t||(m(e.$$.fragment,n),t=!0)},o(n){_(e.$$.fragment,n),t=!1},d(n){S(e,n)}}}const Zre=r=>r._instanceName;function xre(r,e,t){let n,i,l,s;ae(r,qe,c=>t(4,l=c)),ae(r,Xn,c=>t(5,s=c));let{value:o}=e;const a=gt(),u=c=>`{{ literal ${fn(c._id)} }}`;Et(()=>{!(o&&i.find(p=>u(p)===o)!=null)&&i.length&&a("change",u(i[i.length-1]))});function f(c){mt.call(this,r,c)}return r.$$set=c=>{"value"in c&&t(0,o=c.value)},r.$$.update=()=>{r.$$.dirty&48&&t(3,n=zl(s==null?void 0:s.props,l.selectedComponentId)),r.$$.dirty&8&&t(1,i=n.filter(c=>{var p;return(p=c._component)==null?void 0:p.endsWith("/dataprovider")}))},[o,i,u,n,l,s,f]}class eie extends se{constructor(e){super();oe(this,e,xre,Kre,ie,{value:0})}}function tie(r){let e;return{c(){e=U("Screen")},m(t,n){b(t,e,n)},d(t){t&&v(e)}}}function nie(r){let e,t,n,i,l,s,o,a,u,f;t=new Ge({props:{small:!0,$$slots:{default:[tie]},$$scope:{ctx:r}}}),i=new Rn({props:{title:"Destination URL",placeholder:"/screen",value:r[0].url,bindings:r[1]}}),i.$on("change",r[2]);function c(d){r[3](d)}let p={text:"Open screen in modal"};return r[0].peek!==void 0&&(p.value=r[0].peek),a=new gr({props:p}),x.push(()=>pe(a,"value",c)),{c(){e=D("div"),k(t.$$.fragment),n=R(),k(i.$$.fragment),l=R(),s=D("div"),o=R(),k(a.$$.fragment),y(e,"class","root svelte-15fuuda")},m(d,g){b(d,e,g),C(t,e,null),L(e,n),C(i,e,null),L(e,l),L(e,s),L(e,o),C(a,e,null),f=!0},p(d,[g]){const h={};g&16&&(h.$$scope={dirty:g,ctx:d}),t.$set(h);const $={};g&1&&($.value=d[0].url),g&2&&($.bindings=d[1]),i.$set($);const w={};!u&&g&1&&(u=!0,w.value=d[0].peek,de(()=>u=!1)),a.$set(w)},i(d){f||(m(t.$$.fragment,d),m(i.$$.fragment,d),m(a.$$.fragment,d),f=!0)},o(d){_(t.$$.fragment,d),_(i.$$.fragment,d),_(a.$$.fragment,d),f=!1},d(d){d&&v(e),S(t),S(i),S(a)}}}function rie(r,e,t){let{parameters:n}=e,{bindings:i=[]}=e;const l=o=>t(0,n.url=o.detail,n);function s(o){r.$$.not_equal(n.peek,o)&&(n.peek=o,t(0,n))}return r.$$set=o=>{"parameters"in o&&t(0,n=o.parameters),"bindings"in o&&t(1,i=o.bindings)},[n,i,l,s]}class iie extends se{constructor(e){super();oe(this,e,rie,nie,ie,{parameters:0,bindings:1})}}function Gy(r,e,t){const n=r.slice();return n[16]=e[t],n[18]=t,n}function Yy(r){let e,t,n,i,l=r[4],s=[];for(let a=0;a<l.length;a+=1)s[a]=Jy(Gy(r,l,a));const o=a=>_(s[a],1,1,()=>{s[a]=null});return n=new nt({props:{icon:"AddCircle",secondary:!0,$$slots:{default:[uie]},$$scope:{ctx:r}}}),n.$on("click",r[5]),{c(){for(let a=0;a<s.length;a+=1)s[a].c();e=R(),t=D("div"),k(n.$$.fragment),ft(t,"margin-top","10px")},m(a,u){for(let f=0;f<s.length;f+=1)s[f].m(a,u);b(a,e,u),b(a,t,u),C(n,t,null),i=!0},p(a,u){if(u&479){l=a[4];let c;for(c=0;c<l.length;c+=1){const p=Gy(a,l,c);s[c]?(s[c].p(p,u),m(s[c],1)):(s[c]=Jy(p),s[c].c(),m(s[c],1),s[c].m(e.parentNode,e))}for(K(),c=l.length;c<s.length;c+=1)o(c);Z()}const f={};u&524290&&(f.$$scope={dirty:u,ctx:a}),n.$set(f)},i(a){if(!i){for(let u=0;u<l.length;u+=1)m(s[u]);m(n.$$.fragment,a),i=!0}},o(a){s=s.filter(Boolean);for(let u=0;u<s.length;u+=1)_(s[u]);_(n.$$.fragment,a),i=!1},d(a){dt(s,a),a&&v(e),a&&v(t),S(n)}}}function lie(r){let e;return{c(){e=U(r[1])},m(t,n){b(t,e,n)},p(t,n){n&2&&Se(e,t[1])},d(t){t&&v(e)}}}function sie(r){let e,t;function n(...i){return r[11](r[18],...i)}return e=new et({props:{thin:!0,secondary:!0,value:r[16][0]}}),e.$on("change",n),{c(){k(e.$$.fragment)},m(i,l){C(e,i,l),t=!0},p(i,l){r=i;const s={};l&16&&(s.value=r[16][0]),e.$set(s)},i(i){t||(m(e.$$.fragment,i),t=!0)},o(i){_(e.$$.fragment,i),t=!1},d(i){S(e,i)}}}function oie(r){let e,t;function n(...i){return r[10](r[18],...i)}return e=new Ye({props:{value:r[16][0],options:r[0].map(Xy)}}),e.$on("change",n),{c(){k(e.$$.fragment)},m(i,l){C(e,i,l),t=!0},p(i,l){r=i;const s={};l&16&&(s.value=r[16][0]),l&1&&(s.options=r[0].map(Xy)),e.$set(s)},i(i){t||(m(e.$$.fragment,i),t=!0)},o(i){_(e.$$.fragment,i),t=!1},d(i){S(e,i)}}}function aie(r){let e;return{c(){e=U(r[2])},m(t,n){b(t,e,n)},p(t,n){n&4&&Se(e,t[2])},d(t){t&&v(e)}}}function Jy(r){let e,t,n,i,l,s,o,a,u,f,c;e=new Ge({props:{small:!0,$$slots:{default:[lie]},$$scope:{ctx:r}}});const p=[oie,sie],d=[];function g(w,A){return w[0]?0:1}n=g(r),i=d[n]=p[n](r),s=new Ge({props:{small:!0,$$slots:{default:[aie]},$$scope:{ctx:r}}});function h(...w){return r[12](r[18],...w)}a=new Rn({props:{title:`Value for "${r[16][0]}"`,value:r[16][1],bindings:r[3]}}),a.$on("change",h);function $(){return r[13](r[16])}return f=new Rt({props:{size:"S",quiet:!0,icon:"Delete"}}),f.$on("click",$),{c(){k(e.$$.fragment),t=R(),i.c(),l=R(),k(s.$$.fragment),o=R(),k(a.$$.fragment),u=R(),k(f.$$.fragment)},m(w,A){C(e,w,A),b(w,t,A),d[n].m(w,A),b(w,l,A),C(s,w,A),b(w,o,A),C(a,w,A),b(w,u,A),C(f,w,A),c=!0},p(w,A){r=w;const E={};A&524290&&(E.$$scope={dirty:A,ctx:r}),e.$set(E);let I=n;n=g(r),n===I?d[n].p(r,A):(K(),_(d[I],1,1,()=>{d[I]=null}),Z(),i=d[n],i?i.p(r,A):(i=d[n]=p[n](r),i.c()),m(i,1),i.m(l.parentNode,l));const T={};A&524292&&(T.$$scope={dirty:A,ctx:r}),s.$set(T);const P={};A&16&&(P.title=`Value for "${r[16][0]}"`),A&16&&(P.value=r[16][1]),A&8&&(P.bindings=r[3]),a.$set(P)},i(w){c||(m(e.$$.fragment,w),m(i),m(s.$$.fragment,w),m(a.$$.fragment,w),m(f.$$.fragment,w),c=!0)},o(w){_(e.$$.fragment,w),_(i),_(s.$$.fragment,w),_(a.$$.fragment,w),_(f.$$.fragment,w),c=!1},d(w){S(e,w),w&&v(t),d[n].d(w),w&&v(l),S(s,w),w&&v(o),S(a,w),w&&v(u),S(f,w)}}}function uie(r){let e,t;return{c(){e=U(`Add
|
|
749
|
+
to confirm.`,d=R(),k(g.$$.fragment),y(f,"class","delete-items svelte-1ogygrq")},m(T,P){b(T,e,P),L(e,t),L(e,n),L(n,l),L(n,s),L(e,o),b(T,a,P),b(T,u,P),L(u,f);for(let M=0;M<A.length;M+=1)A[M].m(f,null);b(T,c,P),b(T,p,P),b(T,d,P),C(g,T,P),$=!0},p(T,P){if((!$||P&1)&&i!==(i=T[0].name+"")&&Se(l,i),P&32){w=T[5];let B;for(B=0;B<w.length;B+=1){const j=M5(T,w,B);A[B]?A[B].p(j,P):(A[B]=j5(j),A[B].c(),A[B].m(f,null))}for(;B<A.length;B+=1)A[B].d(1);A.length=w.length}const M={};P&1&&(M.placeholder=T[0].name),!h&&P&64&&(h=!0,M.value=T[6],de(()=>h=!1)),g.$set(M)},i(T){$||(m(g.$$.fragment,T),$=!0)},o(T){_(g.$$.fragment,T),$=!1},d(T){T&&v(e),T&&v(a),T&&v(u),dt(A,T),T&&v(c),T&&v(p),T&&v(d),S(g,T)}}}function rne(r){let e,t,n,i,l,s=r[7]&&D5(r),o={$$slots:{default:[tne]},$$scope:{ctx:r}};t=new Ct({props:o}),r[15](t);let a={okText:"Delete Table",onOk:r[10],onCancel:r[11],title:"Confirm Deletion",disabled:r[6]!==r[0].name,$$slots:{default:[nne]},$$scope:{ctx:r}};return i=new wr({props:a}),r[17](i),{c(){s&&s.c(),e=R(),k(t.$$.fragment),n=R(),k(i.$$.fragment)},m(u,f){s&&s.m(u,f),b(u,e,f),C(t,u,f),b(u,n,f),C(i,u,f),l=!0},p(u,[f]){u[7]?s?(s.p(u,f),f&128&&m(s,1)):(s=D5(u),s.c(),m(s,1),s.m(e.parentNode,e)):s&&(K(),_(s,1,1,()=>{s=null}),Z());const c={};f&33554449&&(c.$$scope={dirty:f,ctx:u}),t.$set(c);const p={};f&65&&(p.disabled=u[6]!==u[0].name),f&33554529&&(p.$$scope={dirty:f,ctx:u}),i.$set(p)},i(u){l||(m(s),m(t.$$.fragment,u),m(i.$$.fragment,u),l=!0)},o(u){_(s),_(t.$$.fragment,u),_(i.$$.fragment,u),l=!1},d(u){s&&s.d(u),u&&v(e),r[15](null),S(t,u),u&&v(n),r[17](null),S(i,u)}}}function ine(r,e,t){let n,i,l,s,o;ae(r,Qt,j=>t(19,l=j)),ae(r,Tt,j=>t(20,s=j)),ae(r,qe,j=>t(21,o=j));let{table:a}=e,u,f,c="",p=a.name,d,g,h;function $(){d=o.screens.filter(j=>j.autoTableId===a._id),t(5,g=["All table data"].concat(d.map(j=>`Screen ${j.props._instanceName}`))),f.show()}async function w(){const j=s.selected;try{await Tt.delete(a),await qe.actions.screens.delete(d),await Tt.fetch(),a.type==="external"&&await Zt.fetch(),be.success("Table deleted"),j&&j._id===a._id&&l("./table")}catch{be.error("Error deleting table")}}function A(){t(6,h="")}async function E(){await Tt.save(a),be.success("Table renamed successfully")}function I(j){const H=j.target.value;t(4,c=p===H?`Table with name ${H} already exists. Please choose another name.`:"")}function T(j){r.$$.not_equal(a.name,j)&&(a.name=j,t(0,a))}function P(j){x[j?"unshift":"push"](()=>{u=j,t(2,u)})}function M(j){h=j,t(6,h)}function B(j){x[j?"unshift":"push"](()=>{f=j,t(3,f)})}return r.$$set=j=>{"table"in j&&t(0,a=j.table)},r.$$.update=()=>{r.$$.dirty&1&&t(1,n=(a==null?void 0:a.type)==="external"),r.$$.dirty&3&&t(7,i=!n||(a==null?void 0:a.created))},[a,n,u,f,c,g,h,i,p,$,w,A,E,I,T,P,M,B]}class lne extends se{constructor(e){super();oe(this,e,ine,rne,ie,{table:0})}}function sne(r){let e;return{c(){e=U("Edit")},m(t,n){b(t,e,n)},d(t){t&&v(e)}}}function one(r){let e;return{c(){e=U("Delete")},m(t,n){b(t,e,n)},d(t){t&&v(e)}}}function ane(r){let e,t,n,i;return e=new rn({props:{icon:"Edit",$$slots:{default:[sne]},$$scope:{ctx:r}}}),e.$on("click",function(){pt(r[1].show)&&r[1].show.apply(this,arguments)}),n=new rn({props:{icon:"Delete",$$slots:{default:[one]},$$scope:{ctx:r}}}),n.$on("click",function(){pt(r[2].show)&&r[2].show.apply(this,arguments)}),{c(){k(e.$$.fragment),t=R(),k(n.$$.fragment)},m(l,s){C(e,l,s),b(l,t,s),C(n,l,s),i=!0},p(l,s){r=l;const o={};s&1024&&(o.$$scope={dirty:s,ctx:r}),e.$set(o);const a={};s&1024&&(a.$$scope={dirty:s,ctx:r}),n.$set(a)},i(l){i||(m(e.$$.fragment,l),m(n.$$.fragment,l),i=!0)},o(l){_(e.$$.fragment,l),_(n.$$.fragment,l),i=!1},d(l){S(e,l),l&&v(t),S(n,l)}}}function une(r){let e,t,n;return t=new tt({props:{s:!0,hoverable:!0,name:"MoreSmallList"}}),{c(){e=D("div"),k(t.$$.fragment),y(e,"slot","control"),y(e,"class","icon open-popover")},m(i,l){b(i,e,l),C(t,e,null),n=!0},p:we,i(i){n||(m(t.$$.fragment,i),n=!0)},o(i){_(t.$$.fragment,i),n=!1},d(i){i&&v(e),S(t)}}}function fne(r){let e,t,n;function i(s){r[5](s)}let l={label:"View Name",thin:!0};return r[0].name!==void 0&&(l.value=r[0].name),e=new et({props:l}),x.push(()=>pe(e,"value",i)),{c(){k(e.$$.fragment)},m(s,o){C(e,s,o),n=!0},p(s,o){const a={};!t&&o&1&&(t=!0,a.value=s[0].name,de(()=>t=!1)),e.$set(a)},i(s){n||(m(e.$$.fragment,s),n=!0)},o(s){_(e.$$.fragment,s),n=!1},d(s){S(e,s)}}}function cne(r){let e,t;return e=new zt({props:{title:"Edit View",onConfirm:r[3],confirmText:"Save",$$slots:{default:[fne]},$$scope:{ctx:r}}}),{c(){k(e.$$.fragment)},m(n,i){C(e,n,i),t=!0},p(n,i){const l={};i&1025&&(l.$$scope={dirty:i,ctx:n}),e.$set(l)},i(n){t||(m(e.$$.fragment,n),t=!0)},o(n){_(e.$$.fragment,n),t=!1},d(n){S(e,n)}}}function pne(r){let e,t,n,i,l,s;e=new Pr({props:{$$slots:{control:[une],default:[ane]},$$scope:{ctx:r}}});let o={$$slots:{default:[cne]},$$scope:{ctx:r}};n=new Ct({props:o}),r[6](n);let a={body:`Are you sure you wish to delete the view '${r[0].name}'? Your data will be deleted and this action cannot be undone.`,okText:"Delete View",onOk:r[4],title:"Confirm Deletion"};return l=new wr({props:a}),r[7](l),{c(){k(e.$$.fragment),t=R(),k(n.$$.fragment),i=R(),k(l.$$.fragment)},m(u,f){C(e,u,f),b(u,t,f),C(n,u,f),b(u,i,f),C(l,u,f),s=!0},p(u,[f]){const c={};f&1030&&(c.$$scope={dirty:f,ctx:u}),e.$set(c);const p={};f&1025&&(p.$$scope={dirty:f,ctx:u}),n.$set(p);const d={};f&1&&(d.body=`Are you sure you wish to delete the view '${u[0].name}'? Your data will be deleted and this action cannot be undone.`),l.$set(d)},i(u){s||(m(e.$$.fragment,u),m(n.$$.fragment,u),m(l.$$.fragment,u),s=!0)},o(u){_(e.$$.fragment,u),_(n.$$.fragment,u),_(l.$$.fragment,u),s=!1},d(u){S(e,u),u&&v(t),r[6](null),S(n,u),u&&v(i),r[7](null),S(l,u)}}}function dne(r,e,t){let n;ae(r,Qt,d=>t(8,n=d));let{view:i}=e,l,s=i.name,o;async function a(){await $r.save(Ee({originalName:s},i)),be.success("View renamed successfully")}async function u(){try{const d=i.name,g=i.tableId;await $r.delete(d),be.success("View deleted"),n(`./table/${g}`)}catch{be.error("Error deleting view")}}function f(d){r.$$.not_equal(i.name,d)&&(i.name=d,t(0,i))}function c(d){x[d?"unshift":"push"](()=>{l=d,t(1,l)})}function p(d){x[d?"unshift":"push"](()=>{o=d,t(2,o)})}return r.$$set=d=>{"view"in d&&t(0,i=d.view)},[i,l,o,a,u,f,c,p]}class mne extends se{constructor(e){super();oe(this,e,dne,pne,ie,{view:0})}}function z5(r,e,t){const n=r.slice();return n[13]=e[t],n[15]=t,n}function q5(r,e,t){const n=r.slice();return n[16]=e[t],n[15]=t,n}function U5(r){let e,t,n=r[2],i=[];for(let s=0;s<n.length;s+=1)i[s]=H5(z5(r,n,s));const l=s=>_(i[s],1,1,()=>{i[s]=null});return{c(){e=D("div");for(let s=0;s<i.length;s+=1)i[s].c();y(e,"class","hierarchy-items-container")},m(s,o){b(s,e,o);for(let a=0;a<i.length;a+=1)i[a].m(e,null);t=!0},p(s,o){if(o&55){n=s[2];let a;for(a=0;a<n.length;a+=1){const u=z5(s,n,a);i[a]?(i[a].p(u,o),m(i[a],1)):(i[a]=H5(u),i[a].c(),m(i[a],1),i[a].m(e,null))}for(K(),a=n.length;a<i.length;a+=1)l(a);Z()}},i(s){if(!t){for(let o=0;o<n.length;o+=1)m(i[o]);t=!0}},o(s){i=i.filter(Boolean);for(let o=0;o<i.length;o+=1)_(i[o]);t=!1},d(s){s&&v(e),dt(i,s)}}}function F5(r){let e,t;return e=new lne({props:{table:r[13]}}),{c(){k(e.$$.fragment)},m(n,i){C(e,n,i),t=!0},p(n,i){const l={};i&4&&(l.table=n[13]),e.$set(l)},i(n){t||(m(e.$$.fragment,n),t=!0)},o(n){_(e.$$.fragment,n),t=!1},d(n){S(e,n)}}}function gne(r){let e,t,n=r[13]._id!==fl.USERS&&F5(r);return{c(){n&&n.c(),e=Oe()},m(i,l){n&&n.m(i,l),b(i,e,l),t=!0},p(i,l){i[13]._id!==fl.USERS?n?(n.p(i,l),l&4&&m(n,1)):(n=F5(i),n.c(),m(n,1),n.m(e.parentNode,e)):n&&(K(),_(n,1,1,()=>{n=null}),Z())},i(i){t||(m(n),t=!0)},o(i){_(n),t=!1},d(i){n&&n.d(i),i&&v(e)}}}function _ne(r){let e,t,n;return e=new mne({props:{view:Ee({name:r[16]},r[13].views[r[16]])}}),{c(){k(e.$$.fragment),t=R()},m(i,l){C(e,i,l),b(i,t,l),n=!0},p(i,l){const s={};l&4&&(s.view=Ee({name:i[16]},i[13].views[i[16]])),e.$set(s)},i(i){n||(m(e.$$.fragment,i),n=!0)},o(i){_(e.$$.fragment,i),n=!1},d(i){S(e,i),i&&v(t)}}}function V5(r,e){let t,n,i;function l(){return e[9](e[13],e[16])}return n=new Fl({props:{indentLevel:2,icon:"Remove",text:e[16],selected:e[1]===e[16],$$slots:{default:[_ne]},$$scope:{ctx:e}}}),n.$on("click",l),{key:r,first:null,c(){t=Oe(),k(n.$$.fragment),this.first=t},m(s,o){b(s,t,o),C(n,s,o),i=!0},p(s,o){e=s;const a={};o&4&&(a.text=e[16]),o&6&&(a.selected=e[1]===e[16]),o&262148&&(a.$$scope={dirty:o,ctx:e}),n.$set(a)},i(s){i||(m(n.$$.fragment,s),i=!0)},o(s){_(n.$$.fragment,s),i=!1},d(s){s&&v(t),S(n,s)}}}function H5(r){var f;let e,t,n=[],i=new Map,l,s;function o(){return r[8](r[13])}e=new Fl({props:{indentLevel:1,border:r[15]>0,icon:r[13]._id===fl.USERS?"UserGroup":"Table",text:r[13].name,selected:((f=r[0].selected)==null?void 0:f._id)===r[13]._id,$$slots:{default:[gne]},$$scope:{ctx:r}}}),e.$on("click",o);let a=[...Object.keys(r[13].views||{})].sort();const u=c=>c[15];for(let c=0;c<a.length;c+=1){let p=q5(r,a,c),d=u(p);i.set(d,n[c]=V5(d,p))}return{c(){k(e.$$.fragment),t=R();for(let c=0;c<n.length;c+=1)n[c].c();l=Oe()},m(c,p){C(e,c,p),b(c,t,p);for(let d=0;d<n.length;d+=1)n[d].m(c,p);b(c,l,p),s=!0},p(c,p){var g;r=c;const d={};p&4&&(d.icon=r[13]._id===fl.USERS?"UserGroup":"Table"),p&4&&(d.text=r[13].name),p&5&&(d.selected=((g=r[0].selected)==null?void 0:g._id)===r[13]._id),p&262148&&(d.$$scope={dirty:p,ctx:r}),e.$set(d),p&38&&(a=[...Object.keys(r[13].views||{})].sort(),K(),n=ur(n,p,u,1,r,a,i,l.parentNode,ni,V5,l,q5),Z())},i(c){if(!s){m(e.$$.fragment,c);for(let p=0;p<a.length;p+=1)m(n[p]);s=!0}},o(c){_(e.$$.fragment,c);for(let p=0;p<n.length;p+=1)_(n[p]);s=!1},d(c){S(e,c),c&&v(t);for(let p=0;p<n.length;p+=1)n[p].d(c);c&&v(l)}}}function hne(r){var i;let e,t,n=((i=r[3])==null?void 0:i._id)&&U5(r);return{c(){n&&n.c(),e=Oe()},m(l,s){n&&n.m(l,s),b(l,e,s),t=!0},p(l,[s]){var o;((o=l[3])==null?void 0:o._id)?n?(n.p(l,s),s&8&&m(n,1)):(n=U5(l),n.c(),m(n,1),n.m(e.parentNode,e)):n&&(K(),_(n,1,1,()=>{n=null}),Z())},i(l){t||(m(n),t=!0)},o(l){_(n),t=!1},d(l){n&&n.d(l),l&&v(e)}}}function $ne(r,e,t){let n,i,l,s,o,a;ae(r,Qt,$=>t(10,l=$)),ae(r,Tt,$=>t(0,s=$)),ae(r,$r,$=>t(7,o=$)),ae(r,Hs,$=>t(3,a=$));const u=($,w)=>{var A,E;return((A=$.name)==null?void 0:A.toLowerCase())>((E=w.name)==null?void 0:E.toLowerCase())};let{sourceId:f}=e;function c($){Tt.select($),l(`./table/${$._id}`)}function p($){$r.select($),l(`./view/${$.name}`)}function d($,w){n!==w&&p(Ee({name:w},$.views[w]))}const g=$=>c($),h=($,w)=>d($,w);return r.$$set=$=>{"sourceId"in $&&t(6,f=$.sourceId)},r.$$.update=()=>{r.$$.dirty&128&&t(1,n=o.selected&&o.selected.name),r.$$.dirty&65&&t(2,i=s.list.filter($=>$.sourceId===f).sort(u))},[s,n,i,a,c,d,f,o,g,h]}class bne extends se{constructor(e){super();oe(this,e,$ne,hne,ie,{sourceId:6})}}function W5(r,e,t){const n=r.slice();return n[18]=e[t],n[20]=t,n}function G5(r,e,t){const n=r.slice();return n[21]=e[t],n}function Y5(r){let e,t,n=r[0],i=[];for(let s=0;s<n.length;s+=1)i[s]=K5(W5(r,n,s));const l=s=>_(i[s],1,1,()=>{i[s]=null});return{c(){e=D("div");for(let s=0;s<i.length;s+=1)i[s].c();y(e,"class","hierarchy-items-container")},m(s,o){b(s,e,o);for(let a=0;a<i.length;a+=1)i[a].m(e,null);t=!0},p(s,o){if(o&61){n=s[0];let a;for(a=0;a<n.length;a+=1){const u=W5(s,n,a);i[a]?(i[a].p(u,o),m(i[a],1)):(i[a]=K5(u),i[a].c(),m(i[a],1),i[a].m(e,null))}for(K(),a=n.length;a<i.length;a+=1)l(a);Z()}},i(s){if(!t){for(let o=0;o<n.length;o+=1)m(i[o]);t=!0}},o(s){i=i.filter(Boolean);for(let o=0;o<i.length;o+=1)_(i[o]);t=!1},d(s){s&&v(e),dt(i,s)}}}function J5(r){let e,t;return e=new Dte({props:{datasource:r[18]}}),{c(){k(e.$$.fragment)},m(n,i){C(e,n,i),t=!0},p(n,i){const l={};i&1&&(l.datasource=n[18]),e.$set(l)},i(n){t||(m(e.$$.fragment,n),t=!0)},o(n){_(e.$$.fragment,n),t=!1},d(n){S(e,n)}}}function vne(r){let e,t,n=r[18]._id!==Rm&&J5(r);return{c(){n&&n.c(),e=Oe()},m(i,l){n&&n.m(i,l),b(i,e,l),t=!0},p(i,l){i[18]._id!==Rm?n?(n.p(i,l),l&1&&m(n,1)):(n=J5(i),n.c(),m(n,1),n.m(e.parentNode,e)):n&&(K(),_(n,1,1,()=>{n=null}),Z())},i(i){t||(m(n),t=!0)},o(i){_(n),t=!1},d(i){n&&n.d(i),i&&v(e)}}}function wne(r){let e,t,n;var i=Li[r[18].source];function l(s){return{props:{height:"18",width:"18"}}}return i&&(t=new i(l())),{c(){e=D("div"),t&&k(t.$$.fragment),y(e,"class","datasource-icon svelte-11am1jd"),y(e,"slot","icon")},m(s,o){b(s,e,o),t&&C(t,e,null),n=!0},p(s,o){if(i!==(i=Li[s[18].source])){if(t){K();const a=t;_(a.$$.fragment,1,0,()=>{S(a,1)}),Z()}i?(t=new i(l()),k(t.$$.fragment),m(t.$$.fragment,1),C(t,e,null)):t=null}},i(s){n||(t&&m(t.$$.fragment,s),n=!0)},o(s){t&&_(t.$$.fragment,s),n=!1},d(s){s&&v(e),t&&S(t)}}}function X5(r){let e,t,n,i;e=new bne({props:{sourceId:r[18]._id}});function l(...u){return r[11](r[18],...u)}let s=r[2].list.filter(l),o=[];for(let u=0;u<s.length;u+=1)o[u]=Q5(G5(r,s,u));const a=u=>_(o[u],1,1,()=>{o[u]=null});return{c(){k(e.$$.fragment),t=R();for(let u=0;u<o.length;u+=1)o[u].c();n=Oe()},m(u,f){C(e,u,f),b(u,t,f);for(let c=0;c<o.length;c+=1)o[c].m(u,f);b(u,n,f),i=!0},p(u,f){r=u;const c={};if(f&1&&(c.sourceId=r[18]._id),e.$set(c),f&21){s=r[2].list.filter(l);let p;for(p=0;p<s.length;p+=1){const d=G5(r,s,p);o[p]?(o[p].p(d,f),m(o[p],1)):(o[p]=Q5(d),o[p].c(),m(o[p],1),o[p].m(n.parentNode,n))}for(K(),p=s.length;p<o.length;p+=1)a(p);Z()}},i(u){if(!i){m(e.$$.fragment,u);for(let f=0;f<s.length;f+=1)m(o[f]);i=!0}},o(u){_(e.$$.fragment,u),o=o.filter(Boolean);for(let f=0;f<o.length;f+=1)_(o[f]);i=!1},d(u){S(e,u),u&&v(t),dt(o,u),u&&v(n)}}}function yne(r){let e,t,n;return e=new Hte({props:{query:r[21],onClickQuery:r[4]}}),{c(){k(e.$$.fragment),t=R()},m(i,l){C(e,i,l),b(i,t,l),n=!0},p(i,l){const s={};l&5&&(s.query=i[21]),e.$set(s)},i(i){n||(m(e.$$.fragment,i),n=!0)},o(i){_(e.$$.fragment,i),n=!1},d(i){S(e,i),i&&v(t)}}}function Q5(r){let e,t;function n(){return r[12](r[21])}return e=new Fl({props:{indentLevel:1,icon:"SQLQuery",iconText:r4(r[18],r[21]),iconColor:i4(r[18],r[21]),text:l4(r[18],r[21]),opened:r[2].selected===r[21]._id,selected:r[2].selected===r[21]._id,$$slots:{default:[yne]},$$scope:{ctx:r}}}),e.$on("click",n),{c(){k(e.$$.fragment)},m(i,l){C(e,i,l),t=!0},p(i,l){r=i;const s={};l&5&&(s.iconText=r4(r[18],r[21])),l&5&&(s.iconColor=i4(r[18],r[21])),l&5&&(s.text=l4(r[18],r[21])),l&5&&(s.opened=r[2].selected===r[21]._id),l&5&&(s.selected=r[2].selected===r[21]._id),l&16777221&&(s.$$scope={dirty:l,ctx:r}),e.$set(s)},i(i){t||(m(e.$$.fragment,i),t=!0)},o(i){_(e.$$.fragment,i),t=!1},d(i){S(e,i)}}}function K5(r){let e,t,n,i;function l(){return r[9](r[18])}function s(){return r[10](r[18])}e=new Fl({props:{border:r[20]>0,text:r[18].name,opened:r[18].open,selected:r[18].selected,withArrow:!0,$$slots:{icon:[wne],default:[vne]},$$scope:{ctx:r}}}),e.$on("click",l),e.$on("iconClick",s);let o=r[18].open&&X5(r);return{c(){k(e.$$.fragment),t=R(),o&&o.c(),n=Oe()},m(a,u){C(e,a,u),b(a,t,u),o&&o.m(a,u),b(a,n,u),i=!0},p(a,u){r=a;const f={};u&1&&(f.text=r[18].name),u&1&&(f.opened=r[18].open),u&1&&(f.selected=r[18].selected),u&16777217&&(f.$$scope={dirty:u,ctx:r}),e.$set(f),r[18].open?o?(o.p(r,u),u&1&&m(o,1)):(o=X5(r),o.c(),m(o,1),o.m(n.parentNode,n)):o&&(K(),_(o,1,1,()=>{o=null}),Z())},i(a){i||(m(e.$$.fragment,a),m(o),i=!0)},o(a){_(e.$$.fragment,a),_(o),i=!1},d(a){S(e,a),a&&v(t),o&&o.d(a),a&&v(n)}}}function kne(r){var i;let e,t,n=((i=r[1])==null?void 0:i._id)&&Y5(r);return{c(){n&&n.c(),e=Oe()},m(l,s){n&&n.m(l,s),b(l,e,s),t=!0},p(l,[s]){var o;((o=l[1])==null?void 0:o._id)?n?(n.p(l,s),s&2&&m(n,1)):(n=Y5(l),n.c(),m(n,1),n.m(e.parentNode,e)):n&&(K(),_(n,1,1,()=>{n=null}),Z())},i(l){t||(m(n),t=!0)},o(l){_(n),t=!1},d(l){n&&n.d(l),l&&v(e)}}}function Cne(r,e,t){let n,i,l,s,o,a,u;ae(r,Lr,T=>t(13,l=T)),ae(r,Qt,T=>t(14,s=T)),ae(r,Zt,T=>t(8,o=T)),ae(r,Hs,T=>t(1,a=T)),ae(r,Sn,T=>t(2,u=T));let f=[];function c(T){g(T),Zt.select(T._id),s(`./datasource/${T._id}`)}function p(T){Sn.select(T),s(`./datasource/${T.datasourceId}/${T._id}`)}function d(T){t(6,f=f.filter(P=>T._id!==P))}function g(T){f.includes(T._id)||t(6,f=[...f,T._id])}function h(T){f.includes(T._id)?d(T):g(T)}Et(async()=>{try{await Zt.fetch(),await Sn.fetch()}catch{be.error("Error fetching datasources and queries")}});const $=T=>{var j,H;if(l.selectedDatasource===T._id)return!0;if(!T.entities)return!1;let P=T.entities;if(Array.isArray(P)||(P=Object.values(P)),l.selectedTable){const W=(j=st(Tt).selected)==null?void 0:j._id;return P.find(Y=>Y._id===W)!=null}const M=(H=st($r).selected)==null?void 0:H.name;return P.find(W=>{var Y;return((Y=W.views)==null?void 0:Y[M])!=null})!=null},w=T=>c(T),A=T=>h(T),E=(T,P)=>P.datasourceId===T._id,I=T=>p(T);return r.$$.update=()=>{r.$$.dirty&320&&t(0,n=Array.isArray(o.list)?o.list.map(T=>{const P=o.selected===T._id,M=f.includes(T._id),B=$(T),j=o.list.length===1;return xe(Ee({},T),{selected:P,open:P||M||B||j})}):[]),r.$$.dirty&1&&t(7,i=n.find(T=>T.open)),r.$$.dirty&128&&i&&g(i)},[n,a,u,c,p,h,f,i,o,w,A,E,I]}class Sne extends se{constructor(e){super();oe(this,e,Cne,kne,ie,{})}}function Ane(r){let e,t,n,i,l;e=new Sne({});function s(a){r[5](a)}let o={};return r[0]!==void 0&&(o.modal=r[0]),n=new o5({props:o}),x.push(()=>pe(n,"modal",s)),{c(){k(e.$$.fragment),t=R(),k(n.$$.fragment)},m(a,u){C(e,a,u),b(a,t,u),C(n,a,u),l=!0},p(a,u){const f={};!i&&u&1&&(i=!0,f.modal=a[0],de(()=>i=!1)),n.$set(f)},i(a){l||(m(e.$$.fragment,a),m(n.$$.fragment,a),l=!0)},o(a){_(e.$$.fragment,a),_(n.$$.fragment,a),l=!1},d(a){S(e,a),a&&v(t),S(n,a)}}}function One(r){let e,t;return e=new hn({props:{title:"Sources",$$slots:{default:[Ane]},$$scope:{ctx:r}}}),{c(){k(e.$$.fragment)},m(n,i){C(e,n,i),t=!0},p(n,i){const l={};i&65&&(l.$$scope={dirty:i,ctx:n}),e.$set(l)},i(n){t||(m(e.$$.fragment,n),t=!0)},o(n){_(e.$$.fragment,n),t=!1},d(n){S(e,n)}}}function Ene(r){let e,t,n,i,l,s,o,a,u,f;n=new Kr({props:{selected:Ine,$$slots:{default:[One]},$$scope:{ctx:r}}}),n.$on("select",r[2]),s=new tt({props:{hoverable:!0,name:"AddCircle"}}),s.$on("click",function(){pt(r[0].show)&&r[0].show.apply(this,arguments)});const c=r[4].default,p=ht(c,r,r[6],null);return{c(){e=D("div"),t=D("div"),k(n.$$.fragment),i=R(),l=D("div"),k(s.$$.fragment),a=R(),u=D("div"),p&&p.c(),y(l,"class","add-button svelte-1oe3r6d"),y(l,"data-cy",o=`new-${r[1]?"datasource":"table"}`),y(t,"class","nav svelte-1oe3r6d"),y(u,"class","content svelte-1oe3r6d"),y(e,"class","root svelte-1oe3r6d")},m(d,g){b(d,e,g),L(e,t),C(n,t,null),L(t,i),L(t,l),C(s,l,null),L(e,a),L(e,u),p&&p.m(u,null),f=!0},p(d,[g]){r=d;const h={};g&65&&(h.$$scope={dirty:g,ctx:r}),n.$set(h),(!f||g&2&&o!==(o=`new-${r[1]?"datasource":"table"}`))&&y(l,"data-cy",o),p&&p.p&&(!f||g&64)&&$t(p,c,r,r[6],f?vt(c,r[6],g,null):bt(r[6]),null)},i(d){f||(m(n.$$.fragment,d),m(s.$$.fragment,d),m(p,d),f=!0)},o(d){_(n.$$.fragment,d),_(s.$$.fragment,d),_(p,d),f=!1},d(d){d&&v(e),S(n),S(s),p&&p.d(d)}}}let Ine="Sources";function Tne(r,e,t){let n,i,l;ae(r,kn,c=>t(7,i=c)),ae(r,Lr,c=>t(3,l=c));let{$$slots:s={},$$scope:o}=e,a;function u(){i("./table")}function f(c){a=c,t(0,a)}return r.$$set=c=>{"$$scope"in c&&t(6,o=c.$$scope)},r.$$.update=()=>{r.$$.dirty&8&&t(1,n=l.selectedDatasource&&l.selectedDatasource!==Rm)},[a,n,u,l,s,f,o]}class Lne extends se{constructor(e){super();oe(this,e,Tne,Ene,ie,{})}}function Pne(r,e,t){let n;return ae(r,kn,i=>t(0,n=i)),n("../screens"),[]}class Nne extends se{constructor(e){super();oe(this,e,Pne,null,ie,{})}}function Z5(r){let e,t;return e=new tt({props:{name:"ArrowLeft",hoverable:!0}}),e.$on("click",function(){pt(r[6])&&r[6].apply(this,arguments)}),{c(){k(e.$$.fragment)},m(n,i){C(e,n,i),t=!0},p(n,i){r=n},i(n){t||(m(e.$$.fragment,n),t=!0)},o(n){_(e.$$.fragment,n),t=!1},d(n){S(e,n)}}}function x5(r){let e,t;return e=new tt({props:{name:r[1]}}),{c(){k(e.$$.fragment)},m(n,i){C(e,n,i),t=!0},p(n,i){const l={};i&2&&(l.name=n[1]),e.$set(l)},i(n){t||(m(e.$$.fragment,n),t=!0)},o(n){_(e.$$.fragment,n),t=!1},d(n){S(e,n)}}}function Rne(r){let e=(r[0]||"")+"",t;return{c(){t=U(e)},m(n,i){b(n,t,i)},p(n,i){i&1&&e!==(e=(n[0]||"")+"")&&Se(t,e)},d(n){n&&v(t)}}}function ey(r){let e,t;return e=new tt({props:{name:r[9]?"Minimize":"Maximize",hoverable:!0}}),e.$on("click",r[11]),{c(){k(e.$$.fragment)},m(n,i){C(e,n,i),t=!0},p(n,i){const l={};i&512&&(l.name=n[9]?"Minimize":"Maximize"),e.$set(l)},i(n){t||(m(e.$$.fragment,n),t=!0)},o(n){_(e.$$.fragment,n),t=!1},d(n){S(e,n)}}}function ty(r){let e,t,n,i,l;return t=new tt({props:{name:"Add"}}),{c(){e=D("div"),k(t.$$.fragment),y(e,"class","add-button svelte-1bxbycf")},m(s,o){b(s,e,o),C(t,e,null),n=!0,i||(l=Le(e,"click",function(){pt(r[5])&&r[5].apply(this,arguments)}),i=!0)},p(s,o){r=s},i(s){n||(m(t.$$.fragment,s),n=!0)},o(s){_(t.$$.fragment,s),n=!1},d(s){s&&v(e),S(t),i=!1,l()}}}function Mne(r){let e,t,n,i,l,s,o,a,u,f,c,p=r[3]&&Z5(r),d=r[1]&&x5(r);s=new ut({props:{size:"XXS",$$slots:{default:[Rne]},$$scope:{ctx:r}}});let g=r[4]&&ey(r),h=r[2]&&ty(r);const $=r[10].default,w=ht($,r,r[12],null);return{c(){e=D("div"),t=D("div"),p&&p.c(),n=R(),d&&d.c(),i=R(),l=D("div"),k(s.$$.fragment),o=R(),g&&g.c(),a=R(),h&&h.c(),u=R(),f=D("div"),w&&w.c(),y(l,"class","title svelte-1bxbycf"),y(t,"class","header svelte-1bxbycf"),y(f,"class","body svelte-1bxbycf"),y(e,"class","panel svelte-1bxbycf"),te(e,"wide",r[9]),te(e,"borderLeft",r[7]),te(e,"borderRight",r[8])},m(A,E){b(A,e,E),L(e,t),p&&p.m(t,null),L(t,n),d&&d.m(t,null),L(t,i),L(t,l),C(s,l,null),L(t,o),g&&g.m(t,null),L(t,a),h&&h.m(t,null),L(e,u),L(e,f),w&&w.m(f,null),c=!0},p(A,[E]){A[3]?p?(p.p(A,E),E&8&&m(p,1)):(p=Z5(A),p.c(),m(p,1),p.m(t,n)):p&&(K(),_(p,1,1,()=>{p=null}),Z()),A[1]?d?(d.p(A,E),E&2&&m(d,1)):(d=x5(A),d.c(),m(d,1),d.m(t,i)):d&&(K(),_(d,1,1,()=>{d=null}),Z());const I={};E&4097&&(I.$$scope={dirty:E,ctx:A}),s.$set(I),A[4]?g?(g.p(A,E),E&16&&m(g,1)):(g=ey(A),g.c(),m(g,1),g.m(t,a)):g&&(K(),_(g,1,1,()=>{g=null}),Z()),A[2]?h?(h.p(A,E),E&4&&m(h,1)):(h=ty(A),h.c(),m(h,1),h.m(t,null)):h&&(K(),_(h,1,1,()=>{h=null}),Z()),w&&w.p&&(!c||E&4096)&&$t(w,$,A,A[12],c?vt($,A[12],E,null):bt(A[12]),null),E&512&&te(e,"wide",A[9]),E&128&&te(e,"borderLeft",A[7]),E&256&&te(e,"borderRight",A[8])},i(A){c||(m(p),m(d),m(s.$$.fragment,A),m(g),m(h),m(w,A),c=!0)},o(A){_(p),_(d),_(s.$$.fragment,A),_(g),_(h),_(w,A),c=!1},d(A){A&&v(e),p&&p.d(),d&&d.d(),S(s),g&&g.d(),h&&h.d(),w&&w.d(A)}}}function Dne(r,e,t){let{$$slots:n={},$$scope:i}=e,{title:l}=e,{icon:s}=e,{showAddButton:o=!1}=e,{showBackButton:a=!1}=e,{showExpandIcon:u=!1}=e,{onClickAddButton:f}=e,{onClickBackButton:c}=e,{borderLeft:p=!1}=e,{borderRight:d=!1}=e,g=!1;const h=()=>t(9,g=!g);return r.$$set=$=>{"title"in $&&t(0,l=$.title),"icon"in $&&t(1,s=$.icon),"showAddButton"in $&&t(2,o=$.showAddButton),"showBackButton"in $&&t(3,a=$.showBackButton),"showExpandIcon"in $&&t(4,u=$.showExpandIcon),"onClickAddButton"in $&&t(5,f=$.onClickAddButton),"onClickBackButton"in $&&t(6,c=$.onClickBackButton),"borderLeft"in $&&t(7,p=$.borderLeft),"borderRight"in $&&t(8,d=$.borderRight),"$$scope"in $&&t(12,i=$.$$scope)},[l,s,o,a,u,f,c,p,d,g,n,h,i]}class Pi extends se{constructor(e){super();oe(this,e,Dne,Mne,ie,{title:0,icon:1,showAddButton:2,showBackButton:3,showExpandIcon:4,onClickAddButton:5,onClickBackButton:6,borderLeft:7,borderRight:8})}}function ny(r){var s;let e,t,n,i;e=new Pr({props:{$$slots:{control:[Yne],default:[Gne]},$$scope:{ctx:r}}});let l={title:"Confirm Deletion",body:`Are you sure you wish to delete this '${(s=r[0])==null?void 0:s.name}' component?`,okText:"Delete Component",onOk:r[8]};return n=new wr({props:l}),r[18](n),{c(){k(e.$$.fragment),t=R(),k(n.$$.fragment)},m(o,a){C(e,o,a),b(o,t,a),C(n,o,a),i=!0},p(o,a){var c;const u={};a&524314&&(u.$$scope={dirty:a,ctx:o}),e.$set(u);const f={};a&1&&(f.body=`Are you sure you wish to delete this '${(c=o[0])==null?void 0:c.name}' component?`),n.$set(f)},i(o){i||(m(e.$$.fragment,o),m(n.$$.fragment,o),i=!0)},o(o){_(e.$$.fragment,o),_(n.$$.fragment,o),i=!1},d(o){S(e,o),o&&v(t),r[18](null),S(n,o)}}}function Bne(r){let e;return{c(){e=U("Delete")},m(t,n){b(t,e,n)},d(t){t&&v(e)}}}function jne(r){let e;return{c(){e=U("Move up")},m(t,n){b(t,e,n)},d(t){t&&v(e)}}}function zne(r){let e;return{c(){e=U("Move down")},m(t,n){b(t,e,n)},d(t){t&&v(e)}}}function qne(r){let e;return{c(){e=U("Duplicate")},m(t,n){b(t,e,n)},d(t){t&&v(e)}}}function Une(r){let e;return{c(){e=U("Cut")},m(t,n){b(t,e,n)},d(t){t&&v(e)}}}function Fne(r){let e;return{c(){e=U("Copy")},m(t,n){b(t,e,n)},d(t){t&&v(e)}}}function Vne(r){let e;return{c(){e=U("Paste above")},m(t,n){b(t,e,n)},d(t){t&&v(e)}}}function Hne(r){let e;return{c(){e=U("Paste below")},m(t,n){b(t,e,n)},d(t){t&&v(e)}}}function Wne(r){let e;return{c(){e=U("Paste inside")},m(t,n){b(t,e,n)},d(t){t&&v(e)}}}function Gne(r){let e,t,n,i,l,s,o,a,u,f,c,p,d,g,h,$,w,A;return e=new rn({props:{icon:"Delete",$$slots:{default:[Bne]},$$scope:{ctx:r}}}),e.$on("click",function(){pt(r[1].show)&&r[1].show.apply(this,arguments)}),n=new rn({props:{noClose:!0,icon:"ChevronUp",$$slots:{default:[jne]},$$scope:{ctx:r}}}),n.$on("click",r[5]),l=new rn({props:{noClose:!0,icon:"ChevronDown",$$slots:{default:[zne]},$$scope:{ctx:r}}}),l.$on("click",r[6]),o=new rn({props:{noClose:!0,icon:"Duplicate",$$slots:{default:[qne]},$$scope:{ctx:r}}}),o.$on("click",r[7]),u=new rn({props:{icon:"Cut",$$slots:{default:[Une]},$$scope:{ctx:r}}}),u.$on("click",r[13]),c=new rn({props:{icon:"Copy",$$slots:{default:[Fne]},$$scope:{ctx:r}}}),c.$on("click",r[14]),d=new rn({props:{icon:"LayersBringToFront",disabled:r[3],$$slots:{default:[Vne]},$$scope:{ctx:r}}}),d.$on("click",r[15]),h=new rn({props:{icon:"LayersSendToBack",disabled:r[3],$$slots:{default:[Hne]},$$scope:{ctx:r}}}),h.$on("click",r[16]),w=new rn({props:{icon:"ShowOneLayer",disabled:r[3]||r[4],$$slots:{default:[Wne]},$$scope:{ctx:r}}}),w.$on("click",r[17]),{c(){k(e.$$.fragment),t=R(),k(n.$$.fragment),i=R(),k(l.$$.fragment),s=R(),k(o.$$.fragment),a=R(),k(u.$$.fragment),f=R(),k(c.$$.fragment),p=R(),k(d.$$.fragment),g=R(),k(h.$$.fragment),$=R(),k(w.$$.fragment)},m(E,I){C(e,E,I),b(E,t,I),C(n,E,I),b(E,i,I),C(l,E,I),b(E,s,I),C(o,E,I),b(E,a,I),C(u,E,I),b(E,f,I),C(c,E,I),b(E,p,I),C(d,E,I),b(E,g,I),C(h,E,I),b(E,$,I),C(w,E,I),A=!0},p(E,I){r=E;const T={};I&524288&&(T.$$scope={dirty:I,ctx:r}),e.$set(T);const P={};I&524288&&(P.$$scope={dirty:I,ctx:r}),n.$set(P);const M={};I&524288&&(M.$$scope={dirty:I,ctx:r}),l.$set(M);const B={};I&524288&&(B.$$scope={dirty:I,ctx:r}),o.$set(B);const j={};I&524288&&(j.$$scope={dirty:I,ctx:r}),u.$set(j);const H={};I&524288&&(H.$$scope={dirty:I,ctx:r}),c.$set(H);const W={};I&8&&(W.disabled=r[3]),I&524288&&(W.$$scope={dirty:I,ctx:r}),d.$set(W);const Y={};I&8&&(Y.disabled=r[3]),I&524288&&(Y.$$scope={dirty:I,ctx:r}),h.$set(Y);const G={};I&24&&(G.disabled=r[3]||r[4]),I&524288&&(G.$$scope={dirty:I,ctx:r}),w.$set(G)},i(E){A||(m(e.$$.fragment,E),m(n.$$.fragment,E),m(l.$$.fragment,E),m(o.$$.fragment,E),m(u.$$.fragment,E),m(c.$$.fragment,E),m(d.$$.fragment,E),m(h.$$.fragment,E),m(w.$$.fragment,E),A=!0)},o(E){_(e.$$.fragment,E),_(n.$$.fragment,E),_(l.$$.fragment,E),_(o.$$.fragment,E),_(u.$$.fragment,E),_(c.$$.fragment,E),_(d.$$.fragment,E),_(h.$$.fragment,E),_(w.$$.fragment,E),A=!1},d(E){S(e,E),E&&v(t),S(n,E),E&&v(i),S(l,E),E&&v(s),S(o,E),E&&v(a),S(u,E),E&&v(f),S(c,E),E&&v(p),S(d,E),E&&v(g),S(h,E),E&&v($),S(w,E)}}}function Yne(r){let e,t,n;return t=new tt({props:{size:"S",hoverable:!0,name:"MoreSmallList"}}),{c(){e=D("div"),k(t.$$.fragment),y(e,"slot","control"),y(e,"class","icon svelte-u6s22l")},m(i,l){b(i,e,l),C(t,e,null),n=!0},p:we,i(i){n||(m(t.$$.fragment,i),n=!0)},o(i){_(t.$$.fragment,i),n=!1},d(i){i&&v(e),S(t)}}}function Jne(r){let e,t,n=r[2]&&ny(r);return{c(){n&&n.c(),e=Oe()},m(i,l){n&&n.m(i,l),b(i,e,l),t=!0},p(i,[l]){i[2]?n?(n.p(i,l),l&4&&m(n,1)):(n=ny(i),n.c(),m(n,1),n.m(e.parentNode,e)):n&&(K(),_(n,1,1,()=>{n=null}),Z())},i(i){t||(m(n),t=!0)},o(i){_(n),t=!1},d(i){n&&n.d(i),i&&v(e)}}}function Xne(r,e,t){let n,i,l,s,o;ae(r,qe,P=>t(12,o=P));let{component:a}=e,u;const f=async()=>{try{await qe.actions.components.moveUp(a)}catch{be.error("Error moving component up")}},c=async()=>{try{await qe.actions.components.moveDown(a)}catch{be.error("Error moving component down")}},p=()=>{g(!1),h("below")},d=async()=>{try{await qe.actions.components.delete(a)}catch{be.error("Error deleting component")}},g=(P=!1)=>{qe.actions.components.copy(a,P)},h=P=>{try{qe.actions.components.paste(a,P)}catch{be.error("Error saving component")}},$=()=>g(!0),w=()=>g(!1),A=()=>h("above"),E=()=>h("below"),I=()=>h("inside");function T(P){x[P?"unshift":"push"](()=>{u=P,t(1,u)})}return r.$$set=P=>{"component"in P&&t(11,a=P.component)},r.$$.update=()=>{r.$$.dirty&2048&&t(0,n=qe.actions.components.getDefinition(a==null?void 0:a._component)),r.$$.dirty&2049&&t(4,i=!a||!(n==null?void 0:n.hasChildren)),r.$$.dirty&4096&&t(3,l=!o.componentToPaste),r.$$.dirty&1&&t(2,s=(n==null?void 0:n.editable)!==!1&&(n==null?void 0:n.static)!==!0)},[n,u,s,l,i,f,c,p,d,g,h,a,o,$,w,A,E,I,T]}class Qne extends se{constructor(e){super();oe(this,e,Xne,Jne,ie,{component:11})}}const Or={ABOVE:"above",BELOW:"below",INSIDE:"inside"},ry={source:null,target:null,targetParent:null,dropPosition:null,dragging:!1,valid:!1},Kne=()=>{const r=cn(ry),e={dragstart:t=>{!t||r.set({source:t,target:null,dropPosition:null,dragging:!0,valid:!1})},dragover:({component:t,mousePosition:n})=>{var c,p;const i=qe.actions.components.getDefinition(t._component),l=i==null?void 0:i.hasChildren,s=((c=t._children)==null?void 0:c.length)>0;let o,a,u;l?n<=.33?o=Or.ABOVE:n>=.66?o=Or.BELOW:o=Or.INSIDE:o=n>.5?Or.BELOW:Or.ABOVE,o===Or.BELOW&&s?(a=t._children[0],o=Or.ABOVE):a=t;const f=st(r);o===f.dropPosition&&(a==null?void 0:a._id)===((p=f.target)==null?void 0:p._id)||(a&&(u=jl(st(Nn).props,a._id)),r.update(d=>{var g;return xe(Ee({},d),{dropPosition:o,target:a,targetParent:u,valid:((g=zl(d.source,a._id))==null?void 0:g.length)===0})}))},reset:()=>{r.set(ry)},drop:async()=>{const t=st(r);!t.valid||!t.source||!t.target||(e.reset(),qe.actions.components.copy(t.source,!0,!1),await qe.actions.components.paste(t.target,t.dropPosition))}};return{subscribe:r.subscribe,actions:e}},Uo=Kne();function iy(r,e,t){const n=r.slice();n[19]=e[t],n[22]=t;const i=n[11](n[19],n[4],n[2]);return n[20]=i,n}function Zne(r){let e,t;return e=new Qne({props:{component:r[19]}}),{c(){k(e.$$.fragment)},m(n,i){C(e,n,i),t=!0},p(n,i){const l={};i&8&&(l.component=n[19]),e.$set(l)},i(n){t||(m(e.$$.fragment,n),t=!0)},o(n){_(e.$$.fragment,n),t=!1},d(n){S(e,n)}}}function ly(r){let e,t;return e=new oy({props:{components:r[19]._children,dndStore:Uo,level:r[0]+1}}),{c(){k(e.$$.fragment)},m(n,i){C(e,n,i),t=!0},p(n,i){const l={};i&8&&(l.components=n[19]._children),i&1&&(l.level=n[0]+1),e.$set(l)},i(n){t||(m(e.$$.fragment,n),t=!0)},o(n){_(e.$$.fragment,n),t=!1},d(n){S(e,n)}}}function sy(r,e){let t,n,i,l,s,o,a,u;function f(){return e[14](e[19])}function c(){return e[15](e[19])}n=new Fl({props:{scrollable:!0,draggable:!0,text:e[6](e[19]),icon:e[7](e[19]),withArrow:e[8](e[19]),indentLevel:e[0]+1,selected:e[1].selectedComponentId===e[19]._id,opened:e[20],highlighted:e[12](e[19]),$$slots:{default:[Zne]},$$scope:{ctx:e}}}),n.$on("dragend",Uo.actions.reset),n.$on("dragstart",f),n.$on("dragover",function(){pt(e[5](e[19],e[22]))&&e[5](e[19],e[22]).apply(this,arguments)}),n.$on("iconClick",c),n.$on("drop",e[10]);let p=e[20]&&ly(e);function d(){return e[16](e[19])}return{key:r,first:null,c(){t=D("li"),k(n.$$.fragment),i=R(),p&&p.c(),l=R(),y(t,"id",s=`component-${e[19]._id}`),y(t,"class","svelte-kv7hxn"),this.first=t},m(g,h){b(g,t,h),C(n,t,null),L(t,i),p&&p.m(t,null),L(t,l),o=!0,a||(u=Le(t,"click",qp(d)),a=!0)},p(g,h){e=g;const $={};h&8&&($.text=e[6](e[19])),h&8&&($.icon=e[7](e[19])),h&8&&($.withArrow=e[8](e[19])),h&1&&($.indentLevel=e[0]+1),h&10&&($.selected=e[1].selectedComponentId===e[19]._id),h&28&&($.opened=e[20]),h&8&&($.highlighted=e[12](e[19])),h&8388616&&($.$$scope={dirty:h,ctx:e}),n.$set($),e[20]?p?(p.p(e,h),h&28&&m(p,1)):(p=ly(e),p.c(),m(p,1),p.m(t,l)):p&&(K(),_(p,1,1,()=>{p=null}),Z()),(!o||h&8&&s!==(s=`component-${e[19]._id}`))&&y(t,"id",s)},i(g){o||(m(n.$$.fragment,g),m(p),o=!0)},o(g){_(n.$$.fragment,g),_(p),o=!1},d(g){g&&v(t),S(n),p&&p.d(),a=!1,u()}}}function xne(r){let e,t=[],n=new Map,i,l=r[3]||[];const s=o=>o[19]._id;for(let o=0;o<l.length;o+=1){let a=iy(r,l,o),u=s(a);n.set(u,t[o]=sy(u,a))}return{c(){e=D("ul");for(let o=0;o<t.length;o+=1)t[o].c();y(e,"class","svelte-kv7hxn")},m(o,a){b(o,e,a);for(let u=0;u<t.length;u+=1)t[u].m(e,null);i=!0},p(o,[a]){a&8191&&(l=o[3]||[],K(),t=ur(t,a,s,1,o,l,n,e,ni,sy,null,iy),Z())},i(o){if(!i){for(let a=0;a<l.length;a+=1)m(t[a]);i=!0}},o(o){for(let a=0;a<t.length;a+=1)_(t[a]);i=!1},d(o){o&&v(e);for(let a=0;a<t.length;a+=1)t[a].d()}}}function ere(r,e,t){let n,i,l,s;ae(r,pl,P=>t(17,i=P)),ae(r,qe,P=>t(1,l=P)),ae(r,Mq,P=>t(4,s=P));let{components:o=[]}=e,{level:a=0}=e,u={};const f=(P,M)=>B=>{const j=B.offsetY/B.currentTarget.offsetHeight;return Uo.actions.dragover({component:P,index:M,mousePosition:j}),!1},c=P=>{if(P._instanceName)return P._instanceName;const M=P._component.replace("@budibase/standard-components/","")||"component";return vr(M)},p=P=>{const M=qe.actions.components.getDefinition(P==null?void 0:P._component);return M==null?void 0:M.icon},d=P=>{const M=qe.actions.components.getDefinition(P==null?void 0:P._component);return M==null?void 0:M.hasChildren},g=P=>{var M;return d(P)&&((M=P._children)==null?void 0:M.length)};function h(P){u[P]?delete u[P]:t(2,u[P]=!0,u),t(2,u)}const $=async()=>{try{await Uo.actions.drop()}catch(P){console.error(P),be.error("Error saving component")}},w=(P,M,B)=>{var j;return((j=P==null?void 0:P._children)==null?void 0:j.length)?M.includes(P._id)?!0:!B[P._id]:!1},A=P=>{var j,H,W;const M=(j=st(pl))==null?void 0:j._id,B=(H=st(Nn))==null?void 0:H.props._id;return!M||M===B?!1:((W=zl(i,P._id))==null?void 0:W.length)>0},E=P=>Uo.actions.dragstart(P),I=P=>h(P._id),T=P=>{gn(qe,l.selectedComponentId=P._id,l)};return r.$$set=P=>{"components"in P&&t(13,o=P.components),"level"in P&&t(0,a=P.level)},r.$$.update=()=>{r.$$.dirty&8194&&t(3,n=o==null?void 0:o.filter(P=>{var M,B;return!((M=l.componentToPaste)==null?void 0:M.isCut)||P._id!==((B=l.componentToPaste)==null?void 0:B._id)}))},[a,l,u,n,s,f,c,p,g,h,$,w,A,o,E,I,T]}class oy extends se{constructor(e){super();oe(this,e,ere,xne,ie,{components:13,level:0})}}function ay(r){let e,t;return e=new Pr({props:{$$slots:{control:[ire],default:[rre]},$$scope:{ctx:r}}}),{c(){k(e.$$.fragment)},m(n,i){C(e,n,i),t=!0},p(n,i){const l={};i&514&&(l.$$scope={dirty:i,ctx:n}),e.$set(l)},i(n){t||(m(e.$$.fragment,n),t=!0)},o(n){_(e.$$.fragment,n),t=!1},d(n){S(e,n)}}}function tre(r){let e;return{c(){e=U("Copy")},m(t,n){b(t,e,n)},d(t){t&&v(e)}}}function nre(r){let e;return{c(){e=U("Paste inside")},m(t,n){b(t,e,n)},d(t){t&&v(e)}}}function rre(r){let e,t,n,i;return e=new rn({props:{icon:"Copy",$$slots:{default:[tre]},$$scope:{ctx:r}}}),e.$on("click",r[7]),n=new rn({props:{icon:"ShowOneLayer",disabled:r[1],$$slots:{default:[nre]},$$scope:{ctx:r}}}),n.$on("click",r[8]),{c(){k(e.$$.fragment),t=R(),k(n.$$.fragment)},m(l,s){C(e,l,s),b(l,t,s),C(n,l,s),i=!0},p(l,s){const o={};s&512&&(o.$$scope={dirty:s,ctx:l}),e.$set(o);const a={};s&2&&(a.disabled=l[1]),s&512&&(a.$$scope={dirty:s,ctx:l}),n.$set(a)},i(l){i||(m(e.$$.fragment,l),m(n.$$.fragment,l),i=!0)},o(l){_(e.$$.fragment,l),_(n.$$.fragment,l),i=!1},d(l){S(e,l),l&&v(t),S(n,l)}}}function ire(r){let e,t,n;return t=new tt({props:{size:"S",hoverable:!0,name:"MoreSmallList"}}),{c(){e=D("div"),k(t.$$.fragment),y(e,"slot","control"),y(e,"class","icon svelte-u6s22l")},m(i,l){b(i,e,l),C(t,e,null),n=!0},p:we,i(i){n||(m(t.$$.fragment,i),n=!0)},o(i){_(t.$$.fragment,i),n=!1},d(i){i&&v(e),S(t)}}}function lre(r){let e,t,n=r[0]&&ay(r);return{c(){n&&n.c(),e=Oe()},m(i,l){n&&n.m(i,l),b(i,e,l),t=!0},p(i,[l]){i[0]?n?(n.p(i,l),l&1&&m(n,1)):(n=ay(i),n.c(),m(n,1),n.m(e.parentNode,e)):n&&(K(),_(n,1,1,()=>{n=null}),Z())},i(i){t||(m(n),t=!0)},o(i){_(n),t=!1},d(i){n&&n.d(i),i&&v(e)}}}function sre(r,e,t){let n,i,l,s;ae(r,qe,p=>t(6,s=p));let{component:o}=e;const a=(p=!1)=>{qe.actions.components.copy(o,p)},u=p=>{try{qe.actions.components.paste(o,p)}catch{be.error("Error saving component")}},f=()=>a(!1),c=()=>u("inside");return r.$$set=p=>{"component"in p&&t(4,o=p.component)},r.$$.update=()=>{r.$$.dirty&16&&t(5,n=qe.actions.components.getDefinition(o==null?void 0:o._component)),r.$$.dirty&64&&t(1,i=!s.componentToPaste),r.$$.dirty&32&&t(0,l=(n==null?void 0:n.editable)!==!1&&(n==null?void 0:n.static)!==!0)},[l,i,a,u,o,n,s,f,c]}class ore extends se{constructor(e){super();oe(this,e,sre,lre,ie,{component:4})}}function uy(r){let e,t;return{c(){e=D("div"),y(e,"class","indicator svelte-9uy3y5"),ft(e,"--x",r[2]+"px"),ft(e,"--y",r[3]+"px"),ft(e,"--width",r[4]+"px"),ft(e,"--height",r[5]+"px"),te(e,"above",r[1]===Or.ABOVE),te(e,"below",r[1]===Or.BELOW),te(e,"inside",r[1]===Or.INSIDE)},m(n,i){b(n,e,i)},p(n,i){i&4&&ft(e,"--x",n[2]+"px"),i&8&&ft(e,"--y",n[3]+"px"),i&16&&ft(e,"--width",n[4]+"px"),i&32&&ft(e,"--height",n[5]+"px"),i&2&&te(e,"above",n[1]===Or.ABOVE),i&2&&te(e,"below",n[1]===Or.BELOW),i&2&&te(e,"inside",n[1]===Or.INSIDE)},i(n){t||Tr(()=>{t=Is(e,Kl,{duration:130}),t.start()})},o:we,d(n){n&&v(e)}}}function are(r){let e,t=r[0]&&r[1]&&uy(r);return{c(){t&&t.c(),e=Oe()},m(n,i){t&&t.m(n,i),b(n,e,i)},p(n,[i]){n[0]&&n[1]?t?(t.p(n,i),i&3&&m(t,1)):(t=uy(n),t.c(),m(t,1),t.m(e.parentNode,e)):t&&(t.d(1),t=null)},i(n){m(t)},o:we,d(n){t&&t.d(n),n&&v(e)}}}function ure(r,e,t){let{component:n}=e,{position:i}=e,l,s,o,a;const u=f=>{var d;const c=document.getElementById(`component-${f==null?void 0:f._id}`),p=(d=c==null?void 0:c.children[0])==null?void 0:d.children[0];!c||(t(2,l=p.offsetLeft),t(3,s=p.offsetTop),t(4,o=p.clientWidth),t(5,a=p.clientHeight))};return r.$$set=f=>{"component"in f&&t(0,n=f.component),"position"in f&&t(1,i=f.position)},r.$$.update=()=>{r.$$.dirty&1&&u(n)},[n,i,l,s,o,a]}class fy extends se{constructor(e){super();oe(this,e,ure,are,ie,{component:0,position:1})}}function fre(r){var n;let e,t;return e=new ore({props:{component:(n=r[3])==null?void 0:n.props}}),{c(){k(e.$$.fragment)},m(i,l){C(e,i,l),t=!0},p(i,l){var o;const s={};l&8&&(s.component=(o=i[3])==null?void 0:o.props),e.$set(s)},i(i){t||(m(e.$$.fragment,i),t=!0)},o(i){_(e.$$.fragment,i),t=!1},d(i){S(e,i)}}}function cy(r){let e,t,n,i;e=new fy({props:{component:r[4].target,position:r[4].dropPosition}});let l=r[4].dropPosition!==Or.INSIDE&&py(r);return{c(){k(e.$$.fragment),t=R(),l&&l.c(),n=Oe()},m(s,o){C(e,s,o),b(s,t,o),l&&l.m(s,o),b(s,n,o),i=!0},p(s,o){const a={};o&16&&(a.component=s[4].target),o&16&&(a.position=s[4].dropPosition),e.$set(a),s[4].dropPosition!==Or.INSIDE?l?(l.p(s,o),o&16&&m(l,1)):(l=py(s),l.c(),m(l,1),l.m(n.parentNode,n)):l&&(K(),_(l,1,1,()=>{l=null}),Z())},i(s){i||(m(e.$$.fragment,s),m(l),i=!0)},o(s){_(e.$$.fragment,s),_(l),i=!1},d(s){S(e,s),s&&v(t),l&&l.d(s),s&&v(n)}}}function py(r){let e,t;return e=new fy({props:{component:r[4].targetParent,position:Or.INSIDE}}),{c(){k(e.$$.fragment)},m(n,i){C(e,n,i),t=!0},p(n,i){const l={};i&16&&(l.component=n[4].targetParent),e.$set(l)},i(n){t||(m(e.$$.fragment,n),t=!0)},o(n){_(e.$$.fragment,n),t=!1},d(n){S(e,n)}}}function cre(r){var d,g;let e,t,n,i,l,s,o,a,u,f,c;i=new Fl({props:{text:"Screen",indentLevel:0,selected:r[2].selectedComponentId===((d=r[3])==null?void 0:d.props._id),opened:!0,scrollable:!0,icon:"WebPage",$$slots:{default:[fre]},$$scope:{ctx:r}}}),s=new oy({props:{level:0,components:(g=r[3])==null?void 0:g.props._children}});let p=r[4].dragging&&r[4].valid&&cy(r);return{c(){var h;e=D("div"),t=D("ul"),n=D("li"),k(i.$$.fragment),l=R(),k(s.$$.fragment),o=R(),p&&p.c(),y(n,"id",a=`component-${(h=r[3])==null?void 0:h.props._id}`),y(n,"class","svelte-1mjydjr"),y(t,"class","svelte-1mjydjr"),y(e,"class","nav-items-container svelte-1mjydjr")},m(h,$){b(h,e,$),L(e,t),L(t,n),C(i,n,null),L(n,l),C(s,n,null),L(n,o),p&&p.m(n,null),r[6](e),u=!0,f||(c=Le(n,"click",r[5]),f=!0)},p(h,$){var E,I,T;const w={};$&12&&(w.selected=h[2].selectedComponentId===((E=h[3])==null?void 0:E.props._id)),$&520&&(w.$$scope={dirty:$,ctx:h}),i.$set(w);const A={};$&8&&(A.components=(I=h[3])==null?void 0:I.props._children),s.$set(A),h[4].dragging&&h[4].valid?p?(p.p(h,$),$&16&&m(p,1)):(p=cy(h),p.c(),m(p,1),p.m(n,null)):p&&(K(),_(p,1,1,()=>{p=null}),Z()),(!u||$&8&&a!==(a=`component-${(T=h[3])==null?void 0:T.props._id}`))&&y(n,"id",a)},i(h){u||(m(i.$$.fragment,h),m(s.$$.fragment,h),m(p),u=!0)},o(h){_(i.$$.fragment,h),_(s.$$.fragment,h),_(p),u=!1},d(h){h&&v(e),S(i),S(s),p&&p.d(),r[6](null),f=!1,c()}}}function pre(r){let e,t;return e=new Pi({props:{title:"Components",showAddButton:!0,onClickAddButton:r[7],showExpandIcon:!0,borderRight:!0,$$slots:{default:[cre]},$$scope:{ctx:r}}}),{c(){k(e.$$.fragment)},m(n,i){C(e,n,i),t=!0},p(n,[i]){const l={};i&2&&(l.onClickAddButton=n[7]),i&541&&(l.$$scope={dirty:i,ctx:n}),e.$set(l)},i(n){t||(m(e.$$.fragment,n),t=!0)},o(n){_(e.$$.fragment,n),t=!1},d(n){S(e,n)}}}function dre(r,e,t){let n,i,l,s;ae(r,Qt,p=>t(1,n=p)),ae(r,qe,p=>t(2,i=p)),ae(r,Nn,p=>t(3,l=p)),ae(r,Uo,p=>t(4,s=p));let o;oa("scroll",{scrollTo:p=>{if(!p)return;const d=259,g=32,{scrollLeft:h,scrollTop:$,offsetHeight:w}=o;let A=o.getBoundingClientRect(),E={};const I=p.left+p.width+h-58;I>d?E.left=I-d:E.left=0,E.left===h&&delete E.left;const T=p.top-(A==null?void 0:A.top)+$;T>$+w-2*g?E.top=T-w+2*g:T<$+g?E.top=T-g:delete E.top,!(E.left==null&&E.top==null)&&o.scroll(xe(Ee({},E),{behavior:"smooth"}))}});const u=()=>{gn(qe,i.selectedComponentId=l==null?void 0:l.props._id,i)};function f(p){x[p?"unshift":"push"](()=>{o=p,t(0,o)})}return[o,n,i,l,s,u,f,()=>n("../new")]}class mre extends se{constructor(e){super();oe(this,e,dre,pre,ie,{})}}function dy(r){let e,t,n;return t=new Ge({props:{$$slots:{default:[gre]},$$scope:{ctx:r}}}),{c(){e=D("div"),k(t.$$.fragment),y(e,"class","label svelte-1r4xeml")},m(i,l){b(i,e,l),C(t,e,null),n=!0},p(i,l){const s={};l&2097153&&(s.$$scope={dirty:l,ctx:i}),t.$set(s)},i(i){n||(m(t.$$.fragment,i),n=!0)},o(i){_(t.$$.fragment,i),n=!1},d(i){i&&v(e),S(t)}}}function gre(r){let e;return{c(){e=U(r[0])},m(t,n){b(t,e,n)},p(t,n){n&1&&Se(e,t[0])},d(t){t&&v(e)}}}function _re(r){let e,t,n,i,l,s,o,a=r[4]!=="boolean"&&r[0]&&dy(r);const u=[{componentInstance:r[1]},{value:r[8]},{updateOnChange:!1},{onChange:r[10]},{bindings:r[7]},{name:r[3]},{text:r[0]},{key:r[3]},{type:r[4]},r[5]];var f=r[2];function c(p){let d={};for(let g=0;g<u.length;g+=1)d=Zi(d,u[g]);return{props:d}}return f&&(i=new f(c()),i.$on("change",r[10])),{c(){e=D("div"),a&&a.c(),t=R(),n=D("div"),i&&k(i.$$.fragment),y(n,"data-cy",l=`${r[3]}-prop-control`),y(n,"class","control svelte-1r4xeml"),y(e,"class","property-control svelte-1r4xeml"),y(e,"data-cy",s=`setting-${r[3]}`),te(e,"highlighted",r[6]&&r[9])},m(p,d){b(p,e,d),a&&a.m(e,null),L(e,t),L(e,n),i&&C(i,n,null),o=!0},p(p,[d]){p[4]!=="boolean"&&p[0]?a?(a.p(p,d),d&17&&m(a,1)):(a=dy(p),a.c(),m(a,1),a.m(e,t)):a&&(K(),_(a,1,1,()=>{a=null}),Z());const g=d&1467?rf(u,[d&2&&{componentInstance:p[1]},d&256&&{value:p[8]},u[2],d&1024&&{onChange:p[10]},d&128&&{bindings:p[7]},d&8&&{name:p[3]},d&1&&{text:p[0]},d&8&&{key:p[3]},d&16&&{type:p[4]},d&32&&lf(p[5])]):{};if(f!==(f=p[2])){if(i){K();const h=i;_(h.$$.fragment,1,0,()=>{S(h,1)}),Z()}f?(i=new f(c()),i.$on("change",p[10]),k(i.$$.fragment),m(i.$$.fragment,1),C(i,n,null)):i=null}else f&&i.$set(g);(!o||d&8&&l!==(l=`${p[3]}-prop-control`))&&y(n,"data-cy",l),(!o||d&8&&s!==(s=`setting-${p[3]}`))&&y(e,"data-cy",s),d&576&&te(e,"highlighted",p[6]&&p[9])},i(p){o||(m(a),i&&m(i.$$.fragment,p),o=!0)},o(p){_(a),i&&_(i.$$.fragment,p),o=!1},d(p){p&&v(e),a&&a.d(),i&&S(i)}}}function hre(r,e,t){let n,i,l,s,{label:o=""}=e,{componentInstance:a={}}=e,{control:u=null}=e,{key:f=""}=e,{type:c=""}=e,{value:p=null}=e,{defaultValue:d=null}=e,{props:g={}}=e,{onChange:h=()=>{}}=e,{bindings:$=[]}=e,{componentBindings:w=[]}=e,{nested:A=!1}=e,{highlighted:E=!1}=e;const I=(M,B,j)=>j?[...B||[],...M||[]]:M,T=M=>{let B=M;M&&typeof M=="object"&&("detail"in M?B=M.detail:"target"in M&&(B=M.target.value)),c==="number"&&(B=parseInt(B)),h(typeof B=="string"?s(B):B)},P=(M,B,j)=>{const H=Gi(j,M);return H==null&&B!==void 0?B:H};return Zl(()=>{E&&qe.actions.settings.highlight(null)}),r.$$set=M=>{"label"in M&&t(0,o=M.label),"componentInstance"in M&&t(1,a=M.componentInstance),"control"in M&&t(2,u=M.control),"key"in M&&t(3,f=M.key),"type"in M&&t(4,c=M.type),"value"in M&&t(11,p=M.value),"defaultValue"in M&&t(12,d=M.defaultValue),"props"in M&&t(5,g=M.props),"onChange"in M&&t(13,h=M.onChange),"bindings"in M&&t(14,$=M.bindings),"componentBindings"in M&&t(15,w=M.componentBindings),"nested"in M&&t(16,A=M.nested),"highlighted"in M&&t(6,E=M.highlighted)},r.$$.update=()=>{r.$$.dirty&2048&&t(9,n=p==null||p===""),r.$$.dirty&114688&&t(7,i=I($,w,A)),r.$$.dirty&6272&&t(8,l=P(p,d,i)),r.$$.dirty&256,r.$$.dirty&128&&(s=M=>Wi(i,M))},[o,a,u,f,c,g,E,i,l,n,T,p,d,h,$,w,A]}class iu extends se{constructor(e){super();oe(this,e,hre,_re,ie,{label:0,componentInstance:1,control:2,key:3,type:4,value:11,defaultValue:12,props:5,onChange:13,bindings:14,componentBindings:15,nested:16,highlighted:6})}}class my{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=_n.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 Qn extends my{constructor(e){super(!1);this._children=[],this._json={_id:Al(),_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 Gs(r){return r.split("/").map(e=>(e=decodeURIComponent(e),e=e.replace(/ /g,"-"),e.startsWith(":")||(e=encodeURIComponent(e)),e)).join("/").toLowerCase()}class lu extends my{constructor(){super(!0);this._json={showNavigation:!0,width:"Large",props:{_id:Al(),_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 $re(r){return r.map(e=>({name:`${e.name} - New`,create:()=>wre(e),id:bre,table:e._id}))}const gy=r=>Gs(`/${r.name}/new/row`),bre="NEW_ROW_TEMPLATE";function vre(r,e){return by("New Row").addChild($y(r,e))}const wre=r=>{const e=new lu().instanceName(`${r.name} - New`).customProps({hAlign:"center"}).route(gy(r)),t=_y().instanceName("Form").customProps({actionType:"Create",dataSource:{label:r.name,tableId:r._id,type:"table"},size:"spectrum--medium"}),n=new Qn("@budibase/standard-components/fieldgroup").instanceName("Field Group").customProps({labelPosition:"left"}),i={type:"table",tableId:r._id};Qm(i).forEach(s=>{n.addChild(s)});const l=t._json._id;return t.addChild(hy(r.name,"New")).addChild(vre(r,l)).addChild(n),e.addChild(t).json()};function yre(r){return r.map(e=>({name:`${e.name} - List`,create:()=>Sre(e),id:kre,table:e._id}))}const kre="ROW_LIST_TEMPLATE",Lc=r=>Gs(`/${r.name}`);function Cre(r){const e=new Qn("@budibase/standard-components/button").text("Create New").customProps({size:"M",type:"primary",onClick:[{parameters:{url:gy(r)},"##eventHandlerType":"Navigate To"}]}).instanceName("New Button"),t=new Qn("@budibase/standard-components/heading").instanceName("Title").text(r.name).customProps({size:"M",align:"left"});return new Qn("@budibase/standard-components/container").customProps({direction:"row",hAlign:"stretch",vAlign:"middle",size:"shrink",gap:"M"}).instanceName("Title Container").addChild(t).addChild(e)}const Sre=r=>{const e=new Qn("@budibase/standard-components/dataprovider").instanceName("Data Provider").customProps({dataSource:{label:r.name,name:r._id,tableId:r._id,type:"table"},size:"spectrum--medium",paginate:!0,limit:8}),t=new Qn("@budibase/standard-components/table").customProps({dataProvider:`{{ literal ${fn(e._json._id)} }}`,showAutoColumns:!1,quiet:!1,rowCount:8}).instanceName(`${r.name} Table`),n=fn(t._json._id),i=fn("_id"),l=new Qn("@budibase/standard-components/link").customProps({text:"View",url:`${Lc(r)}/{{ ${n}.${i} }}`,size:"S",color:"var(--spectrum-global-color-gray-600)",align:"left"}).normalStyle({["margin-left"]:"16px",["margin-right"]:"16px"}).instanceName("View Link");return t.addChild(l),e.addChild(t),new lu().route(Lc(r)).instanceName(`${r.name} - List`).addChild(Cre(r)).addChild(e).json()};function Xm(r){return`var(--spectrum-global-color-gray-${r})`}function Are(r){return new Qn("@budibase/standard-components/link").text(r).customProps({url:`/${r.toLowerCase()}`,openInNewTab:!1,color:Xm(700),size:"S",align:"left"})}function _y(){return new Qn("@budibase/standard-components/form").normalStyle({width:"600px"}).instanceName("Form")}function hy(r,e){const t=Are(r).instanceName("Back Link"),n=new Qn("@budibase/standard-components/text").type("none").normalStyle({"margin-right":"4px","margin-left":"4px"}).text(">").instanceName("Arrow").customProps({color:Xm(700),size:"S",align:"left"}),i=new Qn("@budibase/standard-components/text").text(e).instanceName("Identifier").customProps({color:Xm(700),size:"S",align:"left"});return new Qn("@budibase/standard-components/container").customProps({gap:"N",direction:"row",hAlign:"left",vAlign:"middle",size:"shrink"}).instanceName("Breadcrumbs").addChild(t).addChild(n).addChild(i)}function $y(r,e){return new Qn("@budibase/standard-components/button").text("Save").customProps({type:"primary",size:"M",onClick:[{"##eventHandlerType":"Validate Form",parameters:{componentId:e}},{parameters:{providerId:e,tableId:r._id},"##eventHandlerType":"Save Row"},{parameters:{url:Lc(r)},"##eventHandlerType":"Navigate To"}]}).instanceName("Save Button")}function by(r){const e=new Qn("@budibase/standard-components/heading").instanceName("Title").text(r).customProps({size:"M",align:"left"});return new Qn("@budibase/standard-components/container").normalStyle({"margin-top":"32px","margin-bottom":"32px"}).customProps({direction:"row",hAlign:"stretch",vAlign:"middle",size:"shrink",gap:"M"}).instanceName("Title Container").addChild(e)}const Ore={string:"stringfield",number:"numberfield",options:"optionsfield",array:"multifieldselect",boolean:"booleanfield",longform:"longformfield",datetime:"datetimefield",attachment:"attachmentfield",link:"relationshipfield",json:"jsonfield"};function Qm(r){const{schema:e}=Ei(null,r,{formSchema:!0});let t=[];return Object.keys(e||{}).forEach(i=>{const l=e[i];if(l.autocolumn||l.nestedJSON)return;const s=typeof l=="object"?l.type:l,o=Ore[s],a=`@budibase/standard-components/${o}`;if(o){const u=new Qn(a).instanceName(i).customProps({field:i,label:i,placeholder:i});if(s==="options")u.customProps({placeholder:"Choose an option",optionsType:"select",optionsSource:"schema"});else if(s==="longform")u.customProps({format:"auto"});else if(s==="array")u.customProps({placeholder:"Choose an option",optionsSource:"schema"});else if(s==="link"){let f=l.relationshipType==="one-to-many"?"Choose an option":"Choose some options";u.customProps({placeholder:f})}else s==="boolean"?u.customProps({text:i,label:""}):s==="datetime"&&u.customProps({enableTime:!(l==null?void 0:l.dateOnly),timeOnly:l==null?void 0:l.timeOnly,ignoreTimezones:l.ignoreTimezones});t.push(u)}}),t}function Ere(r){let e;return{c(){e=U("Update form fields")},m(t,n){b(t,e,n)},d(t){t&&v(e)}}}function Ire(r){let e,t,n,i,l;t=new Rt({props:{secondary:!0,wide:!0,$$slots:{default:[Ere]},$$scope:{ctx:r}}}),t.$on("click",r[3]);let s={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:r[1],title:"Confirm Form Field Update"};return i=new wr({props:s}),r[4](i),{c(){e=D("div"),k(t.$$.fragment),n=R(),k(i.$$.fragment)},m(o,a){b(o,e,a),C(t,e,null),b(o,n,a),C(i,o,a),l=!0},p(o,[a]){const u={};a&64&&(u.$$scope={dirty:a,ctx:o}),t.$set(u);const f={};i.$set(f)},i(o){l||(m(t.$$.fragment,o),m(i.$$.fragment,o),l=!0)},o(o){_(t.$$.fragment,o),_(i.$$.fragment,o),l=!1},d(o){o&&v(e),S(t),o&&v(n),r[4](null),S(i,o)}}}function Tre(r,e,t){let n;ae(r,Xn,u=>t(5,n=u));let{componentInstance:i}=e,l;const s=async()=>{const u=yc(n==null?void 0:n.props,i._id,p=>p._component.endsWith("/form")),f=u==null?void 0:u.dataSource,c=Qm(f);try{await qe.actions.components.updateSetting("_children",c.map(p=>p.json()))}catch{be.error("Error resetting form fields")}},o=()=>l==null?void 0:l.show();function a(u){x[u?"unshift":"push"](()=>{l=u,t(0,l)})}return r.$$set=u=>{"componentInstance"in u&&t(2,i=u.componentInstance)},[l,s,i,o,a]}class Lre extends se{constructor(e){super();oe(this,e,Tre,Ire,ie,{componentInstance:2})}}function vy(r,e,t){const n=r.slice();return n[44]=e[t],n}function wy(r,e,t){const n=r.slice();return n[47]=e[t],n}function yy(r,e,t){const n=r.slice();return n[50]=e[t],n}function ky(r,e,t){const n=r.slice();return n[50]=e[t],n}function Cy(r,e,t){const n=r.slice();return n[55]=e[t],n}function Sy(r,e,t){const n=r.slice();return n[58]=e[t],n}function Ay(r,e,t){const n=r.slice();return n[61]=e[t],n}function Oy(r,e,t){const n=r.slice();return n[64]=e[t],n}function Ey(r){let e,t,n,i,l,s,o={title:"Query Bindings",$$slots:{body:[Dre],buttons:[Nre]},$$scope:{ctx:r}};return n=new ii({props:o}),r[29](n),{c(){e=D("i"),t=R(),k(n.$$.fragment),y(e,"class","ri-settings-5-line svelte-xmd5g6")},m(a,u){b(a,e,u),b(a,t,u),C(n,a,u),i=!0,l||(s=Le(e,"click",r[20]),l=!0)},p(a,u){const f={};u[0]&131|u[2]&32&&(f.$$scope={dirty:u,ctx:a}),n.$set(f)},i(a){i||(m(n.$$.fragment,a),i=!0)},o(a){_(n.$$.fragment,a),i=!1},d(a){a&&v(e),a&&v(t),r[29](null),S(n,a),l=!1,s()}}}function Pre(r){let e;return{c(){e=U("Save")},m(t,n){b(t,e,n)},d(t){t&&v(e)}}}function Nre(r){let e,t;return e=new nt({props:{slot:"buttons",cta:!0,$$slots:{default:[Pre]},$$scope:{ctx:r}}}),e.$on("click",r[21]),{c(){k(e.$$.fragment)},m(n,i){C(e,n,i),t=!0},p(n,i){const l={};i[2]&32&&(l.$$scope={dirty:i,ctx:n}),e.$set(l)},i(n){t||(m(e.$$.fragment,n),t=!0)},o(n){_(e.$$.fragment,n),t=!1},d(n){S(e,n)}}}function Iy(r){let e,t,n,i;function l(a){r[27](a)}function s(a){r[28](a)}let o={queryBindings:r[18](r[1])};return r[7]!==void 0&&(o.customParams=r[7]),r[0]!==void 0&&(o.bindings=r[0]),e=new Wm({props:o}),x.push(()=>pe(e,"customParams",l)),x.push(()=>pe(e,"bindings",s)),{c(){k(e.$$.fragment)},m(a,u){C(e,a,u),i=!0},p(a,u){const f={};u[0]&2&&(f.queryBindings=a[18](a[1])),!t&&u[0]&128&&(t=!0,f.customParams=a[7],de(()=>t=!1)),!n&&u[0]&1&&(n=!0,f.bindings=a[0],de(()=>n=!1)),e.$set(f)},i(a){i||(m(e.$$.fragment,a),i=!0)},o(a){_(e.$$.fragment,a),i=!1},d(a){S(e,a)}}}function Rre(r){let e=r[18](r[1]).length>0,t,n,i,l=e&&Iy(r);return n=new Um({props:{height:200,query:r[1],schema:r[17](r[1]),datasource:r[19](r[1]),editable:!1}}),{c(){l&&l.c(),t=R(),k(n.$$.fragment)},m(s,o){l&&l.m(s,o),b(s,t,o),C(n,s,o),i=!0},p(s,o){o[0]&2&&(e=s[18](s[1]).length>0),e?l?(l.p(s,o),o[0]&2&&m(l,1)):(l=Iy(s),l.c(),m(l,1),l.m(t.parentNode,t)):l&&(K(),_(l,1,1,()=>{l=null}),Z());const a={};o[0]&2&&(a.query=s[1]),o[0]&2&&(a.schema=s[17](s[1])),o[0]&2&&(a.datasource=s[19](s[1])),n.$set(a)},i(s){i||(m(l),m(n.$$.fragment,s),i=!0)},o(s){_(l),_(n.$$.fragment,s),i=!1},d(s){l&&l.d(s),s&&v(t),S(n,s)}}}function Mre(r){let e,t;return e=new Me({props:{noPadding:!0,gap:"XS",$$slots:{default:[Rre]},$$scope:{ctx:r}}}),{c(){k(e.$$.fragment)},m(n,i){C(e,n,i),t=!0},p(n,i){const l={};i[0]&131|i[2]&32&&(l.$$scope={dirty:i,ctx:n}),e.$set(l)},i(n){t||(m(e.$$.fragment,n),t=!0)},o(n){_(e.$$.fragment,n),t=!1},d(n){S(e,n)}}}function Dre(r){let e,t;return e=new Bi({props:{slot:"body",$$slots:{default:[Mre]},$$scope:{ctx:r}}}),{c(){k(e.$$.fragment)},m(n,i){C(e,n,i),t=!0},p(n,i){const l={};i[0]&131|i[2]&32&&(l.$$scope={dirty:i,ctx:n}),e.$set(l)},i(n){t||(m(e.$$.fragment,n),t=!0)},o(n){_(e.$$.fragment,n),t=!1},d(n){S(e,n)}}}function Bre(r){let e;return{c(){e=U("Tables")},m(t,n){b(t,e,n)},d(t){t&&v(e)}}}function Ty(r){let e,t=r[64].label+"",n,i,l;function s(){return r[31](r[64])}return{c(){e=D("li"),n=U(t),y(e,"class","svelte-xmd5g6")},m(o,a){b(o,e,a),L(e,n),i||(l=Le(e,"click",s),i=!0)},p(o,a){r=o,a[0]&16384&&t!==(t=r[64].label+"")&&Se(n,t)},d(o){o&&v(e),i=!1,l()}}}function Ly(r){let e,t,n,i,l,s,o;e=new Gt({props:{size:"S"}}),i=new ut({props:{size:"XS",$$slots:{default:[jre]},$$scope:{ctx:r}}});let a=r[13],u=[];for(let f=0;f<a.length;f+=1)u[f]=Py(Ay(r,a,f));return{c(){k(e.$$.fragment),t=R(),n=D("div"),k(i.$$.fragment),l=R(),s=D("ul");for(let f=0;f<u.length;f+=1)u[f].c();y(n,"class","title svelte-xmd5g6"),y(s,"class","svelte-xmd5g6")},m(f,c){C(e,f,c),b(f,t,c),b(f,n,c),C(i,n,null),b(f,l,c),b(f,s,c);for(let p=0;p<u.length;p+=1)u[p].m(s,null);o=!0},p(f,c){const p={};if(c[2]&32&&(p.$$scope={dirty:c,ctx:f}),i.$set(p),c[0]&73728){a=f[13];let d;for(d=0;d<a.length;d+=1){const g=Ay(f,a,d);u[d]?u[d].p(g,c):(u[d]=Py(g),u[d].c(),u[d].m(s,null))}for(;d<u.length;d+=1)u[d].d(1);u.length=a.length}},i(f){o||(m(e.$$.fragment,f),m(i.$$.fragment,f),o=!0)},o(f){_(e.$$.fragment,f),_(i.$$.fragment,f),o=!1},d(f){S(e,f),f&&v(t),f&&v(n),S(i),f&&v(l),f&&v(s),dt(u,f)}}}function jre(r){let e;return{c(){e=U("Views")},m(t,n){b(t,e,n)},d(t){t&&v(e)}}}function Py(r){let e,t=r[61].label+"",n,i,l;function s(){return r[32](r[61])}return{c(){e=D("li"),n=U(t),y(e,"class","svelte-xmd5g6")},m(o,a){b(o,e,a),L(e,n),i||(l=Le(e,"click",s),i=!0)},p(o,a){r=o,a[0]&8192&&t!==(t=r[61].label+"")&&Se(n,t)},d(o){o&&v(e),i=!1,l()}}}function Ny(r){let e,t,n,i,l,s,o;e=new Gt({props:{size:"S"}}),i=new ut({props:{size:"XS",$$slots:{default:[zre]},$$scope:{ctx:r}}});let a=r[12],u=[];for(let f=0;f<a.length;f+=1)u[f]=Ry(Sy(r,a,f));return{c(){k(e.$$.fragment),t=R(),n=D("div"),k(i.$$.fragment),l=R(),s=D("ul");for(let f=0;f<u.length;f+=1)u[f].c();y(n,"class","title svelte-xmd5g6"),y(s,"class","svelte-xmd5g6")},m(f,c){C(e,f,c),b(f,t,c),b(f,n,c),C(i,n,null),b(f,l,c),b(f,s,c);for(let p=0;p<u.length;p+=1)u[p].m(s,null);o=!0},p(f,c){const p={};if(c[2]&32&&(p.$$scope={dirty:c,ctx:f}),i.$set(p),c[0]&69634){a=f[12];let d;for(d=0;d<a.length;d+=1){const g=Sy(f,a,d);u[d]?u[d].p(g,c):(u[d]=Ry(g),u[d].c(),u[d].m(s,null))}for(;d<u.length;d+=1)u[d].d(1);u.length=a.length}},i(f){o||(m(e.$$.fragment,f),m(i.$$.fragment,f),o=!0)},o(f){_(e.$$.fragment,f),_(i.$$.fragment,f),o=!1},d(f){S(e,f),f&&v(t),f&&v(n),S(i),f&&v(l),f&&v(s),dt(u,f)}}}function zre(r){let e;return{c(){e=U("Queries")},m(t,n){b(t,e,n)},d(t){t&&v(e)}}}function Ry(r){let e,t=r[58].label+"",n,i,l,s;function o(){return r[33](r[58])}return{c(){e=D("li"),n=U(t),i=R(),y(e,"class","svelte-xmd5g6"),te(e,"selected",r[1]===r[58])},m(a,u){b(a,e,u),L(e,n),L(e,i),l||(s=Le(e,"click",o),l=!0)},p(a,u){r=a,u[0]&4096&&t!==(t=r[58].label+"")&&Se(n,t),u[0]&4098&&te(e,"selected",r[1]===r[58])},d(a){a&&v(e),l=!1,s()}}}function My(r){let e,t,n,i,l,s,o;e=new Gt({props:{size:"S"}}),i=new ut({props:{size:"XS",$$slots:{default:[qre]},$$scope:{ctx:r}}});let a=r[10],u=[];for(let f=0;f<a.length;f+=1)u[f]=Dy(Cy(r,a,f));return{c(){k(e.$$.fragment),t=R(),n=D("div"),k(i.$$.fragment),l=R(),s=D("ul");for(let f=0;f<u.length;f+=1)u[f].c();y(n,"class","title svelte-xmd5g6"),y(s,"class","svelte-xmd5g6")},m(f,c){C(e,f,c),b(f,t,c),b(f,n,c),C(i,n,null),b(f,l,c),b(f,s,c);for(let p=0;p<u.length;p+=1)u[p].m(s,null);o=!0},p(f,c){const p={};if(c[2]&32&&(p.$$scope={dirty:c,ctx:f}),i.$set(p),c[0]&66560){a=f[10];let d;for(d=0;d<a.length;d+=1){const g=Cy(f,a,d);u[d]?u[d].p(g,c):(u[d]=Dy(g),u[d].c(),u[d].m(s,null))}for(;d<u.length;d+=1)u[d].d(1);u.length=a.length}},i(f){o||(m(e.$$.fragment,f),m(i.$$.fragment,f),o=!0)},o(f){_(e.$$.fragment,f),_(i.$$.fragment,f),o=!1},d(f){S(e,f),f&&v(t),f&&v(n),S(i),f&&v(l),f&&v(s),dt(u,f)}}}function qre(r){let e;return{c(){e=U("Relationships")},m(t,n){b(t,e,n)},d(t){t&&v(e)}}}function Dy(r){let e,t=r[55].label+"",n,i,l;function s(){return r[34](r[55])}return{c(){e=D("li"),n=U(t),y(e,"class","svelte-xmd5g6")},m(o,a){b(o,e,a),L(e,n),i||(l=Le(e,"click",s),i=!0)},p(o,a){r=o,a[0]&1024&&t!==(t=r[55].label+"")&&Se(n,t)},d(o){o&&v(e),i=!1,l()}}}function By(r){let e,t,n,i,l,s,o;e=new Gt({props:{size:"S"}}),i=new ut({props:{size:"XS",$$slots:{default:[Ure]},$$scope:{ctx:r}}});let a=r[9],u=[];for(let f=0;f<a.length;f+=1)u[f]=jy(ky(r,a,f));return{c(){k(e.$$.fragment),t=R(),n=D("div"),k(i.$$.fragment),l=R(),s=D("ul");for(let f=0;f<u.length;f+=1)u[f].c();y(n,"class","title svelte-xmd5g6"),y(s,"class","svelte-xmd5g6")},m(f,c){C(e,f,c),b(f,t,c),b(f,n,c),C(i,n,null),b(f,l,c),b(f,s,c);for(let p=0;p<u.length;p+=1)u[p].m(s,null);o=!0},p(f,c){const p={};if(c[2]&32&&(p.$$scope={dirty:c,ctx:f}),i.$set(p),c[0]&66048){a=f[9];let d;for(d=0;d<a.length;d+=1){const g=ky(f,a,d);u[d]?u[d].p(g,c):(u[d]=jy(g),u[d].c(),u[d].m(s,null))}for(;d<u.length;d+=1)u[d].d(1);u.length=a.length}},i(f){o||(m(e.$$.fragment,f),m(i.$$.fragment,f),o=!0)},o(f){_(e.$$.fragment,f),_(i.$$.fragment,f),o=!1},d(f){S(e,f),f&&v(t),f&&v(n),S(i),f&&v(l),f&&v(s),dt(u,f)}}}function Ure(r){let e;return{c(){e=U("Fields")},m(t,n){b(t,e,n)},d(t){t&&v(e)}}}function jy(r){let e,t=r[50].label+"",n,i,l;function s(){return r[35](r[50])}return{c(){e=D("li"),n=U(t),y(e,"class","svelte-xmd5g6")},m(o,a){b(o,e,a),L(e,n),i||(l=Le(e,"click",s),i=!0)},p(o,a){r=o,a[0]&512&&t!==(t=r[50].label+"")&&Se(n,t)},d(o){o&&v(e),i=!1,l()}}}function zy(r){let e,t,n,i,l,s,o;e=new Gt({props:{size:"S"}}),i=new ut({props:{size:"XS",$$slots:{default:[Fre]},$$scope:{ctx:r}}});let a=r[8],u=[];for(let f=0;f<a.length;f+=1)u[f]=qy(yy(r,a,f));return{c(){k(e.$$.fragment),t=R(),n=D("div"),k(i.$$.fragment),l=R(),s=D("ul");for(let f=0;f<u.length;f+=1)u[f].c();y(n,"class","title svelte-xmd5g6"),y(s,"class","svelte-xmd5g6")},m(f,c){C(e,f,c),b(f,t,c),b(f,n,c),C(i,n,null),b(f,l,c),b(f,s,c);for(let p=0;p<u.length;p+=1)u[p].m(s,null);o=!0},p(f,c){const p={};if(c[2]&32&&(p.$$scope={dirty:c,ctx:f}),i.$set(p),c[0]&65792){a=f[8];let d;for(d=0;d<a.length;d+=1){const g=yy(f,a,d);u[d]?u[d].p(g,c):(u[d]=qy(g),u[d].c(),u[d].m(s,null))}for(;d<u.length;d+=1)u[d].d(1);u.length=a.length}},i(f){o||(m(e.$$.fragment,f),m(i.$$.fragment,f),o=!0)},o(f){_(e.$$.fragment,f),_(i.$$.fragment,f),o=!1},d(f){S(e,f),f&&v(t),f&&v(n),S(i),f&&v(l),f&&v(s),dt(u,f)}}}function Fre(r){let e;return{c(){e=U("JSON Arrays")},m(t,n){b(t,e,n)},d(t){t&&v(e)}}}function qy(r){let e,t=r[50].label+"",n,i,l;function s(){return r[36](r[50])}return{c(){e=D("li"),n=U(t),y(e,"class","svelte-xmd5g6")},m(o,a){b(o,e,a),L(e,n),i||(l=Le(e,"click",s),i=!0)},p(o,a){r=o,a[0]&256&&t!==(t=r[50].label+"")&&Se(n,t)},d(o){o&&v(e),i=!1,l()}}}function Uy(r){let e,t,n,i,l,s,o;e=new Gt({props:{size:"S"}}),i=new ut({props:{size:"XS",$$slots:{default:[Vre]},$$scope:{ctx:r}}});let a=r[11],u=[];for(let f=0;f<a.length;f+=1)u[f]=Fy(wy(r,a,f));return{c(){k(e.$$.fragment),t=R(),n=D("div"),k(i.$$.fragment),l=R(),s=D("ul");for(let f=0;f<u.length;f+=1)u[f].c();y(n,"class","title svelte-xmd5g6"),y(s,"class","svelte-xmd5g6")},m(f,c){C(e,f,c),b(f,t,c),b(f,n,c),C(i,n,null),b(f,l,c),b(f,s,c);for(let p=0;p<u.length;p+=1)u[p].m(s,null);o=!0},p(f,c){const p={};if(c[2]&32&&(p.$$scope={dirty:c,ctx:f}),i.$set(p),c[0]&67586){a=f[11];let d;for(d=0;d<a.length;d+=1){const g=wy(f,a,d);u[d]?u[d].p(g,c):(u[d]=Fy(g),u[d].c(),u[d].m(s,null))}for(;d<u.length;d+=1)u[d].d(1);u.length=a.length}},i(f){o||(m(e.$$.fragment,f),m(i.$$.fragment,f),o=!0)},o(f){_(e.$$.fragment,f),_(i.$$.fragment,f),o=!1},d(f){S(e,f),f&&v(t),f&&v(n),S(i),f&&v(l),f&&v(s),dt(u,f)}}}function Vre(r){let e;return{c(){e=U("Data Providers")},m(t,n){b(t,e,n)},d(t){t&&v(e)}}}function Fy(r){let e,t=r[47].label+"",n,i,l,s;function o(){return r[37](r[47])}return{c(){e=D("li"),n=U(t),i=R(),y(e,"class","svelte-xmd5g6"),te(e,"selected",r[1]===r[47])},m(a,u){b(a,e,u),L(e,n),L(e,i),l||(s=Le(e,"click",o),l=!0)},p(a,u){r=a,u[0]&2048&&t!==(t=r[47].label+"")&&Se(n,t),u[0]&2050&&te(e,"selected",r[1]===r[47])},d(a){a&&v(e),l=!1,s()}}}function Vy(r){let e,t,n,i,l,s,o;e=new Gt({props:{size:"S"}}),i=new ut({props:{size:"XS",$$slots:{default:[Hre]},$$scope:{ctx:r}}});let a=r[2],u=[];for(let f=0;f<a.length;f+=1)u[f]=Hy(vy(r,a,f));return{c(){k(e.$$.fragment),t=R(),n=D("div"),k(i.$$.fragment),l=R(),s=D("ul");for(let f=0;f<u.length;f+=1)u[f].c();y(n,"class","title svelte-xmd5g6"),y(s,"class","svelte-xmd5g6")},m(f,c){C(e,f,c),b(f,t,c),b(f,n,c),C(i,n,null),b(f,l,c),b(f,s,c);for(let p=0;p<u.length;p+=1)u[p].m(s,null);o=!0},p(f,c){const p={};if(c[2]&32&&(p.$$scope={dirty:c,ctx:f}),i.$set(p),c[0]&65540){a=f[2];let d;for(d=0;d<a.length;d+=1){const g=vy(f,a,d);u[d]?u[d].p(g,c):(u[d]=Hy(g),u[d].c(),u[d].m(s,null))}for(;d<u.length;d+=1)u[d].d(1);u.length=a.length}},i(f){o||(m(e.$$.fragment,f),m(i.$$.fragment,f),o=!0)},o(f){_(e.$$.fragment,f),_(i.$$.fragment,f),o=!1},d(f){S(e,f),f&&v(t),f&&v(n),S(i),f&&v(l),f&&v(s),dt(u,f)}}}function Hre(r){let e;return{c(){e=U("Other")},m(t,n){b(t,e,n)},d(t){t&&v(e)}}}function Hy(r){let e,t=r[44].label+"",n,i,l;function s(){return r[38](r[44])}return{c(){e=D("li"),n=U(t),y(e,"class","svelte-xmd5g6")},m(o,a){b(o,e,a),L(e,n),i||(l=Le(e,"click",s),i=!0)},p(o,a){r=o,a[0]&4&&t!==(t=r[44].label+"")&&Se(n,t)},d(o){o&&v(e),i=!1,l()}}}function Wre(r){var M,B,j,H,W,Y,G;let e,t,n,i,l,s,o,a,u,f,c,p,d;n=new ut({props:{size:"XS",$$slots:{default:[Bre]},$$scope:{ctx:r}}});let g=r[14],h=[];for(let z=0;z<g.length;z+=1)h[z]=Ty(Oy(r,g,z));let $=((M=r[13])==null?void 0:M.length)&&Ly(r),w=((B=r[12])==null?void 0:B.length)&&Ny(r),A=((j=r[10])==null?void 0:j.length)&&My(r),E=((H=r[9])==null?void 0:H.length)&&By(r),I=((W=r[8])==null?void 0:W.length)&&zy(r),T=((Y=r[11])==null?void 0:Y.length)&&Uy(r),P=((G=r[2])==null?void 0:G.length)&&Vy(r);return{c(){e=D("div"),t=D("div"),k(n.$$.fragment),i=R(),l=D("ul");for(let z=0;z<h.length;z+=1)h[z].c();s=R(),$&&$.c(),o=R(),w&&w.c(),a=R(),A&&A.c(),u=R(),E&&E.c(),f=R(),I&&I.c(),c=R(),T&&T.c(),p=R(),P&&P.c(),y(t,"class","title svelte-xmd5g6"),y(l,"class","svelte-xmd5g6"),y(e,"class","dropdown svelte-xmd5g6")},m(z,F){b(z,e,F),L(e,t),C(n,t,null),L(e,i),L(e,l);for(let V=0;V<h.length;V+=1)h[V].m(l,null);L(e,s),$&&$.m(e,null),L(e,o),w&&w.m(e,null),L(e,a),A&&A.m(e,null),L(e,u),E&&E.m(e,null),L(e,f),I&&I.m(e,null),L(e,c),T&&T.m(e,null),L(e,p),P&&P.m(e,null),d=!0},p(z,F){var X,Q,re,ne,ce,ke,Re;const V={};if(F[2]&32&&(V.$$scope={dirty:F,ctx:z}),n.$set(V),F[0]&81920){g=z[14];let Ce;for(Ce=0;Ce<g.length;Ce+=1){const _e=Oy(z,g,Ce);h[Ce]?h[Ce].p(_e,F):(h[Ce]=Ty(_e),h[Ce].c(),h[Ce].m(l,null))}for(;Ce<h.length;Ce+=1)h[Ce].d(1);h.length=g.length}((X=z[13])==null?void 0:X.length)?$?($.p(z,F),F[0]&8192&&m($,1)):($=Ly(z),$.c(),m($,1),$.m(e,o)):$&&(K(),_($,1,1,()=>{$=null}),Z()),((Q=z[12])==null?void 0:Q.length)?w?(w.p(z,F),F[0]&4096&&m(w,1)):(w=Ny(z),w.c(),m(w,1),w.m(e,a)):w&&(K(),_(w,1,1,()=>{w=null}),Z()),((re=z[10])==null?void 0:re.length)?A?(A.p(z,F),F[0]&1024&&m(A,1)):(A=My(z),A.c(),m(A,1),A.m(e,u)):A&&(K(),_(A,1,1,()=>{A=null}),Z()),((ne=z[9])==null?void 0:ne.length)?E?(E.p(z,F),F[0]&512&&m(E,1)):(E=By(z),E.c(),m(E,1),E.m(e,f)):E&&(K(),_(E,1,1,()=>{E=null}),Z()),((ce=z[8])==null?void 0:ce.length)?I?(I.p(z,F),F[0]&256&&m(I,1)):(I=zy(z),I.c(),m(I,1),I.m(e,c)):I&&(K(),_(I,1,1,()=>{I=null}),Z()),((ke=z[11])==null?void 0:ke.length)?T?(T.p(z,F),F[0]&2048&&m(T,1)):(T=Uy(z),T.c(),m(T,1),T.m(e,p)):T&&(K(),_(T,1,1,()=>{T=null}),Z()),((Re=z[2])==null?void 0:Re.length)?P?(P.p(z,F),F[0]&4&&m(P,1)):(P=Vy(z),P.c(),m(P,1),P.m(e,null)):P&&(K(),_(P,1,1,()=>{P=null}),Z())},i(z){d||(m(n.$$.fragment,z),m($),m(w),m(A),m(E),m(I),m(T),m(P),d=!0)},o(z){_(n.$$.fragment,z),_($),_(w),_(A),_(E),_(I),_(T),_(P),d=!1},d(z){z&&v(e),S(n),dt(h,z),$&&$.d(),w&&w.d(),A&&A.d(),E&&E.d(),I&&I.d(),T&&T.d(),P&&P.d()}}}function Gre(r){var u;let e,t,n,i,l,s;t=new Ye({props:{readonly:!0,value:r[15],options:[r[15]]}}),t.$on("click",function(){pt(r[5].show)&&r[5].show.apply(this,arguments)});let o=((u=r[1])==null?void 0:u.type)==="query"&&Ey(r),a={anchor:r[4],dataCy:`dataSource-popover-${r[3].selectedComponentId}`,$$slots:{default:[Wre]},$$scope:{ctx:r}};return l=new _f({props:a}),r[39](l),{c(){e=D("div"),k(t.$$.fragment),n=R(),o&&o.c(),i=R(),k(l.$$.fragment),y(e,"class","container svelte-xmd5g6")},m(f,c){b(f,e,c),C(t,e,null),L(e,n),o&&o.m(e,null),r[30](e),b(f,i,c),C(l,f,c),s=!0},p(f,c){var g;r=f;const p={};c[0]&32768&&(p.value=r[15]),c[0]&32768&&(p.options=[r[15]]),t.$set(p),((g=r[1])==null?void 0:g.type)==="query"?o?(o.p(r,c),c[0]&2&&m(o,1)):(o=Ey(r),o.c(),m(o,1),o.m(e,null)):o&&(K(),_(o,1,1,()=>{o=null}),Z());const d={};c[0]&16&&(d.anchor=r[4]),c[0]&8&&(d.dataCy=`dataSource-popover-${r[3].selectedComponentId}`),c[0]&32518|c[2]&32&&(d.$$scope={dirty:c,ctx:r}),l.$set(d)},i(f){s||(m(t.$$.fragment,f),m(o),m(l.$$.fragment,f),s=!0)},o(f){_(t.$$.fragment,f),_(o),_(l.$$.fragment,f),s=!1},d(f){f&&v(e),S(t),o&&o.d(),r[30](null),f&&v(i),r[39](null),S(l,f)}}}function Yre(r,e,t){let n,i,l,s,o,a,u,f,c,p,d,g,h,$,w;ae(r,Zt,ue=>t(40,p=ue)),ae(r,Sn,ue=>t(24,d=ue)),ae(r,ms,ue=>t(41,g=ue)),ae(r,qe,ue=>t(3,h=ue)),ae(r,Xn,ue=>t(25,$=ue)),ae(r,Tt,ue=>t(26,w=ue));let{value:A={}}=e,{otherSources:E}=e,{showAllQueries:I}=e,{bindings:T=[]}=e;const P=gt(),M=["attachment","array"];let B,j,H,W;const Y=ue=>{P("change",ue),j.hide()},G=ue=>{const Ae=p.list.find(ye=>ye._id===ue.datasourceId).source;return g[Ae].query[ue.queryVerb]},z=ue=>{var Ae;return((Ae=d.list.find(ye=>ye._id===(ue==null?void 0:ue._id)))==null?void 0:Ae.parameters)||[]},F=ue=>p.list.find(Ae=>Ae._id===(ue==null?void 0:ue.datasourceId)),V=()=>{t(7,W=A.queryParams),H.show()},X=()=>{Y(xe(Ee({},A),{queryParams:W})),H.hide()};function Q(ue){W=ue,t(7,W)}function re(ue){T=ue,t(0,T)}function ne(ue){x[ue?"unshift":"push"](()=>{H=ue,t(6,H)})}function ce(ue){x[ue?"unshift":"push"](()=>{B=ue,t(4,B)})}const ke=ue=>Y(ue),Re=ue=>Y(ue),Ce=ue=>Y(ue),_e=ue=>Y(ue),$e=ue=>Y(ue),Pe=ue=>Y(ue),We=ue=>Y(ue),fe=ue=>Y(ue);function Xe(ue){x[ue?"unshift":"push"](()=>{j=ue,t(5,j)})}return r.$$set=ue=>{"value"in ue&&t(1,A=ue.value),"otherSources"in ue&&t(2,E=ue.otherSources),"showAllQueries"in ue&&t(22,I=ue.showAllQueries),"bindings"in ue&&t(0,T=ue.bindings)},r.$$.update=()=>{var ue;r.$$.dirty[0]&2&&t(15,n=(ue=A==null?void 0:A.label)!=null?ue:"Choose an option"),r.$$.dirty[0]&67108864&&t(14,i=w.list.map(Ae=>({label:Ae.name,tableId:Ae._id,type:"table"}))),r.$$.dirty[0]&67108864&&t(13,l=w.list.reduce((Ae,ye)=>{let he=Object.entries(ye.views||{}).map(([ze,At])=>xe(Ee({label:ze,name:ze},At),{type:"view"}));return[...Ae,...he]},[])),r.$$.dirty[0]&20971520&&t(12,s=d.list.filter(Ae=>I||Ae.queryVerb==="read"||Ae.readable).map(Ae=>xe(Ee({label:Ae.name,name:Ae.name},Ae),{type:"query"}))),r.$$.dirty[0]&33554440&&t(23,o=qo($,h.selectedComponentId)),r.$$.dirty[0]&8388608&&t(11,a=o.filter(Ae=>{var ye;return(ye=Ae._component)==null?void 0:ye.endsWith("/dataprovider")}).map(Ae=>({label:Ae._instanceName,name:Ae._instanceName,providerId:Ae._id,value:`{{ literal ${fn(Ae._id)} }}`,type:"provider"}))),r.$$.dirty[0]&1&&t(10,u=T.filter(Ae=>{var ye;return((ye=Ae.fieldSchema)==null?void 0:ye.type)==="link"}).map(Ae=>{const{providerId:ye,readableBinding:he,fieldSchema:ze}=Ae||{},{name:At,tableId:It}=ze||{},Lt=fn(ye);return{providerId:ye,label:he,fieldName:At,tableId:It,type:"link",rowId:`{{ ${Lt}.${fn("_id")} }}`,rowTableId:`{{ ${Lt}.${fn("tableId")} }}`}})),r.$$.dirty[0]&1&&t(9,f=T.filter(Ae=>{var ye;return M.includes((ye=Ae.fieldSchema)==null?void 0:ye.type)}).map(Ae=>{const{providerId:ye,readableBinding:he,runtimeBinding:ze}=Ae,{name:At,type:It,tableId:Lt}=Ae.fieldSchema;return{providerId:ye,label:he,fieldName:At,fieldType:It,tableId:Lt,type:"field",value:`{{ literal ${ze} }}`}})),r.$$.dirty[0]&1&&t(8,c=T.filter(Ae=>{var ye;return((ye=Ae.fieldSchema)==null?void 0:ye.type)==="jsonarray"}).map(Ae=>{const{providerId:ye,readableBinding:he,runtimeBinding:ze,tableId:At}=Ae,{name:It,type:Lt,prefixKeys:Xt}=Ae.fieldSchema;return{providerId:ye,label:he,fieldName:It,fieldType:Lt,tableId:At,prefixKeys:Xt,type:"jsonarray",value:`{{ literal ${ze} }}`}}))},[T,A,E,h,B,j,H,W,c,f,u,a,s,l,i,n,Y,G,z,F,V,X,I,o,d,$,w,Q,re,ne,ce,ke,Re,Ce,_e,$e,Pe,We,fe,Xe]}class Wy extends se{constructor(e){super();oe(this,e,Yre,Gre,ie,{value:1,otherSources:2,showAllQueries:22,bindings:0},null,[-1,-1,-1])}}function Jre(r){let e,t;return e=new Ye({props:{options:r[1],value:r[0]}}),e.$on("change",r[3]),{c(){k(e.$$.fragment)},m(n,i){C(e,n,i),t=!0},p(n,[i]){const l={};i&2&&(l.options=n[1]),i&1&&(l.value=n[0]),e.$set(l)},i(n){t||(m(e.$$.fragment,n),t=!0)},o(n){_(e.$$.fragment,n),t=!1},d(n){S(e,n)}}}function Xre(r,e,t){let n,i;ae(r,Zt,o=>t(2,i=o));let{value:l=null}=e;function s(o){mt.call(this,r,o)}return r.$$set=o=>{"value"in o&&t(0,l=o.value)},r.$$.update=()=>{r.$$.dirty&4&&t(1,n=i.list.filter(o=>{var a;return o.source==="S3"&&!((a=o.config)==null?void 0:a.endpoint)}).map(o=>({label:o.name,value:o._id})))},[l,n,i,s]}class Qre extends se{constructor(e){super();oe(this,e,Xre,Jre,ie,{value:0})}}function Kre(r){let e,t;return e=new Ye({props:{value:r[0],placeholder:null,options:r[1],getOptionLabel:Zre,getOptionValue:r[2]}}),e.$on("change",r[6]),{c(){k(e.$$.fragment)},m(n,i){C(e,n,i),t=!0},p(n,[i]){const l={};i&1&&(l.value=n[0]),i&2&&(l.options=n[1]),e.$set(l)},i(n){t||(m(e.$$.fragment,n),t=!0)},o(n){_(e.$$.fragment,n),t=!1},d(n){S(e,n)}}}const Zre=r=>r._instanceName;function xre(r,e,t){let n,i,l,s;ae(r,qe,c=>t(4,l=c)),ae(r,Xn,c=>t(5,s=c));let{value:o}=e;const a=gt(),u=c=>`{{ literal ${fn(c._id)} }}`;Et(()=>{!(o&&i.find(p=>u(p)===o)!=null)&&i.length&&a("change",u(i[i.length-1]))});function f(c){mt.call(this,r,c)}return r.$$set=c=>{"value"in c&&t(0,o=c.value)},r.$$.update=()=>{r.$$.dirty&48&&t(3,n=zl(s==null?void 0:s.props,l.selectedComponentId)),r.$$.dirty&8&&t(1,i=n.filter(c=>{var p;return(p=c._component)==null?void 0:p.endsWith("/dataprovider")}))},[o,i,u,n,l,s,f]}class eie extends se{constructor(e){super();oe(this,e,xre,Kre,ie,{value:0})}}function tie(r){let e;return{c(){e=U("Screen")},m(t,n){b(t,e,n)},d(t){t&&v(e)}}}function nie(r){let e,t,n,i,l,s,o,a,u,f;t=new Ge({props:{small:!0,$$slots:{default:[tie]},$$scope:{ctx:r}}}),i=new Rn({props:{title:"Destination URL",placeholder:"/screen",value:r[0].url,bindings:r[1]}}),i.$on("change",r[2]);function c(d){r[3](d)}let p={text:"Open screen in modal"};return r[0].peek!==void 0&&(p.value=r[0].peek),a=new gr({props:p}),x.push(()=>pe(a,"value",c)),{c(){e=D("div"),k(t.$$.fragment),n=R(),k(i.$$.fragment),l=R(),s=D("div"),o=R(),k(a.$$.fragment),y(e,"class","root svelte-15fuuda")},m(d,g){b(d,e,g),C(t,e,null),L(e,n),C(i,e,null),L(e,l),L(e,s),L(e,o),C(a,e,null),f=!0},p(d,[g]){const h={};g&16&&(h.$$scope={dirty:g,ctx:d}),t.$set(h);const $={};g&1&&($.value=d[0].url),g&2&&($.bindings=d[1]),i.$set($);const w={};!u&&g&1&&(u=!0,w.value=d[0].peek,de(()=>u=!1)),a.$set(w)},i(d){f||(m(t.$$.fragment,d),m(i.$$.fragment,d),m(a.$$.fragment,d),f=!0)},o(d){_(t.$$.fragment,d),_(i.$$.fragment,d),_(a.$$.fragment,d),f=!1},d(d){d&&v(e),S(t),S(i),S(a)}}}function rie(r,e,t){let{parameters:n}=e,{bindings:i=[]}=e;const l=o=>t(0,n.url=o.detail,n);function s(o){r.$$.not_equal(n.peek,o)&&(n.peek=o,t(0,n))}return r.$$set=o=>{"parameters"in o&&t(0,n=o.parameters),"bindings"in o&&t(1,i=o.bindings)},[n,i,l,s]}class iie extends se{constructor(e){super();oe(this,e,rie,nie,ie,{parameters:0,bindings:1})}}function Gy(r,e,t){const n=r.slice();return n[16]=e[t],n[18]=t,n}function Yy(r){let e,t,n,i,l=r[4],s=[];for(let a=0;a<l.length;a+=1)s[a]=Jy(Gy(r,l,a));const o=a=>_(s[a],1,1,()=>{s[a]=null});return n=new nt({props:{icon:"AddCircle",secondary:!0,$$slots:{default:[uie]},$$scope:{ctx:r}}}),n.$on("click",r[5]),{c(){for(let a=0;a<s.length;a+=1)s[a].c();e=R(),t=D("div"),k(n.$$.fragment),ft(t,"margin-top","10px")},m(a,u){for(let f=0;f<s.length;f+=1)s[f].m(a,u);b(a,e,u),b(a,t,u),C(n,t,null),i=!0},p(a,u){if(u&479){l=a[4];let c;for(c=0;c<l.length;c+=1){const p=Gy(a,l,c);s[c]?(s[c].p(p,u),m(s[c],1)):(s[c]=Jy(p),s[c].c(),m(s[c],1),s[c].m(e.parentNode,e))}for(K(),c=l.length;c<s.length;c+=1)o(c);Z()}const f={};u&524290&&(f.$$scope={dirty:u,ctx:a}),n.$set(f)},i(a){if(!i){for(let u=0;u<l.length;u+=1)m(s[u]);m(n.$$.fragment,a),i=!0}},o(a){s=s.filter(Boolean);for(let u=0;u<s.length;u+=1)_(s[u]);_(n.$$.fragment,a),i=!1},d(a){dt(s,a),a&&v(e),a&&v(t),S(n)}}}function lie(r){let e;return{c(){e=U(r[1])},m(t,n){b(t,e,n)},p(t,n){n&2&&Se(e,t[1])},d(t){t&&v(e)}}}function sie(r){let e,t;function n(...i){return r[11](r[18],...i)}return e=new et({props:{thin:!0,secondary:!0,value:r[16][0]}}),e.$on("change",n),{c(){k(e.$$.fragment)},m(i,l){C(e,i,l),t=!0},p(i,l){r=i;const s={};l&16&&(s.value=r[16][0]),e.$set(s)},i(i){t||(m(e.$$.fragment,i),t=!0)},o(i){_(e.$$.fragment,i),t=!1},d(i){S(e,i)}}}function oie(r){let e,t;function n(...i){return r[10](r[18],...i)}return e=new Ye({props:{value:r[16][0],options:r[0].map(Xy)}}),e.$on("change",n),{c(){k(e.$$.fragment)},m(i,l){C(e,i,l),t=!0},p(i,l){r=i;const s={};l&16&&(s.value=r[16][0]),l&1&&(s.options=r[0].map(Xy)),e.$set(s)},i(i){t||(m(e.$$.fragment,i),t=!0)},o(i){_(e.$$.fragment,i),t=!1},d(i){S(e,i)}}}function aie(r){let e;return{c(){e=U(r[2])},m(t,n){b(t,e,n)},p(t,n){n&4&&Se(e,t[2])},d(t){t&&v(e)}}}function Jy(r){let e,t,n,i,l,s,o,a,u,f,c;e=new Ge({props:{small:!0,$$slots:{default:[lie]},$$scope:{ctx:r}}});const p=[oie,sie],d=[];function g(w,A){return w[0]?0:1}n=g(r),i=d[n]=p[n](r),s=new Ge({props:{small:!0,$$slots:{default:[aie]},$$scope:{ctx:r}}});function h(...w){return r[12](r[18],...w)}a=new Rn({props:{title:`Value for "${r[16][0]}"`,value:r[16][1],bindings:r[3]}}),a.$on("change",h);function $(){return r[13](r[16])}return f=new Rt({props:{size:"S",quiet:!0,icon:"Delete"}}),f.$on("click",$),{c(){k(e.$$.fragment),t=R(),i.c(),l=R(),k(s.$$.fragment),o=R(),k(a.$$.fragment),u=R(),k(f.$$.fragment)},m(w,A){C(e,w,A),b(w,t,A),d[n].m(w,A),b(w,l,A),C(s,w,A),b(w,o,A),C(a,w,A),b(w,u,A),C(f,w,A),c=!0},p(w,A){r=w;const E={};A&524290&&(E.$$scope={dirty:A,ctx:r}),e.$set(E);let I=n;n=g(r),n===I?d[n].p(r,A):(K(),_(d[I],1,1,()=>{d[I]=null}),Z(),i=d[n],i?i.p(r,A):(i=d[n]=p[n](r),i.c()),m(i,1),i.m(l.parentNode,l));const T={};A&524292&&(T.$$scope={dirty:A,ctx:r}),s.$set(T);const P={};A&16&&(P.title=`Value for "${r[16][0]}"`),A&16&&(P.value=r[16][1]),A&8&&(P.bindings=r[3]),a.$set(P)},i(w){c||(m(e.$$.fragment,w),m(i),m(s.$$.fragment,w),m(a.$$.fragment,w),m(f.$$.fragment,w),c=!0)},o(w){_(e.$$.fragment,w),_(i),_(s.$$.fragment,w),_(a.$$.fragment,w),_(f.$$.fragment,w),c=!1},d(w){S(e,w),w&&v(t),d[n].d(w),w&&v(l),S(s,w),w&&v(o),S(a,w),w&&v(u),S(f,w)}}}function uie(r){let e,t;return{c(){e=U(`Add
|
|
750
750
|
`),t=U(r[1])},m(n,i){b(n,e,i),b(n,t,i)},p(n,i){i&2&&Se(t,n[1])},d(n){n&&v(e),n&&v(t)}}}function fie(r){let e,t,n=r[4]&&Yy(r);return{c(){n&&n.c(),e=Oe()},m(i,l){n&&n.m(i,l),b(i,e,l),t=!0},p(i,[l]){i[4]?n?(n.p(i,l),l&16&&m(n,1)):(n=Yy(i),n.c(),m(n,1),n.m(e.parentNode,e)):n&&(K(),_(n,1,1,()=>{n=null}),Z())},i(i){t||(m(n),t=!0)},o(i){_(n),t=!1},d(i){n&&n.d(i),i&&v(e)}}}const Xy=r=>r.name;function cie(r,e,t){const n=gt();let{parameterFields:i}=e,{schemaFields:l}=e,{fieldLabel:s="Column"}=e,{valueLabel:o="Value"}=e,{bindings:a=[]}=e,u=Object.entries(i||{});const f=()=>{t(4,u=[...u.filter(E=>E[0]),["",""]])},c=E=>{t(4,u=u.filter(I=>I[0]!==E))},p=(E,I)=>{t(4,u[E][1]=I,u),t(4,u)},d=(E,I)=>{t(4,u[E][0]=I,u),t(4,u)},g=E=>{const I={};E.filter(T=>T[0]).forEach(([T,P])=>{I[T]=P}),n("change",I)},h=(E,I)=>d(E,I.detail),$=(E,I)=>d(E,I.detail),w=(E,I)=>p(E,I.detail),A=E=>c(E[0]);return r.$$set=E=>{"parameterFields"in E&&t(9,i=E.parameterFields),"schemaFields"in E&&t(0,l=E.schemaFields),"fieldLabel"in E&&t(1,s=E.fieldLabel),"valueLabel"in E&&t(2,o=E.valueLabel),"bindings"in E&&t(3,a=E.bindings)},r.$$.update=()=>{r.$$.dirty&16&&g(u)},[l,s,o,a,u,f,c,p,d,i,h,$,w,A]}class Km extends se{constructor(e){super();oe(this,e,cie,fie,ie,{parameterFields:9,schemaFields:0,fieldLabel:1,valueLabel:2,bindings:3})}}function pie(r){let e,t,n;return{c(){e=U(`Choosing a Data Source will automatically use the data it provides, but it's
|
|
751
751
|
optional.`),t=D("br"),n=U(`
|
|
752
752
|
You can always add or override fields manually.`)},m(i,l){b(i,e,l),b(i,t,l),b(i,n,l)},p:we,d(i){i&&v(e),i&&v(t),i&&v(n)}}}function die(r){let e;return{c(){e=U("Data Source")},m(t,n){b(t,e,n)},d(t){t&&v(e)}}}function mie(r){let e;return{c(){e=U("Table")},m(t,n){b(t,e,n)},d(t){t&&v(e)}}}function Qy(r){let e,t,n,i,l;e=new Ge({props:{small:!0,$$slots:{default:[gie]},$$scope:{ctx:r}}});function s(a){r[14](a)}let o={placeholder:"Are you sure you want to save this row?"};return r[0].confirmText!==void 0&&(o.value=r[0].confirmText),n=new et({props:o}),x.push(()=>pe(n,"value",s)),{c(){k(e.$$.fragment),t=R(),k(n.$$.fragment)},m(a,u){C(e,a,u),b(a,t,u),C(n,a,u),l=!0},p(a,u){const f={};u&262144&&(f.$$scope={dirty:u,ctx:a}),e.$set(f);const c={};!i&&u&1&&(i=!0,c.value=a[0].confirmText,de(()=>i=!1)),n.$set(c)},i(a){l||(m(e.$$.fragment,a),m(n.$$.fragment,a),l=!0)},o(a){_(e.$$.fragment,a),_(n.$$.fragment,a),l=!1},d(a){S(e,a),a&&v(t),S(n,a)}}}function gie(r){let e;return{c(){e=U("Confirm text")},m(t,n){b(t,e,n)},d(t){t&&v(e)}}}function Ky(r){let e,t,n;return t=new Km({props:{parameterFields:r[0].fields,schemaFields:r[3],bindings:r[1]}}),t.$on("change",r[5]),{c(){e=D("div"),k(t.$$.fragment),y(e,"class","fields svelte-2gvxnz")},m(i,l){b(i,e,l),C(t,e,null),n=!0},p(i,l){const s={};l&1&&(s.parameterFields=i[0].fields),l&8&&(s.schemaFields=i[3]),l&2&&(s.bindings=i[1]),t.$set(s)},i(i){n||(m(t.$$.fragment,i),n=!0)},o(i){_(t.$$.fragment,i),n=!1},d(i){i&&v(e),S(t)}}}function _ie(r){let e,t,n,i,l,s,o,a,u,f,c,p,d,g,h,$,w,A,E,I,T;t=new Ue({props:{size:"S",$$slots:{default:[pie]},$$scope:{ctx:r}}}),l=new Ge({props:{small:!0,$$slots:{default:[die]},$$scope:{ctx:r}}});function P(z){r[11](z)}let M={options:r[4],placeholder:"None"};r[0].providerId!==void 0&&(M.value=r[0].providerId),o=new Ye({props:M}),x.push(()=>pe(o,"value",P)),f=new Ge({props:{small:!0,$$slots:{default:[mie]},$$scope:{ctx:r}}});function B(z){r[12](z)}let j={options:r[2],getOptionLabel:hie,getOptionValue:$ie};r[0].tableId!==void 0&&(j.value=r[0].tableId),p=new Ye({props:j}),x.push(()=>pe(p,"value",B)),h=new Ge({props:{small:!0}});function H(z){r[13](z)}let W={text:"Require confirmation"};r[0].confirm!==void 0&&(W.value=r[0].confirm),w=new gr({props:W}),x.push(()=>pe(w,"value",H));let Y=r[0].confirm&&Qy(r),G=r[0].tableId&&Ky(r);return{c(){e=D("div"),k(t.$$.fragment),n=R(),i=D("div"),k(l.$$.fragment),s=R(),k(o.$$.fragment),u=R(),k(f.$$.fragment),c=R(),k(p.$$.fragment),g=R(),k(h.$$.fragment),$=R(),k(w.$$.fragment),E=R(),Y&&Y.c(),I=R(),G&&G.c(),y(i,"class","params svelte-2gvxnz"),y(e,"class","root svelte-2gvxnz")},m(z,F){b(z,e,F),C(t,e,null),L(e,n),L(e,i),C(l,i,null),L(i,s),C(o,i,null),L(i,u),C(f,i,null),L(i,c),C(p,i,null),L(i,g),C(h,i,null),L(i,$),C(w,i,null),L(i,E),Y&&Y.m(i,null),L(e,I),G&&G.m(e,null),T=!0},p(z,[F]){const V={};F&262144&&(V.$$scope={dirty:F,ctx:z}),t.$set(V);const X={};F&262144&&(X.$$scope={dirty:F,ctx:z}),l.$set(X);const Q={};F&16&&(Q.options=z[4]),!a&&F&1&&(a=!0,Q.value=z[0].providerId,de(()=>a=!1)),o.$set(Q);const re={};F&262144&&(re.$$scope={dirty:F,ctx:z}),f.$set(re);const ne={};F&4&&(ne.options=z[2]),!d&&F&1&&(d=!0,ne.value=z[0].tableId,de(()=>d=!1)),p.$set(ne);const ce={};!A&&F&1&&(A=!0,ce.value=z[0].confirm,de(()=>A=!1)),w.$set(ce),z[0].confirm?Y?(Y.p(z,F),F&1&&m(Y,1)):(Y=Qy(z),Y.c(),m(Y,1),Y.m(i,null)):Y&&(K(),_(Y,1,1,()=>{Y=null}),Z()),z[0].tableId?G?(G.p(z,F),F&1&&m(G,1)):(G=Ky(z),G.c(),m(G,1),G.m(e,null)):G&&(K(),_(G,1,1,()=>{G=null}),Z())},i(z){T||(m(t.$$.fragment,z),m(l.$$.fragment,z),m(o.$$.fragment,z),m(f.$$.fragment,z),m(p.$$.fragment,z),m(h.$$.fragment,z),m(w.$$.fragment,z),m(Y),m(G),T=!0)},o(z){_(t.$$.fragment,z),_(l.$$.fragment,z),_(o.$$.fragment,z),_(f.$$.fragment,z),_(p.$$.fragment,z),_(h.$$.fragment,z),_(w.$$.fragment,z),_(Y),_(G),T=!1},d(z){z&&v(e),S(t),S(l),S(o),S(f),S(p),S(h),S(w),Y&&Y.d(),G&&G.d()}}}const hie=r=>r.name,$ie=r=>r._id;function bie(r,e,t){let n,i,l,s,o,a,u,f;ae(r,Tt,T=>t(8,a=T)),ae(r,Xn,T=>t(9,u=T)),ae(r,qe,T=>t(10,f=T));let{parameters:c}=e,{bindings:p=[]}=e;const d=(T,P)=>{const M=qe.actions.components.getDefinition(T==null?void 0:T._component);return M?(Array.isArray(M.context)?M.context:[M.context]).find(j=>(j==null?void 0:j.type)===P):null},g=(T,P)=>{const M=T.map(H=>({component:H,context:d(H,"form")})),B=P.map(H=>({component:H,context:d(H,"schema")}));return M.concat(B).map(({component:H,context:W})=>{let Y=H._id;return W.suffix&&(Y+=`-${W.suffix}`),{label:H._instanceName,value:Y}})},h=(T,P)=>{const{schema:M}=Ec(P);return Object.values(M||{})},$=T=>{t(0,c.fields=T.detail,c)};function w(T){r.$$.not_equal(c.providerId,T)&&(c.providerId=T,t(0,c))}function A(T){r.$$.not_equal(c.tableId,T)&&(c.tableId=T,t(0,c))}function E(T){r.$$.not_equal(c.confirm,T)&&(c.confirm=T,t(0,c))}function I(T){r.$$.not_equal(c.confirmText,T)&&(c.confirmText=T,t(0,c))}return r.$$set=T=>{"parameters"in T&&t(0,c=T.parameters),"bindings"in T&&t(1,p=T.bindings)},r.$$.update=()=>{r.$$.dirty&1536&&t(7,n=qo(u,f.selectedComponentId,"form")),r.$$.dirty&1536&&t(6,i=qo(u,f.selectedComponentId,"schema")),r.$$.dirty&192&&t(4,l=g(n,i)),r.$$.dirty&513&&t(3,s=h(u,c==null?void 0:c.tableId)),r.$$.dirty&256&&t(2,o=a.list||[])},[c,p,o,s,l,$,i,n,a,u,f,w,A,E,I]}class vie extends se{constructor(e){super();oe(this,e,bie,_ie,ie,{parameters:0,bindings:1})}}function wie(r){let e;return{c(){e=U("Table")},m(t,n){b(t,e,n)},d(t){t&&v(e)}}}function yie(r){let e;return{c(){e=U("Row ID")},m(t,n){b(t,e,n)},d(t){t&&v(e)}}}function Zy(r){let e,t,n,i,l;e=new Ge({props:{small:!0,$$slots:{default:[kie]},$$scope:{ctx:r}}});function s(a){r[7](a)}let o={placeholder:"Are you sure you want to delete this row?"};return r[0].confirmText!==void 0&&(o.value=r[0].confirmText),n=new et({props:o}),x.push(()=>pe(n,"value",s)),{c(){k(e.$$.fragment),t=R(),k(n.$$.fragment)},m(a,u){C(e,a,u),b(a,t,u),C(n,a,u),l=!0},p(a,u){const f={};u&256&&(f.$$scope={dirty:u,ctx:a}),e.$set(f);const c={};!i&&u&1&&(i=!0,c.value=a[0].confirmText,de(()=>i=!1)),n.$set(c)},i(a){l||(m(e.$$.fragment,a),m(n.$$.fragment,a),l=!0)},o(a){_(e.$$.fragment,a),_(n.$$.fragment,a),l=!1},d(a){S(e,a),a&&v(t),S(n,a)}}}function kie(r){let e;return{c(){e=U("Confirm text")},m(t,n){b(t,e,n)},d(t){t&&v(e)}}}function Cie(r){let e,t,n,i,l,s,o,a,u,f,c,p,d,g,h,$;t=new Ge({props:{$$slots:{default:[wie]},$$scope:{ctx:r}}});function w(P){r[4](P)}let A={options:r[2],getOptionLabel:Sie,getOptionValue:Aie};r[0].tableId!==void 0&&(A.value=r[0].tableId),i=new Ye({props:A}),x.push(()=>pe(i,"value",w)),o=new Ge({props:{small:!0,$$slots:{default:[yie]},$$scope:{ctx:r}}}),u=new Rn({props:{bindings:r[1],title:"Row ID to delete",value:r[0].rowId}}),u.$on("change",r[5]),c=new Ge({props:{small:!0}});function E(P){r[6](P)}let I={text:"Require confirmation"};r[0].confirm!==void 0&&(I.value=r[0].confirm),d=new gr({props:I}),x.push(()=>pe(d,"value",E));let T=r[0].confirm&&Zy(r);return{c(){e=D("div"),k(t.$$.fragment),n=R(),k(i.$$.fragment),s=R(),k(o.$$.fragment),a=R(),k(u.$$.fragment),f=R(),k(c.$$.fragment),p=R(),k(d.$$.fragment),h=R(),T&&T.c(),y(e,"class","root svelte-dlpmjc")},m(P,M){b(P,e,M),C(t,e,null),L(e,n),C(i,e,null),L(e,s),C(o,e,null),L(e,a),C(u,e,null),L(e,f),C(c,e,null),L(e,p),C(d,e,null),L(e,h),T&&T.m(e,null),$=!0},p(P,[M]){const B={};M&256&&(B.$$scope={dirty:M,ctx:P}),t.$set(B);const j={};M&4&&(j.options=P[2]),!l&&M&1&&(l=!0,j.value=P[0].tableId,de(()=>l=!1)),i.$set(j);const H={};M&256&&(H.$$scope={dirty:M,ctx:P}),o.$set(H);const W={};M&2&&(W.bindings=P[1]),M&1&&(W.value=P[0].rowId),u.$set(W);const Y={};!g&&M&1&&(g=!0,Y.value=P[0].confirm,de(()=>g=!1)),d.$set(Y),P[0].confirm?T?(T.p(P,M),M&1&&m(T,1)):(T=Zy(P),T.c(),m(T,1),T.m(e,null)):T&&(K(),_(T,1,1,()=>{T=null}),Z())},i(P){$||(m(t.$$.fragment,P),m(i.$$.fragment,P),m(o.$$.fragment,P),m(u.$$.fragment,P),m(c.$$.fragment,P),m(d.$$.fragment,P),m(T),$=!0)},o(P){_(t.$$.fragment,P),_(i.$$.fragment,P),_(o.$$.fragment,P),_(u.$$.fragment,P),_(c.$$.fragment,P),_(d.$$.fragment,P),_(T),$=!1},d(P){P&&v(e),S(t),S(i),S(o),S(u),S(c),S(d),T&&T.d()}}}const Sie=r=>r.name,Aie=r=>r._id;function Oie(r,e,t){let n,i;ae(r,Tt,c=>t(3,i=c));let{parameters:l}=e,{bindings:s=[]}=e;function o(c){r.$$.not_equal(l.tableId,c)&&(l.tableId=c,t(0,l))}const a=c=>t(0,l.rowId=c.detail,l);function u(c){r.$$.not_equal(l.confirm,c)&&(l.confirm=c,t(0,l))}function f(c){r.$$.not_equal(l.confirmText,c)&&(l.confirmText=c,t(0,l))}return r.$$set=c=>{"parameters"in c&&t(0,l=c.parameters),"bindings"in c&&t(1,s=c.bindings)},r.$$.update=()=>{r.$$.dirty&8&&t(2,n=i.list||[])},[l,s,n,i,o,a,u,f]}class Eie extends se{constructor(e){super();oe(this,e,Oie,Cie,ie,{parameters:0,bindings:1})}}function xy(r){let e,t,n,i,l;function s(u){r[9](u)}let o={label:"Query",options:r[3].list.filter(r[8]),getOptionLabel:Nie,getOptionValue:Rie};r[0].queryId!==void 0&&(o.value=r[0].queryId),e=new Ye({props:o}),x.push(()=>pe(e,"value",s));let a=r[0].queryId&&e6(r);return{c(){k(e.$$.fragment),n=R(),a&&a.c(),i=Oe()},m(u,f){C(e,u,f),b(u,n,f),a&&a.m(u,f),b(u,i,f),l=!0},p(u,f){const c={};f&24&&(c.options=u[3].list.filter(u[8])),!t&&f&1&&(t=!0,c.value=u[0].queryId,de(()=>t=!1)),e.$set(c),u[0].queryId?a?(a.p(u,f),f&1&&m(a,1)):(a=e6(u),a.c(),m(a,1),a.m(i.parentNode,i)):a&&(K(),_(a,1,1,()=>{a=null}),Z())},i(u){l||(m(e.$$.fragment,u),m(a),l=!0)},o(u){_(e.$$.fragment,u),_(a),l=!1},d(u){S(e,u),u&&v(n),a&&a.d(u),u&&v(i)}}}function e6(r){var c,p;let e,t,n,i,l,s;function o(d){r[10](d)}let a={text:"Require confirmation"};r[0].confirm!==void 0&&(a.value=r[0].confirm),e=new gr({props:a}),x.push(()=>pe(e,"value",o));let u=r[0].confirm&&t6(r),f=((p=(c=r[5])==null?void 0:c.parameters)==null?void 0:p.length)>0&&n6(r);return{c(){k(e.$$.fragment),n=R(),u&&u.c(),i=R(),f&&f.c(),l=Oe()},m(d,g){C(e,d,g),b(d,n,g),u&&u.m(d,g),b(d,i,g),f&&f.m(d,g),b(d,l,g),s=!0},p(d,g){var $,w;const h={};!t&&g&1&&(t=!0,h.value=d[0].confirm,de(()=>t=!1)),e.$set(h),d[0].confirm?u?(u.p(d,g),g&1&&m(u,1)):(u=t6(d),u.c(),m(u,1),u.m(i.parentNode,i)):u&&(K(),_(u,1,1,()=>{u=null}),Z()),((w=($=d[5])==null?void 0:$.parameters)==null?void 0:w.length)>0?f?(f.p(d,g),g&32&&m(f,1)):(f=n6(d),f.c(),m(f,1),f.m(l.parentNode,l)):f&&(K(),_(f,1,1,()=>{f=null}),Z())},i(d){s||(m(e.$$.fragment,d),m(u),m(f),s=!0)},o(d){_(e.$$.fragment,d),_(u),_(f),s=!1},d(d){S(e,d),d&&v(n),u&&u.d(d),d&&v(i),f&&f.d(d),d&&v(l)}}}function t6(r){let e,t,n;function i(s){r[11](s)}let l={label:"Confirm text",placeholder:"Are you sure you want to execute this query?"};return r[0].confirmText!==void 0&&(l.value=r[0].confirmText),e=new et({props:l}),x.push(()=>pe(e,"value",i)),{c(){k(e.$$.fragment)},m(s,o){C(e,s,o),n=!0},p(s,o){const a={};!t&&o&1&&(t=!0,a.value=s[0].confirmText,de(()=>t=!1)),e.$set(a)},i(s){n||(m(e.$$.fragment,s),n=!0)},o(s){_(e.$$.fragment,s),n=!1},d(s){S(e,s)}}}function n6(r){let e,t,n,i,l,s,o;function a(c){r[12](c)}function u(c){r[13](c)}let f={queryBindings:r[5].parameters};return r[0].queryParams!==void 0&&(f.customParams=r[0].queryParams),r[1]!==void 0&&(f.bindings=r[1]),t=new Wm({props:f}),x.push(()=>pe(t,"customParams",a)),x.push(()=>pe(t,"bindings",u)),s=new Um({props:{height:200,query:r[5],schema:r[6](r[5]),editable:!1,datasource:r[4]}}),{c(){e=D("div"),k(t.$$.fragment),l=R(),k(s.$$.fragment),y(e,"class","params svelte-s3zryk")},m(c,p){b(c,e,p),C(t,e,null),L(e,l),C(s,e,null),o=!0},p(c,p){const d={};p&32&&(d.queryBindings=c[5].parameters),!n&&p&1&&(n=!0,d.customParams=c[0].queryParams,de(()=>n=!1)),!i&&p&2&&(i=!0,d.bindings=c[1],de(()=>i=!1)),t.$set(d);const g={};p&32&&(g.query=c[5]),p&32&&(g.schema=c[6](c[5])),p&16&&(g.datasource=c[4]),s.$set(g)},i(c){o||(m(t.$$.fragment,c),m(s.$$.fragment,c),o=!0)},o(c){_(t.$$.fragment,c),_(s.$$.fragment,c),o=!1},d(c){c&&v(e),S(t),S(s)}}}function Iie(r){let e,t,n,i,l;function s(u){r[7](u)}let o={label:"Datasource",options:r[2].list,getOptionLabel:Lie,getOptionValue:Pie};r[0].datasourceId!==void 0&&(o.value=r[0].datasourceId),e=new Ye({props:o}),x.push(()=>pe(e,"value",s));let a=r[0].datasourceId&&xy(r);return{c(){k(e.$$.fragment),n=R(),a&&a.c(),i=Oe()},m(u,f){C(e,u,f),b(u,n,f),a&&a.m(u,f),b(u,i,f),l=!0},p(u,f){const c={};f&4&&(c.options=u[2].list),!t&&f&1&&(t=!0,c.value=u[0].datasourceId,de(()=>t=!1)),e.$set(c),u[0].datasourceId?a?(a.p(u,f),f&1&&m(a,1)):(a=xy(u),a.c(),m(a,1),a.m(i.parentNode,i)):a&&(K(),_(a,1,1,()=>{a=null}),Z())},i(u){l||(m(e.$$.fragment,u),m(a),l=!0)},o(u){_(e.$$.fragment,u),_(a),l=!1},d(u){S(e,u),u&&v(n),a&&a.d(u),u&&v(i)}}}function Tie(r){let e,t;return e=new Me({props:{gap:"XS",noPadding:!0,$$slots:{default:[Iie]},$$scope:{ctx:r}}}),{c(){k(e.$$.fragment)},m(n,i){C(e,n,i),t=!0},p(n,[i]){const l={};i&32831&&(l.$$scope={dirty:i,ctx:n}),e.$set(l)},i(n){t||(m(e.$$.fragment,n),t=!0)},o(n){_(e.$$.fragment,n),t=!1},d(n){S(e,n)}}}const Lie=r=>r.name,Pie=r=>r._id,Nie=r=>r.name,Rie=r=>r._id;function Mie(r,e,t){let n,i,l,s,o;ae(r,ms,A=>t(14,l=A)),ae(r,Zt,A=>t(2,s=A)),ae(r,Sn,A=>t(3,o=A));let{parameters:a}=e,{bindings:u=[]}=e;function f(A){const E=s.list.find(I=>I._id===A.datasourceId).source;return l[E].query[A.queryVerb]}function c(A){r.$$.not_equal(a.datasourceId,A)&&(a.datasourceId=A,t(0,a))}const p=A=>A.datasourceId===i._id;function d(A){r.$$.not_equal(a.queryId,A)&&(a.queryId=A,t(0,a))}function g(A){r.$$.not_equal(a.confirm,A)&&(a.confirm=A,t(0,a))}function h(A){r.$$.not_equal(a.confirmText,A)&&(a.confirmText=A,t(0,a))}function $(A){r.$$.not_equal(a.queryParams,A)&&(a.queryParams=A,t(0,a))}function w(A){u=A,t(1,u)}return r.$$set=A=>{"parameters"in A&&t(0,a=A.parameters),"bindings"in A&&t(1,u=A.bindings)},r.$$.update=()=>{r.$$.dirty&9&&t(5,n=o.list.find(A=>A._id===a.queryId)),r.$$.dirty&5&&t(4,i=s.list.find(A=>A._id===a.datasourceId))},[a,u,s,o,i,n,f,c,p,d,g,h,$,w]}class Die extends se{constructor(e){super();oe(this,e,Mie,Tie,ie,{parameters:0,bindings:1})}}const Ys={ROW_SAVED:"ROW_SAVED",ROW_UPDATED:"ROW_UPDATED",ROW_DELETED:"ROW_DELETED",WEBHOOK:"WEBHOOK",APP:"APP",CRON:"CRON"},Yi={SEND_EMAIL_SMTP:"SEND_EMAIL_SMTP",CREATE_ROW:"CREATE_ROW",UPDATE_ROW:"UPDATE_ROW",DELETE_ROW:"DELETE_ROW",OUTGOING_WEBHOOK:"OUTGOING_WEBHOOK",EXECUTE_SCRIPT:"EXECUTE_SCRIPT",EXECUTE_QUERY:"EXECUTE_QUERY",SERVER_LOG:"SERVER_LOG",DELAY:"DELAY",FILTER:"FILTER",QUERY_ROWS:"QUERY_ROWS",LOOP:"LOOP",discord:"discord",slack:"slack",zapier:"zapier",integromat:"integromat"};function Bie(r){let e;return{c(){e=U("Create a new automation")},m(t,n){b(t,e,n)},d(t){t&&v(e)}}}function jie(r){let e;return{c(){e=U("Use an existing automation")},m(t,n){b(t,e,n)},d(t){t&&v(e)}}}function zie(r){let e;return{c(){e=U("Automation")},m(t,n){b(t,e,n)},d(t){t&&v(e)}}}function qie(r){let e,t,n;function i(s){r[16](s)}let l={placeholder:"Enter automation name"};return r[0].newAutomationName!==void 0&&(l.value=r[0].newAutomationName),e=new et({props:l}),x.push(()=>pe(e,"value",i)),{c(){k(e.$$.fragment)},m(s,o){C(e,s,o),n=!0},p(s,o){const a={};!t&&o&1&&(t=!0,a.value=s[0].newAutomationName,de(()=>t=!1)),e.$set(a)},i(s){n||(m(e.$$.fragment,s),n=!0)},o(s){_(e.$$.fragment,s),n=!1},d(s){S(e,s)}}}function Uie(r){let e,t,n;function i(s){r[15](s)}let l={placeholder:"Choose automation",options:r[2],getOptionLabel:Hie,getOptionValue:Wie};return r[0].automationId!==void 0&&(l.value=r[0].automationId),e=new Ye({props:l}),x.push(()=>pe(e,"value",i)),{c(){k(e.$$.fragment)},m(s,o){C(e,s,o),n=!0},p(s,o){const a={};o&4&&(a.options=s[2]),!t&&o&1&&(t=!0,a.value=s[0].automationId,de(()=>t=!1)),e.$set(a)},i(s){n||(m(e.$$.fragment,s),n=!0)},o(s){_(e.$$.fragment,s),n=!1},d(s){S(e,s)}}}function r6(r){let e,t,n,i,l;e=new Ge({props:{small:!0,$$slots:{default:[Fie]},$$scope:{ctx:r}}});function s(a){r[18](a)}let o={placeholder:"Are you sure you want to trigger this automation?"};return r[0].confirmText!==void 0&&(o.value=r[0].confirmText),n=new et({props:o}),x.push(()=>pe(n,"value",s)),{c(){k(e.$$.fragment),t=R(),k(n.$$.fragment)},m(a,u){C(e,a,u),b(a,t,u),C(n,a,u),l=!0},p(a,u){const f={};u&524288&&(f.$$scope={dirty:u,ctx:a}),e.$set(f);const c={};!i&&u&1&&(i=!0,c.value=a[0].confirmText,de(()=>i=!1)),n.$set(c)},i(a){l||(m(e.$$.fragment,a),m(n.$$.fragment,a),l=!0)},o(a){_(e.$$.fragment,a),_(n.$$.fragment,a),l=!1},d(a){S(e,a),a&&v(t),S(n,a)}}}function Fie(r){let e;return{c(){e=U("Confirm text")},m(t,n){b(t,e,n)},d(t){t&&v(e)}}}function i6(r){let e,t;return e=new Km({props:{schemaFields:r[4],parameterFields:r[0].fields,fieldLabel:"Field",bindings:r[1]}}),e.$on("change",r[7]),{c(){k(e.$$.fragment)},m(n,i){C(e,n,i),t=!0},p(n,i){const l={};i&16&&(l.schemaFields=n[4]),i&1&&(l.parameterFields=n[0].fields),i&2&&(l.bindings=n[1]),e.$set(l)},i(n){t||(m(e.$$.fragment,n),t=!0)},o(n){_(e.$$.fragment,n),t=!1},d(n){S(e,n)}}}function Vie(r){let e,t,n,i,l,s,o,a,u,f,c,p,d,g,h,$,w,A,E,I,T,P,M,B,j,H,W=r[0].automationId,Y,G,z;s=new Ge({props:{small:!0,$$slots:{default:[Bie]},$$scope:{ctx:r}}}),p=new Ge({props:{small:!0,grey:!r[5],$$slots:{default:[jie]},$$scope:{ctx:r}}}),h=new Ge({props:{small:!0,$$slots:{default:[zie]},$$scope:{ctx:r}}});const F=[Uie,qie],V=[];function X(ke,Re){return ke[3]===ke[6].EXISTING?0:1}w=X(r),A=V[w]=F[w](r),I=new Ge({props:{small:!0}});function Q(ke){r[17](ke)}let re={text:"Require confirmation"};r[0].confirm!==void 0&&(re.value=r[0].confirm),P=new gr({props:re}),x.push(()=>pe(P,"value",Q));let ne=r[0].confirm&&r6(r),ce=i6(r);return{c(){e=D("div"),t=D("div"),n=D("div"),i=D("input"),l=R(),k(s.$$.fragment),o=R(),a=D("div"),u=D("input"),c=R(),k(p.$$.fragment),d=R(),g=D("div"),k(h.$$.fragment),$=R(),A.c(),E=R(),k(I.$$.fragment),T=R(),k(P.$$.fragment),B=R(),ne&&ne.c(),j=R(),H=D("div"),ce.c(),y(i,"type","radio"),i.__value=r[6].NEW,i.value=i.__value,y(i,"class","svelte-zdxuks"),r[13][0].push(i),y(n,"class","radio-container svelte-zdxuks"),y(u,"type","radio"),u.__value=r[6].EXISTING,u.value=u.__value,u.disabled=f=!r[5],y(u,"class","svelte-zdxuks"),r[13][0].push(u),y(a,"class","radio-container svelte-zdxuks"),y(t,"class","radios svelte-zdxuks"),y(g,"class","params svelte-zdxuks"),y(H,"class","fields svelte-zdxuks"),y(e,"class","root svelte-zdxuks")},m(ke,Re){b(ke,e,Re),L(e,t),L(t,n),L(n,i),i.checked=i.__value===r[3],L(n,l),C(s,n,null),L(t,o),L(t,a),L(a,u),u.checked=u.__value===r[3],L(a,c),C(p,a,null),L(e,d),L(e,g),C(h,g,null),L(g,$),V[w].m(g,null),L(g,E),C(I,g,null),L(g,T),C(P,g,null),L(g,B),ne&&ne.m(g,null),L(e,j),L(e,H),ce.m(H,null),Y=!0,G||(z=[Le(i,"change",r[12]),Le(n,"click",r[8]),Le(u,"change",r[14]),Le(a,"click",function(){pt(r[5]?r[9]:null)&&(r[5]?r[9]:null).apply(this,arguments)})],G=!0)},p(ke,[Re]){r=ke,Re&8&&(i.checked=i.__value===r[3]);const Ce={};Re&524288&&(Ce.$$scope={dirty:Re,ctx:r}),s.$set(Ce),(!Y||Re&32&&f!==(f=!r[5]))&&(u.disabled=f),Re&8&&(u.checked=u.__value===r[3]);const _e={};Re&32&&(_e.grey=!r[5]),Re&524288&&(_e.$$scope={dirty:Re,ctx:r}),p.$set(_e);const $e={};Re&524288&&($e.$$scope={dirty:Re,ctx:r}),h.$set($e);let Pe=w;w=X(r),w===Pe?V[w].p(r,Re):(K(),_(V[Pe],1,1,()=>{V[Pe]=null}),Z(),A=V[w],A?A.p(r,Re):(A=V[w]=F[w](r),A.c()),m(A,1),A.m(g,E));const We={};!M&&Re&1&&(M=!0,We.value=r[0].confirm,de(()=>M=!1)),P.$set(We),r[0].confirm?ne?(ne.p(r,Re),Re&1&&m(ne,1)):(ne=r6(r),ne.c(),m(ne,1),ne.m(g,null)):ne&&(K(),_(ne,1,1,()=>{ne=null}),Z()),Re&1&&ie(W,W=r[0].automationId)?(K(),_(ce,1,1,we),Z(),ce=i6(r),ce.c(),m(ce,1),ce.m(H,null)):ce.p(r,Re)},i(ke){Y||(m(s.$$.fragment,ke),m(p.$$.fragment,ke),m(h.$$.fragment,ke),m(A),m(I.$$.fragment,ke),m(P.$$.fragment,ke),m(ne),m(ce),Y=!0)},o(ke){_(s.$$.fragment,ke),_(p.$$.fragment,ke),_(h.$$.fragment,ke),_(A),_(I.$$.fragment,ke),_(P.$$.fragment,ke),_(ne),_(ce),Y=!1},d(ke){ke&&v(e),r[13][0].splice(r[13][0].indexOf(i),1),S(s),r[13][0].splice(r[13][0].indexOf(u),1),S(p),S(h),V[w].d(),S(I),S(P),ne&&ne.d(),ce.d(ke),G=!1,On(z)}}}const Hie=r=>r.name,Wie=r=>r._id;function Gie(r,e,t){let n,i,l,s,o;ae(r,Pt,P=>t(11,o=P));let{parameters:a={}}=e,{bindings:u=[]}=e;const f={NEW:"new",EXISTING:"existing"};let c=a.automationId?f.EXISTING:f.NEW;const p=P=>{t(0,a.fields=P.detail,a)},d=()=>{t(3,c=f.NEW),t(0,a.automationId=void 0,a),t(0,a.fields={},a)},g=()=>{var P;t(3,c=f.EXISTING),t(0,a.newAutomationName="",a),t(0,a.fields={},a),t(0,a.automationId=(P=n[0])==null?void 0:P._id,a)},h=[[]];function $(){c=this.__value,t(3,c)}function w(){c=this.__value,t(3,c)}function A(P){r.$$.not_equal(a.automationId,P)&&(a.automationId=P,t(0,a))}function E(P){r.$$.not_equal(a.newAutomationName,P)&&(a.newAutomationName=P,t(0,a))}function I(P){r.$$.not_equal(a.confirm,P)&&(a.confirm=P,t(0,a))}function T(P){r.$$.not_equal(a.confirmText,P)&&(a.confirmText=P,t(0,a))}return r.$$set=P=>{"parameters"in P&&t(0,a=P.parameters),"bindings"in P&&t(1,u=P.bindings)},r.$$.update=()=>{r.$$.dirty&2048&&t(2,n=o.automations.filter(P=>{var M;return((M=P.definition.trigger)==null?void 0:M.stepId)===Ys.APP}).map(P=>{const M=Object.entries(P.definition.trigger.inputs.fields||{}).map(([B,j])=>({name:B,type:j}));return{name:P.name,_id:P._id,schema:M}})),r.$$.dirty&4&&t(5,i=n&&n.length>0),r.$$.dirty&5&&t(10,l=n==null?void 0:n.find(P=>P._id===(a==null?void 0:a.automationId))),r.$$.dirty&1024&&t(4,s=l==null?void 0:l.schema)},[a,u,n,c,s,i,f,p,d,g,l,o,$,h,w,A,E,I,T]}class Yie extends se{constructor(e){super();oe(this,e,Gie,Vie,ie,{parameters:0,bindings:1})}}function Jie(r){let e;return{c(){e=U("Form")},m(t,n){b(t,e,n)},d(t){t&&v(e)}}}function Xie(r){let e,t,n,i,l,s,o,a,u,f,c;t=new Ge({props:{small:!0,$$slots:{default:[Jie]},$$scope:{ctx:r}}});function p($){r[4]($)}let d={options:r[1],getOptionLabel:Qie,getOptionValue:Kie};r[0].componentId!==void 0&&(d.value=r[0].componentId),i=new Ye({props:d}),x.push(()=>pe(i,"value",p));function g($){r[5]($)}let h={text:"Validate only current step"};return r[0].onlyCurrentStep!==void 0&&(h.value=r[0].onlyCurrentStep),u=new gr({props:h}),x.push(()=>pe(u,"value",g)),{c(){e=D("div"),k(t.$$.fragment),n=R(),k(i.$$.fragment),s=R(),o=D("div"),a=R(),k(u.$$.fragment),y(e,"class","root svelte-ss4wgk")},m($,w){b($,e,w),C(t,e,null),L(e,n),C(i,e,null),L(e,s),L(e,o),L(e,a),C(u,e,null),c=!0},p($,[w]){const A={};w&64&&(A.$$scope={dirty:w,ctx:$}),t.$set(A);const E={};w&2&&(E.options=$[1]),!l&&w&1&&(l=!0,E.value=$[0].componentId,de(()=>l=!1)),i.$set(E);const I={};!f&&w&1&&(f=!0,I.value=$[0].onlyCurrentStep,de(()=>f=!1)),u.$set(I)},i($){c||(m(t.$$.fragment,$),m(i.$$.fragment,$),m(u.$$.fragment,$),c=!0)},o($){_(t.$$.fragment,$),_(i.$$.fragment,$),_(u.$$.fragment,$),c=!1},d($){$&&v(e),S(t),S(i),S(u)}}}const Qie=r=>r._instanceName,Kie=r=>r._id;function Zie(r,e,t){let n,i,l;ae(r,qe,u=>t(2,i=u)),ae(r,Xn,u=>t(3,l=u));let{parameters:s}=e;function o(u){r.$$.not_equal(s.componentId,u)&&(s.componentId=u,t(0,s))}function a(u){r.$$.not_equal(s.onlyCurrentStep,u)&&(s.onlyCurrentStep=u,t(0,s))}return r.$$set=u=>{"parameters"in u&&t(0,s=u.parameters)},r.$$.update=()=>{r.$$.dirty&12&&t(1,n=eu(l,i.selectedComponentId,"ValidateForm"))},[s,n,i,l,o,a]}class xie extends se{constructor(e){super();oe(this,e,Zie,Xie,ie,{parameters:0})}}function ele(r){let e;return{c(){e=U(`Please enter the URL you would like to be redirected to after logging out.
|
|
@@ -916,7 +916,7 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
916
916
|
`),t=D("i"),i=U(n),l=U("?"),s=U(`
|
|
917
917
|
This action cannot be undone.`)},m(o,a){b(o,e,a),b(o,t,a),L(t,i),L(t,l),b(o,s,a)},p(o,a){a&1&&n!==(n=o[0].name+"")&&Se(i,n)},d(o){o&&v(e),o&&v(t),o&&v(s)}}}function z_e(r){let e,t,n,i,l,s;e=new Pr({props:{$$slots:{control:[B_e],default:[D_e]},$$scope:{ctx:r}}});let o={okText:"Delete Automation",onOk:r[3],title:"Confirm Deletion",$$slots:{default:[j_e]},$$scope:{ctx:r}};n=new wr({props:o}),r[4](n);let a={automation:r[0]};return l=new N_e({props:a}),r[5](l),{c(){k(e.$$.fragment),t=R(),k(n.$$.fragment),i=R(),k(l.$$.fragment)},m(u,f){C(e,u,f),b(u,t,f),C(n,u,f),b(u,i,f),C(l,u,f),s=!0},p(u,[f]){const c={};f&134&&(c.$$scope={dirty:f,ctx:u}),e.$set(c);const p={};f&129&&(p.$$scope={dirty:f,ctx:u}),n.$set(p);const d={};f&1&&(d.automation=u[0]),l.$set(d)},i(u){s||(m(e.$$.fragment,u),m(n.$$.fragment,u),m(l.$$.fragment,u),s=!0)},o(u){_(e.$$.fragment,u),_(n.$$.fragment,u),_(l.$$.fragment,u),s=!1},d(u){S(e,u),u&&v(t),r[4](null),S(n,u),u&&v(i),r[5](null),S(l,u)}}}function q_e(r,e,t){let n;ae(r,Qt,f=>t(6,n=f));let{automation:i}=e,l,s;async function o(){try{await Pt.actions.delete(i),be.success("Automation deleted successfully"),n("../automate")}catch{be.error("Error deleting automation")}}function a(f){x[f?"unshift":"push"](()=>{l=f,t(1,l)})}function u(f){x[f?"unshift":"push"](()=>{s=f,t(2,s)})}return r.$$set=f=>{"automation"in f&&t(0,i=f.automation)},[i,l,s,o,a,u]}class U_e extends se{constructor(e){super();oe(this,e,q_e,z_e,ie,{automation:0})}}function Gk(r,e,t){const n=r.slice();return n[5]=e[t],n[7]=t,n}function F_e(r){let e,t,n;return e=new U_e({props:{automation:r[5]}}),{c(){k(e.$$.fragment),t=R()},m(i,l){C(e,i,l),b(i,t,l),n=!0},p(i,l){const s={};l&1&&(s.automation=i[5]),e.$set(s)},i(i){n||(m(e.$$.fragment,i),n=!0)},o(i){_(e.$$.fragment,i),n=!1},d(i){S(e,i),i&&v(t)}}}function Yk(r){let e,t;function n(){return r[3](r[5])}return e=new Fl({props:{border:r[7]>0,icon:"ShareAndroid",text:r[5].name,selected:r[5]._id===r[1],$$slots:{default:[F_e]},$$scope:{ctx:r}}}),e.$on("click",n),{c(){k(e.$$.fragment)},m(i,l){C(e,i,l),t=!0},p(i,l){r=i;const s={};l&1&&(s.text=r[5].name),l&3&&(s.selected=r[5]._id===r[1]),l&257&&(s.$$scope={dirty:l,ctx:r}),e.$set(s)},i(i){t||(m(e.$$.fragment,i),t=!0)},o(i){_(e.$$.fragment,i),t=!1},d(i){S(e,i)}}}function V_e(r){let e,t,n=r[0].automations,i=[];for(let s=0;s<n.length;s+=1)i[s]=Yk(Gk(r,n,s));const l=s=>_(i[s],1,1,()=>{i[s]=null});return{c(){e=D("div");for(let s=0;s<i.length;s+=1)i[s].c();y(e,"class","automations-list svelte-g64vb")},m(s,o){b(s,e,o);for(let a=0;a<i.length;a+=1)i[a].m(e,null);t=!0},p(s,[o]){if(o&7){n=s[0].automations;let a;for(a=0;a<n.length;a+=1){const u=Gk(s,n,a);i[a]?(i[a].p(u,o),m(i[a],1)):(i[a]=Yk(u),i[a].c(),m(i[a],1),i[a].m(e,null))}for(K(),a=n.length;a<i.length;a+=1)l(a);Z()}},i(s){if(!t){for(let o=0;o<n.length;o+=1)m(i[o]);t=!0}},o(s){i=i.filter(Boolean);for(let o=0;o<i.length;o+=1)_(i[o]);t=!1},d(s){s&&v(e),dt(i,s)}}}function H_e(r,e,t){let n,i,l;ae(r,Qt,a=>t(4,i=a)),ae(r,Pt,a=>t(0,l=a)),Et(async()=>{try{await Pt.actions.fetch()}catch{be.error("Error getting automations list")}});function s(a){Pt.actions.select(a),i(`./${a._id}`)}const o=a=>s(a);return r.$$.update=()=>{var a,u;r.$$.dirty&1&&t(1,n=(u=(a=l.selectedAutomation)==null?void 0:a.automation)==null?void 0:u._id)},[l,n,s,o]}class W_e extends se{constructor(e){super();oe(this,e,H_e,V_e,ie,{})}}function Jk(r,e,t){const n=r.slice();return n[17]=e[t][0],n[18]=e[t][1],n}function G_e(r){let e;return{c(){e=U(`Please name your automation, then select a trigger. Every automation must
|
|
918
918
|
start with a trigger.`)},m(t,n){b(t,e,n)},d(t){t&&v(e)}}}function Y_e(r){let e;return{c(){e=U("Triggers")},m(t,n){b(t,e,n)},d(t){t&&v(e)}}}function J_e(r){let e=r[18].name+"",t;return{c(){t=U(e)},m(n,i){b(n,t,i)},p(n,i){i&8&&e!==(e=n[18].name+"")&&Se(t,e)},d(n){n&&v(t)}}}function Xk(r){let e,t,n,i,l,s,o,a,u,f;n=new tt({props:{name:r[18].icon}}),s=new Ue({props:{size:"S",$$slots:{default:[J_e]},$$scope:{ctx:r}}});function c(){return r[13](r[18])}return{c(){e=D("div"),t=D("div"),k(n.$$.fragment),i=R(),l=D("span"),k(s.$$.fragment),o=R(),y(l,"class","icon-spacing svelte-d3iboa"),y(t,"class","item-body svelte-d3iboa"),y(e,"class","item svelte-d3iboa"),te(e,"selected",r[2]===r[18].name)},m(p,d){b(p,e,d),L(e,t),C(n,t,null),L(t,i),L(t,l),C(s,l,null),L(e,o),a=!0,u||(f=Le(e,"click",c),u=!0)},p(p,d){r=p;const g={};d&8&&(g.name=r[18].icon),n.$set(g);const h={};d&2097160&&(h.$$scope={dirty:d,ctx:r}),s.$set(h),d&12&&te(e,"selected",r[2]===r[18].name)},i(p){a||(m(n.$$.fragment,p),m(s.$$.fragment,p),a=!0)},o(p){_(n.$$.fragment,p),_(s.$$.fragment,p),a=!1},d(p){p&&v(e),S(n),S(s),u=!1,f()}}}function X_e(r){let e,t,n,i;e=new Ue({props:{size:"S",$$slots:{default:[Y_e]},$$scope:{ctx:r}}});let l=r[3],s=[];for(let a=0;a<l.length;a+=1)s[a]=Xk(Jk(r,l,a));const o=a=>_(s[a],1,1,()=>{s[a]=null});return{c(){k(e.$$.fragment),t=R(),n=D("div");for(let a=0;a<s.length;a+=1)s[a].c();y(n,"class","item-list svelte-d3iboa")},m(a,u){C(e,a,u),b(a,t,u),b(a,n,u);for(let f=0;f<s.length;f+=1)s[f].m(n,null);i=!0},p(a,u){const f={};if(u&2097152&&(f.$$scope={dirty:u,ctx:a}),e.$set(f),u&76){l=a[3];let c;for(c=0;c<l.length;c+=1){const p=Jk(a,l,c);s[c]?(s[c].p(p,u),m(s[c],1)):(s[c]=Xk(p),s[c].c(),m(s[c],1),s[c].m(n,null))}for(K(),c=l.length;c<s.length;c+=1)o(c);Z()}},i(a){if(!i){m(e.$$.fragment,a);for(let u=0;u<l.length;u+=1)m(s[u]);i=!0}},o(a){_(e.$$.fragment,a),s=s.filter(Boolean);for(let u=0;u<s.length;u+=1)_(s[u]);i=!1},d(a){S(e,a),a&&v(t),a&&v(n),dt(s,a)}}}function Q_e(r){let e,t,n,i,l,s,o,a,u,f;e=new Am({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."}}),n=new Ue({props:{size:"XS",$$slots:{default:[G_e]},$$scope:{ctx:r}}});function c(g){r[10](g)}function p(g){r[11](g)}let d={label:"Name"};return r[0]!==void 0&&(d.value=r[0]),r[4]!==void 0&&(d.error=r[4]),l=new et({props:d}),x.push(()=>pe(l,"value",c)),x.push(()=>pe(l,"error",p)),l.$on("change",r[12]),u=new Me({props:{noPadding:!0,$$slots:{default:[X_e]},$$scope:{ctx:r}}}),{c(){k(e.$$.fragment),t=R(),k(n.$$.fragment),i=R(),k(l.$$.fragment),a=R(),k(u.$$.fragment)},m(g,h){C(e,g,h),b(g,t,h),C(n,g,h),b(g,i,h),C(l,g,h),b(g,a,h),C(u,g,h),f=!0},p(g,h){const $={};h&2097152&&($.$$scope={dirty:h,ctx:g}),n.$set($);const w={};!s&&h&1&&(s=!0,w.value=g[0],de(()=>s=!1)),!o&&h&16&&(o=!0,w.error=g[4],de(()=>o=!1)),l.$set(w);const A={};h&2097164&&(A.$$scope={dirty:h,ctx:g}),u.$set(A)},i(g){f||(m(e.$$.fragment,g),m(n.$$.fragment,g),m(l.$$.fragment,g),m(u.$$.fragment,g),f=!0)},o(g){_(e.$$.fragment,g),_(n.$$.fragment,g),_(l.$$.fragment,g),_(u.$$.fragment,g),f=!1},d(g){S(e,g),g&&v(t),S(n,g),g&&v(i),S(l,g),g&&v(a),S(u,g)}}}function K_e(r){let e,t;return e=new zt({props:{title:"Create Automation",confirmText:"Save",size:"M",onConfirm:r[5],disabled:!r[2]||!r[0],$$slots:{default:[Q_e]},$$scope:{ctx:r}}}),{c(){k(e.$$.fragment)},m(n,i){C(e,n,i),t=!0},p(n,[i]){const l={};i&5&&(l.disabled=!n[2]||!n[0]),i&2097183&&(l.$$scope={dirty:i,ctx:n}),e.$set(l)},i(n){t||(m(e.$$.fragment,n),t=!0)},o(n){_(e.$$.fragment,n),t=!1},d(n){S(e,n)}}}function Z_e(r,e,t){let n,i,l,s,o,a;ae(r,Pt,I=>t(8,s=I)),ae(r,Qt,I=>t(16,o=I)),ae(r,Hs,I=>t(9,a=I));let u,f,c=!1,p,{webhookModal:d}=e;async function g(){var I;try{await Pt.actions.create({name:u,instanceId:n});const T=s.selectedAutomation.constructBlock("TRIGGER",p.stepId,p);Pt.actions.addBlockToAutomation(T),p.stepId===Ys.WEBHOOK&&d.show,await Pt.actions.save((I=s.selectedAutomation)==null?void 0:I.automation),be.success(`Automation ${u} created`),o(`./${s.selectedAutomation.automation._id}`)}catch{be.error("Error creating automation")}}const h=I=>{p=I,t(2,f=I.name)};function $(I){u=I,t(0,u)}function w(I){i=I,t(4,i),t(1,c),t(0,u)}const A=()=>t(1,c=!0),E=I=>h(I);return r.$$set=I=>{"webhookModal"in I&&t(7,d=I.webhookModal)},r.$$.update=()=>{r.$$.dirty&512&&(n=a._id),r.$$.dirty&3&&t(4,i=c&&!u?"Please specify a name for the automation.":null),r.$$.dirty&256&&t(3,l=Object.entries(s.blockDefinitions.TRIGGER))},[u,c,f,l,i,g,h,d,s,a,$,w,A,E]}class Qk extends se{constructor(e){super();oe(this,e,Z_e,K_e,ie,{webhookModal:7})}}function x_e(r){let e,t;return e=new Qk({props:{webhookModal:r[1]}}),{c(){k(e.$$.fragment)},m(n,i){C(e,n,i),t=!0},p(n,i){const l={};i&2&&(l.webhookModal=n[1]),e.$set(l)},i(n){t||(m(e.$$.fragment,n),t=!0)},o(n){_(e.$$.fragment,n),t=!1},d(n){S(e,n)}}}function ehe(r){let e,t,n,i;e=new W_e({});let l={$$slots:{default:[x_e]},$$scope:{ctx:r}};return n=new Ct({props:l}),r[2](n),{c(){k(e.$$.fragment),t=R(),k(n.$$.fragment)},m(s,o){C(e,s,o),b(s,t,o),C(n,s,o),i=!0},p(s,o){const a={};o&10&&(a.$$scope={dirty:o,ctx:s}),n.$set(a)},i(s){i||(m(e.$$.fragment,s),m(n.$$.fragment,s),i=!0)},o(s){_(e.$$.fragment,s),_(n.$$.fragment,s),i=!1},d(s){S(e,s),s&&v(t),r[2](null),S(n,s)}}}function the(r){let e,t;return e=new hn({props:{title:"Automations",$$slots:{default:[ehe]},$$scope:{ctx:r}}}),{c(){k(e.$$.fragment)},m(n,i){C(e,n,i),t=!0},p(n,i){const l={};i&11&&(l.$$scope={dirty:i,ctx:n}),e.$set(l)},i(n){t||(m(e.$$.fragment,n),t=!0)},o(n){_(e.$$.fragment,n),t=!1},d(n){S(e,n)}}}function nhe(r){let e,t,n,i,l,s;return t=new Kr({props:{selected:"Automations",$$slots:{default:[the]},$$scope:{ctx:r}}}),l=new tt({props:{hoverable:!0,name:"AddCircle"}}),l.$on("click",function(){pt(r[0].show)&&r[0].show.apply(this,arguments)}),{c(){e=D("div"),k(t.$$.fragment),n=R(),i=D("div"),k(l.$$.fragment),y(i,"class","add-button svelte-mcmub4"),y(e,"class","title svelte-mcmub4")},m(o,a){b(o,e,a),C(t,e,null),L(e,n),L(e,i),C(l,i,null),s=!0},p(o,[a]){r=o;const u={};a&11&&(u.$$scope={dirty:a,ctx:r}),t.$set(u)},i(o){s||(m(t.$$.fragment,o),m(l.$$.fragment,o),s=!0)},o(o){_(t.$$.fragment,o),_(l.$$.fragment,o),s=!1},d(o){o&&v(e),S(t),S(l)}}}function rhe(r,e,t){let{modal:n}=e,{webhookModal:i}=e;function l(s){x[s?"unshift":"push"](()=>{n=s,t(0,n)})}return r.$$set=s=>{"modal"in s&&t(0,n=s.modal),"webhookModal"in s&&t(1,i=s.webhookModal)},[n,i,l]}class ihe extends se{constructor(e){super();oe(this,e,rhe,nhe,ie,{modal:0,webhookModal:1})}}function Kk(r,e,t){const n=r.slice();return n[8]=e[t],n[10]=t,n}function Zk(r){var u;let e,t,n,i,l;function s(f){r[6](f)}let o={showTestStatus:!0,block:r[8],isTrigger:r[10]===0,testResult:(u=r[2])==null?void 0:u[r[10]]};r[3]!==void 0&&(o.showParameters=r[3]),e=new Pk({props:o}),x.push(()=>pe(e,"showParameters",s));let a=r[3]&&r[3][r[8].id]&&xk(r);return{c(){k(e.$$.fragment),n=R(),a&&a.c(),i=Oe()},m(f,c){C(e,f,c),b(f,n,c),a&&a.m(f,c),b(f,i,c),l=!0},p(f,c){var d;const p={};c&2&&(p.block=f[8]),c&4&&(p.testResult=(d=f[2])==null?void 0:d[f[10]]),!t&&c&8&&(t=!0,p.showParameters=f[3],de(()=>t=!1)),e.$set(p),f[3]&&f[3][f[8].id]?a?(a.p(f,c),c&10&&m(a,1)):(a=xk(f),a.c(),m(a,1),a.m(i.parentNode,i)):a&&(K(),_(a,1,1,()=>{a=null}),Z())},i(f){l||(m(e.$$.fragment,f),m(a),l=!0)},o(f){_(e.$$.fragment,f),_(a),l=!1},d(f){S(e,f),f&&v(n),a&&a.d(f),f&&v(i)}}}function xk(r){var a,u;let e,t,n,i,l,s;e=new Gt({props:{noMargin:!0}});let o=((u=(a=r[2])==null?void 0:a[r[10]])==null?void 0:u.outputs.iterations)&&e7(r);return l=new Kr({props:{noHorizPadding:!0,selected:"Input",$$slots:{default:[ahe]},$$scope:{ctx:r}}}),{c(){k(e.$$.fragment),t=R(),o&&o.c(),n=R(),i=D("div"),k(l.$$.fragment),y(i,"class","tabs svelte-1iblsnb")},m(f,c){C(e,f,c),b(f,t,c),o&&o.m(f,c),b(f,n,c),b(f,i,c),C(l,i,null),s=!0},p(f,c){var d,g;((g=(d=f[2])==null?void 0:d[f[10]])==null?void 0:g.outputs.iterations)?o?(o.p(f,c),c&4&&m(o,1)):(o=e7(f),o.c(),m(o,1),o.m(n.parentNode,n)):o&&(K(),_(o,1,1,()=>{o=null}),Z());const p={};c&2052&&(p.$$scope={dirty:c,ctx:f}),l.$set(p)},i(f){s||(m(e.$$.fragment,f),m(o),m(l.$$.fragment,f),s=!0)},o(f){_(e.$$.fragment,f),_(o),_(l.$$.fragment,f),s=!1},d(f){S(e,f),f&&v(t),o&&o.d(f),f&&v(n),f&&v(i),S(l)}}}function e7(r){let e,t,n,i,l,s;return t=new tt({props:{name:"Reuse"}}),l=new Ge({props:{$$slots:{default:[lhe]},$$scope:{ctx:r}}}),{c(){e=D("div"),k(t.$$.fragment),n=R(),i=D("div"),k(l.$$.fragment),ft(i,"margin-left","10px"),ft(e,"display","flex"),ft(e,"padding","10px 10px 0px 12px")},m(o,a){b(o,e,a),C(t,e,null),L(e,n),L(e,i),C(l,i,null),s=!0},p(o,a){const u={};a&2052&&(u.$$scope={dirty:a,ctx:o}),l.$set(u)},i(o){s||(m(t.$$.fragment,o),m(l.$$.fragment,o),s=!0)},o(o){_(t.$$.fragment,o),_(l.$$.fragment,o),s=!1},d(o){o&&v(e),S(t),S(l)}}}function lhe(r){var l,s;let e,t=((s=(l=r[2])==null?void 0:l[r[10]])==null?void 0:s.outputs.iterations)+"",n,i;return{c(){e=U("This loop ran "),n=U(t),i=U(" times.")},m(o,a){b(o,e,a),b(o,n,a),b(o,i,a)},p(o,a){var u,f;a&4&&t!==(t=((f=(u=o[2])==null?void 0:u[o[10]])==null?void 0:f.outputs.iterations)+"")&&Se(n,t)},d(o){o&&v(e),o&&v(n),o&&v(i)}}}function she(r){var n,i;let e,t;return e=new bi({props:{minHeight:"80px",disabled:!0,value:Nc((i=(n=r[2])==null?void 0:n[r[10]])==null?void 0:i.inputs,"No input")}}),{c(){k(e.$$.fragment)},m(l,s){C(e,l,s),t=!0},p(l,s){var a,u;const o={};s&4&&(o.value=Nc((u=(a=l[2])==null?void 0:a[l[10]])==null?void 0:u.inputs,"No input")),e.$set(o)},i(l){t||(m(e.$$.fragment,l),t=!0)},o(l){_(e.$$.fragment,l),t=!1},d(l){S(e,l)}}}function ohe(r){var n,i;let e,t;return e=new bi({props:{minHeight:"100px",disabled:!0,value:Nc((i=(n=r[2])==null?void 0:n[r[10]])==null?void 0:i.outputs,"No output")}}),{c(){k(e.$$.fragment)},m(l,s){C(e,l,s),t=!0},p(l,s){var a,u;const o={};s&4&&(o.value=Nc((u=(a=l[2])==null?void 0:a[l[10]])==null?void 0:u.outputs,"No output")),e.$set(o)},i(l){t||(m(e.$$.fragment,l),t=!0)},o(l){_(e.$$.fragment,l),t=!1},d(l){S(e,l)}}}function ahe(r){let e,t,n,i;return e=new hn({props:{title:"Input",$$slots:{default:[she]},$$scope:{ctx:r}}}),n=new hn({props:{title:"Output",$$slots:{default:[ohe]},$$scope:{ctx:r}}}),{c(){k(e.$$.fragment),t=R(),k(n.$$.fragment)},m(l,s){C(e,l,s),b(l,t,s),C(n,l,s),i=!0},p(l,s){const o={};s&2052&&(o.$$scope={dirty:s,ctx:l}),e.$set(o);const a={};s&2052&&(a.$$scope={dirty:s,ctx:l}),n.$set(a)},i(l){i||(m(e.$$.fragment,l),m(n.$$.fragment,l),i=!0)},o(l){_(e.$$.fragment,l),_(n.$$.fragment,l),i=!1},d(l){S(e,l),l&&v(t),S(n,l)}}}function t7(r){let e;return{c(){e=D("div"),y(e,"class","separator svelte-1iblsnb")},m(t,n){b(t,e,n)},d(t){t&&v(e)}}}function n7(r){let e,t,n,i,l,s=r[8].stepId!==Yi.LOOP&&Zk(r),o=r[1].length-1!==r[10]&&t7();return{c(){e=D("div"),s&&s.c(),n=R(),o&&o.c(),i=Oe(),y(e,"class","block svelte-1iblsnb"),y(e,"style",t=r[0]?`width: ${r[0]}`:"")},m(a,u){b(a,e,u),s&&s.m(e,null),b(a,n,u),o&&o.m(a,u),b(a,i,u),l=!0},p(a,u){a[8].stepId!==Yi.LOOP?s?(s.p(a,u),u&2&&m(s,1)):(s=Zk(a),s.c(),m(s,1),s.m(e,null)):s&&(K(),_(s,1,1,()=>{s=null}),Z()),(!l||u&1&&t!==(t=a[0]?`width: ${a[0]}`:""))&&y(e,"style",t),a[1].length-1!==a[10]?o||(o=t7(),o.c(),o.m(i.parentNode,i)):o&&(o.d(1),o=null)},i(a){l||(m(s),l=!0)},o(a){_(s),l=!1},d(a){a&&v(e),s&&s.d(),a&&v(n),o&&o.d(a),a&&v(i)}}}function uhe(r){let e,t,n=r[1],i=[];for(let s=0;s<n.length;s+=1)i[s]=n7(Kk(r,n,s));const l=s=>_(i[s],1,1,()=>{i[s]=null});return{c(){e=D("div");for(let s=0;s<i.length;s+=1)i[s].c();y(e,"class","container svelte-1iblsnb")},m(s,o){b(s,e,o);for(let a=0;a<i.length;a+=1)i[a].m(e,null);t=!0},p(s,[o]){if(o&15){n=s[1];let a;for(a=0;a<n.length;a+=1){const u=Kk(s,n,a);i[a]?(i[a].p(u,o),m(i[a],1)):(i[a]=n7(u),i[a].c(),m(i[a],1),i[a].m(e,null))}for(K(),a=n.length;a<i.length;a+=1)l(a);Z()}},i(s){if(!t){for(let o=0;o<n.length;o+=1)m(i[o]);t=!0}},o(s){i=i.filter(Boolean);for(let o=0;o<i.length;o+=1)_(i[o]);t=!1},d(s){s&&v(e),dt(i,s)}}}function Nc(r,e){return r?JSON.stringify(r,null,2):e}function fhe(r,e,t){let n,{automation:i}=e,{testResults:l}=e,{width:s="400px"}=e,o,a;function u(c){return c==null?void 0:c.steps.filter(p=>p.stepId!==Yi.LOOP||[])}function f(c){o=c,t(3,o)}return r.$$set=c=>{"automation"in c&&t(4,i=c.automation),"testResults"in c&&t(5,l=c.testResults),"width"in c&&t(0,s=c.width)},r.$$.update=()=>{if(r.$$.dirty&32&&t(2,n=u(l)),r.$$.dirty&22){if(t(1,a=[]),i)i.definition.trigger&&a.push(i.definition.trigger),t(1,a=a.concat(i.definition.steps||[]).filter(c=>c.stepId!==Yi.LOOP));else if(n){t(1,a=n||[]);let c=0;for(let p of a)p.id=c++}}},[s,a,n,o,i,l,f]}class r7 extends se{constructor(e){super();oe(this,e,fhe,uhe,ie,{automation:4,testResults:5,width:0})}}function che(r){let e,t,n,i,l,s,o,a,u,f,c,p,d;return n=new tt({props:{name:"MultipleCheck"}}),a=new tt({props:{hoverable:!0,name:"Close"}}),a.$on("click",r[4]),f=new Gt({}),p=new r7({props:{automation:r[1],testResults:r[0]}}),{c(){e=D("div"),t=D("div"),k(n.$$.fragment),i=R(),l=D("div"),l.textContent="Test Details",s=R(),o=D("div"),k(a.$$.fragment),u=R(),k(f.$$.fragment),c=R(),k(p.$$.fragment),ft(l,"padding-left","var(--spacing-l)"),y(t,"class","title-text svelte-nwwj95"),ft(o,"padding-right","var(--spacing-xl)"),y(e,"class","title svelte-nwwj95")},m(g,h){b(g,e,h),L(e,t),C(n,t,null),L(t,i),L(t,l),L(e,s),L(e,o),C(a,o,null),b(g,u,h),C(f,g,h),b(g,c,h),C(p,g,h),d=!0},p(g,[h]){const $={};h&2&&($.automation=g[1]),h&1&&($.testResults=g[0]),p.$set($)},i(g){d||(m(n.$$.fragment,g),m(a.$$.fragment,g),m(f.$$.fragment,g),m(p.$$.fragment,g),d=!0)},o(g){_(n.$$.fragment,g),_(a.$$.fragment,g),_(f.$$.fragment,g),_(p.$$.fragment,g),d=!1},d(g){g&&v(e),S(n),S(a),g&&v(u),S(f,g),g&&v(c),S(p,g)}}}function phe(r,e,t){let n;ae(r,Pt,a=>t(2,n=a));let{automation:i}=e,{testResults:l}=e,s;const o=async()=>{gn(Pt,n.showTestPanel=!1,n)};return r.$$set=a=>{"automation"in a&&t(1,i=a.automation),"testResults"in a&&t(0,l=a.testResults)},r.$$.update=()=>{var a;r.$$.dirty&5&&(l||t(0,l=(a=n.selectedAutomation)==null?void 0:a.testResults)),r.$$.dirty&11&&(t(3,s=[]),i?(i.definition.trigger&&s.push(i.definition.trigger),t(3,s=s.concat(i.definition.steps||[]).filter(u=>u.stepId!==Yi.LOOP))):l&&t(3,s=l.steps||[]))},[l,i,n,s,o]}class dhe extends se{constructor(e){super();oe(this,e,phe,che,ie,{automation:1,testResults:0})}}function mhe(r){let e,t,n,i;return n=new Me({props:{gap:"S",justifyItems:"center",$$slots:{default:[bhe]},$$scope:{ctx:r}}}),{c(){e=D("div"),t=D("div"),k(n.$$.fragment),y(t,"class","main svelte-374m3f"),y(e,"class","centered svelte-374m3f")},m(l,s){b(l,e,s),L(e,t),C(n,t,null),i=!0},p(l,s){const o={};s&258&&(o.$$scope={dirty:s,ctx:l}),n.$set(o)},i(l){i||(m(n.$$.fragment,l),i=!0)},o(l){_(n.$$.fragment,l),i=!1},d(l){l&&v(e),S(n)}}}function ghe(r){let e;const t=r[4].default,n=ht(t,r,r[8],null);return{c(){n&&n.c()},m(i,l){n&&n.m(i,l),e=!0},p(i,l){n&&n.p&&(!e||l&256)&&$t(n,t,i,i[8],e?vt(t,i[8],l,null):bt(i[8]),null)},i(i){e||(m(n,i),e=!0)},o(i){_(n,i),e=!1},d(i){n&&n.d(i)}}}function _he(r){let e;return{c(){e=U("You have no automations")},m(t,n){b(t,e,n)},d(t){t&&v(e)}}}function hhe(r){let e;return{c(){e=U("Let's fix that. Call the bots!")},m(t,n){b(t,e,n)},d(t){t&&v(e)}}}function $he(r){let e;return{c(){e=U("Create automation")},m(t,n){b(t,e,n)},d(t){t&&v(e)}}}function bhe(r){let e,t,n,i,l,s,o,a,u;return i=new ut({props:{size:"M",$$slots:{default:[_he]},$$scope:{ctx:r}}}),s=new Ue({props:{size:"M",$$slots:{default:[hhe]},$$scope:{ctx:r}}}),a=new nt({props:{size:"M",cta:!0,$$slots:{default:[$he]},$$scope:{ctx:r}}}),a.$on("click",r[5]),{c(){e=me("svg"),t=me("use"),n=R(),k(i.$$.fragment),l=R(),k(s.$$.fragment),o=R(),k(a.$$.fragment),Ht(t,"xlink:href","#spectrum-icon-18-WorkflowAdd"),y(e,"width","60px"),y(e,"height","60px"),y(e,"class","spectrum-Icon"),y(e,"focusable","false")},m(f,c){b(f,e,c),L(e,t),b(f,n,c),C(i,f,c),b(f,l,c),C(s,f,c),b(f,o,c),C(a,f,c),u=!0},p(f,c){const p={};c&256&&(p.$$scope={dirty:c,ctx:f}),i.$set(p);const d={};c&256&&(d.$$scope={dirty:c,ctx:f}),s.$set(d);const g={};c&256&&(g.$$scope={dirty:c,ctx:f}),a.$set(g)},i(f){u||(m(i.$$.fragment,f),m(s.$$.fragment,f),m(a.$$.fragment,f),u=!0)},o(f){_(i.$$.fragment,f),_(s.$$.fragment,f),_(a.$$.fragment,f),u=!1},d(f){f&&v(e),f&&v(n),S(i,f),f&&v(l),S(s,f),f&&v(o),S(a,f)}}}function i7(r){let e,t,n;return t=new dhe({props:{automation:r[3]}}),{c(){e=D("div"),k(t.$$.fragment),y(e,"class","setup svelte-374m3f")},m(i,l){b(i,e,l),C(t,e,null),n=!0},p(i,l){const s={};l&8&&(s.automation=i[3]),t.$set(s)},i(i){n||(m(t.$$.fragment,i),n=!0)},o(i){_(t.$$.fragment,i),n=!1},d(i){i&&v(e),S(t)}}}function vhe(r){let e,t;return e=new Qk({props:{webhookModal:r[2]}}),{c(){k(e.$$.fragment)},m(n,i){C(e,n,i),t=!0},p(n,i){const l={};i&4&&(l.webhookModal=n[2]),e.$set(l)},i(n){t||(m(e.$$.fragment,n),t=!0)},o(n){_(e.$$.fragment,n),t=!1},d(n){S(e,n)}}}function whe(r){let e,t;return e=new u1({}),{c(){k(e.$$.fragment)},m(n,i){C(e,n,i),t=!0},i(n){t||(m(e.$$.fragment,n),t=!0)},o(n){_(e.$$.fragment,n),t=!1},d(n){S(e,n)}}}function yhe(r){let e,t,n,i,l,s,o,a,u,f,c,p,d;n=new ihe({props:{modal:r[1],webhookModal:r[2]}});const g=[ghe,mhe],h=[];function $(I,T){return I[3]?0:1}s=$(r),o=h[s]=g[s](r);let w=r[0].showTestPanel&&i7(r),A={$$slots:{default:[vhe]},$$scope:{ctx:r}};f=new Ct({props:A}),r[6](f);let E={width:"30%",$$slots:{default:[whe]},$$scope:{ctx:r}};return p=new Ct({props:E}),r[7](p),{c(){e=D("div"),t=D("div"),k(n.$$.fragment),i=R(),l=D("div"),o.c(),a=R(),w&&w.c(),u=R(),k(f.$$.fragment),c=R(),k(p.$$.fragment),y(t,"class","nav svelte-374m3f"),y(l,"class","content svelte-374m3f"),y(e,"class","root svelte-374m3f")},m(I,T){b(I,e,T),L(e,t),C(n,t,null),L(e,i),L(e,l),h[s].m(l,null),L(e,a),w&&w.m(e,null),L(e,u),C(f,e,null),L(e,c),C(p,e,null),d=!0},p(I,[T]){const P={};T&2&&(P.modal=I[1]),T&4&&(P.webhookModal=I[2]),n.$set(P);let M=s;s=$(I),s===M?h[s].p(I,T):(K(),_(h[M],1,1,()=>{h[M]=null}),Z(),o=h[s],o?o.p(I,T):(o=h[s]=g[s](I),o.c()),m(o,1),o.m(l,null)),I[0].showTestPanel?w?(w.p(I,T),T&1&&m(w,1)):(w=i7(I),w.c(),m(w,1),w.m(e,u)):w&&(K(),_(w,1,1,()=>{w=null}),Z());const B={};T&260&&(B.$$scope={dirty:T,ctx:I}),f.$set(B);const j={};T&256&&(j.$$scope={dirty:T,ctx:I}),p.$set(j)},i(I){d||(m(n.$$.fragment,I),m(o),m(w),m(f.$$.fragment,I),m(p.$$.fragment,I),d=!0)},o(I){_(n.$$.fragment,I),_(o),_(w),_(f.$$.fragment,I),_(p.$$.fragment,I),d=!1},d(I){I&&v(e),S(n),h[s].d(),w&&w.d(),r[6](null),S(f),r[7](null),S(p)}}}function khe(r,e,t){let n,i;ae(r,Pt,p=>t(0,i=p));let{$$slots:l={},$$scope:s}=e,o,a;Et(()=>{gn(Pt,i.showTestPanel=!1,i)});const u=()=>o.show();function f(p){x[p?"unshift":"push"](()=>{o=p,t(1,o)})}function c(p){x[p?"unshift":"push"](()=>{a=p,t(2,a)})}return r.$$set=p=>{"$$scope"in p&&t(8,s=p.$$scope)},r.$$.update=()=>{var p;r.$$.dirty&1&&t(3,n=((p=i.selectedAutomation)==null?void 0:p.automation)||i.automations[0])},[i,o,a,n,l,u,f,c,s]}class Che extends se{constructor(e){super();oe(this,e,khe,yhe,ie,{})}}function She(r){let e,t,n,i,l,s,o;function a(f){r[4](f)}let u={};return r[2]!==void 0&&(u.value=r[2]),l=new et({props:u}),x.push(()=>pe(l,"value",a)),{c(){e=D("span"),e.textContent=`The changes you have made will be deleted and the application reverted
|
|
919
|
-
back to its production state.`,t=R(),n=D("span"),n.textContent="Please enter your app name to continue.",i=R(),k(l.$$.fragment)},m(f,c){b(f,e,c),b(f,t,c),b(f,n,c),b(f,i,c),C(l,f,c),o=!0},p(f,c){const p={};!s&&c&4&&(s=!0,p.value=f[2],de(()=>s=!1)),l.$set(p)},i(f){o||(m(l.$$.fragment,f),o=!0)},o(f){_(l.$$.fragment,f),o=!1},d(f){f&&v(e),f&&v(t),f&&v(n),f&&v(i),S(l,f)}}}function Ahe(r){let e,t;return e=new zt({props:{title:"Revert Changes",confirmText:"Revert",onConfirm:r[3],disabled:r[2]!==r[0].name,$$slots:{default:[She]},$$scope:{ctx:r}}}),{c(){k(e.$$.fragment)},m(n,i){C(e,n,i),t=!0},p(n,i){const l={};i&5&&(l.disabled=n[2]!==n[0].name),i&132&&(l.$$scope={dirty:i,ctx:n}),e.$set(l)},i(n){t||(m(e.$$.fragment,n),t=!0)},o(n){_(e.$$.fragment,n),t=!1},d(n){S(e,n)}}}function Ohe(r){let e,t,n,i;e=new tt({props:{name:"Revert",hoverable:!0,tooltip:"Revert changes",dataCy:"revert-application-topnav"}}),e.$on("click",function(){pt(r[1].show)&&r[1].show.apply(this,arguments)});let l={$$slots:{default:[Ahe]},$$scope:{ctx:r}};return n=new Ct({props:l}),r[5](n),{c(){k(e.$$.fragment),t=R(),k(n.$$.fragment)},m(s,o){C(e,s,o),b(s,t,o),C(n,s,o),i=!0},p(s,[o]){r=s;const a={};o&133&&(a.$$scope={dirty:o,ctx:r}),n.$set(a)},i(s){i||(m(e.$$.fragment,s),m(n.$$.fragment,s),i=!0)},o(s){_(e.$$.fragment,s),_(n.$$.fragment,s),i=!1},d(s){S(e,s),s&&v(t),r[5](null),S(n,s)}}}function Ehe(r,e,t){let n,i;ae(r,qe,f=>t(0,i=f));let l,s;const o=async()=>{try{await He.revertAppChanges(n);const f=await He.fetchAppPackage(n);await qe.actions.initialise(f),be.info("Changes reverted successfully")}catch(f){be.error(`Error reverting changes: ${f}`)}};function a(f){s=f,t(2,s)}function u(f){x[f?"unshift":"push"](()=>{l=f,t(1,l)})}return r.$$.update=()=>{r.$$.dirty&1&&(n=i.appId)},[i,l,s,o,a,u]}class Ihe extends se{constructor(e){super();oe(this,e,Ehe,Ohe,ie,{})}}const The="@budibase/client",Lhe="1.1.
|
|
919
|
+
back to its production state.`,t=R(),n=D("span"),n.textContent="Please enter your app name to continue.",i=R(),k(l.$$.fragment)},m(f,c){b(f,e,c),b(f,t,c),b(f,n,c),b(f,i,c),C(l,f,c),o=!0},p(f,c){const p={};!s&&c&4&&(s=!0,p.value=f[2],de(()=>s=!1)),l.$set(p)},i(f){o||(m(l.$$.fragment,f),o=!0)},o(f){_(l.$$.fragment,f),o=!1},d(f){f&&v(e),f&&v(t),f&&v(n),f&&v(i),S(l,f)}}}function Ahe(r){let e,t;return e=new zt({props:{title:"Revert Changes",confirmText:"Revert",onConfirm:r[3],disabled:r[2]!==r[0].name,$$slots:{default:[She]},$$scope:{ctx:r}}}),{c(){k(e.$$.fragment)},m(n,i){C(e,n,i),t=!0},p(n,i){const l={};i&5&&(l.disabled=n[2]!==n[0].name),i&132&&(l.$$scope={dirty:i,ctx:n}),e.$set(l)},i(n){t||(m(e.$$.fragment,n),t=!0)},o(n){_(e.$$.fragment,n),t=!1},d(n){S(e,n)}}}function Ohe(r){let e,t,n,i;e=new tt({props:{name:"Revert",hoverable:!0,tooltip:"Revert changes",dataCy:"revert-application-topnav"}}),e.$on("click",function(){pt(r[1].show)&&r[1].show.apply(this,arguments)});let l={$$slots:{default:[Ahe]},$$scope:{ctx:r}};return n=new Ct({props:l}),r[5](n),{c(){k(e.$$.fragment),t=R(),k(n.$$.fragment)},m(s,o){C(e,s,o),b(s,t,o),C(n,s,o),i=!0},p(s,[o]){r=s;const a={};o&133&&(a.$$scope={dirty:o,ctx:r}),n.$set(a)},i(s){i||(m(e.$$.fragment,s),m(n.$$.fragment,s),i=!0)},o(s){_(e.$$.fragment,s),_(n.$$.fragment,s),i=!1},d(s){S(e,s),s&&v(t),r[5](null),S(n,s)}}}function Ehe(r,e,t){let n,i;ae(r,qe,f=>t(0,i=f));let l,s;const o=async()=>{try{await He.revertAppChanges(n);const f=await He.fetchAppPackage(n);await qe.actions.initialise(f),be.info("Changes reverted successfully")}catch(f){be.error(`Error reverting changes: ${f}`)}};function a(f){s=f,t(2,s)}function u(f){x[f?"unshift":"push"](()=>{l=f,t(1,l)})}return r.$$.update=()=>{r.$$.dirty&1&&(n=i.appId)},[i,l,s,o,a,u]}class Ihe extends se{constructor(e){super();oe(this,e,Ehe,Ohe,ie,{})}}const The="@budibase/client",Lhe="1.1.18",Phe="MPL-2.0",Nhe="dist/budibase-client.js",Rhe="dist/budibase-client.js",Mhe="module",Dhe="src/index.js",Bhe={".":{import:"./dist/budibase-client.js",require:"./dist/budibase-client.js"},"./package.json":"./package.json","./manifest.json":"./manifest.json"},jhe={build:"rollup -c","dev:builder":"rollup -cw"},zhe={"@budibase/bbui":"^1.1.18","@budibase/frontend-core":"^1.1.18","@budibase/string-templates":"^1.1.18","@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",leaflet:"^1.7.1",regexparam:"^1.3.0","rollup-plugin-polyfill-node":"^0.8.0","sanitize-html":"^2.7.0",screenfull:"^6.0.1",shortid:"^2.2.15",svelte:"^3.38.2","svelte-apexcharts":"^1.0.2","svelte-flatpickr":"^3.1.0","svelte-spa-router":"^3.0.5"},qhe={"@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-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"},Uhe="d1836a898cab3f8ab80ee6d8f42be1a9eed7dcdc";var Xs={name:The,version:Lhe,license:Phe,module:Nhe,main:Rhe,type:Mhe,svelte:Dhe,exports:Bhe,scripts:jhe,dependencies:zhe,devDependencies:qhe,gitHead:Uhe};function l7(r){let e,t,n;return t=new tt({props:{name:"Refresh",hoverable:!0,tooltip:r[4]?"An update is available":"No updates are available"}}),t.$on("click",function(){pt(r[2].show)&&r[2].show.apply(this,arguments)}),{c(){e=D("div"),k(t.$$.fragment),y(e,"class","icon-wrapper svelte-18djg2h"),te(e,"highlight",r[4])},m(i,l){b(i,e,l),C(t,e,null),n=!0},p(i,l){r=i;const s={};l&16&&(s.tooltip=r[4]?"An update is available":"No updates are available"),t.$set(s),l&16&&te(e,"highlight",r[4])},i(i){n||(m(t.$$.fragment,i),n=!0)},o(i){_(t.$$.fragment,i),n=!1},d(i){i&&v(e),S(t)}}}function Fhe(r){let e,t;return e=new Ue({props:{size:"S",$$slots:{default:[Hhe]},$$scope:{ctx:r}}}),{c(){k(e.$$.fragment)},m(n,i){C(e,n,i),t=!0},p(n,i){const l={};i&4098&&(l.$$scope={dirty:i,ctx:n}),e.$set(l)},i(n){t||(m(e.$$.fragment,n),t=!0)},o(n){_(e.$$.fragment,n),t=!1},d(n){S(e,n)}}}function Vhe(r){let e,t;return e=new Ue({props:{size:"S",$$slots:{default:[Whe]},$$scope:{ctx:r}}}),{c(){k(e.$$.fragment)},m(n,i){C(e,n,i),t=!0},p(n,i){const l={};i&4098&&(l.$$scope={dirty:i,ctx:n}),e.$set(l)},i(n){t||(m(e.$$.fragment,n),t=!0)},o(n){_(e.$$.fragment,n),t=!1},d(n){S(e,n)}}}function Hhe(r){let e,t,n=r[1].version+"",i,l;return{c(){e=U("This app is currently using version "),t=D("b"),i=U(n),l=U(` which is the
|
|
920
920
|
latest version available.`)},m(s,o){b(s,e,o),b(s,t,o),L(t,i),b(s,l,o)},p(s,o){o&2&&n!==(n=s[1].version+"")&&Se(i,n)},d(s){s&&v(e),s&&v(t),s&&v(l)}}}function Whe(r){let e,t,n=r[1].version+"",i,l,s,o;return{c(){e=U("This app is currently using version "),t=D("b"),i=U(n),l=U(`, but version
|
|
921
921
|
`),s=D("b"),s.textContent=`${Xs.version}`,o=U(` is available. Updates can contain new features,
|
|
922
922
|
performance improvements and bug fixes.`)},m(a,u){b(a,e,u),b(a,t,u),L(t,i),b(a,l,u),b(a,s,u),b(a,o,u)},p(a,u){u&2&&n!==(n=a[1].version+"")&&Se(i,n)},d(a){a&&v(e),a&&v(t),a&&v(l),a&&v(s),a&&v(o)}}}function s7(r){let e,t;return e=new Ue({props:{size:"S",$$slots:{default:[Ghe]},$$scope:{ctx:r}}}),{c(){k(e.$$.fragment)},m(n,i){C(e,n,i),t=!0},p(n,i){const l={};i&4098&&(l.$$scope={dirty:i,ctx:n}),e.$set(l)},i(n){t||(m(e.$$.fragment,n),t=!0)},o(n){_(e.$$.fragment,n),t=!1},d(n){S(e,n)}}}function Ghe(r){let e,t,n=r[1].revertableVersion+"",i,l;return{c(){e=U(`You can revert this app to version
|