@budibase/server 3.4.12 → 3.4.13

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.
@@ -20,7 +20,7 @@ var _d=Object.defineProperty;var bd=(vr,Ea,vo)=>Ea in vr?_d(vr,Ea,{enumerable:!0
20
20
  }`,E=`__svelte_${hash(T)}_${k}`,H=get_root_for_style(p),{stylesheet:F,rules:Z}=managed_styles.get(H)||create_style_information(H,p);Z[E]||(Z[E]=!0,F.insertRule(`@keyframes ${E} ${T}`,F.cssRules.length));const $=p.style.animation||"";return p.style.animation=`${$?`${$}, `:""}${E} ${m}ms linear ${v}ms 1 both`,active$1+=1,E}function delete_rule(p,u){const f=(p.style.animation||"").split(", "),m=f.filter(u?y=>y.indexOf(u)<0:y=>y.indexOf("__svelte")===-1),v=f.length-m.length;v&&(p.style.animation=m.join(", "),active$1-=v,active$1||clear_rules())}function clear_rules(){raf(()=>{active$1||(managed_styles.forEach(p=>{const{ownerNode:u}=p.stylesheet;u&&detach(u)}),managed_styles.clear())})}function create_animation(p,u,f,m){if(!u)return noop$2;const v=p.getBoundingClientRect();if(u.left===v.left&&u.right===v.right&&u.top===v.top&&u.bottom===v.bottom)return noop$2;const{delay:y=0,duration:w=300,easing:k=identity$2,start:S=now$1()+y,end:M=S+w,tick:T=noop$2,css:E}=f(p,{from:u,to:v},m);let H=!0,F=!1,Z;function $(){E&&(Z=create_rule(p,0,1,w,y,k,E)),y||(F=!0)}function J(){E&&delete_rule(p,Z),H=!1}return loop(se=>{if(!F&&se>=S&&(F=!0),F&&se>=M&&(T(1,0),J()),!H)return!1;if(F){const ie=se-S,he=0+1*k(ie/w);T(he,1-he)}return!0}),$(),T(0,1),J}function fix_position(p){const u=getComputedStyle(p);if(u.position!=="absolute"&&u.position!=="fixed"){const{width:f,height:m}=u,v=p.getBoundingClientRect();p.style.position="absolute",p.style.width=f,p.style.height=m,add_transform(p,v)}}function add_transform(p,u){const f=p.getBoundingClientRect();if(u.left!==f.left||u.top!==f.top){const m=getComputedStyle(p),v=m.transform==="none"?"":m.transform;p.style.transform=`${v} translate(${u.left-f.left}px, ${u.top-f.top}px)`}}let current_component;function set_current_component(p){current_component=p}function get_current_component(){if(!current_component)throw new Error("Function called outside component initialization");return current_component}function beforeUpdate(p){get_current_component().$$.before_update.push(p)}function onMount(p){get_current_component().$$.on_mount.push(p)}function afterUpdate(p){get_current_component().$$.after_update.push(p)}function onDestroy(p){get_current_component().$$.on_destroy.push(p)}function createEventDispatcher(){const p=get_current_component();return(u,f,{cancelable:m=!1}={})=>{const v=p.$$.callbacks[u];if(v){const y=custom_event(u,f,{cancelable:m});return v.slice().forEach(w=>{w.call(p,y)}),!y.defaultPrevented}return!0}}function setContext(p,u){return get_current_component().$$.context.set(p,u),u}function getContext$1(p){return get_current_component().$$.context.get(p)}function getAllContexts(){return get_current_component().$$.context}function hasContext(p){return get_current_component().$$.context.has(p)}function bubble(p,u){const f=p.$$.callbacks[u.type];f&&f.slice().forEach(m=>m.call(this,u))}const dirty_components=[],intros={enabled:!1},binding_callbacks=[];let render_callbacks=[];const flush_callbacks=[],resolved_promise=Promise.resolve();let update_scheduled=!1;function schedule_update(){update_scheduled||(update_scheduled=!0,resolved_promise.then(flush))}function tick(){return schedule_update(),resolved_promise}function add_render_callback(p){render_callbacks.push(p)}function add_flush_callback(p){flush_callbacks.push(p)}const seen_callbacks=new Set;let flushidx=0;function flush(){if(flushidx!==0)return;const p=current_component;do{try{for(;flushidx<dirty_components.length;){const u=dirty_components[flushidx];flushidx++,set_current_component(u),update(u.$$)}}catch(u){throw dirty_components.length=0,flushidx=0,u}for(set_current_component(null),dirty_components.length=0,flushidx=0;binding_callbacks.length;)binding_callbacks.pop()();for(let u=0;u<render_callbacks.length;u+=1){const f=render_callbacks[u];seen_callbacks.has(f)||(seen_callbacks.add(f),f())}render_callbacks.length=0}while(dirty_components.length);for(;flush_callbacks.length;)flush_callbacks.pop()();update_scheduled=!1,seen_callbacks.clear(),set_current_component(p)}function update(p){if(p.fragment!==null){p.update(),run_all(p.before_update);const u=p.dirty;p.dirty=[-1],p.fragment&&p.fragment.p(p.ctx,u),p.after_update.forEach(add_render_callback)}}function flush_render_callbacks(p){const u=[],f=[];render_callbacks.forEach(m=>p.indexOf(m)===-1?u.push(m):f.push(m)),f.forEach(m=>m()),render_callbacks=u}let promise;function wait(){return promise||(promise=Promise.resolve(),promise.then(()=>{promise=null})),promise}function dispatch(p,u,f){p.dispatchEvent(custom_event(`${u?"intro":"outro"}${f}`))}const outroing=new Set;let outros;function group_outros(){outros={r:0,c:[],p:outros}}function check_outros(){outros.r||run_all(outros.c),outros=outros.p}function transition_in(p,u){p&&p.i&&(outroing.delete(p),p.i(u))}function transition_out(p,u,f,m){if(p&&p.o){if(outroing.has(p))return;outroing.add(p),outros.c.push(()=>{outroing.delete(p),m&&(f&&p.d(1),m())}),p.o(u)}else m&&m()}const null_transition={duration:0};function create_in_transition(p,u,f){const m={direction:"in"};let v=u(p,f,m),y=!1,w,k,S=0;function M(){w&&delete_rule(p,w)}function T(){const{delay:H=0,duration:F=300,easing:Z=identity$2,tick:$=noop$2,css:J}=v||null_transition;J&&(w=create_rule(p,0,1,F,H,Z,J,S++)),$(0,1);const se=now$1()+H,ie=se+F;k&&k.abort(),y=!0,add_render_callback(()=>dispatch(p,!0,"start")),k=loop(he=>{if(y){if(he>=ie)return $(1,0),dispatch(p,!0,"end"),M(),y=!1;if(he>=se){const fe=Z((he-se)/F);$(fe,1-fe)}}return y})}let E=!1;return{start(){E||(E=!0,delete_rule(p),is_function(v)?(v=v(m),wait().then(T)):T())},invalidate(){E=!1},end(){y&&(M(),y=!1)}}}function create_out_transition(p,u,f){const m={direction:"out"};let v=u(p,f,m),y=!0,w;const k=outros;k.r+=1;let S;function M(){const{delay:T=0,duration:E=300,easing:H=identity$2,tick:F=noop$2,css:Z}=v||null_transition;Z&&(w=create_rule(p,1,0,E,T,H,Z));const $=now$1()+T,J=$+E;add_render_callback(()=>dispatch(p,!1,"start")),"inert"in p&&(S=p.inert,p.inert=!0),loop(se=>{if(y){if(se>=J)return F(0,1),dispatch(p,!1,"end"),--k.r||run_all(k.c),!1;if(se>=$){const ie=H((se-$)/E);F(1-ie,ie)}}return y})}return is_function(v)?wait().then(()=>{v=v(m),M()}):M(),{end(T){T&&"inert"in p&&(p.inert=S),T&&v.tick&&v.tick(1,0),y&&(w&&delete_rule(p,w),y=!1)}}}function create_bidirectional_transition(p,u,f,m){let y=u(p,f,{direction:"both"}),w=m?0:1,k=null,S=null,M=null,T;function E(){M&&delete_rule(p,M)}function H(Z,$){const J=Z.b-w;return $*=Math.abs(J),{a:w,b:Z.b,d:J,duration:$,start:Z.start,end:Z.start+$,group:Z.group}}function F(Z){const{delay:$=0,duration:J=300,easing:se=identity$2,tick:ie=noop$2,css:he}=y||null_transition,fe={start:now$1()+$,b:Z};Z||(fe.group=outros,outros.r+=1),"inert"in p&&(Z?T!==void 0&&(p.inert=T):(T=p.inert,p.inert=!0)),k||S?S=fe:(he&&(E(),M=create_rule(p,w,Z,J,$,se,he)),Z&&ie(0,1),k=H(fe,J),add_render_callback(()=>dispatch(p,Z,"start")),loop(pe=>{if(S&&pe>S.start&&(k=H(S,J),S=null,dispatch(p,k.b,"start"),he&&(E(),M=create_rule(p,w,k.b,k.duration,0,se,y.css))),k){if(pe>=k.end)ie(w=k.b,1-w),dispatch(p,k.b,"end"),S||(k.b?E():--k.group.r||run_all(k.group.c)),k=null;else if(pe>=k.start){const ve=pe-k.start;w=k.a+k.d*se(ve/k.duration),ie(w,1-w)}}return!!(k||S)}))}return{run(Z){is_function(y)?wait().then(()=>{y=y({direction:Z?"in":"out"}),F(Z)}):F(Z)},end(){E(),k=S=null}}}function handle_promise(p,u){const f=u.token={};function m(v,y,w,k){if(u.token!==f)return;u.resolved=k;let S=u.ctx;w!==void 0&&(S=S.slice(),S[w]=k);const M=v&&(u.current=v)(S);let T=!1;u.block&&(u.blocks?u.blocks.forEach((E,H)=>{H!==y&&E&&(group_outros(),transition_out(E,1,1,()=>{u.blocks[H]===E&&(u.blocks[H]=null)}),check_outros())}):u.block.d(1),M.c(),transition_in(M,1),M.m(u.mount(),u.anchor),T=!0),u.block=M,u.blocks&&(u.blocks[y]=M),T&&flush()}if(is_promise(p)){const v=get_current_component();if(p.then(y=>{set_current_component(v),m(u.then,1,u.value,y),set_current_component(null)},y=>{if(set_current_component(v),m(u.catch,2,u.error,y),set_current_component(null),!u.hasCatch)throw y}),u.current!==u.pending)return m(u.pending,0),!0}else{if(u.current!==u.then)return m(u.then,1,u.value,p),!0;u.resolved=p}}function update_await_block_branch(p,u,f){const m=u.slice(),{resolved:v}=p;p.current===p.then&&(m[p.value]=v),p.current===p.catch&&(m[p.error]=v),p.block.p(m,f)}function ensure_array_like(p){return(p==null?void 0:p.length)!==void 0?p:Array.from(p)}function destroy_block(p,u){p.d(1),u.delete(p.key)}function outro_and_destroy_block(p,u){transition_out(p,1,1,()=>{u.delete(p.key)})}function fix_and_destroy_block(p,u){p.f(),destroy_block(p,u)}function fix_and_outro_and_destroy_block(p,u){p.f(),outro_and_destroy_block(p,u)}function update_keyed_each(p,u,f,m,v,y,w,k,S,M,T,E){let H=p.length,F=y.length,Z=H;const $={};for(;Z--;)$[p[Z].key]=Z;const J=[],se=new Map,ie=new Map,he=[];for(Z=F;Z--;){const Ae=E(v,y,Z),ze=f(Ae);let Se=w.get(ze);Se?m&&he.push(()=>Se.p(Ae,u)):(Se=M(ze,Ae),Se.c()),se.set(ze,J[Z]=Se),ze in $&&ie.set(ze,Math.abs(Z-$[ze]))}const fe=new Set,pe=new Set;function ve(Ae){transition_in(Ae,1),Ae.m(k,T),w.set(Ae.key,Ae),T=Ae.first,F--}for(;H&&F;){const Ae=J[F-1],ze=p[H-1],Se=Ae.key,Le=ze.key;Ae===ze?(T=Ae.first,H--,F--):se.has(Le)?!w.has(Se)||fe.has(Se)?ve(Ae):pe.has(Le)?H--:ie.get(Se)>ie.get(Le)?(pe.add(Se),ve(Ae)):(fe.add(Le),H--):(S(ze,w),H--)}for(;H--;){const Ae=p[H];se.has(Ae.key)||S(Ae,w)}for(;F;)ve(J[F-1]);return run_all(he),J}function validate_each_keys(p,u,f,m){const v=new Map;for(let y=0;y<u.length;y++){const w=m(f(p,u,y));if(v.has(w)){let k="";try{k=`with value '${String(w)}' `}catch{}throw new Error(`Cannot have duplicate keys in a keyed each: Keys at index ${v.get(w)} and ${y} ${k}are duplicates`)}v.set(w,y)}}function get_spread_update(p,u){const f={},m={},v={$$scope:1};let y=p.length;for(;y--;){const w=p[y],k=u[y];if(k){for(const S in w)S in k||(m[S]=1);for(const S in k)v[S]||(f[S]=k[S],v[S]=1);p[y]=k}else for(const S in w)v[S]=1}for(const w in m)w in f||(f[w]=void 0);return f}function get_spread_object(p){return typeof p=="object"&&p!==null?p:{}}const _boolean_attributes=["allowfullscreen","allowpaymentrequest","async","autofocus","autoplay","checked","controls","default","defer","disabled","formnovalidate","hidden","inert","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","readonly","required","reversed","selected"],boolean_attributes=new Set([..._boolean_attributes]),ATTR_REGEX=/[&"<]/g,CONTENT_REGEX=/[&<]/g;function escape$1(p,u=!1){const f=String(p),m=u?ATTR_REGEX:CONTENT_REGEX;m.lastIndex=0;let v="",y=0;for(;m.test(f);){const w=m.lastIndex-1,k=f[w];v+=f.substring(y,w)+(k==="&"?"&amp;":k==='"'?"&quot;":"&lt;"),y=w+1}return v+f.substring(y)}const void_element_names=/^(?:area|base|br|col|command|embed|hr|img|input|keygen|link|meta|param|source|track|wbr)$/;function is_void(p){return void_element_names.test(p)||p.toLowerCase()==="!doctype"}const invalid_attribute_name_character=/[\s'">/=\u{FDD0}-\u{FDEF}\u{FFFE}\u{FFFF}\u{1FFFE}\u{1FFFF}\u{2FFFE}\u{2FFFF}\u{3FFFE}\u{3FFFF}\u{4FFFE}\u{4FFFF}\u{5FFFE}\u{5FFFF}\u{6FFFE}\u{6FFFF}\u{7FFFE}\u{7FFFF}\u{8FFFE}\u{8FFFF}\u{9FFFE}\u{9FFFF}\u{AFFFE}\u{AFFFF}\u{BFFFE}\u{BFFFF}\u{CFFFE}\u{CFFFF}\u{DFFFE}\u{DFFFF}\u{EFFFE}\u{EFFFF}\u{FFFFE}\u{FFFFF}\u{10FFFE}\u{10FFFF}]/u;function spread(p,u){const f=Object.assign({},...p);if(u){const v=u.classes,y=u.styles;v&&(f.class==null?f.class=v:f.class+=" "+v),y&&(f.style==null?f.style=style_object_to_string(y):f.style=style_object_to_string(merge_ssr_styles(f.style,y)))}let m="";return Object.keys(f).forEach(v=>{if(invalid_attribute_name_character.test(v))return;const y=f[v];y===!0?m+=" "+v:boolean_attributes.has(v.toLowerCase())?y&&(m+=" "+v):y!=null&&(m+=` ${v}="${y}"`)}),m}function merge_ssr_styles(p,u){const f={};for(const m of p.split(";")){const v=m.indexOf(":"),y=m.slice(0,v).trim(),w=m.slice(v+1).trim();y&&(f[y]=w)}for(const m in u){const v=u[m];v?f[m]=v:delete f[m]}return f}function escape_attribute_value(p){return typeof p=="string"||p&&typeof p=="object"?escape$1(p,!0):p}function escape_object(p){const u={};for(const f in p)u[f]=escape_attribute_value(p[f]);return u}function each$2(p,u){p=ensure_array_like(p);let f="";for(let m=0;m<p.length;m+=1)f+=u(p[m],m);return f}const missing_component={$$render:()=>""};function validate_component(p,u){if(!p||!p.$$render)throw u==="svelte:component"&&(u+=" this={...}"),new Error(`<${u}> is not a valid SSR component. You may need to review your build config to ensure that dependencies are compiled, rather than imported as pre-compiled modules. Otherwise you may need to fix a <${u}>.`);return p}function debug(p,u,f,m){return console.log(`{@debug} ${p?p+" ":""}(${u}:${f})`),console.log(m),""}let on_destroy;function create_ssr_component(p){function u(f,m,v,y,w){const k=current_component,S={on_destroy,context:new Map(w||(k?k.$$.context:[])),on_mount:[],before_update:[],after_update:[],callbacks:blank_object()};set_current_component({$$:S});const M=p(f,m,v,y);return set_current_component(k),M}return{render:(f={},{$$slots:m={},context:v=new Map}={})=>{on_destroy=[];const y={title:"",head:"",css:new Set},w=u(y,f,{},m,v);return run_all(on_destroy),{html:w,css:{code:Array.from(y.css).map(k=>k.code).join(`
21
21
  `),map:null},head:y.title+y.head}},$$render:u}}function add_attribute(p,u,f){if(u==null||f&&!u)return"";const m=f&&u===!0?"":`="${escape$1(u,!0)}"`;return` ${p}${m}`}function add_classes(p){return p?` class="${p}"`:""}function style_object_to_string(p){return Object.keys(p).filter(u=>p[u]!=null&&p[u]!=="").map(u=>`${u}: ${escape_attribute_value(p[u])};`).join(" ")}function add_styles(p){const u=style_object_to_string(p);return u?` style="${u}"`:""}function bind(p,u,f){const m=p.$$.props[u];m!==void 0&&(p.$$.bound[m]=f,f(p.$$.ctx[m]))}function create_component(p){p&&p.c()}function claim_component(p,u){p&&p.l(u)}function mount_component(p,u,f){const{fragment:m,after_update:v}=p.$$;m&&m.m(u,f),add_render_callback(()=>{const y=p.$$.on_mount.map(run).filter(is_function);p.$$.on_destroy?p.$$.on_destroy.push(...y):run_all(y),p.$$.on_mount=[]}),v.forEach(add_render_callback)}function destroy_component(p,u){const f=p.$$;f.fragment!==null&&(flush_render_callbacks(f.after_update),run_all(f.on_destroy),f.fragment&&f.fragment.d(u),f.on_destroy=f.fragment=null,f.ctx=[])}function make_dirty(p,u){p.$$.dirty[0]===-1&&(dirty_components.push(p),schedule_update(),p.$$.dirty.fill(0)),p.$$.dirty[u/31|0]|=1<<u%31}function init$1(p,u,f,m,v,y,w=null,k=[-1]){const S=current_component;set_current_component(p);const M=p.$$={fragment:null,ctx:[],props:y,update:noop$2,not_equal:v,bound:blank_object(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(u.context||(S?S.$$.context:[])),callbacks:blank_object(),dirty:k,skip_bound:!1,root:u.target||S.$$.root};w&&w(M.root);let T=!1;if(M.ctx=f?f(p,u.props||{},(E,H,...F)=>{const Z=F.length?F[0]:H;return M.ctx&&v(M.ctx[E],M.ctx[E]=Z)&&(!M.skip_bound&&M.bound[E]&&M.bound[E](Z),T&&make_dirty(p,E)),H}):[],M.update(),T=!0,run_all(M.before_update),M.fragment=m?m(M.ctx):!1,u.target){if(u.hydrate){start_hydrating();const E=children(u.target);M.fragment&&M.fragment.l(E),E.forEach(detach)}else M.fragment&&M.fragment.c();u.intro&&transition_in(p.$$.fragment),mount_component(p,u.target,u.anchor),end_hydrating(),flush()}set_current_component(S)}let SvelteElement;typeof HTMLElement=="function"&&(SvelteElement=class extends HTMLElement{constructor(u,f,m){super();ua(this,"$$ctor");ua(this,"$$s");ua(this,"$$c");ua(this,"$$cn",!1);ua(this,"$$d",{});ua(this,"$$r",!1);ua(this,"$$p_d",{});ua(this,"$$l",{});ua(this,"$$l_u",new Map);this.$$ctor=u,this.$$s=f,m&&this.attachShadow({mode:"open"})}addEventListener(u,f,m){if(this.$$l[u]=this.$$l[u]||[],this.$$l[u].push(f),this.$$c){const v=this.$$c.$on(u,f);this.$$l_u.set(f,v)}super.addEventListener(u,f,m)}removeEventListener(u,f,m){if(super.removeEventListener(u,f,m),this.$$c){const v=this.$$l_u.get(f);v&&(v(),this.$$l_u.delete(f))}}async connectedCallback(){if(this.$$cn=!0,!this.$$c){let u=function(y){return()=>{let w;return{c:function(){w=element("slot"),y!=="default"&&attr(w,"name",y)},m:function(M,T){insert(M,w,T)},d:function(M){M&&detach(w)}}}};if(await Promise.resolve(),!this.$$cn||this.$$c)return;const f={},m=get_custom_elements_slots(this);for(const y of this.$$s)y in m&&(f[y]=[u(y)]);for(const y of this.attributes){const w=this.$$g_p(y.name);w in this.$$d||(this.$$d[w]=get_custom_element_value(w,y.value,this.$$p_d,"toProp"))}for(const y in this.$$p_d)!(y in this.$$d)&&this[y]!==void 0&&(this.$$d[y]=this[y],delete this[y]);this.$$c=new this.$$ctor({target:this.shadowRoot||this,props:{...this.$$d,$$slots:f,$$scope:{ctx:[]}}});const v=()=>{this.$$r=!0;for(const y in this.$$p_d)if(this.$$d[y]=this.$$c.$$.ctx[this.$$c.$$.props[y]],this.$$p_d[y].reflect){const w=get_custom_element_value(y,this.$$d[y],this.$$p_d,"toAttribute");w==null?this.removeAttribute(this.$$p_d[y].attribute||y):this.setAttribute(this.$$p_d[y].attribute||y,w)}this.$$r=!1};this.$$c.$$.after_update.push(v),v();for(const y in this.$$l)for(const w of this.$$l[y]){const k=this.$$c.$on(y,w);this.$$l_u.set(w,k)}this.$$l={}}}attributeChangedCallback(u,f,m){var v;this.$$r||(u=this.$$g_p(u),this.$$d[u]=get_custom_element_value(u,m,this.$$p_d,"toProp"),(v=this.$$c)==null||v.$set({[u]:this.$$d[u]}))}disconnectedCallback(){this.$$cn=!1,Promise.resolve().then(()=>{!this.$$cn&&this.$$c&&(this.$$c.$destroy(),this.$$c=void 0)})}$$g_p(u){return Object.keys(this.$$p_d).find(f=>this.$$p_d[f].attribute===u||!this.$$p_d[f].attribute&&f.toLowerCase()===u)||u}});function get_custom_element_value(p,u,f,m){var y;const v=(y=f[p])==null?void 0:y.type;if(u=v==="Boolean"&&typeof u!="boolean"?u!=null:u,!m||!f[p])return u;if(m==="toAttribute")switch(v){case"Object":case"Array":return u==null?null:JSON.stringify(u);case"Boolean":return u?"":null;case"Number":return u??null;default:return u}else switch(v){case"Object":case"Array":return u&&JSON.parse(u);case"Boolean":return u;case"Number":return u!=null?+u:u;default:return u}}function create_custom_element(p,u,f,m,v,y){let w=class extends SvelteElement{constructor(){super(p,f,v),this.$$p_d=u}static get observedAttributes(){return Object.keys(u).map(k=>(u[k].attribute||k).toLowerCase())}};return Object.keys(u).forEach(k=>{Object.defineProperty(w.prototype,k,{get(){return this.$$c&&k in this.$$c?this.$$c[k]:this.$$d[k]},set(S){var M;S=get_custom_element_value(k,S,u),this.$$d[k]=S,(M=this.$$c)==null||M.$set({[k]:S})}})}),m.forEach(k=>{Object.defineProperty(w.prototype,k,{get(){var S;return(S=this.$$c)==null?void 0:S[k]}})}),y&&(w=y(w)),p.element=w,w}class SvelteComponent{constructor(){ua(this,"$$");ua(this,"$$set")}$destroy(){destroy_component(this,1),this.$destroy=noop$2}$on(u,f){if(!is_function(f))return noop$2;const m=this.$$.callbacks[u]||(this.$$.callbacks[u]=[]);return m.push(f),()=>{const v=m.indexOf(f);v!==-1&&m.splice(v,1)}}$set(u){this.$$set&&!is_empty(u)&&(this.$$.skip_bound=!0,this.$$set(u),this.$$.skip_bound=!1)}}const VERSION$2="4.2.19",PUBLIC_VERSION="4";function dispatch_dev(p,u){document.dispatchEvent(custom_event(p,{version:VERSION$2,...u},{bubbles:!0}))}function append_dev(p,u){dispatch_dev("SvelteDOMInsert",{target:p,node:u}),append$2(p,u)}function append_hydration_dev(p,u){dispatch_dev("SvelteDOMInsert",{target:p,node:u}),append_hydration(p,u)}function insert_dev(p,u,f){dispatch_dev("SvelteDOMInsert",{target:p,node:u,anchor:f}),insert(p,u,f)}function insert_hydration_dev(p,u,f){dispatch_dev("SvelteDOMInsert",{target:p,node:u,anchor:f}),insert_hydration(p,u,f)}function detach_dev(p){dispatch_dev("SvelteDOMRemove",{node:p}),detach(p)}function detach_between_dev(p,u){for(;p.nextSibling&&p.nextSibling!==u;)detach_dev(p.nextSibling)}function detach_before_dev(p){for(;p.previousSibling;)detach_dev(p.previousSibling)}function detach_after_dev(p){for(;p.nextSibling;)detach_dev(p.nextSibling)}function listen_dev(p,u,f,m,v,y,w){const k=m===!0?["capture"]:m?Array.from(Object.keys(m)):[];v&&k.push("preventDefault"),y&&k.push("stopPropagation"),w&&k.push("stopImmediatePropagation"),dispatch_dev("SvelteDOMAddEventListener",{node:p,event:u,handler:f,modifiers:k});const S=listen(p,u,f,m);return()=>{dispatch_dev("SvelteDOMRemoveEventListener",{node:p,event:u,handler:f,modifiers:k}),S()}}function attr_dev(p,u,f){attr(p,u,f),f==null?dispatch_dev("SvelteDOMRemoveAttribute",{node:p,attribute:u}):dispatch_dev("SvelteDOMSetAttribute",{node:p,attribute:u,value:f})}function prop_dev(p,u,f){p[u]=f,dispatch_dev("SvelteDOMSetProperty",{node:p,property:u,value:f})}function dataset_dev(p,u,f){p.dataset[u]=f,dispatch_dev("SvelteDOMSetDataset",{node:p,property:u,value:f})}function set_data_dev(p,u){u=""+u,p.data!==u&&(dispatch_dev("SvelteDOMSetData",{node:p,data:u}),p.data=u)}function set_data_contenteditable_dev(p,u){u=""+u,p.wholeText!==u&&(dispatch_dev("SvelteDOMSetData",{node:p,data:u}),p.data=u)}function set_data_maybe_contenteditable_dev(p,u,f){~contenteditable_truthy_values.indexOf(f)?set_data_contenteditable_dev(p,u):set_data_dev(p,u)}function ensure_array_like_dev(p){if(typeof p!="string"&&!(p&&typeof p=="object"&&"length"in p)&&!(typeof Symbol=="function"&&p&&Symbol.iterator in p))throw new Error("{#each} only works with iterable values.");return ensure_array_like(p)}function validate_slots(p,u,f){for(const m of Object.keys(u))~f.indexOf(m)||console.warn(`<${p}> received an unexpected slot "${m}".`)}function validate_dynamic_element(p){if(p&&!(typeof p=="string"))throw new Error('<svelte:element> expects "this" attribute to be a string.')}function validate_void_dynamic_element(p){p&&is_void(p)&&console.warn(`<svelte:element this="${p}"> is self-closing and cannot have content.`)}function construct_svelte_component_dev(p,u){const f="this={...} of <svelte:component> should specify a Svelte component.";try{const m=new p(u);if(!m.$$||!m.$set||!m.$on||!m.$destroy)throw new Error(f);return m}catch(m){const{message:v}=m;throw typeof v=="string"&&v.indexOf("is not a constructor")!==-1?new Error(f):m}}class SvelteComponentDev extends SvelteComponent{constructor(f){if(!f||!f.target&&!f.$$inline)throw new Error("'target' is a required option");super();ua(this,"$$prop_def");ua(this,"$$events_def");ua(this,"$$slot_def")}$destroy(){super.$destroy(),this.$destroy=()=>{console.warn("Component was already destroyed")}}$capture_state(){}$inject_state(){}}class SvelteComponentTyped extends SvelteComponentDev{}function loop_guard(p){const u=Date.now();return()=>{if(Date.now()-u>p)throw new Error("Infinite loop detected")}}const internal=Object.freeze(Object.defineProperty({__proto__:null,HtmlTag,HtmlTagHydration,ResizeObserverSingleton,SvelteComponent,SvelteComponentDev,SvelteComponentTyped,get SvelteElement(){return SvelteElement},action_destroyer,add_attribute,add_classes,add_flush_callback,add_iframe_resize_listener,add_location,add_render_callback,add_styles,add_transform,afterUpdate,append:append$2,append_dev,append_empty_stylesheet,append_hydration,append_hydration_dev,append_styles,assign,attr,attr_dev,attribute_to_object,beforeUpdate,bind,binding_callbacks,blank_object,bubble,check_outros,children,claim_comment,claim_component,claim_element,claim_html_tag,claim_space,claim_svg_element,claim_text,clear_loops,comment:comment$1,component_subscribe,compute_rest_props,compute_slots,construct_svelte_component,construct_svelte_component_dev,contenteditable_truthy_values,createEventDispatcher,create_animation,create_bidirectional_transition,create_component,create_custom_element,create_in_transition,create_out_transition,create_slot,create_ssr_component,get current_component(){return current_component},custom_event,dataset_dev,debug,destroy_block,destroy_component,destroy_each,detach,detach_after_dev,detach_before_dev,detach_between_dev,detach_dev,dirty_components,dispatch_dev,each:each$2,element,element_is,empty:empty$1,end_hydrating,ensure_array_like,ensure_array_like_dev,escape:escape$1,escape_attribute_value,escape_object,exclude_internal_props,fix_and_destroy_block,fix_and_outro_and_destroy_block,fix_position,flush,flush_render_callbacks,getAllContexts,getContext:getContext$1,get_all_dirty_from_scope,get_binding_group_value,get_current_component,get_custom_elements_slots,get_root_for_style,get_slot_changes,get_spread_object,get_spread_update,get_store_value,get_svelte_dataset,globals:globals$1,group_outros,handle_promise,hasContext,has_prop,head_selector,identity:identity$2,init:init$1,init_binding_group,init_binding_group_dynamic,insert,insert_dev,insert_hydration,insert_hydration_dev,intros,invalid_attribute_name_character,is_client,is_crossorigin,is_empty,is_function,is_promise,is_void,listen,listen_dev,loop,loop_guard,merge_ssr_styles,missing_component,mount_component,noop:noop$2,not_equal,get now(){return now$1},null_to_empty,object_without_properties,onDestroy,onMount,once:once$2,outro_and_destroy_block,prevent_default,prop_dev,query_selector_all,get raf(){return raf},resize_observer_border_box,resize_observer_content_box,resize_observer_device_pixel_content_box,run,run_all,safe_not_equal,schedule_update,select_multiple_value,select_option,select_options,select_value,self:self$1,setContext,set_attributes,set_current_component,set_custom_element_data,set_custom_element_data_map,set_data,set_data_contenteditable,set_data_contenteditable_dev,set_data_dev,set_data_maybe_contenteditable,set_data_maybe_contenteditable_dev,set_dynamic_element_data,set_input_type,set_input_value,set_now,set_raf,set_store_value,set_style,set_svg_attributes,space,split_css_unit,spread,src_url_equal,srcset_url_equal,start_hydrating,stop_immediate_propagation,stop_propagation,stringify_spread,subscribe,svg_element,text:text$1,tick,time_ranges_to_array,to_number,toggle_class,transition_in,transition_out,trusted,update_await_block_branch,update_keyed_each,update_slot,update_slot_base,validate_component,validate_dynamic_element,validate_each_keys,validate_slots,validate_store,validate_void_dynamic_element,xlink_attr},Symbol.toStringTag,{value:"Module"}));typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(PUBLIC_VERSION);const subscriber_queue=[];function readable(p,u){return{subscribe:writable(p,u).subscribe}}function writable(p,u=noop$2){let f;const m=new Set;function v(k){if(safe_not_equal(p,k)&&(p=k,f)){const S=!subscriber_queue.length;for(const M of m)M[1](),subscriber_queue.push(M,p);if(S){for(let M=0;M<subscriber_queue.length;M+=2)subscriber_queue[M][0](subscriber_queue[M+1]);subscriber_queue.length=0}}}function y(k){v(k(p))}function w(k,S=noop$2){const M=[k,S];return m.add(M),m.size===1&&(f=u(v,y)||noop$2),k(p),()=>{m.delete(M),m.size===0&&f&&(f(),f=null)}}return{set:v,update:y,subscribe:w}}function derived(p,u,f){const m=!Array.isArray(p),v=m?[p]:p;if(!v.every(Boolean))throw new Error("derived() expects stores as input, got a falsy value");const y=u.length<2;return readable(f,(w,k)=>{let S=!1;const M=[];let T=0,E=noop$2;const H=()=>{if(T)return;E();const Z=u(m?M[0]:M,w,k);y?w(Z):E=is_function(Z)?Z:noop$2},F=v.map((Z,$)=>subscribe(Z,J=>{M[$]=J,T&=~(1<<$),S&&H()},()=>{T|=1<<$}));return S=!0,H(),function(){run_all(F),E(),S=!1}})}const svelte=Object.freeze(Object.defineProperty({__proto__:null,SvelteComponent:SvelteComponentDev,SvelteComponentTyped,afterUpdate,beforeUpdate,createEventDispatcher,getAllContexts,getContext:getContext$1,hasContext,onDestroy,onMount,setContext,tick},Symbol.toStringTag,{value:"Module"})),bbui="",indexVars$I="";var PopoverAlignment=(p=>(p.Left="left",p.Right="right",p.LeftOutside="left-outside",p.RightOutside="right-outside",p.Center="center",p.RightContextMenu="right-context-menu",p.LeftContextMenu="left-context-menu",p))(PopoverAlignment||{}),TooltipPosition=(p=>(p.Top="top",p.Right="right",p.Bottom="bottom",p.Left="left",p))(TooltipPosition||{}),TooltipType=(p=>(p.Default="default",p.Info="info",p.Positive="positive",p.Negative="negative",p))(TooltipType||{});const indexVars$H="";function create_fragment$3T(p){let u,f,m,v,y;const w=p[2].default,k=create_slot(w,p,p[1],null);return{c(){u=element("div"),k&&k.c(),u.hidden=!0},m(S,M){insert(S,u,M),k&&k.m(u,null),m=!0,v||(y=action_destroyer(f=portal.call(null,u,p[0])),v=!0)},p(S,[M]){k&&k.p&&(!m||M&2)&&update_slot_base(k,w,S,S[1],m?get_slot_changes(w,S[1],M,null):get_all_dirty_from_scope(S[1]),null),f&&is_function(f.update)&&M&1&&f.update.call(null,S[0])},i(S){m||(transition_in(k,S),m=!0)},o(S){transition_out(k,S),m=!1},d(S){S&&detach(u),k&&k.d(S),v=!1,y()}}}function portal(p,u="body"){let f;async function m(y){if(u=y,typeof u=="string"){if(f=document.querySelector(u),f===null&&(await tick(),f=document.querySelector(u)),f===null)throw new Error(`No element found matching css selector: "${u}"`)}else if(u instanceof HTMLElement)f=u;else throw new TypeError(`Unknown portal target type: ${u===null?"null":typeof u}. Allowed types: string (CSS selector) or HTMLElement.`);f.appendChild(p),p.hidden=!1}function v(){p.parentNode&&p.parentNode.removeChild(p)}return m(u),{update:m,destroy:v}}function instance$3R(p,u,f){let{$$slots:m={},$$scope:v}=u,{target:y="body"}=u;return p.$$set=w=>{"target"in w&&f(0,y=w.target),"$$scope"in w&&f(1,v=w.$$scope)},[y,v,m]}class Portal extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$3R,create_fragment$3T,safe_not_equal,{target:0})}}function cubicOut(p){const u=p-1;return u*u*u+1}function fade(p,{delay:u=0,duration:f=400,easing:m=identity$2}={}){const v=+getComputedStyle(p).opacity;return{delay:u,duration:f,easing:m,css:y=>`opacity: ${y*v}`}}function fly(p,{delay:u=0,duration:f=400,easing:m=cubicOut,x:v=0,y=0,opacity:w=0}={}){const k=getComputedStyle(p),S=+k.opacity,M=k.transform==="none"?"":k.transform,T=S*(1-w),[E,H]=split_css_unit(v),[F,Z]=split_css_unit(y);return{delay:u,duration:f,easing:m,css:($,J)=>`
22
22
  transform: ${M} translate(${(1-$)*E}${H}, ${(1-$)*F}${Z});
23
- opacity: ${S-T*J}`}}const indexVars$G="",AbsTooltip_svelte_svelte_type_style_lang="";function create_if_block$2c(p){let u,f;return u=new Portal({props:{target:".spectrum",$$slots:{default:[create_default_slot$1V]},$$scope:{ctx:p}}}),{c(){create_component(u.$$.fragment)},m(m,v){mount_component(u,m,v),f=!0},p(m,v){const y={};v&132815&&(y.$$scope={dirty:v,ctx:m}),u.$set(y)},i(m){f||(transition_in(u.$$.fragment,m),f=!0)},o(m){transition_out(u.$$.fragment,m),f=!1},d(m){destroy_component(u,m)}}}function create_default_slot$1V(p){let u,f,m,v,y,w,k,S,M;return{c(){u=element("span"),f=element("span"),m=text$1(p[2]),v=space(),y=element("span"),attr(f,"class","spectrum-Tooltip-label svelte-9a74k9"),attr(y,"class","spectrum-Tooltip-tip svelte-9a74k9"),attr(y,"style",p[9]),attr(u,"class",w="spectrum-Tooltip spectrum-Tooltip--"+p[1]+" spectrum-Tooltip--"+p[0]+" is-open svelte-9a74k9"),attr(u,"style",k=`left:${p[6]}px;top:${p[7]}px;${p[10]}`),toggle_class(u,"noWrap",p[3])},m(T,E){insert(T,u,E),append$2(u,f),append$2(f,m),append$2(u,v),append$2(u,y),M=!0},p(T,E){(!M||E&4)&&set_data(m,T[2]),(!M||E&512)&&attr(y,"style",T[9]),(!M||E&3&&w!==(w="spectrum-Tooltip spectrum-Tooltip--"+T[1]+" spectrum-Tooltip--"+T[0]+" is-open svelte-9a74k9"))&&attr(u,"class",w),(!M||E&1216&&k!==(k=`left:${T[6]}px;top:${T[7]}px;${T[10]}`))&&attr(u,"style",k),(!M||E&11)&&toggle_class(u,"noWrap",T[3])},i(T){M||(T&&add_render_callback(()=>{M&&(S||(S=create_bidirectional_transition(u,fade,{duration:130},!0)),S.run(1))}),M=!0)},o(T){T&&(S||(S=create_bidirectional_transition(u,fade,{duration:130},!1)),S.run(0)),M=!1},d(T){T&&detach(u),T&&S&&S.end()}}}function create_fragment$3S(p){let u,f,m,v,y,w;const k=p[13].default,S=create_slot(k,p,p[17],null);let M=p[8]&&p[2]&&p[6]!=null&&p[7]!=null&&create_if_block$2c(p);return{c(){u=element("div"),S&&S.c(),f=space(),M&&M.c(),m=empty$1(),attr(u,"class","abs-tooltip svelte-9a74k9")},m(T,E){insert(T,u,E),S&&S.m(u,null),p[14](u),insert(T,f,E),M&&M.m(T,E),insert(T,m,E),v=!0,y||(w=[listen(u,"focus",null),listen(u,"mouseover",p[15]),listen(u,"mouseleave",p[16])],y=!0)},p(T,[E]){S&&S.p&&(!v||E&131072)&&update_slot_base(S,k,T,T[17],v?get_slot_changes(k,T[17],E,null):get_all_dirty_from_scope(T[17]),null),T[8]&&T[2]&&T[6]!=null&&T[7]!=null?M?(M.p(T,E),E&452&&transition_in(M,1)):(M=create_if_block$2c(T),M.c(),transition_in(M,1),M.m(m.parentNode,m)):M&&(group_outros(),transition_out(M,1,1,()=>{M=null}),check_outros())},i(T){v||(transition_in(S,T),transition_in(M),v=!0)},o(T){transition_out(S,T),transition_out(M),v=!1},d(T){T&&(detach(u),detach(f),detach(m)),S&&S.d(T),p[14](null),M&&M.d(T),y=!1,run_all(w)}}}function instance$3Q(p,u,f){let m,v,{$$slots:y={},$$scope:w}=u,{position:k=TooltipPosition.Top}=u,{type:S=TooltipType.Default}=u,{text:M=""}=u,{fixed:T=!1}=u,{color:E=void 0}=u,{noWrap:H=!1}=u,F,Z=!1,$,J,se=!1,ie,he;const fe=()=>{var Ue;const Le=(Ue=F==null?void 0:F.children)==null?void 0:Ue[0];if(!Le){f(6,$=void 0),f(7,J=void 0);return}const Ce=Le.getBoundingClientRect();k===TooltipPosition.Top?(f(6,$=Ce.left+Ce.width/2),f(7,J=Ce.top)):k===TooltipPosition.Right?(f(6,$=Ce.left+Ce.width),f(7,J=Ce.top+Ce.height/2)):k===TooltipPosition.Bottom?(f(6,$=Ce.left+Ce.width/2),f(7,J=Ce.top+Ce.height)):k===TooltipPosition.Left&&(f(6,$=Ce.left),f(7,J=Ce.top+Ce.height/2))},pe=()=>{fe(),he=setInterval(fe,100),f(8,se=!0)},ve=()=>{clearTimeout(ie),clearInterval(he),f(8,se=!1)};onDestroy(ve);function Ae(Le){binding_callbacks[Le?"unshift":"push"](()=>{F=Le,f(5,F)})}const ze=()=>f(4,Z=!0),Se=()=>f(4,Z=!1);return p.$$set=Le=>{"position"in Le&&f(0,k=Le.position),"type"in Le&&f(1,S=Le.type),"text"in Le&&f(2,M=Le.text),"fixed"in Le&&f(11,T=Le.fixed),"color"in Le&&f(12,E=Le.color),"noWrap"in Le&&f(3,H=Le.noWrap),"$$scope"in Le&&f(17,w=Le.$$scope)},p.$$.update=()=>{p.$$.dirty&2064&&(Z||T?ie=setTimeout(pe,200):ve()),p.$$.dirty&4096&&f(10,m=E?`background:${E};`:null),p.$$.dirty&4096&&f(9,v=E?`border-top-color:${E};`:null)},[k,S,M,H,Z,F,$,J,se,v,m,T,E,y,Ae,ze,Se,w]}class AbsTooltip extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$3Q,create_fragment$3S,safe_not_equal,{position:0,type:1,text:2,fixed:11,color:12,noWrap:3})}}const Icon_svelte_svelte_type_style_lang$1="";function create_default_slot$1U(p){let u,f,m,v,y,w,k,S;return{c(){u=element("div"),f=svg_element("svg"),m=svg_element("use"),set_style(m,"pointer-events","none"),xlink_attr(m,"xlink:href",v="#spectrum-icon-18-"+p[0]),attr(f,"class",y="spectrum-Icon spectrum-Icon--size"+p[1]+" svelte-ksxkvj"),attr(f,"focusable","false"),attr(f,"aria-hidden",p[2]),attr(f,"aria-label",p[0]),attr(f,"style",w=`${p[5]?`color: ${p[5]};`:""} ${p[6]?`--hover-color: ${p[6]}`:"--hover-color: var(--spectrum-alias-icon-color-selected-hover)"}`),toggle_class(f,"hoverable",p[3]),toggle_class(f,"disabled",p[4]),attr(u,"class","icon svelte-ksxkvj"),toggle_class(u,"newStyles",p[12])},m(M,T){insert(M,u,T),append$2(u,f),append$2(f,m),k||(S=[listen(f,"contextmenu",p[13]),listen(f,"click",p[14])],k=!0)},p(M,T){T&1&&v!==(v="#spectrum-icon-18-"+M[0])&&xlink_attr(m,"xlink:href",v),T&2&&y!==(y="spectrum-Icon spectrum-Icon--size"+M[1]+" svelte-ksxkvj")&&attr(f,"class",y),T&4&&attr(f,"aria-hidden",M[2]),T&1&&attr(f,"aria-label",M[0]),T&96&&w!==(w=`${M[5]?`color: ${M[5]};`:""} ${M[6]?`--hover-color: ${M[6]}`:"--hover-color: var(--spectrum-alias-icon-color-selected-hover)"}`)&&attr(f,"style",w),T&10&&toggle_class(f,"hoverable",M[3]),T&18&&toggle_class(f,"disabled",M[4]),T&4096&&toggle_class(u,"newStyles",M[12])},d(M){M&&detach(u),k=!1,run_all(S)}}}function create_fragment$3R(p){let u,f;return u=new AbsTooltip({props:{text:p[7],type:p[9],position:p[8],color:p[10],noWrap:p[11],$$slots:{default:[create_default_slot$1U]},$$scope:{ctx:p}}}),{c(){create_component(u.$$.fragment)},m(m,v){mount_component(u,m,v),f=!0},p(m,[v]){const y={};v&128&&(y.text=m[7]),v&512&&(y.type=m[9]),v&256&&(y.position=m[8]),v&1024&&(y.color=m[10]),v&2048&&(y.noWrap=m[11]),v&36991&&(y.$$scope={dirty:v,ctx:m}),u.$set(y)},i(m){f||(transition_in(u.$$.fragment,m),f=!0)},o(m){transition_out(u.$$.fragment,m),f=!1},d(m){destroy_component(u,m)}}}function instance$3P(p,u,f){let{name:m="Add"}=u,{size:v="M"}=u,{hidden:y=!1}=u,{hoverable:w=!1}=u,{disabled:k=!1}=u,{color:S=void 0}=u,{hoverColor:M=void 0}=u,{tooltip:T=void 0}=u,{tooltipPosition:E=TooltipPosition.Bottom}=u,{tooltipType:H=TooltipType.Default}=u,{tooltipColor:F=void 0}=u,{tooltipWrap:Z=!0}=u,{newStyles:$=!1}=u;function J(ie){bubble.call(this,p,ie)}function se(ie){bubble.call(this,p,ie)}return p.$$set=ie=>{"name"in ie&&f(0,m=ie.name),"size"in ie&&f(1,v=ie.size),"hidden"in ie&&f(2,y=ie.hidden),"hoverable"in ie&&f(3,w=ie.hoverable),"disabled"in ie&&f(4,k=ie.disabled),"color"in ie&&f(5,S=ie.color),"hoverColor"in ie&&f(6,M=ie.hoverColor),"tooltip"in ie&&f(7,T=ie.tooltip),"tooltipPosition"in ie&&f(8,E=ie.tooltipPosition),"tooltipType"in ie&&f(9,H=ie.tooltipType),"tooltipColor"in ie&&f(10,F=ie.tooltipColor),"tooltipWrap"in ie&&f(11,Z=ie.tooltipWrap),"newStyles"in ie&&f(12,$=ie.newStyles)},[m,v,y,w,k,S,M,T,E,H,F,Z,$,J,se]}let Icon$1=class extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$3P,create_fragment$3R,safe_not_equal,{name:0,size:1,hidden:2,hoverable:3,disabled:4,color:5,hoverColor:6,tooltip:7,tooltipPosition:8,tooltipType:9,tooltipColor:10,tooltipWrap:11,newStyles:12})}};const TooltipWrapper_svelte_svelte_type_style_lang="";function create_if_block$2b(p){let u,f,m;return f=new AbsTooltip({props:{text:p[0],$$slots:{default:[create_default_slot$1T]},$$scope:{ctx:p}}}),{c(){u=element("div"),create_component(f.$$.fragment),attr(u,"class","icon-container svelte-19tap7e")},m(v,y){insert(v,u,y),mount_component(f,u,null),m=!0},p(v,y){const w={};y&1&&(w.text=v[0]),y&38&&(w.$$scope={dirty:y,ctx:v}),f.$set(w)},i(v){m||(transition_in(f.$$.fragment,v),m=!0)},o(v){transition_out(f.$$.fragment,v),m=!1},d(v){v&&detach(u),destroy_component(f)}}}function create_default_slot$1T(p){let u,f,m,v,y;return f=new Icon$1({props:{name:"InfoOutline",size:"S",disabled:p[2],hoverable:!0}}),{c(){u=element("div"),create_component(f.$$.fragment),attr(u,"class","icon svelte-19tap7e"),toggle_class(u,"icon-small",p[1]==="M"||p[1]==="S")},m(w,k){insert(w,u,k),mount_component(f,u,null),m=!0,v||(y=listen(u,"focus",p[4]),v=!0)},p(w,k){const S={};k&4&&(S.disabled=w[2]),f.$set(S),(!m||k&2)&&toggle_class(u,"icon-small",w[1]==="M"||w[1]==="S")},i(w){m||(transition_in(f.$$.fragment,w),m=!0)},o(w){transition_out(f.$$.fragment,w),m=!1},d(w){w&&detach(u),destroy_component(f),v=!1,y()}}}function create_fragment$3Q(p){let u,f,m;const v=p[3].default,y=create_slot(v,p,p[5],null);let w=p[0]&&create_if_block$2b(p);return{c(){u=element("div"),y&&y.c(),f=space(),w&&w.c(),attr(u,"class","svelte-19tap7e"),toggle_class(u,"container",!!p[0])},m(k,S){insert(k,u,S),y&&y.m(u,null),append$2(u,f),w&&w.m(u,null),m=!0},p(k,[S]){y&&y.p&&(!m||S&32)&&update_slot_base(y,v,k,k[5],m?get_slot_changes(v,k[5],S,null):get_all_dirty_from_scope(k[5]),null),k[0]?w?(w.p(k,S),S&1&&transition_in(w,1)):(w=create_if_block$2b(k),w.c(),transition_in(w,1),w.m(u,null)):w&&(group_outros(),transition_out(w,1,1,()=>{w=null}),check_outros()),(!m||S&1)&&toggle_class(u,"container",!!k[0])},i(k){m||(transition_in(y,k),transition_in(w),m=!0)},o(k){transition_out(y,k),transition_out(w),m=!1},d(k){k&&detach(u),y&&y.d(k),w&&w.d()}}}function instance$3O(p,u,f){let{$$slots:m={},$$scope:v}=u,{tooltip:y=""}=u,{size:w="M"}=u,{disabled:k=!0}=u;function S(M){bubble.call(this,p,M)}return p.$$set=M=>{"tooltip"in M&&f(0,y=M.tooltip),"size"in M&&f(1,w=M.size),"disabled"in M&&f(2,k=M.disabled),"$$scope"in M&&f(5,v=M.$$scope)},[y,w,k,m,S,v]}class TooltipWrapper extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$3O,create_fragment$3Q,safe_not_equal,{tooltip:0,size:1,disabled:2})}}const FieldLabel_svelte_svelte_type_style_lang="";function create_default_slot$1S(p){let u,f=(p[1]||"")+"",m,v;return{c(){u=element("label"),m=text$1(f),attr(u,"for",p[0]),attr(u,"class",v=null_to_empty(`spectrum-FieldLabel spectrum-FieldLabel--sizeM spectrum-Form-itemLabel ${p[3]}`)+" svelte-dqoj9e")},m(y,w){insert(y,u,w),append$2(u,m)},p(y,w){w&2&&f!==(f=(y[1]||"")+"")&&set_data(m,f),w&1&&attr(u,"for",y[0]),w&8&&v!==(v=null_to_empty(`spectrum-FieldLabel spectrum-FieldLabel--sizeM spectrum-Form-itemLabel ${y[3]}`)+" svelte-dqoj9e")&&attr(u,"class",v)},d(y){y&&detach(u)}}}function create_fragment$3P(p){let u,f;return u=new TooltipWrapper({props:{tooltip:p[2],size:"S",$$slots:{default:[create_default_slot$1S]},$$scope:{ctx:p}}}),{c(){create_component(u.$$.fragment)},m(m,v){mount_component(u,m,v),f=!0},p(m,[v]){const y={};v&4&&(y.tooltip=m[2]),v&43&&(y.$$scope={dirty:v,ctx:m}),u.$set(y)},i(m){f||(transition_in(u.$$.fragment,m),f=!0)},o(m){transition_out(u.$$.fragment,m),f=!1},d(m){destroy_component(u,m)}}}function instance$3N(p,u,f){let m,{forId:v}=u,{label:y}=u,{position:w="above"}=u,{tooltip:k=""}=u;return p.$$set=S=>{"forId"in S&&f(0,v=S.forId),"label"in S&&f(1,y=S.label),"position"in S&&f(4,w=S.position),"tooltip"in S&&f(2,k=S.tooltip)},p.$$.update=()=>{p.$$.dirty&16&&f(3,m=w==="above"?"":`spectrum-FieldLabel--${w}`)},[v,y,k,m,w]}class FieldLabel extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$3N,create_fragment$3P,safe_not_equal,{forId:0,label:1,position:4,tooltip:2})}}const Field_svelte_svelte_type_style_lang$1="";function create_if_block_2$J(p){let u,f;return u=new FieldLabel({props:{forId:p[0],label:p[1],position:p[2],tooltip:p[5]}}),{c(){create_component(u.$$.fragment)},m(m,v){mount_component(u,m,v),f=!0},p(m,v){const y={};v&1&&(y.forId=m[0]),v&2&&(y.label=m[1]),v&4&&(y.position=m[2]),v&32&&(y.tooltip=m[5]),u.$set(y)},i(m){f||(transition_in(u.$$.fragment,m),f=!0)},o(m){transition_out(u.$$.fragment,m),f=!1},d(m){destroy_component(u,m)}}}function create_if_block_1$18(p){let u,f,m,v,y,w;return f=new Icon$1({props:{name:"HelpOutline"}}),{c(){u=element("div"),create_component(f.$$.fragment),m=space(),v=element("span"),y=text$1(p[4]),attr(v,"class","svelte-e52e9j"),attr(u,"class","helpText svelte-e52e9j")},m(k,S){insert(k,u,S),mount_component(f,u,null),append$2(u,m),append$2(u,v),append$2(v,y),w=!0},p(k,S){(!w||S&16)&&set_data(y,k[4])},i(k){w||(transition_in(f.$$.fragment,k),w=!0)},o(k){transition_out(f.$$.fragment,k),w=!1},d(k){k&&detach(u),destroy_component(f)}}}function create_if_block$2a(p){let u,f;return{c(){u=element("div"),f=text$1(p[3]),attr(u,"class","error svelte-e52e9j")},m(m,v){insert(m,u,v),append$2(u,f)},p(m,v){v&8&&set_data(f,m[3])},i:noop$2,o:noop$2,d(m){m&&detach(u)}}}function create_fragment$3O(p){let u,f,m,v,y,w,k,S=p[1]&&create_if_block_2$J(p);const M=p[7].default,T=create_slot(M,p,p[6],null),E=[create_if_block$2a,create_if_block_1$18],H=[];function F(Z,$){return Z[3]?0:Z[4]?1:-1}return~(y=F(p))&&(w=H[y]=E[y](p)),{c(){u=element("div"),S&&S.c(),f=space(),m=element("div"),T&&T.c(),v=space(),w&&w.c(),attr(m,"class","spectrum-Form-itemField svelte-e52e9j"),attr(u,"class","spectrum-Form-item svelte-e52e9j"),toggle_class(u,"above",p[2]==="above")},m(Z,$){insert(Z,u,$),S&&S.m(u,null),append$2(u,f),append$2(u,m),T&&T.m(m,null),append$2(m,v),~y&&H[y].m(m,null),k=!0},p(Z,[$]){Z[1]?S?(S.p(Z,$),$&2&&transition_in(S,1)):(S=create_if_block_2$J(Z),S.c(),transition_in(S,1),S.m(u,f)):S&&(group_outros(),transition_out(S,1,1,()=>{S=null}),check_outros()),T&&T.p&&(!k||$&64)&&update_slot_base(T,M,Z,Z[6],k?get_slot_changes(M,Z[6],$,null):get_all_dirty_from_scope(Z[6]),null);let J=y;y=F(Z),y===J?~y&&H[y].p(Z,$):(w&&(group_outros(),transition_out(H[J],1,1,()=>{H[J]=null}),check_outros()),~y?(w=H[y],w?w.p(Z,$):(w=H[y]=E[y](Z),w.c()),transition_in(w,1),w.m(m,null)):w=null),(!k||$&4)&&toggle_class(u,"above",Z[2]==="above")},i(Z){k||(transition_in(S),transition_in(T,Z),transition_in(w),k=!0)},o(Z){transition_out(S),transition_out(T,Z),transition_out(w),k=!1},d(Z){Z&&detach(u),S&&S.d(),T&&T.d(Z),~y&&H[y].d()}}}function instance$3M(p,u,f){let{$$slots:m={},$$scope:v}=u,{id:y=void 0}=u,{label:w=void 0}=u,{labelPosition:k="above"}=u,{error:S=void 0}=u,{helpText:M=void 0}=u,{tooltip:T=void 0}=u;return p.$$set=E=>{"id"in E&&f(0,y=E.id),"label"in E&&f(1,w=E.label),"labelPosition"in E&&f(2,k=E.labelPosition),"error"in E&&f(3,S=E.error),"helpText"in E&&f(4,M=E.helpText),"tooltip"in E&&f(5,T=E.tooltip),"$$scope"in E&&f(6,v=E.$$scope)},[y,w,k,S,M,T,v,m]}let Field$1=class extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$3M,create_fragment$3O,safe_not_equal,{id:0,label:1,labelPosition:2,error:3,helpText:4,tooltip:5})}};const indexVars$F="",TextField_svelte_svelte_type_style_lang="";function create_fragment$3N(p){let u,f,m,v,y,w,k,S;return{c(){u=element("div"),f=element("input"),f.disabled=p[3],f.readOnly=p[5],attr(f,"id",p[4]),f.value=m=p[0]??"",attr(f,"placeholder",v=p[1]??""),attr(f,"type",p[2]),attr(f,"class","spectrum-Textfield-input svelte-1pznijr"),attr(f,"style",y=p[7]?`text-align: ${p[7]};`:""),attr(f,"inputmode",w=p[15](p[2])),attr(f,"autocomplete",p[10]),attr(u,"class","spectrum-Textfield svelte-1pznijr"),toggle_class(u,"spectrum-Textfield--quiet",p[6]),toggle_class(u,"is-disabled",p[3]),toggle_class(u,"is-focused",p[9])},m(M,T){insert(M,u,T),append$2(u,f),p[24](f),k||(S=[listen(f,"click",p[19]),listen(f,"blur",p[20]),listen(f,"focus",p[21]),listen(f,"input",p[22]),listen(f,"keyup",p[23]),listen(f,"blur",p[12]),listen(f,"focus",p[11]),listen(f,"input",p[13]),listen(f,"keyup",p[14])],k=!0)},p(M,[T]){T&8&&(f.disabled=M[3]),T&32&&(f.readOnly=M[5]),T&16&&attr(f,"id",M[4]),T&1&&m!==(m=M[0]??"")&&f.value!==m&&(f.value=m),T&2&&v!==(v=M[1]??"")&&attr(f,"placeholder",v),T&4&&attr(f,"type",M[2]),T&128&&y!==(y=M[7]?`text-align: ${M[7]};`:"")&&attr(f,"style",y),T&4&&w!==(w=M[15](M[2]))&&attr(f,"inputmode",w),T&1024&&attr(f,"autocomplete",M[10]),T&64&&toggle_class(u,"spectrum-Textfield--quiet",M[6]),T&8&&toggle_class(u,"is-disabled",M[3]),T&512&&toggle_class(u,"is-focused",M[9])},i:noop$2,o:noop$2,d(M){M&&detach(u),p[24](null),k=!1,run_all(S)}}}function instance$3L(p,u,f){let m,{value:v=null}=u,{placeholder:y=void 0}=u,{type:w="text"}=u,{disabled:k=!1}=u,{id:S=null}=u,{readonly:M=!1}=u,{updateOnChange:T=!0}=u,{quiet:E=!1}=u,{align:H=void 0}=u,{autofocus:F=!1}=u,{autocomplete:Z}=u;const $=createEventDispatcher();let J,se=!1;const ie=Ge=>{if(!(M||k)){if(w==="number"){const be=parseFloat(Ge);Ge=isNaN(be)?null:be}$("change",Ge)}},he=()=>{M||k||f(9,se=!0)},fe=Ge=>{var be;M||k||(f(9,se=!1),ie((be=Ge==null?void 0:Ge.target)==null?void 0:be.value))},pe=Ge=>{var be;M||!T||k||ie((be=Ge.target)==null?void 0:be.value)},ve=Ge=>{var be;M||k||Ge.key==="Enter"&&ie((be=Ge.target)==null?void 0:be.value)},Ae=Ge=>Ge==="bigint"?"numeric":Ge==="number"?"decimal":"text";onMount(async()=>{k||(f(9,se=F||!1),se&&(await tick(),J.focus()))});function ze(Ge){bubble.call(this,p,Ge)}function Se(Ge){bubble.call(this,p,Ge)}function Le(Ge){bubble.call(this,p,Ge)}function Ce(Ge){bubble.call(this,p,Ge)}function Ue(Ge){bubble.call(this,p,Ge)}function Ze(Ge){binding_callbacks[Ge?"unshift":"push"](()=>{J=Ge,f(8,J)})}return p.$$set=Ge=>{"value"in Ge&&f(0,v=Ge.value),"placeholder"in Ge&&f(1,y=Ge.placeholder),"type"in Ge&&f(2,w=Ge.type),"disabled"in Ge&&f(3,k=Ge.disabled),"id"in Ge&&f(4,S=Ge.id),"readonly"in Ge&&f(5,M=Ge.readonly),"updateOnChange"in Ge&&f(16,T=Ge.updateOnChange),"quiet"in Ge&&f(6,E=Ge.quiet),"align"in Ge&&f(7,H=Ge.align),"autofocus"in Ge&&f(17,F=Ge.autofocus),"autocomplete"in Ge&&f(18,Z=Ge.autocomplete)},p.$$.update=()=>{p.$$.dirty&262144&&f(10,m=typeof Z=="boolean"?Z?"on":"off":void 0)},[v,y,w,k,S,M,E,H,J,se,m,he,fe,pe,ve,Ae,T,F,Z,ze,Se,Le,Ce,Ue,Ze]}class TextField extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$3L,create_fragment$3N,safe_not_equal,{value:0,placeholder:1,type:2,disabled:3,id:4,readonly:5,updateOnChange:16,quiet:6,align:7,autofocus:17,autocomplete:18})}}function create_default_slot$1R(p){let u,f;return u=new TextField({props:{updateOnChange:p[8],disabled:p[5],readonly:p[6],value:p[0],placeholder:p[3],type:p[4],quiet:p[9],autofocus:p[10],autocomplete:p[11]}}),u.$on("change",p[13]),u.$on("click",p[14]),u.$on("input",p[15]),u.$on("blur",p[16]),u.$on("focus",p[17]),u.$on("keyup",p[18]),{c(){create_component(u.$$.fragment)},m(m,v){mount_component(u,m,v),f=!0},p(m,v){const y={};v&256&&(y.updateOnChange=m[8]),v&32&&(y.disabled=m[5]),v&64&&(y.readonly=m[6]),v&1&&(y.value=m[0]),v&8&&(y.placeholder=m[3]),v&16&&(y.type=m[4]),v&512&&(y.quiet=m[9]),v&1024&&(y.autofocus=m[10]),v&2048&&(y.autocomplete=m[11]),u.$set(y)},i(m){f||(transition_in(u.$$.fragment,m),f=!0)},o(m){transition_out(u.$$.fragment,m),f=!1},d(m){destroy_component(u,m)}}}function create_fragment$3M(p){let u,f;return u=new Field$1({props:{helpText:p[12],label:p[1],labelPosition:p[2],error:p[7],$$slots:{default:[create_default_slot$1R]},$$scope:{ctx:p}}}),{c(){create_component(u.$$.fragment)},m(m,v){mount_component(u,m,v),f=!0},p(m,[v]){const y={};v&4096&&(y.helpText=m[12]),v&2&&(y.label=m[1]),v&4&&(y.labelPosition=m[2]),v&128&&(y.error=m[7]),v&1052537&&(y.$$scope={dirty:v,ctx:m}),u.$set(y)},i(m){f||(transition_in(u.$$.fragment,m),f=!0)},o(m){transition_out(u.$$.fragment,m),f=!1},d(m){destroy_component(u,m)}}}function instance$3K(p,u,f){let{value:m=void 0}=u,{label:v=void 0}=u,{labelPosition:y="above"}=u,{placeholder:w=void 0}=u,{type:k="text"}=u,{disabled:S=!1}=u,{readonly:M=!1}=u,{error:T=void 0}=u,{updateOnChange:E=!0}=u,{quiet:H=!1}=u,{autofocus:F=void 0}=u,{autocomplete:Z=void 0}=u,{helpText:$=void 0}=u;const J=createEventDispatcher(),se=Ae=>{f(0,m=Ae.detail),J("change",Ae.detail)};function ie(Ae){bubble.call(this,p,Ae)}function he(Ae){bubble.call(this,p,Ae)}function fe(Ae){bubble.call(this,p,Ae)}function pe(Ae){bubble.call(this,p,Ae)}function ve(Ae){bubble.call(this,p,Ae)}return p.$$set=Ae=>{"value"in Ae&&f(0,m=Ae.value),"label"in Ae&&f(1,v=Ae.label),"labelPosition"in Ae&&f(2,y=Ae.labelPosition),"placeholder"in Ae&&f(3,w=Ae.placeholder),"type"in Ae&&f(4,k=Ae.type),"disabled"in Ae&&f(5,S=Ae.disabled),"readonly"in Ae&&f(6,M=Ae.readonly),"error"in Ae&&f(7,T=Ae.error),"updateOnChange"in Ae&&f(8,E=Ae.updateOnChange),"quiet"in Ae&&f(9,H=Ae.quiet),"autofocus"in Ae&&f(10,F=Ae.autofocus),"autocomplete"in Ae&&f(11,Z=Ae.autocomplete),"helpText"in Ae&&f(12,$=Ae.helpText)},[m,v,y,w,k,S,M,T,E,H,F,Z,$,se,ie,he,fe,pe,ve]}let Input$5=class extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$3K,create_fragment$3M,safe_not_equal,{value:0,label:1,labelPosition:2,placeholder:3,type:4,disabled:5,readonly:6,error:7,updateOnChange:8,quiet:9,autofocus:10,autocomplete:11,helpText:12})}};const indexVars$E="",indexVars$D="",Stepper_svelte_svelte_type_style_lang="",TextArea_svelte_svelte_type_style_lang="";function create_fragment$3L(p){let u,f,m,v,y,w,k,S;return{c(){u=element("div"),f=element("textarea"),attr(f,"placeholder",m=p[1]||""),attr(f,"class","spectrum-Textfield-input svelte-1kmb9uq"),attr(f,"style",v=p[5]?`text-align: ${p[5]}`:""),f.disabled=p[2],f.readOnly=p[3],attr(f,"id",p[4]),f.value=y=p[0]||"",attr(u,"style",w=`${p[9]}${p[8]}`),attr(u,"class","spectrum-Textfield spectrum-Textfield--multiline svelte-1kmb9uq"),toggle_class(u,"is-disabled",p[2]),toggle_class(u,"is-focused",p[6])},m(M,T){insert(M,u,T),append$2(u,f),p[14](f),k||(S=[listen(f,"focus",p[15]),listen(f,"blur",p[10])],k=!0)},p(M,[T]){T&2&&m!==(m=M[1]||"")&&attr(f,"placeholder",m),T&32&&v!==(v=M[5]?`text-align: ${M[5]}`:"")&&attr(f,"style",v),T&4&&(f.disabled=M[2]),T&8&&(f.readOnly=M[3]),T&16&&attr(f,"id",M[4]),T&1&&y!==(y=M[0]||"")&&(f.value=y),T&768&&w!==(w=`${M[9]}${M[8]}`)&&attr(u,"style",w),T&4&&toggle_class(u,"is-disabled",M[2]),T&64&&toggle_class(u,"is-focused",M[6])},i:noop$2,o:noop$2,d(M){M&&detach(u),p[14](null),k=!1,run_all(S)}}}function instance$3J(p,u,f){let m,v,{value:y=""}=u,{placeholder:w=null}=u,{disabled:k=!1}=u,{readonly:S=!1}=u,{id:M=null}=u,{height:T=null}=u,{minHeight:E=null}=u;const H=()=>({start:$.selectionStart,end:$.selectionEnd});let{align:F=null}=u,Z=!1,$;const J=createEventDispatcher(),se=pe=>{J("change",pe.target.value),f(6,Z=!1)},ie=(pe,ve)=>!pe||ve==null?"":isNaN(ve)?`${pe}:${ve};`:`${pe}:${ve}px;`;function he(pe){binding_callbacks[pe?"unshift":"push"](()=>{$=pe,f(7,$)})}const fe=()=>f(6,Z=!0);return p.$$set=pe=>{"value"in pe&&f(0,y=pe.value),"placeholder"in pe&&f(1,w=pe.placeholder),"disabled"in pe&&f(2,k=pe.disabled),"readonly"in pe&&f(3,S=pe.readonly),"id"in pe&&f(4,M=pe.id),"height"in pe&&f(11,T=pe.height),"minHeight"in pe&&f(12,E=pe.minHeight),"align"in pe&&f(5,F=pe.align)},p.$$.update=()=>{p.$$.dirty&2048&&f(9,m=ie("height",T)),p.$$.dirty&4096&&f(8,v=ie("min-height",E))},[y,w,k,S,M,F,Z,$,v,m,se,T,E,H,he,fe]}class TextArea extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$3J,create_fragment$3L,safe_not_equal,{value:0,placeholder:1,disabled:2,readonly:3,id:4,height:11,minHeight:12,getCaretPosition:13,align:5})}get getCaretPosition(){return this.$$.ctx[13]}}const indexVars$C="",indexVars$B="",indexVars$A="",ignoredClasses=[".download-js-link",".spectrum-Menu",".date-time-popover"],conditionallyIgnoredClasses=[".spectrum-Underlay",".drawer-wrapper",".spectrum-Popover"];let clickHandlers=[],candidateTarget;const handleClick=p=>{const u=p.target||p.relatedTarget;if(!u.closest('[data-ignore-click-outside="true"]')){for(let f of ignoredClasses)if(u.closest(f))return;clickHandlers.forEach(f=>{var m;if(!f.element.contains(u)){for(let v of conditionallyIgnoredClasses){const y=f.anchor.closest(v)!=null;if(u.closest(v)!=null&&!y)return}(m=f.callback)==null||m.call(f,p)}})}},handleMouseUp=p=>{candidateTarget===p.target&&handleClick(p),candidateTarget=void 0},handleMouseDown=p=>{p.button===0&&(candidateTarget=p.target,document.removeEventListener("click",handleMouseUp),document.addEventListener("click",handleMouseUp,!0))},handleBlur=()=>{document.activeElement&&["IFRAME","BODY"].includes(document.activeElement.tagName)&&handleClick(new MouseEvent("click",{relatedTarget:document.activeElement}))};document.addEventListener("mousedown",handleMouseDown),document.addEventListener("contextmenu",handleClick),window.addEventListener("blur",handleBlur);const updateHandler=(p,u,f,m)=>{let v=clickHandlers.find(y=>y.id===p);v?v.callback=m:clickHandlers.push({id:p,element:u,anchor:f,callback:m})},removeHandler=p=>{clickHandlers=clickHandlers.filter(u=>u.id!==p)},clickOutside=(p,u)=>{const f=Math.random(),m=w=>typeof w=="function",v=w=>w!=null&&typeof w=="object",y=w=>{let k,S=p;m(w)?k=w:v(w)&&(k=w.callback,w.anchor&&(S=w.anchor)),updateHandler(f,p,S,k)};return y(u),{update:y,destroy:()=>removeHandler(f)}},indexVars$z="",Search_svelte_svelte_type_style_lang="";function create_fragment$3K(p){let u,f,m,v,y,w,k,S,M,T,E,H;return{c(){u=element("div"),f=element("div"),m=svg_element("svg"),v=svg_element("use"),y=space(),w=element("input"),M=space(),T=element("button"),T.innerHTML='<svg class="spectrum-Icon spectrum-UIIcon-Cross75" focusable="false" aria-hidden="true"><use xlink:href="#spectrum-css-icon-Cross75"></use></svg>',xlink_attr(v,"xlink:href","#spectrum-icon-18-Magnify"),attr(m,"class","spectrum-Icon spectrum-Icon--sizeM spectrum-Textfield-icon"),attr(m,"focusable","false"),attr(m,"aria-hidden","true"),w.disabled=p[3],attr(w,"id",p[4]),w.value=k=p[1]||"",attr(w,"placeholder",S=p[2]||""),attr(w,"type","search"),attr(w,"class","spectrum-Textfield-input spectrum-Search-input svelte-d7zw73"),attr(w,"autocomplete","off"),attr(f,"class","spectrum-Textfield svelte-d7zw73"),toggle_class(f,"spectrum-Textfield--quiet",p[5]),toggle_class(f,"is-focused",p[6]),toggle_class(f,"is-disabled",p[3]),attr(T,"type","reset"),attr(T,"class","spectrum-ClearButton spectrum-Search-clearButton svelte-d7zw73"),attr(u,"class","spectrum-Search svelte-d7zw73"),toggle_class(u,"is-disabled",p[3])},m(F,Z){insert(F,u,Z),append$2(u,f),append$2(f,m),append$2(m,v),append$2(f,y),append$2(f,w),p[17](w),append$2(u,M),append$2(u,T),E||(H=[listen(w,"click",p[13]),listen(w,"blur",p[14]),listen(w,"focus",p[15]),listen(w,"input",p[16]),listen(w,"blur",p[9]),listen(w,"focus",p[8]),listen(w,"input",p[10]),listen(w,"keyup",p[11]),listen(T,"click",p[18])],E=!0)},p(F,[Z]){Z&8&&(w.disabled=F[3]),Z&16&&attr(w,"id",F[4]),Z&2&&k!==(k=F[1]||"")&&w.value!==k&&(w.value=k),Z&4&&S!==(S=F[2]||"")&&attr(w,"placeholder",S),Z&32&&toggle_class(f,"spectrum-Textfield--quiet",F[5]),Z&64&&toggle_class(f,"is-focused",F[6]),Z&8&&toggle_class(f,"is-disabled",F[3]),Z&8&&toggle_class(u,"is-disabled",F[3])},i:noop$2,o:noop$2,d(F){F&&detach(u),p[17](null),E=!1,run_all(H)}}}function instance$3I(p,u,f){let{value:m=null}=u,{placeholder:v=void 0}=u,{disabled:y=!1}=u,{id:w=null}=u,{updateOnChange:k=!0}=u,{quiet:S=!1}=u,{inputRef:M=void 0}=u;const T=createEventDispatcher();let E=!1;const H=Ae=>{T("change",Ae)},F=()=>{f(6,E=!0)},Z=Ae=>{f(6,E=!1),H(Ae.target.value)},$=Ae=>{k&&H(Ae.target.value)},J=Ae=>{Ae.key==="Enter"&&H(Ae.target.value)};function se(Ae){bubble.call(this,p,Ae)}function ie(Ae){bubble.call(this,p,Ae)}function he(Ae){bubble.call(this,p,Ae)}function fe(Ae){bubble.call(this,p,Ae)}function pe(Ae){binding_callbacks[Ae?"unshift":"push"](()=>{M=Ae,f(0,M)})}const ve=()=>H("");return p.$$set=Ae=>{"value"in Ae&&f(1,m=Ae.value),"placeholder"in Ae&&f(2,v=Ae.placeholder),"disabled"in Ae&&f(3,y=Ae.disabled),"id"in Ae&&f(4,w=Ae.id),"updateOnChange"in Ae&&f(12,k=Ae.updateOnChange),"quiet"in Ae&&f(5,S=Ae.quiet),"inputRef"in Ae&&f(0,M=Ae.inputRef)},[M,m,v,y,w,S,E,H,F,Z,$,J,k,se,ie,he,fe,pe,ve]}class Search extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$3I,create_fragment$3K,safe_not_equal,{value:1,placeholder:2,disabled:3,id:4,updateOnChange:12,quiet:5,inputRef:0})}}const indexVars$y="",StatusLight_svelte_svelte_type_style_lang="";function create_fragment$3J(p){let u,f,m,v,y,w;const k=p[21].default,S=create_slot(k,p,p[20],null);return{c(){u=element("div"),S&&S.c(),attr(u,"class",f="spectrum-StatusLight spectrum-StatusLight--size"+p[0]+" svelte-1wk2ay6"),attr(u,"style",m=`--color: ${p[16]??"var(--spectrum-global-color-gray-400)"};`),toggle_class(u,"custom",!!p[16]),toggle_class(u,"square",p[17]),toggle_class(u,"hoverable",p[18]),toggle_class(u,"spectrum-StatusLight--celery",p[1]),toggle_class(u,"spectrum-StatusLight--yellow",p[2]),toggle_class(u,"spectrum-StatusLight--fuchsia",p[3]),toggle_class(u,"spectrum-StatusLight--indigo",p[4]),toggle_class(u,"spectrum-StatusLight--seafoam",p[5]),toggle_class(u,"spectrum-StatusLight--chartreuse",p[6]),toggle_class(u,"spectrum-StatusLight--magenta",p[7]),toggle_class(u,"spectrum-StatusLight--purple",p[8]),toggle_class(u,"spectrum-StatusLight--neutral",p[9]),toggle_class(u,"spectrum-StatusLight--info",p[10]),toggle_class(u,"spectrum-StatusLight--positive",p[11]),toggle_class(u,"spectrum-StatusLight--notice",p[12]),toggle_class(u,"spectrum-StatusLight--negative",p[13]),toggle_class(u,"spectrum-StatusLight--disabled",p[14]),toggle_class(u,"spectrum-StatusLight--active",p[15]),toggle_class(u,"withText",!!p[19].default)},m(M,T){insert(M,u,T),S&&S.m(u,null),v=!0,y||(w=listen(u,"click",p[22]),y=!0)},p(M,[T]){S&&S.p&&(!v||T&1048576)&&update_slot_base(S,k,M,M[20],v?get_slot_changes(k,M[20],T,null):get_all_dirty_from_scope(M[20]),null),(!v||T&1&&f!==(f="spectrum-StatusLight spectrum-StatusLight--size"+M[0]+" svelte-1wk2ay6"))&&attr(u,"class",f),(!v||T&65536&&m!==(m=`--color: ${M[16]??"var(--spectrum-global-color-gray-400)"};`))&&attr(u,"style",m),(!v||T&65537)&&toggle_class(u,"custom",!!M[16]),(!v||T&131073)&&toggle_class(u,"square",M[17]),(!v||T&262145)&&toggle_class(u,"hoverable",M[18]),(!v||T&3)&&toggle_class(u,"spectrum-StatusLight--celery",M[1]),(!v||T&5)&&toggle_class(u,"spectrum-StatusLight--yellow",M[2]),(!v||T&9)&&toggle_class(u,"spectrum-StatusLight--fuchsia",M[3]),(!v||T&17)&&toggle_class(u,"spectrum-StatusLight--indigo",M[4]),(!v||T&33)&&toggle_class(u,"spectrum-StatusLight--seafoam",M[5]),(!v||T&65)&&toggle_class(u,"spectrum-StatusLight--chartreuse",M[6]),(!v||T&129)&&toggle_class(u,"spectrum-StatusLight--magenta",M[7]),(!v||T&257)&&toggle_class(u,"spectrum-StatusLight--purple",M[8]),(!v||T&513)&&toggle_class(u,"spectrum-StatusLight--neutral",M[9]),(!v||T&1025)&&toggle_class(u,"spectrum-StatusLight--info",M[10]),(!v||T&2049)&&toggle_class(u,"spectrum-StatusLight--positive",M[11]),(!v||T&4097)&&toggle_class(u,"spectrum-StatusLight--notice",M[12]),(!v||T&8193)&&toggle_class(u,"spectrum-StatusLight--negative",M[13]),(!v||T&16385)&&toggle_class(u,"spectrum-StatusLight--disabled",M[14]),(!v||T&32769)&&toggle_class(u,"spectrum-StatusLight--active",M[15]),(!v||T&524289)&&toggle_class(u,"withText",!!M[19].default)},i(M){v||(transition_in(S,M),v=!0)},o(M){transition_out(S,M),v=!1},d(M){M&&detach(u),S&&S.d(M),y=!1,w()}}}function instance$3H(p,u,f){let{$$slots:m={},$$scope:v}=u;const y=compute_slots(m);let{size:w="M"}=u,{celery:k=!1}=u,{yellow:S=!1}=u,{fuchsia:M=!1}=u,{indigo:T=!1}=u,{seafoam:E=!1}=u,{chartreuse:H=!1}=u,{magenta:F=!1}=u,{purple:Z=!1}=u,{neutral:$=!1}=u,{info:J=!1}=u,{positive:se=!1}=u,{notice:ie=!1}=u,{negative:he=!1}=u,{disabled:fe=!1}=u,{active:pe=!1}=u,{color:ve=void 0}=u,{square:Ae=!1}=u,{hoverable:ze=!1}=u;function Se(Le){bubble.call(this,p,Le)}return p.$$set=Le=>{"size"in Le&&f(0,w=Le.size),"celery"in Le&&f(1,k=Le.celery),"yellow"in Le&&f(2,S=Le.yellow),"fuchsia"in Le&&f(3,M=Le.fuchsia),"indigo"in Le&&f(4,T=Le.indigo),"seafoam"in Le&&f(5,E=Le.seafoam),"chartreuse"in Le&&f(6,H=Le.chartreuse),"magenta"in Le&&f(7,F=Le.magenta),"purple"in Le&&f(8,Z=Le.purple),"neutral"in Le&&f(9,$=Le.neutral),"info"in Le&&f(10,J=Le.info),"positive"in Le&&f(11,se=Le.positive),"notice"in Le&&f(12,ie=Le.notice),"negative"in Le&&f(13,he=Le.negative),"disabled"in Le&&f(14,fe=Le.disabled),"active"in Le&&f(15,pe=Le.active),"color"in Le&&f(16,ve=Le.color),"square"in Le&&f(17,Ae=Le.square),"hoverable"in Le&&f(18,ze=Le.hoverable),"$$scope"in Le&&f(20,v=Le.$$scope)},[w,k,S,M,T,E,H,F,Z,$,J,se,ie,he,fe,pe,ve,Ae,ze,y,v,m,Se]}class StatusLight extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$3H,create_fragment$3J,safe_not_equal,{size:0,celery:1,yellow:2,fuchsia:3,indigo:4,seafoam:5,chartreuse:6,magenta:7,purple:8,neutral:9,info:10,positive:11,notice:12,negative:13,disabled:14,active:15,color:16,square:17,hoverable:18})}}function positionDropdown(p,u){let f,m=u;const v=()=>y(m),y=k=>{const{anchor:S,align:M,maxHeight:T,maxWidth:E,minWidth:H,useAnchorWidth:F,offset:Z=5,customUpdate:$,resizable:J,wrap:se}=k;if(!S)return;const ie=S.getBoundingClientRect(),he=p.getBoundingClientRect(),fe=window.innerWidth,pe=window.innerHeight,ve=8;let Ae={maxHeight:T,minWidth:F?ie.width:H,maxWidth:F?ie.width:E,left:0,top:0};if(typeof $=="function")Ae=$(ie,he,{...Ae,offset:k.offset});else{const ze=()=>Ae.left+he.width>fe&&ie.left>fe-ie.right,Se=()=>Ae.top+he.height>pe&&ie.top>pe-ie.bottom,Le=Ze=>{!Ae.maxHeight&&J&&(Ae.maxHeight=Ze)},Ce=Ze=>{switch(Ze){case"StartToStart":default:Ae.left=ie.left;break;case"EndToEnd":Ae.left=ie.right-he.width;break;case"StartToEnd":Ae.left=ie.right+Z;break;case"EndToStart":Ae.left=ie.left-he.width-Z;break;case"MidPoint":Ae.left=ie.left+ie.width/2-he.width/2;break;case"ScreenEdge":Ae.left=fe-he.width-ve;break}},Ue=Ze=>{switch(Ze){case"StartToStart":Ae.top=ie.top,Le(pe-ie.top-ve);break;case"EndToEnd":Ae.top=ie.bottom-he.height,Le(ie.bottom-ve);break;case"StartToEnd":default:Ae.top=ie.bottom+Z,Le(pe-ie.bottom-ve);break;case"EndToStart":Ae.top=ie.top-he.height-Z,Le(ie.top-ve);break;case"MidPoint":Ae.top=ie.top+ie.height/2-he.height/2;break;case"ScreenEdge":Ae.top=pe-he.height-ve,Le(pe-2*ve);break}};M===PopoverAlignment.Right?Ce("EndToEnd"):M===PopoverAlignment.RightOutside||M===PopoverAlignment.RightContextMenu?Ce("StartToEnd"):M===PopoverAlignment.LeftOutside||M===PopoverAlignment.LeftContextMenu?Ce("EndToStart"):M===PopoverAlignment.Center?Ce("MidPoint"):Ce("StartToStart"),M===PopoverAlignment.RightOutside||M===PopoverAlignment.LeftOutside?Ue("MidPoint"):M===PopoverAlignment.RightContextMenu||M===PopoverAlignment.LeftContextMenu?(Ue("StartToStart"),Ae.top&&(Ae.top-=5)):Ue("StartToEnd"),ze()&&(M===PopoverAlignment.Left?Ce("EndToEnd"):M===PopoverAlignment.RightOutside&&Ce("EndToStart")),Se()&&(se?(Ue("MidPoint"),Se()&&Ue("ScreenEdge"),Ce("StartToEnd"),ze()&&Ce("EndToStart")):M===PopoverAlignment.LeftOutside||M===PopoverAlignment.RightOutside?Ue("ScreenEdge"):Ue("EndToStart"))}for(const[ze,Se]of Object.entries(Ae)){const Le=ze;Se!=null?p.style[Le]=`${Se}px`:p.style[Le]=""}},w=k=>{m=k,f&&f.disconnect();const{anchor:S}=k;S&&(f=new ResizeObserver(()=>y(k)),f.observe(S),f.observe(p),f.observe(document.body))};return p.style.position="fixed",p.style.zIndex="9999",document.addEventListener("scroll",v,!0),w(u),{update:w,destroy(){f&&f.disconnect(),document.removeEventListener("scroll",v,!0)}}}const Context$1={Modal:"bbui-modal",PopoverRoot:"bbui-popover-root"},Popover_svelte_svelte_type_style_lang="";function create_if_block$29(p){let u,f;return u=new Portal({props:{target:p[17],$$slots:{default:[create_default_slot$1Q]},$$scope:{ctx:p}}}),{c(){create_component(u.$$.fragment)},m(m,v){mount_component(u,m,v),f=!0},p(m,v){const y={};v&131072&&(y.target=m[17]),v&537001982&&(y.$$scope={dirty:v,ctx:m}),u.$set(y)},i(m){f||(transition_in(u.$$.fragment,m),f=!0)},o(m){transition_out(u.$$.fragment,m),f=!1},d(m){destroy_component(u,m)}}}function create_default_slot$1Q(p){let u,f,m,v,y,w,k;const S=p[26].default,M=create_slot(S,p,p[29],null);return{c(){u=element("div"),M&&M.c(),attr(u,"tabindex","0"),attr(u,"class","spectrum-Popover is-open svelte-1kml6bp"),attr(u,"role","presentation"),set_style(u,"height",p[9]),set_style(u,"--customZIndex",p[11]),toggle_class(u,"customZIndex",p[11]),toggle_class(u,"hidden",!p[13]),toggle_class(u,"blockPointerEvents",p[16])},m(T,E){insert(T,u,E),M&&M.m(u,null),y=!0,w||(k=[action_destroyer(f=positionDropdown.call(null,u,{anchor:p[1],align:p[2],maxHeight:p[5],maxWidth:p[4],minWidth:p[3],useAnchorWidth:p[6],offset:p[8],customUpdate:p[12],resizable:p[14],wrap:p[15]})),action_destroyer(m=clickOutside.call(null,u,{callback:p[7]?p[18]:clickOutside_function,anchor:p[1]})),listen(u,"keydown",p[19]),listen(u,"mouseenter",p[27]),listen(u,"mouseleave",p[28])],w=!0)},p(T,E){p=T,M&&M.p&&(!y||E&536870912)&&update_slot_base(M,S,p,p[29],y?get_slot_changes(S,p[29],E,null):get_all_dirty_from_scope(p[29]),null),(!y||E&512)&&set_style(u,"height",p[9]),(!y||E&2048)&&set_style(u,"--customZIndex",p[11]),f&&is_function(f.update)&&E&53630&&f.update.call(null,{anchor:p[1],align:p[2],maxHeight:p[5],maxWidth:p[4],minWidth:p[3],useAnchorWidth:p[6],offset:p[8],customUpdate:p[12],resizable:p[14],wrap:p[15]}),m&&is_function(m.update)&&E&130&&m.update.call(null,{callback:p[7]?p[18]:clickOutside_function,anchor:p[1]}),(!y||E&2048)&&toggle_class(u,"customZIndex",p[11]),(!y||E&8192)&&toggle_class(u,"hidden",!p[13]),(!y||E&65536)&&toggle_class(u,"blockPointerEvents",p[16])},i(T){y||(transition_in(M,T),T&&add_render_callback(()=>{y&&(v||(v=create_bidirectional_transition(u,fly,{y:-20,duration:p[10]?animationDuration:0},!0)),v.run(1))}),y=!0)},o(T){transition_out(M,T),T&&(v||(v=create_bidirectional_transition(u,fly,{y:-20,duration:p[10]?animationDuration:0},!1)),v.run(0)),y=!1},d(T){T&&detach(u),M&&M.d(T),T&&v&&v.end(),w=!1,run_all(k)}}}function create_fragment$3I(p){let u,f,m=p[0]&&create_if_block$29(p);return{c(){m&&m.c(),u=empty$1()},m(v,y){m&&m.m(v,y),insert(v,u,y),f=!0},p(v,[y]){v[0]?m?(m.p(v,y),y&1&&transition_in(m,1)):(m=create_if_block$29(v),m.c(),transition_in(m,1),m.m(u.parentNode,u)):m&&(group_outros(),transition_out(m,1,1,()=>{m=null}),check_outros())},i(v){f||(transition_in(m),f=!0)},o(v){transition_out(m),f=!1},d(v){v&&detach(u),m&&m.d(v)}}}const animationDuration=260,clickOutside_function=()=>{};function instance$3G(p,u,f){let m,{$$slots:v={},$$scope:y}=u,{anchor:w}=u,{align:k=PopoverAlignment.Right}=u,{portalTarget:S=void 0}=u,{minWidth:M=void 0}=u,{maxWidth:T=void 0}=u,{maxHeight:E=void 0}=u,{open:H=!1}=u,{useAnchorWidth:F=!1}=u,{dismissible:Z=!0}=u,{offset:$=4}=u,{customHeight:J=void 0}=u,{animate:se=!0}=u,{customZIndex:ie=void 0}=u,{handlePositionUpdate:he=void 0}=u,{showPopover:fe=!0}=u,{clickOutsideOverride:pe=!1}=u,{resizable:ve=!0}=u,{wrap:Ae=!1}=u;const ze=createEventDispatcher();let Se,Le=!1;const Ce=()=>{ze("open"),f(0,H=!0)},Ue=()=>{ze("close"),f(0,H=!1)},Ze=()=>{H?Ue():Ce()},Ge=He=>{if(!pe&&H){let rt=He.target,ft=!1;for(;!ft&&rt&&rt.parentNode;)ft=rt===w,rt=rt.parentNode;ft&&He.stopPropagation(),Ue()}},be=He=>{pe&&H&&He.key==="Escape"&&Ue()};onDestroy(()=>{clearTimeout(Se)});function De(He){bubble.call(this,p,He)}function Ke(He){bubble.call(this,p,He)}return p.$$set=He=>{"anchor"in He&&f(1,w=He.anchor),"align"in He&&f(2,k=He.align),"portalTarget"in He&&f(20,S=He.portalTarget),"minWidth"in He&&f(3,M=He.minWidth),"maxWidth"in He&&f(4,T=He.maxWidth),"maxHeight"in He&&f(5,E=He.maxHeight),"open"in He&&f(0,H=He.open),"useAnchorWidth"in He&&f(6,F=He.useAnchorWidth),"dismissible"in He&&f(7,Z=He.dismissible),"offset"in He&&f(8,$=He.offset),"customHeight"in He&&f(9,J=He.customHeight),"animate"in He&&f(10,se=He.animate),"customZIndex"in He&&f(11,ie=He.customZIndex),"handlePositionUpdate"in He&&f(12,he=He.handlePositionUpdate),"showPopover"in He&&f(13,fe=He.showPopover),"clickOutsideOverride"in He&&f(21,pe=He.clickOutsideOverride),"resizable"in He&&f(14,ve=He.resizable),"wrap"in He&&f(15,Ae=He.wrap),"$$scope"in He&&f(29,y=He.$$scope)},p.$$.update=()=>{p.$$.dirty&1048576&&f(17,m=S||getContext$1(Context$1.PopoverRoot)||".spectrum"),p.$$.dirty&33555457&&H&&se&&(f(16,Le=!0),clearTimeout(Se),f(25,Se=setTimeout(()=>{f(16,Le=!1)},animationDuration/2)))},[H,w,k,M,T,E,F,Z,$,J,se,ie,he,fe,ve,Ae,Le,m,Ge,be,S,pe,Ce,Ue,Ze,Se,v,De,Ke,y]}class Popover extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$3G,create_fragment$3I,safe_not_equal,{anchor:1,align:2,portalTarget:20,minWidth:3,maxWidth:4,maxHeight:5,open:0,useAnchorWidth:6,dismissible:7,offset:8,customHeight:9,animate:10,customZIndex:11,handlePositionUpdate:12,showPopover:13,clickOutsideOverride:21,resizable:14,wrap:15,show:22,hide:23,toggle:24})}get show(){return this.$$.ctx[22]}get hide(){return this.$$.ctx[23]}get toggle(){return this.$$.ctx[24]}}const indexVars$x="",Tags_svelte_svelte_type_style_lang="";function create_fragment$3H(p){let u,f;const m=p[1].default,v=create_slot(m,p,p[0],null);return{c(){u=element("div"),v&&v.c(),attr(u,"class","spectrum-Tags svelte-17cj8k0"),attr(u,"role","list"),attr(u,"aria-label","list")},m(y,w){insert(y,u,w),v&&v.m(u,null),f=!0},p(y,[w]){v&&v.p&&(!f||w&1)&&update_slot_base(v,m,y,y[0],f?get_slot_changes(m,y[0],w,null):get_all_dirty_from_scope(y[0]),null)},i(y){f||(transition_in(v,y),f=!0)},o(y){transition_out(v,y),f=!1},d(y){y&&detach(u),v&&v.d(y)}}}function instance$3F(p,u,f){let{$$slots:m={},$$scope:v}=u;return p.$$set=y=>{"$$scope"in y&&f(0,v=y.$$scope)},[v,m]}class Tags extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$3F,create_fragment$3H,safe_not_equal,{})}}const indexVars$w="",Avatar_svelte_svelte_type_style_lang="";function create_else_block$F(p){let u,f=(p[3]||"")+"",m;return{c(){u=element("div"),m=text$1(f),attr(u,"class","spectrum-Avatar svelte-xutedg"),attr(u,"style",p[4]),toggle_class(u,"is-disabled",p[2])},m(v,y){insert(v,u,y),append$2(u,m)},p(v,y){y&8&&f!==(f=(v[3]||"")+"")&&set_data(m,f),y&16&&attr(u,"style",v[4]),y&4&&toggle_class(u,"is-disabled",v[2])},d(v){v&&detach(u)}}}function create_if_block$28(p){let u,f;return{c(){u=element("img"),attr(u,"class","spectrum-Avatar"),src_url_equal(u.src,f=p[1])||attr(u,"src",f),attr(u,"alt","Avatar"),set_style(u,"width","var("+p[5].get(p[0])+")"),set_style(u,"height","var("+p[5].get(p[0])+")"),toggle_class(u,"is-disabled",p[2])},m(m,v){insert(m,u,v)},p(m,v){v&2&&!src_url_equal(u.src,f=m[1])&&attr(u,"src",f),v&1&&set_style(u,"width","var("+m[5].get(m[0])+")"),v&1&&set_style(u,"height","var("+m[5].get(m[0])+")"),v&4&&toggle_class(u,"is-disabled",m[2])},d(m){m&&detach(u)}}}function create_fragment$3G(p){let u;function f(y,w){return y[1]?create_if_block$28:create_else_block$F}let m=f(p),v=m(p);return{c(){v.c(),u=empty$1()},m(y,w){v.m(y,w),insert(y,u,w)},p(y,[w]){m===(m=f(y))&&v?v.p(y,w):(v.d(1),v=m(y),v&&(v.c(),v.m(u.parentNode,u)))},i:noop$2,o:noop$2,d(y){y&&detach(u),v.d(y)}}}const DefaultColor="#3aab87";function instance$3E(p,u,f){let m,v,y=new Map([["XXS","--spectrum-alias-avatar-size-50"],["XS","--spectrum-alias-avatar-size-75"],["S","--spectrum-alias-avatar-size-200"],["M","--spectrum-alias-avatar-size-400"],["L","--spectrum-alias-avatar-size-500"],["XL","--spectrum-alias-avatar-size-600"],["XXL","--spectrum-alias-avatar-size-700"]]),{size:w="M"}=u,{url:k=""}=u,{disabled:S=!1}=u,{initials:M="JD"}=u,{color:T=null}=u;const E=F=>F!=null&&F.length?`hsl(${F[0].toLowerCase().charCodeAt(0)%26/26*360}, 50%, 50%)`:DefaultColor,H=(F,Z)=>{const $=`var(${y.get(F)})`,J=`calc(${$} / 2)`;return`width:${$}; height:${$}; font-size:${J}; background:${Z};`};return p.$$set=F=>{"size"in F&&f(0,w=F.size),"url"in F&&f(1,k=F.url),"disabled"in F&&f(2,S=F.disabled),"initials"in F&&f(3,M=F.initials),"color"in F&&f(6,T=F.color)},p.$$.update=()=>{p.$$.dirty&72&&f(7,m=T||E(M)),p.$$.dirty&129&&f(4,v=H(w,m))},[w,k,S,M,v,y,T,m]}class Avatar extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$3E,create_fragment$3G,safe_not_equal,{size:0,url:1,disabled:2,initials:3,color:6})}}function create_fragment$3F(p){let u,f,m,v,y;return{c(){u=element("button"),f=svg_element("svg"),m=svg_element("use"),xlink_attr(m,"xlink:href","#spectrum-css-icon-Cross75"),attr(f,"class","spectrum-Icon spectrum-UIIcon-Cross75"),attr(f,"focusable","false"),attr(f,"aria-hidden","true"),attr(u,"class","spectrum-ClearButton"),u.disabled=p[1],toggle_class(u,"spectrum-ClearButton--small",p[0])},m(w,k){insert(w,u,k),append$2(u,f),append$2(f,m),v||(y=listen(u,"click",p[2]),v=!0)},p(w,[k]){k&2&&(u.disabled=w[1]),k&1&&toggle_class(u,"spectrum-ClearButton--small",w[0])},i:noop$2,o:noop$2,d(w){w&&detach(u),v=!1,y()}}}function instance$3D(p,u,f){let{small:m=!1}=u,{disabled:v}=u;function y(w){bubble.call(this,p,w)}return p.$$set=w=>{"small"in w&&f(0,m=w.small),"disabled"in w&&f(1,v=w.disabled)},[m,v,y]}class ClearButton extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$3D,create_fragment$3F,safe_not_equal,{small:0,disabled:1})}}const Tag_svelte_svelte_type_style_lang$1="";function create_if_block_2$I(p){let u,f;return u=new Avatar({props:{url:p[1]}}),{c(){create_component(u.$$.fragment)},m(m,v){mount_component(u,m,v),f=!0},p(m,v){const y={};v&2&&(y.url=m[1]),u.$set(y)},i(m){f||(transition_in(u.$$.fragment,m),f=!0)},o(m){transition_out(u.$$.fragment,m),f=!1},d(m){destroy_component(u,m)}}}function create_if_block_1$17(p){let u,f,m;return{c(){u=svg_element("svg"),f=svg_element("use"),xlink_attr(f,"xlink:href",m="#spectrum-icon-24-"+p[0]),attr(u,"class","spectrum-Icon spectrum-Icon--sizeS"),attr(u,"focusable","false"),attr(u,"aria-hidden","true"),attr(u,"aria-label","Tag")},m(v,y){insert(v,u,y),append$2(u,f)},p(v,y){y&1&&m!==(m="#spectrum-icon-24-"+v[0])&&xlink_attr(f,"xlink:href",m)},d(v){v&&detach(u)}}}function create_if_block$27(p){let u,f;return u=new ClearButton({}),u.$on("click",p[7]),{c(){create_component(u.$$.fragment)},m(m,v){mount_component(u,m,v),f=!0},i(m){f||(transition_in(u.$$.fragment,m),f=!0)},o(m){transition_out(u.$$.fragment,m),f=!1},d(m){destroy_component(u,m)}}}function create_fragment$3E(p){let u,f,m,v,y,w,k=p[1]&&create_if_block_2$I(p),S=p[0]&&create_if_block_1$17(p);const M=p[6].default,T=create_slot(M,p,p[5],null);let E=p[4]&&create_if_block$27(p);return{c(){u=element("div"),k&&k.c(),f=space(),S&&S.c(),m=space(),v=element("span"),T&&T.c(),y=space(),E&&E.c(),attr(v,"class","spectrum-Tags-itemLabel"),attr(u,"class","spectrum-Tags-item svelte-16fqld8"),attr(u,"role","listitem"),toggle_class(u,"is-invalid",p[2]),toggle_class(u,"is-disabled",p[3])},m(H,F){insert(H,u,F),k&&k.m(u,null),append$2(u,f),S&&S.m(u,null),append$2(u,m),append$2(u,v),T&&T.m(v,null),append$2(u,y),E&&E.m(u,null),w=!0},p(H,[F]){H[1]?k?(k.p(H,F),F&2&&transition_in(k,1)):(k=create_if_block_2$I(H),k.c(),transition_in(k,1),k.m(u,f)):k&&(group_outros(),transition_out(k,1,1,()=>{k=null}),check_outros()),H[0]?S?S.p(H,F):(S=create_if_block_1$17(H),S.c(),S.m(u,m)):S&&(S.d(1),S=null),T&&T.p&&(!w||F&32)&&update_slot_base(T,M,H,H[5],w?get_slot_changes(M,H[5],F,null):get_all_dirty_from_scope(H[5]),null),H[4]?E?F&16&&transition_in(E,1):(E=create_if_block$27(H),E.c(),transition_in(E,1),E.m(u,null)):E&&(group_outros(),transition_out(E,1,1,()=>{E=null}),check_outros()),(!w||F&4)&&toggle_class(u,"is-invalid",H[2]),(!w||F&8)&&toggle_class(u,"is-disabled",H[3])},i(H){w||(transition_in(k),transition_in(T,H),transition_in(E),w=!0)},o(H){transition_out(k),transition_out(T,H),transition_out(E),w=!1},d(H){H&&detach(u),k&&k.d(),S&&S.d(),T&&T.d(H),E&&E.d()}}}function instance$3C(p,u,f){let{$$slots:m={},$$scope:v}=u,{icon:y=""}=u,{avatar:w=""}=u,{invalid:k=!1}=u,{disabled:S=!1}=u,{closable:M=!1}=u;function T(E){bubble.call(this,p,E)}return p.$$set=E=>{"icon"in E&&f(0,y=E.icon),"avatar"in E&&f(1,w=E.avatar),"invalid"in E&&f(2,k=E.invalid),"disabled"in E&&f(3,S=E.disabled),"closable"in E&&f(4,M=E.closable),"$$scope"in E&&f(5,v=E.$$scope)},[y,w,k,S,M,v,m,T]}let Tag$1=class extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$3C,create_fragment$3E,safe_not_equal,{icon:0,avatar:1,invalid:2,disabled:3,closable:4})}};const indexVars$v="";function create_fragment$3D(p){let u,f,m,v,y,w,k,S,M,T,E,H,F,Z;return{c(){u=element("div"),f=element("div"),m=space(),v=element("div"),y=element("div"),w=element("div"),k=element("div"),S=space(),M=element("div"),T=element("div"),E=element("div"),attr(f,"class","spectrum-ProgressCircle-track"),attr(k,"class","spectrum-ProgressCircle-fill"),attr(w,"class","spectrum-ProgressCircle-fillSubMask1"),attr(w,"style",p[3]),attr(y,"class","spectrum-ProgressCircle-fillMask1"),attr(E,"class","spectrum-ProgressCircle-fill"),attr(T,"class","spectrum-ProgressCircle-fillSubMask2"),attr(T,"style",p[4]),attr(M,"class","spectrum-ProgressCircle-fillMask2"),attr(v,"class","spectrum-ProgressCircle-fills"),attr(u,"class",H="spectrum-ProgressCircle spectrum-ProgressCircle--"+convertSize(p[0])),toggle_class(u,"spectrum-ProgressCircle--indeterminate",p[1]==null),toggle_class(u,"spectrum-ProgressCircle--overBackground",p[2])},m($,J){insert($,u,J),append$2(u,f),append$2(u,m),append$2(u,v),append$2(v,y),append$2(y,w),append$2(w,k),append$2(v,S),append$2(v,M),append$2(M,T),append$2(T,E),F||(Z=listen(u,"click",p[7]),F=!0)},p($,[J]){J&8&&attr(w,"style",$[3]),J&16&&attr(T,"style",$[4]),J&1&&H!==(H="spectrum-ProgressCircle spectrum-ProgressCircle--"+convertSize($[0]))&&attr(u,"class",H),J&3&&toggle_class(u,"spectrum-ProgressCircle--indeterminate",$[1]==null),J&5&&toggle_class(u,"spectrum-ProgressCircle--overBackground",$[2])},i:noop$2,o:noop$2,d($){$&&detach(u),F=!1,Z()}}}function convertSize(p){switch(p){case"S":return"small";case"L":return"large";default:return}}function instance$3B(p,u,f){let{size:m="M"}=u,{value:v=null}=u,{minValue:y=0}=u,{maxValue:w=100}=u,k,S;function M(H){if(H){let F=(H-y)/(w-y)*100,Z;F>0&&F<=50?(Z=-180+F/50*180,f(3,k=`transform: rotate(${Z}deg);`),f(4,S="transform: rotate(-180deg);")):F>50&&(Z=-180+(F-50)/50*180,f(3,k="transform: rotate(0deg);"),f(4,S=`transform: rotate(${Z}deg);`))}}let{overBackground:T=!1}=u;function E(H){bubble.call(this,p,H)}return p.$$set=H=>{"size"in H&&f(0,m=H.size),"value"in H&&f(1,v=H.value),"minValue"in H&&f(5,y=H.minValue),"maxValue"in H&&f(6,w=H.maxValue),"overBackground"in H&&f(2,T=H.overBackground)},p.$$.update=()=>{p.$$.dirty&2&&M(v)},[m,v,T,k,S,y,w,E]}class ProgressCircle extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$3B,create_fragment$3D,safe_not_equal,{size:0,value:1,minValue:5,maxValue:6,overBackground:2})}}const Picker_svelte_svelte_type_style_lang="";function get_each_context$J(p,u,f){const m=p.slice();return m[49]=u[f],m[51]=f,m}function create_if_block_11$2(p){let u,f,m,v;const y=[create_if_block_12$2,create_else_block_1$d],w=[];function k(S,M){return S[17]?1:0}return u=k(p),f=w[u]=y[u](p),{c(){f.c(),m=empty$1()},m(S,M){w[u].m(S,M),insert(S,m,M),v=!0},p(S,M){let T=u;u=k(S),u===T?w[u].p(S,M):(group_outros(),transition_out(w[T],1,1,()=>{w[T]=null}),check_outros(),f=w[u],f?f.p(S,M):(f=w[u]=y[u](S),f.c()),transition_in(f,1),f.m(m.parentNode,m))},i(S){v||(transition_in(f),v=!0)},o(S){transition_out(f),v=!1},d(S){S&&detach(m),w[u].d(S)}}}function create_else_block_1$d(p){let u,f,m;return{c(){u=element("span"),f=element("img"),src_url_equal(f.src,m=p[5])||attr(f,"src",m),attr(f,"alt","icon"),attr(f,"width","15"),attr(f,"height","15"),attr(u,"class","option-extra icon field-icon svelte-1jmtv0w")},m(v,y){insert(v,u,y),append$2(u,f)},p(v,y){y[0]&32&&!src_url_equal(f.src,m=v[5])&&attr(f,"src",m)},i:noop$2,o:noop$2,d(v){v&&detach(u)}}}function create_if_block_12$2(p){let u,f,m;return f=new Icon$1({props:{size:"S",name:p[5]}}),{c(){u=element("span"),create_component(f.$$.fragment),attr(u,"class","option-extra icon svelte-1jmtv0w")},m(v,y){insert(v,u,y),mount_component(f,u,null),m=!0},p(v,y){const w={};y[0]&32&&(w.name=v[5]),f.$set(w)},i(v){m||(transition_in(f.$$.fragment,v),m=!0)},o(v){transition_out(f.$$.fragment,v),m=!1},d(v){v&&detach(u),destroy_component(f)}}}function create_if_block_10$3(p){let u,f,m;return f=new StatusLight({props:{square:!0,color:p[6]}}),{c(){u=element("span"),create_component(f.$$.fragment),attr(u,"class","option-extra svelte-1jmtv0w")},m(v,y){insert(v,u,y),mount_component(f,u,null),m=!0},p(v,y){const w={};y[0]&64&&(w.color=v[6]),f.$set(w)},i(v){m||(transition_in(f.$$.fragment,v),m=!0)},o(v){transition_out(f.$$.fragment,v),m=!1},d(v){v&&detach(u),destroy_component(f)}}}function create_if_block_9$4(p){let u,f;return u=new Search({props:{value:p[0],disabled:p[3],placeholder:"Search"}}),u.$on("change",p[37]),{c(){create_component(u.$$.fragment)},m(m,v){mount_component(u,m,v),f=!0},p(m,v){const y={};v[0]&1&&(y.value=m[0]),v[0]&8&&(y.disabled=m[3]),u.$set(y)},i(m){f||(transition_in(u.$$.fragment,m),f=!0)},o(m){transition_out(u.$$.fragment,m),f=!1},d(m){destroy_component(u,m)}}}function create_if_block_8$5(p){let u,f,m,v,y,w,k,S;return{c(){u=element("li"),f=element("span"),m=text$1(p[8]),v=space(),y=svg_element("svg"),w=svg_element("use"),attr(f,"class","spectrum-Menu-itemLabel svelte-1jmtv0w"),xlink_attr(w,"xlink:href","#spectrum-css-icon-Checkmark100"),attr(y,"class","spectrum-Icon spectrum-UIIcon-Checkmark100 spectrum-Menu-checkmark spectrum-Menu-itemIcon svelte-1jmtv0w"),attr(y,"focusable","false"),attr(y,"aria-hidden","true"),attr(u,"class","spectrum-Menu-item placeholder svelte-1jmtv0w"),attr(u,"role","option"),attr(u,"aria-selected","true"),attr(u,"tabindex","0"),toggle_class(u,"is-selected",p[7])},m(M,T){insert(M,u,T),append$2(u,f),append$2(f,m),append$2(u,v),append$2(u,y),append$2(y,w),k||(S=listen(u,"click",p[38]),k=!0)},p(M,T){T[0]&256&&set_data(m,M[8]),T[0]&128&&toggle_class(u,"is-selected",M[7])},d(M){M&&detach(u),k=!1,S()}}}function create_if_block_2$H(p){let u,f,m=ensure_array_like(p[30]),v=[];for(let w=0;w<m.length;w+=1)v[w]=create_each_block$J(get_each_context$J(p,m,w));const y=w=>transition_out(v[w],1,1,()=>{v[w]=null});return{c(){for(let w=0;w<v.length;w+=1)v[w].c();u=empty$1()},m(w,k){for(let S=0;S<v.length;S+=1)v[S]&&v[S].m(w,k);insert(w,u,k),f=!0},p(w,k){if(k[0]&1275330048){m=ensure_array_like(w[30]);let S;for(S=0;S<m.length;S+=1){const M=get_each_context$J(w,m,S);v[S]?(v[S].p(M,k),transition_in(v[S],1)):(v[S]=create_each_block$J(M),v[S].c(),transition_in(v[S],1),v[S].m(u.parentNode,u))}for(group_outros(),S=m.length;S<v.length;S+=1)y(S);check_outros()}},i(w){if(!f){for(let k=0;k<m.length;k+=1)transition_in(v[k]);f=!0}},o(w){v=v.filter(Boolean);for(let k=0;k<v.length;k+=1)transition_out(v[k]);f=!1},d(w){w&&detach(u),destroy_each(v,w)}}}function create_if_block_6$b(p){let u,f,m,v;const y=[create_if_block_7$a,create_else_block$E],w=[];function k(S,M){return S[17]?0:1}return f=k(p),m=w[f]=y[f](p),{c(){u=element("span"),m.c(),attr(u,"class","option-extra icon svelte-1jmtv0w")},m(S,M){insert(S,u,M),w[f].m(u,null),v=!0},p(S,M){let T=f;f=k(S),f===T?w[f].p(S,M):(group_outros(),transition_out(w[T],1,1,()=>{w[T]=null}),check_outros(),m=w[f],m?m.p(S,M):(m=w[f]=y[f](S),m.c()),transition_in(m,1),m.m(u,null))},i(S){v||(transition_in(m),v=!0)},o(S){transition_out(m),v=!1},d(S){S&&detach(u),w[f].d()}}}function create_else_block$E(p){let u,f;return u=new Icon$1({props:{size:"S",name:p[14](p[49],p[51])}}),{c(){create_component(u.$$.fragment)},m(m,v){mount_component(u,m,v),f=!0},p(m,v){const y={};v[0]&1073758208&&(y.name=m[14](m[49],m[51])),u.$set(y)},i(m){f||(transition_in(u.$$.fragment,m),f=!0)},o(m){transition_out(u.$$.fragment,m),f=!1},d(m){destroy_component(u,m)}}}function create_if_block_7$a(p){let u,f;return{c(){u=element("img"),src_url_equal(u.src,f=p[14](p[49],p[51]))||attr(u,"src",f),attr(u,"alt","icon"),attr(u,"width","15"),attr(u,"height","15")},m(m,v){insert(m,u,v)},p(m,v){v[0]&1073758208&&!src_url_equal(u.src,f=m[14](m[49],m[51]))&&attr(u,"src",f)},i:noop$2,o:noop$2,d(m){m&&detach(u)}}}function create_if_block_5$g(p){let u,f,m;return f=new StatusLight({props:{square:!0,color:p[15](p[49],p[51])}}),{c(){u=element("span"),create_component(f.$$.fragment),attr(u,"class","option-extra svelte-1jmtv0w")},m(v,y){insert(v,u,y),mount_component(f,u,null),m=!0},p(v,y){const w={};y[0]&1073774592&&(w.color=v[15](v[49],v[51])),f.$set(w)},i(v){m||(transition_in(f.$$.fragment,v),m=!0)},o(v){transition_out(f.$$.fragment,v),m=!1},d(v){v&&detach(u),destroy_component(f)}}}function create_if_block_4$i(p){let u,f=p[16](p[49],p[51])+"",m;return{c(){u=element("span"),m=text$1(f),attr(u,"class","subtitle-text svelte-1jmtv0w")},m(v,y){insert(v,u,y),append$2(u,m)},p(v,y){y[0]&1073807360&&f!==(f=v[16](v[49],v[51])+"")&&set_data(m,f)},d(v){v&&detach(u)}}}function create_if_block_3$p(p){let u,f,m;return f=new Tags({props:{$$slots:{default:[create_default_slot_1$J]},$$scope:{ctx:p}}}),{c(){u=element("span"),create_component(f.$$.fragment),attr(u,"class","option-tag svelte-1jmtv0w")},m(v,y){insert(v,u,y),mount_component(f,u,null),m=!0},p(v,y){const w={};y[0]&1073741824|y[1]&2097152&&(w.$$scope={dirty:y,ctx:v}),f.$set(w)},i(v){m||(transition_in(f.$$.fragment,v),m=!0)},o(v){transition_out(f.$$.fragment,v),m=!1},d(v){v&&detach(u),destroy_component(f)}}}function create_default_slot_2$u(p){let u=p[49].tag+"",f;return{c(){f=text$1(u)},m(m,v){insert(m,f,v)},p(m,v){v[0]&1073741824&&u!==(u=m[49].tag+"")&&set_data(f,u)},d(m){m&&detach(f)}}}function create_default_slot_1$J(p){let u,f;return u=new Tag$1({props:{icon:"LockClosed",$$slots:{default:[create_default_slot_2$u]},$$scope:{ctx:p}}}),{c(){create_component(u.$$.fragment)},m(m,v){mount_component(u,m,v),f=!0},p(m,v){const y={};v[0]&1073741824|v[1]&2097152&&(y.$$scope={dirty:v,ctx:m}),u.$set(y)},i(m){f||(transition_in(u.$$.fragment,m),f=!0)},o(m){transition_out(u.$$.fragment,m),f=!1},d(m){destroy_component(u,m)}}}function create_each_block$J(p){let u,f=p[14](p[49],p[51]),m,v=p[15](p[49],p[51]),y,w,k=p[12](p[49],p[51])+"",S,M,T=p[16](p[49],p[51]),E,H,F,Z,$,J,se,ie,he=f&&create_if_block_6$b(p),fe=v&&create_if_block_5$g(p),pe=T&&create_if_block_4$i(p),ve=p[49].tag&&create_if_block_3$p(p);function Ae(){return p[39](p[49],p[51])}function ze(...Le){return p[40](p[49],...Le)}function Se(...Le){return p[41](p[49],...Le)}return{c(){u=element("li"),he&&he.c(),m=space(),fe&&fe.c(),y=space(),w=element("span"),S=text$1(k),M=space(),pe&&pe.c(),E=space(),ve&&ve.c(),H=space(),F=svg_element("svg"),Z=svg_element("use"),$=space(),attr(w,"class","spectrum-Menu-itemLabel svelte-1jmtv0w"),xlink_attr(Z,"xlink:href","#spectrum-css-icon-Checkmark100"),attr(F,"class","spectrum-Icon spectrum-UIIcon-Checkmark100 spectrum-Menu-checkmark spectrum-Menu-itemIcon svelte-1jmtv0w"),attr(F,"focusable","false"),attr(F,"aria-hidden","true"),attr(u,"class","spectrum-Menu-item svelte-1jmtv0w"),attr(u,"role","option"),attr(u,"aria-selected","true"),attr(u,"tabindex","0"),toggle_class(u,"is-selected",p[9](p[13](p[49],p[51]))),toggle_class(u,"is-disabled",!p[10](p[49]))},m(Le,Ce){insert(Le,u,Ce),he&&he.m(u,null),append$2(u,m),fe&&fe.m(u,null),append$2(u,y),append$2(u,w),append$2(w,S),append$2(w,M),pe&&pe.m(w,null),append$2(u,E),ve&&ve.m(u,null),append$2(u,H),append$2(u,F),append$2(F,Z),append$2(u,$),J=!0,se||(ie=[listen(u,"click",Ae),listen(u,"mouseenter",ze),listen(u,"mouseleave",Se)],se=!0)},p(Le,Ce){p=Le,Ce[0]&1073758208&&(f=p[14](p[49],p[51])),f?he?(he.p(p,Ce),Ce[0]&1073758208&&transition_in(he,1)):(he=create_if_block_6$b(p),he.c(),transition_in(he,1),he.m(u,m)):he&&(group_outros(),transition_out(he,1,1,()=>{he=null}),check_outros()),Ce[0]&1073774592&&(v=p[15](p[49],p[51])),v?fe?(fe.p(p,Ce),Ce[0]&1073774592&&transition_in(fe,1)):(fe=create_if_block_5$g(p),fe.c(),transition_in(fe,1),fe.m(u,y)):fe&&(group_outros(),transition_out(fe,1,1,()=>{fe=null}),check_outros()),(!J||Ce[0]&1073745920)&&k!==(k=p[12](p[49],p[51])+"")&&set_data(S,k),Ce[0]&1073807360&&(T=p[16](p[49],p[51])),T?pe?pe.p(p,Ce):(pe=create_if_block_4$i(p),pe.c(),pe.m(w,null)):pe&&(pe.d(1),pe=null),p[49].tag?ve?(ve.p(p,Ce),Ce[0]&1073741824&&transition_in(ve,1)):(ve=create_if_block_3$p(p),ve.c(),transition_in(ve,1),ve.m(u,H)):ve&&(group_outros(),transition_out(ve,1,1,()=>{ve=null}),check_outros()),(!J||Ce[0]&1073750528)&&toggle_class(u,"is-selected",p[9](p[13](p[49],p[51]))),(!J||Ce[0]&1073742848)&&toggle_class(u,"is-disabled",!p[10](p[49]))},i(Le){J||(transition_in(he),transition_in(fe),transition_in(ve),J=!0)},o(Le){transition_out(he),transition_out(fe),transition_out(ve),J=!1},d(Le){Le&&detach(u),he&&he.d(),fe&&fe.d(),pe&&pe.d(),ve&&ve.d(),se=!1,run_all(ie)}}}function create_if_block_1$16(p){let u,f,m;return f=new ProgressCircle({props:{size:"S"}}),{c(){u=element("div"),create_component(f.$$.fragment),attr(u,"class","loading svelte-1jmtv0w"),toggle_class(u,"loading--withAutocomplete",p[20])},m(v,y){insert(v,u,y),mount_component(f,u,null),m=!0},p(v,y){(!m||y[0]&1048576)&&toggle_class(u,"loading--withAutocomplete",v[20])},i(v){m||(transition_in(f.$$.fragment,v),m=!0)},o(v){transition_out(f.$$.fragment,v),m=!1},d(v){v&&detach(u),destroy_component(f)}}}function create_if_block$26(p){let u,f;return{c(){u=element("div"),f=text$1(p[23]),attr(u,"class","footer svelte-1jmtv0w")},m(m,v){insert(m,u,v),append$2(u,f)},p(m,v){v[0]&8388608&&set_data(f,m[23])},d(m){m&&detach(u)}}}function create_default_slot$1P(p){let u,f,m,v,y,w,k,S,M,T,E=p[20]&&create_if_block_9$4(p),H=p[8]&&create_if_block_8$5(p),F=p[30].length&&create_if_block_2$H(p),Z=p[25]&&create_if_block_1$16(p),$=p[23]&&create_if_block$26(p);return{c(){u=element("div"),E&&E.c(),f=space(),m=element("ul"),H&&H.c(),v=space(),F&&F.c(),y=space(),Z&&Z.c(),w=space(),$&&$.c(),attr(m,"class","spectrum-Menu"),attr(m,"role","listbox"),attr(u,"class","popover-content svelte-1jmtv0w"),toggle_class(u,"auto-width",p[19])},m(J,se){insert(J,u,se),E&&E.m(u,null),append$2(u,f),append$2(u,m),H&&H.m(m,null),append$2(m,v),F&&F.m(m,null),p[42](m),append$2(u,y),Z&&Z.m(u,null),append$2(u,w),$&&$.m(u,null),S=!0,M||(T=action_destroyer(k=clickOutside.call(null,u,p[43])),M=!0)},p(J,se){J[20]?E?(E.p(J,se),se[0]&1048576&&transition_in(E,1)):(E=create_if_block_9$4(J),E.c(),transition_in(E,1),E.m(u,f)):E&&(group_outros(),transition_out(E,1,1,()=>{E=null}),check_outros()),J[8]?H?H.p(J,se):(H=create_if_block_8$5(J),H.c(),H.m(m,v)):H&&(H.d(1),H=null),J[30].length?F?(F.p(J,se),se[0]&1073741824&&transition_in(F,1)):(F=create_if_block_2$H(J),F.c(),transition_in(F,1),F.m(m,null)):F&&(group_outros(),transition_out(F,1,1,()=>{F=null}),check_outros()),J[25]?Z?(Z.p(J,se),se[0]&33554432&&transition_in(Z,1)):(Z=create_if_block_1$16(J),Z.c(),transition_in(Z,1),Z.m(u,w)):Z&&(group_outros(),transition_out(Z,1,1,()=>{Z=null}),check_outros()),J[23]?$?$.p(J,se):($=create_if_block$26(J),$.c(),$.m(u,null)):$&&($.d(1),$=null),k&&is_function(k.update)&&se[0]&2&&k.update.call(null,J[43]),(!S||se[0]&524288)&&toggle_class(u,"auto-width",J[19])},i(J){S||(transition_in(E),transition_in(F),transition_in(Z),S=!0)},o(J){transition_out(E),transition_out(F),transition_out(Z),S=!1},d(J){J&&detach(u),E&&E.d(),H&&H.d(),F&&F.d(),p[42](null),Z&&Z.d(),$&&$.d(),M=!1,T()}}}function create_fragment$3C(p){let u,f,m,v,y,w,k,S,M,T,E,H,F,Z=p[5]&&create_if_block_11$2(p),$=p[6]&&create_if_block_10$3(p);return T=new Popover({props:{anchor:p[24]?p[24]:p[29],align:p[22]||PopoverAlignment.Left,open:p[1],useAnchorWidth:!p[19],maxWidth:p[19]?400:void 0,customHeight:p[21],maxHeight:360,$$slots:{default:[create_default_slot$1P]},$$scope:{ctx:p}}}),T.$on("close",p[44]),{c(){u=element("button"),Z&&Z.c(),f=space(),$&&$.c(),m=space(),v=element("span"),y=text$1(p[4]),w=space(),k=svg_element("svg"),S=svg_element("use"),M=space(),create_component(T.$$.fragment),attr(v,"class","spectrum-Picker-label svelte-1jmtv0w"),toggle_class(v,"is-placeholder",p[7]),toggle_class(v,"auto-width",p[19]),xlink_attr(S,"xlink:href","#spectrum-css-icon-Chevron100"),attr(k,"class","spectrum-Icon spectrum-UIIcon-ChevronDown100 spectrum-Picker-menuIcon"),attr(k,"focusable","false"),attr(k,"aria-hidden","true"),attr(u,"id",p[2]),attr(u,"class","spectrum-Picker spectrum-Picker--sizeM svelte-1jmtv0w"),u.disabled=p[3],attr(u,"aria-haspopup","listbox"),toggle_class(u,"spectrum-Picker--quiet",p[18]),toggle_class(u,"is-open",p[1])},m(J,se){insert(J,u,se),Z&&Z.m(u,null),append$2(u,f),$&&$.m(u,null),append$2(u,m),append$2(u,v),append$2(v,y),append$2(u,w),append$2(u,k),append$2(k,S),p[36](u),insert(J,M,se),mount_component(T,J,se),E=!0,H||(F=listen(u,"click",p[31]),H=!0)},p(J,se){J[5]?Z?(Z.p(J,se),se[0]&32&&transition_in(Z,1)):(Z=create_if_block_11$2(J),Z.c(),transition_in(Z,1),Z.m(u,f)):Z&&(group_outros(),transition_out(Z,1,1,()=>{Z=null}),check_outros()),J[6]?$?($.p(J,se),se[0]&64&&transition_in($,1)):($=create_if_block_10$3(J),$.c(),transition_in($,1),$.m(u,m)):$&&(group_outros(),transition_out($,1,1,()=>{$=null}),check_outros()),(!E||se[0]&16)&&set_data(y,J[4]),(!E||se[0]&128)&&toggle_class(v,"is-placeholder",J[7]),(!E||se[0]&524288)&&toggle_class(v,"auto-width",J[19]),(!E||se[0]&4)&&attr(u,"id",J[2]),(!E||se[0]&8)&&(u.disabled=J[3]),(!E||se[0]&262144)&&toggle_class(u,"spectrum-Picker--quiet",J[18]),(!E||se[0]&2)&&toggle_class(u,"is-open",J[1]);const ie={};se[0]&553648128&&(ie.anchor=J[24]?J[24]:J[29]),se[0]&4194304&&(ie.align=J[22]||PopoverAlignment.Left),se[0]&2&&(ie.open=J[1]),se[0]&524288&&(ie.useAnchorWidth=!J[19]),se[0]&524288&&(ie.maxWidth=J[19]?400:void 0),se[0]&2097152&&(ie.customHeight=J[21]),se[0]&1587281803|se[1]&2097152&&(ie.$$scope={dirty:se,ctx:J}),T.$set(ie)},i(J){E||(transition_in(Z),transition_in($),transition_in(T.$$.fragment,J),E=!0)},o(J){transition_out(Z),transition_out($),transition_out(T.$$.fragment,J),E=!1},d(J){J&&(detach(u),detach(M)),Z&&Z.d(),$&&$.d(),p[36](null),destroy_component(T,J),H=!1,F()}}}function instance$3A(p,u,f){let m,v,{id:y=void 0}=u,{disabled:w=!1}=u,{fieldText:k=""}=u,{fieldIcon:S=""}=u,{fieldColour:M=""}=u,{isPlaceholder:T=!1}=u,{placeholderOption:E=void 0}=u,{options:H=[]}=u,{isOptionSelected:F=$t=>$t}=u,{isOptionEnabled:Z=($t,xn)=>$t}=u,{onSelectOption:$=()=>{}}=u,{getOptionLabel:J=($t,xn)=>`${$t}`}=u,{getOptionValue:se=($t,xn)=>$t}=u,{getOptionIcon:ie=($t,xn)=>($t==null?void 0:$t.icon)??void 0}=u,{getOptionColour:he=($t,xn)=>($t==null?void 0:$t.colour)??void 0}=u,{getOptionSubtitle:fe=($t,xn)=>($t==null?void 0:$t.subtitle)??void 0}=u,{useOptionIconImage:pe=!1}=u,{open:ve=!1}=u,{readonly:Ae=!1}=u,{quiet:ze=!1}=u,{autoWidth:Se=!1}=u,{autocomplete:Le=!1}=u,{sort:Ce=!1}=u,{searchTerm:Ue=null}=u,{customPopoverHeight:Ze=void 0}=u,{align:Ge=PopoverAlignment.Left}=u,{footer:be=void 0}=u,{customAnchor:De=void 0}=u,{loading:Ke=!1}=u,{onOptionMouseenter:He=()=>{}}=u,{onOptionMouseleave:rt=()=>{}}=u;const ft=createEventDispatcher();let Mt,$e;const je=$t=>{$t.preventDefault(),$t.stopPropagation(),ft("click"),!Ae&&(f(0,Ue=null),f(1,ve=!ve))},Ct=($t,xn,sn)=>!($t!=null&&$t.length)||!Array.isArray($t)?[]:sn?$t.sort((mt,Mn)=>{const Dt=xn(mt),Wt=xn(Mn);return Dt>Wt?1:-1}):$t,yt=($t,xn,sn)=>{if(Le&&xn){const mt=xn.toLowerCase();return $t.filter(Mn=>`${sn(Mn)}`.toLowerCase().includes(mt))}return $t},ot=$t=>{$t.target.scrollHeight-$t.target.clientHeight-$t.target.scrollTop<100&&ft("loadMore")};onDestroy(()=>{$e==null||$e.removeEventListener("scroll",null)});function Rt($t){binding_callbacks[$t?"unshift":"push"](()=>{Mt=$t,f(29,Mt)})}const Xe=$t=>f(0,Ue=$t.detail),Gt=()=>$(null),Jt=($t,xn)=>$(se($t,xn)),Ht=($t,xn)=>He(xn,$t),Pt=($t,xn)=>rt(xn,$t);function Et($t){binding_callbacks[$t?"unshift":"push"](()=>{$e=$t,f(28,$e)})}const cn=()=>{f(1,ve=!1)},Sn=()=>f(1,ve=!1);return p.$$set=$t=>{"id"in $t&&f(2,y=$t.id),"disabled"in $t&&f(3,w=$t.disabled),"fieldText"in $t&&f(4,k=$t.fieldText),"fieldIcon"in $t&&f(5,S=$t.fieldIcon),"fieldColour"in $t&&f(6,M=$t.fieldColour),"isPlaceholder"in $t&&f(7,T=$t.isPlaceholder),"placeholderOption"in $t&&f(8,E=$t.placeholderOption),"options"in $t&&f(32,H=$t.options),"isOptionSelected"in $t&&f(9,F=$t.isOptionSelected),"isOptionEnabled"in $t&&f(10,Z=$t.isOptionEnabled),"onSelectOption"in $t&&f(11,$=$t.onSelectOption),"getOptionLabel"in $t&&f(12,J=$t.getOptionLabel),"getOptionValue"in $t&&f(13,se=$t.getOptionValue),"getOptionIcon"in $t&&f(14,ie=$t.getOptionIcon),"getOptionColour"in $t&&f(15,he=$t.getOptionColour),"getOptionSubtitle"in $t&&f(16,fe=$t.getOptionSubtitle),"useOptionIconImage"in $t&&f(17,pe=$t.useOptionIconImage),"open"in $t&&f(1,ve=$t.open),"readonly"in $t&&f(33,Ae=$t.readonly),"quiet"in $t&&f(18,ze=$t.quiet),"autoWidth"in $t&&f(19,Se=$t.autoWidth),"autocomplete"in $t&&f(20,Le=$t.autocomplete),"sort"in $t&&f(34,Ce=$t.sort),"searchTerm"in $t&&f(0,Ue=$t.searchTerm),"customPopoverHeight"in $t&&f(21,Ze=$t.customPopoverHeight),"align"in $t&&f(22,Ge=$t.align),"footer"in $t&&f(23,be=$t.footer),"customAnchor"in $t&&f(24,De=$t.customAnchor),"loading"in $t&&f(25,Ke=$t.loading),"onOptionMouseenter"in $t&&f(26,He=$t.onOptionMouseenter),"onOptionMouseleave"in $t&&f(27,rt=$t.onOptionMouseleave)},p.$$.update=()=>{p.$$.dirty[0]&4096|p.$$.dirty[1]&10&&f(35,m=Ct(H,J,Ce)),p.$$.dirty[0]&4097|p.$$.dirty[1]&16&&f(30,v=yt(m,Ue,J)),p.$$.dirty[0]&268435456&&($e==null||$e.addEventListener("scroll",ot))},[Ue,ve,y,w,k,S,M,T,E,F,Z,$,J,se,ie,he,fe,pe,ze,Se,Le,Ze,Ge,be,De,Ke,He,rt,$e,Mt,v,je,H,Ae,Ce,m,Rt,Xe,Gt,Jt,Ht,Pt,Et,cn,Sn]}class Picker extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$3A,create_fragment$3C,safe_not_equal,{id:2,disabled:3,fieldText:4,fieldIcon:5,fieldColour:6,isPlaceholder:7,placeholderOption:8,options:32,isOptionSelected:9,isOptionEnabled:10,onSelectOption:11,getOptionLabel:12,getOptionValue:13,getOptionIcon:14,getOptionColour:15,getOptionSubtitle:16,useOptionIconImage:17,open:1,readonly:33,quiet:18,autoWidth:19,autocomplete:20,sort:34,searchTerm:0,customPopoverHeight:21,align:22,footer:23,customAnchor:24,loading:25,onOptionMouseenter:26,onOptionMouseleave:27},null,[-1,-1])}}function create_fragment$3B(p){let u,f,m,v;function y(S){p[32](S)}function w(S){p[33](S)}let k={quiet:p[15],id:p[3],disabled:p[5],readonly:p[14],fieldText:p[27],fieldIcon:p[26],fieldColour:p[25],options:p[6],autoWidth:p[16],align:p[19],footer:p[20],getOptionLabel:p[7],getOptionValue:p[8],getOptionIcon:p[9],getOptionColour:p[10],getOptionSubtitle:p[11],useOptionIconImage:p[12],isOptionEnabled:p[13],autocomplete:p[17],sort:p[18],onOptionMouseenter:p[22],onOptionMouseleave:p[23],isPlaceholder:p[2]==null||p[2]==="",placeholderOption:p[4]===!1?void 0:p[4]||"Choose an option",isOptionSelected:p[31],onSelectOption:p[29],loading:p[21],customPopoverHeight:p[24]};return p[0]!==void 0&&(k.open=p[0]),p[1]!==void 0&&(k.searchTerm=p[1]),u=new Picker({props:k}),binding_callbacks.push(()=>bind(u,"open",y)),binding_callbacks.push(()=>bind(u,"searchTerm",w)),u.$on("click",p[34]),u.$on("loadMore",p[35]),{c(){create_component(u.$$.fragment)},m(S,M){mount_component(u,S,M),v=!0},p(S,M){const T={};M[0]&32768&&(T.quiet=S[15]),M[0]&8&&(T.id=S[3]),M[0]&32&&(T.disabled=S[5]),M[0]&16384&&(T.readonly=S[14]),M[0]&134217728&&(T.fieldText=S[27]),M[0]&67108864&&(T.fieldIcon=S[26]),M[0]&33554432&&(T.fieldColour=S[25]),M[0]&64&&(T.options=S[6]),M[0]&65536&&(T.autoWidth=S[16]),M[0]&524288&&(T.align=S[19]),M[0]&1048576&&(T.footer=S[20]),M[0]&128&&(T.getOptionLabel=S[7]),M[0]&256&&(T.getOptionValue=S[8]),M[0]&512&&(T.getOptionIcon=S[9]),M[0]&1024&&(T.getOptionColour=S[10]),M[0]&2048&&(T.getOptionSubtitle=S[11]),M[0]&4096&&(T.useOptionIconImage=S[12]),M[0]&8192&&(T.isOptionEnabled=S[13]),M[0]&131072&&(T.autocomplete=S[17]),M[0]&262144&&(T.sort=S[18]),M[0]&4194304&&(T.onOptionMouseenter=S[22]),M[0]&8388608&&(T.onOptionMouseleave=S[23]),M[0]&4&&(T.isPlaceholder=S[2]==null||S[2]===""),M[0]&16&&(T.placeholderOption=S[4]===!1?void 0:S[4]||"Choose an option"),M[0]&4&&(T.isOptionSelected=S[31]),M[0]&2097152&&(T.loading=S[21]),M[0]&16777216&&(T.customPopoverHeight=S[24]),!f&&M[0]&1&&(f=!0,T.open=S[0],add_flush_callback(()=>f=!1)),!m&&M[0]&2&&(m=!0,T.searchTerm=S[1],add_flush_callback(()=>m=!1)),u.$set(T)},i(S){v||(transition_in(u.$$.fragment,S),v=!0)},o(S){transition_out(u.$$.fragment,S),v=!1},d(S){destroy_component(u,S)}}}function instance$3z(p,u,f){let m,v,y,{value:w=null}=u,{id:k=void 0}=u,{placeholder:S="Choose an option"}=u,{disabled:M=!1}=u,{options:T=[]}=u,{getOptionLabel:E=(ot,Rt)=>`${ot}`}=u,{getOptionValue:H=(ot,Rt)=>ot}=u,{getOptionIcon:F=(ot,Rt)=>(ot==null?void 0:ot.icon)??void 0}=u,{getOptionColour:Z=(ot,Rt)=>(ot==null?void 0:ot.colour)??void 0}=u,{getOptionSubtitle:$=(ot,Rt)=>(ot==null?void 0:ot.subtitle)??void 0}=u,{compare:J=(ot,Rt)=>ot===Rt}=u,{useOptionIconImage:se=!1}=u,{isOptionEnabled:ie=(ot,Rt)=>ot}=u,{readonly:he=!1}=u,{quiet:fe=!1}=u,{autoWidth:pe=!1}=u,{autocomplete:ve=!1}=u,{sort:Ae=!1}=u,{align:ze=PopoverAlignment.Left}=u,{footer:Se=void 0}=u,{open:Le=!1}=u,{searchTerm:Ce=void 0}=u,{loading:Ue=void 0}=u,{onOptionMouseenter:Ze=()=>{}}=u,{onOptionMouseleave:Ge=()=>{}}=u,{customPopoverHeight:be=void 0}=u;const De=createEventDispatcher();function Ke(ot,Rt){return typeof J=="function"?J(ot,Rt):ot===Rt}const He=(ot,Rt,Xe)=>{if(!(Xe!=null&&Xe.length))return"";const Gt=Xe.findIndex((Jt,Ht)=>Ke(H(Jt,Ht),Rt));return Gt!==-1?ot(Xe[Gt],Gt):null},rt=(ot,Rt,Xe)=>ot==null||ot===""?Xe===!1?"":Xe||"Choose an option":He(E,ot,Rt)||"Choose an option",ft=ot=>{De("change",ot),f(0,Le=!1)},Mt=ot=>Ke(ot,w);function $e(ot){Le=ot,f(0,Le)}function je(ot){Ce=ot,f(1,Ce)}function Ct(ot){bubble.call(this,p,ot)}function yt(ot){bubble.call(this,p,ot)}return p.$$set=ot=>{"value"in ot&&f(2,w=ot.value),"id"in ot&&f(3,k=ot.id),"placeholder"in ot&&f(4,S=ot.placeholder),"disabled"in ot&&f(5,M=ot.disabled),"options"in ot&&f(6,T=ot.options),"getOptionLabel"in ot&&f(7,E=ot.getOptionLabel),"getOptionValue"in ot&&f(8,H=ot.getOptionValue),"getOptionIcon"in ot&&f(9,F=ot.getOptionIcon),"getOptionColour"in ot&&f(10,Z=ot.getOptionColour),"getOptionSubtitle"in ot&&f(11,$=ot.getOptionSubtitle),"compare"in ot&&f(30,J=ot.compare),"useOptionIconImage"in ot&&f(12,se=ot.useOptionIconImage),"isOptionEnabled"in ot&&f(13,ie=ot.isOptionEnabled),"readonly"in ot&&f(14,he=ot.readonly),"quiet"in ot&&f(15,fe=ot.quiet),"autoWidth"in ot&&f(16,pe=ot.autoWidth),"autocomplete"in ot&&f(17,ve=ot.autocomplete),"sort"in ot&&f(18,Ae=ot.sort),"align"in ot&&f(19,ze=ot.align),"footer"in ot&&f(20,Se=ot.footer),"open"in ot&&f(0,Le=ot.open),"searchTerm"in ot&&f(1,Ce=ot.searchTerm),"loading"in ot&&f(21,Ue=ot.loading),"onOptionMouseenter"in ot&&f(22,Ze=ot.onOptionMouseenter),"onOptionMouseleave"in ot&&f(23,Ge=ot.onOptionMouseleave),"customPopoverHeight"in ot&&f(24,be=ot.customPopoverHeight)},p.$$.update=()=>{p.$$.dirty[0]&84&&f(27,m=rt(w,T,S)),p.$$.dirty[0]&580&&f(26,v=He(F,w,T)),p.$$.dirty[0]&1092&&f(25,y=He(Z,w,T))},[Le,Ce,w,k,S,M,T,E,H,F,Z,$,se,ie,he,fe,pe,ve,Ae,ze,Se,Ue,Ze,Ge,be,y,v,m,Ke,ft,J,Mt,$e,je,Ct,yt]}class Select extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$3z,create_fragment$3B,safe_not_equal,{value:2,id:3,placeholder:4,disabled:5,options:6,getOptionLabel:7,getOptionValue:8,getOptionIcon:9,getOptionColour:10,getOptionSubtitle:11,compare:30,useOptionIconImage:12,isOptionEnabled:13,readonly:14,quiet:15,autoWidth:16,autocomplete:17,sort:18,align:19,footer:20,open:0,searchTerm:1,loading:21,onOptionMouseenter:22,onOptionMouseleave:23,customPopoverHeight:24},null,[-1,-1])}}function create_default_slot$1O(p){let u,f;return u=new Select({props:{quiet:p[15],disabled:p[2],readonly:p[3],value:p[0],options:p[7],placeholder:p[6],autoWidth:p[16],sort:p[17],align:p[21],footer:p[22],getOptionLabel:p[8],getOptionValue:p[9],getOptionIcon:p[11],getOptionColour:p[12],getOptionSubtitle:p[10],useOptionIconImage:p[13],isOptionEnabled:p[14],autocomplete:p[19],customPopoverHeight:p[20],compare:p[24],onOptionMouseenter:p[25],onOptionMouseleave:p[26]}}),u.$on("change",p[27]),u.$on("click",p[28]),{c(){create_component(u.$$.fragment)},m(m,v){mount_component(u,m,v),f=!0},p(m,v){const y={};v[0]&32768&&(y.quiet=m[15]),v[0]&4&&(y.disabled=m[2]),v[0]&8&&(y.readonly=m[3]),v[0]&1&&(y.value=m[0]),v[0]&128&&(y.options=m[7]),v[0]&64&&(y.placeholder=m[6]),v[0]&65536&&(y.autoWidth=m[16]),v[0]&131072&&(y.sort=m[17]),v[0]&2097152&&(y.align=m[21]),v[0]&4194304&&(y.footer=m[22]),v[0]&256&&(y.getOptionLabel=m[8]),v[0]&512&&(y.getOptionValue=m[9]),v[0]&2048&&(y.getOptionIcon=m[11]),v[0]&4096&&(y.getOptionColour=m[12]),v[0]&1024&&(y.getOptionSubtitle=m[10]),v[0]&8192&&(y.useOptionIconImage=m[13]),v[0]&16384&&(y.isOptionEnabled=m[14]),v[0]&524288&&(y.autocomplete=m[19]),v[0]&1048576&&(y.customPopoverHeight=m[20]),v[0]&16777216&&(y.compare=m[24]),v[0]&33554432&&(y.onOptionMouseenter=m[25]),v[0]&67108864&&(y.onOptionMouseleave=m[26]),u.$set(y)},i(m){f||(transition_in(u.$$.fragment,m),f=!0)},o(m){transition_out(u.$$.fragment,m),f=!1},d(m){destroy_component(u,m)}}}function create_fragment$3A(p){let u,f;return u=new Field$1({props:{helpText:p[23],label:p[1],labelPosition:p[4],error:p[5],tooltip:p[18],$$slots:{default:[create_default_slot$1O]},$$scope:{ctx:p}}}),{c(){create_component(u.$$.fragment)},m(m,v){mount_component(u,m,v),f=!0},p(m,v){const y={};v[0]&8388608&&(y.helpText=m[23]),v[0]&2&&(y.label=m[1]),v[0]&16&&(y.labelPosition=m[4]),v[0]&32&&(y.error=m[5]),v[0]&262144&&(y.tooltip=m[18]),v[0]&125566925|v[1]&1&&(y.$$scope={dirty:v,ctx:m}),u.$set(y)},i(m){f||(transition_in(u.$$.fragment,m),f=!0)},o(m){transition_out(u.$$.fragment,m),f=!1},d(m){destroy_component(u,m)}}}function instance$3y(p,u,f){let{value:m=void 0}=u,{label:v=void 0}=u,{disabled:y=!1}=u,{readonly:w=!1}=u,{labelPosition:k="above"}=u,{error:S=void 0}=u,{placeholder:M="Choose an option"}=u,{options:T=[]}=u,{getOptionLabel:E=(He,rt)=>De(He,"label")}=u,{getOptionValue:H=(He,rt)=>De(He,"value")}=u,{getOptionSubtitle:F=(He,rt)=>He==null?void 0:He.subtitle}=u,{getOptionIcon:Z=(He,rt)=>He==null?void 0:He.icon}=u,{getOptionColour:$=(He,rt)=>He==null?void 0:He.colour}=u,{useOptionIconImage:J=!1}=u,{isOptionEnabled:se=void 0}=u,{quiet:ie=!1}=u,{autoWidth:he=!1}=u,{sort:fe=!1}=u,{tooltip:pe=void 0}=u,{autocomplete:ve=!1}=u,{customPopoverHeight:Ae=void 0}=u,{align:ze=PopoverAlignment.Left}=u,{footer:Se=void 0}=u,{helpText:Le=void 0}=u,{compare:Ce=void 0}=u,{onOptionMouseenter:Ue=()=>{}}=u,{onOptionMouseleave:Ze=()=>{}}=u;const Ge=createEventDispatcher(),be=He=>{f(0,m=He.detail),Ge("change",He.detail)},De=(He,rt)=>He&&typeof He=="object"?He[rt]:He;function Ke(He){bubble.call(this,p,He)}return p.$$set=He=>{"value"in He&&f(0,m=He.value),"label"in He&&f(1,v=He.label),"disabled"in He&&f(2,y=He.disabled),"readonly"in He&&f(3,w=He.readonly),"labelPosition"in He&&f(4,k=He.labelPosition),"error"in He&&f(5,S=He.error),"placeholder"in He&&f(6,M=He.placeholder),"options"in He&&f(7,T=He.options),"getOptionLabel"in He&&f(8,E=He.getOptionLabel),"getOptionValue"in He&&f(9,H=He.getOptionValue),"getOptionSubtitle"in He&&f(10,F=He.getOptionSubtitle),"getOptionIcon"in He&&f(11,Z=He.getOptionIcon),"getOptionColour"in He&&f(12,$=He.getOptionColour),"useOptionIconImage"in He&&f(13,J=He.useOptionIconImage),"isOptionEnabled"in He&&f(14,se=He.isOptionEnabled),"quiet"in He&&f(15,ie=He.quiet),"autoWidth"in He&&f(16,he=He.autoWidth),"sort"in He&&f(17,fe=He.sort),"tooltip"in He&&f(18,pe=He.tooltip),"autocomplete"in He&&f(19,ve=He.autocomplete),"customPopoverHeight"in He&&f(20,Ae=He.customPopoverHeight),"align"in He&&f(21,ze=He.align),"footer"in He&&f(22,Se=He.footer),"helpText"in He&&f(23,Le=He.helpText),"compare"in He&&f(24,Ce=He.compare),"onOptionMouseenter"in He&&f(25,Ue=He.onOptionMouseenter),"onOptionMouseleave"in He&&f(26,Ze=He.onOptionMouseleave)},[m,v,y,w,k,S,M,T,E,H,F,Z,$,J,se,ie,he,fe,pe,ve,Ae,ze,Se,Le,Ce,Ue,Ze,be,Ke]}class Select_1 extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$3y,create_fragment$3A,safe_not_equal,{value:0,label:1,disabled:2,readonly:3,labelPosition:4,error:5,placeholder:6,options:7,getOptionLabel:8,getOptionValue:9,getOptionSubtitle:10,getOptionIcon:11,getOptionColour:12,useOptionIconImage:13,isOptionEnabled:14,quiet:15,autoWidth:16,sort:17,tooltip:18,autocomplete:19,customPopoverHeight:20,align:21,footer:22,helpText:23,compare:24,onOptionMouseenter:25,onOptionMouseleave:26},null,[-1,-1])}}const indexVars$u="",Combobox_svelte_svelte_type_style_lang="";function get_each_context$I(p,u,f){const m=p.slice();return m[22]=u[f],m}function create_if_block$25(p){let u,f=ensure_array_like(p[5]),m=[];for(let v=0;v<f.length;v+=1)m[v]=create_each_block$I(get_each_context$I(p,f,v));return{c(){for(let v=0;v<m.length;v+=1)m[v].c();u=empty$1()},m(v,y){for(let w=0;w<m.length;w+=1)m[w]&&m[w].m(v,y);insert(v,u,y)},p(v,y){if(y&8417){f=ensure_array_like(v[5]);let w;for(w=0;w<f.length;w+=1){const k=get_each_context$I(v,f,w);m[w]?m[w].p(k,y):(m[w]=create_each_block$I(k),m[w].c(),m[w].m(u.parentNode,u))}for(;w<m.length;w+=1)m[w].d(1);m.length=f.length}},d(v){v&&detach(u),destroy_each(m,v)}}}function create_each_block$I(p){let u,f,m=p[6](p[22])+"",v,y,w,k,S,M,T;function E(){return p[18](p[22])}return{c(){u=element("li"),f=element("span"),v=text$1(m),y=space(),w=svg_element("svg"),k=svg_element("use"),S=space(),attr(f,"class","spectrum-Menu-itemLabel svelte-otlbol"),xlink_attr(k,"xlink:href","#spectrum-css-icon-Checkmark100"),attr(w,"class","spectrum-Icon spectrum-UIIcon-Checkmark100 spectrum-Menu-checkmark spectrum-Menu-itemIcon"),attr(w,"focusable","false"),attr(w,"aria-hidden","true"),attr(u,"class","spectrum-Menu-item"),attr(u,"role","option"),attr(u,"aria-selected","true"),attr(u,"tabindex","0"),toggle_class(u,"is-selected",p[7](p[22])===p[0])},m(H,F){insert(H,u,F),append$2(u,f),append$2(f,v),append$2(u,y),append$2(u,w),append$2(w,k),append$2(u,S),M||(T=listen(u,"click",E),M=!0)},p(H,F){p=H,F&96&&m!==(m=p[6](p[22])+"")&&set_data(v,m),F&161&&toggle_class(u,"is-selected",p[7](p[22])===p[0])},d(H){H&&detach(u),M=!1,T()}}}function create_default_slot$1N(p){let u,f,m=p[5]&&Array.isArray(p[5]),v,y,w,k=m&&create_if_block$25(p);return{c(){u=element("div"),f=element("ul"),k&&k.c(),attr(f,"class","spectrum-Menu"),attr(f,"role","listbox"),attr(u,"class","popover-content svelte-otlbol")},m(S,M){insert(S,u,M),append$2(u,f),k&&k.m(f,null),y||(w=action_destroyer(v=clickOutside.call(null,u,p[19])),y=!0)},p(S,M){M&32&&(m=S[5]&&Array.isArray(S[5])),m?k?k.p(S,M):(k=create_if_block$25(S),k.c(),k.m(f,null)):k&&(k.d(1),k=null),v&&is_function(v.update)&&M&256&&v.update.call(null,S[19])},d(S){S&&detach(u),k&&k.d(),y=!1,w()}}}function create_fragment$3z(p){let u,f,m,v,y,w,k,S,M,T,E,H,F,Z;return E=new Popover({props:{anchor:p[10],open:p[8],align:PopoverAlignment.Left,useAnchorWidth:!0,$$slots:{default:[create_default_slot$1N]},$$scope:{ctx:p}}}),E.$on("close",p[20]),{c(){u=element("div"),f=element("div"),m=element("input"),w=space(),k=element("button"),S=svg_element("svg"),M=svg_element("use"),T=space(),create_component(E.$$.fragment),attr(m,"id",p[1]),attr(m,"type","text"),m.value=v=p[0]||"",attr(m,"placeholder",y=p[2]||""),m.disabled=p[3],m.readOnly=p[4],attr(m,"class","spectrum-Textfield-input spectrum-InputGroup-input svelte-otlbol"),attr(f,"class","spectrum-Textfield spectrum-InputGroup-textfield svelte-otlbol"),toggle_class(f,"is-disabled",p[3]),toggle_class(f,"is-focused",p[8]||p[9]),xlink_attr(M,"xlink:href","#spectrum-css-icon-Chevron100"),attr(S,"class","spectrum-Icon spectrum-UIIcon-ChevronDown100 spectrum-Picker-menuIcon spectrum-InputGroup-icon"),attr(S,"focusable","false"),attr(S,"aria-hidden","true"),attr(k,"class","spectrum-Picker spectrum-Picker--sizeM spectrum-InputGroup-button"),attr(k,"tabindex","-1"),attr(k,"aria-haspopup","true"),k.disabled=p[3],attr(u,"class","spectrum-InputGroup svelte-otlbol"),toggle_class(u,"is-focused",p[8]||p[9]),toggle_class(u,"is-disabled",p[3])},m($,J){insert($,u,J),append$2(u,f),append$2(f,m),append$2(u,w),append$2(u,k),append$2(k,S),append$2(S,M),p[17](u),insert($,T,J),mount_component(E,$,J),H=!0,F||(Z=[listen(m,"focus",p[14]),listen(m,"blur",p[15]),listen(m,"change",p[12]),listen(k,"click",p[16])],F=!0)},p($,[J]){(!H||J&2)&&attr(m,"id",$[1]),(!H||J&1&&v!==(v=$[0]||"")&&m.value!==v)&&(m.value=v),(!H||J&4&&y!==(y=$[2]||""))&&attr(m,"placeholder",y),(!H||J&8)&&(m.disabled=$[3]),(!H||J&16)&&(m.readOnly=$[4]),(!H||J&8)&&toggle_class(f,"is-disabled",$[3]),(!H||J&768)&&toggle_class(f,"is-focused",$[8]||$[9]),(!H||J&8)&&(k.disabled=$[3]),(!H||J&768)&&toggle_class(u,"is-focused",$[8]||$[9]),(!H||J&8)&&toggle_class(u,"is-disabled",$[3]);const se={};J&1024&&(se.anchor=$[10]),J&256&&(se.open=$[8]),J&33554913&&(se.$$scope={dirty:J,ctx:$}),E.$set(se)},i($){H||(transition_in(E.$$.fragment,$),H=!0)},o($){transition_out(E.$$.fragment,$),H=!1},d($){$&&(detach(u),detach(T)),p[17](null),destroy_component(E,$),F=!1,run_all(Z)}}}function instance$3x(p,u,f){let{value:m=void 0}=u,{id:v=void 0}=u,{placeholder:y="Choose an option or type"}=u,{disabled:w=!1}=u,{readonly:k=!1}=u,{options:S=[]}=u,{getOptionLabel:M=Se=>`${Se}`}=u,{getOptionValue:T=Se=>`${Se}`}=u;const E=createEventDispatcher();let H=!1,F=!1,Z;const $=Se=>{E("change",Se),f(8,H=!1)},J=Se=>{const Le=Se.currentTarget.value;E("type",Le),$(Le)},se=Se=>{E("pick",Se),$(Se)},ie=()=>f(9,F=!0),he=()=>{f(9,F=!1),E("blur")},fe=()=>f(8,H=!H);function pe(Se){binding_callbacks[Se?"unshift":"push"](()=>{Z=Se,f(10,Z)})}const ve=Se=>se(T(Se)),Ae=()=>{f(8,H=!1)},ze=()=>f(8,H=!1);return p.$$set=Se=>{"value"in Se&&f(0,m=Se.value),"id"in Se&&f(1,v=Se.id),"placeholder"in Se&&f(2,y=Se.placeholder),"disabled"in Se&&f(3,w=Se.disabled),"readonly"in Se&&f(4,k=Se.readonly),"options"in Se&&f(5,S=Se.options),"getOptionLabel"in Se&&f(6,M=Se.getOptionLabel),"getOptionValue"in Se&&f(7,T=Se.getOptionValue)},[m,v,y,w,k,S,M,T,H,F,Z,E,J,se,ie,he,fe,pe,ve,Ae,ze]}class Combobox extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$3x,create_fragment$3z,safe_not_equal,{value:0,id:1,placeholder:2,disabled:3,readonly:4,options:5,getOptionLabel:6,getOptionValue:7})}}function create_default_slot$1M(p){let u,f;return u=new Combobox({props:{error:p[5],disabled:p[2],value:p[0],options:p[7],placeholder:p[6],readonly:p[3],getOptionLabel:p[9],getOptionValue:p[10]}}),u.$on("change",p[11]),u.$on("pick",p[12]),u.$on("type",p[13]),u.$on("blur",p[14]),{c(){create_component(u.$$.fragment)},m(m,v){mount_component(u,m,v),f=!0},p(m,v){const y={};v&32&&(y.error=m[5]),v&4&&(y.disabled=m[2]),v&1&&(y.value=m[0]),v&128&&(y.options=m[7]),v&64&&(y.placeholder=m[6]),v&8&&(y.readonly=m[3]),v&512&&(y.getOptionLabel=m[9]),v&1024&&(y.getOptionValue=m[10]),u.$set(y)},i(m){f||(transition_in(u.$$.fragment,m),f=!0)},o(m){transition_out(u.$$.fragment,m),f=!1},d(m){destroy_component(u,m)}}}function create_fragment$3y(p){let u,f;return u=new Field$1({props:{helpText:p[8],label:p[1],labelPosition:p[4],error:p[5],$$slots:{default:[create_default_slot$1M]},$$scope:{ctx:p}}}),{c(){create_component(u.$$.fragment)},m(m,v){mount_component(u,m,v),f=!0},p(m,[v]){const y={};v&256&&(y.helpText=m[8]),v&2&&(y.label=m[1]),v&16&&(y.labelPosition=m[4]),v&32&&(y.error=m[5]),v&132845&&(y.$$scope={dirty:v,ctx:m}),u.$set(y)},i(m){f||(transition_in(u.$$.fragment,m),f=!0)},o(m){transition_out(u.$$.fragment,m),f=!1},d(m){destroy_component(u,m)}}}function instance$3w(p,u,f){let{value:m=null}=u,{label:v=void 0}=u,{disabled:y=!1}=u,{readonly:w=!1}=u,{labelPosition:k="above"}=u,{error:S=null}=u,{placeholder:M="Choose an option or type"}=u,{options:T=[]}=u,{helpText:E=null}=u,{getOptionLabel:H=fe=>J(fe,"label")}=u,{getOptionValue:F=fe=>J(fe,"value")}=u;const Z=createEventDispatcher(),$=fe=>{f(0,m=fe.detail),Z("change",fe.detail)},J=(fe,pe)=>fe&&typeof fe=="object"?fe[pe]:fe;function se(fe){bubble.call(this,p,fe)}function ie(fe){bubble.call(this,p,fe)}function he(fe){bubble.call(this,p,fe)}return p.$$set=fe=>{"value"in fe&&f(0,m=fe.value),"label"in fe&&f(1,v=fe.label),"disabled"in fe&&f(2,y=fe.disabled),"readonly"in fe&&f(3,w=fe.readonly),"labelPosition"in fe&&f(4,k=fe.labelPosition),"error"in fe&&f(5,S=fe.error),"placeholder"in fe&&f(6,M=fe.placeholder),"options"in fe&&f(7,T=fe.options),"helpText"in fe&&f(8,E=fe.helpText),"getOptionLabel"in fe&&f(9,H=fe.getOptionLabel),"getOptionValue"in fe&&f(10,F=fe.getOptionValue)},[m,v,y,w,k,S,M,T,E,H,F,$,se,ie,he]}class Combobox_1 extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$3w,create_fragment$3y,safe_not_equal,{value:0,label:1,disabled:2,readonly:3,labelPosition:4,error:5,placeholder:6,options:7,helpText:8,getOptionLabel:9,getOptionValue:10})}}const indexVars$t="",indexVars$s="",indexVars$r="";var AIOperationEnum=(p=>(p.SUMMARISE_TEXT="SUMMARISE_TEXT",p.CLEAN_DATA="CLEAN_DATA",p.TRANSLATE="TRANSLATE",p.CATEGORISE_TEXT="CATEGORISE_TEXT",p.SENTIMENT_ANALYSIS="SENTIMENT_ANALYSIS",p.PROMPT="PROMPT",p.SEARCH_WEB="SEARCH_WEB",p))(AIOperationEnum||{}),OperationFieldTypeEnum=(p=>(p.MULTI_COLUMN="columns",p.COLUMN="column",p.BINDABLE_TEXT="prompt",p))(OperationFieldTypeEnum||{}),Event$1=(p=>(p.USER_CREATED="user:created",p.USER_UPDATED="user:updated",p.USER_DELETED="user:deleted",p.USER_ONBOARDING_COMPLETE="user:onboarding:complete",p.USER_PERMISSION_ADMIN_ASSIGNED="user:admin:assigned",p.USER_PERMISSION_ADMIN_REMOVED="user:admin:removed",p.USER_PERMISSION_BUILDER_ASSIGNED="user:builder:assigned",p.USER_PERMISSION_BUILDER_REMOVED="user:builder:removed",p.USER_INVITED="user:invited",p.USER_INVITED_ACCEPTED="user:invite:accepted",p.USER_PASSWORD_FORCE_RESET="user:password:force:reset",p.USER_PASSWORD_UPDATED="user:password:updated",p.USER_PASSWORD_RESET_REQUESTED="user:password:reset:requested",p.USER_PASSWORD_RESET="user:password:reset",p.USER_DATA_COLLABORATION="user:data:collaboration",p.EMAIL_SMTP_CREATED="email:smtp:created",p.EMAIL_SMTP_UPDATED="email:smtp:updated",p.AI_CONFIG_CREATED="ai:config:created",p.AI_CONFIG_UPDATED="ai:config:updated",p.AUTH_SSO_CREATED="auth:sso:created",p.AUTH_SSO_UPDATED="auth:sso:updated",p.AUTH_SSO_ACTIVATED="auth:sso:activated",p.AUTH_SSO_DEACTIVATED="auth:sso:deactivated",p.AUTH_LOGIN="auth:login",p.AUTH_LOGOUT="auth:logout",p.ORG_NAME_UPDATED="org:info:name:updated",p.ORG_LOGO_UPDATED="org:info:logo:updated",p.ORG_PLATFORM_URL_UPDATED="org:platformurl:updated",p.INSTALLATION_VERSION_CHECKED="installation:version:checked",p.INSTALLATION_VERSION_UPGRADED="installation:version:upgraded",p.INSTALLATION_VERSION_DOWNGRADED="installation:version:downgraded",p.INSTALLATION_FIRST_STARTUP="installation:firstStartup",p.ANALYTICS_OPT_OUT="analytics:opt:out",p.ANALYTICS_OPT_IN="analytics:opt:in",p.APP_CREATED="app:created",p.APP_UPDATED="app:updated",p.APP_DELETED="app:deleted",p.APP_DUPLICATED="app:duplicated",p.APP_PUBLISHED="app:published",p.APP_UNPUBLISHED="app:unpublished",p.APP_TEMPLATE_IMPORTED="app:template:imported",p.APP_FILE_IMPORTED="app:file:imported",p.APP_VERSION_UPDATED="app:version:updated",p.APP_VERSION_REVERTED="app:version:reverted",p.APP_REVERTED="app:reverted",p.APP_EXPORTED="app:exported",p.ROLE_CREATED="role:created",p.ROLE_UPDATED="role:updated",p.ROLE_DELETED="role:deleted",p.ROLE_ASSIGNED="role:assigned",p.ROLE_UNASSIGNED="role:unassigned",p.SERVED_BUILDER="served:builder",p.SERVED_APP="served:app",p.SERVED_APP_PREVIEW="served:app:preview",p.DATASOURCE_CREATED="datasource:created",p.DATASOURCE_UPDATED="datasource:updated",p.DATASOURCE_DELETED="datasource:deleted",p.QUERY_CREATED="query:created",p.QUERY_UPDATED="query:updated",p.QUERY_DELETED="query:deleted",p.QUERY_IMPORT="query:import",p.QUERIES_RUN="queries:run",p.QUERY_PREVIEWED="query:previewed",p.TABLE_CREATED="table:created",p.TABLE_UPDATED="table:updated",p.TABLE_DELETED="table:deleted",p.TABLE_EXPORTED="table:exported",p.TABLE_IMPORTED="table:imported",p.TABLE_DATA_IMPORTED="table:data:imported",p.VIEW_CREATED="view:created",p.VIEW_UPDATED="view:updated",p.VIEW_DELETED="view:deleted",p.VIEW_EXPORTED="view:exported",p.VIEW_FILTER_CREATED="view:filter:created",p.VIEW_FILTER_UPDATED="view:filter:updated",p.VIEW_FILTER_DELETED="view:filter:deleted",p.VIEW_CALCULATION_CREATED="view:calculation:created",p.VIEW_CALCULATION_UPDATED="view:calculation:updated",p.VIEW_CALCULATION_DELETED="view:calculation:deleted",p.VIEW_JOIN_CREATED="view:join:created",p.ROWS_CREATED="rows:created",p.ROWS_IMPORTED="rows:imported",p.COMPONENT_CREATED="component:created",p.COMPONENT_DELETED="component:deleted",p.SCREEN_CREATED="screen:created",p.SCREEN_DELETED="screen:deleted",p.LAYOUT_CREATED="layout:created",p.LAYOUT_DELETED="layout:deleted",p.AUTOMATION_CREATED="automation:created",p.AUTOMATION_DELETED="automation:deleted",p.AUTOMATION_TESTED="automation:tested",p.AUTOMATIONS_RUN="automations:run",p.AUTOMATION_STEP_CREATED="automation:step:created",p.AUTOMATION_STEP_DELETED="automation:step:deleted",p.AUTOMATION_TRIGGER_UPDATED="automation:trigger:updated",p.LICENSE_PLAN_CHANGED="license:plan:changed",p.LICENSE_ACTIVATED="license:activated",p.LICENSE_PAYMENT_FAILED="license:payment:failed",p.LICENSE_PAYMENT_RECOVERED="license:payment:recovered",p.LICENSE_CHECKOUT_OPENED="license:checkout:opened",p.LICENSE_CHECKOUT_SUCCESS="license:checkout:success",p.LICENSE_PORTAL_OPENED="license:portal:opened",p.ACCOUNT_CREATED="account:created",p.ACCOUNT_DELETED="account:deleted",p.ACCOUNT_VERIFIED="account:verified",p.APP_BACKFILL_SUCCEEDED="app:backfill:succeeded",p.APP_BACKFILL_FAILED="app:backfill:failed",p.TENANT_BACKFILL_SUCCEEDED="tenant:backfill:succeeded",p.TENANT_BACKFILL_FAILED="tenant:backfill:failed",p.INSTALLATION_BACKFILL_SUCCEEDED="installation:backfill:succeeded",p.INSTALLATION_BACKFILL_FAILED="installation:backfill:failed",p.USER_GROUP_CREATED="user_group:created",p.USER_GROUP_UPDATED="user_group:updated",p.USER_GROUP_DELETED="user_group:deleted",p.USER_GROUP_USERS_ADDED="user_group:user_added",p.USER_GROUP_USERS_REMOVED="user_group:users_deleted",p.USER_GROUP_PERMISSIONS_EDITED="user_group:permissions_edited",p.USER_GROUP_ONBOARDING="user_group:onboarding_added",p.PLUGIN_INIT="plugin:init",p.PLUGIN_IMPORTED="plugin:imported",p.PLUGIN_DELETED="plugin:deleted",p.APP_BACKUP_RESTORED="app:backup:restored",p.APP_BACKUP_TRIGGERED="app:backup:triggered",p.ENVIRONMENT_VARIABLE_CREATED="environment_variable:created",p.ENVIRONMENT_VARIABLE_DELETED="environment_variable:deleted",p.ENVIRONMENT_VARIABLE_UPGRADE_PANEL_OPENED="environment_variable:upgrade_panel_opened",p.AUDIT_LOGS_FILTERED="audit_log:filtered",p.AUDIT_LOGS_DOWNLOADED="audit_log:downloaded",p.ROW_ACTION_CREATED="row_action:created",p))(Event$1||{}),StaticQuotaName=(p=>(p.ROWS="rows",p.APPS="apps",p.USERS="users",p.CREATORS="creators",p.USER_GROUPS="userGroups",p.PLUGINS="plugins",p.AI_CUSTOM_CONFIGS="aiCustomConfigs",p))(StaticQuotaName||{}),MonthlyQuotaName=(p=>(p.QUERIES="queries",p.AUTOMATIONS="automations",p.BUDIBASE_AI_CREDITS="budibaseAICredits",p))(MonthlyQuotaName||{}),Feature=(p=>(p.USER_GROUPS="userGroups",p.APP_BACKUPS="appBackups",p.ENVIRONMENT_VARIABLES="environmentVariables",p.AUDIT_LOGS="auditLogs",p.ENFORCEABLE_SSO="enforceableSSO",p.BRANDING="branding",p.SCIM="scim",p.SYNC_AUTOMATIONS="syncAutomations",p.TRIGGER_AUTOMATION_RUN="triggerAutomationRun",p.APP_BUILDERS="appBuilders",p.OFFLINE="offline",p.EXPANDED_PUBLIC_API="expandedPublicApi",p.VIEW_PERMISSIONS="viewPermissions",p.VIEW_READONLY_COLUMNS="viewReadonlyColumns",p.BUDIBASE_AI="budibaseAI",p.AI_CUSTOM_CONFIGS="aiCustomConfigs",p))(Feature||{}),BasicOperator=(p=>(p.EQUAL="equal",p.NOT_EQUAL="notEqual",p.EMPTY="empty",p.NOT_EMPTY="notEmpty",p.FUZZY="fuzzy",p.STRING="string",p))(BasicOperator||{}),ArrayOperator=(p=>(p.CONTAINS="contains",p.NOT_CONTAINS="notContains",p.CONTAINS_ANY="containsAny",p.ONE_OF="oneOf",p))(ArrayOperator||{}),RangeOperator=(p=>(p.RANGE="range",p))(RangeOperator||{}),LogicalOperator=(p=>(p.AND="$and",p.OR="$or",p))(LogicalOperator||{});function isLogicalSearchOperator(p){return Object.values(LogicalOperator).includes(p)}function isBasicSearchOperator(p){return Object.values(BasicOperator).includes(p)}function isArraySearchOperator(p){return Object.values(ArrayOperator).includes(p)}function isRangeSearchOperator(p){return Object.values(RangeOperator).includes(p)}var InternalSearchFilterOperator=(p=>(p.COMPLEX_ID_OPERATOR="_complexIdOperator",p))(InternalSearchFilterOperator||{}),EmptyFilterOption=(p=>(p.RETURN_ALL="all",p.RETURN_NONE="none",p))(EmptyFilterOption||{}),UILogicalOperator=(p=>(p.ALL="all",p.ANY="any",p))(UILogicalOperator||{});Event$1.PLUGIN_INIT;var AutomationIOType=(p=>(p.OBJECT="object",p.STRING="string",p.BOOLEAN="boolean",p.NUMBER="number",p.ARRAY="array",p.JSON="json",p.DATE="date",p.ATTACHMENT="attachment",p))(AutomationIOType||{}),AutomationCustomIOType=(p=>(p.TABLE="table",p.ROW="row",p.ROWS="rows",p.WIDE="wide",p.QUERY="query",p.QUERY_PARAMS="queryParams",p.QUERY_LIMIT="queryLimit",p.LOOP_OPTION="loopOption",p.ITEM="item",p.CODE="code",p.FILTERS="filters",p.COLUMN="column",p.TRIGGER_SCHEMA="triggerSchema",p.CRON="cron",p.WEBHOOK_URL="webhookUrl",p.AUTOMATION="automation",p.AUTOMATION_FIELDS="automationFields",p.MULTI_ATTACHMENTS="multi_attachments",p.TRIGGER_FILTER="trigger_filter",p))(AutomationCustomIOType||{}),AutomationTriggerStepId=(p=>(p.ROW_SAVED="ROW_SAVED",p.ROW_UPDATED="ROW_UPDATED",p.ROW_DELETED="ROW_DELETED",p.WEBHOOK="WEBHOOK",p.APP="APP",p.CRON="CRON",p.ROW_ACTION="ROW_ACTION",p))(AutomationTriggerStepId||{}),AutomationStepType=(p=>(p.LOGIC="LOGIC",p.ACTION="ACTION",p.TRIGGER="TRIGGER",p))(AutomationStepType||{}),AutomationActionStepId=(p=>(p.SEND_EMAIL_SMTP="SEND_EMAIL_SMTP",p.CREATE_ROW="CREATE_ROW",p.UPDATE_ROW="UPDATE_ROW",p.DELETE_ROW="DELETE_ROW",p.EXECUTE_BASH="EXECUTE_BASH",p.OUTGOING_WEBHOOK="OUTGOING_WEBHOOK",p.EXECUTE_SCRIPT="EXECUTE_SCRIPT",p.EXECUTE_QUERY="EXECUTE_QUERY",p.SERVER_LOG="SERVER_LOG",p.DELAY="DELAY",p.FILTER="FILTER",p.QUERY_ROWS="QUERY_ROWS",p.LOOP="LOOP",p.COLLECT="COLLECT",p.OPENAI="OPENAI",p.TRIGGER_AUTOMATION_RUN="TRIGGER_AUTOMATION_RUN",p.BRANCH="BRANCH",p.discord="discord",p.slack="slack",p.zapier="zapier",p.integromat="integromat",p.n8n="n8n",p))(AutomationActionStepId||{});[...Object.values(AutomationActionStepId),...Object.values(AutomationTriggerStepId)];var AutomationFeature=(p=>(p.LOOPING="LOOPING",p))(AutomationFeature||{}),AutomationEventType=(p=>(p.ROW_SAVE="row:save",p.ROW_UPDATE="row:update",p.ROW_DELETE="row:delete",p.APP_TRIGGER="app:trigger",p.CRON_TRIGGER="cron:trigger",p.WEBHOOK_TRIGGER="web:trigger",p.ROW_ACTION="row:action",p))(AutomationEventType||{}),HttpMethod=(p=>(p.GET="GET",p.POST="POST",p.PATCH="PATCH",p.PUT="PUT",p.HEAD="HEAD",p.DELETE="DELETE",p))(HttpMethod||{}),FieldType=(p=>(p.STRING="string",p.LONGFORM="longform",p.OPTIONS="options",p.NUMBER="number",p.BOOLEAN="boolean",p.ARRAY="array",p.DATETIME="datetime",p.ATTACHMENTS="attachment",p.ATTACHMENT_SINGLE="attachment_single",p.LINK="link",p.FORMULA="formula",p.AUTO="auto",p.AI="ai",p.JSON="json",p.INTERNAL="internal",p.BARCODEQR="barcodeqr",p.SIGNATURE_SINGLE="signature_single",p.BIGINT="bigint",p.BB_REFERENCE="bb_reference",p.BB_REFERENCE_SINGLE="bb_reference_single",p))(FieldType||{}),RelationshipType=(p=>(p.ONE_TO_MANY="one-to-many",p.MANY_TO_ONE="many-to-one",p.MANY_TO_MANY="many-to-many",p))(RelationshipType||{}),FormulaType=(p=>(p.STATIC="static",p.DYNAMIC="dynamic",p.AI="ai",p))(FormulaType||{}),BBReferenceFieldSubType=(p=>(p.USER="user",p.USERS="users",p))(BBReferenceFieldSubType||{});function isRelationshipField(p){return p.type===FieldType.LINK}var ViewV2Type=(p=>(p.CALCULATION="calculation",p))(ViewV2Type||{});const SEPARATOR$1="_",prefixed=p=>`${p}${SEPARATOR$1}`;var DocumentType=(p=>(p.USER="us",p.GROUP="gr",p.WORKSPACE="workspace",p.CONFIG="config",p.TEMPLATE="template",p.APP="app",p.DEV="dev",p.APP_DEV="app_dev",p.APP_METADATA="app_metadata",p.ROLE="role",p.MIGRATIONS="migrations",p.DEV_INFO="devinfo",p.AUTOMATION_LOG="log_au",p.ACCOUNT_METADATA="acc_metadata",p.PLUGIN="plg",p.DATASOURCE="datasource",p.DATASOURCE_PLUS="datasource_plus",p.APP_BACKUP="backup",p.TABLE="ta",p.ROW="ro",p.AUTOMATION="au",p.LINK="li",p.WEBHOOK="wh",p.INSTANCE="inst",p.LAYOUT="layout",p.SCREEN="screen",p.QUERY="query",p.DEPLOYMENTS="deployments",p.METADATA="metadata",p.MEM_VIEW="view",p.USER_FLAG="flag",p.AUTOMATION_METADATA="meta_au",p.AUDIT_LOG="al",p.APP_MIGRATION_METADATA="_design/migrations",p.SCIM_LOG="scimlog",p.ROW_ACTIONS="ra",p))(DocumentType||{});Object.values(DocumentType).sort((p,u)=>u.length-p.length);var InternalTable=(p=>(p.USER_METADATA="ta_users",p))(InternalTable||{}),VirtualDocumentType=(p=>(p.VIEW="view",p.ROW_ACTION="row_action",p))(VirtualDocumentType||{});Object.values(VirtualDocumentType).sort((p,u)=>u.length-p.length);var Theme=(p=>(p.LIGHTEST="lightest",p.LIGHT="light",p.DARK="dark",p.DARKEST="darkest",p.NORD="nord",p.MIDNIGHT="midnight",p))(Theme||{}),PluginType=(p=>(p.DATASOURCE="datasource",p.COMPONENT="component",p.AUTOMATION="automation",p))(PluginType||{});Object.values(PluginType),StaticQuotaName.ROWS,MonthlyQuotaName.QUERIES,MonthlyQuotaName.AUTOMATIONS,MonthlyQuotaName.QUERIES,MonthlyQuotaName.AUTOMATIONS;var PingSource=(p=>(p.BUILDER="builder",p.APP="app",p))(PingSource||{}),SortOrder=(p=>(p.ASCENDING="ascending",p.DESCENDING="descending",p))(SortOrder||{}),SortType=(p=>(p.STRING="string",p.NUMBER="number",p))(SortType||{}),util$2;(function(p){p.assertEqual=v=>v;function u(v){}p.assertIs=u;function f(v){throw new Error}p.assertNever=f,p.arrayToEnum=v=>{const y={};for(const w of v)y[w]=w;return y},p.getValidEnumValues=v=>{const y=p.objectKeys(v).filter(k=>typeof v[v[k]]!="number"),w={};for(const k of y)w[k]=v[k];return p.objectValues(w)},p.objectValues=v=>p.objectKeys(v).map(function(y){return v[y]}),p.objectKeys=typeof Object.keys=="function"?v=>Object.keys(v):v=>{const y=[];for(const w in v)Object.prototype.hasOwnProperty.call(v,w)&&y.push(w);return y},p.find=(v,y)=>{for(const w of v)if(y(w))return w},p.isInteger=typeof Number.isInteger=="function"?v=>Number.isInteger(v):v=>typeof v=="number"&&isFinite(v)&&Math.floor(v)===v;function m(v,y=" | "){return v.map(w=>typeof w=="string"?`'${w}'`:w).join(y)}p.joinValues=m,p.jsonStringifyReplacer=(v,y)=>typeof y=="bigint"?y.toString():y})(util$2||(util$2={}));var objectUtil;(function(p){p.mergeShapes=(u,f)=>({...u,...f})})(objectUtil||(objectUtil={}));const ZodParsedType=util$2.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),getParsedType=p=>{switch(typeof p){case"undefined":return ZodParsedType.undefined;case"string":return ZodParsedType.string;case"number":return isNaN(p)?ZodParsedType.nan:ZodParsedType.number;case"boolean":return ZodParsedType.boolean;case"function":return ZodParsedType.function;case"bigint":return ZodParsedType.bigint;case"symbol":return ZodParsedType.symbol;case"object":return Array.isArray(p)?ZodParsedType.array:p===null?ZodParsedType.null:p.then&&typeof p.then=="function"&&p.catch&&typeof p.catch=="function"?ZodParsedType.promise:typeof Map<"u"&&p instanceof Map?ZodParsedType.map:typeof Set<"u"&&p instanceof Set?ZodParsedType.set:typeof Date<"u"&&p instanceof Date?ZodParsedType.date:ZodParsedType.object;default:return ZodParsedType.unknown}},ZodIssueCode=util$2.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),quotelessJson=p=>JSON.stringify(p,null,2).replace(/"([^"]+)":/g,"$1:");class ZodError extends Error{constructor(u){super(),this.issues=[],this.addIssue=m=>{this.issues=[...this.issues,m]},this.addIssues=(m=[])=>{this.issues=[...this.issues,...m]};const f=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,f):this.__proto__=f,this.name="ZodError",this.issues=u}get errors(){return this.issues}format(u){const f=u||function(y){return y.message},m={_errors:[]},v=y=>{for(const w of y.issues)if(w.code==="invalid_union")w.unionErrors.map(v);else if(w.code==="invalid_return_type")v(w.returnTypeError);else if(w.code==="invalid_arguments")v(w.argumentsError);else if(w.path.length===0)m._errors.push(f(w));else{let k=m,S=0;for(;S<w.path.length;){const M=w.path[S];S===w.path.length-1?(k[M]=k[M]||{_errors:[]},k[M]._errors.push(f(w))):k[M]=k[M]||{_errors:[]},k=k[M],S++}}};return v(this),m}static assert(u){if(!(u instanceof ZodError))throw new Error(`Not a ZodError: ${u}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,util$2.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(u=f=>f.message){const f={},m=[];for(const v of this.issues)v.path.length>0?(f[v.path[0]]=f[v.path[0]]||[],f[v.path[0]].push(u(v))):m.push(u(v));return{formErrors:m,fieldErrors:f}}get formErrors(){return this.flatten()}}ZodError.create=p=>new ZodError(p);const errorMap=(p,u)=>{let f;switch(p.code){case ZodIssueCode.invalid_type:p.received===ZodParsedType.undefined?f="Required":f=`Expected ${p.expected}, received ${p.received}`;break;case ZodIssueCode.invalid_literal:f=`Invalid literal value, expected ${JSON.stringify(p.expected,util$2.jsonStringifyReplacer)}`;break;case ZodIssueCode.unrecognized_keys:f=`Unrecognized key(s) in object: ${util$2.joinValues(p.keys,", ")}`;break;case ZodIssueCode.invalid_union:f="Invalid input";break;case ZodIssueCode.invalid_union_discriminator:f=`Invalid discriminator value. Expected ${util$2.joinValues(p.options)}`;break;case ZodIssueCode.invalid_enum_value:f=`Invalid enum value. Expected ${util$2.joinValues(p.options)}, received '${p.received}'`;break;case ZodIssueCode.invalid_arguments:f="Invalid function arguments";break;case ZodIssueCode.invalid_return_type:f="Invalid function return type";break;case ZodIssueCode.invalid_date:f="Invalid date";break;case ZodIssueCode.invalid_string:typeof p.validation=="object"?"includes"in p.validation?(f=`Invalid input: must include "${p.validation.includes}"`,typeof p.validation.position=="number"&&(f=`${f} at one or more positions greater than or equal to ${p.validation.position}`)):"startsWith"in p.validation?f=`Invalid input: must start with "${p.validation.startsWith}"`:"endsWith"in p.validation?f=`Invalid input: must end with "${p.validation.endsWith}"`:util$2.assertNever(p.validation):p.validation!=="regex"?f=`Invalid ${p.validation}`:f="Invalid";break;case ZodIssueCode.too_small:p.type==="array"?f=`Array must contain ${p.exact?"exactly":p.inclusive?"at least":"more than"} ${p.minimum} element(s)`:p.type==="string"?f=`String must contain ${p.exact?"exactly":p.inclusive?"at least":"over"} ${p.minimum} character(s)`:p.type==="number"?f=`Number must be ${p.exact?"exactly equal to ":p.inclusive?"greater than or equal to ":"greater than "}${p.minimum}`:p.type==="date"?f=`Date must be ${p.exact?"exactly equal to ":p.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(p.minimum))}`:f="Invalid input";break;case ZodIssueCode.too_big:p.type==="array"?f=`Array must contain ${p.exact?"exactly":p.inclusive?"at most":"less than"} ${p.maximum} element(s)`:p.type==="string"?f=`String must contain ${p.exact?"exactly":p.inclusive?"at most":"under"} ${p.maximum} character(s)`:p.type==="number"?f=`Number must be ${p.exact?"exactly":p.inclusive?"less than or equal to":"less than"} ${p.maximum}`:p.type==="bigint"?f=`BigInt must be ${p.exact?"exactly":p.inclusive?"less than or equal to":"less than"} ${p.maximum}`:p.type==="date"?f=`Date must be ${p.exact?"exactly":p.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(p.maximum))}`:f="Invalid input";break;case ZodIssueCode.custom:f="Invalid input";break;case ZodIssueCode.invalid_intersection_types:f="Intersection results could not be merged";break;case ZodIssueCode.not_multiple_of:f=`Number must be a multiple of ${p.multipleOf}`;break;case ZodIssueCode.not_finite:f="Number must be finite";break;default:f=u.defaultError,util$2.assertNever(p)}return{message:f}};let overrideErrorMap=errorMap;function setErrorMap(p){overrideErrorMap=p}function getErrorMap(){return overrideErrorMap}const makeIssue=p=>{const{data:u,path:f,errorMaps:m,issueData:v}=p,y=[...f,...v.path||[]],w={...v,path:y};if(v.message!==void 0)return{...v,path:y,message:v.message};let k="";const S=m.filter(M=>!!M).slice().reverse();for(const M of S)k=M(w,{data:u,defaultError:k}).message;return{...v,path:y,message:k}},EMPTY_PATH=[];function addIssueToContext(p,u){const f=getErrorMap(),m=makeIssue({issueData:u,data:p.data,path:p.path,errorMaps:[p.common.contextualErrorMap,p.schemaErrorMap,f,f===errorMap?void 0:errorMap].filter(v=>!!v)});p.common.issues.push(m)}class ParseStatus{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(u,f){const m=[];for(const v of f){if(v.status==="aborted")return INVALID$3;v.status==="dirty"&&u.dirty(),m.push(v.value)}return{status:u.value,value:m}}static async mergeObjectAsync(u,f){const m=[];for(const v of f){const y=await v.key,w=await v.value;m.push({key:y,value:w})}return ParseStatus.mergeObjectSync(u,m)}static mergeObjectSync(u,f){const m={};for(const v of f){const{key:y,value:w}=v;if(y.status==="aborted"||w.status==="aborted")return INVALID$3;y.status==="dirty"&&u.dirty(),w.status==="dirty"&&u.dirty(),y.value!=="__proto__"&&(typeof w.value<"u"||v.alwaysSet)&&(m[y.value]=w.value)}return{status:u.value,value:m}}}const INVALID$3=Object.freeze({status:"aborted"}),DIRTY=p=>({status:"dirty",value:p}),OK=p=>({status:"valid",value:p}),isAborted=p=>p.status==="aborted",isDirty=p=>p.status==="dirty",isValid$3=p=>p.status==="valid",isAsync=p=>typeof Promise<"u"&&p instanceof Promise;function __classPrivateFieldGet(p,u,f,m){if(f==="a"&&!m)throw new TypeError("Private accessor was defined without a getter");if(typeof u=="function"?p!==u||!m:!u.has(p))throw new TypeError("Cannot read private member from an object whose class did not declare it");return f==="m"?m:f==="a"?m.call(p):m?m.value:u.get(p)}function __classPrivateFieldSet(p,u,f,m,v){if(m==="m")throw new TypeError("Private method is not writable");if(m==="a"&&!v)throw new TypeError("Private accessor was defined without a setter");if(typeof u=="function"?p!==u||!v:!u.has(p))throw new TypeError("Cannot write private member to an object whose class did not declare it");return m==="a"?v.call(p,f):v?v.value=f:u.set(p,f),f}typeof SuppressedError=="function"&&SuppressedError;var errorUtil;(function(p){p.errToObj=u=>typeof u=="string"?{message:u}:u||{},p.toString=u=>typeof u=="string"?u:u==null?void 0:u.message})(errorUtil||(errorUtil={}));var _ZodEnum_cache,_ZodNativeEnum_cache;class ParseInputLazyPath{constructor(u,f,m,v){this._cachedPath=[],this.parent=u,this.data=f,this._path=m,this._key=v}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const handleResult=(p,u)=>{if(isValid$3(u))return{success:!0,data:u.value};if(!p.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const f=new ZodError(p.common.issues);return this._error=f,this._error}}};function processCreateParams(p){if(!p)return{};const{errorMap:u,invalid_type_error:f,required_error:m,description:v}=p;if(u&&(f||m))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return u?{errorMap:u,description:v}:{errorMap:(w,k)=>{var S,M;const{message:T}=p;return w.code==="invalid_enum_value"?{message:T??k.defaultError}:typeof k.data>"u"?{message:(S=T??m)!==null&&S!==void 0?S:k.defaultError}:w.code!=="invalid_type"?{message:k.defaultError}:{message:(M=T??f)!==null&&M!==void 0?M:k.defaultError}},description:v}}class ZodType{constructor(u){this.spa=this.safeParseAsync,this._def=u,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(u){return getParsedType(u.data)}_getOrReturnCtx(u,f){return f||{common:u.parent.common,data:u.data,parsedType:getParsedType(u.data),schemaErrorMap:this._def.errorMap,path:u.path,parent:u.parent}}_processInputParams(u){return{status:new ParseStatus,ctx:{common:u.parent.common,data:u.data,parsedType:getParsedType(u.data),schemaErrorMap:this._def.errorMap,path:u.path,parent:u.parent}}}_parseSync(u){const f=this._parse(u);if(isAsync(f))throw new Error("Synchronous parse encountered promise.");return f}_parseAsync(u){const f=this._parse(u);return Promise.resolve(f)}parse(u,f){const m=this.safeParse(u,f);if(m.success)return m.data;throw m.error}safeParse(u,f){var m;const v={common:{issues:[],async:(m=f==null?void 0:f.async)!==null&&m!==void 0?m:!1,contextualErrorMap:f==null?void 0:f.errorMap},path:(f==null?void 0:f.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:u,parsedType:getParsedType(u)},y=this._parseSync({data:u,path:v.path,parent:v});return handleResult(v,y)}async parseAsync(u,f){const m=await this.safeParseAsync(u,f);if(m.success)return m.data;throw m.error}async safeParseAsync(u,f){const m={common:{issues:[],contextualErrorMap:f==null?void 0:f.errorMap,async:!0},path:(f==null?void 0:f.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:u,parsedType:getParsedType(u)},v=this._parse({data:u,path:m.path,parent:m}),y=await(isAsync(v)?v:Promise.resolve(v));return handleResult(m,y)}refine(u,f){const m=v=>typeof f=="string"||typeof f>"u"?{message:f}:typeof f=="function"?f(v):f;return this._refinement((v,y)=>{const w=u(v),k=()=>y.addIssue({code:ZodIssueCode.custom,...m(v)});return typeof Promise<"u"&&w instanceof Promise?w.then(S=>S?!0:(k(),!1)):w?!0:(k(),!1)})}refinement(u,f){return this._refinement((m,v)=>u(m)?!0:(v.addIssue(typeof f=="function"?f(m,v):f),!1))}_refinement(u){return new ZodEffects({schema:this,typeName:ZodFirstPartyTypeKind.ZodEffects,effect:{type:"refinement",refinement:u}})}superRefine(u){return this._refinement(u)}optional(){return ZodOptional.create(this,this._def)}nullable(){return ZodNullable.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return ZodArray.create(this,this._def)}promise(){return ZodPromise.create(this,this._def)}or(u){return ZodUnion.create([this,u],this._def)}and(u){return ZodIntersection.create(this,u,this._def)}transform(u){return new ZodEffects({...processCreateParams(this._def),schema:this,typeName:ZodFirstPartyTypeKind.ZodEffects,effect:{type:"transform",transform:u}})}default(u){const f=typeof u=="function"?u:()=>u;return new ZodDefault({...processCreateParams(this._def),innerType:this,defaultValue:f,typeName:ZodFirstPartyTypeKind.ZodDefault})}brand(){return new ZodBranded({typeName:ZodFirstPartyTypeKind.ZodBranded,type:this,...processCreateParams(this._def)})}catch(u){const f=typeof u=="function"?u:()=>u;return new ZodCatch({...processCreateParams(this._def),innerType:this,catchValue:f,typeName:ZodFirstPartyTypeKind.ZodCatch})}describe(u){const f=this.constructor;return new f({...this._def,description:u})}pipe(u){return ZodPipeline.create(this,u)}readonly(){return ZodReadonly.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const cuidRegex=/^c[^\s-]{8,}$/i,cuid2Regex=/^[0-9a-z]+$/,ulidRegex=/^[0-9A-HJKMNP-TV-Z]{26}$/,uuidRegex=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,nanoidRegex=/^[a-z0-9_-]{21}$/i,durationRegex=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,emailRegex=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,_emojiRegex="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let emojiRegex;const ipv4Regex=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,ipv6Regex=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,base64Regex=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,dateRegexSource="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",dateRegex=new RegExp(`^${dateRegexSource}$`);function timeRegexSource(p){let u="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return p.precision?u=`${u}\\.\\d{${p.precision}}`:p.precision==null&&(u=`${u}(\\.\\d+)?`),u}function timeRegex(p){return new RegExp(`^${timeRegexSource(p)}$`)}function datetimeRegex(p){let u=`${dateRegexSource}T${timeRegexSource(p)}`;const f=[];return f.push(p.local?"Z?":"Z"),p.offset&&f.push("([+-]\\d{2}:?\\d{2})"),u=`${u}(${f.join("|")})`,new RegExp(`^${u}$`)}function isValidIP(p,u){return!!((u==="v4"||!u)&&ipv4Regex.test(p)||(u==="v6"||!u)&&ipv6Regex.test(p))}class ZodString extends ZodType{_parse(u){if(this._def.coerce&&(u.data=String(u.data)),this._getType(u)!==ZodParsedType.string){const y=this._getOrReturnCtx(u);return addIssueToContext(y,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.string,received:y.parsedType}),INVALID$3}const m=new ParseStatus;let v;for(const y of this._def.checks)if(y.kind==="min")u.data.length<y.value&&(v=this._getOrReturnCtx(u,v),addIssueToContext(v,{code:ZodIssueCode.too_small,minimum:y.value,type:"string",inclusive:!0,exact:!1,message:y.message}),m.dirty());else if(y.kind==="max")u.data.length>y.value&&(v=this._getOrReturnCtx(u,v),addIssueToContext(v,{code:ZodIssueCode.too_big,maximum:y.value,type:"string",inclusive:!0,exact:!1,message:y.message}),m.dirty());else if(y.kind==="length"){const w=u.data.length>y.value,k=u.data.length<y.value;(w||k)&&(v=this._getOrReturnCtx(u,v),w?addIssueToContext(v,{code:ZodIssueCode.too_big,maximum:y.value,type:"string",inclusive:!0,exact:!0,message:y.message}):k&&addIssueToContext(v,{code:ZodIssueCode.too_small,minimum:y.value,type:"string",inclusive:!0,exact:!0,message:y.message}),m.dirty())}else if(y.kind==="email")emailRegex.test(u.data)||(v=this._getOrReturnCtx(u,v),addIssueToContext(v,{validation:"email",code:ZodIssueCode.invalid_string,message:y.message}),m.dirty());else if(y.kind==="emoji")emojiRegex||(emojiRegex=new RegExp(_emojiRegex,"u")),emojiRegex.test(u.data)||(v=this._getOrReturnCtx(u,v),addIssueToContext(v,{validation:"emoji",code:ZodIssueCode.invalid_string,message:y.message}),m.dirty());else if(y.kind==="uuid")uuidRegex.test(u.data)||(v=this._getOrReturnCtx(u,v),addIssueToContext(v,{validation:"uuid",code:ZodIssueCode.invalid_string,message:y.message}),m.dirty());else if(y.kind==="nanoid")nanoidRegex.test(u.data)||(v=this._getOrReturnCtx(u,v),addIssueToContext(v,{validation:"nanoid",code:ZodIssueCode.invalid_string,message:y.message}),m.dirty());else if(y.kind==="cuid")cuidRegex.test(u.data)||(v=this._getOrReturnCtx(u,v),addIssueToContext(v,{validation:"cuid",code:ZodIssueCode.invalid_string,message:y.message}),m.dirty());else if(y.kind==="cuid2")cuid2Regex.test(u.data)||(v=this._getOrReturnCtx(u,v),addIssueToContext(v,{validation:"cuid2",code:ZodIssueCode.invalid_string,message:y.message}),m.dirty());else if(y.kind==="ulid")ulidRegex.test(u.data)||(v=this._getOrReturnCtx(u,v),addIssueToContext(v,{validation:"ulid",code:ZodIssueCode.invalid_string,message:y.message}),m.dirty());else if(y.kind==="url")try{new URL(u.data)}catch{v=this._getOrReturnCtx(u,v),addIssueToContext(v,{validation:"url",code:ZodIssueCode.invalid_string,message:y.message}),m.dirty()}else y.kind==="regex"?(y.regex.lastIndex=0,y.regex.test(u.data)||(v=this._getOrReturnCtx(u,v),addIssueToContext(v,{validation:"regex",code:ZodIssueCode.invalid_string,message:y.message}),m.dirty())):y.kind==="trim"?u.data=u.data.trim():y.kind==="includes"?u.data.includes(y.value,y.position)||(v=this._getOrReturnCtx(u,v),addIssueToContext(v,{code:ZodIssueCode.invalid_string,validation:{includes:y.value,position:y.position},message:y.message}),m.dirty()):y.kind==="toLowerCase"?u.data=u.data.toLowerCase():y.kind==="toUpperCase"?u.data=u.data.toUpperCase():y.kind==="startsWith"?u.data.startsWith(y.value)||(v=this._getOrReturnCtx(u,v),addIssueToContext(v,{code:ZodIssueCode.invalid_string,validation:{startsWith:y.value},message:y.message}),m.dirty()):y.kind==="endsWith"?u.data.endsWith(y.value)||(v=this._getOrReturnCtx(u,v),addIssueToContext(v,{code:ZodIssueCode.invalid_string,validation:{endsWith:y.value},message:y.message}),m.dirty()):y.kind==="datetime"?datetimeRegex(y).test(u.data)||(v=this._getOrReturnCtx(u,v),addIssueToContext(v,{code:ZodIssueCode.invalid_string,validation:"datetime",message:y.message}),m.dirty()):y.kind==="date"?dateRegex.test(u.data)||(v=this._getOrReturnCtx(u,v),addIssueToContext(v,{code:ZodIssueCode.invalid_string,validation:"date",message:y.message}),m.dirty()):y.kind==="time"?timeRegex(y).test(u.data)||(v=this._getOrReturnCtx(u,v),addIssueToContext(v,{code:ZodIssueCode.invalid_string,validation:"time",message:y.message}),m.dirty()):y.kind==="duration"?durationRegex.test(u.data)||(v=this._getOrReturnCtx(u,v),addIssueToContext(v,{validation:"duration",code:ZodIssueCode.invalid_string,message:y.message}),m.dirty()):y.kind==="ip"?isValidIP(u.data,y.version)||(v=this._getOrReturnCtx(u,v),addIssueToContext(v,{validation:"ip",code:ZodIssueCode.invalid_string,message:y.message}),m.dirty()):y.kind==="base64"?base64Regex.test(u.data)||(v=this._getOrReturnCtx(u,v),addIssueToContext(v,{validation:"base64",code:ZodIssueCode.invalid_string,message:y.message}),m.dirty()):util$2.assertNever(y);return{status:m.value,value:u.data}}_regex(u,f,m){return this.refinement(v=>u.test(v),{validation:f,code:ZodIssueCode.invalid_string,...errorUtil.errToObj(m)})}_addCheck(u){return new ZodString({...this._def,checks:[...this._def.checks,u]})}email(u){return this._addCheck({kind:"email",...errorUtil.errToObj(u)})}url(u){return this._addCheck({kind:"url",...errorUtil.errToObj(u)})}emoji(u){return this._addCheck({kind:"emoji",...errorUtil.errToObj(u)})}uuid(u){return this._addCheck({kind:"uuid",...errorUtil.errToObj(u)})}nanoid(u){return this._addCheck({kind:"nanoid",...errorUtil.errToObj(u)})}cuid(u){return this._addCheck({kind:"cuid",...errorUtil.errToObj(u)})}cuid2(u){return this._addCheck({kind:"cuid2",...errorUtil.errToObj(u)})}ulid(u){return this._addCheck({kind:"ulid",...errorUtil.errToObj(u)})}base64(u){return this._addCheck({kind:"base64",...errorUtil.errToObj(u)})}ip(u){return this._addCheck({kind:"ip",...errorUtil.errToObj(u)})}datetime(u){var f,m;return typeof u=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:u}):this._addCheck({kind:"datetime",precision:typeof(u==null?void 0:u.precision)>"u"?null:u==null?void 0:u.precision,offset:(f=u==null?void 0:u.offset)!==null&&f!==void 0?f:!1,local:(m=u==null?void 0:u.local)!==null&&m!==void 0?m:!1,...errorUtil.errToObj(u==null?void 0:u.message)})}date(u){return this._addCheck({kind:"date",message:u})}time(u){return typeof u=="string"?this._addCheck({kind:"time",precision:null,message:u}):this._addCheck({kind:"time",precision:typeof(u==null?void 0:u.precision)>"u"?null:u==null?void 0:u.precision,...errorUtil.errToObj(u==null?void 0:u.message)})}duration(u){return this._addCheck({kind:"duration",...errorUtil.errToObj(u)})}regex(u,f){return this._addCheck({kind:"regex",regex:u,...errorUtil.errToObj(f)})}includes(u,f){return this._addCheck({kind:"includes",value:u,position:f==null?void 0:f.position,...errorUtil.errToObj(f==null?void 0:f.message)})}startsWith(u,f){return this._addCheck({kind:"startsWith",value:u,...errorUtil.errToObj(f)})}endsWith(u,f){return this._addCheck({kind:"endsWith",value:u,...errorUtil.errToObj(f)})}min(u,f){return this._addCheck({kind:"min",value:u,...errorUtil.errToObj(f)})}max(u,f){return this._addCheck({kind:"max",value:u,...errorUtil.errToObj(f)})}length(u,f){return this._addCheck({kind:"length",value:u,...errorUtil.errToObj(f)})}nonempty(u){return this.min(1,errorUtil.errToObj(u))}trim(){return new ZodString({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new ZodString({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new ZodString({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(u=>u.kind==="datetime")}get isDate(){return!!this._def.checks.find(u=>u.kind==="date")}get isTime(){return!!this._def.checks.find(u=>u.kind==="time")}get isDuration(){return!!this._def.checks.find(u=>u.kind==="duration")}get isEmail(){return!!this._def.checks.find(u=>u.kind==="email")}get isURL(){return!!this._def.checks.find(u=>u.kind==="url")}get isEmoji(){return!!this._def.checks.find(u=>u.kind==="emoji")}get isUUID(){return!!this._def.checks.find(u=>u.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(u=>u.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(u=>u.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(u=>u.kind==="cuid2")}get isULID(){return!!this._def.checks.find(u=>u.kind==="ulid")}get isIP(){return!!this._def.checks.find(u=>u.kind==="ip")}get isBase64(){return!!this._def.checks.find(u=>u.kind==="base64")}get minLength(){let u=null;for(const f of this._def.checks)f.kind==="min"&&(u===null||f.value>u)&&(u=f.value);return u}get maxLength(){let u=null;for(const f of this._def.checks)f.kind==="max"&&(u===null||f.value<u)&&(u=f.value);return u}}ZodString.create=p=>{var u;return new ZodString({checks:[],typeName:ZodFirstPartyTypeKind.ZodString,coerce:(u=p==null?void 0:p.coerce)!==null&&u!==void 0?u:!1,...processCreateParams(p)})};function floatSafeRemainder(p,u){const f=(p.toString().split(".")[1]||"").length,m=(u.toString().split(".")[1]||"").length,v=f>m?f:m,y=parseInt(p.toFixed(v).replace(".","")),w=parseInt(u.toFixed(v).replace(".",""));return y%w/Math.pow(10,v)}class ZodNumber extends ZodType{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(u){if(this._def.coerce&&(u.data=Number(u.data)),this._getType(u)!==ZodParsedType.number){const y=this._getOrReturnCtx(u);return addIssueToContext(y,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.number,received:y.parsedType}),INVALID$3}let m;const v=new ParseStatus;for(const y of this._def.checks)y.kind==="int"?util$2.isInteger(u.data)||(m=this._getOrReturnCtx(u,m),addIssueToContext(m,{code:ZodIssueCode.invalid_type,expected:"integer",received:"float",message:y.message}),v.dirty()):y.kind==="min"?(y.inclusive?u.data<y.value:u.data<=y.value)&&(m=this._getOrReturnCtx(u,m),addIssueToContext(m,{code:ZodIssueCode.too_small,minimum:y.value,type:"number",inclusive:y.inclusive,exact:!1,message:y.message}),v.dirty()):y.kind==="max"?(y.inclusive?u.data>y.value:u.data>=y.value)&&(m=this._getOrReturnCtx(u,m),addIssueToContext(m,{code:ZodIssueCode.too_big,maximum:y.value,type:"number",inclusive:y.inclusive,exact:!1,message:y.message}),v.dirty()):y.kind==="multipleOf"?floatSafeRemainder(u.data,y.value)!==0&&(m=this._getOrReturnCtx(u,m),addIssueToContext(m,{code:ZodIssueCode.not_multiple_of,multipleOf:y.value,message:y.message}),v.dirty()):y.kind==="finite"?Number.isFinite(u.data)||(m=this._getOrReturnCtx(u,m),addIssueToContext(m,{code:ZodIssueCode.not_finite,message:y.message}),v.dirty()):util$2.assertNever(y);return{status:v.value,value:u.data}}gte(u,f){return this.setLimit("min",u,!0,errorUtil.toString(f))}gt(u,f){return this.setLimit("min",u,!1,errorUtil.toString(f))}lte(u,f){return this.setLimit("max",u,!0,errorUtil.toString(f))}lt(u,f){return this.setLimit("max",u,!1,errorUtil.toString(f))}setLimit(u,f,m,v){return new ZodNumber({...this._def,checks:[...this._def.checks,{kind:u,value:f,inclusive:m,message:errorUtil.toString(v)}]})}_addCheck(u){return new ZodNumber({...this._def,checks:[...this._def.checks,u]})}int(u){return this._addCheck({kind:"int",message:errorUtil.toString(u)})}positive(u){return this._addCheck({kind:"min",value:0,inclusive:!1,message:errorUtil.toString(u)})}negative(u){return this._addCheck({kind:"max",value:0,inclusive:!1,message:errorUtil.toString(u)})}nonpositive(u){return this._addCheck({kind:"max",value:0,inclusive:!0,message:errorUtil.toString(u)})}nonnegative(u){return this._addCheck({kind:"min",value:0,inclusive:!0,message:errorUtil.toString(u)})}multipleOf(u,f){return this._addCheck({kind:"multipleOf",value:u,message:errorUtil.toString(f)})}finite(u){return this._addCheck({kind:"finite",message:errorUtil.toString(u)})}safe(u){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:errorUtil.toString(u)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:errorUtil.toString(u)})}get minValue(){let u=null;for(const f of this._def.checks)f.kind==="min"&&(u===null||f.value>u)&&(u=f.value);return u}get maxValue(){let u=null;for(const f of this._def.checks)f.kind==="max"&&(u===null||f.value<u)&&(u=f.value);return u}get isInt(){return!!this._def.checks.find(u=>u.kind==="int"||u.kind==="multipleOf"&&util$2.isInteger(u.value))}get isFinite(){let u=null,f=null;for(const m of this._def.checks){if(m.kind==="finite"||m.kind==="int"||m.kind==="multipleOf")return!0;m.kind==="min"?(f===null||m.value>f)&&(f=m.value):m.kind==="max"&&(u===null||m.value<u)&&(u=m.value)}return Number.isFinite(f)&&Number.isFinite(u)}}ZodNumber.create=p=>new ZodNumber({checks:[],typeName:ZodFirstPartyTypeKind.ZodNumber,coerce:(p==null?void 0:p.coerce)||!1,...processCreateParams(p)});class ZodBigInt extends ZodType{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(u){if(this._def.coerce&&(u.data=BigInt(u.data)),this._getType(u)!==ZodParsedType.bigint){const y=this._getOrReturnCtx(u);return addIssueToContext(y,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.bigint,received:y.parsedType}),INVALID$3}let m;const v=new ParseStatus;for(const y of this._def.checks)y.kind==="min"?(y.inclusive?u.data<y.value:u.data<=y.value)&&(m=this._getOrReturnCtx(u,m),addIssueToContext(m,{code:ZodIssueCode.too_small,type:"bigint",minimum:y.value,inclusive:y.inclusive,message:y.message}),v.dirty()):y.kind==="max"?(y.inclusive?u.data>y.value:u.data>=y.value)&&(m=this._getOrReturnCtx(u,m),addIssueToContext(m,{code:ZodIssueCode.too_big,type:"bigint",maximum:y.value,inclusive:y.inclusive,message:y.message}),v.dirty()):y.kind==="multipleOf"?u.data%y.value!==BigInt(0)&&(m=this._getOrReturnCtx(u,m),addIssueToContext(m,{code:ZodIssueCode.not_multiple_of,multipleOf:y.value,message:y.message}),v.dirty()):util$2.assertNever(y);return{status:v.value,value:u.data}}gte(u,f){return this.setLimit("min",u,!0,errorUtil.toString(f))}gt(u,f){return this.setLimit("min",u,!1,errorUtil.toString(f))}lte(u,f){return this.setLimit("max",u,!0,errorUtil.toString(f))}lt(u,f){return this.setLimit("max",u,!1,errorUtil.toString(f))}setLimit(u,f,m,v){return new ZodBigInt({...this._def,checks:[...this._def.checks,{kind:u,value:f,inclusive:m,message:errorUtil.toString(v)}]})}_addCheck(u){return new ZodBigInt({...this._def,checks:[...this._def.checks,u]})}positive(u){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:errorUtil.toString(u)})}negative(u){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:errorUtil.toString(u)})}nonpositive(u){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:errorUtil.toString(u)})}nonnegative(u){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:errorUtil.toString(u)})}multipleOf(u,f){return this._addCheck({kind:"multipleOf",value:u,message:errorUtil.toString(f)})}get minValue(){let u=null;for(const f of this._def.checks)f.kind==="min"&&(u===null||f.value>u)&&(u=f.value);return u}get maxValue(){let u=null;for(const f of this._def.checks)f.kind==="max"&&(u===null||f.value<u)&&(u=f.value);return u}}ZodBigInt.create=p=>{var u;return new ZodBigInt({checks:[],typeName:ZodFirstPartyTypeKind.ZodBigInt,coerce:(u=p==null?void 0:p.coerce)!==null&&u!==void 0?u:!1,...processCreateParams(p)})};class ZodBoolean extends ZodType{_parse(u){if(this._def.coerce&&(u.data=!!u.data),this._getType(u)!==ZodParsedType.boolean){const m=this._getOrReturnCtx(u);return addIssueToContext(m,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.boolean,received:m.parsedType}),INVALID$3}return OK(u.data)}}ZodBoolean.create=p=>new ZodBoolean({typeName:ZodFirstPartyTypeKind.ZodBoolean,coerce:(p==null?void 0:p.coerce)||!1,...processCreateParams(p)});class ZodDate extends ZodType{_parse(u){if(this._def.coerce&&(u.data=new Date(u.data)),this._getType(u)!==ZodParsedType.date){const y=this._getOrReturnCtx(u);return addIssueToContext(y,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.date,received:y.parsedType}),INVALID$3}if(isNaN(u.data.getTime())){const y=this._getOrReturnCtx(u);return addIssueToContext(y,{code:ZodIssueCode.invalid_date}),INVALID$3}const m=new ParseStatus;let v;for(const y of this._def.checks)y.kind==="min"?u.data.getTime()<y.value&&(v=this._getOrReturnCtx(u,v),addIssueToContext(v,{code:ZodIssueCode.too_small,message:y.message,inclusive:!0,exact:!1,minimum:y.value,type:"date"}),m.dirty()):y.kind==="max"?u.data.getTime()>y.value&&(v=this._getOrReturnCtx(u,v),addIssueToContext(v,{code:ZodIssueCode.too_big,message:y.message,inclusive:!0,exact:!1,maximum:y.value,type:"date"}),m.dirty()):util$2.assertNever(y);return{status:m.value,value:new Date(u.data.getTime())}}_addCheck(u){return new ZodDate({...this._def,checks:[...this._def.checks,u]})}min(u,f){return this._addCheck({kind:"min",value:u.getTime(),message:errorUtil.toString(f)})}max(u,f){return this._addCheck({kind:"max",value:u.getTime(),message:errorUtil.toString(f)})}get minDate(){let u=null;for(const f of this._def.checks)f.kind==="min"&&(u===null||f.value>u)&&(u=f.value);return u!=null?new Date(u):null}get maxDate(){let u=null;for(const f of this._def.checks)f.kind==="max"&&(u===null||f.value<u)&&(u=f.value);return u!=null?new Date(u):null}}ZodDate.create=p=>new ZodDate({checks:[],coerce:(p==null?void 0:p.coerce)||!1,typeName:ZodFirstPartyTypeKind.ZodDate,...processCreateParams(p)});class ZodSymbol extends ZodType{_parse(u){if(this._getType(u)!==ZodParsedType.symbol){const m=this._getOrReturnCtx(u);return addIssueToContext(m,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.symbol,received:m.parsedType}),INVALID$3}return OK(u.data)}}ZodSymbol.create=p=>new ZodSymbol({typeName:ZodFirstPartyTypeKind.ZodSymbol,...processCreateParams(p)});class ZodUndefined extends ZodType{_parse(u){if(this._getType(u)!==ZodParsedType.undefined){const m=this._getOrReturnCtx(u);return addIssueToContext(m,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.undefined,received:m.parsedType}),INVALID$3}return OK(u.data)}}ZodUndefined.create=p=>new ZodUndefined({typeName:ZodFirstPartyTypeKind.ZodUndefined,...processCreateParams(p)});class ZodNull extends ZodType{_parse(u){if(this._getType(u)!==ZodParsedType.null){const m=this._getOrReturnCtx(u);return addIssueToContext(m,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.null,received:m.parsedType}),INVALID$3}return OK(u.data)}}ZodNull.create=p=>new ZodNull({typeName:ZodFirstPartyTypeKind.ZodNull,...processCreateParams(p)});class ZodAny extends ZodType{constructor(){super(...arguments),this._any=!0}_parse(u){return OK(u.data)}}ZodAny.create=p=>new ZodAny({typeName:ZodFirstPartyTypeKind.ZodAny,...processCreateParams(p)});class ZodUnknown extends ZodType{constructor(){super(...arguments),this._unknown=!0}_parse(u){return OK(u.data)}}ZodUnknown.create=p=>new ZodUnknown({typeName:ZodFirstPartyTypeKind.ZodUnknown,...processCreateParams(p)});class ZodNever extends ZodType{_parse(u){const f=this._getOrReturnCtx(u);return addIssueToContext(f,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.never,received:f.parsedType}),INVALID$3}}ZodNever.create=p=>new ZodNever({typeName:ZodFirstPartyTypeKind.ZodNever,...processCreateParams(p)});class ZodVoid extends ZodType{_parse(u){if(this._getType(u)!==ZodParsedType.undefined){const m=this._getOrReturnCtx(u);return addIssueToContext(m,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.void,received:m.parsedType}),INVALID$3}return OK(u.data)}}ZodVoid.create=p=>new ZodVoid({typeName:ZodFirstPartyTypeKind.ZodVoid,...processCreateParams(p)});class ZodArray extends ZodType{_parse(u){const{ctx:f,status:m}=this._processInputParams(u),v=this._def;if(f.parsedType!==ZodParsedType.array)return addIssueToContext(f,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.array,received:f.parsedType}),INVALID$3;if(v.exactLength!==null){const w=f.data.length>v.exactLength.value,k=f.data.length<v.exactLength.value;(w||k)&&(addIssueToContext(f,{code:w?ZodIssueCode.too_big:ZodIssueCode.too_small,minimum:k?v.exactLength.value:void 0,maximum:w?v.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:v.exactLength.message}),m.dirty())}if(v.minLength!==null&&f.data.length<v.minLength.value&&(addIssueToContext(f,{code:ZodIssueCode.too_small,minimum:v.minLength.value,type:"array",inclusive:!0,exact:!1,message:v.minLength.message}),m.dirty()),v.maxLength!==null&&f.data.length>v.maxLength.value&&(addIssueToContext(f,{code:ZodIssueCode.too_big,maximum:v.maxLength.value,type:"array",inclusive:!0,exact:!1,message:v.maxLength.message}),m.dirty()),f.common.async)return Promise.all([...f.data].map((w,k)=>v.type._parseAsync(new ParseInputLazyPath(f,w,f.path,k)))).then(w=>ParseStatus.mergeArray(m,w));const y=[...f.data].map((w,k)=>v.type._parseSync(new ParseInputLazyPath(f,w,f.path,k)));return ParseStatus.mergeArray(m,y)}get element(){return this._def.type}min(u,f){return new ZodArray({...this._def,minLength:{value:u,message:errorUtil.toString(f)}})}max(u,f){return new ZodArray({...this._def,maxLength:{value:u,message:errorUtil.toString(f)}})}length(u,f){return new ZodArray({...this._def,exactLength:{value:u,message:errorUtil.toString(f)}})}nonempty(u){return this.min(1,u)}}ZodArray.create=(p,u)=>new ZodArray({type:p,minLength:null,maxLength:null,exactLength:null,typeName:ZodFirstPartyTypeKind.ZodArray,...processCreateParams(u)});function deepPartialify(p){if(p instanceof ZodObject){const u={};for(const f in p.shape){const m=p.shape[f];u[f]=ZodOptional.create(deepPartialify(m))}return new ZodObject({...p._def,shape:()=>u})}else return p instanceof ZodArray?new ZodArray({...p._def,type:deepPartialify(p.element)}):p instanceof ZodOptional?ZodOptional.create(deepPartialify(p.unwrap())):p instanceof ZodNullable?ZodNullable.create(deepPartialify(p.unwrap())):p instanceof ZodTuple?ZodTuple.create(p.items.map(u=>deepPartialify(u))):p}class ZodObject extends ZodType{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const u=this._def.shape(),f=util$2.objectKeys(u);return this._cached={shape:u,keys:f}}_parse(u){if(this._getType(u)!==ZodParsedType.object){const M=this._getOrReturnCtx(u);return addIssueToContext(M,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.object,received:M.parsedType}),INVALID$3}const{status:m,ctx:v}=this._processInputParams(u),{shape:y,keys:w}=this._getCached(),k=[];if(!(this._def.catchall instanceof ZodNever&&this._def.unknownKeys==="strip"))for(const M in v.data)w.includes(M)||k.push(M);const S=[];for(const M of w){const T=y[M],E=v.data[M];S.push({key:{status:"valid",value:M},value:T._parse(new ParseInputLazyPath(v,E,v.path,M)),alwaysSet:M in v.data})}if(this._def.catchall instanceof ZodNever){const M=this._def.unknownKeys;if(M==="passthrough")for(const T of k)S.push({key:{status:"valid",value:T},value:{status:"valid",value:v.data[T]}});else if(M==="strict")k.length>0&&(addIssueToContext(v,{code:ZodIssueCode.unrecognized_keys,keys:k}),m.dirty());else if(M!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const M=this._def.catchall;for(const T of k){const E=v.data[T];S.push({key:{status:"valid",value:T},value:M._parse(new ParseInputLazyPath(v,E,v.path,T)),alwaysSet:T in v.data})}}return v.common.async?Promise.resolve().then(async()=>{const M=[];for(const T of S){const E=await T.key,H=await T.value;M.push({key:E,value:H,alwaysSet:T.alwaysSet})}return M}).then(M=>ParseStatus.mergeObjectSync(m,M)):ParseStatus.mergeObjectSync(m,S)}get shape(){return this._def.shape()}strict(u){return errorUtil.errToObj,new ZodObject({...this._def,unknownKeys:"strict",...u!==void 0?{errorMap:(f,m)=>{var v,y,w,k;const S=(w=(y=(v=this._def).errorMap)===null||y===void 0?void 0:y.call(v,f,m).message)!==null&&w!==void 0?w:m.defaultError;return f.code==="unrecognized_keys"?{message:(k=errorUtil.errToObj(u).message)!==null&&k!==void 0?k:S}:{message:S}}}:{}})}strip(){return new ZodObject({...this._def,unknownKeys:"strip"})}passthrough(){return new ZodObject({...this._def,unknownKeys:"passthrough"})}extend(u){return new ZodObject({...this._def,shape:()=>({...this._def.shape(),...u})})}merge(u){return new ZodObject({unknownKeys:u._def.unknownKeys,catchall:u._def.catchall,shape:()=>({...this._def.shape(),...u._def.shape()}),typeName:ZodFirstPartyTypeKind.ZodObject})}setKey(u,f){return this.augment({[u]:f})}catchall(u){return new ZodObject({...this._def,catchall:u})}pick(u){const f={};return util$2.objectKeys(u).forEach(m=>{u[m]&&this.shape[m]&&(f[m]=this.shape[m])}),new ZodObject({...this._def,shape:()=>f})}omit(u){const f={};return util$2.objectKeys(this.shape).forEach(m=>{u[m]||(f[m]=this.shape[m])}),new ZodObject({...this._def,shape:()=>f})}deepPartial(){return deepPartialify(this)}partial(u){const f={};return util$2.objectKeys(this.shape).forEach(m=>{const v=this.shape[m];u&&!u[m]?f[m]=v:f[m]=v.optional()}),new ZodObject({...this._def,shape:()=>f})}required(u){const f={};return util$2.objectKeys(this.shape).forEach(m=>{if(u&&!u[m])f[m]=this.shape[m];else{let y=this.shape[m];for(;y instanceof ZodOptional;)y=y._def.innerType;f[m]=y}}),new ZodObject({...this._def,shape:()=>f})}keyof(){return createZodEnum(util$2.objectKeys(this.shape))}}ZodObject.create=(p,u)=>new ZodObject({shape:()=>p,unknownKeys:"strip",catchall:ZodNever.create(),typeName:ZodFirstPartyTypeKind.ZodObject,...processCreateParams(u)}),ZodObject.strictCreate=(p,u)=>new ZodObject({shape:()=>p,unknownKeys:"strict",catchall:ZodNever.create(),typeName:ZodFirstPartyTypeKind.ZodObject,...processCreateParams(u)}),ZodObject.lazycreate=(p,u)=>new ZodObject({shape:p,unknownKeys:"strip",catchall:ZodNever.create(),typeName:ZodFirstPartyTypeKind.ZodObject,...processCreateParams(u)});class ZodUnion extends ZodType{_parse(u){const{ctx:f}=this._processInputParams(u),m=this._def.options;function v(y){for(const k of y)if(k.result.status==="valid")return k.result;for(const k of y)if(k.result.status==="dirty")return f.common.issues.push(...k.ctx.common.issues),k.result;const w=y.map(k=>new ZodError(k.ctx.common.issues));return addIssueToContext(f,{code:ZodIssueCode.invalid_union,unionErrors:w}),INVALID$3}if(f.common.async)return Promise.all(m.map(async y=>{const w={...f,common:{...f.common,issues:[]},parent:null};return{result:await y._parseAsync({data:f.data,path:f.path,parent:w}),ctx:w}})).then(v);{let y;const w=[];for(const S of m){const M={...f,common:{...f.common,issues:[]},parent:null},T=S._parseSync({data:f.data,path:f.path,parent:M});if(T.status==="valid")return T;T.status==="dirty"&&!y&&(y={result:T,ctx:M}),M.common.issues.length&&w.push(M.common.issues)}if(y)return f.common.issues.push(...y.ctx.common.issues),y.result;const k=w.map(S=>new ZodError(S));return addIssueToContext(f,{code:ZodIssueCode.invalid_union,unionErrors:k}),INVALID$3}}get options(){return this._def.options}}ZodUnion.create=(p,u)=>new ZodUnion({options:p,typeName:ZodFirstPartyTypeKind.ZodUnion,...processCreateParams(u)});const getDiscriminator=p=>p instanceof ZodLazy?getDiscriminator(p.schema):p instanceof ZodEffects?getDiscriminator(p.innerType()):p instanceof ZodLiteral?[p.value]:p instanceof ZodEnum?p.options:p instanceof ZodNativeEnum?util$2.objectValues(p.enum):p instanceof ZodDefault?getDiscriminator(p._def.innerType):p instanceof ZodUndefined?[void 0]:p instanceof ZodNull?[null]:p instanceof ZodOptional?[void 0,...getDiscriminator(p.unwrap())]:p instanceof ZodNullable?[null,...getDiscriminator(p.unwrap())]:p instanceof ZodBranded||p instanceof ZodReadonly?getDiscriminator(p.unwrap()):p instanceof ZodCatch?getDiscriminator(p._def.innerType):[];class ZodDiscriminatedUnion extends ZodType{_parse(u){const{ctx:f}=this._processInputParams(u);if(f.parsedType!==ZodParsedType.object)return addIssueToContext(f,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.object,received:f.parsedType}),INVALID$3;const m=this.discriminator,v=f.data[m],y=this.optionsMap.get(v);return y?f.common.async?y._parseAsync({data:f.data,path:f.path,parent:f}):y._parseSync({data:f.data,path:f.path,parent:f}):(addIssueToContext(f,{code:ZodIssueCode.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[m]}),INVALID$3)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(u,f,m){const v=new Map;for(const y of f){const w=getDiscriminator(y.shape[u]);if(!w.length)throw new Error(`A discriminator value for key \`${u}\` could not be extracted from all schema options`);for(const k of w){if(v.has(k))throw new Error(`Discriminator property ${String(u)} has duplicate value ${String(k)}`);v.set(k,y)}}return new ZodDiscriminatedUnion({typeName:ZodFirstPartyTypeKind.ZodDiscriminatedUnion,discriminator:u,options:f,optionsMap:v,...processCreateParams(m)})}}function mergeValues(p,u){const f=getParsedType(p),m=getParsedType(u);if(p===u)return{valid:!0,data:p};if(f===ZodParsedType.object&&m===ZodParsedType.object){const v=util$2.objectKeys(u),y=util$2.objectKeys(p).filter(k=>v.indexOf(k)!==-1),w={...p,...u};for(const k of y){const S=mergeValues(p[k],u[k]);if(!S.valid)return{valid:!1};w[k]=S.data}return{valid:!0,data:w}}else if(f===ZodParsedType.array&&m===ZodParsedType.array){if(p.length!==u.length)return{valid:!1};const v=[];for(let y=0;y<p.length;y++){const w=p[y],k=u[y],S=mergeValues(w,k);if(!S.valid)return{valid:!1};v.push(S.data)}return{valid:!0,data:v}}else return f===ZodParsedType.date&&m===ZodParsedType.date&&+p==+u?{valid:!0,data:p}:{valid:!1}}class ZodIntersection extends ZodType{_parse(u){const{status:f,ctx:m}=this._processInputParams(u),v=(y,w)=>{if(isAborted(y)||isAborted(w))return INVALID$3;const k=mergeValues(y.value,w.value);return k.valid?((isDirty(y)||isDirty(w))&&f.dirty(),{status:f.value,value:k.data}):(addIssueToContext(m,{code:ZodIssueCode.invalid_intersection_types}),INVALID$3)};return m.common.async?Promise.all([this._def.left._parseAsync({data:m.data,path:m.path,parent:m}),this._def.right._parseAsync({data:m.data,path:m.path,parent:m})]).then(([y,w])=>v(y,w)):v(this._def.left._parseSync({data:m.data,path:m.path,parent:m}),this._def.right._parseSync({data:m.data,path:m.path,parent:m}))}}ZodIntersection.create=(p,u,f)=>new ZodIntersection({left:p,right:u,typeName:ZodFirstPartyTypeKind.ZodIntersection,...processCreateParams(f)});class ZodTuple extends ZodType{_parse(u){const{status:f,ctx:m}=this._processInputParams(u);if(m.parsedType!==ZodParsedType.array)return addIssueToContext(m,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.array,received:m.parsedType}),INVALID$3;if(m.data.length<this._def.items.length)return addIssueToContext(m,{code:ZodIssueCode.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),INVALID$3;!this._def.rest&&m.data.length>this._def.items.length&&(addIssueToContext(m,{code:ZodIssueCode.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),f.dirty());const y=[...m.data].map((w,k)=>{const S=this._def.items[k]||this._def.rest;return S?S._parse(new ParseInputLazyPath(m,w,m.path,k)):null}).filter(w=>!!w);return m.common.async?Promise.all(y).then(w=>ParseStatus.mergeArray(f,w)):ParseStatus.mergeArray(f,y)}get items(){return this._def.items}rest(u){return new ZodTuple({...this._def,rest:u})}}ZodTuple.create=(p,u)=>{if(!Array.isArray(p))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new ZodTuple({items:p,typeName:ZodFirstPartyTypeKind.ZodTuple,rest:null,...processCreateParams(u)})};class ZodRecord extends ZodType{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(u){const{status:f,ctx:m}=this._processInputParams(u);if(m.parsedType!==ZodParsedType.object)return addIssueToContext(m,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.object,received:m.parsedType}),INVALID$3;const v=[],y=this._def.keyType,w=this._def.valueType;for(const k in m.data)v.push({key:y._parse(new ParseInputLazyPath(m,k,m.path,k)),value:w._parse(new ParseInputLazyPath(m,m.data[k],m.path,k)),alwaysSet:k in m.data});return m.common.async?ParseStatus.mergeObjectAsync(f,v):ParseStatus.mergeObjectSync(f,v)}get element(){return this._def.valueType}static create(u,f,m){return f instanceof ZodType?new ZodRecord({keyType:u,valueType:f,typeName:ZodFirstPartyTypeKind.ZodRecord,...processCreateParams(m)}):new ZodRecord({keyType:ZodString.create(),valueType:u,typeName:ZodFirstPartyTypeKind.ZodRecord,...processCreateParams(f)})}}class ZodMap extends ZodType{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(u){const{status:f,ctx:m}=this._processInputParams(u);if(m.parsedType!==ZodParsedType.map)return addIssueToContext(m,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.map,received:m.parsedType}),INVALID$3;const v=this._def.keyType,y=this._def.valueType,w=[...m.data.entries()].map(([k,S],M)=>({key:v._parse(new ParseInputLazyPath(m,k,m.path,[M,"key"])),value:y._parse(new ParseInputLazyPath(m,S,m.path,[M,"value"]))}));if(m.common.async){const k=new Map;return Promise.resolve().then(async()=>{for(const S of w){const M=await S.key,T=await S.value;if(M.status==="aborted"||T.status==="aborted")return INVALID$3;(M.status==="dirty"||T.status==="dirty")&&f.dirty(),k.set(M.value,T.value)}return{status:f.value,value:k}})}else{const k=new Map;for(const S of w){const M=S.key,T=S.value;if(M.status==="aborted"||T.status==="aborted")return INVALID$3;(M.status==="dirty"||T.status==="dirty")&&f.dirty(),k.set(M.value,T.value)}return{status:f.value,value:k}}}}ZodMap.create=(p,u,f)=>new ZodMap({valueType:u,keyType:p,typeName:ZodFirstPartyTypeKind.ZodMap,...processCreateParams(f)});class ZodSet extends ZodType{_parse(u){const{status:f,ctx:m}=this._processInputParams(u);if(m.parsedType!==ZodParsedType.set)return addIssueToContext(m,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.set,received:m.parsedType}),INVALID$3;const v=this._def;v.minSize!==null&&m.data.size<v.minSize.value&&(addIssueToContext(m,{code:ZodIssueCode.too_small,minimum:v.minSize.value,type:"set",inclusive:!0,exact:!1,message:v.minSize.message}),f.dirty()),v.maxSize!==null&&m.data.size>v.maxSize.value&&(addIssueToContext(m,{code:ZodIssueCode.too_big,maximum:v.maxSize.value,type:"set",inclusive:!0,exact:!1,message:v.maxSize.message}),f.dirty());const y=this._def.valueType;function w(S){const M=new Set;for(const T of S){if(T.status==="aborted")return INVALID$3;T.status==="dirty"&&f.dirty(),M.add(T.value)}return{status:f.value,value:M}}const k=[...m.data.values()].map((S,M)=>y._parse(new ParseInputLazyPath(m,S,m.path,M)));return m.common.async?Promise.all(k).then(S=>w(S)):w(k)}min(u,f){return new ZodSet({...this._def,minSize:{value:u,message:errorUtil.toString(f)}})}max(u,f){return new ZodSet({...this._def,maxSize:{value:u,message:errorUtil.toString(f)}})}size(u,f){return this.min(u,f).max(u,f)}nonempty(u){return this.min(1,u)}}ZodSet.create=(p,u)=>new ZodSet({valueType:p,minSize:null,maxSize:null,typeName:ZodFirstPartyTypeKind.ZodSet,...processCreateParams(u)});class ZodFunction extends ZodType{constructor(){super(...arguments),this.validate=this.implement}_parse(u){const{ctx:f}=this._processInputParams(u);if(f.parsedType!==ZodParsedType.function)return addIssueToContext(f,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.function,received:f.parsedType}),INVALID$3;function m(k,S){return makeIssue({data:k,path:f.path,errorMaps:[f.common.contextualErrorMap,f.schemaErrorMap,getErrorMap(),errorMap].filter(M=>!!M),issueData:{code:ZodIssueCode.invalid_arguments,argumentsError:S}})}function v(k,S){return makeIssue({data:k,path:f.path,errorMaps:[f.common.contextualErrorMap,f.schemaErrorMap,getErrorMap(),errorMap].filter(M=>!!M),issueData:{code:ZodIssueCode.invalid_return_type,returnTypeError:S}})}const y={errorMap:f.common.contextualErrorMap},w=f.data;if(this._def.returns instanceof ZodPromise){const k=this;return OK(async function(...S){const M=new ZodError([]),T=await k._def.args.parseAsync(S,y).catch(F=>{throw M.addIssue(m(S,F)),M}),E=await Reflect.apply(w,this,T);return await k._def.returns._def.type.parseAsync(E,y).catch(F=>{throw M.addIssue(v(E,F)),M})})}else{const k=this;return OK(function(...S){const M=k._def.args.safeParse(S,y);if(!M.success)throw new ZodError([m(S,M.error)]);const T=Reflect.apply(w,this,M.data),E=k._def.returns.safeParse(T,y);if(!E.success)throw new ZodError([v(T,E.error)]);return E.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...u){return new ZodFunction({...this._def,args:ZodTuple.create(u).rest(ZodUnknown.create())})}returns(u){return new ZodFunction({...this._def,returns:u})}implement(u){return this.parse(u)}strictImplement(u){return this.parse(u)}static create(u,f,m){return new ZodFunction({args:u||ZodTuple.create([]).rest(ZodUnknown.create()),returns:f||ZodUnknown.create(),typeName:ZodFirstPartyTypeKind.ZodFunction,...processCreateParams(m)})}}class ZodLazy extends ZodType{get schema(){return this._def.getter()}_parse(u){const{ctx:f}=this._processInputParams(u);return this._def.getter()._parse({data:f.data,path:f.path,parent:f})}}ZodLazy.create=(p,u)=>new ZodLazy({getter:p,typeName:ZodFirstPartyTypeKind.ZodLazy,...processCreateParams(u)});class ZodLiteral extends ZodType{_parse(u){if(u.data!==this._def.value){const f=this._getOrReturnCtx(u);return addIssueToContext(f,{received:f.data,code:ZodIssueCode.invalid_literal,expected:this._def.value}),INVALID$3}return{status:"valid",value:u.data}}get value(){return this._def.value}}ZodLiteral.create=(p,u)=>new ZodLiteral({value:p,typeName:ZodFirstPartyTypeKind.ZodLiteral,...processCreateParams(u)});function createZodEnum(p,u){return new ZodEnum({values:p,typeName:ZodFirstPartyTypeKind.ZodEnum,...processCreateParams(u)})}class ZodEnum extends ZodType{constructor(){super(...arguments),_ZodEnum_cache.set(this,void 0)}_parse(u){if(typeof u.data!="string"){const f=this._getOrReturnCtx(u),m=this._def.values;return addIssueToContext(f,{expected:util$2.joinValues(m),received:f.parsedType,code:ZodIssueCode.invalid_type}),INVALID$3}if(__classPrivateFieldGet(this,_ZodEnum_cache,"f")||__classPrivateFieldSet(this,_ZodEnum_cache,new Set(this._def.values),"f"),!__classPrivateFieldGet(this,_ZodEnum_cache,"f").has(u.data)){const f=this._getOrReturnCtx(u),m=this._def.values;return addIssueToContext(f,{received:f.data,code:ZodIssueCode.invalid_enum_value,options:m}),INVALID$3}return OK(u.data)}get options(){return this._def.values}get enum(){const u={};for(const f of this._def.values)u[f]=f;return u}get Values(){const u={};for(const f of this._def.values)u[f]=f;return u}get Enum(){const u={};for(const f of this._def.values)u[f]=f;return u}extract(u,f=this._def){return ZodEnum.create(u,{...this._def,...f})}exclude(u,f=this._def){return ZodEnum.create(this.options.filter(m=>!u.includes(m)),{...this._def,...f})}}_ZodEnum_cache=new WeakMap,ZodEnum.create=createZodEnum;class ZodNativeEnum extends ZodType{constructor(){super(...arguments),_ZodNativeEnum_cache.set(this,void 0)}_parse(u){const f=util$2.getValidEnumValues(this._def.values),m=this._getOrReturnCtx(u);if(m.parsedType!==ZodParsedType.string&&m.parsedType!==ZodParsedType.number){const v=util$2.objectValues(f);return addIssueToContext(m,{expected:util$2.joinValues(v),received:m.parsedType,code:ZodIssueCode.invalid_type}),INVALID$3}if(__classPrivateFieldGet(this,_ZodNativeEnum_cache,"f")||__classPrivateFieldSet(this,_ZodNativeEnum_cache,new Set(util$2.getValidEnumValues(this._def.values)),"f"),!__classPrivateFieldGet(this,_ZodNativeEnum_cache,"f").has(u.data)){const v=util$2.objectValues(f);return addIssueToContext(m,{received:m.data,code:ZodIssueCode.invalid_enum_value,options:v}),INVALID$3}return OK(u.data)}get enum(){return this._def.values}}_ZodNativeEnum_cache=new WeakMap,ZodNativeEnum.create=(p,u)=>new ZodNativeEnum({values:p,typeName:ZodFirstPartyTypeKind.ZodNativeEnum,...processCreateParams(u)});class ZodPromise extends ZodType{unwrap(){return this._def.type}_parse(u){const{ctx:f}=this._processInputParams(u);if(f.parsedType!==ZodParsedType.promise&&f.common.async===!1)return addIssueToContext(f,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.promise,received:f.parsedType}),INVALID$3;const m=f.parsedType===ZodParsedType.promise?f.data:Promise.resolve(f.data);return OK(m.then(v=>this._def.type.parseAsync(v,{path:f.path,errorMap:f.common.contextualErrorMap})))}}ZodPromise.create=(p,u)=>new ZodPromise({type:p,typeName:ZodFirstPartyTypeKind.ZodPromise,...processCreateParams(u)});class ZodEffects extends ZodType{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===ZodFirstPartyTypeKind.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(u){const{status:f,ctx:m}=this._processInputParams(u),v=this._def.effect||null,y={addIssue:w=>{addIssueToContext(m,w),w.fatal?f.abort():f.dirty()},get path(){return m.path}};if(y.addIssue=y.addIssue.bind(y),v.type==="preprocess"){const w=v.transform(m.data,y);if(m.common.async)return Promise.resolve(w).then(async k=>{if(f.value==="aborted")return INVALID$3;const S=await this._def.schema._parseAsync({data:k,path:m.path,parent:m});return S.status==="aborted"?INVALID$3:S.status==="dirty"||f.value==="dirty"?DIRTY(S.value):S});{if(f.value==="aborted")return INVALID$3;const k=this._def.schema._parseSync({data:w,path:m.path,parent:m});return k.status==="aborted"?INVALID$3:k.status==="dirty"||f.value==="dirty"?DIRTY(k.value):k}}if(v.type==="refinement"){const w=k=>{const S=v.refinement(k,y);if(m.common.async)return Promise.resolve(S);if(S instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return k};if(m.common.async===!1){const k=this._def.schema._parseSync({data:m.data,path:m.path,parent:m});return k.status==="aborted"?INVALID$3:(k.status==="dirty"&&f.dirty(),w(k.value),{status:f.value,value:k.value})}else return this._def.schema._parseAsync({data:m.data,path:m.path,parent:m}).then(k=>k.status==="aborted"?INVALID$3:(k.status==="dirty"&&f.dirty(),w(k.value).then(()=>({status:f.value,value:k.value}))))}if(v.type==="transform")if(m.common.async===!1){const w=this._def.schema._parseSync({data:m.data,path:m.path,parent:m});if(!isValid$3(w))return w;const k=v.transform(w.value,y);if(k instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:f.value,value:k}}else return this._def.schema._parseAsync({data:m.data,path:m.path,parent:m}).then(w=>isValid$3(w)?Promise.resolve(v.transform(w.value,y)).then(k=>({status:f.value,value:k})):w);util$2.assertNever(v)}}ZodEffects.create=(p,u,f)=>new ZodEffects({schema:p,typeName:ZodFirstPartyTypeKind.ZodEffects,effect:u,...processCreateParams(f)}),ZodEffects.createWithPreprocess=(p,u,f)=>new ZodEffects({schema:u,effect:{type:"preprocess",transform:p},typeName:ZodFirstPartyTypeKind.ZodEffects,...processCreateParams(f)});class ZodOptional extends ZodType{_parse(u){return this._getType(u)===ZodParsedType.undefined?OK(void 0):this._def.innerType._parse(u)}unwrap(){return this._def.innerType}}ZodOptional.create=(p,u)=>new ZodOptional({innerType:p,typeName:ZodFirstPartyTypeKind.ZodOptional,...processCreateParams(u)});class ZodNullable extends ZodType{_parse(u){return this._getType(u)===ZodParsedType.null?OK(null):this._def.innerType._parse(u)}unwrap(){return this._def.innerType}}ZodNullable.create=(p,u)=>new ZodNullable({innerType:p,typeName:ZodFirstPartyTypeKind.ZodNullable,...processCreateParams(u)});class ZodDefault extends ZodType{_parse(u){const{ctx:f}=this._processInputParams(u);let m=f.data;return f.parsedType===ZodParsedType.undefined&&(m=this._def.defaultValue()),this._def.innerType._parse({data:m,path:f.path,parent:f})}removeDefault(){return this._def.innerType}}ZodDefault.create=(p,u)=>new ZodDefault({innerType:p,typeName:ZodFirstPartyTypeKind.ZodDefault,defaultValue:typeof u.default=="function"?u.default:()=>u.default,...processCreateParams(u)});class ZodCatch extends ZodType{_parse(u){const{ctx:f}=this._processInputParams(u),m={...f,common:{...f.common,issues:[]}},v=this._def.innerType._parse({data:m.data,path:m.path,parent:{...m}});return isAsync(v)?v.then(y=>({status:"valid",value:y.status==="valid"?y.value:this._def.catchValue({get error(){return new ZodError(m.common.issues)},input:m.data})})):{status:"valid",value:v.status==="valid"?v.value:this._def.catchValue({get error(){return new ZodError(m.common.issues)},input:m.data})}}removeCatch(){return this._def.innerType}}ZodCatch.create=(p,u)=>new ZodCatch({innerType:p,typeName:ZodFirstPartyTypeKind.ZodCatch,catchValue:typeof u.catch=="function"?u.catch:()=>u.catch,...processCreateParams(u)});class ZodNaN extends ZodType{_parse(u){if(this._getType(u)!==ZodParsedType.nan){const m=this._getOrReturnCtx(u);return addIssueToContext(m,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.nan,received:m.parsedType}),INVALID$3}return{status:"valid",value:u.data}}}ZodNaN.create=p=>new ZodNaN({typeName:ZodFirstPartyTypeKind.ZodNaN,...processCreateParams(p)});const BRAND=Symbol("zod_brand");class ZodBranded extends ZodType{_parse(u){const{ctx:f}=this._processInputParams(u),m=f.data;return this._def.type._parse({data:m,path:f.path,parent:f})}unwrap(){return this._def.type}}class ZodPipeline extends ZodType{_parse(u){const{status:f,ctx:m}=this._processInputParams(u);if(m.common.async)return(async()=>{const y=await this._def.in._parseAsync({data:m.data,path:m.path,parent:m});return y.status==="aborted"?INVALID$3:y.status==="dirty"?(f.dirty(),DIRTY(y.value)):this._def.out._parseAsync({data:y.value,path:m.path,parent:m})})();{const v=this._def.in._parseSync({data:m.data,path:m.path,parent:m});return v.status==="aborted"?INVALID$3:v.status==="dirty"?(f.dirty(),{status:"dirty",value:v.value}):this._def.out._parseSync({data:v.value,path:m.path,parent:m})}}static create(u,f){return new ZodPipeline({in:u,out:f,typeName:ZodFirstPartyTypeKind.ZodPipeline})}}class ZodReadonly extends ZodType{_parse(u){const f=this._def.innerType._parse(u),m=v=>(isValid$3(v)&&(v.value=Object.freeze(v.value)),v);return isAsync(f)?f.then(v=>m(v)):m(f)}unwrap(){return this._def.innerType}}ZodReadonly.create=(p,u)=>new ZodReadonly({innerType:p,typeName:ZodFirstPartyTypeKind.ZodReadonly,...processCreateParams(u)});function custom(p,u={},f){return p?ZodAny.create().superRefine((m,v)=>{var y,w;if(!p(m)){const k=typeof u=="function"?u(m):typeof u=="string"?{message:u}:u,S=(w=(y=k.fatal)!==null&&y!==void 0?y:f)!==null&&w!==void 0?w:!0,M=typeof k=="string"?{message:k}:k;v.addIssue({code:"custom",...M,fatal:S})}}):ZodAny.create()}const late={object:ZodObject.lazycreate};var ZodFirstPartyTypeKind;(function(p){p.ZodString="ZodString",p.ZodNumber="ZodNumber",p.ZodNaN="ZodNaN",p.ZodBigInt="ZodBigInt",p.ZodBoolean="ZodBoolean",p.ZodDate="ZodDate",p.ZodSymbol="ZodSymbol",p.ZodUndefined="ZodUndefined",p.ZodNull="ZodNull",p.ZodAny="ZodAny",p.ZodUnknown="ZodUnknown",p.ZodNever="ZodNever",p.ZodVoid="ZodVoid",p.ZodArray="ZodArray",p.ZodObject="ZodObject",p.ZodUnion="ZodUnion",p.ZodDiscriminatedUnion="ZodDiscriminatedUnion",p.ZodIntersection="ZodIntersection",p.ZodTuple="ZodTuple",p.ZodRecord="ZodRecord",p.ZodMap="ZodMap",p.ZodSet="ZodSet",p.ZodFunction="ZodFunction",p.ZodLazy="ZodLazy",p.ZodLiteral="ZodLiteral",p.ZodEnum="ZodEnum",p.ZodEffects="ZodEffects",p.ZodNativeEnum="ZodNativeEnum",p.ZodOptional="ZodOptional",p.ZodNullable="ZodNullable",p.ZodDefault="ZodDefault",p.ZodCatch="ZodCatch",p.ZodPromise="ZodPromise",p.ZodBranded="ZodBranded",p.ZodPipeline="ZodPipeline",p.ZodReadonly="ZodReadonly"})(ZodFirstPartyTypeKind||(ZodFirstPartyTypeKind={}));const instanceOfType=(p,u={message:`Input not instance of ${p.name}`})=>custom(f=>f instanceof p,u),stringType=ZodString.create,numberType=ZodNumber.create,nanType=ZodNaN.create,bigIntType=ZodBigInt.create,booleanType=ZodBoolean.create,dateType=ZodDate.create,symbolType=ZodSymbol.create,undefinedType=ZodUndefined.create,nullType=ZodNull.create,anyType=ZodAny.create,unknownType=ZodUnknown.create,neverType=ZodNever.create,voidType=ZodVoid.create,arrayType=ZodArray.create,objectType$1=ZodObject.create,strictObjectType=ZodObject.strictCreate,unionType=ZodUnion.create,discriminatedUnionType=ZodDiscriminatedUnion.create,intersectionType=ZodIntersection.create,tupleType=ZodTuple.create,recordType=ZodRecord.create,mapType=ZodMap.create,setType=ZodSet.create,functionType=ZodFunction.create,lazyType=ZodLazy.create,literalType=ZodLiteral.create,enumType=ZodEnum.create,nativeEnumType=ZodNativeEnum.create,promiseType=ZodPromise.create,effectsType=ZodEffects.create,optionalType=ZodOptional.create,nullableType=ZodNullable.create,preprocessType=ZodEffects.createWithPreprocess,pipelineType=ZodPipeline.create,ostring=()=>stringType().optional(),onumber=()=>numberType().optional(),oboolean=()=>booleanType().optional(),coerce={string:p=>ZodString.create({...p,coerce:!0}),number:p=>ZodNumber.create({...p,coerce:!0}),boolean:p=>ZodBoolean.create({...p,coerce:!0}),bigint:p=>ZodBigInt.create({...p,coerce:!0}),date:p=>ZodDate.create({...p,coerce:!0})},NEVER=INVALID$3;var z=Object.freeze({__proto__:null,defaultErrorMap:errorMap,setErrorMap,getErrorMap,makeIssue,EMPTY_PATH,addIssueToContext,ParseStatus,INVALID:INVALID$3,DIRTY,OK,isAborted,isDirty,isValid:isValid$3,isAsync,get util(){return util$2},get objectUtil(){return objectUtil},ZodParsedType,getParsedType,ZodType,datetimeRegex,ZodString,ZodNumber,ZodBigInt,ZodBoolean,ZodDate,ZodSymbol,ZodUndefined,ZodNull,ZodAny,ZodUnknown,ZodNever,ZodVoid,ZodArray,ZodObject,ZodUnion,ZodDiscriminatedUnion,ZodIntersection,ZodTuple,ZodRecord,ZodMap,ZodSet,ZodFunction,ZodLazy,ZodLiteral,ZodEnum,ZodNativeEnum,ZodPromise,ZodEffects,ZodTransformer:ZodEffects,ZodOptional,ZodNullable,ZodDefault,ZodCatch,ZodNaN,BRAND,ZodBranded,ZodPipeline,ZodReadonly,custom,Schema:ZodType,ZodSchema:ZodType,late,get ZodFirstPartyTypeKind(){return ZodFirstPartyTypeKind},coerce,any:anyType,array:arrayType,bigint:bigIntType,boolean:booleanType,date:dateType,discriminatedUnion:discriminatedUnionType,effect:effectsType,enum:enumType,function:functionType,instanceof:instanceOfType,intersection:intersectionType,lazy:lazyType,literal:literalType,map:mapType,nan:nanType,nativeEnum:nativeEnumType,never:neverType,null:nullType,nullable:nullableType,number:numberType,object:objectType$1,oboolean,onumber,optional:optionalType,ostring,pipeline:pipelineType,preprocess:preprocessType,promise:promiseType,record:recordType,set:setType,strictObject:strictObjectType,string:stringType,symbol:symbolType,transformer:effectsType,tuple:tupleType,undefined:undefinedType,union:unionType,unknown:unknownType,void:voidType,NEVER,ZodIssueCode,quotelessJson,ZodError});const fieldKey=z.string().refine(p=>p!==InternalSearchFilterOperator.COMPLEX_ID_OPERATOR,{message:`Key '${InternalSearchFilterOperator.COMPLEX_ID_OPERATOR}' is not allowed`}),stringBasicFilter=z.record(fieldKey,z.string()),basicFilter=z.record(fieldKey,z.any()),arrayFilter$2=z.record(fieldKey,z.union([z.any().array(),z.string()])),logicFilter=z.lazy(()=>z.object({conditions:z.array(z.object(queryFilterValidation))})),stringOrNumber=z.union([z.string(),z.number()]),queryFilterValidation={[BasicOperator.STRING]:stringBasicFilter.optional(),[BasicOperator.FUZZY]:stringBasicFilter.optional(),[RangeOperator.RANGE]:z.record(fieldKey,z.union([z.object({high:stringOrNumber,low:stringOrNumber}),z.object({high:stringOrNumber}),z.object({low:stringOrNumber})])).optional(),[BasicOperator.EQUAL]:basicFilter.optional(),[BasicOperator.NOT_EQUAL]:basicFilter.optional(),[BasicOperator.EMPTY]:basicFilter.optional(),[BasicOperator.NOT_EMPTY]:basicFilter.optional(),[ArrayOperator.ONE_OF]:arrayFilter$2.optional(),[ArrayOperator.CONTAINS]:arrayFilter$2.optional(),[ArrayOperator.NOT_CONTAINS]:arrayFilter$2.optional(),[ArrayOperator.CONTAINS_ANY]:arrayFilter$2.optional(),[LogicalOperator.AND]:logicFilter.optional(),[LogicalOperator.OR]:logicFilter.optional()};z.object({query:z.object({allOr:z.boolean().optional(),onEmptyFilter:z.nativeEnum(EmptyFilterOption).optional(),...queryFilterValidation}).optional(),paginate:z.boolean().optional(),bookmark:z.union([z.string(),z.number()]).nullish(),limit:z.number().optional(),sort:z.string().nullish(),sortOrder:z.nativeEnum(SortOrder).optional(),sortType:z.nativeEnum(SortType).nullish(),version:z.string().optional(),disableEscaping:z.boolean().optional(),countRows:z.boolean().optional()});var MaintenanceType=(p=>(p.SQS_MISSING="sqs_missing",p))(MaintenanceType||{}),DropPosition=(p=>(p.ABOVE="above",p.BELOW="below",p.INSIDE="inside",p))(DropPosition||{});AIOperationEnum.SUMMARISE_TEXT+"",OperationFieldTypeEnum.MULTI_COLUMN,AIOperationEnum.CLEAN_DATA+"",OperationFieldTypeEnum.COLUMN,AIOperationEnum.TRANSLATE+"",OperationFieldTypeEnum.COLUMN,OperationFieldTypeEnum.BINDABLE_TEXT,AIOperationEnum.CATEGORISE_TEXT+"",OperationFieldTypeEnum.MULTI_COLUMN,OperationFieldTypeEnum.BINDABLE_TEXT,AIOperationEnum.SENTIMENT_ANALYSIS+"",OperationFieldTypeEnum.COLUMN,AIOperationEnum.PROMPT+"",OperationFieldTypeEnum.BINDABLE_TEXT,AIOperationEnum.SEARCH_WEB+"",OperationFieldTypeEnum.MULTI_COLUMN;var Header=(p=>(p.API_KEY="x-budibase-api-key",p.LICENSE_KEY="x-budibase-license-key",p.API_VER="x-budibase-api-version",p.APP_ID="x-budibase-app-id",p.SESSION_ID="x-budibase-session-id",p.TYPE="x-budibase-type",p.PREVIEW_ROLE="x-budibase-role",p.TENANT_ID="x-budibase-tenant-id",p.VERIFICATION_CODE="x-budibase-verification-code",p.RETURN_VERIFICATION_CODE="x-budibase-return-verification-code",p.RESET_PASSWORD_CODE="x-budibase-reset-password-code",p.RETURN_RESET_PASSWORD_CODE="x-budibase-return-reset-password-code",p.TOKEN="x-budibase-token",p.CSRF_TOKEN="x-csrf-token",p.CORRELATION_ID="x-budibase-correlation-id",p.AUTHORIZATION="authorization",p.MIGRATING_APP="x-budibase-migrating-app",p.COOKIE="cookie",p))(Header||{});FieldType.STRING+"",FieldType.STRING,FieldType.OPTIONS,FieldType.LONGFORM,FieldType.BARCODEQR,FieldType.OPTIONS+"",FieldType.OPTIONS,FieldType.STRING,FieldType.LONGFORM,FieldType.BARCODEQR,FieldType.LONGFORM+"",FieldType.LONGFORM,FieldType.STRING,FieldType.OPTIONS,FieldType.BARCODEQR,FieldType.BARCODEQR+"",FieldType.BARCODEQR,FieldType.STRING,FieldType.OPTIONS,FieldType.LONGFORM,FieldType.NUMBER+"",FieldType.NUMBER,FieldType.BOOLEAN;const ThemeClassPrefix="spectrum--";Theme.DARKEST;const DefaultAppTheme=Theme.LIGHT,ThemeOptions=[{id:Theme.LIGHT,name:"Light"},{id:Theme.DARKEST,name:"Dark"},{id:Theme.NORD,name:"Nord",base:Theme.DARKEST},{id:Theme.MIDNIGHT,name:"Midnight",base:Theme.DARKEST}],OperatorOptions={Equals:{value:"equal",label:"Equals"},NotEquals:{value:"notEqual",label:"Not equals"},Empty:{value:"empty",label:"Is empty"},NotEmpty:{value:"notEmpty",label:"Is not empty"},StartsWith:{value:"string",label:"Starts with"},Like:{value:"fuzzy",label:"Like"},MoreThan:{value:"rangeLow",label:"More than or equal to"},LessThan:{value:"rangeHigh",label:"Less than or equal to"},Contains:{value:"contains",label:"Contains"},NotContains:{value:"notContains",label:"Does not contain"},In:{value:"oneOf",label:"Is in"},ContainsAny:{value:"containsAny",label:"Has any"}},SqlNumberTypeRangeMap={integer:{max:2147483647,min:-2147483648},int:{max:2147483647,min:-2147483648},smallint:{max:32767,min:-32768},mediumint:{max:8388607,min:-8388608}};var SocketEvent=(p=>(p.UserUpdate="UserUpdate",p.UserDisconnect="UserDisconnect",p.Heartbeat="Heartbeat",p))(SocketEvent||{}),GridSocketEvent=(p=>(p.RowChange="RowChange",p.DatasourceChange="DatasourceChange",p.SelectDatasource="SelectDatasource",p.SelectCell="SelectCell",p))(GridSocketEvent||{});const SocketSessionTTL=60,ValidColumnNameRegex=/^[_a-zA-Z0-9\s]*$/g;var BpmCorrelationKey=(p=>(p.ONBOARDING="budibase:onboarding:correlationkey",p.VERIFY_SSO_LOGIN="budibase:verify_sso_login:correlationkey",p))(BpmCorrelationKey||{});const DEFAULT_BB_DATASOURCE_ID="datasource_internal_bb_default";var commonjsGlobal$1=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function getDefaultExportFromCjs$1(p){return p&&p.__esModule&&Object.prototype.hasOwnProperty.call(p,"default")?p.default:p}function getAugmentedNamespace(p){if(p.__esModule)return p;var u=p.default;if(typeof u=="function"){var f=function m(){return this instanceof m?Reflect.construct(u,arguments,this.constructor):u.apply(this,arguments)};f.prototype=u.prototype}else f={};return Object.defineProperty(f,"__esModule",{value:!0}),Object.keys(p).forEach(function(m){var v=Object.getOwnPropertyDescriptor(p,m);Object.defineProperty(f,m,v.get?v:{enumerable:!0,get:function(){return p[m]}})}),f}var dayjs_min$1={exports:{}};(function(p,u){(function(f,m){p.exports=m()})(commonjsGlobal$1,function(){var f=1e3,m=6e4,v=36e5,y="millisecond",w="second",k="minute",S="hour",M="day",T="week",E="month",H="quarter",F="year",Z="date",$="Invalid Date",J=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,se=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,ie={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(Ge){var be=["th","st","nd","rd"],De=Ge%100;return"["+Ge+(be[(De-20)%10]||be[De]||be[0])+"]"}},he=function(Ge,be,De){var Ke=String(Ge);return!Ke||Ke.length>=be?Ge:""+Array(be+1-Ke.length).join(De)+Ge},fe={s:he,z:function(Ge){var be=-Ge.utcOffset(),De=Math.abs(be),Ke=Math.floor(De/60),He=De%60;return(be<=0?"+":"-")+he(Ke,2,"0")+":"+he(He,2,"0")},m:function Ge(be,De){if(be.date()<De.date())return-Ge(De,be);var Ke=12*(De.year()-be.year())+(De.month()-be.month()),He=be.clone().add(Ke,E),rt=De-He<0,ft=be.clone().add(Ke+(rt?-1:1),E);return+(-(Ke+(De-He)/(rt?He-ft:ft-He))||0)},a:function(Ge){return Ge<0?Math.ceil(Ge)||0:Math.floor(Ge)},p:function(Ge){return{M:E,y:F,w:T,d:M,D:Z,h:S,m:k,s:w,ms:y,Q:H}[Ge]||String(Ge||"").toLowerCase().replace(/s$/,"")},u:function(Ge){return Ge===void 0}},pe="en",ve={};ve[pe]=ie;var Ae="$isDayjsObject",ze=function(Ge){return Ge instanceof Ue||!(!Ge||!Ge[Ae])},Se=function Ge(be,De,Ke){var He;if(!be)return pe;if(typeof be=="string"){var rt=be.toLowerCase();ve[rt]&&(He=rt),De&&(ve[rt]=De,He=rt);var ft=be.split("-");if(!He&&ft.length>1)return Ge(ft[0])}else{var Mt=be.name;ve[Mt]=be,He=Mt}return!Ke&&He&&(pe=He),He||!Ke&&pe},Le=function(Ge,be){if(ze(Ge))return Ge.clone();var De=typeof be=="object"?be:{};return De.date=Ge,De.args=arguments,new Ue(De)},Ce=fe;Ce.l=Se,Ce.i=ze,Ce.w=function(Ge,be){return Le(Ge,{locale:be.$L,utc:be.$u,x:be.$x,$offset:be.$offset})};var Ue=function(){function Ge(De){this.$L=Se(De.locale,null,!0),this.parse(De),this.$x=this.$x||De.x||{},this[Ae]=!0}var be=Ge.prototype;return be.parse=function(De){this.$d=function(Ke){var He=Ke.date,rt=Ke.utc;if(He===null)return new Date(NaN);if(Ce.u(He))return new Date;if(He instanceof Date)return new Date(He);if(typeof He=="string"&&!/Z$/i.test(He)){var ft=He.match(J);if(ft){var Mt=ft[2]-1||0,$e=(ft[7]||"0").substring(0,3);return rt?new Date(Date.UTC(ft[1],Mt,ft[3]||1,ft[4]||0,ft[5]||0,ft[6]||0,$e)):new Date(ft[1],Mt,ft[3]||1,ft[4]||0,ft[5]||0,ft[6]||0,$e)}}return new Date(He)}(De),this.init()},be.init=function(){var De=this.$d;this.$y=De.getFullYear(),this.$M=De.getMonth(),this.$D=De.getDate(),this.$W=De.getDay(),this.$H=De.getHours(),this.$m=De.getMinutes(),this.$s=De.getSeconds(),this.$ms=De.getMilliseconds()},be.$utils=function(){return Ce},be.isValid=function(){return this.$d.toString()!==$},be.isSame=function(De,Ke){var He=Le(De);return this.startOf(Ke)<=He&&He<=this.endOf(Ke)},be.isAfter=function(De,Ke){return Le(De)<this.startOf(Ke)},be.isBefore=function(De,Ke){return this.endOf(Ke)<Le(De)},be.$g=function(De,Ke,He){return Ce.u(De)?this[Ke]:this.set(He,De)},be.unix=function(){return Math.floor(this.valueOf()/1e3)},be.valueOf=function(){return this.$d.getTime()},be.startOf=function(De,Ke){var He=this,rt=!!Ce.u(Ke)||Ke,ft=Ce.p(De),Mt=function(Gt,Jt){var Ht=Ce.w(He.$u?Date.UTC(He.$y,Jt,Gt):new Date(He.$y,Jt,Gt),He);return rt?Ht:Ht.endOf(M)},$e=function(Gt,Jt){return Ce.w(He.toDate()[Gt].apply(He.toDate("s"),(rt?[0,0,0,0]:[23,59,59,999]).slice(Jt)),He)},je=this.$W,Ct=this.$M,yt=this.$D,ot="set"+(this.$u?"UTC":"");switch(ft){case F:return rt?Mt(1,0):Mt(31,11);case E:return rt?Mt(1,Ct):Mt(0,Ct+1);case T:var Rt=this.$locale().weekStart||0,Xe=(je<Rt?je+7:je)-Rt;return Mt(rt?yt-Xe:yt+(6-Xe),Ct);case M:case Z:return $e(ot+"Hours",0);case S:return $e(ot+"Minutes",1);case k:return $e(ot+"Seconds",2);case w:return $e(ot+"Milliseconds",3);default:return this.clone()}},be.endOf=function(De){return this.startOf(De,!1)},be.$set=function(De,Ke){var He,rt=Ce.p(De),ft="set"+(this.$u?"UTC":""),Mt=(He={},He[M]=ft+"Date",He[Z]=ft+"Date",He[E]=ft+"Month",He[F]=ft+"FullYear",He[S]=ft+"Hours",He[k]=ft+"Minutes",He[w]=ft+"Seconds",He[y]=ft+"Milliseconds",He)[rt],$e=rt===M?this.$D+(Ke-this.$W):Ke;if(rt===E||rt===F){var je=this.clone().set(Z,1);je.$d[Mt]($e),je.init(),this.$d=je.set(Z,Math.min(this.$D,je.daysInMonth())).$d}else Mt&&this.$d[Mt]($e);return this.init(),this},be.set=function(De,Ke){return this.clone().$set(De,Ke)},be.get=function(De){return this[Ce.p(De)]()},be.add=function(De,Ke){var He,rt=this;De=Number(De);var ft=Ce.p(Ke),Mt=function(Ct){var yt=Le(rt);return Ce.w(yt.date(yt.date()+Math.round(Ct*De)),rt)};if(ft===E)return this.set(E,this.$M+De);if(ft===F)return this.set(F,this.$y+De);if(ft===M)return Mt(1);if(ft===T)return Mt(7);var $e=(He={},He[k]=m,He[S]=v,He[w]=f,He)[ft]||1,je=this.$d.getTime()+De*$e;return Ce.w(je,this)},be.subtract=function(De,Ke){return this.add(-1*De,Ke)},be.format=function(De){var Ke=this,He=this.$locale();if(!this.isValid())return He.invalidDate||$;var rt=De||"YYYY-MM-DDTHH:mm:ssZ",ft=Ce.z(this),Mt=this.$H,$e=this.$m,je=this.$M,Ct=He.weekdays,yt=He.months,ot=He.meridiem,Rt=function(Jt,Ht,Pt,Et){return Jt&&(Jt[Ht]||Jt(Ke,rt))||Pt[Ht].slice(0,Et)},Xe=function(Jt){return Ce.s(Mt%12||12,Jt,"0")},Gt=ot||function(Jt,Ht,Pt){var Et=Jt<12?"AM":"PM";return Pt?Et.toLowerCase():Et};return rt.replace(se,function(Jt,Ht){return Ht||function(Pt){switch(Pt){case"YY":return String(Ke.$y).slice(-2);case"YYYY":return Ce.s(Ke.$y,4,"0");case"M":return je+1;case"MM":return Ce.s(je+1,2,"0");case"MMM":return Rt(He.monthsShort,je,yt,3);case"MMMM":return Rt(yt,je);case"D":return Ke.$D;case"DD":return Ce.s(Ke.$D,2,"0");case"d":return String(Ke.$W);case"dd":return Rt(He.weekdaysMin,Ke.$W,Ct,2);case"ddd":return Rt(He.weekdaysShort,Ke.$W,Ct,3);case"dddd":return Ct[Ke.$W];case"H":return String(Mt);case"HH":return Ce.s(Mt,2,"0");case"h":return Xe(1);case"hh":return Xe(2);case"a":return Gt(Mt,$e,!0);case"A":return Gt(Mt,$e,!1);case"m":return String($e);case"mm":return Ce.s($e,2,"0");case"s":return String(Ke.$s);case"ss":return Ce.s(Ke.$s,2,"0");case"SSS":return Ce.s(Ke.$ms,3,"0");case"Z":return ft}return null}(Jt)||ft.replace(":","")})},be.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},be.diff=function(De,Ke,He){var rt,ft=this,Mt=Ce.p(Ke),$e=Le(De),je=($e.utcOffset()-this.utcOffset())*m,Ct=this-$e,yt=function(){return Ce.m(ft,$e)};switch(Mt){case F:rt=yt()/12;break;case E:rt=yt();break;case H:rt=yt()/3;break;case T:rt=(Ct-je)/6048e5;break;case M:rt=(Ct-je)/864e5;break;case S:rt=Ct/v;break;case k:rt=Ct/m;break;case w:rt=Ct/f;break;default:rt=Ct}return He?rt:Ce.a(rt)},be.daysInMonth=function(){return this.endOf(E).$D},be.$locale=function(){return ve[this.$L]},be.locale=function(De,Ke){if(!De)return this.$L;var He=this.clone(),rt=Se(De,Ke,!0);return rt&&(He.$L=rt),He},be.clone=function(){return Ce.w(this.$d,this)},be.toDate=function(){return new Date(this.valueOf())},be.toJSON=function(){return this.isValid()?this.toISOString():null},be.toISOString=function(){return this.$d.toISOString()},be.toString=function(){return this.$d.toUTCString()},Ge}(),Ze=Ue.prototype;return Le.prototype=Ze,[["$ms",y],["$s",w],["$m",k],["$H",S],["$W",M],["$M",E],["$y",F],["$D",Z]].forEach(function(Ge){Ze[Ge[1]]=function(be){return this.$g(be,Ge[0],Ge[1])}}),Le.extend=function(Ge,be){return Ge.$i||(Ge(be,Ue,Le),Ge.$i=!0),Le},Le.locale=Se,Le.isDayjs=ze,Le.unix=function(Ge){return Le(1e3*Ge)},Le.en=ve[pe],Le.Ls=ve,Le.p={},Le})})(dayjs_min$1);var dayjs_minExports=dayjs_min$1.exports;const dayjs=getDefaultExportFromCjs$1(dayjs_minExports);var lodash={exports:{}};/**
23
+ opacity: ${S-T*J}`}}const indexVars$G="",AbsTooltip_svelte_svelte_type_style_lang="";function create_if_block$2c(p){let u,f;return u=new Portal({props:{target:".spectrum",$$slots:{default:[create_default_slot$1V]},$$scope:{ctx:p}}}),{c(){create_component(u.$$.fragment)},m(m,v){mount_component(u,m,v),f=!0},p(m,v){const y={};v&132815&&(y.$$scope={dirty:v,ctx:m}),u.$set(y)},i(m){f||(transition_in(u.$$.fragment,m),f=!0)},o(m){transition_out(u.$$.fragment,m),f=!1},d(m){destroy_component(u,m)}}}function create_default_slot$1V(p){let u,f,m,v,y,w,k,S,M;return{c(){u=element("span"),f=element("span"),m=text$1(p[2]),v=space(),y=element("span"),attr(f,"class","spectrum-Tooltip-label svelte-9a74k9"),attr(y,"class","spectrum-Tooltip-tip svelte-9a74k9"),attr(y,"style",p[9]),attr(u,"class",w="spectrum-Tooltip spectrum-Tooltip--"+p[1]+" spectrum-Tooltip--"+p[0]+" is-open svelte-9a74k9"),attr(u,"style",k=`left:${p[6]}px;top:${p[7]}px;${p[10]}`),toggle_class(u,"noWrap",p[3])},m(T,E){insert(T,u,E),append$2(u,f),append$2(f,m),append$2(u,v),append$2(u,y),M=!0},p(T,E){(!M||E&4)&&set_data(m,T[2]),(!M||E&512)&&attr(y,"style",T[9]),(!M||E&3&&w!==(w="spectrum-Tooltip spectrum-Tooltip--"+T[1]+" spectrum-Tooltip--"+T[0]+" is-open svelte-9a74k9"))&&attr(u,"class",w),(!M||E&1216&&k!==(k=`left:${T[6]}px;top:${T[7]}px;${T[10]}`))&&attr(u,"style",k),(!M||E&11)&&toggle_class(u,"noWrap",T[3])},i(T){M||(T&&add_render_callback(()=>{M&&(S||(S=create_bidirectional_transition(u,fade,{duration:130},!0)),S.run(1))}),M=!0)},o(T){T&&(S||(S=create_bidirectional_transition(u,fade,{duration:130},!1)),S.run(0)),M=!1},d(T){T&&detach(u),T&&S&&S.end()}}}function create_fragment$3S(p){let u,f,m,v,y,w;const k=p[13].default,S=create_slot(k,p,p[17],null);let M=p[8]&&p[2]&&p[6]!=null&&p[7]!=null&&create_if_block$2c(p);return{c(){u=element("div"),S&&S.c(),f=space(),M&&M.c(),m=empty$1(),attr(u,"class","abs-tooltip svelte-9a74k9")},m(T,E){insert(T,u,E),S&&S.m(u,null),p[14](u),insert(T,f,E),M&&M.m(T,E),insert(T,m,E),v=!0,y||(w=[listen(u,"focus",null),listen(u,"mouseover",p[15]),listen(u,"mouseleave",p[16])],y=!0)},p(T,[E]){S&&S.p&&(!v||E&131072)&&update_slot_base(S,k,T,T[17],v?get_slot_changes(k,T[17],E,null):get_all_dirty_from_scope(T[17]),null),T[8]&&T[2]&&T[6]!=null&&T[7]!=null?M?(M.p(T,E),E&452&&transition_in(M,1)):(M=create_if_block$2c(T),M.c(),transition_in(M,1),M.m(m.parentNode,m)):M&&(group_outros(),transition_out(M,1,1,()=>{M=null}),check_outros())},i(T){v||(transition_in(S,T),transition_in(M),v=!0)},o(T){transition_out(S,T),transition_out(M),v=!1},d(T){T&&(detach(u),detach(f),detach(m)),S&&S.d(T),p[14](null),M&&M.d(T),y=!1,run_all(w)}}}function instance$3Q(p,u,f){let m,v,{$$slots:y={},$$scope:w}=u,{position:k=TooltipPosition.Top}=u,{type:S=TooltipType.Default}=u,{text:M=""}=u,{fixed:T=!1}=u,{color:E=void 0}=u,{noWrap:H=!1}=u,F,Z=!1,$,J,se=!1,ie,he;const fe=()=>{var Ue;const Le=(Ue=F==null?void 0:F.children)==null?void 0:Ue[0];if(!Le){f(6,$=void 0),f(7,J=void 0);return}const Ce=Le.getBoundingClientRect();k===TooltipPosition.Top?(f(6,$=Ce.left+Ce.width/2),f(7,J=Ce.top)):k===TooltipPosition.Right?(f(6,$=Ce.left+Ce.width),f(7,J=Ce.top+Ce.height/2)):k===TooltipPosition.Bottom?(f(6,$=Ce.left+Ce.width/2),f(7,J=Ce.top+Ce.height)):k===TooltipPosition.Left&&(f(6,$=Ce.left),f(7,J=Ce.top+Ce.height/2))},pe=()=>{fe(),he=setInterval(fe,100),f(8,se=!0)},ve=()=>{clearTimeout(ie),clearInterval(he),f(8,se=!1)};onDestroy(ve);function Ae(Le){binding_callbacks[Le?"unshift":"push"](()=>{F=Le,f(5,F)})}const ze=()=>f(4,Z=!0),Se=()=>f(4,Z=!1);return p.$$set=Le=>{"position"in Le&&f(0,k=Le.position),"type"in Le&&f(1,S=Le.type),"text"in Le&&f(2,M=Le.text),"fixed"in Le&&f(11,T=Le.fixed),"color"in Le&&f(12,E=Le.color),"noWrap"in Le&&f(3,H=Le.noWrap),"$$scope"in Le&&f(17,w=Le.$$scope)},p.$$.update=()=>{p.$$.dirty&2064&&(Z||T?ie=setTimeout(pe,200):ve()),p.$$.dirty&4096&&f(10,m=E?`background:${E};`:null),p.$$.dirty&4096&&f(9,v=E?`border-top-color:${E};`:null)},[k,S,M,H,Z,F,$,J,se,v,m,T,E,y,Ae,ze,Se,w]}class AbsTooltip extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$3Q,create_fragment$3S,safe_not_equal,{position:0,type:1,text:2,fixed:11,color:12,noWrap:3})}}const Icon_svelte_svelte_type_style_lang$1="";function create_default_slot$1U(p){let u,f,m,v,y,w,k,S;return{c(){u=element("div"),f=svg_element("svg"),m=svg_element("use"),set_style(m,"pointer-events","none"),xlink_attr(m,"xlink:href",v="#spectrum-icon-18-"+p[0]),attr(f,"class",y="spectrum-Icon spectrum-Icon--size"+p[1]+" svelte-ksxkvj"),attr(f,"focusable","false"),attr(f,"aria-hidden",p[2]),attr(f,"aria-label",p[0]),attr(f,"style",w=`${p[5]?`color: ${p[5]};`:""} ${p[6]?`--hover-color: ${p[6]}`:"--hover-color: var(--spectrum-alias-icon-color-selected-hover)"}`),toggle_class(f,"hoverable",p[3]),toggle_class(f,"disabled",p[4]),attr(u,"class","icon svelte-ksxkvj"),toggle_class(u,"newStyles",p[12])},m(M,T){insert(M,u,T),append$2(u,f),append$2(f,m),k||(S=[listen(f,"contextmenu",p[13]),listen(f,"click",p[14])],k=!0)},p(M,T){T&1&&v!==(v="#spectrum-icon-18-"+M[0])&&xlink_attr(m,"xlink:href",v),T&2&&y!==(y="spectrum-Icon spectrum-Icon--size"+M[1]+" svelte-ksxkvj")&&attr(f,"class",y),T&4&&attr(f,"aria-hidden",M[2]),T&1&&attr(f,"aria-label",M[0]),T&96&&w!==(w=`${M[5]?`color: ${M[5]};`:""} ${M[6]?`--hover-color: ${M[6]}`:"--hover-color: var(--spectrum-alias-icon-color-selected-hover)"}`)&&attr(f,"style",w),T&10&&toggle_class(f,"hoverable",M[3]),T&18&&toggle_class(f,"disabled",M[4]),T&4096&&toggle_class(u,"newStyles",M[12])},d(M){M&&detach(u),k=!1,run_all(S)}}}function create_fragment$3R(p){let u,f;return u=new AbsTooltip({props:{text:p[7],type:p[9],position:p[8],color:p[10],noWrap:p[11],$$slots:{default:[create_default_slot$1U]},$$scope:{ctx:p}}}),{c(){create_component(u.$$.fragment)},m(m,v){mount_component(u,m,v),f=!0},p(m,[v]){const y={};v&128&&(y.text=m[7]),v&512&&(y.type=m[9]),v&256&&(y.position=m[8]),v&1024&&(y.color=m[10]),v&2048&&(y.noWrap=m[11]),v&36991&&(y.$$scope={dirty:v,ctx:m}),u.$set(y)},i(m){f||(transition_in(u.$$.fragment,m),f=!0)},o(m){transition_out(u.$$.fragment,m),f=!1},d(m){destroy_component(u,m)}}}function instance$3P(p,u,f){let{name:m="Add"}=u,{size:v="M"}=u,{hidden:y=!1}=u,{hoverable:w=!1}=u,{disabled:k=!1}=u,{color:S=void 0}=u,{hoverColor:M=void 0}=u,{tooltip:T=void 0}=u,{tooltipPosition:E=TooltipPosition.Bottom}=u,{tooltipType:H=TooltipType.Default}=u,{tooltipColor:F=void 0}=u,{tooltipWrap:Z=!0}=u,{newStyles:$=!1}=u;function J(ie){bubble.call(this,p,ie)}function se(ie){bubble.call(this,p,ie)}return p.$$set=ie=>{"name"in ie&&f(0,m=ie.name),"size"in ie&&f(1,v=ie.size),"hidden"in ie&&f(2,y=ie.hidden),"hoverable"in ie&&f(3,w=ie.hoverable),"disabled"in ie&&f(4,k=ie.disabled),"color"in ie&&f(5,S=ie.color),"hoverColor"in ie&&f(6,M=ie.hoverColor),"tooltip"in ie&&f(7,T=ie.tooltip),"tooltipPosition"in ie&&f(8,E=ie.tooltipPosition),"tooltipType"in ie&&f(9,H=ie.tooltipType),"tooltipColor"in ie&&f(10,F=ie.tooltipColor),"tooltipWrap"in ie&&f(11,Z=ie.tooltipWrap),"newStyles"in ie&&f(12,$=ie.newStyles)},[m,v,y,w,k,S,M,T,E,H,F,Z,$,J,se]}let Icon$1=class extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$3P,create_fragment$3R,safe_not_equal,{name:0,size:1,hidden:2,hoverable:3,disabled:4,color:5,hoverColor:6,tooltip:7,tooltipPosition:8,tooltipType:9,tooltipColor:10,tooltipWrap:11,newStyles:12})}};const TooltipWrapper_svelte_svelte_type_style_lang="";function create_if_block$2b(p){let u,f,m;return f=new AbsTooltip({props:{text:p[0],$$slots:{default:[create_default_slot$1T]},$$scope:{ctx:p}}}),{c(){u=element("div"),create_component(f.$$.fragment),attr(u,"class","icon-container svelte-19tap7e")},m(v,y){insert(v,u,y),mount_component(f,u,null),m=!0},p(v,y){const w={};y&1&&(w.text=v[0]),y&38&&(w.$$scope={dirty:y,ctx:v}),f.$set(w)},i(v){m||(transition_in(f.$$.fragment,v),m=!0)},o(v){transition_out(f.$$.fragment,v),m=!1},d(v){v&&detach(u),destroy_component(f)}}}function create_default_slot$1T(p){let u,f,m,v,y;return f=new Icon$1({props:{name:"InfoOutline",size:"S",disabled:p[2],hoverable:!0}}),{c(){u=element("div"),create_component(f.$$.fragment),attr(u,"class","icon svelte-19tap7e"),toggle_class(u,"icon-small",p[1]==="M"||p[1]==="S")},m(w,k){insert(w,u,k),mount_component(f,u,null),m=!0,v||(y=listen(u,"focus",p[4]),v=!0)},p(w,k){const S={};k&4&&(S.disabled=w[2]),f.$set(S),(!m||k&2)&&toggle_class(u,"icon-small",w[1]==="M"||w[1]==="S")},i(w){m||(transition_in(f.$$.fragment,w),m=!0)},o(w){transition_out(f.$$.fragment,w),m=!1},d(w){w&&detach(u),destroy_component(f),v=!1,y()}}}function create_fragment$3Q(p){let u,f,m;const v=p[3].default,y=create_slot(v,p,p[5],null);let w=p[0]&&create_if_block$2b(p);return{c(){u=element("div"),y&&y.c(),f=space(),w&&w.c(),attr(u,"class","svelte-19tap7e"),toggle_class(u,"container",!!p[0])},m(k,S){insert(k,u,S),y&&y.m(u,null),append$2(u,f),w&&w.m(u,null),m=!0},p(k,[S]){y&&y.p&&(!m||S&32)&&update_slot_base(y,v,k,k[5],m?get_slot_changes(v,k[5],S,null):get_all_dirty_from_scope(k[5]),null),k[0]?w?(w.p(k,S),S&1&&transition_in(w,1)):(w=create_if_block$2b(k),w.c(),transition_in(w,1),w.m(u,null)):w&&(group_outros(),transition_out(w,1,1,()=>{w=null}),check_outros()),(!m||S&1)&&toggle_class(u,"container",!!k[0])},i(k){m||(transition_in(y,k),transition_in(w),m=!0)},o(k){transition_out(y,k),transition_out(w),m=!1},d(k){k&&detach(u),y&&y.d(k),w&&w.d()}}}function instance$3O(p,u,f){let{$$slots:m={},$$scope:v}=u,{tooltip:y=""}=u,{size:w="M"}=u,{disabled:k=!0}=u;function S(M){bubble.call(this,p,M)}return p.$$set=M=>{"tooltip"in M&&f(0,y=M.tooltip),"size"in M&&f(1,w=M.size),"disabled"in M&&f(2,k=M.disabled),"$$scope"in M&&f(5,v=M.$$scope)},[y,w,k,m,S,v]}class TooltipWrapper extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$3O,create_fragment$3Q,safe_not_equal,{tooltip:0,size:1,disabled:2})}}const FieldLabel_svelte_svelte_type_style_lang="";function create_default_slot$1S(p){let u,f=(p[1]||"")+"",m,v;return{c(){u=element("label"),m=text$1(f),attr(u,"for",p[0]),attr(u,"class",v=null_to_empty(`spectrum-FieldLabel spectrum-FieldLabel--sizeM spectrum-Form-itemLabel ${p[3]}`)+" svelte-dqoj9e")},m(y,w){insert(y,u,w),append$2(u,m)},p(y,w){w&2&&f!==(f=(y[1]||"")+"")&&set_data(m,f),w&1&&attr(u,"for",y[0]),w&8&&v!==(v=null_to_empty(`spectrum-FieldLabel spectrum-FieldLabel--sizeM spectrum-Form-itemLabel ${y[3]}`)+" svelte-dqoj9e")&&attr(u,"class",v)},d(y){y&&detach(u)}}}function create_fragment$3P(p){let u,f;return u=new TooltipWrapper({props:{tooltip:p[2],size:"S",$$slots:{default:[create_default_slot$1S]},$$scope:{ctx:p}}}),{c(){create_component(u.$$.fragment)},m(m,v){mount_component(u,m,v),f=!0},p(m,[v]){const y={};v&4&&(y.tooltip=m[2]),v&43&&(y.$$scope={dirty:v,ctx:m}),u.$set(y)},i(m){f||(transition_in(u.$$.fragment,m),f=!0)},o(m){transition_out(u.$$.fragment,m),f=!1},d(m){destroy_component(u,m)}}}function instance$3N(p,u,f){let m,{forId:v}=u,{label:y}=u,{position:w="above"}=u,{tooltip:k=""}=u;return p.$$set=S=>{"forId"in S&&f(0,v=S.forId),"label"in S&&f(1,y=S.label),"position"in S&&f(4,w=S.position),"tooltip"in S&&f(2,k=S.tooltip)},p.$$.update=()=>{p.$$.dirty&16&&f(3,m=w==="above"?"":`spectrum-FieldLabel--${w}`)},[v,y,k,m,w]}class FieldLabel extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$3N,create_fragment$3P,safe_not_equal,{forId:0,label:1,position:4,tooltip:2})}}const Field_svelte_svelte_type_style_lang$1="";function create_if_block_2$J(p){let u,f;return u=new FieldLabel({props:{forId:p[0],label:p[1],position:p[2],tooltip:p[5]}}),{c(){create_component(u.$$.fragment)},m(m,v){mount_component(u,m,v),f=!0},p(m,v){const y={};v&1&&(y.forId=m[0]),v&2&&(y.label=m[1]),v&4&&(y.position=m[2]),v&32&&(y.tooltip=m[5]),u.$set(y)},i(m){f||(transition_in(u.$$.fragment,m),f=!0)},o(m){transition_out(u.$$.fragment,m),f=!1},d(m){destroy_component(u,m)}}}function create_if_block_1$18(p){let u,f,m,v,y,w;return f=new Icon$1({props:{name:"HelpOutline"}}),{c(){u=element("div"),create_component(f.$$.fragment),m=space(),v=element("span"),y=text$1(p[4]),attr(v,"class","svelte-e52e9j"),attr(u,"class","helpText svelte-e52e9j")},m(k,S){insert(k,u,S),mount_component(f,u,null),append$2(u,m),append$2(u,v),append$2(v,y),w=!0},p(k,S){(!w||S&16)&&set_data(y,k[4])},i(k){w||(transition_in(f.$$.fragment,k),w=!0)},o(k){transition_out(f.$$.fragment,k),w=!1},d(k){k&&detach(u),destroy_component(f)}}}function create_if_block$2a(p){let u,f;return{c(){u=element("div"),f=text$1(p[3]),attr(u,"class","error svelte-e52e9j")},m(m,v){insert(m,u,v),append$2(u,f)},p(m,v){v&8&&set_data(f,m[3])},i:noop$2,o:noop$2,d(m){m&&detach(u)}}}function create_fragment$3O(p){let u,f,m,v,y,w,k,S=p[1]&&create_if_block_2$J(p);const M=p[7].default,T=create_slot(M,p,p[6],null),E=[create_if_block$2a,create_if_block_1$18],H=[];function F(Z,$){return Z[3]?0:Z[4]?1:-1}return~(y=F(p))&&(w=H[y]=E[y](p)),{c(){u=element("div"),S&&S.c(),f=space(),m=element("div"),T&&T.c(),v=space(),w&&w.c(),attr(m,"class","spectrum-Form-itemField svelte-e52e9j"),attr(u,"class","spectrum-Form-item svelte-e52e9j"),toggle_class(u,"above",p[2]==="above")},m(Z,$){insert(Z,u,$),S&&S.m(u,null),append$2(u,f),append$2(u,m),T&&T.m(m,null),append$2(m,v),~y&&H[y].m(m,null),k=!0},p(Z,[$]){Z[1]?S?(S.p(Z,$),$&2&&transition_in(S,1)):(S=create_if_block_2$J(Z),S.c(),transition_in(S,1),S.m(u,f)):S&&(group_outros(),transition_out(S,1,1,()=>{S=null}),check_outros()),T&&T.p&&(!k||$&64)&&update_slot_base(T,M,Z,Z[6],k?get_slot_changes(M,Z[6],$,null):get_all_dirty_from_scope(Z[6]),null);let J=y;y=F(Z),y===J?~y&&H[y].p(Z,$):(w&&(group_outros(),transition_out(H[J],1,1,()=>{H[J]=null}),check_outros()),~y?(w=H[y],w?w.p(Z,$):(w=H[y]=E[y](Z),w.c()),transition_in(w,1),w.m(m,null)):w=null),(!k||$&4)&&toggle_class(u,"above",Z[2]==="above")},i(Z){k||(transition_in(S),transition_in(T,Z),transition_in(w),k=!0)},o(Z){transition_out(S),transition_out(T,Z),transition_out(w),k=!1},d(Z){Z&&detach(u),S&&S.d(),T&&T.d(Z),~y&&H[y].d()}}}function instance$3M(p,u,f){let{$$slots:m={},$$scope:v}=u,{id:y=void 0}=u,{label:w=void 0}=u,{labelPosition:k="above"}=u,{error:S=void 0}=u,{helpText:M=void 0}=u,{tooltip:T=void 0}=u;return p.$$set=E=>{"id"in E&&f(0,y=E.id),"label"in E&&f(1,w=E.label),"labelPosition"in E&&f(2,k=E.labelPosition),"error"in E&&f(3,S=E.error),"helpText"in E&&f(4,M=E.helpText),"tooltip"in E&&f(5,T=E.tooltip),"$$scope"in E&&f(6,v=E.$$scope)},[y,w,k,S,M,T,v,m]}let Field$1=class extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$3M,create_fragment$3O,safe_not_equal,{id:0,label:1,labelPosition:2,error:3,helpText:4,tooltip:5})}};const indexVars$F="",TextField_svelte_svelte_type_style_lang="";function create_fragment$3N(p){let u,f,m,v,y,w,k,S;return{c(){u=element("div"),f=element("input"),f.disabled=p[3],f.readOnly=p[5],attr(f,"id",p[4]),f.value=m=p[0]??"",attr(f,"placeholder",v=p[1]??""),attr(f,"type",p[2]),attr(f,"class","spectrum-Textfield-input svelte-1pznijr"),attr(f,"style",y=p[7]?`text-align: ${p[7]};`:""),attr(f,"inputmode",w=p[15](p[2])),attr(f,"autocomplete",p[10]),attr(u,"class","spectrum-Textfield svelte-1pznijr"),toggle_class(u,"spectrum-Textfield--quiet",p[6]),toggle_class(u,"is-disabled",p[3]),toggle_class(u,"is-focused",p[9])},m(M,T){insert(M,u,T),append$2(u,f),p[24](f),k||(S=[listen(f,"click",p[19]),listen(f,"blur",p[20]),listen(f,"focus",p[21]),listen(f,"input",p[22]),listen(f,"keyup",p[23]),listen(f,"blur",p[12]),listen(f,"focus",p[11]),listen(f,"input",p[13]),listen(f,"keyup",p[14])],k=!0)},p(M,[T]){T&8&&(f.disabled=M[3]),T&32&&(f.readOnly=M[5]),T&16&&attr(f,"id",M[4]),T&1&&m!==(m=M[0]??"")&&f.value!==m&&(f.value=m),T&2&&v!==(v=M[1]??"")&&attr(f,"placeholder",v),T&4&&attr(f,"type",M[2]),T&128&&y!==(y=M[7]?`text-align: ${M[7]};`:"")&&attr(f,"style",y),T&4&&w!==(w=M[15](M[2]))&&attr(f,"inputmode",w),T&1024&&attr(f,"autocomplete",M[10]),T&64&&toggle_class(u,"spectrum-Textfield--quiet",M[6]),T&8&&toggle_class(u,"is-disabled",M[3]),T&512&&toggle_class(u,"is-focused",M[9])},i:noop$2,o:noop$2,d(M){M&&detach(u),p[24](null),k=!1,run_all(S)}}}function instance$3L(p,u,f){let m,{value:v=null}=u,{placeholder:y=void 0}=u,{type:w="text"}=u,{disabled:k=!1}=u,{id:S=null}=u,{readonly:M=!1}=u,{updateOnChange:T=!0}=u,{quiet:E=!1}=u,{align:H=void 0}=u,{autofocus:F=!1}=u,{autocomplete:Z}=u;const $=createEventDispatcher();let J,se=!1;const ie=Ge=>{if(!(M||k)){if(w==="number"){const be=parseFloat(Ge);Ge=isNaN(be)?null:be}$("change",Ge)}},he=()=>{M||k||f(9,se=!0)},fe=Ge=>{var be;M||k||(f(9,se=!1),ie((be=Ge==null?void 0:Ge.target)==null?void 0:be.value))},pe=Ge=>{var be;M||!T||k||ie((be=Ge.target)==null?void 0:be.value)},ve=Ge=>{var be;M||k||Ge.key==="Enter"&&ie((be=Ge.target)==null?void 0:be.value)},Ae=Ge=>Ge==="bigint"?"numeric":Ge==="number"?"decimal":"text";onMount(async()=>{k||(f(9,se=F||!1),se&&(await tick(),J.focus()))});function ze(Ge){bubble.call(this,p,Ge)}function Se(Ge){bubble.call(this,p,Ge)}function Le(Ge){bubble.call(this,p,Ge)}function Ce(Ge){bubble.call(this,p,Ge)}function Ue(Ge){bubble.call(this,p,Ge)}function Ze(Ge){binding_callbacks[Ge?"unshift":"push"](()=>{J=Ge,f(8,J)})}return p.$$set=Ge=>{"value"in Ge&&f(0,v=Ge.value),"placeholder"in Ge&&f(1,y=Ge.placeholder),"type"in Ge&&f(2,w=Ge.type),"disabled"in Ge&&f(3,k=Ge.disabled),"id"in Ge&&f(4,S=Ge.id),"readonly"in Ge&&f(5,M=Ge.readonly),"updateOnChange"in Ge&&f(16,T=Ge.updateOnChange),"quiet"in Ge&&f(6,E=Ge.quiet),"align"in Ge&&f(7,H=Ge.align),"autofocus"in Ge&&f(17,F=Ge.autofocus),"autocomplete"in Ge&&f(18,Z=Ge.autocomplete)},p.$$.update=()=>{p.$$.dirty&262144&&f(10,m=typeof Z=="boolean"?Z?"on":"off":void 0)},[v,y,w,k,S,M,E,H,J,se,m,he,fe,pe,ve,Ae,T,F,Z,ze,Se,Le,Ce,Ue,Ze]}class TextField extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$3L,create_fragment$3N,safe_not_equal,{value:0,placeholder:1,type:2,disabled:3,id:4,readonly:5,updateOnChange:16,quiet:6,align:7,autofocus:17,autocomplete:18})}}function create_default_slot$1R(p){let u,f;return u=new TextField({props:{updateOnChange:p[8],disabled:p[5],readonly:p[6],value:p[0],placeholder:p[3],type:p[4],quiet:p[9],autofocus:p[10],autocomplete:p[11]}}),u.$on("change",p[13]),u.$on("click",p[14]),u.$on("input",p[15]),u.$on("blur",p[16]),u.$on("focus",p[17]),u.$on("keyup",p[18]),{c(){create_component(u.$$.fragment)},m(m,v){mount_component(u,m,v),f=!0},p(m,v){const y={};v&256&&(y.updateOnChange=m[8]),v&32&&(y.disabled=m[5]),v&64&&(y.readonly=m[6]),v&1&&(y.value=m[0]),v&8&&(y.placeholder=m[3]),v&16&&(y.type=m[4]),v&512&&(y.quiet=m[9]),v&1024&&(y.autofocus=m[10]),v&2048&&(y.autocomplete=m[11]),u.$set(y)},i(m){f||(transition_in(u.$$.fragment,m),f=!0)},o(m){transition_out(u.$$.fragment,m),f=!1},d(m){destroy_component(u,m)}}}function create_fragment$3M(p){let u,f;return u=new Field$1({props:{helpText:p[12],label:p[1],labelPosition:p[2],error:p[7],$$slots:{default:[create_default_slot$1R]},$$scope:{ctx:p}}}),{c(){create_component(u.$$.fragment)},m(m,v){mount_component(u,m,v),f=!0},p(m,[v]){const y={};v&4096&&(y.helpText=m[12]),v&2&&(y.label=m[1]),v&4&&(y.labelPosition=m[2]),v&128&&(y.error=m[7]),v&1052537&&(y.$$scope={dirty:v,ctx:m}),u.$set(y)},i(m){f||(transition_in(u.$$.fragment,m),f=!0)},o(m){transition_out(u.$$.fragment,m),f=!1},d(m){destroy_component(u,m)}}}function instance$3K(p,u,f){let{value:m=void 0}=u,{label:v=void 0}=u,{labelPosition:y="above"}=u,{placeholder:w=void 0}=u,{type:k="text"}=u,{disabled:S=!1}=u,{readonly:M=!1}=u,{error:T=void 0}=u,{updateOnChange:E=!0}=u,{quiet:H=!1}=u,{autofocus:F=void 0}=u,{autocomplete:Z=void 0}=u,{helpText:$=void 0}=u;const J=createEventDispatcher(),se=Ae=>{f(0,m=Ae.detail),J("change",Ae.detail)};function ie(Ae){bubble.call(this,p,Ae)}function he(Ae){bubble.call(this,p,Ae)}function fe(Ae){bubble.call(this,p,Ae)}function pe(Ae){bubble.call(this,p,Ae)}function ve(Ae){bubble.call(this,p,Ae)}return p.$$set=Ae=>{"value"in Ae&&f(0,m=Ae.value),"label"in Ae&&f(1,v=Ae.label),"labelPosition"in Ae&&f(2,y=Ae.labelPosition),"placeholder"in Ae&&f(3,w=Ae.placeholder),"type"in Ae&&f(4,k=Ae.type),"disabled"in Ae&&f(5,S=Ae.disabled),"readonly"in Ae&&f(6,M=Ae.readonly),"error"in Ae&&f(7,T=Ae.error),"updateOnChange"in Ae&&f(8,E=Ae.updateOnChange),"quiet"in Ae&&f(9,H=Ae.quiet),"autofocus"in Ae&&f(10,F=Ae.autofocus),"autocomplete"in Ae&&f(11,Z=Ae.autocomplete),"helpText"in Ae&&f(12,$=Ae.helpText)},[m,v,y,w,k,S,M,T,E,H,F,Z,$,se,ie,he,fe,pe,ve]}let Input$5=class extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$3K,create_fragment$3M,safe_not_equal,{value:0,label:1,labelPosition:2,placeholder:3,type:4,disabled:5,readonly:6,error:7,updateOnChange:8,quiet:9,autofocus:10,autocomplete:11,helpText:12})}};const indexVars$E="",indexVars$D="",Stepper_svelte_svelte_type_style_lang="",TextArea_svelte_svelte_type_style_lang="";function create_fragment$3L(p){let u,f,m,v,y,w,k,S;return{c(){u=element("div"),f=element("textarea"),attr(f,"placeholder",m=p[1]||""),attr(f,"class","spectrum-Textfield-input svelte-1kmb9uq"),attr(f,"style",v=p[5]?`text-align: ${p[5]}`:""),f.disabled=p[2],f.readOnly=p[3],attr(f,"id",p[4]),f.value=y=p[0]||"",attr(u,"style",w=`${p[9]}${p[8]}`),attr(u,"class","spectrum-Textfield spectrum-Textfield--multiline svelte-1kmb9uq"),toggle_class(u,"is-disabled",p[2]),toggle_class(u,"is-focused",p[6])},m(M,T){insert(M,u,T),append$2(u,f),p[14](f),k||(S=[listen(f,"focus",p[15]),listen(f,"blur",p[10])],k=!0)},p(M,[T]){T&2&&m!==(m=M[1]||"")&&attr(f,"placeholder",m),T&32&&v!==(v=M[5]?`text-align: ${M[5]}`:"")&&attr(f,"style",v),T&4&&(f.disabled=M[2]),T&8&&(f.readOnly=M[3]),T&16&&attr(f,"id",M[4]),T&1&&y!==(y=M[0]||"")&&(f.value=y),T&768&&w!==(w=`${M[9]}${M[8]}`)&&attr(u,"style",w),T&4&&toggle_class(u,"is-disabled",M[2]),T&64&&toggle_class(u,"is-focused",M[6])},i:noop$2,o:noop$2,d(M){M&&detach(u),p[14](null),k=!1,run_all(S)}}}function instance$3J(p,u,f){let m,v,{value:y=""}=u,{placeholder:w=null}=u,{disabled:k=!1}=u,{readonly:S=!1}=u,{id:M=null}=u,{height:T=null}=u,{minHeight:E=null}=u;const H=()=>({start:$.selectionStart,end:$.selectionEnd});let{align:F=null}=u,Z=!1,$;const J=createEventDispatcher(),se=pe=>{J("change",pe.target.value),f(6,Z=!1)},ie=(pe,ve)=>!pe||ve==null?"":isNaN(ve)?`${pe}:${ve};`:`${pe}:${ve}px;`;function he(pe){binding_callbacks[pe?"unshift":"push"](()=>{$=pe,f(7,$)})}const fe=()=>f(6,Z=!0);return p.$$set=pe=>{"value"in pe&&f(0,y=pe.value),"placeholder"in pe&&f(1,w=pe.placeholder),"disabled"in pe&&f(2,k=pe.disabled),"readonly"in pe&&f(3,S=pe.readonly),"id"in pe&&f(4,M=pe.id),"height"in pe&&f(11,T=pe.height),"minHeight"in pe&&f(12,E=pe.minHeight),"align"in pe&&f(5,F=pe.align)},p.$$.update=()=>{p.$$.dirty&2048&&f(9,m=ie("height",T)),p.$$.dirty&4096&&f(8,v=ie("min-height",E))},[y,w,k,S,M,F,Z,$,v,m,se,T,E,H,he,fe]}class TextArea extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$3J,create_fragment$3L,safe_not_equal,{value:0,placeholder:1,disabled:2,readonly:3,id:4,height:11,minHeight:12,getCaretPosition:13,align:5})}get getCaretPosition(){return this.$$.ctx[13]}}const indexVars$C="",indexVars$B="",indexVars$A="",ignoredClasses=[".download-js-link",".spectrum-Menu",".date-time-popover"],conditionallyIgnoredClasses=[".spectrum-Underlay",".drawer-wrapper",".spectrum-Popover"];let clickHandlers=[],candidateTarget;const handleClick=p=>{const u=p.target||p.relatedTarget;if(!u.closest('[data-ignore-click-outside="true"]')){for(let f of ignoredClasses)if(u.closest(f))return;clickHandlers.forEach(f=>{var m;if(!f.element.contains(u)){for(let v of conditionallyIgnoredClasses){const y=f.anchor.closest(v)!=null;if(u.closest(v)!=null&&!y)return}(m=f.callback)==null||m.call(f,p)}})}},handleMouseUp=p=>{candidateTarget===p.target&&handleClick(p),candidateTarget=void 0},handleMouseDown=p=>{p.button===0&&(candidateTarget=p.target,document.removeEventListener("click",handleMouseUp),document.addEventListener("click",handleMouseUp,!0))},handleBlur=()=>{document.activeElement&&["IFRAME","BODY"].includes(document.activeElement.tagName)&&handleClick(new MouseEvent("click",{relatedTarget:document.activeElement}))};document.addEventListener("mousedown",handleMouseDown),document.addEventListener("contextmenu",handleClick),window.addEventListener("blur",handleBlur);const updateHandler=(p,u,f,m)=>{let v=clickHandlers.find(y=>y.id===p);v?v.callback=m:clickHandlers.push({id:p,element:u,anchor:f,callback:m})},removeHandler=p=>{clickHandlers=clickHandlers.filter(u=>u.id!==p)},clickOutside=(p,u)=>{const f=Math.random(),m=w=>typeof w=="function",v=w=>w!=null&&typeof w=="object",y=w=>{let k,S=p;m(w)?k=w:v(w)&&(k=w.callback,w.anchor&&(S=w.anchor)),updateHandler(f,p,S,k)};return y(u),{update:y,destroy:()=>removeHandler(f)}},indexVars$z="",Search_svelte_svelte_type_style_lang="";function create_fragment$3K(p){let u,f,m,v,y,w,k,S,M,T,E,H;return{c(){u=element("div"),f=element("div"),m=svg_element("svg"),v=svg_element("use"),y=space(),w=element("input"),M=space(),T=element("button"),T.innerHTML='<svg class="spectrum-Icon spectrum-UIIcon-Cross75" focusable="false" aria-hidden="true"><use xlink:href="#spectrum-css-icon-Cross75"></use></svg>',xlink_attr(v,"xlink:href","#spectrum-icon-18-Magnify"),attr(m,"class","spectrum-Icon spectrum-Icon--sizeM spectrum-Textfield-icon"),attr(m,"focusable","false"),attr(m,"aria-hidden","true"),w.disabled=p[3],attr(w,"id",p[4]),w.value=k=p[1]||"",attr(w,"placeholder",S=p[2]||""),attr(w,"type","search"),attr(w,"class","spectrum-Textfield-input spectrum-Search-input svelte-d7zw73"),attr(w,"autocomplete","off"),attr(f,"class","spectrum-Textfield svelte-d7zw73"),toggle_class(f,"spectrum-Textfield--quiet",p[5]),toggle_class(f,"is-focused",p[6]),toggle_class(f,"is-disabled",p[3]),attr(T,"type","reset"),attr(T,"class","spectrum-ClearButton spectrum-Search-clearButton svelte-d7zw73"),attr(u,"class","spectrum-Search svelte-d7zw73"),toggle_class(u,"is-disabled",p[3])},m(F,Z){insert(F,u,Z),append$2(u,f),append$2(f,m),append$2(m,v),append$2(f,y),append$2(f,w),p[17](w),append$2(u,M),append$2(u,T),E||(H=[listen(w,"click",p[13]),listen(w,"blur",p[14]),listen(w,"focus",p[15]),listen(w,"input",p[16]),listen(w,"blur",p[9]),listen(w,"focus",p[8]),listen(w,"input",p[10]),listen(w,"keyup",p[11]),listen(T,"click",p[18])],E=!0)},p(F,[Z]){Z&8&&(w.disabled=F[3]),Z&16&&attr(w,"id",F[4]),Z&2&&k!==(k=F[1]||"")&&w.value!==k&&(w.value=k),Z&4&&S!==(S=F[2]||"")&&attr(w,"placeholder",S),Z&32&&toggle_class(f,"spectrum-Textfield--quiet",F[5]),Z&64&&toggle_class(f,"is-focused",F[6]),Z&8&&toggle_class(f,"is-disabled",F[3]),Z&8&&toggle_class(u,"is-disabled",F[3])},i:noop$2,o:noop$2,d(F){F&&detach(u),p[17](null),E=!1,run_all(H)}}}function instance$3I(p,u,f){let{value:m=null}=u,{placeholder:v=void 0}=u,{disabled:y=!1}=u,{id:w=null}=u,{updateOnChange:k=!0}=u,{quiet:S=!1}=u,{inputRef:M=void 0}=u;const T=createEventDispatcher();let E=!1;const H=Ae=>{T("change",Ae)},F=()=>{f(6,E=!0)},Z=Ae=>{f(6,E=!1),H(Ae.target.value)},$=Ae=>{k&&H(Ae.target.value)},J=Ae=>{Ae.key==="Enter"&&H(Ae.target.value)};function se(Ae){bubble.call(this,p,Ae)}function ie(Ae){bubble.call(this,p,Ae)}function he(Ae){bubble.call(this,p,Ae)}function fe(Ae){bubble.call(this,p,Ae)}function pe(Ae){binding_callbacks[Ae?"unshift":"push"](()=>{M=Ae,f(0,M)})}const ve=()=>H("");return p.$$set=Ae=>{"value"in Ae&&f(1,m=Ae.value),"placeholder"in Ae&&f(2,v=Ae.placeholder),"disabled"in Ae&&f(3,y=Ae.disabled),"id"in Ae&&f(4,w=Ae.id),"updateOnChange"in Ae&&f(12,k=Ae.updateOnChange),"quiet"in Ae&&f(5,S=Ae.quiet),"inputRef"in Ae&&f(0,M=Ae.inputRef)},[M,m,v,y,w,S,E,H,F,Z,$,J,k,se,ie,he,fe,pe,ve]}class Search extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$3I,create_fragment$3K,safe_not_equal,{value:1,placeholder:2,disabled:3,id:4,updateOnChange:12,quiet:5,inputRef:0})}}const indexVars$y="",StatusLight_svelte_svelte_type_style_lang="";function create_fragment$3J(p){let u,f,m,v,y,w;const k=p[21].default,S=create_slot(k,p,p[20],null);return{c(){u=element("div"),S&&S.c(),attr(u,"class",f="spectrum-StatusLight spectrum-StatusLight--size"+p[0]+" svelte-1wk2ay6"),attr(u,"style",m=`--color: ${p[16]??"var(--spectrum-global-color-gray-400)"};`),toggle_class(u,"custom",!!p[16]),toggle_class(u,"square",p[17]),toggle_class(u,"hoverable",p[18]),toggle_class(u,"spectrum-StatusLight--celery",p[1]),toggle_class(u,"spectrum-StatusLight--yellow",p[2]),toggle_class(u,"spectrum-StatusLight--fuchsia",p[3]),toggle_class(u,"spectrum-StatusLight--indigo",p[4]),toggle_class(u,"spectrum-StatusLight--seafoam",p[5]),toggle_class(u,"spectrum-StatusLight--chartreuse",p[6]),toggle_class(u,"spectrum-StatusLight--magenta",p[7]),toggle_class(u,"spectrum-StatusLight--purple",p[8]),toggle_class(u,"spectrum-StatusLight--neutral",p[9]),toggle_class(u,"spectrum-StatusLight--info",p[10]),toggle_class(u,"spectrum-StatusLight--positive",p[11]),toggle_class(u,"spectrum-StatusLight--notice",p[12]),toggle_class(u,"spectrum-StatusLight--negative",p[13]),toggle_class(u,"spectrum-StatusLight--disabled",p[14]),toggle_class(u,"spectrum-StatusLight--active",p[15]),toggle_class(u,"withText",!!p[19].default)},m(M,T){insert(M,u,T),S&&S.m(u,null),v=!0,y||(w=listen(u,"click",p[22]),y=!0)},p(M,[T]){S&&S.p&&(!v||T&1048576)&&update_slot_base(S,k,M,M[20],v?get_slot_changes(k,M[20],T,null):get_all_dirty_from_scope(M[20]),null),(!v||T&1&&f!==(f="spectrum-StatusLight spectrum-StatusLight--size"+M[0]+" svelte-1wk2ay6"))&&attr(u,"class",f),(!v||T&65536&&m!==(m=`--color: ${M[16]??"var(--spectrum-global-color-gray-400)"};`))&&attr(u,"style",m),(!v||T&65537)&&toggle_class(u,"custom",!!M[16]),(!v||T&131073)&&toggle_class(u,"square",M[17]),(!v||T&262145)&&toggle_class(u,"hoverable",M[18]),(!v||T&3)&&toggle_class(u,"spectrum-StatusLight--celery",M[1]),(!v||T&5)&&toggle_class(u,"spectrum-StatusLight--yellow",M[2]),(!v||T&9)&&toggle_class(u,"spectrum-StatusLight--fuchsia",M[3]),(!v||T&17)&&toggle_class(u,"spectrum-StatusLight--indigo",M[4]),(!v||T&33)&&toggle_class(u,"spectrum-StatusLight--seafoam",M[5]),(!v||T&65)&&toggle_class(u,"spectrum-StatusLight--chartreuse",M[6]),(!v||T&129)&&toggle_class(u,"spectrum-StatusLight--magenta",M[7]),(!v||T&257)&&toggle_class(u,"spectrum-StatusLight--purple",M[8]),(!v||T&513)&&toggle_class(u,"spectrum-StatusLight--neutral",M[9]),(!v||T&1025)&&toggle_class(u,"spectrum-StatusLight--info",M[10]),(!v||T&2049)&&toggle_class(u,"spectrum-StatusLight--positive",M[11]),(!v||T&4097)&&toggle_class(u,"spectrum-StatusLight--notice",M[12]),(!v||T&8193)&&toggle_class(u,"spectrum-StatusLight--negative",M[13]),(!v||T&16385)&&toggle_class(u,"spectrum-StatusLight--disabled",M[14]),(!v||T&32769)&&toggle_class(u,"spectrum-StatusLight--active",M[15]),(!v||T&524289)&&toggle_class(u,"withText",!!M[19].default)},i(M){v||(transition_in(S,M),v=!0)},o(M){transition_out(S,M),v=!1},d(M){M&&detach(u),S&&S.d(M),y=!1,w()}}}function instance$3H(p,u,f){let{$$slots:m={},$$scope:v}=u;const y=compute_slots(m);let{size:w="M"}=u,{celery:k=!1}=u,{yellow:S=!1}=u,{fuchsia:M=!1}=u,{indigo:T=!1}=u,{seafoam:E=!1}=u,{chartreuse:H=!1}=u,{magenta:F=!1}=u,{purple:Z=!1}=u,{neutral:$=!1}=u,{info:J=!1}=u,{positive:se=!1}=u,{notice:ie=!1}=u,{negative:he=!1}=u,{disabled:fe=!1}=u,{active:pe=!1}=u,{color:ve=void 0}=u,{square:Ae=!1}=u,{hoverable:ze=!1}=u;function Se(Le){bubble.call(this,p,Le)}return p.$$set=Le=>{"size"in Le&&f(0,w=Le.size),"celery"in Le&&f(1,k=Le.celery),"yellow"in Le&&f(2,S=Le.yellow),"fuchsia"in Le&&f(3,M=Le.fuchsia),"indigo"in Le&&f(4,T=Le.indigo),"seafoam"in Le&&f(5,E=Le.seafoam),"chartreuse"in Le&&f(6,H=Le.chartreuse),"magenta"in Le&&f(7,F=Le.magenta),"purple"in Le&&f(8,Z=Le.purple),"neutral"in Le&&f(9,$=Le.neutral),"info"in Le&&f(10,J=Le.info),"positive"in Le&&f(11,se=Le.positive),"notice"in Le&&f(12,ie=Le.notice),"negative"in Le&&f(13,he=Le.negative),"disabled"in Le&&f(14,fe=Le.disabled),"active"in Le&&f(15,pe=Le.active),"color"in Le&&f(16,ve=Le.color),"square"in Le&&f(17,Ae=Le.square),"hoverable"in Le&&f(18,ze=Le.hoverable),"$$scope"in Le&&f(20,v=Le.$$scope)},[w,k,S,M,T,E,H,F,Z,$,J,se,ie,he,fe,pe,ve,Ae,ze,y,v,m,Se]}class StatusLight extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$3H,create_fragment$3J,safe_not_equal,{size:0,celery:1,yellow:2,fuchsia:3,indigo:4,seafoam:5,chartreuse:6,magenta:7,purple:8,neutral:9,info:10,positive:11,notice:12,negative:13,disabled:14,active:15,color:16,square:17,hoverable:18})}}function positionDropdown(p,u){let f,m=u;const v=()=>y(m),y=k=>{const{anchor:S,align:M,maxHeight:T,maxWidth:E,minWidth:H,useAnchorWidth:F,offset:Z=5,customUpdate:$,resizable:J,wrap:se}=k;if(!S)return;const ie=S.getBoundingClientRect(),he=p.getBoundingClientRect(),fe=window.innerWidth,pe=window.innerHeight,ve=8;let Ae={maxHeight:T,minWidth:F?ie.width:H,maxWidth:F?ie.width:E,left:0,top:0};if(typeof $=="function")Ae=$(ie,he,{...Ae,offset:k.offset});else{const ze=()=>Ae.left+he.width>fe&&ie.left>fe-ie.right,Se=()=>Ae.top+he.height>pe&&ie.top>pe-ie.bottom,Le=Ze=>{!Ae.maxHeight&&J&&(Ae.maxHeight=Ze)},Ce=Ze=>{switch(Ze){case"StartToStart":default:Ae.left=ie.left;break;case"EndToEnd":Ae.left=ie.right-he.width;break;case"StartToEnd":Ae.left=ie.right+Z;break;case"EndToStart":Ae.left=ie.left-he.width-Z;break;case"MidPoint":Ae.left=ie.left+ie.width/2-he.width/2;break;case"ScreenEdge":Ae.left=fe-he.width-ve;break}},Ue=Ze=>{switch(Ze){case"StartToStart":Ae.top=ie.top,Le(pe-ie.top-ve);break;case"EndToEnd":Ae.top=ie.bottom-he.height,Le(ie.bottom-ve);break;case"StartToEnd":default:Ae.top=ie.bottom+Z,Le(pe-ie.bottom-ve);break;case"EndToStart":Ae.top=ie.top-he.height-Z,Le(ie.top-ve);break;case"MidPoint":Ae.top=ie.top+ie.height/2-he.height/2;break;case"ScreenEdge":Ae.top=pe-he.height-ve,Le(pe-2*ve);break}};M===PopoverAlignment.Right?Ce("EndToEnd"):M===PopoverAlignment.RightOutside||M===PopoverAlignment.RightContextMenu?Ce("StartToEnd"):M===PopoverAlignment.LeftOutside||M===PopoverAlignment.LeftContextMenu?Ce("EndToStart"):M===PopoverAlignment.Center?Ce("MidPoint"):Ce("StartToStart"),M===PopoverAlignment.RightOutside||M===PopoverAlignment.LeftOutside?Ue("MidPoint"):M===PopoverAlignment.RightContextMenu||M===PopoverAlignment.LeftContextMenu?(Ue("StartToStart"),Ae.top&&(Ae.top-=5)):Ue("StartToEnd"),ze()&&(M===PopoverAlignment.Left?Ce("EndToEnd"):M===PopoverAlignment.RightOutside&&Ce("EndToStart")),Se()&&(se?(Ue("MidPoint"),Se()&&Ue("ScreenEdge"),Ce("StartToEnd"),ze()&&Ce("EndToStart")):M===PopoverAlignment.LeftOutside||M===PopoverAlignment.RightOutside?Ue("ScreenEdge"):Ue("EndToStart"))}for(const[ze,Se]of Object.entries(Ae)){const Le=ze;Se!=null?p.style[Le]=`${Se}px`:p.style[Le]=""}},w=k=>{m=k,f&&f.disconnect();const{anchor:S}=k;S&&(f=new ResizeObserver(()=>y(k)),f.observe(S),f.observe(p),f.observe(document.body))};return p.style.position="fixed",p.style.zIndex="9999",document.addEventListener("scroll",v,!0),w(u),{update:w,destroy(){f&&f.disconnect(),document.removeEventListener("scroll",v,!0)}}}const Context$1={Modal:"bbui-modal",PopoverRoot:"bbui-popover-root"},Popover_svelte_svelte_type_style_lang="";function create_if_block$29(p){let u,f;return u=new Portal({props:{target:p[17],$$slots:{default:[create_default_slot$1Q]},$$scope:{ctx:p}}}),{c(){create_component(u.$$.fragment)},m(m,v){mount_component(u,m,v),f=!0},p(m,v){const y={};v&131072&&(y.target=m[17]),v&537001982&&(y.$$scope={dirty:v,ctx:m}),u.$set(y)},i(m){f||(transition_in(u.$$.fragment,m),f=!0)},o(m){transition_out(u.$$.fragment,m),f=!1},d(m){destroy_component(u,m)}}}function create_default_slot$1Q(p){let u,f,m,v,y,w,k;const S=p[26].default,M=create_slot(S,p,p[29],null);return{c(){u=element("div"),M&&M.c(),attr(u,"tabindex","0"),attr(u,"class","spectrum-Popover is-open svelte-1kml6bp"),attr(u,"role","presentation"),set_style(u,"height",p[9]),set_style(u,"--customZIndex",p[11]),toggle_class(u,"customZIndex",p[11]),toggle_class(u,"hidden",!p[13]),toggle_class(u,"blockPointerEvents",p[16])},m(T,E){insert(T,u,E),M&&M.m(u,null),y=!0,w||(k=[action_destroyer(f=positionDropdown.call(null,u,{anchor:p[1],align:p[2],maxHeight:p[5],maxWidth:p[4],minWidth:p[3],useAnchorWidth:p[6],offset:p[8],customUpdate:p[12],resizable:p[14],wrap:p[15]})),action_destroyer(m=clickOutside.call(null,u,{callback:p[7]?p[18]:clickOutside_function,anchor:p[1]})),listen(u,"keydown",p[19]),listen(u,"mouseenter",p[27]),listen(u,"mouseleave",p[28])],w=!0)},p(T,E){p=T,M&&M.p&&(!y||E&536870912)&&update_slot_base(M,S,p,p[29],y?get_slot_changes(S,p[29],E,null):get_all_dirty_from_scope(p[29]),null),(!y||E&512)&&set_style(u,"height",p[9]),(!y||E&2048)&&set_style(u,"--customZIndex",p[11]),f&&is_function(f.update)&&E&53630&&f.update.call(null,{anchor:p[1],align:p[2],maxHeight:p[5],maxWidth:p[4],minWidth:p[3],useAnchorWidth:p[6],offset:p[8],customUpdate:p[12],resizable:p[14],wrap:p[15]}),m&&is_function(m.update)&&E&130&&m.update.call(null,{callback:p[7]?p[18]:clickOutside_function,anchor:p[1]}),(!y||E&2048)&&toggle_class(u,"customZIndex",p[11]),(!y||E&8192)&&toggle_class(u,"hidden",!p[13]),(!y||E&65536)&&toggle_class(u,"blockPointerEvents",p[16])},i(T){y||(transition_in(M,T),T&&add_render_callback(()=>{y&&(v||(v=create_bidirectional_transition(u,fly,{y:-20,duration:p[10]?animationDuration:0},!0)),v.run(1))}),y=!0)},o(T){transition_out(M,T),T&&(v||(v=create_bidirectional_transition(u,fly,{y:-20,duration:p[10]?animationDuration:0},!1)),v.run(0)),y=!1},d(T){T&&detach(u),M&&M.d(T),T&&v&&v.end(),w=!1,run_all(k)}}}function create_fragment$3I(p){let u,f,m=p[0]&&create_if_block$29(p);return{c(){m&&m.c(),u=empty$1()},m(v,y){m&&m.m(v,y),insert(v,u,y),f=!0},p(v,[y]){v[0]?m?(m.p(v,y),y&1&&transition_in(m,1)):(m=create_if_block$29(v),m.c(),transition_in(m,1),m.m(u.parentNode,u)):m&&(group_outros(),transition_out(m,1,1,()=>{m=null}),check_outros())},i(v){f||(transition_in(m),f=!0)},o(v){transition_out(m),f=!1},d(v){v&&detach(u),m&&m.d(v)}}}const animationDuration=260,clickOutside_function=()=>{};function instance$3G(p,u,f){let m,{$$slots:v={},$$scope:y}=u,{anchor:w}=u,{align:k=PopoverAlignment.Right}=u,{portalTarget:S=void 0}=u,{minWidth:M=void 0}=u,{maxWidth:T=void 0}=u,{maxHeight:E=void 0}=u,{open:H=!1}=u,{useAnchorWidth:F=!1}=u,{dismissible:Z=!0}=u,{offset:$=4}=u,{customHeight:J=void 0}=u,{animate:se=!0}=u,{customZIndex:ie=void 0}=u,{handlePositionUpdate:he=void 0}=u,{showPopover:fe=!0}=u,{clickOutsideOverride:pe=!1}=u,{resizable:ve=!0}=u,{wrap:Ae=!1}=u;const ze=createEventDispatcher();let Se,Le=!1;const Ce=()=>{ze("open"),f(0,H=!0)},Ue=()=>{ze("close"),f(0,H=!1)},Ze=()=>{H?Ue():Ce()},Ge=He=>{if(!pe&&H){let rt=He.target,ft=!1;for(;!ft&&rt&&rt.parentNode;)ft=rt===w,rt=rt.parentNode;ft&&He.stopPropagation(),Ue()}},be=He=>{pe&&H&&He.key==="Escape"&&Ue()};onDestroy(()=>{clearTimeout(Se)});function De(He){bubble.call(this,p,He)}function Ke(He){bubble.call(this,p,He)}return p.$$set=He=>{"anchor"in He&&f(1,w=He.anchor),"align"in He&&f(2,k=He.align),"portalTarget"in He&&f(20,S=He.portalTarget),"minWidth"in He&&f(3,M=He.minWidth),"maxWidth"in He&&f(4,T=He.maxWidth),"maxHeight"in He&&f(5,E=He.maxHeight),"open"in He&&f(0,H=He.open),"useAnchorWidth"in He&&f(6,F=He.useAnchorWidth),"dismissible"in He&&f(7,Z=He.dismissible),"offset"in He&&f(8,$=He.offset),"customHeight"in He&&f(9,J=He.customHeight),"animate"in He&&f(10,se=He.animate),"customZIndex"in He&&f(11,ie=He.customZIndex),"handlePositionUpdate"in He&&f(12,he=He.handlePositionUpdate),"showPopover"in He&&f(13,fe=He.showPopover),"clickOutsideOverride"in He&&f(21,pe=He.clickOutsideOverride),"resizable"in He&&f(14,ve=He.resizable),"wrap"in He&&f(15,Ae=He.wrap),"$$scope"in He&&f(29,y=He.$$scope)},p.$$.update=()=>{p.$$.dirty&1048576&&f(17,m=S||getContext$1(Context$1.PopoverRoot)||".spectrum"),p.$$.dirty&33555457&&H&&se&&(f(16,Le=!0),clearTimeout(Se),f(25,Se=setTimeout(()=>{f(16,Le=!1)},animationDuration/2)))},[H,w,k,M,T,E,F,Z,$,J,se,ie,he,fe,ve,Ae,Le,m,Ge,be,S,pe,Ce,Ue,Ze,Se,v,De,Ke,y]}class Popover extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$3G,create_fragment$3I,safe_not_equal,{anchor:1,align:2,portalTarget:20,minWidth:3,maxWidth:4,maxHeight:5,open:0,useAnchorWidth:6,dismissible:7,offset:8,customHeight:9,animate:10,customZIndex:11,handlePositionUpdate:12,showPopover:13,clickOutsideOverride:21,resizable:14,wrap:15,show:22,hide:23,toggle:24})}get show(){return this.$$.ctx[22]}get hide(){return this.$$.ctx[23]}get toggle(){return this.$$.ctx[24]}}const indexVars$x="",Tags_svelte_svelte_type_style_lang="";function create_fragment$3H(p){let u,f;const m=p[1].default,v=create_slot(m,p,p[0],null);return{c(){u=element("div"),v&&v.c(),attr(u,"class","spectrum-Tags svelte-17cj8k0"),attr(u,"role","list"),attr(u,"aria-label","list")},m(y,w){insert(y,u,w),v&&v.m(u,null),f=!0},p(y,[w]){v&&v.p&&(!f||w&1)&&update_slot_base(v,m,y,y[0],f?get_slot_changes(m,y[0],w,null):get_all_dirty_from_scope(y[0]),null)},i(y){f||(transition_in(v,y),f=!0)},o(y){transition_out(v,y),f=!1},d(y){y&&detach(u),v&&v.d(y)}}}function instance$3F(p,u,f){let{$$slots:m={},$$scope:v}=u;return p.$$set=y=>{"$$scope"in y&&f(0,v=y.$$scope)},[v,m]}class Tags extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$3F,create_fragment$3H,safe_not_equal,{})}}const indexVars$w="",Avatar_svelte_svelte_type_style_lang="";function create_else_block$F(p){let u,f=(p[3]||"")+"",m;return{c(){u=element("div"),m=text$1(f),attr(u,"class","spectrum-Avatar svelte-xutedg"),attr(u,"style",p[4]),toggle_class(u,"is-disabled",p[2])},m(v,y){insert(v,u,y),append$2(u,m)},p(v,y){y&8&&f!==(f=(v[3]||"")+"")&&set_data(m,f),y&16&&attr(u,"style",v[4]),y&4&&toggle_class(u,"is-disabled",v[2])},d(v){v&&detach(u)}}}function create_if_block$28(p){let u,f;return{c(){u=element("img"),attr(u,"class","spectrum-Avatar"),src_url_equal(u.src,f=p[1])||attr(u,"src",f),attr(u,"alt","Avatar"),set_style(u,"width","var("+p[5].get(p[0])+")"),set_style(u,"height","var("+p[5].get(p[0])+")"),toggle_class(u,"is-disabled",p[2])},m(m,v){insert(m,u,v)},p(m,v){v&2&&!src_url_equal(u.src,f=m[1])&&attr(u,"src",f),v&1&&set_style(u,"width","var("+m[5].get(m[0])+")"),v&1&&set_style(u,"height","var("+m[5].get(m[0])+")"),v&4&&toggle_class(u,"is-disabled",m[2])},d(m){m&&detach(u)}}}function create_fragment$3G(p){let u;function f(y,w){return y[1]?create_if_block$28:create_else_block$F}let m=f(p),v=m(p);return{c(){v.c(),u=empty$1()},m(y,w){v.m(y,w),insert(y,u,w)},p(y,[w]){m===(m=f(y))&&v?v.p(y,w):(v.d(1),v=m(y),v&&(v.c(),v.m(u.parentNode,u)))},i:noop$2,o:noop$2,d(y){y&&detach(u),v.d(y)}}}const DefaultColor="#3aab87";function instance$3E(p,u,f){let m,v,y=new Map([["XXS","--spectrum-alias-avatar-size-50"],["XS","--spectrum-alias-avatar-size-75"],["S","--spectrum-alias-avatar-size-200"],["M","--spectrum-alias-avatar-size-400"],["L","--spectrum-alias-avatar-size-500"],["XL","--spectrum-alias-avatar-size-600"],["XXL","--spectrum-alias-avatar-size-700"]]),{size:w="M"}=u,{url:k=""}=u,{disabled:S=!1}=u,{initials:M="JD"}=u,{color:T=null}=u;const E=F=>F!=null&&F.length?`hsl(${F[0].toLowerCase().charCodeAt(0)%26/26*360}, 50%, 50%)`:DefaultColor,H=(F,Z)=>{const $=`var(${y.get(F)})`,J=`calc(${$} / 2)`;return`width:${$}; height:${$}; font-size:${J}; background:${Z};`};return p.$$set=F=>{"size"in F&&f(0,w=F.size),"url"in F&&f(1,k=F.url),"disabled"in F&&f(2,S=F.disabled),"initials"in F&&f(3,M=F.initials),"color"in F&&f(6,T=F.color)},p.$$.update=()=>{p.$$.dirty&72&&f(7,m=T||E(M)),p.$$.dirty&129&&f(4,v=H(w,m))},[w,k,S,M,v,y,T,m]}class Avatar extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$3E,create_fragment$3G,safe_not_equal,{size:0,url:1,disabled:2,initials:3,color:6})}}function create_fragment$3F(p){let u,f,m,v,y;return{c(){u=element("button"),f=svg_element("svg"),m=svg_element("use"),xlink_attr(m,"xlink:href","#spectrum-css-icon-Cross75"),attr(f,"class","spectrum-Icon spectrum-UIIcon-Cross75"),attr(f,"focusable","false"),attr(f,"aria-hidden","true"),attr(u,"class","spectrum-ClearButton"),u.disabled=p[1],toggle_class(u,"spectrum-ClearButton--small",p[0])},m(w,k){insert(w,u,k),append$2(u,f),append$2(f,m),v||(y=listen(u,"click",p[2]),v=!0)},p(w,[k]){k&2&&(u.disabled=w[1]),k&1&&toggle_class(u,"spectrum-ClearButton--small",w[0])},i:noop$2,o:noop$2,d(w){w&&detach(u),v=!1,y()}}}function instance$3D(p,u,f){let{small:m=!1}=u,{disabled:v}=u;function y(w){bubble.call(this,p,w)}return p.$$set=w=>{"small"in w&&f(0,m=w.small),"disabled"in w&&f(1,v=w.disabled)},[m,v,y]}class ClearButton extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$3D,create_fragment$3F,safe_not_equal,{small:0,disabled:1})}}const Tag_svelte_svelte_type_style_lang$1="";function create_if_block_2$I(p){let u,f;return u=new Avatar({props:{url:p[1]}}),{c(){create_component(u.$$.fragment)},m(m,v){mount_component(u,m,v),f=!0},p(m,v){const y={};v&2&&(y.url=m[1]),u.$set(y)},i(m){f||(transition_in(u.$$.fragment,m),f=!0)},o(m){transition_out(u.$$.fragment,m),f=!1},d(m){destroy_component(u,m)}}}function create_if_block_1$17(p){let u,f,m;return{c(){u=svg_element("svg"),f=svg_element("use"),xlink_attr(f,"xlink:href",m="#spectrum-icon-24-"+p[0]),attr(u,"class","spectrum-Icon spectrum-Icon--sizeS"),attr(u,"focusable","false"),attr(u,"aria-hidden","true"),attr(u,"aria-label","Tag")},m(v,y){insert(v,u,y),append$2(u,f)},p(v,y){y&1&&m!==(m="#spectrum-icon-24-"+v[0])&&xlink_attr(f,"xlink:href",m)},d(v){v&&detach(u)}}}function create_if_block$27(p){let u,f;return u=new ClearButton({}),u.$on("click",p[7]),{c(){create_component(u.$$.fragment)},m(m,v){mount_component(u,m,v),f=!0},i(m){f||(transition_in(u.$$.fragment,m),f=!0)},o(m){transition_out(u.$$.fragment,m),f=!1},d(m){destroy_component(u,m)}}}function create_fragment$3E(p){let u,f,m,v,y,w,k=p[1]&&create_if_block_2$I(p),S=p[0]&&create_if_block_1$17(p);const M=p[6].default,T=create_slot(M,p,p[5],null);let E=p[4]&&create_if_block$27(p);return{c(){u=element("div"),k&&k.c(),f=space(),S&&S.c(),m=space(),v=element("span"),T&&T.c(),y=space(),E&&E.c(),attr(v,"class","spectrum-Tags-itemLabel"),attr(u,"class","spectrum-Tags-item svelte-16fqld8"),attr(u,"role","listitem"),toggle_class(u,"is-invalid",p[2]),toggle_class(u,"is-disabled",p[3])},m(H,F){insert(H,u,F),k&&k.m(u,null),append$2(u,f),S&&S.m(u,null),append$2(u,m),append$2(u,v),T&&T.m(v,null),append$2(u,y),E&&E.m(u,null),w=!0},p(H,[F]){H[1]?k?(k.p(H,F),F&2&&transition_in(k,1)):(k=create_if_block_2$I(H),k.c(),transition_in(k,1),k.m(u,f)):k&&(group_outros(),transition_out(k,1,1,()=>{k=null}),check_outros()),H[0]?S?S.p(H,F):(S=create_if_block_1$17(H),S.c(),S.m(u,m)):S&&(S.d(1),S=null),T&&T.p&&(!w||F&32)&&update_slot_base(T,M,H,H[5],w?get_slot_changes(M,H[5],F,null):get_all_dirty_from_scope(H[5]),null),H[4]?E?F&16&&transition_in(E,1):(E=create_if_block$27(H),E.c(),transition_in(E,1),E.m(u,null)):E&&(group_outros(),transition_out(E,1,1,()=>{E=null}),check_outros()),(!w||F&4)&&toggle_class(u,"is-invalid",H[2]),(!w||F&8)&&toggle_class(u,"is-disabled",H[3])},i(H){w||(transition_in(k),transition_in(T,H),transition_in(E),w=!0)},o(H){transition_out(k),transition_out(T,H),transition_out(E),w=!1},d(H){H&&detach(u),k&&k.d(),S&&S.d(),T&&T.d(H),E&&E.d()}}}function instance$3C(p,u,f){let{$$slots:m={},$$scope:v}=u,{icon:y=""}=u,{avatar:w=""}=u,{invalid:k=!1}=u,{disabled:S=!1}=u,{closable:M=!1}=u;function T(E){bubble.call(this,p,E)}return p.$$set=E=>{"icon"in E&&f(0,y=E.icon),"avatar"in E&&f(1,w=E.avatar),"invalid"in E&&f(2,k=E.invalid),"disabled"in E&&f(3,S=E.disabled),"closable"in E&&f(4,M=E.closable),"$$scope"in E&&f(5,v=E.$$scope)},[y,w,k,S,M,v,m,T]}let Tag$1=class extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$3C,create_fragment$3E,safe_not_equal,{icon:0,avatar:1,invalid:2,disabled:3,closable:4})}};const indexVars$v="";function create_fragment$3D(p){let u,f,m,v,y,w,k,S,M,T,E,H,F,Z;return{c(){u=element("div"),f=element("div"),m=space(),v=element("div"),y=element("div"),w=element("div"),k=element("div"),S=space(),M=element("div"),T=element("div"),E=element("div"),attr(f,"class","spectrum-ProgressCircle-track"),attr(k,"class","spectrum-ProgressCircle-fill"),attr(w,"class","spectrum-ProgressCircle-fillSubMask1"),attr(w,"style",p[3]),attr(y,"class","spectrum-ProgressCircle-fillMask1"),attr(E,"class","spectrum-ProgressCircle-fill"),attr(T,"class","spectrum-ProgressCircle-fillSubMask2"),attr(T,"style",p[4]),attr(M,"class","spectrum-ProgressCircle-fillMask2"),attr(v,"class","spectrum-ProgressCircle-fills"),attr(u,"class",H="spectrum-ProgressCircle spectrum-ProgressCircle--"+convertSize(p[0])),toggle_class(u,"spectrum-ProgressCircle--indeterminate",p[1]==null),toggle_class(u,"spectrum-ProgressCircle--overBackground",p[2])},m($,J){insert($,u,J),append$2(u,f),append$2(u,m),append$2(u,v),append$2(v,y),append$2(y,w),append$2(w,k),append$2(v,S),append$2(v,M),append$2(M,T),append$2(T,E),F||(Z=listen(u,"click",p[7]),F=!0)},p($,[J]){J&8&&attr(w,"style",$[3]),J&16&&attr(T,"style",$[4]),J&1&&H!==(H="spectrum-ProgressCircle spectrum-ProgressCircle--"+convertSize($[0]))&&attr(u,"class",H),J&3&&toggle_class(u,"spectrum-ProgressCircle--indeterminate",$[1]==null),J&5&&toggle_class(u,"spectrum-ProgressCircle--overBackground",$[2])},i:noop$2,o:noop$2,d($){$&&detach(u),F=!1,Z()}}}function convertSize(p){switch(p){case"S":return"small";case"L":return"large";default:return}}function instance$3B(p,u,f){let{size:m="M"}=u,{value:v=null}=u,{minValue:y=0}=u,{maxValue:w=100}=u,k,S;function M(H){if(H){let F=(H-y)/(w-y)*100,Z;F>0&&F<=50?(Z=-180+F/50*180,f(3,k=`transform: rotate(${Z}deg);`),f(4,S="transform: rotate(-180deg);")):F>50&&(Z=-180+(F-50)/50*180,f(3,k="transform: rotate(0deg);"),f(4,S=`transform: rotate(${Z}deg);`))}}let{overBackground:T=!1}=u;function E(H){bubble.call(this,p,H)}return p.$$set=H=>{"size"in H&&f(0,m=H.size),"value"in H&&f(1,v=H.value),"minValue"in H&&f(5,y=H.minValue),"maxValue"in H&&f(6,w=H.maxValue),"overBackground"in H&&f(2,T=H.overBackground)},p.$$.update=()=>{p.$$.dirty&2&&M(v)},[m,v,T,k,S,y,w,E]}class ProgressCircle extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$3B,create_fragment$3D,safe_not_equal,{size:0,value:1,minValue:5,maxValue:6,overBackground:2})}}const Picker_svelte_svelte_type_style_lang="";function get_each_context$J(p,u,f){const m=p.slice();return m[49]=u[f],m[51]=f,m}function create_if_block_11$2(p){let u,f,m,v;const y=[create_if_block_12$2,create_else_block_1$d],w=[];function k(S,M){return S[17]?1:0}return u=k(p),f=w[u]=y[u](p),{c(){f.c(),m=empty$1()},m(S,M){w[u].m(S,M),insert(S,m,M),v=!0},p(S,M){let T=u;u=k(S),u===T?w[u].p(S,M):(group_outros(),transition_out(w[T],1,1,()=>{w[T]=null}),check_outros(),f=w[u],f?f.p(S,M):(f=w[u]=y[u](S),f.c()),transition_in(f,1),f.m(m.parentNode,m))},i(S){v||(transition_in(f),v=!0)},o(S){transition_out(f),v=!1},d(S){S&&detach(m),w[u].d(S)}}}function create_else_block_1$d(p){let u,f,m;return{c(){u=element("span"),f=element("img"),src_url_equal(f.src,m=p[5])||attr(f,"src",m),attr(f,"alt","icon"),attr(f,"width","15"),attr(f,"height","15"),attr(u,"class","option-extra icon field-icon svelte-1jmtv0w")},m(v,y){insert(v,u,y),append$2(u,f)},p(v,y){y[0]&32&&!src_url_equal(f.src,m=v[5])&&attr(f,"src",m)},i:noop$2,o:noop$2,d(v){v&&detach(u)}}}function create_if_block_12$2(p){let u,f,m;return f=new Icon$1({props:{size:"S",name:p[5]}}),{c(){u=element("span"),create_component(f.$$.fragment),attr(u,"class","option-extra icon svelte-1jmtv0w")},m(v,y){insert(v,u,y),mount_component(f,u,null),m=!0},p(v,y){const w={};y[0]&32&&(w.name=v[5]),f.$set(w)},i(v){m||(transition_in(f.$$.fragment,v),m=!0)},o(v){transition_out(f.$$.fragment,v),m=!1},d(v){v&&detach(u),destroy_component(f)}}}function create_if_block_10$3(p){let u,f,m;return f=new StatusLight({props:{square:!0,color:p[6]}}),{c(){u=element("span"),create_component(f.$$.fragment),attr(u,"class","option-extra svelte-1jmtv0w")},m(v,y){insert(v,u,y),mount_component(f,u,null),m=!0},p(v,y){const w={};y[0]&64&&(w.color=v[6]),f.$set(w)},i(v){m||(transition_in(f.$$.fragment,v),m=!0)},o(v){transition_out(f.$$.fragment,v),m=!1},d(v){v&&detach(u),destroy_component(f)}}}function create_if_block_9$4(p){let u,f;return u=new Search({props:{value:p[0],disabled:p[3],placeholder:"Search"}}),u.$on("change",p[37]),{c(){create_component(u.$$.fragment)},m(m,v){mount_component(u,m,v),f=!0},p(m,v){const y={};v[0]&1&&(y.value=m[0]),v[0]&8&&(y.disabled=m[3]),u.$set(y)},i(m){f||(transition_in(u.$$.fragment,m),f=!0)},o(m){transition_out(u.$$.fragment,m),f=!1},d(m){destroy_component(u,m)}}}function create_if_block_8$5(p){let u,f,m,v,y,w,k,S;return{c(){u=element("li"),f=element("span"),m=text$1(p[8]),v=space(),y=svg_element("svg"),w=svg_element("use"),attr(f,"class","spectrum-Menu-itemLabel svelte-1jmtv0w"),xlink_attr(w,"xlink:href","#spectrum-css-icon-Checkmark100"),attr(y,"class","spectrum-Icon spectrum-UIIcon-Checkmark100 spectrum-Menu-checkmark spectrum-Menu-itemIcon svelte-1jmtv0w"),attr(y,"focusable","false"),attr(y,"aria-hidden","true"),attr(u,"class","spectrum-Menu-item placeholder svelte-1jmtv0w"),attr(u,"role","option"),attr(u,"aria-selected","true"),attr(u,"tabindex","0"),toggle_class(u,"is-selected",p[7])},m(M,T){insert(M,u,T),append$2(u,f),append$2(f,m),append$2(u,v),append$2(u,y),append$2(y,w),k||(S=listen(u,"click",p[38]),k=!0)},p(M,T){T[0]&256&&set_data(m,M[8]),T[0]&128&&toggle_class(u,"is-selected",M[7])},d(M){M&&detach(u),k=!1,S()}}}function create_if_block_2$H(p){let u,f,m=ensure_array_like(p[30]),v=[];for(let w=0;w<m.length;w+=1)v[w]=create_each_block$J(get_each_context$J(p,m,w));const y=w=>transition_out(v[w],1,1,()=>{v[w]=null});return{c(){for(let w=0;w<v.length;w+=1)v[w].c();u=empty$1()},m(w,k){for(let S=0;S<v.length;S+=1)v[S]&&v[S].m(w,k);insert(w,u,k),f=!0},p(w,k){if(k[0]&1275330048){m=ensure_array_like(w[30]);let S;for(S=0;S<m.length;S+=1){const M=get_each_context$J(w,m,S);v[S]?(v[S].p(M,k),transition_in(v[S],1)):(v[S]=create_each_block$J(M),v[S].c(),transition_in(v[S],1),v[S].m(u.parentNode,u))}for(group_outros(),S=m.length;S<v.length;S+=1)y(S);check_outros()}},i(w){if(!f){for(let k=0;k<m.length;k+=1)transition_in(v[k]);f=!0}},o(w){v=v.filter(Boolean);for(let k=0;k<v.length;k+=1)transition_out(v[k]);f=!1},d(w){w&&detach(u),destroy_each(v,w)}}}function create_if_block_6$b(p){let u,f,m,v;const y=[create_if_block_7$a,create_else_block$E],w=[];function k(S,M){return S[17]?0:1}return f=k(p),m=w[f]=y[f](p),{c(){u=element("span"),m.c(),attr(u,"class","option-extra icon svelte-1jmtv0w")},m(S,M){insert(S,u,M),w[f].m(u,null),v=!0},p(S,M){let T=f;f=k(S),f===T?w[f].p(S,M):(group_outros(),transition_out(w[T],1,1,()=>{w[T]=null}),check_outros(),m=w[f],m?m.p(S,M):(m=w[f]=y[f](S),m.c()),transition_in(m,1),m.m(u,null))},i(S){v||(transition_in(m),v=!0)},o(S){transition_out(m),v=!1},d(S){S&&detach(u),w[f].d()}}}function create_else_block$E(p){let u,f;return u=new Icon$1({props:{size:"S",name:p[14](p[49],p[51])}}),{c(){create_component(u.$$.fragment)},m(m,v){mount_component(u,m,v),f=!0},p(m,v){const y={};v[0]&1073758208&&(y.name=m[14](m[49],m[51])),u.$set(y)},i(m){f||(transition_in(u.$$.fragment,m),f=!0)},o(m){transition_out(u.$$.fragment,m),f=!1},d(m){destroy_component(u,m)}}}function create_if_block_7$a(p){let u,f;return{c(){u=element("img"),src_url_equal(u.src,f=p[14](p[49],p[51]))||attr(u,"src",f),attr(u,"alt","icon"),attr(u,"width","15"),attr(u,"height","15")},m(m,v){insert(m,u,v)},p(m,v){v[0]&1073758208&&!src_url_equal(u.src,f=m[14](m[49],m[51]))&&attr(u,"src",f)},i:noop$2,o:noop$2,d(m){m&&detach(u)}}}function create_if_block_5$g(p){let u,f,m;return f=new StatusLight({props:{square:!0,color:p[15](p[49],p[51])}}),{c(){u=element("span"),create_component(f.$$.fragment),attr(u,"class","option-extra svelte-1jmtv0w")},m(v,y){insert(v,u,y),mount_component(f,u,null),m=!0},p(v,y){const w={};y[0]&1073774592&&(w.color=v[15](v[49],v[51])),f.$set(w)},i(v){m||(transition_in(f.$$.fragment,v),m=!0)},o(v){transition_out(f.$$.fragment,v),m=!1},d(v){v&&detach(u),destroy_component(f)}}}function create_if_block_4$i(p){let u,f=p[16](p[49],p[51])+"",m;return{c(){u=element("span"),m=text$1(f),attr(u,"class","subtitle-text svelte-1jmtv0w")},m(v,y){insert(v,u,y),append$2(u,m)},p(v,y){y[0]&1073807360&&f!==(f=v[16](v[49],v[51])+"")&&set_data(m,f)},d(v){v&&detach(u)}}}function create_if_block_3$p(p){let u,f,m;return f=new Tags({props:{$$slots:{default:[create_default_slot_1$J]},$$scope:{ctx:p}}}),{c(){u=element("span"),create_component(f.$$.fragment),attr(u,"class","option-tag svelte-1jmtv0w")},m(v,y){insert(v,u,y),mount_component(f,u,null),m=!0},p(v,y){const w={};y[0]&1073741824|y[1]&2097152&&(w.$$scope={dirty:y,ctx:v}),f.$set(w)},i(v){m||(transition_in(f.$$.fragment,v),m=!0)},o(v){transition_out(f.$$.fragment,v),m=!1},d(v){v&&detach(u),destroy_component(f)}}}function create_default_slot_2$u(p){let u=p[49].tag+"",f;return{c(){f=text$1(u)},m(m,v){insert(m,f,v)},p(m,v){v[0]&1073741824&&u!==(u=m[49].tag+"")&&set_data(f,u)},d(m){m&&detach(f)}}}function create_default_slot_1$J(p){let u,f;return u=new Tag$1({props:{icon:"LockClosed",$$slots:{default:[create_default_slot_2$u]},$$scope:{ctx:p}}}),{c(){create_component(u.$$.fragment)},m(m,v){mount_component(u,m,v),f=!0},p(m,v){const y={};v[0]&1073741824|v[1]&2097152&&(y.$$scope={dirty:v,ctx:m}),u.$set(y)},i(m){f||(transition_in(u.$$.fragment,m),f=!0)},o(m){transition_out(u.$$.fragment,m),f=!1},d(m){destroy_component(u,m)}}}function create_each_block$J(p){let u,f=p[14](p[49],p[51]),m,v=p[15](p[49],p[51]),y,w,k=p[12](p[49],p[51])+"",S,M,T=p[16](p[49],p[51]),E,H,F,Z,$,J,se,ie,he=f&&create_if_block_6$b(p),fe=v&&create_if_block_5$g(p),pe=T&&create_if_block_4$i(p),ve=p[49].tag&&create_if_block_3$p(p);function Ae(){return p[39](p[49],p[51])}function ze(...Le){return p[40](p[49],...Le)}function Se(...Le){return p[41](p[49],...Le)}return{c(){u=element("li"),he&&he.c(),m=space(),fe&&fe.c(),y=space(),w=element("span"),S=text$1(k),M=space(),pe&&pe.c(),E=space(),ve&&ve.c(),H=space(),F=svg_element("svg"),Z=svg_element("use"),$=space(),attr(w,"class","spectrum-Menu-itemLabel svelte-1jmtv0w"),xlink_attr(Z,"xlink:href","#spectrum-css-icon-Checkmark100"),attr(F,"class","spectrum-Icon spectrum-UIIcon-Checkmark100 spectrum-Menu-checkmark spectrum-Menu-itemIcon svelte-1jmtv0w"),attr(F,"focusable","false"),attr(F,"aria-hidden","true"),attr(u,"class","spectrum-Menu-item svelte-1jmtv0w"),attr(u,"role","option"),attr(u,"aria-selected","true"),attr(u,"tabindex","0"),toggle_class(u,"is-selected",p[9](p[13](p[49],p[51]))),toggle_class(u,"is-disabled",!p[10](p[49]))},m(Le,Ce){insert(Le,u,Ce),he&&he.m(u,null),append$2(u,m),fe&&fe.m(u,null),append$2(u,y),append$2(u,w),append$2(w,S),append$2(w,M),pe&&pe.m(w,null),append$2(u,E),ve&&ve.m(u,null),append$2(u,H),append$2(u,F),append$2(F,Z),append$2(u,$),J=!0,se||(ie=[listen(u,"click",Ae),listen(u,"mouseenter",ze),listen(u,"mouseleave",Se)],se=!0)},p(Le,Ce){p=Le,Ce[0]&1073758208&&(f=p[14](p[49],p[51])),f?he?(he.p(p,Ce),Ce[0]&1073758208&&transition_in(he,1)):(he=create_if_block_6$b(p),he.c(),transition_in(he,1),he.m(u,m)):he&&(group_outros(),transition_out(he,1,1,()=>{he=null}),check_outros()),Ce[0]&1073774592&&(v=p[15](p[49],p[51])),v?fe?(fe.p(p,Ce),Ce[0]&1073774592&&transition_in(fe,1)):(fe=create_if_block_5$g(p),fe.c(),transition_in(fe,1),fe.m(u,y)):fe&&(group_outros(),transition_out(fe,1,1,()=>{fe=null}),check_outros()),(!J||Ce[0]&1073745920)&&k!==(k=p[12](p[49],p[51])+"")&&set_data(S,k),Ce[0]&1073807360&&(T=p[16](p[49],p[51])),T?pe?pe.p(p,Ce):(pe=create_if_block_4$i(p),pe.c(),pe.m(w,null)):pe&&(pe.d(1),pe=null),p[49].tag?ve?(ve.p(p,Ce),Ce[0]&1073741824&&transition_in(ve,1)):(ve=create_if_block_3$p(p),ve.c(),transition_in(ve,1),ve.m(u,H)):ve&&(group_outros(),transition_out(ve,1,1,()=>{ve=null}),check_outros()),(!J||Ce[0]&1073750528)&&toggle_class(u,"is-selected",p[9](p[13](p[49],p[51]))),(!J||Ce[0]&1073742848)&&toggle_class(u,"is-disabled",!p[10](p[49]))},i(Le){J||(transition_in(he),transition_in(fe),transition_in(ve),J=!0)},o(Le){transition_out(he),transition_out(fe),transition_out(ve),J=!1},d(Le){Le&&detach(u),he&&he.d(),fe&&fe.d(),pe&&pe.d(),ve&&ve.d(),se=!1,run_all(ie)}}}function create_if_block_1$16(p){let u,f,m;return f=new ProgressCircle({props:{size:"S"}}),{c(){u=element("div"),create_component(f.$$.fragment),attr(u,"class","loading svelte-1jmtv0w"),toggle_class(u,"loading--withAutocomplete",p[20])},m(v,y){insert(v,u,y),mount_component(f,u,null),m=!0},p(v,y){(!m||y[0]&1048576)&&toggle_class(u,"loading--withAutocomplete",v[20])},i(v){m||(transition_in(f.$$.fragment,v),m=!0)},o(v){transition_out(f.$$.fragment,v),m=!1},d(v){v&&detach(u),destroy_component(f)}}}function create_if_block$26(p){let u,f;return{c(){u=element("div"),f=text$1(p[23]),attr(u,"class","footer svelte-1jmtv0w")},m(m,v){insert(m,u,v),append$2(u,f)},p(m,v){v[0]&8388608&&set_data(f,m[23])},d(m){m&&detach(u)}}}function create_default_slot$1P(p){let u,f,m,v,y,w,k,S,M,T,E=p[20]&&create_if_block_9$4(p),H=p[8]&&create_if_block_8$5(p),F=p[30].length&&create_if_block_2$H(p),Z=p[25]&&create_if_block_1$16(p),$=p[23]&&create_if_block$26(p);return{c(){u=element("div"),E&&E.c(),f=space(),m=element("ul"),H&&H.c(),v=space(),F&&F.c(),y=space(),Z&&Z.c(),w=space(),$&&$.c(),attr(m,"class","spectrum-Menu"),attr(m,"role","listbox"),attr(u,"class","popover-content svelte-1jmtv0w"),toggle_class(u,"auto-width",p[19])},m(J,se){insert(J,u,se),E&&E.m(u,null),append$2(u,f),append$2(u,m),H&&H.m(m,null),append$2(m,v),F&&F.m(m,null),p[42](m),append$2(u,y),Z&&Z.m(u,null),append$2(u,w),$&&$.m(u,null),S=!0,M||(T=action_destroyer(k=clickOutside.call(null,u,p[43])),M=!0)},p(J,se){J[20]?E?(E.p(J,se),se[0]&1048576&&transition_in(E,1)):(E=create_if_block_9$4(J),E.c(),transition_in(E,1),E.m(u,f)):E&&(group_outros(),transition_out(E,1,1,()=>{E=null}),check_outros()),J[8]?H?H.p(J,se):(H=create_if_block_8$5(J),H.c(),H.m(m,v)):H&&(H.d(1),H=null),J[30].length?F?(F.p(J,se),se[0]&1073741824&&transition_in(F,1)):(F=create_if_block_2$H(J),F.c(),transition_in(F,1),F.m(m,null)):F&&(group_outros(),transition_out(F,1,1,()=>{F=null}),check_outros()),J[25]?Z?(Z.p(J,se),se[0]&33554432&&transition_in(Z,1)):(Z=create_if_block_1$16(J),Z.c(),transition_in(Z,1),Z.m(u,w)):Z&&(group_outros(),transition_out(Z,1,1,()=>{Z=null}),check_outros()),J[23]?$?$.p(J,se):($=create_if_block$26(J),$.c(),$.m(u,null)):$&&($.d(1),$=null),k&&is_function(k.update)&&se[0]&2&&k.update.call(null,J[43]),(!S||se[0]&524288)&&toggle_class(u,"auto-width",J[19])},i(J){S||(transition_in(E),transition_in(F),transition_in(Z),S=!0)},o(J){transition_out(E),transition_out(F),transition_out(Z),S=!1},d(J){J&&detach(u),E&&E.d(),H&&H.d(),F&&F.d(),p[42](null),Z&&Z.d(),$&&$.d(),M=!1,T()}}}function create_fragment$3C(p){let u,f,m,v,y,w,k,S,M,T,E,H,F,Z=p[5]&&create_if_block_11$2(p),$=p[6]&&create_if_block_10$3(p);return T=new Popover({props:{anchor:p[24]?p[24]:p[29],align:p[22]||PopoverAlignment.Left,open:p[1],useAnchorWidth:!p[19],maxWidth:p[19]?400:void 0,customHeight:p[21],maxHeight:360,$$slots:{default:[create_default_slot$1P]},$$scope:{ctx:p}}}),T.$on("close",p[44]),{c(){u=element("button"),Z&&Z.c(),f=space(),$&&$.c(),m=space(),v=element("span"),y=text$1(p[4]),w=space(),k=svg_element("svg"),S=svg_element("use"),M=space(),create_component(T.$$.fragment),attr(v,"class","spectrum-Picker-label svelte-1jmtv0w"),toggle_class(v,"is-placeholder",p[7]),toggle_class(v,"auto-width",p[19]),xlink_attr(S,"xlink:href","#spectrum-css-icon-Chevron100"),attr(k,"class","spectrum-Icon spectrum-UIIcon-ChevronDown100 spectrum-Picker-menuIcon"),attr(k,"focusable","false"),attr(k,"aria-hidden","true"),attr(u,"id",p[2]),attr(u,"class","spectrum-Picker spectrum-Picker--sizeM svelte-1jmtv0w"),u.disabled=p[3],attr(u,"aria-haspopup","listbox"),toggle_class(u,"spectrum-Picker--quiet",p[18]),toggle_class(u,"is-open",p[1])},m(J,se){insert(J,u,se),Z&&Z.m(u,null),append$2(u,f),$&&$.m(u,null),append$2(u,m),append$2(u,v),append$2(v,y),append$2(u,w),append$2(u,k),append$2(k,S),p[36](u),insert(J,M,se),mount_component(T,J,se),E=!0,H||(F=listen(u,"click",p[31]),H=!0)},p(J,se){J[5]?Z?(Z.p(J,se),se[0]&32&&transition_in(Z,1)):(Z=create_if_block_11$2(J),Z.c(),transition_in(Z,1),Z.m(u,f)):Z&&(group_outros(),transition_out(Z,1,1,()=>{Z=null}),check_outros()),J[6]?$?($.p(J,se),se[0]&64&&transition_in($,1)):($=create_if_block_10$3(J),$.c(),transition_in($,1),$.m(u,m)):$&&(group_outros(),transition_out($,1,1,()=>{$=null}),check_outros()),(!E||se[0]&16)&&set_data(y,J[4]),(!E||se[0]&128)&&toggle_class(v,"is-placeholder",J[7]),(!E||se[0]&524288)&&toggle_class(v,"auto-width",J[19]),(!E||se[0]&4)&&attr(u,"id",J[2]),(!E||se[0]&8)&&(u.disabled=J[3]),(!E||se[0]&262144)&&toggle_class(u,"spectrum-Picker--quiet",J[18]),(!E||se[0]&2)&&toggle_class(u,"is-open",J[1]);const ie={};se[0]&553648128&&(ie.anchor=J[24]?J[24]:J[29]),se[0]&4194304&&(ie.align=J[22]||PopoverAlignment.Left),se[0]&2&&(ie.open=J[1]),se[0]&524288&&(ie.useAnchorWidth=!J[19]),se[0]&524288&&(ie.maxWidth=J[19]?400:void 0),se[0]&2097152&&(ie.customHeight=J[21]),se[0]&1587281803|se[1]&2097152&&(ie.$$scope={dirty:se,ctx:J}),T.$set(ie)},i(J){E||(transition_in(Z),transition_in($),transition_in(T.$$.fragment,J),E=!0)},o(J){transition_out(Z),transition_out($),transition_out(T.$$.fragment,J),E=!1},d(J){J&&(detach(u),detach(M)),Z&&Z.d(),$&&$.d(),p[36](null),destroy_component(T,J),H=!1,F()}}}function instance$3A(p,u,f){let m,v,{id:y=void 0}=u,{disabled:w=!1}=u,{fieldText:k=""}=u,{fieldIcon:S=""}=u,{fieldColour:M=""}=u,{isPlaceholder:T=!1}=u,{placeholderOption:E=void 0}=u,{options:H=[]}=u,{isOptionSelected:F=$t=>$t}=u,{isOptionEnabled:Z=($t,xn)=>$t}=u,{onSelectOption:$=()=>{}}=u,{getOptionLabel:J=($t,xn)=>`${$t}`}=u,{getOptionValue:se=($t,xn)=>$t}=u,{getOptionIcon:ie=($t,xn)=>($t==null?void 0:$t.icon)??void 0}=u,{getOptionColour:he=($t,xn)=>($t==null?void 0:$t.colour)??void 0}=u,{getOptionSubtitle:fe=($t,xn)=>($t==null?void 0:$t.subtitle)??void 0}=u,{useOptionIconImage:pe=!1}=u,{open:ve=!1}=u,{readonly:Ae=!1}=u,{quiet:ze=!1}=u,{autoWidth:Se=!1}=u,{autocomplete:Le=!1}=u,{sort:Ce=!1}=u,{searchTerm:Ue=null}=u,{customPopoverHeight:Ze=void 0}=u,{align:Ge=PopoverAlignment.Left}=u,{footer:be=void 0}=u,{customAnchor:De=void 0}=u,{loading:Ke=!1}=u,{onOptionMouseenter:He=()=>{}}=u,{onOptionMouseleave:rt=()=>{}}=u;const ft=createEventDispatcher();let Mt,$e;const je=$t=>{$t.preventDefault(),$t.stopPropagation(),ft("click"),!Ae&&(f(0,Ue=null),f(1,ve=!ve))},Ct=($t,xn,sn)=>!($t!=null&&$t.length)||!Array.isArray($t)?[]:sn?$t.sort((mt,Mn)=>{const Dt=xn(mt),Wt=xn(Mn);return Dt>Wt?1:-1}):$t,yt=($t,xn,sn)=>{if(Le&&xn){const mt=xn.toLowerCase();return $t.filter(Mn=>`${sn(Mn)}`.toLowerCase().includes(mt))}return $t},ot=$t=>{$t.target.scrollHeight-$t.target.clientHeight-$t.target.scrollTop<100&&ft("loadMore")};onDestroy(()=>{$e==null||$e.removeEventListener("scroll",null)});function Rt($t){binding_callbacks[$t?"unshift":"push"](()=>{Mt=$t,f(29,Mt)})}const Xe=$t=>f(0,Ue=$t.detail),Gt=()=>$(null),Jt=($t,xn)=>$(se($t,xn)),Ht=($t,xn)=>He(xn,$t),Pt=($t,xn)=>rt(xn,$t);function Et($t){binding_callbacks[$t?"unshift":"push"](()=>{$e=$t,f(28,$e)})}const cn=()=>{f(1,ve=!1)},Sn=()=>f(1,ve=!1);return p.$$set=$t=>{"id"in $t&&f(2,y=$t.id),"disabled"in $t&&f(3,w=$t.disabled),"fieldText"in $t&&f(4,k=$t.fieldText),"fieldIcon"in $t&&f(5,S=$t.fieldIcon),"fieldColour"in $t&&f(6,M=$t.fieldColour),"isPlaceholder"in $t&&f(7,T=$t.isPlaceholder),"placeholderOption"in $t&&f(8,E=$t.placeholderOption),"options"in $t&&f(32,H=$t.options),"isOptionSelected"in $t&&f(9,F=$t.isOptionSelected),"isOptionEnabled"in $t&&f(10,Z=$t.isOptionEnabled),"onSelectOption"in $t&&f(11,$=$t.onSelectOption),"getOptionLabel"in $t&&f(12,J=$t.getOptionLabel),"getOptionValue"in $t&&f(13,se=$t.getOptionValue),"getOptionIcon"in $t&&f(14,ie=$t.getOptionIcon),"getOptionColour"in $t&&f(15,he=$t.getOptionColour),"getOptionSubtitle"in $t&&f(16,fe=$t.getOptionSubtitle),"useOptionIconImage"in $t&&f(17,pe=$t.useOptionIconImage),"open"in $t&&f(1,ve=$t.open),"readonly"in $t&&f(33,Ae=$t.readonly),"quiet"in $t&&f(18,ze=$t.quiet),"autoWidth"in $t&&f(19,Se=$t.autoWidth),"autocomplete"in $t&&f(20,Le=$t.autocomplete),"sort"in $t&&f(34,Ce=$t.sort),"searchTerm"in $t&&f(0,Ue=$t.searchTerm),"customPopoverHeight"in $t&&f(21,Ze=$t.customPopoverHeight),"align"in $t&&f(22,Ge=$t.align),"footer"in $t&&f(23,be=$t.footer),"customAnchor"in $t&&f(24,De=$t.customAnchor),"loading"in $t&&f(25,Ke=$t.loading),"onOptionMouseenter"in $t&&f(26,He=$t.onOptionMouseenter),"onOptionMouseleave"in $t&&f(27,rt=$t.onOptionMouseleave)},p.$$.update=()=>{p.$$.dirty[0]&4096|p.$$.dirty[1]&10&&f(35,m=Ct(H,J,Ce)),p.$$.dirty[0]&4097|p.$$.dirty[1]&16&&f(30,v=yt(m,Ue,J)),p.$$.dirty[0]&268435456&&($e==null||$e.addEventListener("scroll",ot))},[Ue,ve,y,w,k,S,M,T,E,F,Z,$,J,se,ie,he,fe,pe,ze,Se,Le,Ze,Ge,be,De,Ke,He,rt,$e,Mt,v,je,H,Ae,Ce,m,Rt,Xe,Gt,Jt,Ht,Pt,Et,cn,Sn]}class Picker extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$3A,create_fragment$3C,safe_not_equal,{id:2,disabled:3,fieldText:4,fieldIcon:5,fieldColour:6,isPlaceholder:7,placeholderOption:8,options:32,isOptionSelected:9,isOptionEnabled:10,onSelectOption:11,getOptionLabel:12,getOptionValue:13,getOptionIcon:14,getOptionColour:15,getOptionSubtitle:16,useOptionIconImage:17,open:1,readonly:33,quiet:18,autoWidth:19,autocomplete:20,sort:34,searchTerm:0,customPopoverHeight:21,align:22,footer:23,customAnchor:24,loading:25,onOptionMouseenter:26,onOptionMouseleave:27},null,[-1,-1])}}function create_fragment$3B(p){let u,f,m,v;function y(S){p[32](S)}function w(S){p[33](S)}let k={quiet:p[15],id:p[3],disabled:p[5],readonly:p[14],fieldText:p[27],fieldIcon:p[26],fieldColour:p[25],options:p[6],autoWidth:p[16],align:p[19],footer:p[20],getOptionLabel:p[7],getOptionValue:p[8],getOptionIcon:p[9],getOptionColour:p[10],getOptionSubtitle:p[11],useOptionIconImage:p[12],isOptionEnabled:p[13],autocomplete:p[17],sort:p[18],onOptionMouseenter:p[22],onOptionMouseleave:p[23],isPlaceholder:p[2]==null||p[2]==="",placeholderOption:p[4]===!1?void 0:p[4]||"Choose an option",isOptionSelected:p[31],onSelectOption:p[29],loading:p[21],customPopoverHeight:p[24]};return p[0]!==void 0&&(k.open=p[0]),p[1]!==void 0&&(k.searchTerm=p[1]),u=new Picker({props:k}),binding_callbacks.push(()=>bind(u,"open",y)),binding_callbacks.push(()=>bind(u,"searchTerm",w)),u.$on("click",p[34]),u.$on("loadMore",p[35]),{c(){create_component(u.$$.fragment)},m(S,M){mount_component(u,S,M),v=!0},p(S,M){const T={};M[0]&32768&&(T.quiet=S[15]),M[0]&8&&(T.id=S[3]),M[0]&32&&(T.disabled=S[5]),M[0]&16384&&(T.readonly=S[14]),M[0]&134217728&&(T.fieldText=S[27]),M[0]&67108864&&(T.fieldIcon=S[26]),M[0]&33554432&&(T.fieldColour=S[25]),M[0]&64&&(T.options=S[6]),M[0]&65536&&(T.autoWidth=S[16]),M[0]&524288&&(T.align=S[19]),M[0]&1048576&&(T.footer=S[20]),M[0]&128&&(T.getOptionLabel=S[7]),M[0]&256&&(T.getOptionValue=S[8]),M[0]&512&&(T.getOptionIcon=S[9]),M[0]&1024&&(T.getOptionColour=S[10]),M[0]&2048&&(T.getOptionSubtitle=S[11]),M[0]&4096&&(T.useOptionIconImage=S[12]),M[0]&8192&&(T.isOptionEnabled=S[13]),M[0]&131072&&(T.autocomplete=S[17]),M[0]&262144&&(T.sort=S[18]),M[0]&4194304&&(T.onOptionMouseenter=S[22]),M[0]&8388608&&(T.onOptionMouseleave=S[23]),M[0]&4&&(T.isPlaceholder=S[2]==null||S[2]===""),M[0]&16&&(T.placeholderOption=S[4]===!1?void 0:S[4]||"Choose an option"),M[0]&4&&(T.isOptionSelected=S[31]),M[0]&2097152&&(T.loading=S[21]),M[0]&16777216&&(T.customPopoverHeight=S[24]),!f&&M[0]&1&&(f=!0,T.open=S[0],add_flush_callback(()=>f=!1)),!m&&M[0]&2&&(m=!0,T.searchTerm=S[1],add_flush_callback(()=>m=!1)),u.$set(T)},i(S){v||(transition_in(u.$$.fragment,S),v=!0)},o(S){transition_out(u.$$.fragment,S),v=!1},d(S){destroy_component(u,S)}}}function instance$3z(p,u,f){let m,v,y,{value:w=null}=u,{id:k=void 0}=u,{placeholder:S="Choose an option"}=u,{disabled:M=!1}=u,{options:T=[]}=u,{getOptionLabel:E=(ot,Rt)=>`${ot}`}=u,{getOptionValue:H=(ot,Rt)=>ot}=u,{getOptionIcon:F=(ot,Rt)=>(ot==null?void 0:ot.icon)??void 0}=u,{getOptionColour:Z=(ot,Rt)=>(ot==null?void 0:ot.colour)??void 0}=u,{getOptionSubtitle:$=(ot,Rt)=>(ot==null?void 0:ot.subtitle)??void 0}=u,{compare:J=(ot,Rt)=>ot===Rt}=u,{useOptionIconImage:se=!1}=u,{isOptionEnabled:ie=(ot,Rt)=>ot}=u,{readonly:he=!1}=u,{quiet:fe=!1}=u,{autoWidth:pe=!1}=u,{autocomplete:ve=!1}=u,{sort:Ae=!1}=u,{align:ze=PopoverAlignment.Left}=u,{footer:Se=void 0}=u,{open:Le=!1}=u,{searchTerm:Ce=void 0}=u,{loading:Ue=void 0}=u,{onOptionMouseenter:Ze=()=>{}}=u,{onOptionMouseleave:Ge=()=>{}}=u,{customPopoverHeight:be=void 0}=u;const De=createEventDispatcher();function Ke(ot,Rt){return typeof J=="function"?J(ot,Rt):ot===Rt}const He=(ot,Rt,Xe)=>{if(!(Xe!=null&&Xe.length))return"";const Gt=Xe.findIndex((Jt,Ht)=>Ke(H(Jt,Ht),Rt));return Gt!==-1?ot(Xe[Gt],Gt):null},rt=(ot,Rt,Xe)=>ot==null||ot===""?Xe===!1?"":Xe||"Choose an option":He(E,ot,Rt)||"Choose an option",ft=ot=>{De("change",ot),f(0,Le=!1)},Mt=ot=>Ke(ot,w);function $e(ot){Le=ot,f(0,Le)}function je(ot){Ce=ot,f(1,Ce)}function Ct(ot){bubble.call(this,p,ot)}function yt(ot){bubble.call(this,p,ot)}return p.$$set=ot=>{"value"in ot&&f(2,w=ot.value),"id"in ot&&f(3,k=ot.id),"placeholder"in ot&&f(4,S=ot.placeholder),"disabled"in ot&&f(5,M=ot.disabled),"options"in ot&&f(6,T=ot.options),"getOptionLabel"in ot&&f(7,E=ot.getOptionLabel),"getOptionValue"in ot&&f(8,H=ot.getOptionValue),"getOptionIcon"in ot&&f(9,F=ot.getOptionIcon),"getOptionColour"in ot&&f(10,Z=ot.getOptionColour),"getOptionSubtitle"in ot&&f(11,$=ot.getOptionSubtitle),"compare"in ot&&f(30,J=ot.compare),"useOptionIconImage"in ot&&f(12,se=ot.useOptionIconImage),"isOptionEnabled"in ot&&f(13,ie=ot.isOptionEnabled),"readonly"in ot&&f(14,he=ot.readonly),"quiet"in ot&&f(15,fe=ot.quiet),"autoWidth"in ot&&f(16,pe=ot.autoWidth),"autocomplete"in ot&&f(17,ve=ot.autocomplete),"sort"in ot&&f(18,Ae=ot.sort),"align"in ot&&f(19,ze=ot.align),"footer"in ot&&f(20,Se=ot.footer),"open"in ot&&f(0,Le=ot.open),"searchTerm"in ot&&f(1,Ce=ot.searchTerm),"loading"in ot&&f(21,Ue=ot.loading),"onOptionMouseenter"in ot&&f(22,Ze=ot.onOptionMouseenter),"onOptionMouseleave"in ot&&f(23,Ge=ot.onOptionMouseleave),"customPopoverHeight"in ot&&f(24,be=ot.customPopoverHeight)},p.$$.update=()=>{p.$$.dirty[0]&84&&f(27,m=rt(w,T,S)),p.$$.dirty[0]&580&&f(26,v=He(F,w,T)),p.$$.dirty[0]&1092&&f(25,y=He(Z,w,T))},[Le,Ce,w,k,S,M,T,E,H,F,Z,$,se,ie,he,fe,pe,ve,Ae,ze,Se,Ue,Ze,Ge,be,y,v,m,Ke,ft,J,Mt,$e,je,Ct,yt]}class Select extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$3z,create_fragment$3B,safe_not_equal,{value:2,id:3,placeholder:4,disabled:5,options:6,getOptionLabel:7,getOptionValue:8,getOptionIcon:9,getOptionColour:10,getOptionSubtitle:11,compare:30,useOptionIconImage:12,isOptionEnabled:13,readonly:14,quiet:15,autoWidth:16,autocomplete:17,sort:18,align:19,footer:20,open:0,searchTerm:1,loading:21,onOptionMouseenter:22,onOptionMouseleave:23,customPopoverHeight:24},null,[-1,-1])}}function create_default_slot$1O(p){let u,f;return u=new Select({props:{quiet:p[15],disabled:p[2],readonly:p[3],value:p[0],options:p[7],placeholder:p[6],autoWidth:p[16],sort:p[17],align:p[21],footer:p[22],getOptionLabel:p[8],getOptionValue:p[9],getOptionIcon:p[11],getOptionColour:p[12],getOptionSubtitle:p[10],useOptionIconImage:p[13],isOptionEnabled:p[14],autocomplete:p[19],customPopoverHeight:p[20],compare:p[24],onOptionMouseenter:p[25],onOptionMouseleave:p[26]}}),u.$on("change",p[27]),u.$on("click",p[28]),{c(){create_component(u.$$.fragment)},m(m,v){mount_component(u,m,v),f=!0},p(m,v){const y={};v[0]&32768&&(y.quiet=m[15]),v[0]&4&&(y.disabled=m[2]),v[0]&8&&(y.readonly=m[3]),v[0]&1&&(y.value=m[0]),v[0]&128&&(y.options=m[7]),v[0]&64&&(y.placeholder=m[6]),v[0]&65536&&(y.autoWidth=m[16]),v[0]&131072&&(y.sort=m[17]),v[0]&2097152&&(y.align=m[21]),v[0]&4194304&&(y.footer=m[22]),v[0]&256&&(y.getOptionLabel=m[8]),v[0]&512&&(y.getOptionValue=m[9]),v[0]&2048&&(y.getOptionIcon=m[11]),v[0]&4096&&(y.getOptionColour=m[12]),v[0]&1024&&(y.getOptionSubtitle=m[10]),v[0]&8192&&(y.useOptionIconImage=m[13]),v[0]&16384&&(y.isOptionEnabled=m[14]),v[0]&524288&&(y.autocomplete=m[19]),v[0]&1048576&&(y.customPopoverHeight=m[20]),v[0]&16777216&&(y.compare=m[24]),v[0]&33554432&&(y.onOptionMouseenter=m[25]),v[0]&67108864&&(y.onOptionMouseleave=m[26]),u.$set(y)},i(m){f||(transition_in(u.$$.fragment,m),f=!0)},o(m){transition_out(u.$$.fragment,m),f=!1},d(m){destroy_component(u,m)}}}function create_fragment$3A(p){let u,f;return u=new Field$1({props:{helpText:p[23],label:p[1],labelPosition:p[4],error:p[5],tooltip:p[18],$$slots:{default:[create_default_slot$1O]},$$scope:{ctx:p}}}),{c(){create_component(u.$$.fragment)},m(m,v){mount_component(u,m,v),f=!0},p(m,v){const y={};v[0]&8388608&&(y.helpText=m[23]),v[0]&2&&(y.label=m[1]),v[0]&16&&(y.labelPosition=m[4]),v[0]&32&&(y.error=m[5]),v[0]&262144&&(y.tooltip=m[18]),v[0]&125566925|v[1]&1&&(y.$$scope={dirty:v,ctx:m}),u.$set(y)},i(m){f||(transition_in(u.$$.fragment,m),f=!0)},o(m){transition_out(u.$$.fragment,m),f=!1},d(m){destroy_component(u,m)}}}function instance$3y(p,u,f){let{value:m=void 0}=u,{label:v=void 0}=u,{disabled:y=!1}=u,{readonly:w=!1}=u,{labelPosition:k="above"}=u,{error:S=void 0}=u,{placeholder:M="Choose an option"}=u,{options:T=[]}=u,{getOptionLabel:E=(He,rt)=>De(He,"label")}=u,{getOptionValue:H=(He,rt)=>De(He,"value")}=u,{getOptionSubtitle:F=(He,rt)=>He==null?void 0:He.subtitle}=u,{getOptionIcon:Z=(He,rt)=>He==null?void 0:He.icon}=u,{getOptionColour:$=(He,rt)=>He==null?void 0:He.colour}=u,{useOptionIconImage:J=!1}=u,{isOptionEnabled:se=void 0}=u,{quiet:ie=!1}=u,{autoWidth:he=!1}=u,{sort:fe=!1}=u,{tooltip:pe=void 0}=u,{autocomplete:ve=!1}=u,{customPopoverHeight:Ae=void 0}=u,{align:ze=PopoverAlignment.Left}=u,{footer:Se=void 0}=u,{helpText:Le=void 0}=u,{compare:Ce=void 0}=u,{onOptionMouseenter:Ue=()=>{}}=u,{onOptionMouseleave:Ze=()=>{}}=u;const Ge=createEventDispatcher(),be=He=>{f(0,m=He.detail),Ge("change",He.detail)},De=(He,rt)=>He&&typeof He=="object"?He[rt]:He;function Ke(He){bubble.call(this,p,He)}return p.$$set=He=>{"value"in He&&f(0,m=He.value),"label"in He&&f(1,v=He.label),"disabled"in He&&f(2,y=He.disabled),"readonly"in He&&f(3,w=He.readonly),"labelPosition"in He&&f(4,k=He.labelPosition),"error"in He&&f(5,S=He.error),"placeholder"in He&&f(6,M=He.placeholder),"options"in He&&f(7,T=He.options),"getOptionLabel"in He&&f(8,E=He.getOptionLabel),"getOptionValue"in He&&f(9,H=He.getOptionValue),"getOptionSubtitle"in He&&f(10,F=He.getOptionSubtitle),"getOptionIcon"in He&&f(11,Z=He.getOptionIcon),"getOptionColour"in He&&f(12,$=He.getOptionColour),"useOptionIconImage"in He&&f(13,J=He.useOptionIconImage),"isOptionEnabled"in He&&f(14,se=He.isOptionEnabled),"quiet"in He&&f(15,ie=He.quiet),"autoWidth"in He&&f(16,he=He.autoWidth),"sort"in He&&f(17,fe=He.sort),"tooltip"in He&&f(18,pe=He.tooltip),"autocomplete"in He&&f(19,ve=He.autocomplete),"customPopoverHeight"in He&&f(20,Ae=He.customPopoverHeight),"align"in He&&f(21,ze=He.align),"footer"in He&&f(22,Se=He.footer),"helpText"in He&&f(23,Le=He.helpText),"compare"in He&&f(24,Ce=He.compare),"onOptionMouseenter"in He&&f(25,Ue=He.onOptionMouseenter),"onOptionMouseleave"in He&&f(26,Ze=He.onOptionMouseleave)},[m,v,y,w,k,S,M,T,E,H,F,Z,$,J,se,ie,he,fe,pe,ve,Ae,ze,Se,Le,Ce,Ue,Ze,be,Ke]}class Select_1 extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$3y,create_fragment$3A,safe_not_equal,{value:0,label:1,disabled:2,readonly:3,labelPosition:4,error:5,placeholder:6,options:7,getOptionLabel:8,getOptionValue:9,getOptionSubtitle:10,getOptionIcon:11,getOptionColour:12,useOptionIconImage:13,isOptionEnabled:14,quiet:15,autoWidth:16,sort:17,tooltip:18,autocomplete:19,customPopoverHeight:20,align:21,footer:22,helpText:23,compare:24,onOptionMouseenter:25,onOptionMouseleave:26},null,[-1,-1])}}const indexVars$u="",Combobox_svelte_svelte_type_style_lang="";function get_each_context$I(p,u,f){const m=p.slice();return m[22]=u[f],m}function create_if_block$25(p){let u,f=ensure_array_like(p[5]),m=[];for(let v=0;v<f.length;v+=1)m[v]=create_each_block$I(get_each_context$I(p,f,v));return{c(){for(let v=0;v<m.length;v+=1)m[v].c();u=empty$1()},m(v,y){for(let w=0;w<m.length;w+=1)m[w]&&m[w].m(v,y);insert(v,u,y)},p(v,y){if(y&8417){f=ensure_array_like(v[5]);let w;for(w=0;w<f.length;w+=1){const k=get_each_context$I(v,f,w);m[w]?m[w].p(k,y):(m[w]=create_each_block$I(k),m[w].c(),m[w].m(u.parentNode,u))}for(;w<m.length;w+=1)m[w].d(1);m.length=f.length}},d(v){v&&detach(u),destroy_each(m,v)}}}function create_each_block$I(p){let u,f,m=p[6](p[22])+"",v,y,w,k,S,M,T;function E(){return p[18](p[22])}return{c(){u=element("li"),f=element("span"),v=text$1(m),y=space(),w=svg_element("svg"),k=svg_element("use"),S=space(),attr(f,"class","spectrum-Menu-itemLabel svelte-otlbol"),xlink_attr(k,"xlink:href","#spectrum-css-icon-Checkmark100"),attr(w,"class","spectrum-Icon spectrum-UIIcon-Checkmark100 spectrum-Menu-checkmark spectrum-Menu-itemIcon"),attr(w,"focusable","false"),attr(w,"aria-hidden","true"),attr(u,"class","spectrum-Menu-item"),attr(u,"role","option"),attr(u,"aria-selected","true"),attr(u,"tabindex","0"),toggle_class(u,"is-selected",p[7](p[22])===p[0])},m(H,F){insert(H,u,F),append$2(u,f),append$2(f,v),append$2(u,y),append$2(u,w),append$2(w,k),append$2(u,S),M||(T=listen(u,"click",E),M=!0)},p(H,F){p=H,F&96&&m!==(m=p[6](p[22])+"")&&set_data(v,m),F&161&&toggle_class(u,"is-selected",p[7](p[22])===p[0])},d(H){H&&detach(u),M=!1,T()}}}function create_default_slot$1N(p){let u,f,m=p[5]&&Array.isArray(p[5]),v,y,w,k=m&&create_if_block$25(p);return{c(){u=element("div"),f=element("ul"),k&&k.c(),attr(f,"class","spectrum-Menu"),attr(f,"role","listbox"),attr(u,"class","popover-content svelte-otlbol")},m(S,M){insert(S,u,M),append$2(u,f),k&&k.m(f,null),y||(w=action_destroyer(v=clickOutside.call(null,u,p[19])),y=!0)},p(S,M){M&32&&(m=S[5]&&Array.isArray(S[5])),m?k?k.p(S,M):(k=create_if_block$25(S),k.c(),k.m(f,null)):k&&(k.d(1),k=null),v&&is_function(v.update)&&M&256&&v.update.call(null,S[19])},d(S){S&&detach(u),k&&k.d(),y=!1,w()}}}function create_fragment$3z(p){let u,f,m,v,y,w,k,S,M,T,E,H,F,Z;return E=new Popover({props:{anchor:p[10],open:p[8],align:PopoverAlignment.Left,useAnchorWidth:!0,$$slots:{default:[create_default_slot$1N]},$$scope:{ctx:p}}}),E.$on("close",p[20]),{c(){u=element("div"),f=element("div"),m=element("input"),w=space(),k=element("button"),S=svg_element("svg"),M=svg_element("use"),T=space(),create_component(E.$$.fragment),attr(m,"id",p[1]),attr(m,"type","text"),m.value=v=p[0]||"",attr(m,"placeholder",y=p[2]||""),m.disabled=p[3],m.readOnly=p[4],attr(m,"class","spectrum-Textfield-input spectrum-InputGroup-input svelte-otlbol"),attr(f,"class","spectrum-Textfield spectrum-InputGroup-textfield svelte-otlbol"),toggle_class(f,"is-disabled",p[3]),toggle_class(f,"is-focused",p[8]||p[9]),xlink_attr(M,"xlink:href","#spectrum-css-icon-Chevron100"),attr(S,"class","spectrum-Icon spectrum-UIIcon-ChevronDown100 spectrum-Picker-menuIcon spectrum-InputGroup-icon"),attr(S,"focusable","false"),attr(S,"aria-hidden","true"),attr(k,"class","spectrum-Picker spectrum-Picker--sizeM spectrum-InputGroup-button"),attr(k,"tabindex","-1"),attr(k,"aria-haspopup","true"),k.disabled=p[3],attr(u,"class","spectrum-InputGroup svelte-otlbol"),toggle_class(u,"is-focused",p[8]||p[9]),toggle_class(u,"is-disabled",p[3])},m($,J){insert($,u,J),append$2(u,f),append$2(f,m),append$2(u,w),append$2(u,k),append$2(k,S),append$2(S,M),p[17](u),insert($,T,J),mount_component(E,$,J),H=!0,F||(Z=[listen(m,"focus",p[14]),listen(m,"blur",p[15]),listen(m,"change",p[12]),listen(k,"click",p[16])],F=!0)},p($,[J]){(!H||J&2)&&attr(m,"id",$[1]),(!H||J&1&&v!==(v=$[0]||"")&&m.value!==v)&&(m.value=v),(!H||J&4&&y!==(y=$[2]||""))&&attr(m,"placeholder",y),(!H||J&8)&&(m.disabled=$[3]),(!H||J&16)&&(m.readOnly=$[4]),(!H||J&8)&&toggle_class(f,"is-disabled",$[3]),(!H||J&768)&&toggle_class(f,"is-focused",$[8]||$[9]),(!H||J&8)&&(k.disabled=$[3]),(!H||J&768)&&toggle_class(u,"is-focused",$[8]||$[9]),(!H||J&8)&&toggle_class(u,"is-disabled",$[3]);const se={};J&1024&&(se.anchor=$[10]),J&256&&(se.open=$[8]),J&33554913&&(se.$$scope={dirty:J,ctx:$}),E.$set(se)},i($){H||(transition_in(E.$$.fragment,$),H=!0)},o($){transition_out(E.$$.fragment,$),H=!1},d($){$&&(detach(u),detach(T)),p[17](null),destroy_component(E,$),F=!1,run_all(Z)}}}function instance$3x(p,u,f){let{value:m=void 0}=u,{id:v=void 0}=u,{placeholder:y="Choose an option or type"}=u,{disabled:w=!1}=u,{readonly:k=!1}=u,{options:S=[]}=u,{getOptionLabel:M=Se=>`${Se}`}=u,{getOptionValue:T=Se=>`${Se}`}=u;const E=createEventDispatcher();let H=!1,F=!1,Z;const $=Se=>{E("change",Se),f(8,H=!1)},J=Se=>{const Le=Se.currentTarget.value;E("type",Le),$(Le)},se=Se=>{E("pick",Se),$(Se)},ie=()=>f(9,F=!0),he=()=>{f(9,F=!1),E("blur")},fe=()=>f(8,H=!H);function pe(Se){binding_callbacks[Se?"unshift":"push"](()=>{Z=Se,f(10,Z)})}const ve=Se=>se(T(Se)),Ae=()=>{f(8,H=!1)},ze=()=>f(8,H=!1);return p.$$set=Se=>{"value"in Se&&f(0,m=Se.value),"id"in Se&&f(1,v=Se.id),"placeholder"in Se&&f(2,y=Se.placeholder),"disabled"in Se&&f(3,w=Se.disabled),"readonly"in Se&&f(4,k=Se.readonly),"options"in Se&&f(5,S=Se.options),"getOptionLabel"in Se&&f(6,M=Se.getOptionLabel),"getOptionValue"in Se&&f(7,T=Se.getOptionValue)},[m,v,y,w,k,S,M,T,H,F,Z,E,J,se,ie,he,fe,pe,ve,Ae,ze]}class Combobox extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$3x,create_fragment$3z,safe_not_equal,{value:0,id:1,placeholder:2,disabled:3,readonly:4,options:5,getOptionLabel:6,getOptionValue:7})}}function create_default_slot$1M(p){let u,f;return u=new Combobox({props:{error:p[5],disabled:p[2],value:p[0],options:p[7],placeholder:p[6],readonly:p[3],getOptionLabel:p[9],getOptionValue:p[10]}}),u.$on("change",p[11]),u.$on("pick",p[12]),u.$on("type",p[13]),u.$on("blur",p[14]),{c(){create_component(u.$$.fragment)},m(m,v){mount_component(u,m,v),f=!0},p(m,v){const y={};v&32&&(y.error=m[5]),v&4&&(y.disabled=m[2]),v&1&&(y.value=m[0]),v&128&&(y.options=m[7]),v&64&&(y.placeholder=m[6]),v&8&&(y.readonly=m[3]),v&512&&(y.getOptionLabel=m[9]),v&1024&&(y.getOptionValue=m[10]),u.$set(y)},i(m){f||(transition_in(u.$$.fragment,m),f=!0)},o(m){transition_out(u.$$.fragment,m),f=!1},d(m){destroy_component(u,m)}}}function create_fragment$3y(p){let u,f;return u=new Field$1({props:{helpText:p[8],label:p[1],labelPosition:p[4],error:p[5],$$slots:{default:[create_default_slot$1M]},$$scope:{ctx:p}}}),{c(){create_component(u.$$.fragment)},m(m,v){mount_component(u,m,v),f=!0},p(m,[v]){const y={};v&256&&(y.helpText=m[8]),v&2&&(y.label=m[1]),v&16&&(y.labelPosition=m[4]),v&32&&(y.error=m[5]),v&132845&&(y.$$scope={dirty:v,ctx:m}),u.$set(y)},i(m){f||(transition_in(u.$$.fragment,m),f=!0)},o(m){transition_out(u.$$.fragment,m),f=!1},d(m){destroy_component(u,m)}}}function instance$3w(p,u,f){let{value:m=null}=u,{label:v=void 0}=u,{disabled:y=!1}=u,{readonly:w=!1}=u,{labelPosition:k="above"}=u,{error:S=null}=u,{placeholder:M="Choose an option or type"}=u,{options:T=[]}=u,{helpText:E=null}=u,{getOptionLabel:H=fe=>J(fe,"label")}=u,{getOptionValue:F=fe=>J(fe,"value")}=u;const Z=createEventDispatcher(),$=fe=>{f(0,m=fe.detail),Z("change",fe.detail)},J=(fe,pe)=>fe&&typeof fe=="object"?fe[pe]:fe;function se(fe){bubble.call(this,p,fe)}function ie(fe){bubble.call(this,p,fe)}function he(fe){bubble.call(this,p,fe)}return p.$$set=fe=>{"value"in fe&&f(0,m=fe.value),"label"in fe&&f(1,v=fe.label),"disabled"in fe&&f(2,y=fe.disabled),"readonly"in fe&&f(3,w=fe.readonly),"labelPosition"in fe&&f(4,k=fe.labelPosition),"error"in fe&&f(5,S=fe.error),"placeholder"in fe&&f(6,M=fe.placeholder),"options"in fe&&f(7,T=fe.options),"helpText"in fe&&f(8,E=fe.helpText),"getOptionLabel"in fe&&f(9,H=fe.getOptionLabel),"getOptionValue"in fe&&f(10,F=fe.getOptionValue)},[m,v,y,w,k,S,M,T,E,H,F,$,se,ie,he]}class Combobox_1 extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$3w,create_fragment$3y,safe_not_equal,{value:0,label:1,disabled:2,readonly:3,labelPosition:4,error:5,placeholder:6,options:7,helpText:8,getOptionLabel:9,getOptionValue:10})}}const indexVars$t="",indexVars$s="",indexVars$r="";var AIOperationEnum=(p=>(p.SUMMARISE_TEXT="SUMMARISE_TEXT",p.CLEAN_DATA="CLEAN_DATA",p.TRANSLATE="TRANSLATE",p.CATEGORISE_TEXT="CATEGORISE_TEXT",p.SENTIMENT_ANALYSIS="SENTIMENT_ANALYSIS",p.PROMPT="PROMPT",p.SEARCH_WEB="SEARCH_WEB",p))(AIOperationEnum||{}),OperationFieldTypeEnum=(p=>(p.MULTI_COLUMN="columns",p.COLUMN="column",p.BINDABLE_TEXT="prompt",p))(OperationFieldTypeEnum||{}),Event$1=(p=>(p.USER_CREATED="user:created",p.USER_UPDATED="user:updated",p.USER_DELETED="user:deleted",p.USER_ONBOARDING_COMPLETE="user:onboarding:complete",p.USER_PERMISSION_ADMIN_ASSIGNED="user:admin:assigned",p.USER_PERMISSION_ADMIN_REMOVED="user:admin:removed",p.USER_PERMISSION_BUILDER_ASSIGNED="user:builder:assigned",p.USER_PERMISSION_BUILDER_REMOVED="user:builder:removed",p.USER_INVITED="user:invited",p.USER_INVITED_ACCEPTED="user:invite:accepted",p.USER_PASSWORD_FORCE_RESET="user:password:force:reset",p.USER_PASSWORD_UPDATED="user:password:updated",p.USER_PASSWORD_RESET_REQUESTED="user:password:reset:requested",p.USER_PASSWORD_RESET="user:password:reset",p.USER_DATA_COLLABORATION="user:data:collaboration",p.EMAIL_SMTP_CREATED="email:smtp:created",p.EMAIL_SMTP_UPDATED="email:smtp:updated",p.AI_CONFIG_CREATED="ai:config:created",p.AI_CONFIG_UPDATED="ai:config:updated",p.AUTH_SSO_CREATED="auth:sso:created",p.AUTH_SSO_UPDATED="auth:sso:updated",p.AUTH_SSO_ACTIVATED="auth:sso:activated",p.AUTH_SSO_DEACTIVATED="auth:sso:deactivated",p.AUTH_LOGIN="auth:login",p.AUTH_LOGOUT="auth:logout",p.ORG_NAME_UPDATED="org:info:name:updated",p.ORG_LOGO_UPDATED="org:info:logo:updated",p.ORG_PLATFORM_URL_UPDATED="org:platformurl:updated",p.INSTALLATION_VERSION_CHECKED="installation:version:checked",p.INSTALLATION_VERSION_UPGRADED="installation:version:upgraded",p.INSTALLATION_VERSION_DOWNGRADED="installation:version:downgraded",p.INSTALLATION_FIRST_STARTUP="installation:firstStartup",p.ANALYTICS_OPT_OUT="analytics:opt:out",p.ANALYTICS_OPT_IN="analytics:opt:in",p.APP_CREATED="app:created",p.APP_UPDATED="app:updated",p.APP_DELETED="app:deleted",p.APP_DUPLICATED="app:duplicated",p.APP_PUBLISHED="app:published",p.APP_UNPUBLISHED="app:unpublished",p.APP_TEMPLATE_IMPORTED="app:template:imported",p.APP_FILE_IMPORTED="app:file:imported",p.APP_VERSION_UPDATED="app:version:updated",p.APP_VERSION_REVERTED="app:version:reverted",p.APP_REVERTED="app:reverted",p.APP_EXPORTED="app:exported",p.ROLE_CREATED="role:created",p.ROLE_UPDATED="role:updated",p.ROLE_DELETED="role:deleted",p.ROLE_ASSIGNED="role:assigned",p.ROLE_UNASSIGNED="role:unassigned",p.SERVED_BUILDER="served:builder",p.SERVED_APP="served:app",p.SERVED_APP_PREVIEW="served:app:preview",p.DATASOURCE_CREATED="datasource:created",p.DATASOURCE_UPDATED="datasource:updated",p.DATASOURCE_DELETED="datasource:deleted",p.QUERY_CREATED="query:created",p.QUERY_UPDATED="query:updated",p.QUERY_DELETED="query:deleted",p.QUERY_IMPORT="query:import",p.QUERIES_RUN="queries:run",p.QUERY_PREVIEWED="query:previewed",p.TABLE_CREATED="table:created",p.TABLE_UPDATED="table:updated",p.TABLE_DELETED="table:deleted",p.TABLE_EXPORTED="table:exported",p.TABLE_IMPORTED="table:imported",p.TABLE_DATA_IMPORTED="table:data:imported",p.VIEW_CREATED="view:created",p.VIEW_UPDATED="view:updated",p.VIEW_DELETED="view:deleted",p.VIEW_EXPORTED="view:exported",p.VIEW_FILTER_CREATED="view:filter:created",p.VIEW_FILTER_UPDATED="view:filter:updated",p.VIEW_FILTER_DELETED="view:filter:deleted",p.VIEW_CALCULATION_CREATED="view:calculation:created",p.VIEW_CALCULATION_UPDATED="view:calculation:updated",p.VIEW_CALCULATION_DELETED="view:calculation:deleted",p.VIEW_JOIN_CREATED="view:join:created",p.ROWS_CREATED="rows:created",p.ROWS_IMPORTED="rows:imported",p.COMPONENT_CREATED="component:created",p.COMPONENT_DELETED="component:deleted",p.SCREEN_CREATED="screen:created",p.SCREEN_DELETED="screen:deleted",p.LAYOUT_CREATED="layout:created",p.LAYOUT_DELETED="layout:deleted",p.AUTOMATION_CREATED="automation:created",p.AUTOMATION_DELETED="automation:deleted",p.AUTOMATION_TESTED="automation:tested",p.AUTOMATIONS_RUN="automations:run",p.AUTOMATION_STEP_CREATED="automation:step:created",p.AUTOMATION_STEP_DELETED="automation:step:deleted",p.AUTOMATION_TRIGGER_UPDATED="automation:trigger:updated",p.LICENSE_PLAN_CHANGED="license:plan:changed",p.LICENSE_ACTIVATED="license:activated",p.LICENSE_PAYMENT_FAILED="license:payment:failed",p.LICENSE_PAYMENT_RECOVERED="license:payment:recovered",p.LICENSE_CHECKOUT_OPENED="license:checkout:opened",p.LICENSE_CHECKOUT_SUCCESS="license:checkout:success",p.LICENSE_PORTAL_OPENED="license:portal:opened",p.ACCOUNT_CREATED="account:created",p.ACCOUNT_DELETED="account:deleted",p.ACCOUNT_VERIFIED="account:verified",p.APP_BACKFILL_SUCCEEDED="app:backfill:succeeded",p.APP_BACKFILL_FAILED="app:backfill:failed",p.TENANT_BACKFILL_SUCCEEDED="tenant:backfill:succeeded",p.TENANT_BACKFILL_FAILED="tenant:backfill:failed",p.INSTALLATION_BACKFILL_SUCCEEDED="installation:backfill:succeeded",p.INSTALLATION_BACKFILL_FAILED="installation:backfill:failed",p.USER_GROUP_CREATED="user_group:created",p.USER_GROUP_UPDATED="user_group:updated",p.USER_GROUP_DELETED="user_group:deleted",p.USER_GROUP_USERS_ADDED="user_group:user_added",p.USER_GROUP_USERS_REMOVED="user_group:users_deleted",p.USER_GROUP_PERMISSIONS_EDITED="user_group:permissions_edited",p.USER_GROUP_ONBOARDING="user_group:onboarding_added",p.PLUGIN_INIT="plugin:init",p.PLUGIN_IMPORTED="plugin:imported",p.PLUGIN_DELETED="plugin:deleted",p.APP_BACKUP_RESTORED="app:backup:restored",p.APP_BACKUP_TRIGGERED="app:backup:triggered",p.ENVIRONMENT_VARIABLE_CREATED="environment_variable:created",p.ENVIRONMENT_VARIABLE_DELETED="environment_variable:deleted",p.ENVIRONMENT_VARIABLE_UPGRADE_PANEL_OPENED="environment_variable:upgrade_panel_opened",p.AUDIT_LOGS_FILTERED="audit_log:filtered",p.AUDIT_LOGS_DOWNLOADED="audit_log:downloaded",p.ROW_ACTION_CREATED="row_action:created",p))(Event$1||{}),StaticQuotaName=(p=>(p.ROWS="rows",p.APPS="apps",p.USERS="users",p.CREATORS="creators",p.USER_GROUPS="userGroups",p.PLUGINS="plugins",p.AI_CUSTOM_CONFIGS="aiCustomConfigs",p))(StaticQuotaName||{}),MonthlyQuotaName=(p=>(p.QUERIES="queries",p.AUTOMATIONS="automations",p.BUDIBASE_AI_CREDITS="budibaseAICredits",p))(MonthlyQuotaName||{}),Feature=(p=>(p.USER_GROUPS="userGroups",p.APP_BACKUPS="appBackups",p.ENVIRONMENT_VARIABLES="environmentVariables",p.AUDIT_LOGS="auditLogs",p.ENFORCEABLE_SSO="enforceableSSO",p.BRANDING="branding",p.SCIM="scim",p.SYNC_AUTOMATIONS="syncAutomations",p.TRIGGER_AUTOMATION_RUN="triggerAutomationRun",p.APP_BUILDERS="appBuilders",p.OFFLINE="offline",p.EXPANDED_PUBLIC_API="expandedPublicApi",p.VIEW_PERMISSIONS="viewPermissions",p.VIEW_READONLY_COLUMNS="viewReadonlyColumns",p.BUDIBASE_AI="budibaseAI",p.AI_CUSTOM_CONFIGS="aiCustomConfigs",p))(Feature||{}),BasicOperator=(p=>(p.EQUAL="equal",p.NOT_EQUAL="notEqual",p.EMPTY="empty",p.NOT_EMPTY="notEmpty",p.FUZZY="fuzzy",p.STRING="string",p))(BasicOperator||{}),ArrayOperator=(p=>(p.CONTAINS="contains",p.NOT_CONTAINS="notContains",p.CONTAINS_ANY="containsAny",p.ONE_OF="oneOf",p))(ArrayOperator||{}),RangeOperator=(p=>(p.RANGE="range",p))(RangeOperator||{}),LogicalOperator=(p=>(p.AND="$and",p.OR="$or",p))(LogicalOperator||{});function isLogicalSearchOperator(p){return Object.values(LogicalOperator).includes(p)}function isBasicSearchOperator(p){return Object.values(BasicOperator).includes(p)}function isArraySearchOperator(p){return Object.values(ArrayOperator).includes(p)}function isRangeSearchOperator(p){return Object.values(RangeOperator).includes(p)}var InternalSearchFilterOperator=(p=>(p.COMPLEX_ID_OPERATOR="_complexIdOperator",p))(InternalSearchFilterOperator||{}),EmptyFilterOption=(p=>(p.RETURN_ALL="all",p.RETURN_NONE="none",p))(EmptyFilterOption||{}),UILogicalOperator=(p=>(p.ALL="all",p.ANY="any",p))(UILogicalOperator||{});Event$1.PLUGIN_INIT;var AutomationIOType=(p=>(p.OBJECT="object",p.STRING="string",p.BOOLEAN="boolean",p.NUMBER="number",p.ARRAY="array",p.JSON="json",p.DATE="date",p.ATTACHMENT="attachment",p))(AutomationIOType||{}),AutomationCustomIOType=(p=>(p.TABLE="table",p.ROW="row",p.ROWS="rows",p.WIDE="wide",p.QUERY="query",p.QUERY_PARAMS="queryParams",p.QUERY_LIMIT="queryLimit",p.LOOP_OPTION="loopOption",p.ITEM="item",p.CODE="code",p.FILTERS="filters",p.COLUMN="column",p.TRIGGER_SCHEMA="triggerSchema",p.CRON="cron",p.WEBHOOK_URL="webhookUrl",p.AUTOMATION="automation",p.AUTOMATION_FIELDS="automationFields",p.MULTI_ATTACHMENTS="multi_attachments",p.TRIGGER_FILTER="trigger_filter",p))(AutomationCustomIOType||{}),AutomationTriggerStepId=(p=>(p.ROW_SAVED="ROW_SAVED",p.ROW_UPDATED="ROW_UPDATED",p.ROW_DELETED="ROW_DELETED",p.WEBHOOK="WEBHOOK",p.APP="APP",p.CRON="CRON",p.ROW_ACTION="ROW_ACTION",p))(AutomationTriggerStepId||{}),AutomationStepType=(p=>(p.LOGIC="LOGIC",p.ACTION="ACTION",p.TRIGGER="TRIGGER",p))(AutomationStepType||{}),AutomationActionStepId=(p=>(p.SEND_EMAIL_SMTP="SEND_EMAIL_SMTP",p.CREATE_ROW="CREATE_ROW",p.UPDATE_ROW="UPDATE_ROW",p.DELETE_ROW="DELETE_ROW",p.EXECUTE_BASH="EXECUTE_BASH",p.OUTGOING_WEBHOOK="OUTGOING_WEBHOOK",p.EXECUTE_SCRIPT="EXECUTE_SCRIPT",p.EXECUTE_QUERY="EXECUTE_QUERY",p.SERVER_LOG="SERVER_LOG",p.DELAY="DELAY",p.FILTER="FILTER",p.QUERY_ROWS="QUERY_ROWS",p.LOOP="LOOP",p.COLLECT="COLLECT",p.OPENAI="OPENAI",p.TRIGGER_AUTOMATION_RUN="TRIGGER_AUTOMATION_RUN",p.BRANCH="BRANCH",p.discord="discord",p.slack="slack",p.zapier="zapier",p.integromat="integromat",p.n8n="n8n",p))(AutomationActionStepId||{});[...Object.values(AutomationActionStepId),...Object.values(AutomationTriggerStepId)];var AutomationFeature=(p=>(p.LOOPING="LOOPING",p))(AutomationFeature||{}),AutomationEventType=(p=>(p.ROW_SAVE="row:save",p.ROW_UPDATE="row:update",p.ROW_DELETE="row:delete",p.APP_TRIGGER="app:trigger",p.CRON_TRIGGER="cron:trigger",p.WEBHOOK_TRIGGER="web:trigger",p.ROW_ACTION="row:action",p))(AutomationEventType||{}),HttpMethod=(p=>(p.GET="GET",p.POST="POST",p.PATCH="PATCH",p.PUT="PUT",p.HEAD="HEAD",p.DELETE="DELETE",p))(HttpMethod||{}),FieldType=(p=>(p.STRING="string",p.LONGFORM="longform",p.OPTIONS="options",p.NUMBER="number",p.BOOLEAN="boolean",p.ARRAY="array",p.DATETIME="datetime",p.ATTACHMENTS="attachment",p.ATTACHMENT_SINGLE="attachment_single",p.LINK="link",p.FORMULA="formula",p.AUTO="auto",p.AI="ai",p.JSON="json",p.INTERNAL="internal",p.BARCODEQR="barcodeqr",p.SIGNATURE_SINGLE="signature_single",p.BIGINT="bigint",p.BB_REFERENCE="bb_reference",p.BB_REFERENCE_SINGLE="bb_reference_single",p))(FieldType||{}),RelationshipType=(p=>(p.ONE_TO_MANY="one-to-many",p.MANY_TO_ONE="many-to-one",p.MANY_TO_MANY="many-to-many",p))(RelationshipType||{}),FormulaType=(p=>(p.STATIC="static",p.DYNAMIC="dynamic",p.AI="ai",p))(FormulaType||{}),BBReferenceFieldSubType=(p=>(p.USER="user",p.USERS="users",p))(BBReferenceFieldSubType||{});function isRelationshipField(p){return p.type===FieldType.LINK}var ViewV2Type=(p=>(p.CALCULATION="calculation",p))(ViewV2Type||{});const SEPARATOR$1="_",prefixed=p=>`${p}${SEPARATOR$1}`;var DocumentType=(p=>(p.USER="us",p.GROUP="gr",p.WORKSPACE="workspace",p.CONFIG="config",p.TEMPLATE="template",p.APP="app",p.DEV="dev",p.APP_DEV="app_dev",p.APP_METADATA="app_metadata",p.ROLE="role",p.MIGRATIONS="migrations",p.DEV_INFO="devinfo",p.AUTOMATION_LOG="log_au",p.ACCOUNT_METADATA="acc_metadata",p.PLUGIN="plg",p.DATASOURCE="datasource",p.DATASOURCE_PLUS="datasource_plus",p.APP_BACKUP="backup",p.TABLE="ta",p.ROW="ro",p.AUTOMATION="au",p.LINK="li",p.WEBHOOK="wh",p.INSTANCE="inst",p.LAYOUT="layout",p.SCREEN="screen",p.QUERY="query",p.DEPLOYMENTS="deployments",p.METADATA="metadata",p.MEM_VIEW="view",p.USER_FLAG="flag",p.AUTOMATION_METADATA="meta_au",p.AUDIT_LOG="al",p.APP_MIGRATION_METADATA="_design/migrations",p.SCIM_LOG="scimlog",p.ROW_ACTIONS="ra",p))(DocumentType||{});Object.values(DocumentType).sort((p,u)=>u.length-p.length);var InternalTable=(p=>(p.USER_METADATA="ta_users",p))(InternalTable||{}),VirtualDocumentType=(p=>(p.VIEW="view",p.ROW_ACTION="row_action",p))(VirtualDocumentType||{});Object.values(VirtualDocumentType).sort((p,u)=>u.length-p.length);var Theme=(p=>(p.LIGHTEST="lightest",p.LIGHT="light",p.DARK="dark",p.DARKEST="darkest",p.NORD="nord",p.MIDNIGHT="midnight",p))(Theme||{}),PluginType=(p=>(p.DATASOURCE="datasource",p.COMPONENT="component",p.AUTOMATION="automation",p))(PluginType||{});Object.values(PluginType),StaticQuotaName.ROWS,MonthlyQuotaName.QUERIES,MonthlyQuotaName.AUTOMATIONS,MonthlyQuotaName.QUERIES,MonthlyQuotaName.AUTOMATIONS;var PingSource=(p=>(p.BUILDER="builder",p.APP="app",p))(PingSource||{}),SortOrder=(p=>(p.ASCENDING="ascending",p.DESCENDING="descending",p))(SortOrder||{}),SortType=(p=>(p.STRING="string",p.NUMBER="number",p))(SortType||{}),util$2;(function(p){p.assertEqual=v=>v;function u(v){}p.assertIs=u;function f(v){throw new Error}p.assertNever=f,p.arrayToEnum=v=>{const y={};for(const w of v)y[w]=w;return y},p.getValidEnumValues=v=>{const y=p.objectKeys(v).filter(k=>typeof v[v[k]]!="number"),w={};for(const k of y)w[k]=v[k];return p.objectValues(w)},p.objectValues=v=>p.objectKeys(v).map(function(y){return v[y]}),p.objectKeys=typeof Object.keys=="function"?v=>Object.keys(v):v=>{const y=[];for(const w in v)Object.prototype.hasOwnProperty.call(v,w)&&y.push(w);return y},p.find=(v,y)=>{for(const w of v)if(y(w))return w},p.isInteger=typeof Number.isInteger=="function"?v=>Number.isInteger(v):v=>typeof v=="number"&&isFinite(v)&&Math.floor(v)===v;function m(v,y=" | "){return v.map(w=>typeof w=="string"?`'${w}'`:w).join(y)}p.joinValues=m,p.jsonStringifyReplacer=(v,y)=>typeof y=="bigint"?y.toString():y})(util$2||(util$2={}));var objectUtil;(function(p){p.mergeShapes=(u,f)=>({...u,...f})})(objectUtil||(objectUtil={}));const ZodParsedType=util$2.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),getParsedType=p=>{switch(typeof p){case"undefined":return ZodParsedType.undefined;case"string":return ZodParsedType.string;case"number":return isNaN(p)?ZodParsedType.nan:ZodParsedType.number;case"boolean":return ZodParsedType.boolean;case"function":return ZodParsedType.function;case"bigint":return ZodParsedType.bigint;case"symbol":return ZodParsedType.symbol;case"object":return Array.isArray(p)?ZodParsedType.array:p===null?ZodParsedType.null:p.then&&typeof p.then=="function"&&p.catch&&typeof p.catch=="function"?ZodParsedType.promise:typeof Map<"u"&&p instanceof Map?ZodParsedType.map:typeof Set<"u"&&p instanceof Set?ZodParsedType.set:typeof Date<"u"&&p instanceof Date?ZodParsedType.date:ZodParsedType.object;default:return ZodParsedType.unknown}},ZodIssueCode=util$2.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),quotelessJson=p=>JSON.stringify(p,null,2).replace(/"([^"]+)":/g,"$1:");class ZodError extends Error{constructor(u){super(),this.issues=[],this.addIssue=m=>{this.issues=[...this.issues,m]},this.addIssues=(m=[])=>{this.issues=[...this.issues,...m]};const f=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,f):this.__proto__=f,this.name="ZodError",this.issues=u}get errors(){return this.issues}format(u){const f=u||function(y){return y.message},m={_errors:[]},v=y=>{for(const w of y.issues)if(w.code==="invalid_union")w.unionErrors.map(v);else if(w.code==="invalid_return_type")v(w.returnTypeError);else if(w.code==="invalid_arguments")v(w.argumentsError);else if(w.path.length===0)m._errors.push(f(w));else{let k=m,S=0;for(;S<w.path.length;){const M=w.path[S];S===w.path.length-1?(k[M]=k[M]||{_errors:[]},k[M]._errors.push(f(w))):k[M]=k[M]||{_errors:[]},k=k[M],S++}}};return v(this),m}static assert(u){if(!(u instanceof ZodError))throw new Error(`Not a ZodError: ${u}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,util$2.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(u=f=>f.message){const f={},m=[];for(const v of this.issues)v.path.length>0?(f[v.path[0]]=f[v.path[0]]||[],f[v.path[0]].push(u(v))):m.push(u(v));return{formErrors:m,fieldErrors:f}}get formErrors(){return this.flatten()}}ZodError.create=p=>new ZodError(p);const errorMap=(p,u)=>{let f;switch(p.code){case ZodIssueCode.invalid_type:p.received===ZodParsedType.undefined?f="Required":f=`Expected ${p.expected}, received ${p.received}`;break;case ZodIssueCode.invalid_literal:f=`Invalid literal value, expected ${JSON.stringify(p.expected,util$2.jsonStringifyReplacer)}`;break;case ZodIssueCode.unrecognized_keys:f=`Unrecognized key(s) in object: ${util$2.joinValues(p.keys,", ")}`;break;case ZodIssueCode.invalid_union:f="Invalid input";break;case ZodIssueCode.invalid_union_discriminator:f=`Invalid discriminator value. Expected ${util$2.joinValues(p.options)}`;break;case ZodIssueCode.invalid_enum_value:f=`Invalid enum value. Expected ${util$2.joinValues(p.options)}, received '${p.received}'`;break;case ZodIssueCode.invalid_arguments:f="Invalid function arguments";break;case ZodIssueCode.invalid_return_type:f="Invalid function return type";break;case ZodIssueCode.invalid_date:f="Invalid date";break;case ZodIssueCode.invalid_string:typeof p.validation=="object"?"includes"in p.validation?(f=`Invalid input: must include "${p.validation.includes}"`,typeof p.validation.position=="number"&&(f=`${f} at one or more positions greater than or equal to ${p.validation.position}`)):"startsWith"in p.validation?f=`Invalid input: must start with "${p.validation.startsWith}"`:"endsWith"in p.validation?f=`Invalid input: must end with "${p.validation.endsWith}"`:util$2.assertNever(p.validation):p.validation!=="regex"?f=`Invalid ${p.validation}`:f="Invalid";break;case ZodIssueCode.too_small:p.type==="array"?f=`Array must contain ${p.exact?"exactly":p.inclusive?"at least":"more than"} ${p.minimum} element(s)`:p.type==="string"?f=`String must contain ${p.exact?"exactly":p.inclusive?"at least":"over"} ${p.minimum} character(s)`:p.type==="number"?f=`Number must be ${p.exact?"exactly equal to ":p.inclusive?"greater than or equal to ":"greater than "}${p.minimum}`:p.type==="date"?f=`Date must be ${p.exact?"exactly equal to ":p.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(p.minimum))}`:f="Invalid input";break;case ZodIssueCode.too_big:p.type==="array"?f=`Array must contain ${p.exact?"exactly":p.inclusive?"at most":"less than"} ${p.maximum} element(s)`:p.type==="string"?f=`String must contain ${p.exact?"exactly":p.inclusive?"at most":"under"} ${p.maximum} character(s)`:p.type==="number"?f=`Number must be ${p.exact?"exactly":p.inclusive?"less than or equal to":"less than"} ${p.maximum}`:p.type==="bigint"?f=`BigInt must be ${p.exact?"exactly":p.inclusive?"less than or equal to":"less than"} ${p.maximum}`:p.type==="date"?f=`Date must be ${p.exact?"exactly":p.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(p.maximum))}`:f="Invalid input";break;case ZodIssueCode.custom:f="Invalid input";break;case ZodIssueCode.invalid_intersection_types:f="Intersection results could not be merged";break;case ZodIssueCode.not_multiple_of:f=`Number must be a multiple of ${p.multipleOf}`;break;case ZodIssueCode.not_finite:f="Number must be finite";break;default:f=u.defaultError,util$2.assertNever(p)}return{message:f}};let overrideErrorMap=errorMap;function setErrorMap(p){overrideErrorMap=p}function getErrorMap(){return overrideErrorMap}const makeIssue=p=>{const{data:u,path:f,errorMaps:m,issueData:v}=p,y=[...f,...v.path||[]],w={...v,path:y};if(v.message!==void 0)return{...v,path:y,message:v.message};let k="";const S=m.filter(M=>!!M).slice().reverse();for(const M of S)k=M(w,{data:u,defaultError:k}).message;return{...v,path:y,message:k}},EMPTY_PATH=[];function addIssueToContext(p,u){const f=getErrorMap(),m=makeIssue({issueData:u,data:p.data,path:p.path,errorMaps:[p.common.contextualErrorMap,p.schemaErrorMap,f,f===errorMap?void 0:errorMap].filter(v=>!!v)});p.common.issues.push(m)}class ParseStatus{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(u,f){const m=[];for(const v of f){if(v.status==="aborted")return INVALID$3;v.status==="dirty"&&u.dirty(),m.push(v.value)}return{status:u.value,value:m}}static async mergeObjectAsync(u,f){const m=[];for(const v of f){const y=await v.key,w=await v.value;m.push({key:y,value:w})}return ParseStatus.mergeObjectSync(u,m)}static mergeObjectSync(u,f){const m={};for(const v of f){const{key:y,value:w}=v;if(y.status==="aborted"||w.status==="aborted")return INVALID$3;y.status==="dirty"&&u.dirty(),w.status==="dirty"&&u.dirty(),y.value!=="__proto__"&&(typeof w.value<"u"||v.alwaysSet)&&(m[y.value]=w.value)}return{status:u.value,value:m}}}const INVALID$3=Object.freeze({status:"aborted"}),DIRTY=p=>({status:"dirty",value:p}),OK=p=>({status:"valid",value:p}),isAborted=p=>p.status==="aborted",isDirty=p=>p.status==="dirty",isValid$3=p=>p.status==="valid",isAsync=p=>typeof Promise<"u"&&p instanceof Promise;function __classPrivateFieldGet(p,u,f,m){if(f==="a"&&!m)throw new TypeError("Private accessor was defined without a getter");if(typeof u=="function"?p!==u||!m:!u.has(p))throw new TypeError("Cannot read private member from an object whose class did not declare it");return f==="m"?m:f==="a"?m.call(p):m?m.value:u.get(p)}function __classPrivateFieldSet(p,u,f,m,v){if(m==="m")throw new TypeError("Private method is not writable");if(m==="a"&&!v)throw new TypeError("Private accessor was defined without a setter");if(typeof u=="function"?p!==u||!v:!u.has(p))throw new TypeError("Cannot write private member to an object whose class did not declare it");return m==="a"?v.call(p,f):v?v.value=f:u.set(p,f),f}typeof SuppressedError=="function"&&SuppressedError;var errorUtil;(function(p){p.errToObj=u=>typeof u=="string"?{message:u}:u||{},p.toString=u=>typeof u=="string"?u:u==null?void 0:u.message})(errorUtil||(errorUtil={}));var _ZodEnum_cache,_ZodNativeEnum_cache;class ParseInputLazyPath{constructor(u,f,m,v){this._cachedPath=[],this.parent=u,this.data=f,this._path=m,this._key=v}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const handleResult=(p,u)=>{if(isValid$3(u))return{success:!0,data:u.value};if(!p.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const f=new ZodError(p.common.issues);return this._error=f,this._error}}};function processCreateParams(p){if(!p)return{};const{errorMap:u,invalid_type_error:f,required_error:m,description:v}=p;if(u&&(f||m))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return u?{errorMap:u,description:v}:{errorMap:(w,k)=>{var S,M;const{message:T}=p;return w.code==="invalid_enum_value"?{message:T??k.defaultError}:typeof k.data>"u"?{message:(S=T??m)!==null&&S!==void 0?S:k.defaultError}:w.code!=="invalid_type"?{message:k.defaultError}:{message:(M=T??f)!==null&&M!==void 0?M:k.defaultError}},description:v}}class ZodType{constructor(u){this.spa=this.safeParseAsync,this._def=u,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(u){return getParsedType(u.data)}_getOrReturnCtx(u,f){return f||{common:u.parent.common,data:u.data,parsedType:getParsedType(u.data),schemaErrorMap:this._def.errorMap,path:u.path,parent:u.parent}}_processInputParams(u){return{status:new ParseStatus,ctx:{common:u.parent.common,data:u.data,parsedType:getParsedType(u.data),schemaErrorMap:this._def.errorMap,path:u.path,parent:u.parent}}}_parseSync(u){const f=this._parse(u);if(isAsync(f))throw new Error("Synchronous parse encountered promise.");return f}_parseAsync(u){const f=this._parse(u);return Promise.resolve(f)}parse(u,f){const m=this.safeParse(u,f);if(m.success)return m.data;throw m.error}safeParse(u,f){var m;const v={common:{issues:[],async:(m=f==null?void 0:f.async)!==null&&m!==void 0?m:!1,contextualErrorMap:f==null?void 0:f.errorMap},path:(f==null?void 0:f.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:u,parsedType:getParsedType(u)},y=this._parseSync({data:u,path:v.path,parent:v});return handleResult(v,y)}async parseAsync(u,f){const m=await this.safeParseAsync(u,f);if(m.success)return m.data;throw m.error}async safeParseAsync(u,f){const m={common:{issues:[],contextualErrorMap:f==null?void 0:f.errorMap,async:!0},path:(f==null?void 0:f.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:u,parsedType:getParsedType(u)},v=this._parse({data:u,path:m.path,parent:m}),y=await(isAsync(v)?v:Promise.resolve(v));return handleResult(m,y)}refine(u,f){const m=v=>typeof f=="string"||typeof f>"u"?{message:f}:typeof f=="function"?f(v):f;return this._refinement((v,y)=>{const w=u(v),k=()=>y.addIssue({code:ZodIssueCode.custom,...m(v)});return typeof Promise<"u"&&w instanceof Promise?w.then(S=>S?!0:(k(),!1)):w?!0:(k(),!1)})}refinement(u,f){return this._refinement((m,v)=>u(m)?!0:(v.addIssue(typeof f=="function"?f(m,v):f),!1))}_refinement(u){return new ZodEffects({schema:this,typeName:ZodFirstPartyTypeKind.ZodEffects,effect:{type:"refinement",refinement:u}})}superRefine(u){return this._refinement(u)}optional(){return ZodOptional.create(this,this._def)}nullable(){return ZodNullable.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return ZodArray.create(this,this._def)}promise(){return ZodPromise.create(this,this._def)}or(u){return ZodUnion.create([this,u],this._def)}and(u){return ZodIntersection.create(this,u,this._def)}transform(u){return new ZodEffects({...processCreateParams(this._def),schema:this,typeName:ZodFirstPartyTypeKind.ZodEffects,effect:{type:"transform",transform:u}})}default(u){const f=typeof u=="function"?u:()=>u;return new ZodDefault({...processCreateParams(this._def),innerType:this,defaultValue:f,typeName:ZodFirstPartyTypeKind.ZodDefault})}brand(){return new ZodBranded({typeName:ZodFirstPartyTypeKind.ZodBranded,type:this,...processCreateParams(this._def)})}catch(u){const f=typeof u=="function"?u:()=>u;return new ZodCatch({...processCreateParams(this._def),innerType:this,catchValue:f,typeName:ZodFirstPartyTypeKind.ZodCatch})}describe(u){const f=this.constructor;return new f({...this._def,description:u})}pipe(u){return ZodPipeline.create(this,u)}readonly(){return ZodReadonly.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const cuidRegex=/^c[^\s-]{8,}$/i,cuid2Regex=/^[0-9a-z]+$/,ulidRegex=/^[0-9A-HJKMNP-TV-Z]{26}$/,uuidRegex=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,nanoidRegex=/^[a-z0-9_-]{21}$/i,durationRegex=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,emailRegex=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,_emojiRegex="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let emojiRegex;const ipv4Regex=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,ipv6Regex=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,base64Regex=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,dateRegexSource="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",dateRegex=new RegExp(`^${dateRegexSource}$`);function timeRegexSource(p){let u="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return p.precision?u=`${u}\\.\\d{${p.precision}}`:p.precision==null&&(u=`${u}(\\.\\d+)?`),u}function timeRegex(p){return new RegExp(`^${timeRegexSource(p)}$`)}function datetimeRegex(p){let u=`${dateRegexSource}T${timeRegexSource(p)}`;const f=[];return f.push(p.local?"Z?":"Z"),p.offset&&f.push("([+-]\\d{2}:?\\d{2})"),u=`${u}(${f.join("|")})`,new RegExp(`^${u}$`)}function isValidIP(p,u){return!!((u==="v4"||!u)&&ipv4Regex.test(p)||(u==="v6"||!u)&&ipv6Regex.test(p))}class ZodString extends ZodType{_parse(u){if(this._def.coerce&&(u.data=String(u.data)),this._getType(u)!==ZodParsedType.string){const y=this._getOrReturnCtx(u);return addIssueToContext(y,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.string,received:y.parsedType}),INVALID$3}const m=new ParseStatus;let v;for(const y of this._def.checks)if(y.kind==="min")u.data.length<y.value&&(v=this._getOrReturnCtx(u,v),addIssueToContext(v,{code:ZodIssueCode.too_small,minimum:y.value,type:"string",inclusive:!0,exact:!1,message:y.message}),m.dirty());else if(y.kind==="max")u.data.length>y.value&&(v=this._getOrReturnCtx(u,v),addIssueToContext(v,{code:ZodIssueCode.too_big,maximum:y.value,type:"string",inclusive:!0,exact:!1,message:y.message}),m.dirty());else if(y.kind==="length"){const w=u.data.length>y.value,k=u.data.length<y.value;(w||k)&&(v=this._getOrReturnCtx(u,v),w?addIssueToContext(v,{code:ZodIssueCode.too_big,maximum:y.value,type:"string",inclusive:!0,exact:!0,message:y.message}):k&&addIssueToContext(v,{code:ZodIssueCode.too_small,minimum:y.value,type:"string",inclusive:!0,exact:!0,message:y.message}),m.dirty())}else if(y.kind==="email")emailRegex.test(u.data)||(v=this._getOrReturnCtx(u,v),addIssueToContext(v,{validation:"email",code:ZodIssueCode.invalid_string,message:y.message}),m.dirty());else if(y.kind==="emoji")emojiRegex||(emojiRegex=new RegExp(_emojiRegex,"u")),emojiRegex.test(u.data)||(v=this._getOrReturnCtx(u,v),addIssueToContext(v,{validation:"emoji",code:ZodIssueCode.invalid_string,message:y.message}),m.dirty());else if(y.kind==="uuid")uuidRegex.test(u.data)||(v=this._getOrReturnCtx(u,v),addIssueToContext(v,{validation:"uuid",code:ZodIssueCode.invalid_string,message:y.message}),m.dirty());else if(y.kind==="nanoid")nanoidRegex.test(u.data)||(v=this._getOrReturnCtx(u,v),addIssueToContext(v,{validation:"nanoid",code:ZodIssueCode.invalid_string,message:y.message}),m.dirty());else if(y.kind==="cuid")cuidRegex.test(u.data)||(v=this._getOrReturnCtx(u,v),addIssueToContext(v,{validation:"cuid",code:ZodIssueCode.invalid_string,message:y.message}),m.dirty());else if(y.kind==="cuid2")cuid2Regex.test(u.data)||(v=this._getOrReturnCtx(u,v),addIssueToContext(v,{validation:"cuid2",code:ZodIssueCode.invalid_string,message:y.message}),m.dirty());else if(y.kind==="ulid")ulidRegex.test(u.data)||(v=this._getOrReturnCtx(u,v),addIssueToContext(v,{validation:"ulid",code:ZodIssueCode.invalid_string,message:y.message}),m.dirty());else if(y.kind==="url")try{new URL(u.data)}catch{v=this._getOrReturnCtx(u,v),addIssueToContext(v,{validation:"url",code:ZodIssueCode.invalid_string,message:y.message}),m.dirty()}else y.kind==="regex"?(y.regex.lastIndex=0,y.regex.test(u.data)||(v=this._getOrReturnCtx(u,v),addIssueToContext(v,{validation:"regex",code:ZodIssueCode.invalid_string,message:y.message}),m.dirty())):y.kind==="trim"?u.data=u.data.trim():y.kind==="includes"?u.data.includes(y.value,y.position)||(v=this._getOrReturnCtx(u,v),addIssueToContext(v,{code:ZodIssueCode.invalid_string,validation:{includes:y.value,position:y.position},message:y.message}),m.dirty()):y.kind==="toLowerCase"?u.data=u.data.toLowerCase():y.kind==="toUpperCase"?u.data=u.data.toUpperCase():y.kind==="startsWith"?u.data.startsWith(y.value)||(v=this._getOrReturnCtx(u,v),addIssueToContext(v,{code:ZodIssueCode.invalid_string,validation:{startsWith:y.value},message:y.message}),m.dirty()):y.kind==="endsWith"?u.data.endsWith(y.value)||(v=this._getOrReturnCtx(u,v),addIssueToContext(v,{code:ZodIssueCode.invalid_string,validation:{endsWith:y.value},message:y.message}),m.dirty()):y.kind==="datetime"?datetimeRegex(y).test(u.data)||(v=this._getOrReturnCtx(u,v),addIssueToContext(v,{code:ZodIssueCode.invalid_string,validation:"datetime",message:y.message}),m.dirty()):y.kind==="date"?dateRegex.test(u.data)||(v=this._getOrReturnCtx(u,v),addIssueToContext(v,{code:ZodIssueCode.invalid_string,validation:"date",message:y.message}),m.dirty()):y.kind==="time"?timeRegex(y).test(u.data)||(v=this._getOrReturnCtx(u,v),addIssueToContext(v,{code:ZodIssueCode.invalid_string,validation:"time",message:y.message}),m.dirty()):y.kind==="duration"?durationRegex.test(u.data)||(v=this._getOrReturnCtx(u,v),addIssueToContext(v,{validation:"duration",code:ZodIssueCode.invalid_string,message:y.message}),m.dirty()):y.kind==="ip"?isValidIP(u.data,y.version)||(v=this._getOrReturnCtx(u,v),addIssueToContext(v,{validation:"ip",code:ZodIssueCode.invalid_string,message:y.message}),m.dirty()):y.kind==="base64"?base64Regex.test(u.data)||(v=this._getOrReturnCtx(u,v),addIssueToContext(v,{validation:"base64",code:ZodIssueCode.invalid_string,message:y.message}),m.dirty()):util$2.assertNever(y);return{status:m.value,value:u.data}}_regex(u,f,m){return this.refinement(v=>u.test(v),{validation:f,code:ZodIssueCode.invalid_string,...errorUtil.errToObj(m)})}_addCheck(u){return new ZodString({...this._def,checks:[...this._def.checks,u]})}email(u){return this._addCheck({kind:"email",...errorUtil.errToObj(u)})}url(u){return this._addCheck({kind:"url",...errorUtil.errToObj(u)})}emoji(u){return this._addCheck({kind:"emoji",...errorUtil.errToObj(u)})}uuid(u){return this._addCheck({kind:"uuid",...errorUtil.errToObj(u)})}nanoid(u){return this._addCheck({kind:"nanoid",...errorUtil.errToObj(u)})}cuid(u){return this._addCheck({kind:"cuid",...errorUtil.errToObj(u)})}cuid2(u){return this._addCheck({kind:"cuid2",...errorUtil.errToObj(u)})}ulid(u){return this._addCheck({kind:"ulid",...errorUtil.errToObj(u)})}base64(u){return this._addCheck({kind:"base64",...errorUtil.errToObj(u)})}ip(u){return this._addCheck({kind:"ip",...errorUtil.errToObj(u)})}datetime(u){var f,m;return typeof u=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:u}):this._addCheck({kind:"datetime",precision:typeof(u==null?void 0:u.precision)>"u"?null:u==null?void 0:u.precision,offset:(f=u==null?void 0:u.offset)!==null&&f!==void 0?f:!1,local:(m=u==null?void 0:u.local)!==null&&m!==void 0?m:!1,...errorUtil.errToObj(u==null?void 0:u.message)})}date(u){return this._addCheck({kind:"date",message:u})}time(u){return typeof u=="string"?this._addCheck({kind:"time",precision:null,message:u}):this._addCheck({kind:"time",precision:typeof(u==null?void 0:u.precision)>"u"?null:u==null?void 0:u.precision,...errorUtil.errToObj(u==null?void 0:u.message)})}duration(u){return this._addCheck({kind:"duration",...errorUtil.errToObj(u)})}regex(u,f){return this._addCheck({kind:"regex",regex:u,...errorUtil.errToObj(f)})}includes(u,f){return this._addCheck({kind:"includes",value:u,position:f==null?void 0:f.position,...errorUtil.errToObj(f==null?void 0:f.message)})}startsWith(u,f){return this._addCheck({kind:"startsWith",value:u,...errorUtil.errToObj(f)})}endsWith(u,f){return this._addCheck({kind:"endsWith",value:u,...errorUtil.errToObj(f)})}min(u,f){return this._addCheck({kind:"min",value:u,...errorUtil.errToObj(f)})}max(u,f){return this._addCheck({kind:"max",value:u,...errorUtil.errToObj(f)})}length(u,f){return this._addCheck({kind:"length",value:u,...errorUtil.errToObj(f)})}nonempty(u){return this.min(1,errorUtil.errToObj(u))}trim(){return new ZodString({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new ZodString({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new ZodString({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(u=>u.kind==="datetime")}get isDate(){return!!this._def.checks.find(u=>u.kind==="date")}get isTime(){return!!this._def.checks.find(u=>u.kind==="time")}get isDuration(){return!!this._def.checks.find(u=>u.kind==="duration")}get isEmail(){return!!this._def.checks.find(u=>u.kind==="email")}get isURL(){return!!this._def.checks.find(u=>u.kind==="url")}get isEmoji(){return!!this._def.checks.find(u=>u.kind==="emoji")}get isUUID(){return!!this._def.checks.find(u=>u.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(u=>u.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(u=>u.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(u=>u.kind==="cuid2")}get isULID(){return!!this._def.checks.find(u=>u.kind==="ulid")}get isIP(){return!!this._def.checks.find(u=>u.kind==="ip")}get isBase64(){return!!this._def.checks.find(u=>u.kind==="base64")}get minLength(){let u=null;for(const f of this._def.checks)f.kind==="min"&&(u===null||f.value>u)&&(u=f.value);return u}get maxLength(){let u=null;for(const f of this._def.checks)f.kind==="max"&&(u===null||f.value<u)&&(u=f.value);return u}}ZodString.create=p=>{var u;return new ZodString({checks:[],typeName:ZodFirstPartyTypeKind.ZodString,coerce:(u=p==null?void 0:p.coerce)!==null&&u!==void 0?u:!1,...processCreateParams(p)})};function floatSafeRemainder(p,u){const f=(p.toString().split(".")[1]||"").length,m=(u.toString().split(".")[1]||"").length,v=f>m?f:m,y=parseInt(p.toFixed(v).replace(".","")),w=parseInt(u.toFixed(v).replace(".",""));return y%w/Math.pow(10,v)}class ZodNumber extends ZodType{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(u){if(this._def.coerce&&(u.data=Number(u.data)),this._getType(u)!==ZodParsedType.number){const y=this._getOrReturnCtx(u);return addIssueToContext(y,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.number,received:y.parsedType}),INVALID$3}let m;const v=new ParseStatus;for(const y of this._def.checks)y.kind==="int"?util$2.isInteger(u.data)||(m=this._getOrReturnCtx(u,m),addIssueToContext(m,{code:ZodIssueCode.invalid_type,expected:"integer",received:"float",message:y.message}),v.dirty()):y.kind==="min"?(y.inclusive?u.data<y.value:u.data<=y.value)&&(m=this._getOrReturnCtx(u,m),addIssueToContext(m,{code:ZodIssueCode.too_small,minimum:y.value,type:"number",inclusive:y.inclusive,exact:!1,message:y.message}),v.dirty()):y.kind==="max"?(y.inclusive?u.data>y.value:u.data>=y.value)&&(m=this._getOrReturnCtx(u,m),addIssueToContext(m,{code:ZodIssueCode.too_big,maximum:y.value,type:"number",inclusive:y.inclusive,exact:!1,message:y.message}),v.dirty()):y.kind==="multipleOf"?floatSafeRemainder(u.data,y.value)!==0&&(m=this._getOrReturnCtx(u,m),addIssueToContext(m,{code:ZodIssueCode.not_multiple_of,multipleOf:y.value,message:y.message}),v.dirty()):y.kind==="finite"?Number.isFinite(u.data)||(m=this._getOrReturnCtx(u,m),addIssueToContext(m,{code:ZodIssueCode.not_finite,message:y.message}),v.dirty()):util$2.assertNever(y);return{status:v.value,value:u.data}}gte(u,f){return this.setLimit("min",u,!0,errorUtil.toString(f))}gt(u,f){return this.setLimit("min",u,!1,errorUtil.toString(f))}lte(u,f){return this.setLimit("max",u,!0,errorUtil.toString(f))}lt(u,f){return this.setLimit("max",u,!1,errorUtil.toString(f))}setLimit(u,f,m,v){return new ZodNumber({...this._def,checks:[...this._def.checks,{kind:u,value:f,inclusive:m,message:errorUtil.toString(v)}]})}_addCheck(u){return new ZodNumber({...this._def,checks:[...this._def.checks,u]})}int(u){return this._addCheck({kind:"int",message:errorUtil.toString(u)})}positive(u){return this._addCheck({kind:"min",value:0,inclusive:!1,message:errorUtil.toString(u)})}negative(u){return this._addCheck({kind:"max",value:0,inclusive:!1,message:errorUtil.toString(u)})}nonpositive(u){return this._addCheck({kind:"max",value:0,inclusive:!0,message:errorUtil.toString(u)})}nonnegative(u){return this._addCheck({kind:"min",value:0,inclusive:!0,message:errorUtil.toString(u)})}multipleOf(u,f){return this._addCheck({kind:"multipleOf",value:u,message:errorUtil.toString(f)})}finite(u){return this._addCheck({kind:"finite",message:errorUtil.toString(u)})}safe(u){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:errorUtil.toString(u)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:errorUtil.toString(u)})}get minValue(){let u=null;for(const f of this._def.checks)f.kind==="min"&&(u===null||f.value>u)&&(u=f.value);return u}get maxValue(){let u=null;for(const f of this._def.checks)f.kind==="max"&&(u===null||f.value<u)&&(u=f.value);return u}get isInt(){return!!this._def.checks.find(u=>u.kind==="int"||u.kind==="multipleOf"&&util$2.isInteger(u.value))}get isFinite(){let u=null,f=null;for(const m of this._def.checks){if(m.kind==="finite"||m.kind==="int"||m.kind==="multipleOf")return!0;m.kind==="min"?(f===null||m.value>f)&&(f=m.value):m.kind==="max"&&(u===null||m.value<u)&&(u=m.value)}return Number.isFinite(f)&&Number.isFinite(u)}}ZodNumber.create=p=>new ZodNumber({checks:[],typeName:ZodFirstPartyTypeKind.ZodNumber,coerce:(p==null?void 0:p.coerce)||!1,...processCreateParams(p)});class ZodBigInt extends ZodType{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(u){if(this._def.coerce&&(u.data=BigInt(u.data)),this._getType(u)!==ZodParsedType.bigint){const y=this._getOrReturnCtx(u);return addIssueToContext(y,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.bigint,received:y.parsedType}),INVALID$3}let m;const v=new ParseStatus;for(const y of this._def.checks)y.kind==="min"?(y.inclusive?u.data<y.value:u.data<=y.value)&&(m=this._getOrReturnCtx(u,m),addIssueToContext(m,{code:ZodIssueCode.too_small,type:"bigint",minimum:y.value,inclusive:y.inclusive,message:y.message}),v.dirty()):y.kind==="max"?(y.inclusive?u.data>y.value:u.data>=y.value)&&(m=this._getOrReturnCtx(u,m),addIssueToContext(m,{code:ZodIssueCode.too_big,type:"bigint",maximum:y.value,inclusive:y.inclusive,message:y.message}),v.dirty()):y.kind==="multipleOf"?u.data%y.value!==BigInt(0)&&(m=this._getOrReturnCtx(u,m),addIssueToContext(m,{code:ZodIssueCode.not_multiple_of,multipleOf:y.value,message:y.message}),v.dirty()):util$2.assertNever(y);return{status:v.value,value:u.data}}gte(u,f){return this.setLimit("min",u,!0,errorUtil.toString(f))}gt(u,f){return this.setLimit("min",u,!1,errorUtil.toString(f))}lte(u,f){return this.setLimit("max",u,!0,errorUtil.toString(f))}lt(u,f){return this.setLimit("max",u,!1,errorUtil.toString(f))}setLimit(u,f,m,v){return new ZodBigInt({...this._def,checks:[...this._def.checks,{kind:u,value:f,inclusive:m,message:errorUtil.toString(v)}]})}_addCheck(u){return new ZodBigInt({...this._def,checks:[...this._def.checks,u]})}positive(u){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:errorUtil.toString(u)})}negative(u){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:errorUtil.toString(u)})}nonpositive(u){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:errorUtil.toString(u)})}nonnegative(u){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:errorUtil.toString(u)})}multipleOf(u,f){return this._addCheck({kind:"multipleOf",value:u,message:errorUtil.toString(f)})}get minValue(){let u=null;for(const f of this._def.checks)f.kind==="min"&&(u===null||f.value>u)&&(u=f.value);return u}get maxValue(){let u=null;for(const f of this._def.checks)f.kind==="max"&&(u===null||f.value<u)&&(u=f.value);return u}}ZodBigInt.create=p=>{var u;return new ZodBigInt({checks:[],typeName:ZodFirstPartyTypeKind.ZodBigInt,coerce:(u=p==null?void 0:p.coerce)!==null&&u!==void 0?u:!1,...processCreateParams(p)})};class ZodBoolean extends ZodType{_parse(u){if(this._def.coerce&&(u.data=!!u.data),this._getType(u)!==ZodParsedType.boolean){const m=this._getOrReturnCtx(u);return addIssueToContext(m,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.boolean,received:m.parsedType}),INVALID$3}return OK(u.data)}}ZodBoolean.create=p=>new ZodBoolean({typeName:ZodFirstPartyTypeKind.ZodBoolean,coerce:(p==null?void 0:p.coerce)||!1,...processCreateParams(p)});class ZodDate extends ZodType{_parse(u){if(this._def.coerce&&(u.data=new Date(u.data)),this._getType(u)!==ZodParsedType.date){const y=this._getOrReturnCtx(u);return addIssueToContext(y,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.date,received:y.parsedType}),INVALID$3}if(isNaN(u.data.getTime())){const y=this._getOrReturnCtx(u);return addIssueToContext(y,{code:ZodIssueCode.invalid_date}),INVALID$3}const m=new ParseStatus;let v;for(const y of this._def.checks)y.kind==="min"?u.data.getTime()<y.value&&(v=this._getOrReturnCtx(u,v),addIssueToContext(v,{code:ZodIssueCode.too_small,message:y.message,inclusive:!0,exact:!1,minimum:y.value,type:"date"}),m.dirty()):y.kind==="max"?u.data.getTime()>y.value&&(v=this._getOrReturnCtx(u,v),addIssueToContext(v,{code:ZodIssueCode.too_big,message:y.message,inclusive:!0,exact:!1,maximum:y.value,type:"date"}),m.dirty()):util$2.assertNever(y);return{status:m.value,value:new Date(u.data.getTime())}}_addCheck(u){return new ZodDate({...this._def,checks:[...this._def.checks,u]})}min(u,f){return this._addCheck({kind:"min",value:u.getTime(),message:errorUtil.toString(f)})}max(u,f){return this._addCheck({kind:"max",value:u.getTime(),message:errorUtil.toString(f)})}get minDate(){let u=null;for(const f of this._def.checks)f.kind==="min"&&(u===null||f.value>u)&&(u=f.value);return u!=null?new Date(u):null}get maxDate(){let u=null;for(const f of this._def.checks)f.kind==="max"&&(u===null||f.value<u)&&(u=f.value);return u!=null?new Date(u):null}}ZodDate.create=p=>new ZodDate({checks:[],coerce:(p==null?void 0:p.coerce)||!1,typeName:ZodFirstPartyTypeKind.ZodDate,...processCreateParams(p)});class ZodSymbol extends ZodType{_parse(u){if(this._getType(u)!==ZodParsedType.symbol){const m=this._getOrReturnCtx(u);return addIssueToContext(m,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.symbol,received:m.parsedType}),INVALID$3}return OK(u.data)}}ZodSymbol.create=p=>new ZodSymbol({typeName:ZodFirstPartyTypeKind.ZodSymbol,...processCreateParams(p)});class ZodUndefined extends ZodType{_parse(u){if(this._getType(u)!==ZodParsedType.undefined){const m=this._getOrReturnCtx(u);return addIssueToContext(m,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.undefined,received:m.parsedType}),INVALID$3}return OK(u.data)}}ZodUndefined.create=p=>new ZodUndefined({typeName:ZodFirstPartyTypeKind.ZodUndefined,...processCreateParams(p)});class ZodNull extends ZodType{_parse(u){if(this._getType(u)!==ZodParsedType.null){const m=this._getOrReturnCtx(u);return addIssueToContext(m,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.null,received:m.parsedType}),INVALID$3}return OK(u.data)}}ZodNull.create=p=>new ZodNull({typeName:ZodFirstPartyTypeKind.ZodNull,...processCreateParams(p)});class ZodAny extends ZodType{constructor(){super(...arguments),this._any=!0}_parse(u){return OK(u.data)}}ZodAny.create=p=>new ZodAny({typeName:ZodFirstPartyTypeKind.ZodAny,...processCreateParams(p)});class ZodUnknown extends ZodType{constructor(){super(...arguments),this._unknown=!0}_parse(u){return OK(u.data)}}ZodUnknown.create=p=>new ZodUnknown({typeName:ZodFirstPartyTypeKind.ZodUnknown,...processCreateParams(p)});class ZodNever extends ZodType{_parse(u){const f=this._getOrReturnCtx(u);return addIssueToContext(f,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.never,received:f.parsedType}),INVALID$3}}ZodNever.create=p=>new ZodNever({typeName:ZodFirstPartyTypeKind.ZodNever,...processCreateParams(p)});class ZodVoid extends ZodType{_parse(u){if(this._getType(u)!==ZodParsedType.undefined){const m=this._getOrReturnCtx(u);return addIssueToContext(m,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.void,received:m.parsedType}),INVALID$3}return OK(u.data)}}ZodVoid.create=p=>new ZodVoid({typeName:ZodFirstPartyTypeKind.ZodVoid,...processCreateParams(p)});class ZodArray extends ZodType{_parse(u){const{ctx:f,status:m}=this._processInputParams(u),v=this._def;if(f.parsedType!==ZodParsedType.array)return addIssueToContext(f,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.array,received:f.parsedType}),INVALID$3;if(v.exactLength!==null){const w=f.data.length>v.exactLength.value,k=f.data.length<v.exactLength.value;(w||k)&&(addIssueToContext(f,{code:w?ZodIssueCode.too_big:ZodIssueCode.too_small,minimum:k?v.exactLength.value:void 0,maximum:w?v.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:v.exactLength.message}),m.dirty())}if(v.minLength!==null&&f.data.length<v.minLength.value&&(addIssueToContext(f,{code:ZodIssueCode.too_small,minimum:v.minLength.value,type:"array",inclusive:!0,exact:!1,message:v.minLength.message}),m.dirty()),v.maxLength!==null&&f.data.length>v.maxLength.value&&(addIssueToContext(f,{code:ZodIssueCode.too_big,maximum:v.maxLength.value,type:"array",inclusive:!0,exact:!1,message:v.maxLength.message}),m.dirty()),f.common.async)return Promise.all([...f.data].map((w,k)=>v.type._parseAsync(new ParseInputLazyPath(f,w,f.path,k)))).then(w=>ParseStatus.mergeArray(m,w));const y=[...f.data].map((w,k)=>v.type._parseSync(new ParseInputLazyPath(f,w,f.path,k)));return ParseStatus.mergeArray(m,y)}get element(){return this._def.type}min(u,f){return new ZodArray({...this._def,minLength:{value:u,message:errorUtil.toString(f)}})}max(u,f){return new ZodArray({...this._def,maxLength:{value:u,message:errorUtil.toString(f)}})}length(u,f){return new ZodArray({...this._def,exactLength:{value:u,message:errorUtil.toString(f)}})}nonempty(u){return this.min(1,u)}}ZodArray.create=(p,u)=>new ZodArray({type:p,minLength:null,maxLength:null,exactLength:null,typeName:ZodFirstPartyTypeKind.ZodArray,...processCreateParams(u)});function deepPartialify(p){if(p instanceof ZodObject){const u={};for(const f in p.shape){const m=p.shape[f];u[f]=ZodOptional.create(deepPartialify(m))}return new ZodObject({...p._def,shape:()=>u})}else return p instanceof ZodArray?new ZodArray({...p._def,type:deepPartialify(p.element)}):p instanceof ZodOptional?ZodOptional.create(deepPartialify(p.unwrap())):p instanceof ZodNullable?ZodNullable.create(deepPartialify(p.unwrap())):p instanceof ZodTuple?ZodTuple.create(p.items.map(u=>deepPartialify(u))):p}class ZodObject extends ZodType{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const u=this._def.shape(),f=util$2.objectKeys(u);return this._cached={shape:u,keys:f}}_parse(u){if(this._getType(u)!==ZodParsedType.object){const M=this._getOrReturnCtx(u);return addIssueToContext(M,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.object,received:M.parsedType}),INVALID$3}const{status:m,ctx:v}=this._processInputParams(u),{shape:y,keys:w}=this._getCached(),k=[];if(!(this._def.catchall instanceof ZodNever&&this._def.unknownKeys==="strip"))for(const M in v.data)w.includes(M)||k.push(M);const S=[];for(const M of w){const T=y[M],E=v.data[M];S.push({key:{status:"valid",value:M},value:T._parse(new ParseInputLazyPath(v,E,v.path,M)),alwaysSet:M in v.data})}if(this._def.catchall instanceof ZodNever){const M=this._def.unknownKeys;if(M==="passthrough")for(const T of k)S.push({key:{status:"valid",value:T},value:{status:"valid",value:v.data[T]}});else if(M==="strict")k.length>0&&(addIssueToContext(v,{code:ZodIssueCode.unrecognized_keys,keys:k}),m.dirty());else if(M!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const M=this._def.catchall;for(const T of k){const E=v.data[T];S.push({key:{status:"valid",value:T},value:M._parse(new ParseInputLazyPath(v,E,v.path,T)),alwaysSet:T in v.data})}}return v.common.async?Promise.resolve().then(async()=>{const M=[];for(const T of S){const E=await T.key,H=await T.value;M.push({key:E,value:H,alwaysSet:T.alwaysSet})}return M}).then(M=>ParseStatus.mergeObjectSync(m,M)):ParseStatus.mergeObjectSync(m,S)}get shape(){return this._def.shape()}strict(u){return errorUtil.errToObj,new ZodObject({...this._def,unknownKeys:"strict",...u!==void 0?{errorMap:(f,m)=>{var v,y,w,k;const S=(w=(y=(v=this._def).errorMap)===null||y===void 0?void 0:y.call(v,f,m).message)!==null&&w!==void 0?w:m.defaultError;return f.code==="unrecognized_keys"?{message:(k=errorUtil.errToObj(u).message)!==null&&k!==void 0?k:S}:{message:S}}}:{}})}strip(){return new ZodObject({...this._def,unknownKeys:"strip"})}passthrough(){return new ZodObject({...this._def,unknownKeys:"passthrough"})}extend(u){return new ZodObject({...this._def,shape:()=>({...this._def.shape(),...u})})}merge(u){return new ZodObject({unknownKeys:u._def.unknownKeys,catchall:u._def.catchall,shape:()=>({...this._def.shape(),...u._def.shape()}),typeName:ZodFirstPartyTypeKind.ZodObject})}setKey(u,f){return this.augment({[u]:f})}catchall(u){return new ZodObject({...this._def,catchall:u})}pick(u){const f={};return util$2.objectKeys(u).forEach(m=>{u[m]&&this.shape[m]&&(f[m]=this.shape[m])}),new ZodObject({...this._def,shape:()=>f})}omit(u){const f={};return util$2.objectKeys(this.shape).forEach(m=>{u[m]||(f[m]=this.shape[m])}),new ZodObject({...this._def,shape:()=>f})}deepPartial(){return deepPartialify(this)}partial(u){const f={};return util$2.objectKeys(this.shape).forEach(m=>{const v=this.shape[m];u&&!u[m]?f[m]=v:f[m]=v.optional()}),new ZodObject({...this._def,shape:()=>f})}required(u){const f={};return util$2.objectKeys(this.shape).forEach(m=>{if(u&&!u[m])f[m]=this.shape[m];else{let y=this.shape[m];for(;y instanceof ZodOptional;)y=y._def.innerType;f[m]=y}}),new ZodObject({...this._def,shape:()=>f})}keyof(){return createZodEnum(util$2.objectKeys(this.shape))}}ZodObject.create=(p,u)=>new ZodObject({shape:()=>p,unknownKeys:"strip",catchall:ZodNever.create(),typeName:ZodFirstPartyTypeKind.ZodObject,...processCreateParams(u)}),ZodObject.strictCreate=(p,u)=>new ZodObject({shape:()=>p,unknownKeys:"strict",catchall:ZodNever.create(),typeName:ZodFirstPartyTypeKind.ZodObject,...processCreateParams(u)}),ZodObject.lazycreate=(p,u)=>new ZodObject({shape:p,unknownKeys:"strip",catchall:ZodNever.create(),typeName:ZodFirstPartyTypeKind.ZodObject,...processCreateParams(u)});class ZodUnion extends ZodType{_parse(u){const{ctx:f}=this._processInputParams(u),m=this._def.options;function v(y){for(const k of y)if(k.result.status==="valid")return k.result;for(const k of y)if(k.result.status==="dirty")return f.common.issues.push(...k.ctx.common.issues),k.result;const w=y.map(k=>new ZodError(k.ctx.common.issues));return addIssueToContext(f,{code:ZodIssueCode.invalid_union,unionErrors:w}),INVALID$3}if(f.common.async)return Promise.all(m.map(async y=>{const w={...f,common:{...f.common,issues:[]},parent:null};return{result:await y._parseAsync({data:f.data,path:f.path,parent:w}),ctx:w}})).then(v);{let y;const w=[];for(const S of m){const M={...f,common:{...f.common,issues:[]},parent:null},T=S._parseSync({data:f.data,path:f.path,parent:M});if(T.status==="valid")return T;T.status==="dirty"&&!y&&(y={result:T,ctx:M}),M.common.issues.length&&w.push(M.common.issues)}if(y)return f.common.issues.push(...y.ctx.common.issues),y.result;const k=w.map(S=>new ZodError(S));return addIssueToContext(f,{code:ZodIssueCode.invalid_union,unionErrors:k}),INVALID$3}}get options(){return this._def.options}}ZodUnion.create=(p,u)=>new ZodUnion({options:p,typeName:ZodFirstPartyTypeKind.ZodUnion,...processCreateParams(u)});const getDiscriminator=p=>p instanceof ZodLazy?getDiscriminator(p.schema):p instanceof ZodEffects?getDiscriminator(p.innerType()):p instanceof ZodLiteral?[p.value]:p instanceof ZodEnum?p.options:p instanceof ZodNativeEnum?util$2.objectValues(p.enum):p instanceof ZodDefault?getDiscriminator(p._def.innerType):p instanceof ZodUndefined?[void 0]:p instanceof ZodNull?[null]:p instanceof ZodOptional?[void 0,...getDiscriminator(p.unwrap())]:p instanceof ZodNullable?[null,...getDiscriminator(p.unwrap())]:p instanceof ZodBranded||p instanceof ZodReadonly?getDiscriminator(p.unwrap()):p instanceof ZodCatch?getDiscriminator(p._def.innerType):[];class ZodDiscriminatedUnion extends ZodType{_parse(u){const{ctx:f}=this._processInputParams(u);if(f.parsedType!==ZodParsedType.object)return addIssueToContext(f,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.object,received:f.parsedType}),INVALID$3;const m=this.discriminator,v=f.data[m],y=this.optionsMap.get(v);return y?f.common.async?y._parseAsync({data:f.data,path:f.path,parent:f}):y._parseSync({data:f.data,path:f.path,parent:f}):(addIssueToContext(f,{code:ZodIssueCode.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[m]}),INVALID$3)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(u,f,m){const v=new Map;for(const y of f){const w=getDiscriminator(y.shape[u]);if(!w.length)throw new Error(`A discriminator value for key \`${u}\` could not be extracted from all schema options`);for(const k of w){if(v.has(k))throw new Error(`Discriminator property ${String(u)} has duplicate value ${String(k)}`);v.set(k,y)}}return new ZodDiscriminatedUnion({typeName:ZodFirstPartyTypeKind.ZodDiscriminatedUnion,discriminator:u,options:f,optionsMap:v,...processCreateParams(m)})}}function mergeValues(p,u){const f=getParsedType(p),m=getParsedType(u);if(p===u)return{valid:!0,data:p};if(f===ZodParsedType.object&&m===ZodParsedType.object){const v=util$2.objectKeys(u),y=util$2.objectKeys(p).filter(k=>v.indexOf(k)!==-1),w={...p,...u};for(const k of y){const S=mergeValues(p[k],u[k]);if(!S.valid)return{valid:!1};w[k]=S.data}return{valid:!0,data:w}}else if(f===ZodParsedType.array&&m===ZodParsedType.array){if(p.length!==u.length)return{valid:!1};const v=[];for(let y=0;y<p.length;y++){const w=p[y],k=u[y],S=mergeValues(w,k);if(!S.valid)return{valid:!1};v.push(S.data)}return{valid:!0,data:v}}else return f===ZodParsedType.date&&m===ZodParsedType.date&&+p==+u?{valid:!0,data:p}:{valid:!1}}class ZodIntersection extends ZodType{_parse(u){const{status:f,ctx:m}=this._processInputParams(u),v=(y,w)=>{if(isAborted(y)||isAborted(w))return INVALID$3;const k=mergeValues(y.value,w.value);return k.valid?((isDirty(y)||isDirty(w))&&f.dirty(),{status:f.value,value:k.data}):(addIssueToContext(m,{code:ZodIssueCode.invalid_intersection_types}),INVALID$3)};return m.common.async?Promise.all([this._def.left._parseAsync({data:m.data,path:m.path,parent:m}),this._def.right._parseAsync({data:m.data,path:m.path,parent:m})]).then(([y,w])=>v(y,w)):v(this._def.left._parseSync({data:m.data,path:m.path,parent:m}),this._def.right._parseSync({data:m.data,path:m.path,parent:m}))}}ZodIntersection.create=(p,u,f)=>new ZodIntersection({left:p,right:u,typeName:ZodFirstPartyTypeKind.ZodIntersection,...processCreateParams(f)});class ZodTuple extends ZodType{_parse(u){const{status:f,ctx:m}=this._processInputParams(u);if(m.parsedType!==ZodParsedType.array)return addIssueToContext(m,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.array,received:m.parsedType}),INVALID$3;if(m.data.length<this._def.items.length)return addIssueToContext(m,{code:ZodIssueCode.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),INVALID$3;!this._def.rest&&m.data.length>this._def.items.length&&(addIssueToContext(m,{code:ZodIssueCode.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),f.dirty());const y=[...m.data].map((w,k)=>{const S=this._def.items[k]||this._def.rest;return S?S._parse(new ParseInputLazyPath(m,w,m.path,k)):null}).filter(w=>!!w);return m.common.async?Promise.all(y).then(w=>ParseStatus.mergeArray(f,w)):ParseStatus.mergeArray(f,y)}get items(){return this._def.items}rest(u){return new ZodTuple({...this._def,rest:u})}}ZodTuple.create=(p,u)=>{if(!Array.isArray(p))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new ZodTuple({items:p,typeName:ZodFirstPartyTypeKind.ZodTuple,rest:null,...processCreateParams(u)})};class ZodRecord extends ZodType{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(u){const{status:f,ctx:m}=this._processInputParams(u);if(m.parsedType!==ZodParsedType.object)return addIssueToContext(m,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.object,received:m.parsedType}),INVALID$3;const v=[],y=this._def.keyType,w=this._def.valueType;for(const k in m.data)v.push({key:y._parse(new ParseInputLazyPath(m,k,m.path,k)),value:w._parse(new ParseInputLazyPath(m,m.data[k],m.path,k)),alwaysSet:k in m.data});return m.common.async?ParseStatus.mergeObjectAsync(f,v):ParseStatus.mergeObjectSync(f,v)}get element(){return this._def.valueType}static create(u,f,m){return f instanceof ZodType?new ZodRecord({keyType:u,valueType:f,typeName:ZodFirstPartyTypeKind.ZodRecord,...processCreateParams(m)}):new ZodRecord({keyType:ZodString.create(),valueType:u,typeName:ZodFirstPartyTypeKind.ZodRecord,...processCreateParams(f)})}}class ZodMap extends ZodType{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(u){const{status:f,ctx:m}=this._processInputParams(u);if(m.parsedType!==ZodParsedType.map)return addIssueToContext(m,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.map,received:m.parsedType}),INVALID$3;const v=this._def.keyType,y=this._def.valueType,w=[...m.data.entries()].map(([k,S],M)=>({key:v._parse(new ParseInputLazyPath(m,k,m.path,[M,"key"])),value:y._parse(new ParseInputLazyPath(m,S,m.path,[M,"value"]))}));if(m.common.async){const k=new Map;return Promise.resolve().then(async()=>{for(const S of w){const M=await S.key,T=await S.value;if(M.status==="aborted"||T.status==="aborted")return INVALID$3;(M.status==="dirty"||T.status==="dirty")&&f.dirty(),k.set(M.value,T.value)}return{status:f.value,value:k}})}else{const k=new Map;for(const S of w){const M=S.key,T=S.value;if(M.status==="aborted"||T.status==="aborted")return INVALID$3;(M.status==="dirty"||T.status==="dirty")&&f.dirty(),k.set(M.value,T.value)}return{status:f.value,value:k}}}}ZodMap.create=(p,u,f)=>new ZodMap({valueType:u,keyType:p,typeName:ZodFirstPartyTypeKind.ZodMap,...processCreateParams(f)});class ZodSet extends ZodType{_parse(u){const{status:f,ctx:m}=this._processInputParams(u);if(m.parsedType!==ZodParsedType.set)return addIssueToContext(m,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.set,received:m.parsedType}),INVALID$3;const v=this._def;v.minSize!==null&&m.data.size<v.minSize.value&&(addIssueToContext(m,{code:ZodIssueCode.too_small,minimum:v.minSize.value,type:"set",inclusive:!0,exact:!1,message:v.minSize.message}),f.dirty()),v.maxSize!==null&&m.data.size>v.maxSize.value&&(addIssueToContext(m,{code:ZodIssueCode.too_big,maximum:v.maxSize.value,type:"set",inclusive:!0,exact:!1,message:v.maxSize.message}),f.dirty());const y=this._def.valueType;function w(S){const M=new Set;for(const T of S){if(T.status==="aborted")return INVALID$3;T.status==="dirty"&&f.dirty(),M.add(T.value)}return{status:f.value,value:M}}const k=[...m.data.values()].map((S,M)=>y._parse(new ParseInputLazyPath(m,S,m.path,M)));return m.common.async?Promise.all(k).then(S=>w(S)):w(k)}min(u,f){return new ZodSet({...this._def,minSize:{value:u,message:errorUtil.toString(f)}})}max(u,f){return new ZodSet({...this._def,maxSize:{value:u,message:errorUtil.toString(f)}})}size(u,f){return this.min(u,f).max(u,f)}nonempty(u){return this.min(1,u)}}ZodSet.create=(p,u)=>new ZodSet({valueType:p,minSize:null,maxSize:null,typeName:ZodFirstPartyTypeKind.ZodSet,...processCreateParams(u)});class ZodFunction extends ZodType{constructor(){super(...arguments),this.validate=this.implement}_parse(u){const{ctx:f}=this._processInputParams(u);if(f.parsedType!==ZodParsedType.function)return addIssueToContext(f,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.function,received:f.parsedType}),INVALID$3;function m(k,S){return makeIssue({data:k,path:f.path,errorMaps:[f.common.contextualErrorMap,f.schemaErrorMap,getErrorMap(),errorMap].filter(M=>!!M),issueData:{code:ZodIssueCode.invalid_arguments,argumentsError:S}})}function v(k,S){return makeIssue({data:k,path:f.path,errorMaps:[f.common.contextualErrorMap,f.schemaErrorMap,getErrorMap(),errorMap].filter(M=>!!M),issueData:{code:ZodIssueCode.invalid_return_type,returnTypeError:S}})}const y={errorMap:f.common.contextualErrorMap},w=f.data;if(this._def.returns instanceof ZodPromise){const k=this;return OK(async function(...S){const M=new ZodError([]),T=await k._def.args.parseAsync(S,y).catch(F=>{throw M.addIssue(m(S,F)),M}),E=await Reflect.apply(w,this,T);return await k._def.returns._def.type.parseAsync(E,y).catch(F=>{throw M.addIssue(v(E,F)),M})})}else{const k=this;return OK(function(...S){const M=k._def.args.safeParse(S,y);if(!M.success)throw new ZodError([m(S,M.error)]);const T=Reflect.apply(w,this,M.data),E=k._def.returns.safeParse(T,y);if(!E.success)throw new ZodError([v(T,E.error)]);return E.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...u){return new ZodFunction({...this._def,args:ZodTuple.create(u).rest(ZodUnknown.create())})}returns(u){return new ZodFunction({...this._def,returns:u})}implement(u){return this.parse(u)}strictImplement(u){return this.parse(u)}static create(u,f,m){return new ZodFunction({args:u||ZodTuple.create([]).rest(ZodUnknown.create()),returns:f||ZodUnknown.create(),typeName:ZodFirstPartyTypeKind.ZodFunction,...processCreateParams(m)})}}class ZodLazy extends ZodType{get schema(){return this._def.getter()}_parse(u){const{ctx:f}=this._processInputParams(u);return this._def.getter()._parse({data:f.data,path:f.path,parent:f})}}ZodLazy.create=(p,u)=>new ZodLazy({getter:p,typeName:ZodFirstPartyTypeKind.ZodLazy,...processCreateParams(u)});class ZodLiteral extends ZodType{_parse(u){if(u.data!==this._def.value){const f=this._getOrReturnCtx(u);return addIssueToContext(f,{received:f.data,code:ZodIssueCode.invalid_literal,expected:this._def.value}),INVALID$3}return{status:"valid",value:u.data}}get value(){return this._def.value}}ZodLiteral.create=(p,u)=>new ZodLiteral({value:p,typeName:ZodFirstPartyTypeKind.ZodLiteral,...processCreateParams(u)});function createZodEnum(p,u){return new ZodEnum({values:p,typeName:ZodFirstPartyTypeKind.ZodEnum,...processCreateParams(u)})}class ZodEnum extends ZodType{constructor(){super(...arguments),_ZodEnum_cache.set(this,void 0)}_parse(u){if(typeof u.data!="string"){const f=this._getOrReturnCtx(u),m=this._def.values;return addIssueToContext(f,{expected:util$2.joinValues(m),received:f.parsedType,code:ZodIssueCode.invalid_type}),INVALID$3}if(__classPrivateFieldGet(this,_ZodEnum_cache,"f")||__classPrivateFieldSet(this,_ZodEnum_cache,new Set(this._def.values),"f"),!__classPrivateFieldGet(this,_ZodEnum_cache,"f").has(u.data)){const f=this._getOrReturnCtx(u),m=this._def.values;return addIssueToContext(f,{received:f.data,code:ZodIssueCode.invalid_enum_value,options:m}),INVALID$3}return OK(u.data)}get options(){return this._def.values}get enum(){const u={};for(const f of this._def.values)u[f]=f;return u}get Values(){const u={};for(const f of this._def.values)u[f]=f;return u}get Enum(){const u={};for(const f of this._def.values)u[f]=f;return u}extract(u,f=this._def){return ZodEnum.create(u,{...this._def,...f})}exclude(u,f=this._def){return ZodEnum.create(this.options.filter(m=>!u.includes(m)),{...this._def,...f})}}_ZodEnum_cache=new WeakMap,ZodEnum.create=createZodEnum;class ZodNativeEnum extends ZodType{constructor(){super(...arguments),_ZodNativeEnum_cache.set(this,void 0)}_parse(u){const f=util$2.getValidEnumValues(this._def.values),m=this._getOrReturnCtx(u);if(m.parsedType!==ZodParsedType.string&&m.parsedType!==ZodParsedType.number){const v=util$2.objectValues(f);return addIssueToContext(m,{expected:util$2.joinValues(v),received:m.parsedType,code:ZodIssueCode.invalid_type}),INVALID$3}if(__classPrivateFieldGet(this,_ZodNativeEnum_cache,"f")||__classPrivateFieldSet(this,_ZodNativeEnum_cache,new Set(util$2.getValidEnumValues(this._def.values)),"f"),!__classPrivateFieldGet(this,_ZodNativeEnum_cache,"f").has(u.data)){const v=util$2.objectValues(f);return addIssueToContext(m,{received:m.data,code:ZodIssueCode.invalid_enum_value,options:v}),INVALID$3}return OK(u.data)}get enum(){return this._def.values}}_ZodNativeEnum_cache=new WeakMap,ZodNativeEnum.create=(p,u)=>new ZodNativeEnum({values:p,typeName:ZodFirstPartyTypeKind.ZodNativeEnum,...processCreateParams(u)});class ZodPromise extends ZodType{unwrap(){return this._def.type}_parse(u){const{ctx:f}=this._processInputParams(u);if(f.parsedType!==ZodParsedType.promise&&f.common.async===!1)return addIssueToContext(f,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.promise,received:f.parsedType}),INVALID$3;const m=f.parsedType===ZodParsedType.promise?f.data:Promise.resolve(f.data);return OK(m.then(v=>this._def.type.parseAsync(v,{path:f.path,errorMap:f.common.contextualErrorMap})))}}ZodPromise.create=(p,u)=>new ZodPromise({type:p,typeName:ZodFirstPartyTypeKind.ZodPromise,...processCreateParams(u)});class ZodEffects extends ZodType{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===ZodFirstPartyTypeKind.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(u){const{status:f,ctx:m}=this._processInputParams(u),v=this._def.effect||null,y={addIssue:w=>{addIssueToContext(m,w),w.fatal?f.abort():f.dirty()},get path(){return m.path}};if(y.addIssue=y.addIssue.bind(y),v.type==="preprocess"){const w=v.transform(m.data,y);if(m.common.async)return Promise.resolve(w).then(async k=>{if(f.value==="aborted")return INVALID$3;const S=await this._def.schema._parseAsync({data:k,path:m.path,parent:m});return S.status==="aborted"?INVALID$3:S.status==="dirty"||f.value==="dirty"?DIRTY(S.value):S});{if(f.value==="aborted")return INVALID$3;const k=this._def.schema._parseSync({data:w,path:m.path,parent:m});return k.status==="aborted"?INVALID$3:k.status==="dirty"||f.value==="dirty"?DIRTY(k.value):k}}if(v.type==="refinement"){const w=k=>{const S=v.refinement(k,y);if(m.common.async)return Promise.resolve(S);if(S instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return k};if(m.common.async===!1){const k=this._def.schema._parseSync({data:m.data,path:m.path,parent:m});return k.status==="aborted"?INVALID$3:(k.status==="dirty"&&f.dirty(),w(k.value),{status:f.value,value:k.value})}else return this._def.schema._parseAsync({data:m.data,path:m.path,parent:m}).then(k=>k.status==="aborted"?INVALID$3:(k.status==="dirty"&&f.dirty(),w(k.value).then(()=>({status:f.value,value:k.value}))))}if(v.type==="transform")if(m.common.async===!1){const w=this._def.schema._parseSync({data:m.data,path:m.path,parent:m});if(!isValid$3(w))return w;const k=v.transform(w.value,y);if(k instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:f.value,value:k}}else return this._def.schema._parseAsync({data:m.data,path:m.path,parent:m}).then(w=>isValid$3(w)?Promise.resolve(v.transform(w.value,y)).then(k=>({status:f.value,value:k})):w);util$2.assertNever(v)}}ZodEffects.create=(p,u,f)=>new ZodEffects({schema:p,typeName:ZodFirstPartyTypeKind.ZodEffects,effect:u,...processCreateParams(f)}),ZodEffects.createWithPreprocess=(p,u,f)=>new ZodEffects({schema:u,effect:{type:"preprocess",transform:p},typeName:ZodFirstPartyTypeKind.ZodEffects,...processCreateParams(f)});class ZodOptional extends ZodType{_parse(u){return this._getType(u)===ZodParsedType.undefined?OK(void 0):this._def.innerType._parse(u)}unwrap(){return this._def.innerType}}ZodOptional.create=(p,u)=>new ZodOptional({innerType:p,typeName:ZodFirstPartyTypeKind.ZodOptional,...processCreateParams(u)});class ZodNullable extends ZodType{_parse(u){return this._getType(u)===ZodParsedType.null?OK(null):this._def.innerType._parse(u)}unwrap(){return this._def.innerType}}ZodNullable.create=(p,u)=>new ZodNullable({innerType:p,typeName:ZodFirstPartyTypeKind.ZodNullable,...processCreateParams(u)});class ZodDefault extends ZodType{_parse(u){const{ctx:f}=this._processInputParams(u);let m=f.data;return f.parsedType===ZodParsedType.undefined&&(m=this._def.defaultValue()),this._def.innerType._parse({data:m,path:f.path,parent:f})}removeDefault(){return this._def.innerType}}ZodDefault.create=(p,u)=>new ZodDefault({innerType:p,typeName:ZodFirstPartyTypeKind.ZodDefault,defaultValue:typeof u.default=="function"?u.default:()=>u.default,...processCreateParams(u)});class ZodCatch extends ZodType{_parse(u){const{ctx:f}=this._processInputParams(u),m={...f,common:{...f.common,issues:[]}},v=this._def.innerType._parse({data:m.data,path:m.path,parent:{...m}});return isAsync(v)?v.then(y=>({status:"valid",value:y.status==="valid"?y.value:this._def.catchValue({get error(){return new ZodError(m.common.issues)},input:m.data})})):{status:"valid",value:v.status==="valid"?v.value:this._def.catchValue({get error(){return new ZodError(m.common.issues)},input:m.data})}}removeCatch(){return this._def.innerType}}ZodCatch.create=(p,u)=>new ZodCatch({innerType:p,typeName:ZodFirstPartyTypeKind.ZodCatch,catchValue:typeof u.catch=="function"?u.catch:()=>u.catch,...processCreateParams(u)});class ZodNaN extends ZodType{_parse(u){if(this._getType(u)!==ZodParsedType.nan){const m=this._getOrReturnCtx(u);return addIssueToContext(m,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.nan,received:m.parsedType}),INVALID$3}return{status:"valid",value:u.data}}}ZodNaN.create=p=>new ZodNaN({typeName:ZodFirstPartyTypeKind.ZodNaN,...processCreateParams(p)});const BRAND=Symbol("zod_brand");class ZodBranded extends ZodType{_parse(u){const{ctx:f}=this._processInputParams(u),m=f.data;return this._def.type._parse({data:m,path:f.path,parent:f})}unwrap(){return this._def.type}}class ZodPipeline extends ZodType{_parse(u){const{status:f,ctx:m}=this._processInputParams(u);if(m.common.async)return(async()=>{const y=await this._def.in._parseAsync({data:m.data,path:m.path,parent:m});return y.status==="aborted"?INVALID$3:y.status==="dirty"?(f.dirty(),DIRTY(y.value)):this._def.out._parseAsync({data:y.value,path:m.path,parent:m})})();{const v=this._def.in._parseSync({data:m.data,path:m.path,parent:m});return v.status==="aborted"?INVALID$3:v.status==="dirty"?(f.dirty(),{status:"dirty",value:v.value}):this._def.out._parseSync({data:v.value,path:m.path,parent:m})}}static create(u,f){return new ZodPipeline({in:u,out:f,typeName:ZodFirstPartyTypeKind.ZodPipeline})}}class ZodReadonly extends ZodType{_parse(u){const f=this._def.innerType._parse(u),m=v=>(isValid$3(v)&&(v.value=Object.freeze(v.value)),v);return isAsync(f)?f.then(v=>m(v)):m(f)}unwrap(){return this._def.innerType}}ZodReadonly.create=(p,u)=>new ZodReadonly({innerType:p,typeName:ZodFirstPartyTypeKind.ZodReadonly,...processCreateParams(u)});function custom(p,u={},f){return p?ZodAny.create().superRefine((m,v)=>{var y,w;if(!p(m)){const k=typeof u=="function"?u(m):typeof u=="string"?{message:u}:u,S=(w=(y=k.fatal)!==null&&y!==void 0?y:f)!==null&&w!==void 0?w:!0,M=typeof k=="string"?{message:k}:k;v.addIssue({code:"custom",...M,fatal:S})}}):ZodAny.create()}const late={object:ZodObject.lazycreate};var ZodFirstPartyTypeKind;(function(p){p.ZodString="ZodString",p.ZodNumber="ZodNumber",p.ZodNaN="ZodNaN",p.ZodBigInt="ZodBigInt",p.ZodBoolean="ZodBoolean",p.ZodDate="ZodDate",p.ZodSymbol="ZodSymbol",p.ZodUndefined="ZodUndefined",p.ZodNull="ZodNull",p.ZodAny="ZodAny",p.ZodUnknown="ZodUnknown",p.ZodNever="ZodNever",p.ZodVoid="ZodVoid",p.ZodArray="ZodArray",p.ZodObject="ZodObject",p.ZodUnion="ZodUnion",p.ZodDiscriminatedUnion="ZodDiscriminatedUnion",p.ZodIntersection="ZodIntersection",p.ZodTuple="ZodTuple",p.ZodRecord="ZodRecord",p.ZodMap="ZodMap",p.ZodSet="ZodSet",p.ZodFunction="ZodFunction",p.ZodLazy="ZodLazy",p.ZodLiteral="ZodLiteral",p.ZodEnum="ZodEnum",p.ZodEffects="ZodEffects",p.ZodNativeEnum="ZodNativeEnum",p.ZodOptional="ZodOptional",p.ZodNullable="ZodNullable",p.ZodDefault="ZodDefault",p.ZodCatch="ZodCatch",p.ZodPromise="ZodPromise",p.ZodBranded="ZodBranded",p.ZodPipeline="ZodPipeline",p.ZodReadonly="ZodReadonly"})(ZodFirstPartyTypeKind||(ZodFirstPartyTypeKind={}));const instanceOfType=(p,u={message:`Input not instance of ${p.name}`})=>custom(f=>f instanceof p,u),stringType=ZodString.create,numberType=ZodNumber.create,nanType=ZodNaN.create,bigIntType=ZodBigInt.create,booleanType=ZodBoolean.create,dateType=ZodDate.create,symbolType=ZodSymbol.create,undefinedType=ZodUndefined.create,nullType=ZodNull.create,anyType=ZodAny.create,unknownType=ZodUnknown.create,neverType=ZodNever.create,voidType=ZodVoid.create,arrayType=ZodArray.create,objectType$1=ZodObject.create,strictObjectType=ZodObject.strictCreate,unionType=ZodUnion.create,discriminatedUnionType=ZodDiscriminatedUnion.create,intersectionType=ZodIntersection.create,tupleType=ZodTuple.create,recordType=ZodRecord.create,mapType=ZodMap.create,setType=ZodSet.create,functionType=ZodFunction.create,lazyType=ZodLazy.create,literalType=ZodLiteral.create,enumType=ZodEnum.create,nativeEnumType=ZodNativeEnum.create,promiseType=ZodPromise.create,effectsType=ZodEffects.create,optionalType=ZodOptional.create,nullableType=ZodNullable.create,preprocessType=ZodEffects.createWithPreprocess,pipelineType=ZodPipeline.create,ostring=()=>stringType().optional(),onumber=()=>numberType().optional(),oboolean=()=>booleanType().optional(),coerce={string:p=>ZodString.create({...p,coerce:!0}),number:p=>ZodNumber.create({...p,coerce:!0}),boolean:p=>ZodBoolean.create({...p,coerce:!0}),bigint:p=>ZodBigInt.create({...p,coerce:!0}),date:p=>ZodDate.create({...p,coerce:!0})},NEVER=INVALID$3;var z=Object.freeze({__proto__:null,defaultErrorMap:errorMap,setErrorMap,getErrorMap,makeIssue,EMPTY_PATH,addIssueToContext,ParseStatus,INVALID:INVALID$3,DIRTY,OK,isAborted,isDirty,isValid:isValid$3,isAsync,get util(){return util$2},get objectUtil(){return objectUtil},ZodParsedType,getParsedType,ZodType,datetimeRegex,ZodString,ZodNumber,ZodBigInt,ZodBoolean,ZodDate,ZodSymbol,ZodUndefined,ZodNull,ZodAny,ZodUnknown,ZodNever,ZodVoid,ZodArray,ZodObject,ZodUnion,ZodDiscriminatedUnion,ZodIntersection,ZodTuple,ZodRecord,ZodMap,ZodSet,ZodFunction,ZodLazy,ZodLiteral,ZodEnum,ZodNativeEnum,ZodPromise,ZodEffects,ZodTransformer:ZodEffects,ZodOptional,ZodNullable,ZodDefault,ZodCatch,ZodNaN,BRAND,ZodBranded,ZodPipeline,ZodReadonly,custom,Schema:ZodType,ZodSchema:ZodType,late,get ZodFirstPartyTypeKind(){return ZodFirstPartyTypeKind},coerce,any:anyType,array:arrayType,bigint:bigIntType,boolean:booleanType,date:dateType,discriminatedUnion:discriminatedUnionType,effect:effectsType,enum:enumType,function:functionType,instanceof:instanceOfType,intersection:intersectionType,lazy:lazyType,literal:literalType,map:mapType,nan:nanType,nativeEnum:nativeEnumType,never:neverType,null:nullType,nullable:nullableType,number:numberType,object:objectType$1,oboolean,onumber,optional:optionalType,ostring,pipeline:pipelineType,preprocess:preprocessType,promise:promiseType,record:recordType,set:setType,strictObject:strictObjectType,string:stringType,symbol:symbolType,transformer:effectsType,tuple:tupleType,undefined:undefinedType,union:unionType,unknown:unknownType,void:voidType,NEVER,ZodIssueCode,quotelessJson,ZodError});const fieldKey=z.string().refine(p=>p!==InternalSearchFilterOperator.COMPLEX_ID_OPERATOR,{message:`Key '${InternalSearchFilterOperator.COMPLEX_ID_OPERATOR}' is not allowed`}),stringBasicFilter=z.record(fieldKey,z.string()),basicFilter=z.record(fieldKey,z.any()),arrayFilter$2=z.record(fieldKey,z.union([z.any().array(),z.string()])),logicFilter=z.lazy(()=>z.object({conditions:z.array(z.object(queryFilterValidation))})),stringOrNumber=z.union([z.string(),z.number()]),queryFilterValidation={[BasicOperator.STRING]:stringBasicFilter.optional(),[BasicOperator.FUZZY]:stringBasicFilter.optional(),[RangeOperator.RANGE]:z.record(fieldKey,z.union([z.object({high:stringOrNumber,low:stringOrNumber}),z.object({high:stringOrNumber}),z.object({low:stringOrNumber})])).optional(),[BasicOperator.EQUAL]:basicFilter.optional(),[BasicOperator.NOT_EQUAL]:basicFilter.optional(),[BasicOperator.EMPTY]:basicFilter.optional(),[BasicOperator.NOT_EMPTY]:basicFilter.optional(),[ArrayOperator.ONE_OF]:arrayFilter$2.optional(),[ArrayOperator.CONTAINS]:arrayFilter$2.optional(),[ArrayOperator.NOT_CONTAINS]:arrayFilter$2.optional(),[ArrayOperator.CONTAINS_ANY]:arrayFilter$2.optional(),[LogicalOperator.AND]:logicFilter.optional(),[LogicalOperator.OR]:logicFilter.optional()};z.object({query:z.object({allOr:z.boolean().optional(),onEmptyFilter:z.nativeEnum(EmptyFilterOption).optional(),...queryFilterValidation}).optional(),paginate:z.boolean().optional(),bookmark:z.union([z.string(),z.number()]).nullish(),limit:z.number().optional(),sort:z.string().nullish(),sortOrder:z.nativeEnum(SortOrder).optional(),sortType:z.nativeEnum(SortType).nullish(),version:z.string().optional(),disableEscaping:z.boolean().optional(),countRows:z.boolean().optional()});var MaintenanceType=(p=>(p.SQS_MISSING="sqs_missing",p))(MaintenanceType||{}),DropPosition=(p=>(p.ABOVE="above",p.BELOW="below",p.INSIDE="inside",p))(DropPosition||{}),ComponentContextScopes=(p=>(p.Local="local",p.Global="global",p))(ComponentContextScopes||{});AIOperationEnum.SUMMARISE_TEXT+"",OperationFieldTypeEnum.MULTI_COLUMN,AIOperationEnum.CLEAN_DATA+"",OperationFieldTypeEnum.COLUMN,AIOperationEnum.TRANSLATE+"",OperationFieldTypeEnum.COLUMN,OperationFieldTypeEnum.BINDABLE_TEXT,AIOperationEnum.CATEGORISE_TEXT+"",OperationFieldTypeEnum.MULTI_COLUMN,OperationFieldTypeEnum.BINDABLE_TEXT,AIOperationEnum.SENTIMENT_ANALYSIS+"",OperationFieldTypeEnum.COLUMN,AIOperationEnum.PROMPT+"",OperationFieldTypeEnum.BINDABLE_TEXT,AIOperationEnum.SEARCH_WEB+"",OperationFieldTypeEnum.MULTI_COLUMN;var Header=(p=>(p.API_KEY="x-budibase-api-key",p.LICENSE_KEY="x-budibase-license-key",p.API_VER="x-budibase-api-version",p.APP_ID="x-budibase-app-id",p.SESSION_ID="x-budibase-session-id",p.TYPE="x-budibase-type",p.PREVIEW_ROLE="x-budibase-role",p.TENANT_ID="x-budibase-tenant-id",p.VERIFICATION_CODE="x-budibase-verification-code",p.RETURN_VERIFICATION_CODE="x-budibase-return-verification-code",p.RESET_PASSWORD_CODE="x-budibase-reset-password-code",p.RETURN_RESET_PASSWORD_CODE="x-budibase-return-reset-password-code",p.TOKEN="x-budibase-token",p.CSRF_TOKEN="x-csrf-token",p.CORRELATION_ID="x-budibase-correlation-id",p.AUTHORIZATION="authorization",p.MIGRATING_APP="x-budibase-migrating-app",p.COOKIE="cookie",p))(Header||{});FieldType.STRING+"",FieldType.STRING,FieldType.OPTIONS,FieldType.LONGFORM,FieldType.BARCODEQR,FieldType.OPTIONS+"",FieldType.OPTIONS,FieldType.STRING,FieldType.LONGFORM,FieldType.BARCODEQR,FieldType.LONGFORM+"",FieldType.LONGFORM,FieldType.STRING,FieldType.OPTIONS,FieldType.BARCODEQR,FieldType.BARCODEQR+"",FieldType.BARCODEQR,FieldType.STRING,FieldType.OPTIONS,FieldType.LONGFORM,FieldType.NUMBER+"",FieldType.NUMBER,FieldType.BOOLEAN;const ThemeClassPrefix="spectrum--";Theme.DARKEST;const DefaultAppTheme=Theme.LIGHT,ThemeOptions=[{id:Theme.LIGHT,name:"Light"},{id:Theme.DARKEST,name:"Dark"},{id:Theme.NORD,name:"Nord",base:Theme.DARKEST},{id:Theme.MIDNIGHT,name:"Midnight",base:Theme.DARKEST}],OperatorOptions={Equals:{value:"equal",label:"Equals"},NotEquals:{value:"notEqual",label:"Not equals"},Empty:{value:"empty",label:"Is empty"},NotEmpty:{value:"notEmpty",label:"Is not empty"},StartsWith:{value:"string",label:"Starts with"},Like:{value:"fuzzy",label:"Like"},MoreThan:{value:"rangeLow",label:"More than or equal to"},LessThan:{value:"rangeHigh",label:"Less than or equal to"},Contains:{value:"contains",label:"Contains"},NotContains:{value:"notContains",label:"Does not contain"},In:{value:"oneOf",label:"Is in"},ContainsAny:{value:"containsAny",label:"Has any"}},SqlNumberTypeRangeMap={integer:{max:2147483647,min:-2147483648},int:{max:2147483647,min:-2147483648},smallint:{max:32767,min:-32768},mediumint:{max:8388607,min:-8388608}};var SocketEvent=(p=>(p.UserUpdate="UserUpdate",p.UserDisconnect="UserDisconnect",p.Heartbeat="Heartbeat",p))(SocketEvent||{}),GridSocketEvent=(p=>(p.RowChange="RowChange",p.DatasourceChange="DatasourceChange",p.SelectDatasource="SelectDatasource",p.SelectCell="SelectCell",p))(GridSocketEvent||{});const SocketSessionTTL=60,ValidColumnNameRegex=/^[_a-zA-Z0-9\s]*$/g;var BpmCorrelationKey=(p=>(p.ONBOARDING="budibase:onboarding:correlationkey",p.VERIFY_SSO_LOGIN="budibase:verify_sso_login:correlationkey",p))(BpmCorrelationKey||{});const DEFAULT_BB_DATASOURCE_ID="datasource_internal_bb_default";var commonjsGlobal$1=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function getDefaultExportFromCjs$1(p){return p&&p.__esModule&&Object.prototype.hasOwnProperty.call(p,"default")?p.default:p}function getAugmentedNamespace(p){if(p.__esModule)return p;var u=p.default;if(typeof u=="function"){var f=function m(){return this instanceof m?Reflect.construct(u,arguments,this.constructor):u.apply(this,arguments)};f.prototype=u.prototype}else f={};return Object.defineProperty(f,"__esModule",{value:!0}),Object.keys(p).forEach(function(m){var v=Object.getOwnPropertyDescriptor(p,m);Object.defineProperty(f,m,v.get?v:{enumerable:!0,get:function(){return p[m]}})}),f}var dayjs_min$1={exports:{}};(function(p,u){(function(f,m){p.exports=m()})(commonjsGlobal$1,function(){var f=1e3,m=6e4,v=36e5,y="millisecond",w="second",k="minute",S="hour",M="day",T="week",E="month",H="quarter",F="year",Z="date",$="Invalid Date",J=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,se=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,ie={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(Ge){var be=["th","st","nd","rd"],De=Ge%100;return"["+Ge+(be[(De-20)%10]||be[De]||be[0])+"]"}},he=function(Ge,be,De){var Ke=String(Ge);return!Ke||Ke.length>=be?Ge:""+Array(be+1-Ke.length).join(De)+Ge},fe={s:he,z:function(Ge){var be=-Ge.utcOffset(),De=Math.abs(be),Ke=Math.floor(De/60),He=De%60;return(be<=0?"+":"-")+he(Ke,2,"0")+":"+he(He,2,"0")},m:function Ge(be,De){if(be.date()<De.date())return-Ge(De,be);var Ke=12*(De.year()-be.year())+(De.month()-be.month()),He=be.clone().add(Ke,E),rt=De-He<0,ft=be.clone().add(Ke+(rt?-1:1),E);return+(-(Ke+(De-He)/(rt?He-ft:ft-He))||0)},a:function(Ge){return Ge<0?Math.ceil(Ge)||0:Math.floor(Ge)},p:function(Ge){return{M:E,y:F,w:T,d:M,D:Z,h:S,m:k,s:w,ms:y,Q:H}[Ge]||String(Ge||"").toLowerCase().replace(/s$/,"")},u:function(Ge){return Ge===void 0}},pe="en",ve={};ve[pe]=ie;var Ae="$isDayjsObject",ze=function(Ge){return Ge instanceof Ue||!(!Ge||!Ge[Ae])},Se=function Ge(be,De,Ke){var He;if(!be)return pe;if(typeof be=="string"){var rt=be.toLowerCase();ve[rt]&&(He=rt),De&&(ve[rt]=De,He=rt);var ft=be.split("-");if(!He&&ft.length>1)return Ge(ft[0])}else{var Mt=be.name;ve[Mt]=be,He=Mt}return!Ke&&He&&(pe=He),He||!Ke&&pe},Le=function(Ge,be){if(ze(Ge))return Ge.clone();var De=typeof be=="object"?be:{};return De.date=Ge,De.args=arguments,new Ue(De)},Ce=fe;Ce.l=Se,Ce.i=ze,Ce.w=function(Ge,be){return Le(Ge,{locale:be.$L,utc:be.$u,x:be.$x,$offset:be.$offset})};var Ue=function(){function Ge(De){this.$L=Se(De.locale,null,!0),this.parse(De),this.$x=this.$x||De.x||{},this[Ae]=!0}var be=Ge.prototype;return be.parse=function(De){this.$d=function(Ke){var He=Ke.date,rt=Ke.utc;if(He===null)return new Date(NaN);if(Ce.u(He))return new Date;if(He instanceof Date)return new Date(He);if(typeof He=="string"&&!/Z$/i.test(He)){var ft=He.match(J);if(ft){var Mt=ft[2]-1||0,$e=(ft[7]||"0").substring(0,3);return rt?new Date(Date.UTC(ft[1],Mt,ft[3]||1,ft[4]||0,ft[5]||0,ft[6]||0,$e)):new Date(ft[1],Mt,ft[3]||1,ft[4]||0,ft[5]||0,ft[6]||0,$e)}}return new Date(He)}(De),this.init()},be.init=function(){var De=this.$d;this.$y=De.getFullYear(),this.$M=De.getMonth(),this.$D=De.getDate(),this.$W=De.getDay(),this.$H=De.getHours(),this.$m=De.getMinutes(),this.$s=De.getSeconds(),this.$ms=De.getMilliseconds()},be.$utils=function(){return Ce},be.isValid=function(){return this.$d.toString()!==$},be.isSame=function(De,Ke){var He=Le(De);return this.startOf(Ke)<=He&&He<=this.endOf(Ke)},be.isAfter=function(De,Ke){return Le(De)<this.startOf(Ke)},be.isBefore=function(De,Ke){return this.endOf(Ke)<Le(De)},be.$g=function(De,Ke,He){return Ce.u(De)?this[Ke]:this.set(He,De)},be.unix=function(){return Math.floor(this.valueOf()/1e3)},be.valueOf=function(){return this.$d.getTime()},be.startOf=function(De,Ke){var He=this,rt=!!Ce.u(Ke)||Ke,ft=Ce.p(De),Mt=function(Gt,Jt){var Ht=Ce.w(He.$u?Date.UTC(He.$y,Jt,Gt):new Date(He.$y,Jt,Gt),He);return rt?Ht:Ht.endOf(M)},$e=function(Gt,Jt){return Ce.w(He.toDate()[Gt].apply(He.toDate("s"),(rt?[0,0,0,0]:[23,59,59,999]).slice(Jt)),He)},je=this.$W,Ct=this.$M,yt=this.$D,ot="set"+(this.$u?"UTC":"");switch(ft){case F:return rt?Mt(1,0):Mt(31,11);case E:return rt?Mt(1,Ct):Mt(0,Ct+1);case T:var Rt=this.$locale().weekStart||0,Xe=(je<Rt?je+7:je)-Rt;return Mt(rt?yt-Xe:yt+(6-Xe),Ct);case M:case Z:return $e(ot+"Hours",0);case S:return $e(ot+"Minutes",1);case k:return $e(ot+"Seconds",2);case w:return $e(ot+"Milliseconds",3);default:return this.clone()}},be.endOf=function(De){return this.startOf(De,!1)},be.$set=function(De,Ke){var He,rt=Ce.p(De),ft="set"+(this.$u?"UTC":""),Mt=(He={},He[M]=ft+"Date",He[Z]=ft+"Date",He[E]=ft+"Month",He[F]=ft+"FullYear",He[S]=ft+"Hours",He[k]=ft+"Minutes",He[w]=ft+"Seconds",He[y]=ft+"Milliseconds",He)[rt],$e=rt===M?this.$D+(Ke-this.$W):Ke;if(rt===E||rt===F){var je=this.clone().set(Z,1);je.$d[Mt]($e),je.init(),this.$d=je.set(Z,Math.min(this.$D,je.daysInMonth())).$d}else Mt&&this.$d[Mt]($e);return this.init(),this},be.set=function(De,Ke){return this.clone().$set(De,Ke)},be.get=function(De){return this[Ce.p(De)]()},be.add=function(De,Ke){var He,rt=this;De=Number(De);var ft=Ce.p(Ke),Mt=function(Ct){var yt=Le(rt);return Ce.w(yt.date(yt.date()+Math.round(Ct*De)),rt)};if(ft===E)return this.set(E,this.$M+De);if(ft===F)return this.set(F,this.$y+De);if(ft===M)return Mt(1);if(ft===T)return Mt(7);var $e=(He={},He[k]=m,He[S]=v,He[w]=f,He)[ft]||1,je=this.$d.getTime()+De*$e;return Ce.w(je,this)},be.subtract=function(De,Ke){return this.add(-1*De,Ke)},be.format=function(De){var Ke=this,He=this.$locale();if(!this.isValid())return He.invalidDate||$;var rt=De||"YYYY-MM-DDTHH:mm:ssZ",ft=Ce.z(this),Mt=this.$H,$e=this.$m,je=this.$M,Ct=He.weekdays,yt=He.months,ot=He.meridiem,Rt=function(Jt,Ht,Pt,Et){return Jt&&(Jt[Ht]||Jt(Ke,rt))||Pt[Ht].slice(0,Et)},Xe=function(Jt){return Ce.s(Mt%12||12,Jt,"0")},Gt=ot||function(Jt,Ht,Pt){var Et=Jt<12?"AM":"PM";return Pt?Et.toLowerCase():Et};return rt.replace(se,function(Jt,Ht){return Ht||function(Pt){switch(Pt){case"YY":return String(Ke.$y).slice(-2);case"YYYY":return Ce.s(Ke.$y,4,"0");case"M":return je+1;case"MM":return Ce.s(je+1,2,"0");case"MMM":return Rt(He.monthsShort,je,yt,3);case"MMMM":return Rt(yt,je);case"D":return Ke.$D;case"DD":return Ce.s(Ke.$D,2,"0");case"d":return String(Ke.$W);case"dd":return Rt(He.weekdaysMin,Ke.$W,Ct,2);case"ddd":return Rt(He.weekdaysShort,Ke.$W,Ct,3);case"dddd":return Ct[Ke.$W];case"H":return String(Mt);case"HH":return Ce.s(Mt,2,"0");case"h":return Xe(1);case"hh":return Xe(2);case"a":return Gt(Mt,$e,!0);case"A":return Gt(Mt,$e,!1);case"m":return String($e);case"mm":return Ce.s($e,2,"0");case"s":return String(Ke.$s);case"ss":return Ce.s(Ke.$s,2,"0");case"SSS":return Ce.s(Ke.$ms,3,"0");case"Z":return ft}return null}(Jt)||ft.replace(":","")})},be.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},be.diff=function(De,Ke,He){var rt,ft=this,Mt=Ce.p(Ke),$e=Le(De),je=($e.utcOffset()-this.utcOffset())*m,Ct=this-$e,yt=function(){return Ce.m(ft,$e)};switch(Mt){case F:rt=yt()/12;break;case E:rt=yt();break;case H:rt=yt()/3;break;case T:rt=(Ct-je)/6048e5;break;case M:rt=(Ct-je)/864e5;break;case S:rt=Ct/v;break;case k:rt=Ct/m;break;case w:rt=Ct/f;break;default:rt=Ct}return He?rt:Ce.a(rt)},be.daysInMonth=function(){return this.endOf(E).$D},be.$locale=function(){return ve[this.$L]},be.locale=function(De,Ke){if(!De)return this.$L;var He=this.clone(),rt=Se(De,Ke,!0);return rt&&(He.$L=rt),He},be.clone=function(){return Ce.w(this.$d,this)},be.toDate=function(){return new Date(this.valueOf())},be.toJSON=function(){return this.isValid()?this.toISOString():null},be.toISOString=function(){return this.$d.toISOString()},be.toString=function(){return this.$d.toUTCString()},Ge}(),Ze=Ue.prototype;return Le.prototype=Ze,[["$ms",y],["$s",w],["$m",k],["$H",S],["$W",M],["$M",E],["$y",F],["$D",Z]].forEach(function(Ge){Ze[Ge[1]]=function(be){return this.$g(be,Ge[0],Ge[1])}}),Le.extend=function(Ge,be){return Ge.$i||(Ge(be,Ue,Le),Ge.$i=!0),Le},Le.locale=Se,Le.isDayjs=ze,Le.unix=function(Ge){return Le(1e3*Ge)},Le.en=ve[pe],Le.Ls=ve,Le.p={},Le})})(dayjs_min$1);var dayjs_minExports=dayjs_min$1.exports;const dayjs=getDefaultExportFromCjs$1(dayjs_minExports);var lodash={exports:{}};/**
24
24
  * @license
25
25
  * Lodash <https://lodash.com/>
26
26
  * Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
@@ -380,7 +380,7 @@ function print() { __p += __j.call(arguments, '') }
380
380
  </g>
381
381
  </g>
382
382
  </svg>
383
- `;var HTTPMethod=(p=>(p.POST="POST",p.PATCH="PATCH",p.GET="GET",p.PUT="PUT",p.DELETE="DELETE",p))(HTTPMethod||{});const BannedSearchTypes=[FieldType.LINK,FieldType.ATTACHMENT_SINGLE,FieldType.ATTACHMENTS,FieldType.FORMULA,FieldType.JSON,FieldType.ATTACHMENT_SINGLE,FieldType.SIGNATURE_SINGLE,"jsonarray","queryarray"],Cookies={Auth:"budibase:auth",CurrentApp:"budibase:currentapp",ReturnUrl:"budibase:returnurl",AccountReturnUrl:"budibase:account:returnurl",OnboardingProcessCorrelationKey:BpmCorrelationKey.ONBOARDING};var TableNames=(p=>(p.USERS="ta_users",p))(TableNames||{});const BudibaseRoles={AppUser:"appUser",Developer:"developer",Creator:"creator",Admin:"admin",Owner:"owner"},BudibaseRoleOptionsOld=[{label:"Developer",value:BudibaseRoles.Developer}],BudibaseRoleOptions=[{label:"Account admin",value:BudibaseRoles.Admin,subtitle:"Has full access to all apps and settings in your account",sortOrder:1},{label:"Creator",value:BudibaseRoles.Creator,subtitle:"Can create and edit apps they have access to",sortOrder:2},{label:"App user",value:BudibaseRoles.AppUser,subtitle:"Can only use published apps they have access to",sortOrder:3}],ExtendedBudibaseRoleOptions=[{label:"Account holder",value:BudibaseRoles.Owner,sortOrder:0},...BudibaseRoleOptions,...BudibaseRoleOptionsOld],PlanType={FREE:"free",TEAM:"team",PRO:"pro",BUSINESS:"business",PREMIUM:"premium",ENTERPRISE:"enterprise",ENTERPRISE_BASIC_TRIAL:"enterprise_basic_trial"},ApiVersion="1",Roles={ADMIN:"ADMIN",POWER:"POWER",BASIC:"BASIC",PUBLIC:"PUBLIC",BUILDER:"BUILDER",CREATOR:"CREATOR"},EventPublishType={ENV_VAR_UPGRADE_PANEL_OPENED:"environment_variable_upgrade_panel_opened"},ContextScopes={Local:"local",Global:"global"},TypeIconMap={[FieldType.STRING]:"Text",[FieldType.OPTIONS]:"Dropdown",[FieldType.DATETIME]:"Calendar",[FieldType.BARCODEQR]:"Camera",[FieldType.SIGNATURE_SINGLE]:"AnnotatePen",[FieldType.LONGFORM]:"TextAlignLeft",[FieldType.ARRAY]:"Duplicate",[FieldType.NUMBER]:"123",[FieldType.BOOLEAN]:"Boolean",[FieldType.ATTACHMENTS]:"DocumentFragmentGroup",[FieldType.ATTACHMENT_SINGLE]:"DocumentFragment",[FieldType.LINK]:"DataCorrelated",[FieldType.FORMULA]:"Calculator",[FieldType.AI]:"MagicWand",[FieldType.JSON]:"Brackets",[FieldType.BIGINT]:"TagBold",[FieldType.AUTO]:"Shapes",[FieldType.BB_REFERENCE]:{[BBReferenceFieldSubType.USER]:"UserGroup",[BBReferenceFieldSubType.USERS]:"UserGroup"},[FieldType.BB_REFERENCE_SINGLE]:{[BBReferenceFieldSubType.USER]:"User"}},OptionColours=[...new Array(12).keys()].map(p=>`hsla(${(p+1)*222%360}, 90%, 75%, 0.3)`),FilterOperator={ANY:"any",ALL:"all"},OnEmptyFilter={RETURN_ALL:"all",RETURN_NONE:"none"},FilterValueType={BINDING:"Binding",VALUE:"Value"},FieldPermissions={WRITABLE:"writable",READONLY:"readonly",HIDDEN:"hidden"},Constants$2=Object.freeze(Object.defineProperty({__proto__:null,ApiVersion,BannedSearchTypes,BudibaseRoleOptions,BudibaseRoleOptionsOld,BudibaseRoles,ContextScopes,Cookies,DEFAULT_BB_DATASOURCE_ID,EventPublishType,ExtendedBudibaseRoleOptions,Features:Feature,FieldPermissions,FilterOperator,FilterValueType,OnEmptyFilter,OperatorOptions,OptionColours,PlanType,Roles,SqlNumberTypeRangeMap,TableNames,TypeIconMap},Symbol.toStringTag,{value:"Module"})),buildAnalyticsEndpoints=p=>({getAnalyticsStatus:async()=>await p.get({url:"/api/bbtel"}),analyticsPing:async u=>await p.post({url:"/api/bbtel/ping",body:{...u,timezone:Intl.DateTimeFormat().resolvedOptions().timeZone}})}),buildAIEndpoints=p=>({generateCronExpression:async u=>await p.post({url:"/api/ai/cron",body:{prompt:u}})}),buildAppEndpoints=p=>({fetchAppPackage:async u=>await p.get({url:`/api/applications/${u}/appPackage`}),saveAppMetadata:async(u,f)=>await p.put({url:`/api/applications/${u}`,body:f}),publishAppChanges:async u=>await p.post({url:`/api/applications/${u}/publish`}),revertAppChanges:async u=>await p.post({url:`/api/dev/${u}/revert`}),updateAppClientVersion:async u=>await p.post({url:`/api/applications/${u}/client/update`}),revertAppClientVersion:async u=>await p.post({url:`/api/applications/${u}/client/revert`}),getAppDeployments:async()=>await p.get({url:"/api/deployments"}),createApp:async u=>await p.post({url:"/api/applications",body:u,json:!1}),duplicateApp:async(u,f)=>await p.post({url:`/api/applications/${u}/duplicate`,body:f,json:!1}),updateAppFromExport:async(u,f)=>{const m=getDevAppID(u);return await p.post({url:`/api/applications/${m}/import`,body:f,json:!1})},importApps:async u=>await p.post({url:"/api/cloud/import",body:u,json:!1}),unpublishApp:async u=>await p.post({url:`/api/applications/${u}/unpublish`}),deleteApp:async u=>await p.delete({url:`/api/applications/${u}`}),releaseAppLock:async u=>await p.delete({url:`/api/dev/${u}/lock`}),fetchSystemDebugInfo:async()=>await p.get({url:"/api/debug/diagnostics"}),syncApp:async u=>await p.post({url:`/api/applications/${u}/sync`}),getApps:async()=>await p.get({url:"/api/applications?status=all"}),fetchComponentLibDefinitions:async u=>await p.get({url:`/api/${u}/components/definitions`}),addSampleData:async u=>await p.post({url:`/api/applications/${u}/sample`}),setRevertableVersion:async(u,f)=>await p.post({url:`/api/applications/${u}/setRevertableVersion`,body:{revertableVersion:f}})}),buildAttachmentEndpoints=p=>{const u={getSignedDatasourceURL:async(f,m,v)=>await p.post({url:`/api/attachments/${f}/url`,body:{bucket:m,key:v}})};return{...u,uploadAttachment:async(f,m)=>await p.post({url:`/api/attachments/${f}/upload`,body:m,json:!1}),uploadBuilderAttachment:async f=>await p.post({url:"/api/attachments/process",body:f,json:!1}),externalUpload:async(f,m,v,y)=>{const{signedUrl:w,publicUrl:k}=await u.getSignedDatasourceURL(f,m,v);return w?(await p.put({url:w,body:y,json:!1,external:!0,parseResponse:S=>S}),{publicUrl:k}):{publicUrl:void 0}},downloadAttachment:async(f,m,v)=>await p.get({url:`/api/${f}/rows/${m}/attachment/${v}`,parseResponse:y=>y,suppressErrors:!0})}},buildAuthEndpoints=p=>({logIn:async(u,f,m)=>await p.post({url:`/api/global/auth/${u}/login`,body:{username:f,password:m}}),logOut:async()=>await p.post({url:"/api/global/auth/logout"}),setInitInfo:async u=>await p.post({url:"/api/global/auth/init",body:u}),getInitInfo:async()=>await p.get({url:"/api/global/auth/init"}),requestForgotPassword:async(u,f)=>await p.post({url:`/api/global/auth/${u}/reset`,body:{email:f}}),resetPassword:async(u,f,m)=>await p.post({url:`/api/global/auth/${u}/reset/update`,body:{password:f,resetCode:m}})}),buildAutomationEndpoints=p=>({triggerAutomation:async(u,f,m)=>await p.post({url:`/api/automations/${u}/trigger`,body:{fields:f,timeout:m}}),testAutomation:async(u,f)=>await p.post({url:`/api/automations/${u}/test`,body:f}),getAutomations:async()=>await p.get({url:"/api/automations"}),getAutomationDefinitions:async()=>await p.get({url:"/api/automations/definitions/list"}),createAutomation:async u=>await p.post({url:"/api/automations",body:u}),updateAutomation:async u=>await p.put({url:"/api/automations",body:u}),deleteAutomation:async(u,f)=>await p.delete({url:`/api/automations/${u}/${f}`}),getAutomationLogs:async u=>await p.post({url:"/api/automations/logs/search",body:u}),clearAutomationLogErrors:async(u,f)=>await p.delete({url:"/api/automations/logs",body:{appId:f,automationId:u}})}),buildConfigEndpoints=p=>({saveConfig:async u=>await p.post({url:"/api/global/configs",body:u}),getConfig:async u=>await p.get({url:`/api/global/configs/${u}`}),deleteConfig:async(u,f)=>await p.delete({url:`/api/global/configs/${u}/${f}`}),getTenantConfig:async u=>await p.get({url:`/api/global/configs/public?tenantId=${u}`}),getOIDCConfigs:async u=>await p.get({url:`/api/global/configs/public/oidc?tenantId=${u}`}),getChecklist:async u=>await p.get({url:`/api/global/configs/checklist?tenantId=${u}`}),uploadLogo:async u=>await p.post({url:"/api/global/configs/upload/settings/logoUrl",body:u,json:!1}),uploadFavicon:async u=>await p.post({url:"/api/global/configs/upload/settings/faviconUrl",body:u,json:!1}),uploadOIDCLogo:async(u,f)=>await p.post({url:`/api/global/configs/upload/logos_oidc/${u}`,body:f,json:!1}),getOIDCLogos:async()=>await p.get({url:"/api/global/configs/logos_oidc"})}),buildDatasourceEndpoints=p=>({getDatasources:async()=>await p.get({url:"/api/datasources"}),buildDatasourceSchema:async(u,f)=>await p.post({url:`/api/datasources/${u}/schema`,body:{tablesFilter:f}}),createDatasource:async u=>await p.post({url:"/api/datasources",body:u}),updateDatasource:async u=>await p.put({url:`/api/datasources/${u._id}`,body:u}),deleteDatasource:async(u,f)=>await p.delete({url:`/api/datasources/${u}/${f}`}),validateDatasource:async u=>await p.post({url:"/api/datasources/verify",body:{datasource:u}}),fetchInfoForDatasource:async u=>await p.post({url:"/api/datasources/info",body:{datasource:u}}),fetchExternalSchema:async u=>await p.get({url:`/api/datasources/${u}/schema/external`})}),buildFlagEndpoints=p=>({getFlags:async()=>await p.get({url:"/api/users/flags"}),updateFlag:async(u,f)=>await p.post({url:"/api/users/flags",body:{flag:u,value:f}}),toggleUiFeature:async u=>await p.post({url:`/api/beta/${u}`})}),buildLayoutEndpoints=p=>({saveLayout:async u=>await p.post({url:"/api/layouts",body:u}),deleteLayout:async(u,f)=>await p.delete({url:`/api/layouts/${u}/${f}`})}),buildOtherEndpoints=p=>({getEnvironment:async()=>await p.get({url:"/api/system/environment"}),getSystemStatus:async()=>await p.get({url:"/api/system/status"}),getIntegrations:async()=>await p.get({url:"/api/integrations"}),getBudibaseVersion:async()=>(await p.get({url:"/api/dev/version"})).version,getBasePermissions:async()=>await p.get({url:"/api/permission/builtin"})}),buildPermissionsEndpoints=p=>({getPermissionForResource:async u=>await p.get({url:`/api/permission/${u}`}),updatePermissionForResource:async(u,f,m)=>await p.post({url:`/api/permission/${f}/${u}/${m}`}),removePermissionFromResource:async(u,f,m)=>await p.delete({url:`/api/permission/${f}/${u}/${m}`}),getDependants:async u=>await p.get({url:`/api/permission/${u}/dependants`})}),buildQueryEndpoints=p=>({executeQuery:async(u,{pagination:f,parameters:m}={})=>await p.post({url:`/api/v2/queries/${u}`,body:{parameters:m,pagination:f}}),fetchQueryDefinition:async u=>await p.get({url:`/api/queries/${u}`,cache:!0}),getQueries:async()=>await p.get({url:"/api/queries"}),saveQuery:async u=>await p.post({url:"/api/queries",body:u}),deleteQuery:async(u,f)=>await p.delete({url:`/api/queries/${u}/${f}`}),importQueries:async u=>await p.post({url:"/api/queries/import",body:u}),previewQuery:async u=>await p.post({url:"/api/queries/preview",body:u})}),buildRelationshipEndpoints=p=>({fetchRelationshipData:async(u,f,m)=>{const v=await p.get({url:`/api/${u}/${f}/enrich?field=${m}`});return m?v[m]||[]:[v]}}),buildRoleEndpoints=p=>({deleteRole:async(u,f)=>await p.delete({url:`/api/roles/${u}/${f}`}),saveRole:async u=>await p.post({url:"/api/roles",body:u}),getRoles:async()=>await p.get({url:"/api/roles"}),getRolesForApp:async u=>await p.get({url:`/api/global/roles/${u}`}),getAccessibleRoles:async()=>await p.get({url:"/api/roles/accessible"})}),buildRouteEndpoints=p=>({fetchClientAppRoutes:async()=>await p.get({url:"/api/routing/client"}),fetchAppRoutes:async()=>await p.get({url:"/api/routing"})}),buildRowEndpoints=p=>({fetchRow:async(u,f)=>await p.get({url:`/api/${u}/rows/${f}`}),saveRow:async(u,f=!1)=>{const m=u._viewId||u.tableId;return await p.post({url:`/api/${m}/rows`,body:u,suppressErrors:f})},patchRow:async(u,f=!1)=>{const m=u._viewId||u.tableId;return await p.patch({url:`/api/${m}/rows`,body:u,suppressErrors:f})},deleteRow:async(u,f)=>await p.delete({url:`/api/${u}/rows`,body:{_id:f}}),deleteRows:async(u,f)=>(f.forEach(m=>{typeof m=="object"&&(m==null||delete m._viewId)}),await p.delete({url:`/api/${u}/rows`,body:{rows:f}})),exportRows:async(u,f,m)=>await p.post({url:`/api/${u}/rows/exportRows?format=${f}`,body:m,parseResponse:async v=>await v.text()})}),buildScreenEndpoints=p=>({saveScreen:async u=>await p.post({url:"/api/screens",body:u}),deleteScreen:async(u,f)=>await p.delete({url:`/api/screens/${u}/${f}`}),usageInScreens:async u=>await p.post({url:`/api/screens/usage/${u}`})}),buildTableEndpoints=p=>({fetchTableDefinition:async u=>await p.get({url:`/api/tables/${u}`,cache:!0}),fetchTableData:async u=>await p.get({url:`/api/${u}/rows`}),searchTable:async(u,f)=>await p.post({url:`/api/${u}/search`,body:f}),importTableData:async(u,f,m)=>await p.post({url:`/api/tables/${u}/import`,body:{rows:f,identifierFields:m}}),csvToJson:async u=>await p.post({url:"/api/convert/csvToJson",body:{csvString:u}}),getTables:async()=>await p.get({url:"/api/tables"}),getTable:async u=>await p.get({url:`/api/tables/${u}`}),saveTable:async u=>await p.post({url:"/api/tables",body:u}),deleteTable:async(u,f)=>await p.delete({url:`/api/tables/${u}/${f}`}),validateNewTableImport:async(u,f)=>await p.post({url:"/api/tables/validateNewTableImport",body:{rows:u,schema:f}}),validateExistingTableImport:async(u,f)=>await p.post({url:"/api/tables/validateExistingTableImport",body:{rows:u,tableId:f}}),migrateColumn:async(u,f,m)=>await p.post({url:`/api/tables/${u}/migrate`,body:{oldColumn:f,newColumn:m}})}),buildTemplateEndpoints=p=>({getEmailTemplateDefinitions:async()=>await p.get({url:"/api/global/template/definitions"}),getEmailTemplates:async()=>await p.get({url:"/api/global/template/email"}),saveEmailTemplate:async u=>await p.post({url:"/api/global/template",body:u}),getAppTemplates:async()=>await p.get({url:"/api/templates"})}),buildUserEndpoints=p=>({getUsers:async()=>await p.get({url:"/api/global/users"}),searchUsers:async u=>await p.post({url:"/api/global/users/search",body:u}),getUser:async u=>await p.get({url:`/api/global/users/${u}`}),updateOwnMetadata:async u=>await p.post({url:"/api/users/metadata/self",body:u}),createAdminUser:async u=>await p.post({url:"/api/global/users/init",body:u}),saveUser:async u=>await p.post({url:"/api/global/users",body:u}),createUsers:async(u,f)=>(await p.post({url:"/api/global/users/bulk",body:{create:{users:u,groups:f}}})).created,deleteUser:async u=>await p.delete({url:`/api/global/users/${u}`}),deleteUsers:async u=>(await p.post({url:"/api/global/users/bulk",body:{delete:{users:u}}})).deleted,onboardUsers:async u=>await p.post({url:"/api/global/users/onboard",body:u}),updateUserInvite:async(u,f)=>await p.post({url:`/api/global/users/invite/update/${u}`,body:f}),getUserInvite:async u=>await p.get({url:`/api/global/users/invite/${u}`}),getUserInvites:async()=>await p.get({url:"/api/global/users/invites"}),inviteUsers:async u=>await p.post({url:"/api/global/users/multi/invite",body:u}),removeUserInvites:async u=>await p.post({url:"/api/global/users/multi/invite/delete",body:u}),acceptInvite:async u=>await p.post({url:"/api/global/users/invite/accept",body:u}),getUserCountByApp:async u=>(await p.get({url:`/api/global/users/count/${u}`})).userCount,addAppBuilder:async(u,f)=>await p.post({url:`/api/global/users/${u}/app/${f}/builder`}),removeAppBuilder:async(u,f)=>await p.delete({url:`/api/global/users/${u}/app/${f}/builder`}),getAccountHolder:async()=>await p.get({url:"/api/global/users/accountholder"})}),buildSelfEndpoints=p=>({generateAPIKey:async()=>{const u=await p.post({url:"/api/global/self/api_key"});return u==null?void 0:u.apiKey},fetchDeveloperInfo:async()=>p.get({url:"/api/global/self/api_key"}),fetchSelf:async()=>await p.get({url:"/api/self"}),fetchBuilderSelf:async()=>await p.get({url:"/api/global/self"}),updateSelf:async u=>await p.post({url:"/api/global/self",body:u})}),buildViewEndpoints=p=>({fetchViewData:async(u,{field:f,groupBy:m,calculation:v})=>{const y=new URLSearchParams;v&&(f&&y.set("field",f),y.set("calculation",v)),m&&y.set("group",m);const w=f?`/api/views/${encodeURIComponent(u)}?${y}`:`/api/views/${encodeURIComponent(u)}`;return await p.get({url:w})},exportView:async(u,f)=>{const m=encodeURIComponent(u);return await p.get({url:`/api/views/export?view=${m}&format=${f}`,parseResponse:async v=>await v.text()})},saveView:async u=>await p.post({url:"/api/views",body:u}),deleteView:async u=>await p.delete({url:`/api/views/${encodeURIComponent(u)}`})}),buildViewV2Endpoints=p=>({fetchDefinition:async u=>await p.get({url:`/api/v2/views/${encodeURIComponent(u)}`,cache:!0}),create:async u=>await p.post({url:"/api/v2/views",body:u}),update:async u=>await p.put({url:`/api/v2/views/${encodeURIComponent(u.id)}`,body:u}),fetch:async(u,f)=>await p.post({url:`/api/v2/views/${encodeURIComponent(u)}/search`,body:f}),delete:async u=>await p.delete({url:`/api/v2/views/${encodeURIComponent(u)}`})}),buildLicensingEndpoints=p=>({activateLicenseKey:async u=>p.post({url:"/api/global/license/key",body:{licenseKey:u}}),deleteLicenseKey:async()=>p.delete({url:"/api/global/license/key"}),getLicenseKey:async()=>{try{return await p.get({url:"/api/global/license/key"})}catch(u){if(u.status!==404)throw u}},activateOfflineLicense:async u=>p.post({url:"/api/global/license/offline",body:{offlineLicenseToken:u}}),deleteOfflineLicense:async()=>p.delete({url:"/api/global/license/offline"}),getOfflineLicense:async()=>{try{return await p.get({url:"/api/global/license/offline"})}catch(u){if(u.status!==404)throw u}},getOfflineLicenseIdentifier:async()=>await p.get({url:"/api/global/license/offline/identifier"}),refreshLicense:async()=>p.post({url:"/api/global/license/refresh"}),getQuotaUsage:async()=>p.get({url:"/api/global/license/usage"})}),buildGroupsEndpoints=p=>{async function u(f,m,v,y){return await p.post({url:`/api/global/groups/${f}/${m}`,body:{[v]:y}})}return{saveGroup:async f=>await p.post({url:"/api/global/groups",body:f}),getGroups:async()=>(await p.get({url:"/api/global/groups"})).data,getGroup:async f=>await p.get({url:`/api/global/groups/${f}`}),deleteGroup:async(f,m)=>await p.delete({url:`/api/global/groups/${f}/${m}`}),getGroupUsers:async({id:f,bookmark:m,emailSearch:v})=>{let y=`/api/global/groups/${f}/users?`;return m&&(y+=`bookmark=${m}&`),v&&(y+=`emailSearch=${v}`),await p.get({url:y})},addUsersToGroup:async(f,m)=>u(f,"users","add",m),removeUsersFromGroup:async(f,m)=>u(f,"users","remove",m),addAppsToGroup:async(f,m)=>u(f,"apps","add",m),removeAppsFromGroup:async(f,m)=>u(f,"apps","remove",m),addGroupAppBuilder:async(f,m)=>await p.post({url:`/api/global/groups/${f}/app/${m}/builder`}),removeGroupAppBuilder:async(f,m)=>await p.delete({url:`/api/global/groups/${f}/app/${m}/builder`})}},buildPluginEndpoints=p=>({uploadPlugin:async u=>await p.post({url:"/api/plugin/upload",body:u,json:!1}),createPlugin:async u=>await p.post({url:"/api/plugin",body:u}),getPlugins:async()=>await p.get({url:"/api/plugin"}),deletePlugin:async u=>await p.delete({url:`/api/plugin/${u}`})}),buildBackupEndpoints=p=>({createManualBackup:async u=>await p.post({url:`/api/apps/${u}/backups`}),searchBackups:async(u,f)=>await p.post({url:`/api/apps/${u}/backups/search`,body:f}),deleteBackup:async(u,f)=>await p.delete({url:`/api/apps/${u}/backups/${f}`}),restoreBackup:async(u,f,m)=>await p.post({url:`/api/apps/${u}/backups/${f}/import`,body:{name:m}})}),buildEnvironmentVariableEndpoints=p=>({checkEnvironmentVariableStatus:async()=>await p.get({url:"/api/env/variables/status"}),fetchEnvironmentVariables:async()=>await p.get({url:"/api/env/variables",json:!1}),createEnvironmentVariable:async u=>await p.post({url:"/api/env/variables",body:u}),deleteEnvironmentVariable:async u=>await p.delete({url:`/api/env/variables/${u}`}),updateEnvironmentVariable:async(u,f)=>await p.patch({url:`/api/env/variables/${u}`,body:f})}),buildEventEndpoints=p=>({publishEvent:async u=>await p.post({url:"/api/global/event/publish",body:{type:u}})}),buildAuditLogEndpoints=p=>({searchAuditLogs:async u=>await p.post({url:"/api/global/auditlogs/search",body:u}),getEventDefinitions:async()=>await p.get({url:"/api/global/auditlogs/definitions"}),getDownloadUrl:u=>`/api/global/auditlogs/download?query=${encodeURIComponent(JSON.stringify(u))}`}),buildLogsEndpoints=p=>({getSystemLogs:async()=>await p.get({url:"/api/system/logs",json:!1,parseResponse:async u=>u})}),buildMigrationEndpoints=p=>({getMigrationStatus:async()=>await p.get({url:"/api/migrations/status"})}),buildRowActionEndpoints=p=>({fetch:async u=>(await p.get({url:`/api/tables/${u}/actions`})).actions,create:async(u,f)=>await p.post({url:`/api/tables/${u}/actions`,body:{name:f}}),delete:async(u,f)=>await p.delete({url:`/api/tables/${u}/actions/${f}`}),enableView:async(u,f,m)=>await p.post({url:`/api/tables/${u}/actions/${f}/permissions/${m}`}),disableView:async(u,f,m)=>await p.delete({url:`/api/tables/${u}/actions/${f}/permissions/${m}`}),trigger:async(u,f,m)=>await p.post({url:`/api/tables/${u}/actions/${f}/trigger`,body:{rowId:m}})}),APISessionID=uuid(),createAPIClient=(p={})=>{let u={};const f=async(M,T,E=!1)=>{let H=M.statusText,F=null;try{F=await M.json(),F!=null&&F.message?H=F.message:F!=null&&F.error&&(H=JSON.stringify(F.error))}catch{}return{message:H,json:F,status:M.status,url:M.url,method:T,handled:!0,suppressErrors:E}},m=(M,T,E)=>({message:M,json:null,status:400,url:T,method:E,handled:!0,suppressErrors:!1}),v=async M=>{let{json:T,method:E,external:H,body:F,url:Z,parseResponse:$,suppressErrors:J}=M;T=T&&E!==HTTPMethod.GET;let se={Accept:"application/json"};se[Header.SESSION_ID]=APISessionID,H||(se[Header.API_VER]=ApiVersion),T&&(se["Content-Type"]="application/json"),p!=null&&p.attachHeaders&&p.attachHeaders(se);let ie=F;if(T)try{ie=JSON.stringify(F)}catch{throw m("Invalid JSON body",Z,E)}let he;try{he=await fetch(Z,{method:E,headers:se,body:ie,credentials:"same-origin"})}catch{throw delete u[Z],m("Failed to send request",Z,E)}if(he.status>=200&&he.status<400){y(he);try{return he.status===204?void 0:$?await $(he):await he.json()}catch(fe){throw delete u[Z],`Failed to parse response: ${fe}`}}else throw delete u[Z],await f(he,E,J)},y=M=>{if(!p.onMigrationDetected)return;const T=M.headers.get(Header.MIGRATING_APP);T&&p.onMigrationDetected(T)},w=async M=>{const T=M.url;return u[T]||(u[T]=v(M),u[T]=await u[T]),await u[T]},k=M=>async T=>{try{let E={json:!0,external:!1,suppressErrors:!1,cache:!1,method:M,...T},{url:H,cache:F,external:Z}=E;return Z||(E.url=`/${H}`.replace("//","/")),await(F&&(p==null?void 0:p.enableCaching)?w:v)(E)}catch(E){throw p!=null&&p.onError&&p.onError(E),E}};let S={post:k(HTTPMethod.POST),get:k(HTTPMethod.GET),patch:k(HTTPMethod.PATCH),delete:k(HTTPMethod.DELETE),put:k(HTTPMethod.PUT),invalidateCache:()=>{u={}},getAppID:()=>{var T;let M={};return(T=p==null?void 0:p.attachHeaders)==null||T.call(p,M),M==null?void 0:M[Header.APP_ID]}};return{...S,...buildAIEndpoints(S),...buildAnalyticsEndpoints(S),...buildAppEndpoints(S),...buildAttachmentEndpoints(S),...buildAuthEndpoints(S),...buildAutomationEndpoints(S),...buildConfigEndpoints(S),...buildDatasourceEndpoints(S),...buildFlagEndpoints(S),...buildLayoutEndpoints(S),...buildOtherEndpoints(S),...buildPermissionsEndpoints(S),...buildQueryEndpoints(S),...buildRelationshipEndpoints(S),...buildRoleEndpoints(S),...buildRouteEndpoints(S),...buildRowEndpoints(S),...buildScreenEndpoints(S),...buildTableEndpoints(S),...buildTemplateEndpoints(S),...buildUserEndpoints(S),...buildViewEndpoints(S),...buildSelfEndpoints(S),...buildLicensingEndpoints(S),...buildGroupsEndpoints(S),...buildPluginEndpoints(S),...buildBackupEndpoints(S),...buildEnvironmentVariableEndpoints(S),...buildEventEndpoints(S),...buildAuditLogEndpoints(S),...buildLogsEndpoints(S),...buildMigrationEndpoints(S),viewV2:buildViewV2Endpoints(S),rowActions:buildRowActionEndpoints(S)}},getJSONArrayDatasourceSchema=(p,u)=>{let f=p,m=[];u.prefixKeys&&(m=u.prefixKeys.concat(["schema"])),m=m.concat(u.label.split(".").slice(2));for(let v=0;v<m.length;v++)f=f==null?void 0:f[m[v]],f!=null&&f.schema&&(f=f.schema);return convertJSONSchemaToTableSchema(f,{squashObjects:!0,prefixKeys:m})},convertJSONSchemaToTableSchema=(p,u)=>{if(!p)return null;u={squashObjects:!1,prefixKeys:null,...u},p.schema?p=p.schema:p={value:p};const f=extractJSONSchemaKeys(p,u.squashObjects);let m={};return f.forEach(({key:v,type:y})=>{m[v]={type:y,name:v,prefixKeys:u.prefixKeys}}),m},extractJSONSchemaKeys=(p,u=!1)=>{if(!p||!Object.keys(p).length)return[];let f=[];return Object.keys(p).forEach(m=>{const v=p[m].type;if(v==="json"&&u){const y=extractJSONSchemaKeys(p[m].schema,u);f=f.concat(y.map(w=>({key:`${m}.${w.key}`,type:w.type})))}else f.push({key:m,type:v==="array"?"jsonarray":v})}),f},generateQueryArraySchemas=(p,u)=>{var f,m;for(let v in p)((f=p[v])==null?void 0:f.type)==="json"&&((m=p[v])==null?void 0:m.subtype)==="array"&&hasSchema(u[v])&&(p[v]={schema:{schema:Object.entries(u[v]||{}).reduce((y,[w,k])=>(y[w]={name:w,type:k.type,subtype:k.subtype},y),{}),type:"json"},type:"json",subtype:"array"});return p};function setCookie(p,u,f){getCookie(p)&&removeCookie(p);let m=`${p}=${u}; Path=/;`;f&&(m+=` Domain=${f};`),window.document.cookie=m}function getCookie(p){const f=`; ${document.cookie}`.split(`; ${p}=`);if(f.length===2)return f[1].split(";").shift()}function removeCookie(p){getCookie(p)&&(document.cookie=`${p}=; Max-Age=-99999999; Path=/;`)}const RolePriorities={[Roles.ADMIN]:5,[Roles.CREATOR]:4,[Roles.POWER]:3,[Roles.BASIC]:2,[Roles.PUBLIC]:1},getRolePriority=p=>RolePriorities[p]??0,sleep=p=>new Promise(u=>setTimeout(u,p)),debounce=(p,u=1e3)=>{let f;return async(...m)=>new Promise(v=>{f&&clearTimeout(f),f=setTimeout(async()=>{v(await p(...m))},u)})},throttle=(p,u=1e3)=>{let f,m=!1,v=!1;const y=(...w)=>{if(f=w,m){v=!0;return}p(...f),m=!0,setTimeout(()=>{m=!1,v&&(v=!1,y(...f))},u)};return y},domDebounce=p=>{let u=!1,f;return(...m)=>{f=m,u||(u=!0,requestAnimationFrame(()=>{p(...f),u=!1}))}},buildFormBlockButtonConfig=p=>{const{_id:u,actionType:f,dataSource:m,notificationOverride:v,actionUrl:y,showDeleteButton:w,deleteButtonLabel:k,showSaveButton:S,saveButtonLabel:M}=p||{};if(!u)return;const T=`${u}-form`,E=`${u}-repeater`,H=m==null?void 0:m.resourceId,F=w===!1?"":k==null?void 0:k.trim(),Z=S===!1?"":M==null?void 0:M.trim(),$=[{"##eventHandlerType":"Validate Form",parameters:{componentId:T}},{"##eventHandlerType":"Save Row",parameters:{providerId:T,tableId:H,notificationOverride:v,confirm:null}},{"##eventHandlerType":"Close Screen Modal"},{"##eventHandlerType":"Close Side Panel"},{"##eventHandlerType":"Close Modal"},...f!=="Create"?[]:[{"##eventHandlerType":"Clear Form",parameters:{componentId:T}}],...y?[{"##eventHandlerType":"Navigate To",parameters:{url:y}}]:[]],J=[{"##eventHandlerType":"Delete Row",parameters:{confirm:!0,tableId:H,rowId:`{{ ${makePropSafe(E)}.${makePropSafe("_id")} }}`,revId:`{{ ${makePropSafe(E)}.${makePropSafe("_rev")} }}`,notificationOverride:v}},{"##eventHandlerType":"Close Screen Modal"},{"##eventHandlerType":"Close Side Panel"},{"##eventHandlerType":"Close Modal"},...y?[{"##eventHandlerType":"Navigate To",parameters:{url:y}}]:[]],se=[];return f&&["Update","Create"].includes(f)&&S!==!1&&se.push({text:Z||"Save",_id:uuid(),_component:"@budibase/standard-components/button",onClick:$,type:"cta"}),f==="Update"&&w!==!1&&se.push({text:F||"Delete",_id:uuid(),_component:"@budibase/standard-components/button",onClick:J,quiet:!0,type:"warning"}),se},buildMultiStepFormBlockDefaultProps=p=>{const{_id:u,stepCount:f,currentStep:m,actionType:v,dataSource:y}=p||{};if(!u||!f)return;const w=`Step {{ [${u}-form].[__currentStep] }}`,k=y==null?void 0:y.resourceId,S=`${u}-form`;let M=[];return m!==0&&M.push({_id:uuid(),_component:"@budibase/standard-components/button",_instanceName:uuid(),text:"Back",type:"secondary",size:"M",onClick:[{parameters:{type:"prev",componentId:S},"##eventHandlerType":"Change Form Step"}]}),m!==f-1&&M.push({_id:uuid(),_component:"@budibase/standard-components/button",_instanceName:uuid(),text:"Next",type:"cta",size:"M",onClick:[{"##eventHandlerType":"Validate Form",parameters:{componentId:S}},{parameters:{type:"next",componentId:S},"##eventHandlerType":"Change Form Step"}]}),v!=="View"&&m===f-1&&M.push({_id:uuid(),_component:"@budibase/standard-components/button",_instanceName:uuid(),text:"Save",type:"cta",size:"M",onClick:[{"##eventHandlerType":"Validate Form",parameters:{componentId:S}},{"##eventHandlerType":"Save Row",parameters:{tableId:k,providerId:S}},...v!=="Create"?[]:[{"##eventHandlerType":"Clear Form",parameters:{componentId:S}}]]}),{buttons:M,title:w}};function parseFilter(p){var f;if(!(p!=null&&p.groups))return p;const u=lodashExports.cloneDeep(p);return u.groups=(f=u.groups)==null?void 0:f.map(m=>{var v,y;return m.filters=(v=m.filters)==null?void 0:v.filter(w=>w.field&&w.operator),(y=m.filters)!=null&&y.length?m:null}).filter(m=>!!m),u}const isBetterSample=(p,u)=>{if(u==null&&p!=null)return!0;if(u!=null&&p==null)return!1;const f=typeof u,m=typeof p;return f!==m?!1:m==="string"&&p.length>u.length||m==="object"&&Object.keys(p).length>Object.keys(u).length},generateGoldenSample=p=>{let u={};return p==null||p.slice(0,100).forEach(f=>{Object.keys(f).forEach(m=>{isBetterSample(f[m],u[m])&&(u[m]=f[m])})}),u},getColumnIcon=p=>{if(p.schema.icon)return p.schema.icon;if(p.calculationType)return"Calculator";if(p.schema.autocolumn)return"MagicWand";if(isDeprecatedSingleUserColumn(p.schema))return"User";const{type:u,subtype:f}=p.schema;return(typeof TypeIconMap[u]=="object"&&f?TypeIconMap[u][f]:TypeIconMap[u])||"Text"},memo=p=>{const u=writable(p);let f=JSON.stringify(p);const m=v=>{const y=JSON.stringify(v);y!==f&&(u.set(v),f=y)};return{subscribe:u.subscribe,set:m,update:v=>{let y=JSON.parse(f);const w=v(y);m(w)}}},derivedMemo=(p,u)=>{const f=derived(p,u),m=memo(get_store_value(f));return f.subscribe(m.set),m},PACKET_TYPES=Object.create(null);PACKET_TYPES.open="0",PACKET_TYPES.close="1",PACKET_TYPES.ping="2",PACKET_TYPES.pong="3",PACKET_TYPES.message="4",PACKET_TYPES.upgrade="5",PACKET_TYPES.noop="6";const PACKET_TYPES_REVERSE=Object.create(null);Object.keys(PACKET_TYPES).forEach(p=>{PACKET_TYPES_REVERSE[PACKET_TYPES[p]]=p});const ERROR_PACKET={type:"error",data:"parser error"},withNativeBlob$1=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",withNativeArrayBuffer$2=typeof ArrayBuffer=="function",isView$1=p=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(p):p&&p.buffer instanceof ArrayBuffer,encodePacket=({type:p,data:u},f,m)=>withNativeBlob$1&&u instanceof Blob?f?m(u):encodeBlobAsBase64(u,m):withNativeArrayBuffer$2&&(u instanceof ArrayBuffer||isView$1(u))?f?m(u):encodeBlobAsBase64(new Blob([u]),m):m(PACKET_TYPES[p]+(u||"")),encodeBlobAsBase64=(p,u)=>{const f=new FileReader;return f.onload=function(){const m=f.result.split(",")[1];u("b"+(m||""))},f.readAsDataURL(p)};function toArray(p){return p instanceof Uint8Array?p:p instanceof ArrayBuffer?new Uint8Array(p):new Uint8Array(p.buffer,p.byteOffset,p.byteLength)}let TEXT_ENCODER;function encodePacketToBinary(p,u){if(withNativeBlob$1&&p.data instanceof Blob)return p.data.arrayBuffer().then(toArray).then(u);if(withNativeArrayBuffer$2&&(p.data instanceof ArrayBuffer||isView$1(p.data)))return u(toArray(p.data));encodePacket(p,!1,f=>{TEXT_ENCODER||(TEXT_ENCODER=new TextEncoder),u(TEXT_ENCODER.encode(f))})}const chars="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",lookup$2=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let p=0;p<chars.length;p++)lookup$2[chars.charCodeAt(p)]=p;const decode$2=p=>{let u=p.length*.75,f=p.length,m,v=0,y,w,k,S;p[p.length-1]==="="&&(u--,p[p.length-2]==="="&&u--);const M=new ArrayBuffer(u),T=new Uint8Array(M);for(m=0;m<f;m+=4)y=lookup$2[p.charCodeAt(m)],w=lookup$2[p.charCodeAt(m+1)],k=lookup$2[p.charCodeAt(m+2)],S=lookup$2[p.charCodeAt(m+3)],T[v++]=y<<2|w>>4,T[v++]=(w&15)<<4|k>>2,T[v++]=(k&3)<<6|S&63;return M},withNativeArrayBuffer$1=typeof ArrayBuffer=="function",decodePacket=(p,u)=>{if(typeof p!="string")return{type:"message",data:mapBinary(p,u)};const f=p.charAt(0);return f==="b"?{type:"message",data:decodeBase64Packet(p.substring(1),u)}:PACKET_TYPES_REVERSE[f]?p.length>1?{type:PACKET_TYPES_REVERSE[f],data:p.substring(1)}:{type:PACKET_TYPES_REVERSE[f]}:ERROR_PACKET},decodeBase64Packet=(p,u)=>{if(withNativeArrayBuffer$1){const f=decode$2(p);return mapBinary(f,u)}else return{base64:!0,data:p}},mapBinary=(p,u)=>{switch(u){case"blob":return p instanceof Blob?p:new Blob([p]);case"arraybuffer":default:return p instanceof ArrayBuffer?p:p.buffer}},SEPARATOR=String.fromCharCode(30),encodePayload=(p,u)=>{const f=p.length,m=new Array(f);let v=0;p.forEach((y,w)=>{encodePacket(y,!1,k=>{m[w]=k,++v===f&&u(m.join(SEPARATOR))})})},decodePayload=(p,u)=>{const f=p.split(SEPARATOR),m=[];for(let v=0;v<f.length;v++){const y=decodePacket(f[v],u);if(m.push(y),y.type==="error")break}return m};function createPacketEncoderStream(){return new TransformStream({transform(p,u){encodePacketToBinary(p,f=>{const m=f.length;let v;if(m<126)v=new Uint8Array(1),new DataView(v.buffer).setUint8(0,m);else if(m<65536){v=new Uint8Array(3);const y=new DataView(v.buffer);y.setUint8(0,126),y.setUint16(1,m)}else{v=new Uint8Array(9);const y=new DataView(v.buffer);y.setUint8(0,127),y.setBigUint64(1,BigInt(m))}p.data&&typeof p.data!="string"&&(v[0]|=128),u.enqueue(v),u.enqueue(f)})}})}let TEXT_DECODER;function totalLength(p){return p.reduce((u,f)=>u+f.length,0)}function concatChunks(p,u){if(p[0].length===u)return p.shift();const f=new Uint8Array(u);let m=0;for(let v=0;v<u;v++)f[v]=p[0][m++],m===p[0].length&&(p.shift(),m=0);return p.length&&m<p[0].length&&(p[0]=p[0].slice(m)),f}function createPacketDecoderStream(p,u){TEXT_DECODER||(TEXT_DECODER=new TextDecoder);const f=[];let m=0,v=-1,y=!1;return new TransformStream({transform(w,k){for(f.push(w);;){if(m===0){if(totalLength(f)<1)break;const S=concatChunks(f,1);y=(S[0]&128)===128,v=S[0]&127,v<126?m=3:v===126?m=1:m=2}else if(m===1){if(totalLength(f)<2)break;const S=concatChunks(f,2);v=new DataView(S.buffer,S.byteOffset,S.length).getUint16(0),m=3}else if(m===2){if(totalLength(f)<8)break;const S=concatChunks(f,8),M=new DataView(S.buffer,S.byteOffset,S.length),T=M.getUint32(0);if(T>Math.pow(2,53-32)-1){k.enqueue(ERROR_PACKET);break}v=T*Math.pow(2,32)+M.getUint32(4),m=3}else{if(totalLength(f)<v)break;const S=concatChunks(f,v);k.enqueue(decodePacket(y?S:TEXT_DECODER.decode(S),u)),m=0}if(v===0||v>p){k.enqueue(ERROR_PACKET);break}}}})}const protocol$1=4;function Emitter(p){if(p)return mixin(p)}function mixin(p){for(var u in Emitter.prototype)p[u]=Emitter.prototype[u];return p}Emitter.prototype.on=Emitter.prototype.addEventListener=function(p,u){return this._callbacks=this._callbacks||{},(this._callbacks["$"+p]=this._callbacks["$"+p]||[]).push(u),this},Emitter.prototype.once=function(p,u){function f(){this.off(p,f),u.apply(this,arguments)}return f.fn=u,this.on(p,f),this},Emitter.prototype.off=Emitter.prototype.removeListener=Emitter.prototype.removeAllListeners=Emitter.prototype.removeEventListener=function(p,u){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var f=this._callbacks["$"+p];if(!f)return this;if(arguments.length==1)return delete this._callbacks["$"+p],this;for(var m,v=0;v<f.length;v++)if(m=f[v],m===u||m.fn===u){f.splice(v,1);break}return f.length===0&&delete this._callbacks["$"+p],this},Emitter.prototype.emit=function(p){this._callbacks=this._callbacks||{};for(var u=new Array(arguments.length-1),f=this._callbacks["$"+p],m=1;m<arguments.length;m++)u[m-1]=arguments[m];if(f){f=f.slice(0);for(var m=0,v=f.length;m<v;++m)f[m].apply(this,u)}return this},Emitter.prototype.emitReserved=Emitter.prototype.emit,Emitter.prototype.listeners=function(p){return this._callbacks=this._callbacks||{},this._callbacks["$"+p]||[]},Emitter.prototype.hasListeners=function(p){return!!this.listeners(p).length};const globalThisShim=(()=>typeof self<"u"?self:typeof window<"u"?window:Function("return this")())();function pick(p,...u){return u.reduce((f,m)=>(p.hasOwnProperty(m)&&(f[m]=p[m]),f),{})}const NATIVE_SET_TIMEOUT=globalThisShim.setTimeout,NATIVE_CLEAR_TIMEOUT=globalThisShim.clearTimeout;function installTimerFunctions(p,u){u.useNativeTimers?(p.setTimeoutFn=NATIVE_SET_TIMEOUT.bind(globalThisShim),p.clearTimeoutFn=NATIVE_CLEAR_TIMEOUT.bind(globalThisShim)):(p.setTimeoutFn=globalThisShim.setTimeout.bind(globalThisShim),p.clearTimeoutFn=globalThisShim.clearTimeout.bind(globalThisShim))}const BASE64_OVERHEAD=1.33;function byteLength(p){return typeof p=="string"?utf8Length(p):Math.ceil((p.byteLength||p.size)*BASE64_OVERHEAD)}function utf8Length(p){let u=0,f=0;for(let m=0,v=p.length;m<v;m++)u=p.charCodeAt(m),u<128?f+=1:u<2048?f+=2:u<55296||u>=57344?f+=3:(m++,f+=4);return f}function encode$2(p){let u="";for(let f in p)p.hasOwnProperty(f)&&(u.length&&(u+="&"),u+=encodeURIComponent(f)+"="+encodeURIComponent(p[f]));return u}function decode$1(p){let u={},f=p.split("&");for(let m=0,v=f.length;m<v;m++){let y=f[m].split("=");u[decodeURIComponent(y[0])]=decodeURIComponent(y[1])}return u}class TransportError extends Error{constructor(u,f,m){super(u),this.description=f,this.context=m,this.type="TransportError"}}class Transport extends Emitter{constructor(u){super(),this.writable=!1,installTimerFunctions(this,u),this.opts=u,this.query=u.query,this.socket=u.socket}onError(u,f,m){return super.emitReserved("error",new TransportError(u,f,m)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(u){this.readyState==="open"&&this.write(u)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(u){const f=decodePacket(u,this.socket.binaryType);this.onPacket(f)}onPacket(u){super.emitReserved("packet",u)}onClose(u){this.readyState="closed",super.emitReserved("close",u)}pause(u){}createUri(u,f={}){return u+"://"+this._hostname()+this._port()+this.opts.path+this._query(f)}_hostname(){const u=this.opts.hostname;return u.indexOf(":")===-1?u:"["+u+"]"}_port(){return this.opts.port&&(this.opts.secure&&+(this.opts.port!==443)||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(u){const f=encode$2(u);return f.length?"?"+f:""}}const alphabet$3="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_".split(""),length=64,map={};let seed$1=0,i=0,prev;function encode$1(p){let u="";do u=alphabet$3[p%length]+u,p=Math.floor(p/length);while(p>0);return u}function yeast(){const p=encode$1(+new Date);return p!==prev?(seed$1=0,prev=p):p+"."+encode$1(seed$1++)}for(;i<length;i++)map[alphabet$3[i]]=i;let value$1=!1;try{value$1=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch(p){}const hasCORS=value$1;function XHR(p){const u=p.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!u||hasCORS))return new XMLHttpRequest}catch{}if(!u)try{return new globalThisShim[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}function createCookieJar(){}function empty(){}const hasXHR2=function(){return new XHR({xdomain:!1}).responseType!=null}();class Polling extends Transport{constructor(u){if(super(u),this.polling=!1,typeof location<"u"){const m=location.protocol==="https:";let v=location.port;v||(v=m?"443":"80"),this.xd=typeof location<"u"&&u.hostname!==location.hostname||v!==u.port}const f=u&&u.forceBase64;this.supportsBinary=hasXHR2&&!f,this.opts.withCredentials&&(this.cookieJar=void 0)}get name(){return"polling"}doOpen(){this.poll()}pause(u){this.readyState="pausing";const f=()=>{this.readyState="paused",u()};if(this.polling||!this.writable){let m=0;this.polling&&(m++,this.once("pollComplete",function(){--m||f()})),this.writable||(m++,this.once("drain",function(){--m||f()}))}else f()}poll(){this.polling=!0,this.doPoll(),this.emitReserved("poll")}onData(u){const f=m=>{if(this.readyState==="opening"&&m.type==="open"&&this.onOpen(),m.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(m)};decodePayload(u,this.socket.binaryType).forEach(f),this.readyState!=="closed"&&(this.polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this.poll())}doClose(){const u=()=>{this.write([{type:"close"}])};this.readyState==="open"?u():this.once("open",u)}write(u){this.writable=!1,encodePayload(u,f=>{this.doWrite(f,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const u=this.opts.secure?"https":"http",f=this.query||{};return this.opts.timestampRequests!==!1&&(f[this.opts.timestampParam]=yeast()),!this.supportsBinary&&!f.sid&&(f.b64=1),this.createUri(u,f)}request(u={}){return Object.assign(u,{xd:this.xd,cookieJar:this.cookieJar},this.opts),new Request(this.uri(),u)}doWrite(u,f){const m=this.request({method:"POST",data:u});m.on("success",f),m.on("error",(v,y)=>{this.onError("xhr post error",v,y)})}doPoll(){const u=this.request();u.on("data",this.onData.bind(this)),u.on("error",(f,m)=>{this.onError("xhr poll error",f,m)}),this.pollXhr=u}}class Request extends Emitter{constructor(u,f){super(),installTimerFunctions(this,f),this.opts=f,this.method=f.method||"GET",this.uri=u,this.data=f.data!==void 0?f.data:null,this.create()}create(){var u;const f=pick(this.opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");f.xdomain=!!this.opts.xd;const m=this.xhr=new XHR(f);try{m.open(this.method,this.uri,!0);try{if(this.opts.extraHeaders){m.setDisableHeaderCheck&&m.setDisableHeaderCheck(!0);for(let v in this.opts.extraHeaders)this.opts.extraHeaders.hasOwnProperty(v)&&m.setRequestHeader(v,this.opts.extraHeaders[v])}}catch{}if(this.method==="POST")try{m.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{m.setRequestHeader("Accept","*/*")}catch{}(u=this.opts.cookieJar)===null||u===void 0||u.addCookies(m),"withCredentials"in m&&(m.withCredentials=this.opts.withCredentials),this.opts.requestTimeout&&(m.timeout=this.opts.requestTimeout),m.onreadystatechange=()=>{var v;m.readyState===3&&((v=this.opts.cookieJar)===null||v===void 0||v.parseCookies(m)),m.readyState===4&&(m.status===200||m.status===1223?this.onLoad():this.setTimeoutFn(()=>{this.onError(typeof m.status=="number"?m.status:0)},0))},m.send(this.data)}catch(v){this.setTimeoutFn(()=>{this.onError(v)},0);return}typeof document<"u"&&(this.index=Request.requestsCount++,Request.requests[this.index]=this)}onError(u){this.emitReserved("error",u,this.xhr),this.cleanup(!0)}cleanup(u){if(!(typeof this.xhr>"u"||this.xhr===null)){if(this.xhr.onreadystatechange=empty,u)try{this.xhr.abort()}catch{}typeof document<"u"&&delete Request.requests[this.index],this.xhr=null}}onLoad(){const u=this.xhr.responseText;u!==null&&(this.emitReserved("data",u),this.emitReserved("success"),this.cleanup())}abort(){this.cleanup()}}if(Request.requestsCount=0,Request.requests={},typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",unloadHandler);else if(typeof addEventListener=="function"){const p="onpagehide"in globalThisShim?"pagehide":"unload";addEventListener(p,unloadHandler,!1)}}function unloadHandler(){for(let p in Request.requests)Request.requests.hasOwnProperty(p)&&Request.requests[p].abort()}const nextTick=(()=>typeof Promise=="function"&&typeof Promise.resolve=="function"?u=>Promise.resolve().then(u):(u,f)=>f(u,0))(),WebSocket=globalThisShim.WebSocket||globalThisShim.MozWebSocket,usingBrowserWebSocket=!0,defaultBinaryType="arraybuffer",isReactNative=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class WS extends Transport{constructor(u){super(u),this.supportsBinary=!u.forceBase64}get name(){return"websocket"}doOpen(){if(!this.check())return;const u=this.uri(),f=this.opts.protocols,m=isReactNative?{}:pick(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(m.headers=this.opts.extraHeaders);try{this.ws=usingBrowserWebSocket&&!isReactNative?f?new WebSocket(u,f):new WebSocket(u):new WebSocket(u,f,m)}catch(v){return this.emitReserved("error",v)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=u=>this.onClose({description:"websocket connection closed",context:u}),this.ws.onmessage=u=>this.onData(u.data),this.ws.onerror=u=>this.onError("websocket error",u)}write(u){this.writable=!1;for(let f=0;f<u.length;f++){const m=u[f],v=f===u.length-1;encodePacket(m,this.supportsBinary,y=>{const w={};try{usingBrowserWebSocket&&this.ws.send(y)}catch{}v&&nextTick(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.close(),this.ws=null)}uri(){const u=this.opts.secure?"wss":"ws",f=this.query||{};return this.opts.timestampRequests&&(f[this.opts.timestampParam]=yeast()),this.supportsBinary||(f.b64=1),this.createUri(u,f)}check(){return!!WebSocket}}class WT extends Transport{get name(){return"webtransport"}doOpen(){typeof WebTransport=="function"&&(this.transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name]),this.transport.closed.then(()=>{this.onClose()}).catch(u=>{this.onError("webtransport error",u)}),this.transport.ready.then(()=>{this.transport.createBidirectionalStream().then(u=>{const f=createPacketDecoderStream(Number.MAX_SAFE_INTEGER,this.socket.binaryType),m=u.readable.pipeThrough(f).getReader(),v=createPacketEncoderStream();v.readable.pipeTo(u.writable),this.writer=v.writable.getWriter();const y=()=>{m.read().then(({done:k,value:S})=>{k||(this.onPacket(S),y())}).catch(k=>{})};y();const w={type:"open"};this.query.sid&&(w.data=`{"sid":"${this.query.sid}"}`),this.writer.write(w).then(()=>this.onOpen())})}))}write(u){this.writable=!1;for(let f=0;f<u.length;f++){const m=u[f],v=f===u.length-1;this.writer.write(m).then(()=>{v&&nextTick(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var u;(u=this.transport)===null||u===void 0||u.close()}}const transports={websocket:WS,webtransport:WT,polling:Polling},re=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,parts=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function parse$6(p){if(p.length>2e3)throw"URI too long";const u=p,f=p.indexOf("["),m=p.indexOf("]");f!=-1&&m!=-1&&(p=p.substring(0,f)+p.substring(f,m).replace(/:/g,";")+p.substring(m,p.length));let v=re.exec(p||""),y={},w=14;for(;w--;)y[parts[w]]=v[w]||"";return f!=-1&&m!=-1&&(y.source=u,y.host=y.host.substring(1,y.host.length-1).replace(/;/g,":"),y.authority=y.authority.replace("[","").replace("]","").replace(/;/g,":"),y.ipv6uri=!0),y.pathNames=pathNames(y,y.path),y.queryKey=queryKey(y,y.query),y}function pathNames(p,u){const f=/\/{2,9}/g,m=u.replace(f,"/").split("/");return(u.slice(0,1)=="/"||u.length===0)&&m.splice(0,1),u.slice(-1)=="/"&&m.splice(m.length-1,1),m}function queryKey(p,u){const f={};return u.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(m,v,y){v&&(f[v]=y)}),f}let Socket$1=class Ec extends Emitter{constructor(u,f={}){super(),this.binaryType=defaultBinaryType,this.writeBuffer=[],u&&typeof u=="object"&&(f=u,u=null),u?(u=parse$6(u),f.hostname=u.host,f.secure=u.protocol==="https"||u.protocol==="wss",f.port=u.port,u.query&&(f.query=u.query)):f.host&&(f.hostname=parse$6(f.host).host),installTimerFunctions(this,f),this.secure=f.secure!=null?f.secure:typeof location<"u"&&location.protocol==="https:",f.hostname&&!f.port&&(f.port=this.secure?"443":"80"),this.hostname=f.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=f.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=f.transports||["polling","websocket","webtransport"],this.writeBuffer=[],this.prevBufferLen=0,this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},f),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=decode$1(this.opts.query)),this.id=null,this.upgrades=null,this.pingInterval=null,this.pingTimeout=null,this.pingTimeoutTimer=null,typeof addEventListener=="function"&&(this.opts.closeOnBeforeunload&&(this.beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this.beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this.offlineEventListener=()=>{this.onClose("transport close",{description:"network connection lost"})},addEventListener("offline",this.offlineEventListener,!1))),this.open()}createTransport(u){const f=Object.assign({},this.opts.query);f.EIO=protocol$1,f.transport=u,this.id&&(f.sid=this.id);const m=Object.assign({},this.opts,{query:f,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[u]);return new transports[u](m)}open(){let u;if(this.opts.rememberUpgrade&&Ec.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1)u="websocket";else if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}else u=this.transports[0];this.readyState="opening";try{u=this.createTransport(u)}catch{this.transports.shift(),this.open();return}u.open(),this.setTransport(u)}setTransport(u){this.transport&&this.transport.removeAllListeners(),this.transport=u,u.on("drain",this.onDrain.bind(this)).on("packet",this.onPacket.bind(this)).on("error",this.onError.bind(this)).on("close",f=>this.onClose("transport close",f))}probe(u){let f=this.createTransport(u),m=!1;Ec.priorWebsocketSuccess=!1;const v=()=>{m||(f.send([{type:"ping",data:"probe"}]),f.once("packet",E=>{if(!m)if(E.type==="pong"&&E.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",f),!f)return;Ec.priorWebsocketSuccess=f.name==="websocket",this.transport.pause(()=>{m||this.readyState!=="closed"&&(T(),this.setTransport(f),f.send([{type:"upgrade"}]),this.emitReserved("upgrade",f),f=null,this.upgrading=!1,this.flush())})}else{const H=new Error("probe error");H.transport=f.name,this.emitReserved("upgradeError",H)}}))};function y(){m||(m=!0,T(),f.close(),f=null)}const w=E=>{const H=new Error("probe error: "+E);H.transport=f.name,y(),this.emitReserved("upgradeError",H)};function k(){w("transport closed")}function S(){w("socket closed")}function M(E){f&&E.name!==f.name&&y()}const T=()=>{f.removeListener("open",v),f.removeListener("error",w),f.removeListener("close",k),this.off("close",S),this.off("upgrading",M)};f.once("open",v),f.once("error",w),f.once("close",k),this.once("close",S),this.once("upgrading",M),this.upgrades.indexOf("webtransport")!==-1&&u!=="webtransport"?this.setTimeoutFn(()=>{m||f.open()},200):f.open()}onOpen(){if(this.readyState="open",Ec.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush(),this.readyState==="open"&&this.opts.upgrade){let u=0;const f=this.upgrades.length;for(;u<f;u++)this.probe(this.upgrades[u])}}onPacket(u){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",u),this.emitReserved("heartbeat"),this.resetPingTimeout(),u.type){case"open":this.onHandshake(JSON.parse(u.data));break;case"ping":this.sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong");break;case"error":const f=new Error("server error");f.code=u.data,this.onError(f);break;case"message":this.emitReserved("data",u.data),this.emitReserved("message",u.data);break}}onHandshake(u){this.emitReserved("handshake",u),this.id=u.sid,this.transport.query.sid=u.sid,this.upgrades=this.filterUpgrades(u.upgrades),this.pingInterval=u.pingInterval,this.pingTimeout=u.pingTimeout,this.maxPayload=u.maxPayload,this.onOpen(),this.readyState!=="closed"&&this.resetPingTimeout()}resetPingTimeout(){this.clearTimeoutFn(this.pingTimeoutTimer),this.pingTimeoutTimer=this.setTimeoutFn(()=>{this.onClose("ping timeout")},this.pingInterval+this.pingTimeout),this.opts.autoUnref&&this.pingTimeoutTimer.unref()}onDrain(){this.writeBuffer.splice(0,this.prevBufferLen),this.prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const u=this.getWritablePackets();this.transport.send(u),this.prevBufferLen=u.length,this.emitReserved("flush")}}getWritablePackets(){if(!(this.maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let f=1;for(let m=0;m<this.writeBuffer.length;m++){const v=this.writeBuffer[m].data;if(v&&(f+=byteLength(v)),m>0&&f>this.maxPayload)return this.writeBuffer.slice(0,m);f+=2}return this.writeBuffer}write(u,f,m){return this.sendPacket("message",u,f,m),this}send(u,f,m){return this.sendPacket("message",u,f,m),this}sendPacket(u,f,m,v){if(typeof f=="function"&&(v=f,f=void 0),typeof m=="function"&&(v=m,m=null),this.readyState==="closing"||this.readyState==="closed")return;m=m||{},m.compress=m.compress!==!1;const y={type:u,data:f,options:m};this.emitReserved("packetCreate",y),this.writeBuffer.push(y),v&&this.once("flush",v),this.flush()}close(){const u=()=>{this.onClose("forced close"),this.transport.close()},f=()=>{this.off("upgrade",f),this.off("upgradeError",f),u()},m=()=>{this.once("upgrade",f),this.once("upgradeError",f)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?m():u()}):this.upgrading?m():u()),this}onError(u){Ec.priorWebsocketSuccess=!1,this.emitReserved("error",u),this.onClose("transport error",u)}onClose(u,f){(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")&&(this.clearTimeoutFn(this.pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),typeof removeEventListener=="function"&&(removeEventListener("beforeunload",this.beforeunloadEventListener,!1),removeEventListener("offline",this.offlineEventListener,!1)),this.readyState="closed",this.id=null,this.emitReserved("close",u,f),this.writeBuffer=[],this.prevBufferLen=0)}filterUpgrades(u){const f=[];let m=0;const v=u.length;for(;m<v;m++)~this.transports.indexOf(u[m])&&f.push(u[m]);return f}};Socket$1.protocol=protocol$1;function url(p,u="",f){let m=p;f=f||typeof location<"u"&&location,p==null&&(p=f.protocol+"//"+f.host),typeof p=="string"&&(p.charAt(0)==="/"&&(p.charAt(1)==="/"?p=f.protocol+p:p=f.host+p),/^(https?|wss?):\/\//.test(p)||(typeof f<"u"?p=f.protocol+"//"+p:p="https://"+p),m=parse$6(p)),m.port||(/^(http|ws)$/.test(m.protocol)?m.port="80":/^(http|ws)s$/.test(m.protocol)&&(m.port="443")),m.path=m.path||"/";const y=m.host.indexOf(":")!==-1?"["+m.host+"]":m.host;return m.id=m.protocol+"://"+y+":"+m.port+u,m.href=m.protocol+"://"+y+(f&&f.port===m.port?"":":"+m.port),m}const withNativeArrayBuffer=typeof ArrayBuffer=="function",isView=p=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(p):p.buffer instanceof ArrayBuffer,toString=Object.prototype.toString,withNativeBlob=typeof Blob=="function"||typeof Blob<"u"&&toString.call(Blob)==="[object BlobConstructor]",withNativeFile=typeof File=="function"||typeof File<"u"&&toString.call(File)==="[object FileConstructor]";function isBinary(p){return withNativeArrayBuffer&&(p instanceof ArrayBuffer||isView(p))||withNativeBlob&&p instanceof Blob||withNativeFile&&p instanceof File}function hasBinary(p,u){if(!p||typeof p!="object")return!1;if(Array.isArray(p)){for(let f=0,m=p.length;f<m;f++)if(hasBinary(p[f]))return!0;return!1}if(isBinary(p))return!0;if(p.toJSON&&typeof p.toJSON=="function"&&arguments.length===1)return hasBinary(p.toJSON(),!0);for(const f in p)if(Object.prototype.hasOwnProperty.call(p,f)&&hasBinary(p[f]))return!0;return!1}function deconstructPacket(p){const u=[],f=p.data,m=p;return m.data=_deconstructPacket(f,u),m.attachments=u.length,{packet:m,buffers:u}}function _deconstructPacket(p,u){if(!p)return p;if(isBinary(p)){const f={_placeholder:!0,num:u.length};return u.push(p),f}else if(Array.isArray(p)){const f=new Array(p.length);for(let m=0;m<p.length;m++)f[m]=_deconstructPacket(p[m],u);return f}else if(typeof p=="object"&&!(p instanceof Date)){const f={};for(const m in p)Object.prototype.hasOwnProperty.call(p,m)&&(f[m]=_deconstructPacket(p[m],u));return f}return p}function reconstructPacket(p,u){return p.data=_reconstructPacket(p.data,u),delete p.attachments,p}function _reconstructPacket(p,u){if(!p)return p;if(p&&p._placeholder===!0){if(typeof p.num=="number"&&p.num>=0&&p.num<u.length)return u[p.num];throw new Error("illegal attachments")}else if(Array.isArray(p))for(let f=0;f<p.length;f++)p[f]=_reconstructPacket(p[f],u);else if(typeof p=="object")for(const f in p)Object.prototype.hasOwnProperty.call(p,f)&&(p[f]=_reconstructPacket(p[f],u));return p}const RESERVED_EVENTS$1=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"],protocol=5;var PacketType;(function(p){p[p.CONNECT=0]="CONNECT",p[p.DISCONNECT=1]="DISCONNECT",p[p.EVENT=2]="EVENT",p[p.ACK=3]="ACK",p[p.CONNECT_ERROR=4]="CONNECT_ERROR",p[p.BINARY_EVENT=5]="BINARY_EVENT",p[p.BINARY_ACK=6]="BINARY_ACK"})(PacketType||(PacketType={}));class Encoder{constructor(u){this.replacer=u}encode(u){return(u.type===PacketType.EVENT||u.type===PacketType.ACK)&&hasBinary(u)?this.encodeAsBinary({type:u.type===PacketType.EVENT?PacketType.BINARY_EVENT:PacketType.BINARY_ACK,nsp:u.nsp,data:u.data,id:u.id}):[this.encodeAsString(u)]}encodeAsString(u){let f=""+u.type;return(u.type===PacketType.BINARY_EVENT||u.type===PacketType.BINARY_ACK)&&(f+=u.attachments+"-"),u.nsp&&u.nsp!=="/"&&(f+=u.nsp+","),u.id!=null&&(f+=u.id),u.data!=null&&(f+=JSON.stringify(u.data,this.replacer)),f}encodeAsBinary(u){const f=deconstructPacket(u),m=this.encodeAsString(f.packet),v=f.buffers;return v.unshift(m),v}}function isObject$1(p){return Object.prototype.toString.call(p)==="[object Object]"}class Decoder extends Emitter{constructor(u){super(),this.reviver=u}add(u){let f;if(typeof u=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");f=this.decodeString(u);const m=f.type===PacketType.BINARY_EVENT;m||f.type===PacketType.BINARY_ACK?(f.type=m?PacketType.EVENT:PacketType.ACK,this.reconstructor=new BinaryReconstructor(f),f.attachments===0&&super.emitReserved("decoded",f)):super.emitReserved("decoded",f)}else if(isBinary(u)||u.base64)if(this.reconstructor)f=this.reconstructor.takeBinaryData(u),f&&(this.reconstructor=null,super.emitReserved("decoded",f));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+u)}decodeString(u){let f=0;const m={type:Number(u.charAt(0))};if(PacketType[m.type]===void 0)throw new Error("unknown packet type "+m.type);if(m.type===PacketType.BINARY_EVENT||m.type===PacketType.BINARY_ACK){const y=f+1;for(;u.charAt(++f)!=="-"&&f!=u.length;);const w=u.substring(y,f);if(w!=Number(w)||u.charAt(f)!=="-")throw new Error("Illegal attachments");m.attachments=Number(w)}if(u.charAt(f+1)==="/"){const y=f+1;for(;++f&&!(u.charAt(f)===","||f===u.length););m.nsp=u.substring(y,f)}else m.nsp="/";const v=u.charAt(f+1);if(v!==""&&Number(v)==v){const y=f+1;for(;++f;){const w=u.charAt(f);if(w==null||Number(w)!=w){--f;break}if(f===u.length)break}m.id=Number(u.substring(y,f+1))}if(u.charAt(++f)){const y=this.tryParse(u.substr(f));if(Decoder.isPayloadValid(m.type,y))m.data=y;else throw new Error("invalid payload")}return m}tryParse(u){try{return JSON.parse(u,this.reviver)}catch{return!1}}static isPayloadValid(u,f){switch(u){case PacketType.CONNECT:return isObject$1(f);case PacketType.DISCONNECT:return f===void 0;case PacketType.CONNECT_ERROR:return typeof f=="string"||isObject$1(f);case PacketType.EVENT:case PacketType.BINARY_EVENT:return Array.isArray(f)&&(typeof f[0]=="number"||typeof f[0]=="string"&&RESERVED_EVENTS$1.indexOf(f[0])===-1);case PacketType.ACK:case PacketType.BINARY_ACK:return Array.isArray(f)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class BinaryReconstructor{constructor(u){this.packet=u,this.buffers=[],this.reconPack=u}takeBinaryData(u){if(this.buffers.push(u),this.buffers.length===this.reconPack.attachments){const f=reconstructPacket(this.reconPack,this.buffers);return this.finishedReconstruction(),f}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}const parser$1=Object.freeze(Object.defineProperty({__proto__:null,Decoder,Encoder,get PacketType(){return PacketType},protocol},Symbol.toStringTag,{value:"Module"}));function on(p,u,f){return p.on(u,f),function(){p.off(u,f)}}const RESERVED_EVENTS=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class Socket extends Emitter{constructor(u,f,m){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=u,this.nsp=f,m&&m.auth&&(this.auth=m.auth),this._opts=Object.assign({},m),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const u=this.io;this.subs=[on(u,"open",this.onopen.bind(this)),on(u,"packet",this.onpacket.bind(this)),on(u,"error",this.onerror.bind(this)),on(u,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...u){return u.unshift("message"),this.emit.apply(this,u),this}emit(u,...f){if(RESERVED_EVENTS.hasOwnProperty(u))throw new Error('"'+u.toString()+'" is a reserved event name');if(f.unshift(u),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(f),this;const m={type:PacketType.EVENT,data:f};if(m.options={},m.options.compress=this.flags.compress!==!1,typeof f[f.length-1]=="function"){const w=this.ids++,k=f.pop();this._registerAckCallback(w,k),m.id=w}const v=this.io.engine&&this.io.engine.transport&&this.io.engine.transport.writable;return this.flags.volatile&&(!v||!this.connected)||(this.connected?(this.notifyOutgoingListeners(m),this.packet(m)):this.sendBuffer.push(m)),this.flags={},this}_registerAckCallback(u,f){var m;const v=(m=this.flags.timeout)!==null&&m!==void 0?m:this._opts.ackTimeout;if(v===void 0){this.acks[u]=f;return}const y=this.io.setTimeoutFn(()=>{delete this.acks[u];for(let k=0;k<this.sendBuffer.length;k++)this.sendBuffer[k].id===u&&this.sendBuffer.splice(k,1);f.call(this,new Error("operation has timed out"))},v),w=(...k)=>{this.io.clearTimeoutFn(y),f.apply(this,k)};w.withError=!0,this.acks[u]=w}emitWithAck(u,...f){return new Promise((m,v)=>{const y=(w,k)=>w?v(w):m(k);y.withError=!0,f.push(y),this.emit(u,...f)})}_addToQueue(u){let f;typeof u[u.length-1]=="function"&&(f=u.pop());const m={id:this._queueSeq++,tryCount:0,pending:!1,args:u,flags:Object.assign({fromQueue:!0},this.flags)};u.push((v,...y)=>m!==this._queue[0]?void 0:(v!==null?m.tryCount>this._opts.retries&&(this._queue.shift(),f&&f(v)):(this._queue.shift(),f&&f(null,...y)),m.pending=!1,this._drainQueue())),this._queue.push(m),this._drainQueue()}_drainQueue(u=!1){if(!this.connected||this._queue.length===0)return;const f=this._queue[0];f.pending&&!u||(f.pending=!0,f.tryCount++,this.flags=f.flags,this.emit.apply(this,f.args))}packet(u){u.nsp=this.nsp,this.io._packet(u)}onopen(){typeof this.auth=="function"?this.auth(u=>{this._sendConnectPacket(u)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(u){this.packet({type:PacketType.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},u):u})}onerror(u){this.connected||this.emitReserved("connect_error",u)}onclose(u,f){this.connected=!1,delete this.id,this.emitReserved("disconnect",u,f),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(u=>{if(!this.sendBuffer.some(m=>String(m.id)===u)){const m=this.acks[u];delete this.acks[u],m.withError&&m.call(this,new Error("socket has been disconnected"))}})}onpacket(u){if(u.nsp===this.nsp)switch(u.type){case PacketType.CONNECT:u.data&&u.data.sid?this.onconnect(u.data.sid,u.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case PacketType.EVENT:case PacketType.BINARY_EVENT:this.onevent(u);break;case PacketType.ACK:case PacketType.BINARY_ACK:this.onack(u);break;case PacketType.DISCONNECT:this.ondisconnect();break;case PacketType.CONNECT_ERROR:this.destroy();const m=new Error(u.data.message);m.data=u.data.data,this.emitReserved("connect_error",m);break}}onevent(u){const f=u.data||[];u.id!=null&&f.push(this.ack(u.id)),this.connected?this.emitEvent(f):this.receiveBuffer.push(Object.freeze(f))}emitEvent(u){if(this._anyListeners&&this._anyListeners.length){const f=this._anyListeners.slice();for(const m of f)m.apply(this,u)}super.emit.apply(this,u),this._pid&&u.length&&typeof u[u.length-1]=="string"&&(this._lastOffset=u[u.length-1])}ack(u){const f=this;let m=!1;return function(...v){m||(m=!0,f.packet({type:PacketType.ACK,id:u,data:v}))}}onack(u){const f=this.acks[u.id];typeof f=="function"&&(delete this.acks[u.id],f.withError&&u.data.unshift(null),f.apply(this,u.data))}onconnect(u,f){this.id=u,this.recovered=f&&this._pid===f,this._pid=f,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach(u=>this.emitEvent(u)),this.receiveBuffer=[],this.sendBuffer.forEach(u=>{this.notifyOutgoingListeners(u),this.packet(u)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(u=>u()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:PacketType.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(u){return this.flags.compress=u,this}get volatile(){return this.flags.volatile=!0,this}timeout(u){return this.flags.timeout=u,this}onAny(u){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(u),this}prependAny(u){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(u),this}offAny(u){if(!this._anyListeners)return this;if(u){const f=this._anyListeners;for(let m=0;m<f.length;m++)if(u===f[m])return f.splice(m,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(u){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(u),this}prependAnyOutgoing(u){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(u),this}offAnyOutgoing(u){if(!this._anyOutgoingListeners)return this;if(u){const f=this._anyOutgoingListeners;for(let m=0;m<f.length;m++)if(u===f[m])return f.splice(m,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(u){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const f=this._anyOutgoingListeners.slice();for(const m of f)m.apply(this,u.data)}}}function Backoff(p){p=p||{},this.ms=p.min||100,this.max=p.max||1e4,this.factor=p.factor||2,this.jitter=p.jitter>0&&p.jitter<=1?p.jitter:0,this.attempts=0}Backoff.prototype.duration=function(){var p=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var u=Math.random(),f=Math.floor(u*this.jitter*p);p=Math.floor(u*10)&1?p+f:p-f}return Math.min(p,this.max)|0},Backoff.prototype.reset=function(){this.attempts=0},Backoff.prototype.setMin=function(p){this.ms=p},Backoff.prototype.setMax=function(p){this.max=p},Backoff.prototype.setJitter=function(p){this.jitter=p};class Manager extends Emitter{constructor(u,f){var m;super(),this.nsps={},this.subs=[],u&&typeof u=="object"&&(f=u,u=void 0),f=f||{},f.path=f.path||"/socket.io",this.opts=f,installTimerFunctions(this,f),this.reconnection(f.reconnection!==!1),this.reconnectionAttempts(f.reconnectionAttempts||1/0),this.reconnectionDelay(f.reconnectionDelay||1e3),this.reconnectionDelayMax(f.reconnectionDelayMax||5e3),this.randomizationFactor((m=f.randomizationFactor)!==null&&m!==void 0?m:.5),this.backoff=new Backoff({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(f.timeout==null?2e4:f.timeout),this._readyState="closed",this.uri=u;const v=f.parser||parser$1;this.encoder=new v.Encoder,this.decoder=new v.Decoder,this._autoConnect=f.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(u){return arguments.length?(this._reconnection=!!u,this):this._reconnection}reconnectionAttempts(u){return u===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=u,this)}reconnectionDelay(u){var f;return u===void 0?this._reconnectionDelay:(this._reconnectionDelay=u,(f=this.backoff)===null||f===void 0||f.setMin(u),this)}randomizationFactor(u){var f;return u===void 0?this._randomizationFactor:(this._randomizationFactor=u,(f=this.backoff)===null||f===void 0||f.setJitter(u),this)}reconnectionDelayMax(u){var f;return u===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=u,(f=this.backoff)===null||f===void 0||f.setMax(u),this)}timeout(u){return arguments.length?(this._timeout=u,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(u){if(~this._readyState.indexOf("open"))return this;this.engine=new Socket$1(this.uri,this.opts);const f=this.engine,m=this;this._readyState="opening",this.skipReconnect=!1;const v=on(f,"open",function(){m.onopen(),u&&u()}),y=k=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",k),u?u(k):this.maybeReconnectOnOpen()},w=on(f,"error",y);if(this._timeout!==!1){const k=this._timeout,S=this.setTimeoutFn(()=>{v(),y(new Error("timeout")),f.close()},k);this.opts.autoUnref&&S.unref(),this.subs.push(()=>{this.clearTimeoutFn(S)})}return this.subs.push(v),this.subs.push(w),this}connect(u){return this.open(u)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const u=this.engine;this.subs.push(on(u,"ping",this.onping.bind(this)),on(u,"data",this.ondata.bind(this)),on(u,"error",this.onerror.bind(this)),on(u,"close",this.onclose.bind(this)),on(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(u){try{this.decoder.add(u)}catch(f){this.onclose("parse error",f)}}ondecoded(u){nextTick(()=>{this.emitReserved("packet",u)},this.setTimeoutFn)}onerror(u){this.emitReserved("error",u)}socket(u,f){let m=this.nsps[u];return m?this._autoConnect&&!m.active&&m.connect():(m=new Socket(this,u,f),this.nsps[u]=m),m}_destroy(u){const f=Object.keys(this.nsps);for(const m of f)if(this.nsps[m].active)return;this._close()}_packet(u){const f=this.encoder.encode(u);for(let m=0;m<f.length;m++)this.engine.write(f[m],u.options)}cleanup(){this.subs.forEach(u=>u()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close"),this.engine&&this.engine.close()}disconnect(){return this._close()}onclose(u,f){this.cleanup(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",u,f),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const u=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const f=this.backoff.duration();this._reconnecting=!0;const m=this.setTimeoutFn(()=>{u.skipReconnect||(this.emitReserved("reconnect_attempt",u.backoff.attempts),!u.skipReconnect&&u.open(v=>{v?(u._reconnecting=!1,u.reconnect(),this.emitReserved("reconnect_error",v)):u.onreconnect()}))},f);this.opts.autoUnref&&m.unref(),this.subs.push(()=>{this.clearTimeoutFn(m)})}}onreconnect(){const u=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",u)}}const cache={};function lookup$1(p,u){typeof p=="object"&&(u=p,p=void 0),u=u||{};const f=url(p,u.path||"/socket.io"),m=f.source,v=f.id,y=f.path,w=cache[v]&&y in cache[v].nsps,k=u.forceNew||u["force new connection"]||u.multiplex===!1||w;let S;return k?S=new Manager(m,u):(cache[v]||(cache[v]=new Manager(m,u)),S=cache[v]),f.query&&!u.query&&(u.query=f.queryKey),S.socket(f.path,u)}Object.assign(lookup$1,{Manager,Socket,io:lookup$1,connect:lookup$1});const DefaultOptions={heartbeat:!0},createWebsocket=(p,u=DefaultOptions)=>{if(!p)throw"A websocket path must be provided";const{heartbeat:f}={...DefaultOptions,...u},m=location.protocol==="https:",v=m?"wss:":"ws:",y=location.hostname,w=location.port||(m?443:80);let k=lookup$1(`${v}//${y}:${w}`,{path:p,reconnectionAttempts:3,reconnectionDelay:5e3,reconnectionDelayMax:5e3,timeout:4e3,transports:["websocket"]}),S;return f&&(S=setInterval(()=>{k.emit(SocketEvent.Heartbeat)},SocketSessionTTL*500)),k.on("disconnect",()=>{clearInterval(S)}),k.onOther=(M,T)=>{k.on(M,E=>{(E==null?void 0:E.apiSessionId)!==APISessionID&&T(E)})},k},extractFileNameRegex=/filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/;async function downloadStream(p){const u=await p.blob(),f=p.headers.get("Content-Disposition"),v=extractFileNameRegex.exec(f)[1].replace(/['"]/g,""),y=new Blob([u]),w=URL.createObjectURL(y),k=document.createElement("a");k.href=w,k.download=v,k.click(),URL.revokeObjectURL(w)}const shouldDisplaySetting=(p,u)=>{let f=u.dependsOn;return f&&!Array.isArray(f)&&(f=[f]),f!=null&&f.length?f.every(m=>{let v=m,y=null,w=!!m.invert;if(typeof m=="object"&&(v=m.setting,y=m.value),!v)return!1;Array.isArray(y)||(y=[y]);const k=deepGet$1(p,v);return y.some(M=>M==null?k!=null&&k!==!1&&k!=="":M===k)!==w}):!0},columnTypeManyTypeOverrides={[FieldType.DATETIME]:FieldType.STRING,[FieldType.BOOLEAN]:FieldType.STRING,[FieldType.SIGNATURE_SINGLE]:FieldType.ATTACHMENTS},columnTypeManyParser={[FieldType.DATETIME]:(p,u)=>{function f(m){const{timeOnly:v,dateOnly:y}=u||{},w=!y,k=parseDate(m,{enableTime:w});return getDateDisplayValue(k,{enableTime:w,timeOnly:v})}return p.map(m=>f(m))},[FieldType.BOOLEAN]:p=>p.map(u=>!!u),[FieldType.BB_REFERENCE_SINGLE]:p=>[...new Map(p.map(u=>[u._id,u])).values()],[FieldType.BB_REFERENCE]:p=>[...new Map(p.map(u=>[u._id,u])).values()],[FieldType.ARRAY]:p=>Array.from(new Set(p))};function enrichSchemaWithRelColumns(p){return Object.keys(p).reduce((f,m)=>{const v=p[m];if(f[m]=v,v.visible!==!1&&isRelationshipField(v)&&v.columns){const y=(v==null?void 0:v.relationshipType)===RelationshipType.ONE_TO_MANY;for(const w of Object.keys(v.columns)){const k=v.columns[w];if(!k.visible)continue;const S=`${v.name}.${w}`;f[S]={...k,type:k.type,name:S,related:{field:m,subField:w},cellRenderType:!y&&columnTypeManyTypeOverrides[k.type]||k.type}}}return f},{})}function getRelatedTableValues(p,u,f){var y,w,k,S;const m=isRelationshipField(f)&&(f==null?void 0:f.relationshipType)===RelationshipType.ONE_TO_MANY;let v="";if(m)v=(w=(y=p[u.related.field])==null?void 0:y[0])==null?void 0:w[u.related.subField];else{const M=columnTypeManyParser[u.type]||(H=>H),T=(S=(k=p[u.related.field])==null?void 0:k.flatMap(H=>H[u.related.subField]))==null?void 0:S.filter(H=>H!=null),E=M(T||[],u);v=E,[FieldType.STRING,FieldType.NUMBER,FieldType.BIGINT,FieldType.BOOLEAN,FieldType.DATETIME,FieldType.LONGFORM,FieldType.BARCODEQR].includes(u.type)&&(v=E==null?void 0:E.join(", "))}return v}function canBeDisplayColumn(p){return!(!canBeDisplayColumn$1(p.type)||p.related)}function canBeSortColumn(p){return p.calculationType?!0:!(!canBeSortColumn$1(p.type)||p.related)}const getSettingsDefinition=p=>{var f;if(!p)return[];let u=[];return(f=p.settings)==null||f.forEach(m=>{var v;m.section?u=u.concat((v=m.settings||[])==null?void 0:v.map(y=>({...y,sectionDependsOn:m.dependsOn}))):u.push(m)}),u},{buildQuery,limit:queryLimit,runQuery,sort}=QueryUtils;class BaseDataFetch{constructor(u){ua(this,"API");ua(this,"features");ua(this,"options");ua(this,"store");ua(this,"derivedStore");if(this.features={supportsSearch:!1,supportsSort:!1,supportsPagination:!1},this.options={datasource:u.datasource,limit:10,filter:null,query:u.query,sortColumn:null,sortOrder:SortOrder.ASCENDING,sortType:null,paginate:!0,clientSideSearching:!0,clientSideSorting:!0,clientSideLimiting:!0},this.store=writable({rows:[],info:null,schema:null,loading:!1,loaded:!1,query:u.query,pageNumber:0,cursor:null,cursors:[],resetKey:Math.random().toString(),error:null}),this.API=u==null?void 0:u.API,this.options={...this.options,...u},!this.API)throw"An API client is required for fetching data";if(this.getData=this.getData.bind(this),this.getPage=this.getPage.bind(this),this.getInitialData=this.getInitialData.bind(this),this.determineFeatureFlags=this.determineFeatureFlags.bind(this),this.refresh=this.refresh.bind(this),this.update=this.update.bind(this),this.hasNextPage=this.hasNextPage.bind(this),this.hasPrevPage=this.hasPrevPage.bind(this),this.nextPage=this.nextPage.bind(this),this.prevPage=this.prevPage.bind(this),this.derivedStore=derived(this.store,f=>({...f,...this.features,hasNextPage:this.hasNextPage(f),hasPrevPage:this.hasPrevPage(f)})),!this.options.datasource){this.store.update(f=>({...f,loaded:!0}));return}}get subscribe(){return this.derivedStore.subscribe}getDefaultSortColumn(u,f){return u!=null&&u.primaryDisplay&&f[u.primaryDisplay]?u.primaryDisplay:Object.keys(f)[0]}async getInitialData(){const{filter:u,paginate:f}=this.options,m=await this.getDefinition(),v=await this.determineFeatureFlags();this.features={supportsSearch:!!(v!=null&&v.supportsSearch),supportsSort:!!(v!=null&&v.supportsSort),supportsPagination:f&&!!(v!=null&&v.supportsPagination)};let y=this.getSchema(m);if(!y)return;if(y=this.enrichSchema(y),this.options.sortColumn&&!y[this.options.sortColumn]&&(this.options.sortColumn=null),this.options.sortColumn||(this.options.sortColumn=this.getDefaultSortColumn(m,y)),!this.options.sortColumn)this.options.sortOrder=SortOrder.ASCENDING,this.options.sortType=null;else{this.options.sortType=SortType.STRING;const S=y==null?void 0:y[this.options.sortColumn];((S==null?void 0:S.type)===FieldType.NUMBER||(S==null?void 0:S.type)===FieldType.BIGINT||"calculationType"in S&&(S!=null&&S.calculationType))&&(this.options.sortType=SortType.NUMBER),this.options.sortOrder?this.options.sortOrder=this.options.sortOrder.toLowerCase():this.options.sortOrder=SortOrder.ASCENDING}let w=this.options.query;w||(w=buildQuery(u??void 0)),this.store.update(S=>({...S,definition:m,schema:y,query:w,loading:!0,cursors:[],cursor:null}));const k=await this.getPage();this.store.update(S=>({...S,loading:!1,loaded:!0,pageNumber:0,rows:k.rows,info:k.info,cursors:f&&k.hasNextPage?[null,k.cursor]:[null],error:k.error,resetKey:Math.random().toString()}))}async getPage(){const{sortColumn:u,sortOrder:f,sortType:m,limit:v,clientSideSearching:y,clientSideSorting:w,clientSideLimiting:k}=this.options,{query:S}=get_store_value(this.store);let{rows:M,info:T,hasNextPage:E,cursor:H,error:F}=await this.getData();return!this.features.supportsSearch&&y&&(M=runQuery(M,S)),!this.features.supportsSort&&w&&m&&(M=sort(M,u,f,m)),!this.features.supportsPagination&&k&&(M=queryLimit(M,v)),{rows:M,info:T,hasNextPage:E,cursor:H,error:F}}getSchema(u){return(u==null?void 0:u.schema)??void 0}enrichSchema(u){let f={};for(const v of Object.keys(u)){const y=u[v];if(y.type===FieldType.JSON){const w=convertJSONSchemaToTableSchema(y,{squashObjects:!0});if(w)for(const k of Object.keys(w))f[`${v}.${k}`]={type:w[k].type,nestedJSON:!0}}}let m={};return Object.entries({...u,...f}).forEach(([v,y])=>{typeof y=="string"?m[v]={type:y,name:v}:m[v]={...y,type:y.type,name:v}}),m}async determineFeatureFlags(){return{supportsSearch:!1,supportsSort:!1,supportsPagination:!1}}async update(u){let f=!1;for(const[m,v]of Object.entries(u||{})){const y=this.options[m]??null;if(JSON.stringify(v??null)!==JSON.stringify(y)){f=!0;break}}f&&(this.options={...this.options,...fp$1.cloneDeep(u)},await this.getInitialData())}async refresh(){if(get_store_value(this.store).loading)return;this.store.update(S=>({...S,loading:!0}));const{rows:u,info:f,error:m,cursor:v}=await this.getPage();let{cursors:y}=get_store_value(this.store);const{pageNumber:w}=get_store_value(this.store);if(!u.length&&w>0)return this.store.update(S=>({...S,loading:!1,cursors:y.slice(0,w)})),await this.prevPage();y[w+1]!=v&&(y=y.slice(0,w+1),y[w+1]=v),this.store.update(S=>({...S,rows:u,info:f,loading:!1,error:m,cursors:y}))}hasNextPage(u){return u.cursors[u.pageNumber+1]!=null}hasPrevPage(u){return u.pageNumber>0}async nextPage(){const u=get_store_value(this.derivedStore);if(u.loading||!this.options.paginate||!u.hasNextPage)return;const f=u.cursors[u.pageNumber+1];this.store.update(S=>({...S,loading:!0,cursor:f,pageNumber:S.pageNumber+1}));const{rows:m,info:v,hasNextPage:y,cursor:w,error:k}=await this.getPage();this.store.update(S=>{let{cursors:M,pageNumber:T}=S;return y&&(M[T+1]=w),{...S,rows:m,info:v,cursors:M,loading:!1,error:k}})}async prevPage(){const u=get_store_value(this.derivedStore);if(u.loading||!this.options.paginate||!u.hasPrevPage)return;const f=u.cursors[u.pageNumber-1];this.store.update(w=>({...w,loading:!0,cursor:f,pageNumber:w.pageNumber-1}));const{rows:m,info:v,error:y}=await this.getPage();this.store.update(w=>({...w,rows:m,info:v,loading:!1,error:y}))}}class TableFetch extends BaseDataFetch{async determineFeatureFlags(){return{supportsSearch:!0,supportsSort:!0,supportsPagination:!0}}async getDefinition(){const{datasource:u}=this.options;if(!(u!=null&&u.tableId))return null;try{return await this.API.fetchTableDefinition(u.tableId)}catch(f){return this.store.update(m=>({...m,error:f})),null}}async getData(){const{datasource:u,limit:f,sortColumn:m,sortOrder:v,sortType:y,paginate:w}=this.options,{tableId:k}=u,{cursor:S,query:M}=get_store_value(this.store);try{const T=await this.API.searchTable(k,{query:M,limit:f,sort:m,sortOrder:v??SortOrder.ASCENDING,sortType:y,paginate:w,bookmark:S});return{rows:(T==null?void 0:T.rows)||[],hasNextPage:(T==null?void 0:T.hasNextPage)||!1,cursor:(T==null?void 0:T.bookmark)||null}}catch(T){return{rows:[],hasNextPage:!1,error:T}}}}class ViewFetch extends BaseDataFetch{async getDefinition(){const{datasource:u}=this.options;if(!(u!=null&&u.tableId))return null;try{return await this.API.fetchTableDefinition(u.tableId)}catch(f){return this.store.update(m=>({...m,error:f})),null}}getSchema(u){var m,v;const{datasource:f}=this.options;return(v=(m=u==null?void 0:u.views)==null?void 0:m[f==null?void 0:f.name])==null?void 0:v.schema}async getData(){const{datasource:u}=this.options;try{return{rows:await this.API.fetchViewData(u.name,{calculation:u.calculation,field:u.field,groupBy:u.groupBy,tableId:u.tableId})||[]}}catch(f){return console.error(f,{datasource:u}),{rows:[]}}}}class ViewV2Fetch extends BaseDataFetch{async determineFeatureFlags(){return{supportsSearch:!0,supportsSort:!0,supportsPagination:!0}}async getDefinition(){const{datasource:u}=this.options;try{const f=await this.API.viewV2.fetchDefinition(u.id);return f==null?void 0:f.data}catch(f){return this.store.update(m=>({...m,error:f})),null}}getDefaultSortColumn(){return null}async getData(){var T;const{datasource:u,limit:f,sortColumn:m,sortOrder:v,sortType:y,paginate:w}=this.options,{cursor:k,query:S,definition:M}=get_store_value(this.store);if((M==null?void 0:M.type)===ViewV2Type.CALCULATION&&!Object.values(M.schema||{}).some(isCalculationField))return{rows:[],hasNextPage:!1,cursor:null,error:null};!m&&((T=M==null?void 0:M.sort)!=null&&T.field)&&(this.options.sortColumn=M.sort.field,this.options.sortOrder=M.sort.order||SortOrder.ASCENDING);try{const E={query:S,paginate:w,limit:f,bookmark:k,sort:m,sortOrder:v,sortType:y};if(w){const H=await this.API.viewV2.fetch(u.id,{...E,paginate:w});return{rows:(H==null?void 0:H.rows)||[],hasNextPage:(H==null?void 0:H.hasNextPage)||!1,cursor:(H==null?void 0:H.bookmark)||null}}else{const H=await this.API.viewV2.fetch(u.id,{...E,paginate:w});return{rows:(H==null?void 0:H.rows)||[],hasNextPage:!1,cursor:null}}}catch(E){return{rows:[],hasNextPage:!1,cursor:null,error:E}}}}class QueryFetch extends BaseDataFetch{async determineFeatureFlags(){var m,v,y,w,k,S;const u=await this.getDefinition();return{supportsPagination:!!((v=(m=u==null?void 0:u.fields)==null?void 0:m.pagination)!=null&&v.type)&&!!((w=(y=u==null?void 0:u.fields)==null?void 0:y.pagination)!=null&&w.location)&&!!((S=(k=u==null?void 0:u.fields)==null?void 0:k.pagination)!=null&&S.pageParam)}}async getDefinition(){const{datasource:u}=this.options;if(!(u!=null&&u._id))return null;try{const f=await this.API.fetchQueryDefinition(u._id);return f.fields||(f.fields=u.fields),f}catch{return null}}getDefaultSortColumn(){return null}async getData(){var T,E;const{datasource:u,limit:f,paginate:m}=this.options,{supportsPagination:v}=this.features,{cursor:y,definition:w}=get_store_value(this.store),k=(E=(T=w==null?void 0:w.fields)==null?void 0:T.pagination)==null?void 0:E.type,S=cloneDeep$1(u.queryParams||{});for(const H of(u==null?void 0:u.parameters)||[])S[H.name]||(S[H.name]=H.default);const M={parameters:S};if(m&&v){const H=k==="page"?parseInt(y||"1"):y;M.pagination={page:H,limit:f}}try{const H=await this.API.executeQuery(u==null?void 0:u._id,M),{data:F,pagination:Z,...$}=H;let J=null,se=!1;return m&&v&&(k==="page"?(J=M.pagination.page+1,se=(F==null?void 0:F.length)===f&&f>0):(J=Z==null?void 0:Z.cursor,se=J!=null)),{rows:F||[],info:$,cursor:J,hasNextPage:se}}catch{return{rows:[],hasNextPage:!1}}}}class RelationshipFetch extends BaseDataFetch{async getDefinition(){const{datasource:u}=this.options;if(!(u!=null&&u.tableId))return null;try{return await this.API.fetchTableDefinition(u.tableId)}catch(f){return this.store.update(m=>({...m,error:f})),null}}async getData(){const{datasource:u}=this.options;if(!(u!=null&&u.rowId)||!(u!=null&&u.rowTableId))return{rows:[]};try{return{rows:await this.API.fetchRelationshipData(u.rowTableId,u.rowId,u.fieldName)}}catch{return{rows:[]}}}}class NestedProviderFetch extends BaseDataFetch{async getDefinition(){var f,m;const{datasource:u}=this.options;return{schema:(f=u==null?void 0:u.value)==null?void 0:f.schema,primaryDisplay:(m=u==null?void 0:u.value)==null?void 0:m.primaryDisplay}}async getData(){var f;const{datasource:u}=this.options;return{rows:((f=u==null?void 0:u.value)==null?void 0:f.rows)||[],hasNextPage:!1,cursor:null}}}function isArrayOfStrings(p){return Array.isArray(p)&&!!p[0]&&typeof p[0]!="object"}class FieldFetch extends BaseDataFetch{async getDefinition(){const{datasource:u}=this.options;let f;return u.fieldType==="attachment"?f={url:{type:"string"},name:{type:"string"}}:u.fieldType==="array"&&(f={value:{type:"string"}}),{schema:f}}async getData(){const{datasource:u}=this.options,f=(u==null?void 0:u.value)||[];let m;return isArrayOfStrings(f)?m=f.map(v=>({value:v})):m=f,{rows:m||[],hasNextPage:!1,cursor:null}}}class JSONArrayFetch extends FieldFetch{async getDefinition(){const{datasource:u}=this.options;try{const f=await this.API.fetchTableDefinition(u.tableId);return{schema:getJSONArrayDatasourceSchema(f==null?void 0:f.schema,u)}}catch{return null}}}class UserFetch extends BaseDataFetch{constructor(u){super({...u,datasource:{type:"user",tableId:InternalTable.USER_METADATA}})}async determineFeatureFlags(){return{supportsSearch:!0,supportsSort:!1,supportsPagination:!0}}async getDefinition(){return{schema:{}}}async getData(){const{limit:u,paginate:f}=this.options,{cursor:m,query:v}=get_store_value(this.store),{appId:y,paginated:w,...k}=v,S=isSupportedUserSearch(k)?k:{};try{const M={bookmark:m??void 0,query:S??void 0,appId:y,paginate:w||f,limit:u},T=await this.API.searchUsers(M);return{rows:(T==null?void 0:T.data)||[],hasNextPage:(T==null?void 0:T.hasNextPage)||!1,cursor:(T==null?void 0:T.nextPage)||null}}catch(M){return{rows:[],hasNextPage:!1,error:M}}}}class GroupUserFetch extends BaseDataFetch{constructor(u){super({...u,datasource:{type:"groupUser",tableId:InternalTable.USER_METADATA}})}async determineFeatureFlags(){return{supportsSearch:!0,supportsSort:!1,supportsPagination:!0}}async getDefinition(){return{schema:{}}}async getData(){const{query:u,cursor:f}=get_store_value(this.store);try{const m=await this.API.getGroupUsers({id:u.groupId,emailSearch:u.emailSearch,bookmark:f??void 0});return{rows:(m==null?void 0:m.users)||[],hasNextPage:(m==null?void 0:m.hasNextPage)||!1,cursor:(m==null?void 0:m.bookmark)||null}}catch(m){return{rows:[],hasNextPage:!1,error:m}}}}class CustomFetch extends BaseDataFetch{getType(u){return u==null?"string":typeof u==="object"?Array.isArray(u)?"array":"json":isNaN(u)?"string":"number"}parseCustomData(u){if(!u)return[];if(Array.isArray(u))return u;if(typeof u=="string"){try{const f=JSON.parse(u);return Array.isArray(f)?f:[f]}catch{}return u.includes(`
383
+ `;var HTTPMethod=(p=>(p.POST="POST",p.PATCH="PATCH",p.GET="GET",p.PUT="PUT",p.DELETE="DELETE",p))(HTTPMethod||{});const BannedSearchTypes=[FieldType.LINK,FieldType.ATTACHMENT_SINGLE,FieldType.ATTACHMENTS,FieldType.FORMULA,FieldType.JSON,FieldType.ATTACHMENT_SINGLE,FieldType.SIGNATURE_SINGLE,"jsonarray","queryarray"],Cookies={Auth:"budibase:auth",CurrentApp:"budibase:currentapp",ReturnUrl:"budibase:returnurl",AccountReturnUrl:"budibase:account:returnurl",OnboardingProcessCorrelationKey:BpmCorrelationKey.ONBOARDING};var TableNames=(p=>(p.USERS="ta_users",p))(TableNames||{});const BudibaseRoles={AppUser:"appUser",Developer:"developer",Creator:"creator",Admin:"admin",Owner:"owner"},BudibaseRoleOptionsOld=[{label:"Developer",value:BudibaseRoles.Developer}],BudibaseRoleOptions=[{label:"Account admin",value:BudibaseRoles.Admin,subtitle:"Has full access to all apps and settings in your account",sortOrder:1},{label:"Creator",value:BudibaseRoles.Creator,subtitle:"Can create and edit apps they have access to",sortOrder:2},{label:"App user",value:BudibaseRoles.AppUser,subtitle:"Can only use published apps they have access to",sortOrder:3}],ExtendedBudibaseRoleOptions=[{label:"Account holder",value:BudibaseRoles.Owner,sortOrder:0},...BudibaseRoleOptions,...BudibaseRoleOptionsOld],PlanType={FREE:"free",TEAM:"team",PRO:"pro",BUSINESS:"business",PREMIUM:"premium",ENTERPRISE:"enterprise",ENTERPRISE_BASIC_TRIAL:"enterprise_basic_trial"},ApiVersion="1",Roles={ADMIN:"ADMIN",POWER:"POWER",BASIC:"BASIC",PUBLIC:"PUBLIC",BUILDER:"BUILDER",CREATOR:"CREATOR"},EventPublishType={ENV_VAR_UPGRADE_PANEL_OPENED:"environment_variable_upgrade_panel_opened"},TypeIconMap={[FieldType.STRING]:"Text",[FieldType.OPTIONS]:"Dropdown",[FieldType.DATETIME]:"Calendar",[FieldType.BARCODEQR]:"Camera",[FieldType.SIGNATURE_SINGLE]:"AnnotatePen",[FieldType.LONGFORM]:"TextAlignLeft",[FieldType.ARRAY]:"Duplicate",[FieldType.NUMBER]:"123",[FieldType.BOOLEAN]:"Boolean",[FieldType.ATTACHMENTS]:"DocumentFragmentGroup",[FieldType.ATTACHMENT_SINGLE]:"DocumentFragment",[FieldType.LINK]:"DataCorrelated",[FieldType.FORMULA]:"Calculator",[FieldType.AI]:"MagicWand",[FieldType.JSON]:"Brackets",[FieldType.BIGINT]:"TagBold",[FieldType.AUTO]:"Shapes",[FieldType.BB_REFERENCE]:{[BBReferenceFieldSubType.USER]:"UserGroup",[BBReferenceFieldSubType.USERS]:"UserGroup"},[FieldType.BB_REFERENCE_SINGLE]:{[BBReferenceFieldSubType.USER]:"User"}},OptionColours=[...new Array(12).keys()].map(p=>`hsla(${(p+1)*222%360}, 90%, 75%, 0.3)`),FilterOperator={ANY:"any",ALL:"all"},OnEmptyFilter={RETURN_ALL:"all",RETURN_NONE:"none"},FilterValueType={BINDING:"Binding",VALUE:"Value"},FieldPermissions={WRITABLE:"writable",READONLY:"readonly",HIDDEN:"hidden"},Constants$2=Object.freeze(Object.defineProperty({__proto__:null,ApiVersion,BannedSearchTypes,BudibaseRoleOptions,BudibaseRoleOptionsOld,BudibaseRoles,ContextScopes:ComponentContextScopes,Cookies,DEFAULT_BB_DATASOURCE_ID,EventPublishType,ExtendedBudibaseRoleOptions,Features:Feature,FieldPermissions,FilterOperator,FilterValueType,OnEmptyFilter,OperatorOptions,OptionColours,PlanType,Roles,SqlNumberTypeRangeMap,TableNames,TypeIconMap},Symbol.toStringTag,{value:"Module"})),buildAnalyticsEndpoints=p=>({getAnalyticsStatus:async()=>await p.get({url:"/api/bbtel"}),analyticsPing:async u=>await p.post({url:"/api/bbtel/ping",body:{...u,timezone:Intl.DateTimeFormat().resolvedOptions().timeZone}})}),buildAIEndpoints=p=>({generateCronExpression:async u=>await p.post({url:"/api/ai/cron",body:{prompt:u}})}),buildAppEndpoints=p=>({fetchAppPackage:async u=>await p.get({url:`/api/applications/${u}/appPackage`}),saveAppMetadata:async(u,f)=>await p.put({url:`/api/applications/${u}`,body:f}),publishAppChanges:async u=>await p.post({url:`/api/applications/${u}/publish`}),revertAppChanges:async u=>await p.post({url:`/api/dev/${u}/revert`}),updateAppClientVersion:async u=>await p.post({url:`/api/applications/${u}/client/update`}),revertAppClientVersion:async u=>await p.post({url:`/api/applications/${u}/client/revert`}),getAppDeployments:async()=>await p.get({url:"/api/deployments"}),createApp:async u=>await p.post({url:"/api/applications",body:u,json:!1}),duplicateApp:async(u,f)=>await p.post({url:`/api/applications/${u}/duplicate`,body:f,json:!1}),updateAppFromExport:async(u,f)=>{const m=getDevAppID(u);return await p.post({url:`/api/applications/${m}/import`,body:f,json:!1})},importApps:async u=>await p.post({url:"/api/cloud/import",body:u,json:!1}),unpublishApp:async u=>await p.post({url:`/api/applications/${u}/unpublish`}),deleteApp:async u=>await p.delete({url:`/api/applications/${u}`}),releaseAppLock:async u=>await p.delete({url:`/api/dev/${u}/lock`}),fetchSystemDebugInfo:async()=>await p.get({url:"/api/debug/diagnostics"}),syncApp:async u=>await p.post({url:`/api/applications/${u}/sync`}),getApps:async()=>await p.get({url:"/api/applications?status=all"}),fetchComponentLibDefinitions:async u=>await p.get({url:`/api/${u}/components/definitions`}),addSampleData:async u=>await p.post({url:`/api/applications/${u}/sample`}),setRevertableVersion:async(u,f)=>await p.post({url:`/api/applications/${u}/setRevertableVersion`,body:{revertableVersion:f}})}),buildAttachmentEndpoints=p=>{const u={getSignedDatasourceURL:async(f,m,v)=>await p.post({url:`/api/attachments/${f}/url`,body:{bucket:m,key:v}})};return{...u,uploadAttachment:async(f,m)=>await p.post({url:`/api/attachments/${f}/upload`,body:m,json:!1}),uploadBuilderAttachment:async f=>await p.post({url:"/api/attachments/process",body:f,json:!1}),externalUpload:async(f,m,v,y)=>{const{signedUrl:w,publicUrl:k}=await u.getSignedDatasourceURL(f,m,v);return w?(await p.put({url:w,body:y,json:!1,external:!0,parseResponse:S=>S}),{publicUrl:k}):{publicUrl:void 0}},downloadAttachment:async(f,m,v)=>await p.get({url:`/api/${f}/rows/${m}/attachment/${v}`,parseResponse:y=>y,suppressErrors:!0})}},buildAuthEndpoints=p=>({logIn:async(u,f,m)=>await p.post({url:`/api/global/auth/${u}/login`,body:{username:f,password:m}}),logOut:async()=>await p.post({url:"/api/global/auth/logout"}),setInitInfo:async u=>await p.post({url:"/api/global/auth/init",body:u}),getInitInfo:async()=>await p.get({url:"/api/global/auth/init"}),requestForgotPassword:async(u,f)=>await p.post({url:`/api/global/auth/${u}/reset`,body:{email:f}}),resetPassword:async(u,f,m)=>await p.post({url:`/api/global/auth/${u}/reset/update`,body:{password:f,resetCode:m}})}),buildAutomationEndpoints=p=>({triggerAutomation:async(u,f,m)=>await p.post({url:`/api/automations/${u}/trigger`,body:{fields:f,timeout:m}}),testAutomation:async(u,f)=>await p.post({url:`/api/automations/${u}/test`,body:f}),getAutomations:async()=>await p.get({url:"/api/automations"}),getAutomationDefinitions:async()=>await p.get({url:"/api/automations/definitions/list"}),createAutomation:async u=>await p.post({url:"/api/automations",body:u}),updateAutomation:async u=>await p.put({url:"/api/automations",body:u}),deleteAutomation:async(u,f)=>await p.delete({url:`/api/automations/${u}/${f}`}),getAutomationLogs:async u=>await p.post({url:"/api/automations/logs/search",body:u}),clearAutomationLogErrors:async(u,f)=>await p.delete({url:"/api/automations/logs",body:{appId:f,automationId:u}})}),buildConfigEndpoints=p=>({saveConfig:async u=>await p.post({url:"/api/global/configs",body:u}),getConfig:async u=>await p.get({url:`/api/global/configs/${u}`}),deleteConfig:async(u,f)=>await p.delete({url:`/api/global/configs/${u}/${f}`}),getTenantConfig:async u=>await p.get({url:`/api/global/configs/public?tenantId=${u}`}),getOIDCConfigs:async u=>await p.get({url:`/api/global/configs/public/oidc?tenantId=${u}`}),getChecklist:async u=>await p.get({url:`/api/global/configs/checklist?tenantId=${u}`}),uploadLogo:async u=>await p.post({url:"/api/global/configs/upload/settings/logoUrl",body:u,json:!1}),uploadFavicon:async u=>await p.post({url:"/api/global/configs/upload/settings/faviconUrl",body:u,json:!1}),uploadOIDCLogo:async(u,f)=>await p.post({url:`/api/global/configs/upload/logos_oidc/${u}`,body:f,json:!1}),getOIDCLogos:async()=>await p.get({url:"/api/global/configs/logos_oidc"})}),buildDatasourceEndpoints=p=>({getDatasources:async()=>await p.get({url:"/api/datasources"}),buildDatasourceSchema:async(u,f)=>await p.post({url:`/api/datasources/${u}/schema`,body:{tablesFilter:f}}),createDatasource:async u=>await p.post({url:"/api/datasources",body:u}),updateDatasource:async u=>await p.put({url:`/api/datasources/${u._id}`,body:u}),deleteDatasource:async(u,f)=>await p.delete({url:`/api/datasources/${u}/${f}`}),validateDatasource:async u=>await p.post({url:"/api/datasources/verify",body:{datasource:u}}),fetchInfoForDatasource:async u=>await p.post({url:"/api/datasources/info",body:{datasource:u}}),fetchExternalSchema:async u=>await p.get({url:`/api/datasources/${u}/schema/external`})}),buildFlagEndpoints=p=>({getFlags:async()=>await p.get({url:"/api/users/flags"}),updateFlag:async(u,f)=>await p.post({url:"/api/users/flags",body:{flag:u,value:f}}),toggleUiFeature:async u=>await p.post({url:`/api/beta/${u}`})}),buildLayoutEndpoints=p=>({saveLayout:async u=>await p.post({url:"/api/layouts",body:u}),deleteLayout:async(u,f)=>await p.delete({url:`/api/layouts/${u}/${f}`})}),buildOtherEndpoints=p=>({getEnvironment:async()=>await p.get({url:"/api/system/environment"}),getSystemStatus:async()=>await p.get({url:"/api/system/status"}),getIntegrations:async()=>await p.get({url:"/api/integrations"}),getBudibaseVersion:async()=>(await p.get({url:"/api/dev/version"})).version,getBasePermissions:async()=>await p.get({url:"/api/permission/builtin"})}),buildPermissionsEndpoints=p=>({getPermissionForResource:async u=>await p.get({url:`/api/permission/${u}`}),updatePermissionForResource:async(u,f,m)=>await p.post({url:`/api/permission/${f}/${u}/${m}`}),removePermissionFromResource:async(u,f,m)=>await p.delete({url:`/api/permission/${f}/${u}/${m}`}),getDependants:async u=>await p.get({url:`/api/permission/${u}/dependants`})}),buildQueryEndpoints=p=>({executeQuery:async(u,{pagination:f,parameters:m}={})=>await p.post({url:`/api/v2/queries/${u}`,body:{parameters:m,pagination:f}}),fetchQueryDefinition:async u=>await p.get({url:`/api/queries/${u}`,cache:!0}),getQueries:async()=>await p.get({url:"/api/queries"}),saveQuery:async u=>await p.post({url:"/api/queries",body:u}),deleteQuery:async(u,f)=>await p.delete({url:`/api/queries/${u}/${f}`}),importQueries:async u=>await p.post({url:"/api/queries/import",body:u}),previewQuery:async u=>await p.post({url:"/api/queries/preview",body:u})}),buildRelationshipEndpoints=p=>({fetchRelationshipData:async(u,f,m)=>{const v=await p.get({url:`/api/${u}/${f}/enrich?field=${m}`});return m?v[m]||[]:[v]}}),buildRoleEndpoints=p=>({deleteRole:async(u,f)=>await p.delete({url:`/api/roles/${u}/${f}`}),saveRole:async u=>await p.post({url:"/api/roles",body:u}),getRoles:async()=>await p.get({url:"/api/roles"}),getRolesForApp:async u=>await p.get({url:`/api/global/roles/${u}`}),getAccessibleRoles:async()=>await p.get({url:"/api/roles/accessible"})}),buildRouteEndpoints=p=>({fetchClientAppRoutes:async()=>await p.get({url:"/api/routing/client"}),fetchAppRoutes:async()=>await p.get({url:"/api/routing"})}),buildRowEndpoints=p=>({fetchRow:async(u,f)=>await p.get({url:`/api/${u}/rows/${f}`}),saveRow:async(u,f=!1)=>{const m=u._viewId||u.tableId;return await p.post({url:`/api/${m}/rows`,body:u,suppressErrors:f})},patchRow:async(u,f=!1)=>{const m=u._viewId||u.tableId;return await p.patch({url:`/api/${m}/rows`,body:u,suppressErrors:f})},deleteRow:async(u,f)=>await p.delete({url:`/api/${u}/rows`,body:{_id:f}}),deleteRows:async(u,f)=>(f.forEach(m=>{typeof m=="object"&&(m==null||delete m._viewId)}),await p.delete({url:`/api/${u}/rows`,body:{rows:f}})),exportRows:async(u,f,m)=>await p.post({url:`/api/${u}/rows/exportRows?format=${f}`,body:m,parseResponse:async v=>await v.text()})}),buildScreenEndpoints=p=>({saveScreen:async u=>await p.post({url:"/api/screens",body:u}),deleteScreen:async(u,f)=>await p.delete({url:`/api/screens/${u}/${f}`}),usageInScreens:async u=>await p.post({url:`/api/screens/usage/${u}`})}),buildTableEndpoints=p=>({fetchTableDefinition:async u=>await p.get({url:`/api/tables/${u}`,cache:!0}),fetchTableData:async u=>await p.get({url:`/api/${u}/rows`}),searchTable:async(u,f)=>await p.post({url:`/api/${u}/search`,body:f}),importTableData:async(u,f,m)=>await p.post({url:`/api/tables/${u}/import`,body:{rows:f,identifierFields:m}}),csvToJson:async u=>await p.post({url:"/api/convert/csvToJson",body:{csvString:u}}),getTables:async()=>await p.get({url:"/api/tables"}),getTable:async u=>await p.get({url:`/api/tables/${u}`}),saveTable:async u=>await p.post({url:"/api/tables",body:u}),deleteTable:async(u,f)=>await p.delete({url:`/api/tables/${u}/${f}`}),validateNewTableImport:async(u,f)=>await p.post({url:"/api/tables/validateNewTableImport",body:{rows:u,schema:f}}),validateExistingTableImport:async(u,f)=>await p.post({url:"/api/tables/validateExistingTableImport",body:{rows:u,tableId:f}}),migrateColumn:async(u,f,m)=>await p.post({url:`/api/tables/${u}/migrate`,body:{oldColumn:f,newColumn:m}})}),buildTemplateEndpoints=p=>({getEmailTemplateDefinitions:async()=>await p.get({url:"/api/global/template/definitions"}),getEmailTemplates:async()=>await p.get({url:"/api/global/template/email"}),saveEmailTemplate:async u=>await p.post({url:"/api/global/template",body:u}),getAppTemplates:async()=>await p.get({url:"/api/templates"})}),buildUserEndpoints=p=>({getUsers:async()=>await p.get({url:"/api/global/users"}),searchUsers:async u=>await p.post({url:"/api/global/users/search",body:u}),getUser:async u=>await p.get({url:`/api/global/users/${u}`}),updateOwnMetadata:async u=>await p.post({url:"/api/users/metadata/self",body:u}),createAdminUser:async u=>await p.post({url:"/api/global/users/init",body:u}),saveUser:async u=>await p.post({url:"/api/global/users",body:u}),createUsers:async(u,f)=>(await p.post({url:"/api/global/users/bulk",body:{create:{users:u,groups:f}}})).created,deleteUser:async u=>await p.delete({url:`/api/global/users/${u}`}),deleteUsers:async u=>(await p.post({url:"/api/global/users/bulk",body:{delete:{users:u}}})).deleted,onboardUsers:async u=>await p.post({url:"/api/global/users/onboard",body:u}),updateUserInvite:async(u,f)=>await p.post({url:`/api/global/users/invite/update/${u}`,body:f}),getUserInvite:async u=>await p.get({url:`/api/global/users/invite/${u}`}),getUserInvites:async()=>await p.get({url:"/api/global/users/invites"}),inviteUsers:async u=>await p.post({url:"/api/global/users/multi/invite",body:u}),removeUserInvites:async u=>await p.post({url:"/api/global/users/multi/invite/delete",body:u}),acceptInvite:async u=>await p.post({url:"/api/global/users/invite/accept",body:u}),getUserCountByApp:async u=>(await p.get({url:`/api/global/users/count/${u}`})).userCount,addAppBuilder:async(u,f)=>await p.post({url:`/api/global/users/${u}/app/${f}/builder`}),removeAppBuilder:async(u,f)=>await p.delete({url:`/api/global/users/${u}/app/${f}/builder`}),getAccountHolder:async()=>await p.get({url:"/api/global/users/accountholder"})}),buildSelfEndpoints=p=>({generateAPIKey:async()=>{const u=await p.post({url:"/api/global/self/api_key"});return u==null?void 0:u.apiKey},fetchDeveloperInfo:async()=>p.get({url:"/api/global/self/api_key"}),fetchSelf:async()=>await p.get({url:"/api/self"}),fetchBuilderSelf:async()=>await p.get({url:"/api/global/self"}),updateSelf:async u=>await p.post({url:"/api/global/self",body:u})}),buildViewEndpoints=p=>({fetchViewData:async(u,{field:f,groupBy:m,calculation:v})=>{const y=new URLSearchParams;v&&(f&&y.set("field",f),y.set("calculation",v)),m&&y.set("group",m);const w=f?`/api/views/${encodeURIComponent(u)}?${y}`:`/api/views/${encodeURIComponent(u)}`;return await p.get({url:w})},exportView:async(u,f)=>{const m=encodeURIComponent(u);return await p.get({url:`/api/views/export?view=${m}&format=${f}`,parseResponse:async v=>await v.text()})},saveView:async u=>await p.post({url:"/api/views",body:u}),deleteView:async u=>await p.delete({url:`/api/views/${encodeURIComponent(u)}`})}),buildViewV2Endpoints=p=>({fetchDefinition:async u=>await p.get({url:`/api/v2/views/${encodeURIComponent(u)}`,cache:!0}),create:async u=>await p.post({url:"/api/v2/views",body:u}),update:async u=>await p.put({url:`/api/v2/views/${encodeURIComponent(u.id)}`,body:u}),fetch:async(u,f)=>await p.post({url:`/api/v2/views/${encodeURIComponent(u)}/search`,body:f}),delete:async u=>await p.delete({url:`/api/v2/views/${encodeURIComponent(u)}`})}),buildLicensingEndpoints=p=>({activateLicenseKey:async u=>p.post({url:"/api/global/license/key",body:{licenseKey:u}}),deleteLicenseKey:async()=>p.delete({url:"/api/global/license/key"}),getLicenseKey:async()=>{try{return await p.get({url:"/api/global/license/key"})}catch(u){if(u.status!==404)throw u}},activateOfflineLicense:async u=>p.post({url:"/api/global/license/offline",body:{offlineLicenseToken:u}}),deleteOfflineLicense:async()=>p.delete({url:"/api/global/license/offline"}),getOfflineLicense:async()=>{try{return await p.get({url:"/api/global/license/offline"})}catch(u){if(u.status!==404)throw u}},getOfflineLicenseIdentifier:async()=>await p.get({url:"/api/global/license/offline/identifier"}),refreshLicense:async()=>p.post({url:"/api/global/license/refresh"}),getQuotaUsage:async()=>p.get({url:"/api/global/license/usage"})}),buildGroupsEndpoints=p=>{async function u(f,m,v,y){return await p.post({url:`/api/global/groups/${f}/${m}`,body:{[v]:y}})}return{saveGroup:async f=>await p.post({url:"/api/global/groups",body:f}),getGroups:async()=>(await p.get({url:"/api/global/groups"})).data,getGroup:async f=>await p.get({url:`/api/global/groups/${f}`}),deleteGroup:async(f,m)=>await p.delete({url:`/api/global/groups/${f}/${m}`}),getGroupUsers:async({id:f,bookmark:m,emailSearch:v})=>{let y=`/api/global/groups/${f}/users?`;return m&&(y+=`bookmark=${m}&`),v&&(y+=`emailSearch=${v}`),await p.get({url:y})},addUsersToGroup:async(f,m)=>u(f,"users","add",m),removeUsersFromGroup:async(f,m)=>u(f,"users","remove",m),addAppsToGroup:async(f,m)=>u(f,"apps","add",m),removeAppsFromGroup:async(f,m)=>u(f,"apps","remove",m),addGroupAppBuilder:async(f,m)=>await p.post({url:`/api/global/groups/${f}/app/${m}/builder`}),removeGroupAppBuilder:async(f,m)=>await p.delete({url:`/api/global/groups/${f}/app/${m}/builder`})}},buildPluginEndpoints=p=>({uploadPlugin:async u=>await p.post({url:"/api/plugin/upload",body:u,json:!1}),createPlugin:async u=>await p.post({url:"/api/plugin",body:u}),getPlugins:async()=>await p.get({url:"/api/plugin"}),deletePlugin:async u=>await p.delete({url:`/api/plugin/${u}`})}),buildBackupEndpoints=p=>({createManualBackup:async u=>await p.post({url:`/api/apps/${u}/backups`}),searchBackups:async(u,f)=>await p.post({url:`/api/apps/${u}/backups/search`,body:f}),deleteBackup:async(u,f)=>await p.delete({url:`/api/apps/${u}/backups/${f}`}),restoreBackup:async(u,f,m)=>await p.post({url:`/api/apps/${u}/backups/${f}/import`,body:{name:m}})}),buildEnvironmentVariableEndpoints=p=>({checkEnvironmentVariableStatus:async()=>await p.get({url:"/api/env/variables/status"}),fetchEnvironmentVariables:async()=>await p.get({url:"/api/env/variables",json:!1}),createEnvironmentVariable:async u=>await p.post({url:"/api/env/variables",body:u}),deleteEnvironmentVariable:async u=>await p.delete({url:`/api/env/variables/${u}`}),updateEnvironmentVariable:async(u,f)=>await p.patch({url:`/api/env/variables/${u}`,body:f})}),buildEventEndpoints=p=>({publishEvent:async u=>await p.post({url:"/api/global/event/publish",body:{type:u}})}),buildAuditLogEndpoints=p=>({searchAuditLogs:async u=>await p.post({url:"/api/global/auditlogs/search",body:u}),getEventDefinitions:async()=>await p.get({url:"/api/global/auditlogs/definitions"}),getDownloadUrl:u=>`/api/global/auditlogs/download?query=${encodeURIComponent(JSON.stringify(u))}`}),buildLogsEndpoints=p=>({getSystemLogs:async()=>await p.get({url:"/api/system/logs",json:!1,parseResponse:async u=>u})}),buildMigrationEndpoints=p=>({getMigrationStatus:async()=>await p.get({url:"/api/migrations/status"})}),buildRowActionEndpoints=p=>({fetch:async u=>(await p.get({url:`/api/tables/${u}/actions`})).actions,create:async(u,f)=>await p.post({url:`/api/tables/${u}/actions`,body:{name:f}}),delete:async(u,f)=>await p.delete({url:`/api/tables/${u}/actions/${f}`}),enableView:async(u,f,m)=>await p.post({url:`/api/tables/${u}/actions/${f}/permissions/${m}`}),disableView:async(u,f,m)=>await p.delete({url:`/api/tables/${u}/actions/${f}/permissions/${m}`}),trigger:async(u,f,m)=>await p.post({url:`/api/tables/${u}/actions/${f}/trigger`,body:{rowId:m}})}),APISessionID=uuid(),createAPIClient=(p={})=>{let u={};const f=async(M,T,E=!1)=>{let H=M.statusText,F=null;try{F=await M.json(),F!=null&&F.message?H=F.message:F!=null&&F.error&&(H=JSON.stringify(F.error))}catch{}return{message:H,json:F,status:M.status,url:M.url,method:T,handled:!0,suppressErrors:E}},m=(M,T,E)=>({message:M,json:null,status:400,url:T,method:E,handled:!0,suppressErrors:!1}),v=async M=>{let{json:T,method:E,external:H,body:F,url:Z,parseResponse:$,suppressErrors:J}=M;T=T&&E!==HTTPMethod.GET;let se={Accept:"application/json"};se[Header.SESSION_ID]=APISessionID,H||(se[Header.API_VER]=ApiVersion),T&&(se["Content-Type"]="application/json"),p!=null&&p.attachHeaders&&p.attachHeaders(se);let ie=F;if(T)try{ie=JSON.stringify(F)}catch{throw m("Invalid JSON body",Z,E)}let he;try{he=await fetch(Z,{method:E,headers:se,body:ie,credentials:"same-origin"})}catch{throw delete u[Z],m("Failed to send request",Z,E)}if(he.status>=200&&he.status<400){y(he);try{return he.status===204?void 0:$?await $(he):await he.json()}catch(fe){throw delete u[Z],`Failed to parse response: ${fe}`}}else throw delete u[Z],await f(he,E,J)},y=M=>{if(!p.onMigrationDetected)return;const T=M.headers.get(Header.MIGRATING_APP);T&&p.onMigrationDetected(T)},w=async M=>{const T=M.url;return u[T]||(u[T]=v(M),u[T]=await u[T]),await u[T]},k=M=>async T=>{try{let E={json:!0,external:!1,suppressErrors:!1,cache:!1,method:M,...T},{url:H,cache:F,external:Z}=E;return Z||(E.url=`/${H}`.replace("//","/")),await(F&&(p==null?void 0:p.enableCaching)?w:v)(E)}catch(E){throw p!=null&&p.onError&&p.onError(E),E}};let S={post:k(HTTPMethod.POST),get:k(HTTPMethod.GET),patch:k(HTTPMethod.PATCH),delete:k(HTTPMethod.DELETE),put:k(HTTPMethod.PUT),invalidateCache:()=>{u={}},getAppID:()=>{var T;let M={};return(T=p==null?void 0:p.attachHeaders)==null||T.call(p,M),M==null?void 0:M[Header.APP_ID]}};return{...S,...buildAIEndpoints(S),...buildAnalyticsEndpoints(S),...buildAppEndpoints(S),...buildAttachmentEndpoints(S),...buildAuthEndpoints(S),...buildAutomationEndpoints(S),...buildConfigEndpoints(S),...buildDatasourceEndpoints(S),...buildFlagEndpoints(S),...buildLayoutEndpoints(S),...buildOtherEndpoints(S),...buildPermissionsEndpoints(S),...buildQueryEndpoints(S),...buildRelationshipEndpoints(S),...buildRoleEndpoints(S),...buildRouteEndpoints(S),...buildRowEndpoints(S),...buildScreenEndpoints(S),...buildTableEndpoints(S),...buildTemplateEndpoints(S),...buildUserEndpoints(S),...buildViewEndpoints(S),...buildSelfEndpoints(S),...buildLicensingEndpoints(S),...buildGroupsEndpoints(S),...buildPluginEndpoints(S),...buildBackupEndpoints(S),...buildEnvironmentVariableEndpoints(S),...buildEventEndpoints(S),...buildAuditLogEndpoints(S),...buildLogsEndpoints(S),...buildMigrationEndpoints(S),viewV2:buildViewV2Endpoints(S),rowActions:buildRowActionEndpoints(S)}},getJSONArrayDatasourceSchema=(p,u)=>{let f=p,m=[];u.prefixKeys&&(m=u.prefixKeys.concat(["schema"])),m=m.concat(u.label.split(".").slice(2));for(let v=0;v<m.length;v++)f=f==null?void 0:f[m[v]],f!=null&&f.schema&&(f=f.schema);return convertJSONSchemaToTableSchema(f,{squashObjects:!0,prefixKeys:m})},convertJSONSchemaToTableSchema=(p,u)=>{if(!p)return null;u={squashObjects:!1,prefixKeys:null,...u},p.schema?p=p.schema:p={value:p};const f=extractJSONSchemaKeys(p,u.squashObjects);let m={};return f.forEach(({key:v,type:y})=>{m[v]={type:y,name:v,prefixKeys:u.prefixKeys}}),m},extractJSONSchemaKeys=(p,u=!1)=>{if(!p||!Object.keys(p).length)return[];let f=[];return Object.keys(p).forEach(m=>{const v=p[m].type;if(v==="json"&&u){const y=extractJSONSchemaKeys(p[m].schema,u);f=f.concat(y.map(w=>({key:`${m}.${w.key}`,type:w.type})))}else f.push({key:m,type:v==="array"?"jsonarray":v})}),f},generateQueryArraySchemas=(p,u)=>{var f,m;for(let v in p)((f=p[v])==null?void 0:f.type)==="json"&&((m=p[v])==null?void 0:m.subtype)==="array"&&hasSchema(u[v])&&(p[v]={schema:{schema:Object.entries(u[v]||{}).reduce((y,[w,k])=>(y[w]={name:w,type:k.type,subtype:k.subtype},y),{}),type:"json"},type:"json",subtype:"array"});return p};function setCookie(p,u,f){getCookie(p)&&removeCookie(p);let m=`${p}=${u}; Path=/;`;f&&(m+=` Domain=${f};`),window.document.cookie=m}function getCookie(p){const f=`; ${document.cookie}`.split(`; ${p}=`);if(f.length===2)return f[1].split(";").shift()}function removeCookie(p){getCookie(p)&&(document.cookie=`${p}=; Max-Age=-99999999; Path=/;`)}const RolePriorities={[Roles.ADMIN]:5,[Roles.CREATOR]:4,[Roles.POWER]:3,[Roles.BASIC]:2,[Roles.PUBLIC]:1},getRolePriority=p=>RolePriorities[p]??0,sleep=p=>new Promise(u=>setTimeout(u,p)),debounce=(p,u=1e3)=>{let f;return async(...m)=>new Promise(v=>{f&&clearTimeout(f),f=setTimeout(async()=>{v(await p(...m))},u)})},throttle=(p,u=1e3)=>{let f,m=!1,v=!1;const y=(...w)=>{if(f=w,m){v=!0;return}p(...f),m=!0,setTimeout(()=>{m=!1,v&&(v=!1,y(...f))},u)};return y},domDebounce=p=>{let u=!1,f;return(...m)=>{f=m,u||(u=!0,requestAnimationFrame(()=>{p(...f),u=!1}))}},buildFormBlockButtonConfig=p=>{const{_id:u,actionType:f,dataSource:m,notificationOverride:v,actionUrl:y,showDeleteButton:w,deleteButtonLabel:k,showSaveButton:S,saveButtonLabel:M}=p||{};if(!u)return;const T=`${u}-form`,E=`${u}-repeater`,H=m==null?void 0:m.resourceId,F=w===!1?"":k==null?void 0:k.trim(),Z=S===!1?"":M==null?void 0:M.trim(),$=[{"##eventHandlerType":"Validate Form",parameters:{componentId:T}},{"##eventHandlerType":"Save Row",parameters:{providerId:T,tableId:H,notificationOverride:v,confirm:null}},{"##eventHandlerType":"Close Screen Modal"},{"##eventHandlerType":"Close Side Panel"},{"##eventHandlerType":"Close Modal"},...f!=="Create"?[]:[{"##eventHandlerType":"Clear Form",parameters:{componentId:T}}],...y?[{"##eventHandlerType":"Navigate To",parameters:{url:y}}]:[]],J=[{"##eventHandlerType":"Delete Row",parameters:{confirm:!0,tableId:H,rowId:`{{ ${makePropSafe(E)}.${makePropSafe("_id")} }}`,revId:`{{ ${makePropSafe(E)}.${makePropSafe("_rev")} }}`,notificationOverride:v}},{"##eventHandlerType":"Close Screen Modal"},{"##eventHandlerType":"Close Side Panel"},{"##eventHandlerType":"Close Modal"},...y?[{"##eventHandlerType":"Navigate To",parameters:{url:y}}]:[]],se=[];return f&&["Update","Create"].includes(f)&&S!==!1&&se.push({text:Z||"Save",_id:uuid(),_component:"@budibase/standard-components/button",onClick:$,type:"cta"}),f==="Update"&&w!==!1&&se.push({text:F||"Delete",_id:uuid(),_component:"@budibase/standard-components/button",onClick:J,quiet:!0,type:"warning"}),se},buildMultiStepFormBlockDefaultProps=p=>{const{_id:u,stepCount:f,currentStep:m,actionType:v,dataSource:y}=p||{};if(!u||!f)return;const w=`Step {{ [${u}-form].[__currentStep] }}`,k=y==null?void 0:y.resourceId,S=`${u}-form`;let M=[];return m!==0&&M.push({_id:uuid(),_component:"@budibase/standard-components/button",_instanceName:uuid(),text:"Back",type:"secondary",size:"M",onClick:[{parameters:{type:"prev",componentId:S},"##eventHandlerType":"Change Form Step"}]}),m!==f-1&&M.push({_id:uuid(),_component:"@budibase/standard-components/button",_instanceName:uuid(),text:"Next",type:"cta",size:"M",onClick:[{"##eventHandlerType":"Validate Form",parameters:{componentId:S}},{parameters:{type:"next",componentId:S},"##eventHandlerType":"Change Form Step"}]}),v!=="View"&&m===f-1&&M.push({_id:uuid(),_component:"@budibase/standard-components/button",_instanceName:uuid(),text:"Save",type:"cta",size:"M",onClick:[{"##eventHandlerType":"Validate Form",parameters:{componentId:S}},{"##eventHandlerType":"Save Row",parameters:{tableId:k,providerId:S}},...v!=="Create"?[]:[{"##eventHandlerType":"Clear Form",parameters:{componentId:S}}]]}),{buttons:M,title:w}};function parseFilter(p){var f;if(!(p!=null&&p.groups))return p;const u=lodashExports.cloneDeep(p);return u.groups=(f=u.groups)==null?void 0:f.map(m=>{var v,y;return m.filters=(v=m.filters)==null?void 0:v.filter(w=>w.field&&w.operator),(y=m.filters)!=null&&y.length?m:null}).filter(m=>!!m),u}const isBetterSample=(p,u)=>{if(u==null&&p!=null)return!0;if(u!=null&&p==null)return!1;const f=typeof u,m=typeof p;return f!==m?!1:m==="string"&&p.length>u.length||m==="object"&&Object.keys(p).length>Object.keys(u).length},generateGoldenSample=p=>{let u={};return p==null||p.slice(0,100).forEach(f=>{Object.keys(f).forEach(m=>{isBetterSample(f[m],u[m])&&(u[m]=f[m])})}),u},getColumnIcon=p=>{if(p.schema.icon)return p.schema.icon;if(p.calculationType)return"Calculator";if(p.schema.autocolumn)return"MagicWand";if(isDeprecatedSingleUserColumn(p.schema))return"User";const{type:u,subtype:f}=p.schema;return(typeof TypeIconMap[u]=="object"&&f?TypeIconMap[u][f]:TypeIconMap[u])||"Text"},memo=p=>{const u=writable(p);let f=JSON.stringify(p);const m=v=>{const y=JSON.stringify(v);y!==f&&(u.set(v),f=y)};return{subscribe:u.subscribe,set:m,update:v=>{let y=JSON.parse(f);const w=v(y);m(w)}}},derivedMemo=(p,u)=>{const f=derived(p,u),m=memo(get_store_value(f));return f.subscribe(m.set),m},PACKET_TYPES=Object.create(null);PACKET_TYPES.open="0",PACKET_TYPES.close="1",PACKET_TYPES.ping="2",PACKET_TYPES.pong="3",PACKET_TYPES.message="4",PACKET_TYPES.upgrade="5",PACKET_TYPES.noop="6";const PACKET_TYPES_REVERSE=Object.create(null);Object.keys(PACKET_TYPES).forEach(p=>{PACKET_TYPES_REVERSE[PACKET_TYPES[p]]=p});const ERROR_PACKET={type:"error",data:"parser error"},withNativeBlob$1=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",withNativeArrayBuffer$2=typeof ArrayBuffer=="function",isView$1=p=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(p):p&&p.buffer instanceof ArrayBuffer,encodePacket=({type:p,data:u},f,m)=>withNativeBlob$1&&u instanceof Blob?f?m(u):encodeBlobAsBase64(u,m):withNativeArrayBuffer$2&&(u instanceof ArrayBuffer||isView$1(u))?f?m(u):encodeBlobAsBase64(new Blob([u]),m):m(PACKET_TYPES[p]+(u||"")),encodeBlobAsBase64=(p,u)=>{const f=new FileReader;return f.onload=function(){const m=f.result.split(",")[1];u("b"+(m||""))},f.readAsDataURL(p)};function toArray(p){return p instanceof Uint8Array?p:p instanceof ArrayBuffer?new Uint8Array(p):new Uint8Array(p.buffer,p.byteOffset,p.byteLength)}let TEXT_ENCODER;function encodePacketToBinary(p,u){if(withNativeBlob$1&&p.data instanceof Blob)return p.data.arrayBuffer().then(toArray).then(u);if(withNativeArrayBuffer$2&&(p.data instanceof ArrayBuffer||isView$1(p.data)))return u(toArray(p.data));encodePacket(p,!1,f=>{TEXT_ENCODER||(TEXT_ENCODER=new TextEncoder),u(TEXT_ENCODER.encode(f))})}const chars="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",lookup$2=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let p=0;p<chars.length;p++)lookup$2[chars.charCodeAt(p)]=p;const decode$2=p=>{let u=p.length*.75,f=p.length,m,v=0,y,w,k,S;p[p.length-1]==="="&&(u--,p[p.length-2]==="="&&u--);const M=new ArrayBuffer(u),T=new Uint8Array(M);for(m=0;m<f;m+=4)y=lookup$2[p.charCodeAt(m)],w=lookup$2[p.charCodeAt(m+1)],k=lookup$2[p.charCodeAt(m+2)],S=lookup$2[p.charCodeAt(m+3)],T[v++]=y<<2|w>>4,T[v++]=(w&15)<<4|k>>2,T[v++]=(k&3)<<6|S&63;return M},withNativeArrayBuffer$1=typeof ArrayBuffer=="function",decodePacket=(p,u)=>{if(typeof p!="string")return{type:"message",data:mapBinary(p,u)};const f=p.charAt(0);return f==="b"?{type:"message",data:decodeBase64Packet(p.substring(1),u)}:PACKET_TYPES_REVERSE[f]?p.length>1?{type:PACKET_TYPES_REVERSE[f],data:p.substring(1)}:{type:PACKET_TYPES_REVERSE[f]}:ERROR_PACKET},decodeBase64Packet=(p,u)=>{if(withNativeArrayBuffer$1){const f=decode$2(p);return mapBinary(f,u)}else return{base64:!0,data:p}},mapBinary=(p,u)=>{switch(u){case"blob":return p instanceof Blob?p:new Blob([p]);case"arraybuffer":default:return p instanceof ArrayBuffer?p:p.buffer}},SEPARATOR=String.fromCharCode(30),encodePayload=(p,u)=>{const f=p.length,m=new Array(f);let v=0;p.forEach((y,w)=>{encodePacket(y,!1,k=>{m[w]=k,++v===f&&u(m.join(SEPARATOR))})})},decodePayload=(p,u)=>{const f=p.split(SEPARATOR),m=[];for(let v=0;v<f.length;v++){const y=decodePacket(f[v],u);if(m.push(y),y.type==="error")break}return m};function createPacketEncoderStream(){return new TransformStream({transform(p,u){encodePacketToBinary(p,f=>{const m=f.length;let v;if(m<126)v=new Uint8Array(1),new DataView(v.buffer).setUint8(0,m);else if(m<65536){v=new Uint8Array(3);const y=new DataView(v.buffer);y.setUint8(0,126),y.setUint16(1,m)}else{v=new Uint8Array(9);const y=new DataView(v.buffer);y.setUint8(0,127),y.setBigUint64(1,BigInt(m))}p.data&&typeof p.data!="string"&&(v[0]|=128),u.enqueue(v),u.enqueue(f)})}})}let TEXT_DECODER;function totalLength(p){return p.reduce((u,f)=>u+f.length,0)}function concatChunks(p,u){if(p[0].length===u)return p.shift();const f=new Uint8Array(u);let m=0;for(let v=0;v<u;v++)f[v]=p[0][m++],m===p[0].length&&(p.shift(),m=0);return p.length&&m<p[0].length&&(p[0]=p[0].slice(m)),f}function createPacketDecoderStream(p,u){TEXT_DECODER||(TEXT_DECODER=new TextDecoder);const f=[];let m=0,v=-1,y=!1;return new TransformStream({transform(w,k){for(f.push(w);;){if(m===0){if(totalLength(f)<1)break;const S=concatChunks(f,1);y=(S[0]&128)===128,v=S[0]&127,v<126?m=3:v===126?m=1:m=2}else if(m===1){if(totalLength(f)<2)break;const S=concatChunks(f,2);v=new DataView(S.buffer,S.byteOffset,S.length).getUint16(0),m=3}else if(m===2){if(totalLength(f)<8)break;const S=concatChunks(f,8),M=new DataView(S.buffer,S.byteOffset,S.length),T=M.getUint32(0);if(T>Math.pow(2,53-32)-1){k.enqueue(ERROR_PACKET);break}v=T*Math.pow(2,32)+M.getUint32(4),m=3}else{if(totalLength(f)<v)break;const S=concatChunks(f,v);k.enqueue(decodePacket(y?S:TEXT_DECODER.decode(S),u)),m=0}if(v===0||v>p){k.enqueue(ERROR_PACKET);break}}}})}const protocol$1=4;function Emitter(p){if(p)return mixin(p)}function mixin(p){for(var u in Emitter.prototype)p[u]=Emitter.prototype[u];return p}Emitter.prototype.on=Emitter.prototype.addEventListener=function(p,u){return this._callbacks=this._callbacks||{},(this._callbacks["$"+p]=this._callbacks["$"+p]||[]).push(u),this},Emitter.prototype.once=function(p,u){function f(){this.off(p,f),u.apply(this,arguments)}return f.fn=u,this.on(p,f),this},Emitter.prototype.off=Emitter.prototype.removeListener=Emitter.prototype.removeAllListeners=Emitter.prototype.removeEventListener=function(p,u){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var f=this._callbacks["$"+p];if(!f)return this;if(arguments.length==1)return delete this._callbacks["$"+p],this;for(var m,v=0;v<f.length;v++)if(m=f[v],m===u||m.fn===u){f.splice(v,1);break}return f.length===0&&delete this._callbacks["$"+p],this},Emitter.prototype.emit=function(p){this._callbacks=this._callbacks||{};for(var u=new Array(arguments.length-1),f=this._callbacks["$"+p],m=1;m<arguments.length;m++)u[m-1]=arguments[m];if(f){f=f.slice(0);for(var m=0,v=f.length;m<v;++m)f[m].apply(this,u)}return this},Emitter.prototype.emitReserved=Emitter.prototype.emit,Emitter.prototype.listeners=function(p){return this._callbacks=this._callbacks||{},this._callbacks["$"+p]||[]},Emitter.prototype.hasListeners=function(p){return!!this.listeners(p).length};const globalThisShim=(()=>typeof self<"u"?self:typeof window<"u"?window:Function("return this")())();function pick(p,...u){return u.reduce((f,m)=>(p.hasOwnProperty(m)&&(f[m]=p[m]),f),{})}const NATIVE_SET_TIMEOUT=globalThisShim.setTimeout,NATIVE_CLEAR_TIMEOUT=globalThisShim.clearTimeout;function installTimerFunctions(p,u){u.useNativeTimers?(p.setTimeoutFn=NATIVE_SET_TIMEOUT.bind(globalThisShim),p.clearTimeoutFn=NATIVE_CLEAR_TIMEOUT.bind(globalThisShim)):(p.setTimeoutFn=globalThisShim.setTimeout.bind(globalThisShim),p.clearTimeoutFn=globalThisShim.clearTimeout.bind(globalThisShim))}const BASE64_OVERHEAD=1.33;function byteLength(p){return typeof p=="string"?utf8Length(p):Math.ceil((p.byteLength||p.size)*BASE64_OVERHEAD)}function utf8Length(p){let u=0,f=0;for(let m=0,v=p.length;m<v;m++)u=p.charCodeAt(m),u<128?f+=1:u<2048?f+=2:u<55296||u>=57344?f+=3:(m++,f+=4);return f}function encode$2(p){let u="";for(let f in p)p.hasOwnProperty(f)&&(u.length&&(u+="&"),u+=encodeURIComponent(f)+"="+encodeURIComponent(p[f]));return u}function decode$1(p){let u={},f=p.split("&");for(let m=0,v=f.length;m<v;m++){let y=f[m].split("=");u[decodeURIComponent(y[0])]=decodeURIComponent(y[1])}return u}class TransportError extends Error{constructor(u,f,m){super(u),this.description=f,this.context=m,this.type="TransportError"}}class Transport extends Emitter{constructor(u){super(),this.writable=!1,installTimerFunctions(this,u),this.opts=u,this.query=u.query,this.socket=u.socket}onError(u,f,m){return super.emitReserved("error",new TransportError(u,f,m)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(u){this.readyState==="open"&&this.write(u)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(u){const f=decodePacket(u,this.socket.binaryType);this.onPacket(f)}onPacket(u){super.emitReserved("packet",u)}onClose(u){this.readyState="closed",super.emitReserved("close",u)}pause(u){}createUri(u,f={}){return u+"://"+this._hostname()+this._port()+this.opts.path+this._query(f)}_hostname(){const u=this.opts.hostname;return u.indexOf(":")===-1?u:"["+u+"]"}_port(){return this.opts.port&&(this.opts.secure&&+(this.opts.port!==443)||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(u){const f=encode$2(u);return f.length?"?"+f:""}}const alphabet$3="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_".split(""),length=64,map={};let seed$1=0,i=0,prev;function encode$1(p){let u="";do u=alphabet$3[p%length]+u,p=Math.floor(p/length);while(p>0);return u}function yeast(){const p=encode$1(+new Date);return p!==prev?(seed$1=0,prev=p):p+"."+encode$1(seed$1++)}for(;i<length;i++)map[alphabet$3[i]]=i;let value$1=!1;try{value$1=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch(p){}const hasCORS=value$1;function XHR(p){const u=p.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!u||hasCORS))return new XMLHttpRequest}catch{}if(!u)try{return new globalThisShim[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}function createCookieJar(){}function empty(){}const hasXHR2=function(){return new XHR({xdomain:!1}).responseType!=null}();class Polling extends Transport{constructor(u){if(super(u),this.polling=!1,typeof location<"u"){const m=location.protocol==="https:";let v=location.port;v||(v=m?"443":"80"),this.xd=typeof location<"u"&&u.hostname!==location.hostname||v!==u.port}const f=u&&u.forceBase64;this.supportsBinary=hasXHR2&&!f,this.opts.withCredentials&&(this.cookieJar=void 0)}get name(){return"polling"}doOpen(){this.poll()}pause(u){this.readyState="pausing";const f=()=>{this.readyState="paused",u()};if(this.polling||!this.writable){let m=0;this.polling&&(m++,this.once("pollComplete",function(){--m||f()})),this.writable||(m++,this.once("drain",function(){--m||f()}))}else f()}poll(){this.polling=!0,this.doPoll(),this.emitReserved("poll")}onData(u){const f=m=>{if(this.readyState==="opening"&&m.type==="open"&&this.onOpen(),m.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(m)};decodePayload(u,this.socket.binaryType).forEach(f),this.readyState!=="closed"&&(this.polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this.poll())}doClose(){const u=()=>{this.write([{type:"close"}])};this.readyState==="open"?u():this.once("open",u)}write(u){this.writable=!1,encodePayload(u,f=>{this.doWrite(f,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const u=this.opts.secure?"https":"http",f=this.query||{};return this.opts.timestampRequests!==!1&&(f[this.opts.timestampParam]=yeast()),!this.supportsBinary&&!f.sid&&(f.b64=1),this.createUri(u,f)}request(u={}){return Object.assign(u,{xd:this.xd,cookieJar:this.cookieJar},this.opts),new Request(this.uri(),u)}doWrite(u,f){const m=this.request({method:"POST",data:u});m.on("success",f),m.on("error",(v,y)=>{this.onError("xhr post error",v,y)})}doPoll(){const u=this.request();u.on("data",this.onData.bind(this)),u.on("error",(f,m)=>{this.onError("xhr poll error",f,m)}),this.pollXhr=u}}class Request extends Emitter{constructor(u,f){super(),installTimerFunctions(this,f),this.opts=f,this.method=f.method||"GET",this.uri=u,this.data=f.data!==void 0?f.data:null,this.create()}create(){var u;const f=pick(this.opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");f.xdomain=!!this.opts.xd;const m=this.xhr=new XHR(f);try{m.open(this.method,this.uri,!0);try{if(this.opts.extraHeaders){m.setDisableHeaderCheck&&m.setDisableHeaderCheck(!0);for(let v in this.opts.extraHeaders)this.opts.extraHeaders.hasOwnProperty(v)&&m.setRequestHeader(v,this.opts.extraHeaders[v])}}catch{}if(this.method==="POST")try{m.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{m.setRequestHeader("Accept","*/*")}catch{}(u=this.opts.cookieJar)===null||u===void 0||u.addCookies(m),"withCredentials"in m&&(m.withCredentials=this.opts.withCredentials),this.opts.requestTimeout&&(m.timeout=this.opts.requestTimeout),m.onreadystatechange=()=>{var v;m.readyState===3&&((v=this.opts.cookieJar)===null||v===void 0||v.parseCookies(m)),m.readyState===4&&(m.status===200||m.status===1223?this.onLoad():this.setTimeoutFn(()=>{this.onError(typeof m.status=="number"?m.status:0)},0))},m.send(this.data)}catch(v){this.setTimeoutFn(()=>{this.onError(v)},0);return}typeof document<"u"&&(this.index=Request.requestsCount++,Request.requests[this.index]=this)}onError(u){this.emitReserved("error",u,this.xhr),this.cleanup(!0)}cleanup(u){if(!(typeof this.xhr>"u"||this.xhr===null)){if(this.xhr.onreadystatechange=empty,u)try{this.xhr.abort()}catch{}typeof document<"u"&&delete Request.requests[this.index],this.xhr=null}}onLoad(){const u=this.xhr.responseText;u!==null&&(this.emitReserved("data",u),this.emitReserved("success"),this.cleanup())}abort(){this.cleanup()}}if(Request.requestsCount=0,Request.requests={},typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",unloadHandler);else if(typeof addEventListener=="function"){const p="onpagehide"in globalThisShim?"pagehide":"unload";addEventListener(p,unloadHandler,!1)}}function unloadHandler(){for(let p in Request.requests)Request.requests.hasOwnProperty(p)&&Request.requests[p].abort()}const nextTick=(()=>typeof Promise=="function"&&typeof Promise.resolve=="function"?u=>Promise.resolve().then(u):(u,f)=>f(u,0))(),WebSocket=globalThisShim.WebSocket||globalThisShim.MozWebSocket,usingBrowserWebSocket=!0,defaultBinaryType="arraybuffer",isReactNative=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class WS extends Transport{constructor(u){super(u),this.supportsBinary=!u.forceBase64}get name(){return"websocket"}doOpen(){if(!this.check())return;const u=this.uri(),f=this.opts.protocols,m=isReactNative?{}:pick(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(m.headers=this.opts.extraHeaders);try{this.ws=usingBrowserWebSocket&&!isReactNative?f?new WebSocket(u,f):new WebSocket(u):new WebSocket(u,f,m)}catch(v){return this.emitReserved("error",v)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=u=>this.onClose({description:"websocket connection closed",context:u}),this.ws.onmessage=u=>this.onData(u.data),this.ws.onerror=u=>this.onError("websocket error",u)}write(u){this.writable=!1;for(let f=0;f<u.length;f++){const m=u[f],v=f===u.length-1;encodePacket(m,this.supportsBinary,y=>{const w={};try{usingBrowserWebSocket&&this.ws.send(y)}catch{}v&&nextTick(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.close(),this.ws=null)}uri(){const u=this.opts.secure?"wss":"ws",f=this.query||{};return this.opts.timestampRequests&&(f[this.opts.timestampParam]=yeast()),this.supportsBinary||(f.b64=1),this.createUri(u,f)}check(){return!!WebSocket}}class WT extends Transport{get name(){return"webtransport"}doOpen(){typeof WebTransport=="function"&&(this.transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name]),this.transport.closed.then(()=>{this.onClose()}).catch(u=>{this.onError("webtransport error",u)}),this.transport.ready.then(()=>{this.transport.createBidirectionalStream().then(u=>{const f=createPacketDecoderStream(Number.MAX_SAFE_INTEGER,this.socket.binaryType),m=u.readable.pipeThrough(f).getReader(),v=createPacketEncoderStream();v.readable.pipeTo(u.writable),this.writer=v.writable.getWriter();const y=()=>{m.read().then(({done:k,value:S})=>{k||(this.onPacket(S),y())}).catch(k=>{})};y();const w={type:"open"};this.query.sid&&(w.data=`{"sid":"${this.query.sid}"}`),this.writer.write(w).then(()=>this.onOpen())})}))}write(u){this.writable=!1;for(let f=0;f<u.length;f++){const m=u[f],v=f===u.length-1;this.writer.write(m).then(()=>{v&&nextTick(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var u;(u=this.transport)===null||u===void 0||u.close()}}const transports={websocket:WS,webtransport:WT,polling:Polling},re=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,parts=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function parse$6(p){if(p.length>2e3)throw"URI too long";const u=p,f=p.indexOf("["),m=p.indexOf("]");f!=-1&&m!=-1&&(p=p.substring(0,f)+p.substring(f,m).replace(/:/g,";")+p.substring(m,p.length));let v=re.exec(p||""),y={},w=14;for(;w--;)y[parts[w]]=v[w]||"";return f!=-1&&m!=-1&&(y.source=u,y.host=y.host.substring(1,y.host.length-1).replace(/;/g,":"),y.authority=y.authority.replace("[","").replace("]","").replace(/;/g,":"),y.ipv6uri=!0),y.pathNames=pathNames(y,y.path),y.queryKey=queryKey(y,y.query),y}function pathNames(p,u){const f=/\/{2,9}/g,m=u.replace(f,"/").split("/");return(u.slice(0,1)=="/"||u.length===0)&&m.splice(0,1),u.slice(-1)=="/"&&m.splice(m.length-1,1),m}function queryKey(p,u){const f={};return u.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(m,v,y){v&&(f[v]=y)}),f}let Socket$1=class Ec extends Emitter{constructor(u,f={}){super(),this.binaryType=defaultBinaryType,this.writeBuffer=[],u&&typeof u=="object"&&(f=u,u=null),u?(u=parse$6(u),f.hostname=u.host,f.secure=u.protocol==="https"||u.protocol==="wss",f.port=u.port,u.query&&(f.query=u.query)):f.host&&(f.hostname=parse$6(f.host).host),installTimerFunctions(this,f),this.secure=f.secure!=null?f.secure:typeof location<"u"&&location.protocol==="https:",f.hostname&&!f.port&&(f.port=this.secure?"443":"80"),this.hostname=f.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=f.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=f.transports||["polling","websocket","webtransport"],this.writeBuffer=[],this.prevBufferLen=0,this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},f),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=decode$1(this.opts.query)),this.id=null,this.upgrades=null,this.pingInterval=null,this.pingTimeout=null,this.pingTimeoutTimer=null,typeof addEventListener=="function"&&(this.opts.closeOnBeforeunload&&(this.beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this.beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this.offlineEventListener=()=>{this.onClose("transport close",{description:"network connection lost"})},addEventListener("offline",this.offlineEventListener,!1))),this.open()}createTransport(u){const f=Object.assign({},this.opts.query);f.EIO=protocol$1,f.transport=u,this.id&&(f.sid=this.id);const m=Object.assign({},this.opts,{query:f,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[u]);return new transports[u](m)}open(){let u;if(this.opts.rememberUpgrade&&Ec.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1)u="websocket";else if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}else u=this.transports[0];this.readyState="opening";try{u=this.createTransport(u)}catch{this.transports.shift(),this.open();return}u.open(),this.setTransport(u)}setTransport(u){this.transport&&this.transport.removeAllListeners(),this.transport=u,u.on("drain",this.onDrain.bind(this)).on("packet",this.onPacket.bind(this)).on("error",this.onError.bind(this)).on("close",f=>this.onClose("transport close",f))}probe(u){let f=this.createTransport(u),m=!1;Ec.priorWebsocketSuccess=!1;const v=()=>{m||(f.send([{type:"ping",data:"probe"}]),f.once("packet",E=>{if(!m)if(E.type==="pong"&&E.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",f),!f)return;Ec.priorWebsocketSuccess=f.name==="websocket",this.transport.pause(()=>{m||this.readyState!=="closed"&&(T(),this.setTransport(f),f.send([{type:"upgrade"}]),this.emitReserved("upgrade",f),f=null,this.upgrading=!1,this.flush())})}else{const H=new Error("probe error");H.transport=f.name,this.emitReserved("upgradeError",H)}}))};function y(){m||(m=!0,T(),f.close(),f=null)}const w=E=>{const H=new Error("probe error: "+E);H.transport=f.name,y(),this.emitReserved("upgradeError",H)};function k(){w("transport closed")}function S(){w("socket closed")}function M(E){f&&E.name!==f.name&&y()}const T=()=>{f.removeListener("open",v),f.removeListener("error",w),f.removeListener("close",k),this.off("close",S),this.off("upgrading",M)};f.once("open",v),f.once("error",w),f.once("close",k),this.once("close",S),this.once("upgrading",M),this.upgrades.indexOf("webtransport")!==-1&&u!=="webtransport"?this.setTimeoutFn(()=>{m||f.open()},200):f.open()}onOpen(){if(this.readyState="open",Ec.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush(),this.readyState==="open"&&this.opts.upgrade){let u=0;const f=this.upgrades.length;for(;u<f;u++)this.probe(this.upgrades[u])}}onPacket(u){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",u),this.emitReserved("heartbeat"),this.resetPingTimeout(),u.type){case"open":this.onHandshake(JSON.parse(u.data));break;case"ping":this.sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong");break;case"error":const f=new Error("server error");f.code=u.data,this.onError(f);break;case"message":this.emitReserved("data",u.data),this.emitReserved("message",u.data);break}}onHandshake(u){this.emitReserved("handshake",u),this.id=u.sid,this.transport.query.sid=u.sid,this.upgrades=this.filterUpgrades(u.upgrades),this.pingInterval=u.pingInterval,this.pingTimeout=u.pingTimeout,this.maxPayload=u.maxPayload,this.onOpen(),this.readyState!=="closed"&&this.resetPingTimeout()}resetPingTimeout(){this.clearTimeoutFn(this.pingTimeoutTimer),this.pingTimeoutTimer=this.setTimeoutFn(()=>{this.onClose("ping timeout")},this.pingInterval+this.pingTimeout),this.opts.autoUnref&&this.pingTimeoutTimer.unref()}onDrain(){this.writeBuffer.splice(0,this.prevBufferLen),this.prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const u=this.getWritablePackets();this.transport.send(u),this.prevBufferLen=u.length,this.emitReserved("flush")}}getWritablePackets(){if(!(this.maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let f=1;for(let m=0;m<this.writeBuffer.length;m++){const v=this.writeBuffer[m].data;if(v&&(f+=byteLength(v)),m>0&&f>this.maxPayload)return this.writeBuffer.slice(0,m);f+=2}return this.writeBuffer}write(u,f,m){return this.sendPacket("message",u,f,m),this}send(u,f,m){return this.sendPacket("message",u,f,m),this}sendPacket(u,f,m,v){if(typeof f=="function"&&(v=f,f=void 0),typeof m=="function"&&(v=m,m=null),this.readyState==="closing"||this.readyState==="closed")return;m=m||{},m.compress=m.compress!==!1;const y={type:u,data:f,options:m};this.emitReserved("packetCreate",y),this.writeBuffer.push(y),v&&this.once("flush",v),this.flush()}close(){const u=()=>{this.onClose("forced close"),this.transport.close()},f=()=>{this.off("upgrade",f),this.off("upgradeError",f),u()},m=()=>{this.once("upgrade",f),this.once("upgradeError",f)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?m():u()}):this.upgrading?m():u()),this}onError(u){Ec.priorWebsocketSuccess=!1,this.emitReserved("error",u),this.onClose("transport error",u)}onClose(u,f){(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")&&(this.clearTimeoutFn(this.pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),typeof removeEventListener=="function"&&(removeEventListener("beforeunload",this.beforeunloadEventListener,!1),removeEventListener("offline",this.offlineEventListener,!1)),this.readyState="closed",this.id=null,this.emitReserved("close",u,f),this.writeBuffer=[],this.prevBufferLen=0)}filterUpgrades(u){const f=[];let m=0;const v=u.length;for(;m<v;m++)~this.transports.indexOf(u[m])&&f.push(u[m]);return f}};Socket$1.protocol=protocol$1;function url(p,u="",f){let m=p;f=f||typeof location<"u"&&location,p==null&&(p=f.protocol+"//"+f.host),typeof p=="string"&&(p.charAt(0)==="/"&&(p.charAt(1)==="/"?p=f.protocol+p:p=f.host+p),/^(https?|wss?):\/\//.test(p)||(typeof f<"u"?p=f.protocol+"//"+p:p="https://"+p),m=parse$6(p)),m.port||(/^(http|ws)$/.test(m.protocol)?m.port="80":/^(http|ws)s$/.test(m.protocol)&&(m.port="443")),m.path=m.path||"/";const y=m.host.indexOf(":")!==-1?"["+m.host+"]":m.host;return m.id=m.protocol+"://"+y+":"+m.port+u,m.href=m.protocol+"://"+y+(f&&f.port===m.port?"":":"+m.port),m}const withNativeArrayBuffer=typeof ArrayBuffer=="function",isView=p=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(p):p.buffer instanceof ArrayBuffer,toString=Object.prototype.toString,withNativeBlob=typeof Blob=="function"||typeof Blob<"u"&&toString.call(Blob)==="[object BlobConstructor]",withNativeFile=typeof File=="function"||typeof File<"u"&&toString.call(File)==="[object FileConstructor]";function isBinary(p){return withNativeArrayBuffer&&(p instanceof ArrayBuffer||isView(p))||withNativeBlob&&p instanceof Blob||withNativeFile&&p instanceof File}function hasBinary(p,u){if(!p||typeof p!="object")return!1;if(Array.isArray(p)){for(let f=0,m=p.length;f<m;f++)if(hasBinary(p[f]))return!0;return!1}if(isBinary(p))return!0;if(p.toJSON&&typeof p.toJSON=="function"&&arguments.length===1)return hasBinary(p.toJSON(),!0);for(const f in p)if(Object.prototype.hasOwnProperty.call(p,f)&&hasBinary(p[f]))return!0;return!1}function deconstructPacket(p){const u=[],f=p.data,m=p;return m.data=_deconstructPacket(f,u),m.attachments=u.length,{packet:m,buffers:u}}function _deconstructPacket(p,u){if(!p)return p;if(isBinary(p)){const f={_placeholder:!0,num:u.length};return u.push(p),f}else if(Array.isArray(p)){const f=new Array(p.length);for(let m=0;m<p.length;m++)f[m]=_deconstructPacket(p[m],u);return f}else if(typeof p=="object"&&!(p instanceof Date)){const f={};for(const m in p)Object.prototype.hasOwnProperty.call(p,m)&&(f[m]=_deconstructPacket(p[m],u));return f}return p}function reconstructPacket(p,u){return p.data=_reconstructPacket(p.data,u),delete p.attachments,p}function _reconstructPacket(p,u){if(!p)return p;if(p&&p._placeholder===!0){if(typeof p.num=="number"&&p.num>=0&&p.num<u.length)return u[p.num];throw new Error("illegal attachments")}else if(Array.isArray(p))for(let f=0;f<p.length;f++)p[f]=_reconstructPacket(p[f],u);else if(typeof p=="object")for(const f in p)Object.prototype.hasOwnProperty.call(p,f)&&(p[f]=_reconstructPacket(p[f],u));return p}const RESERVED_EVENTS$1=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"],protocol=5;var PacketType;(function(p){p[p.CONNECT=0]="CONNECT",p[p.DISCONNECT=1]="DISCONNECT",p[p.EVENT=2]="EVENT",p[p.ACK=3]="ACK",p[p.CONNECT_ERROR=4]="CONNECT_ERROR",p[p.BINARY_EVENT=5]="BINARY_EVENT",p[p.BINARY_ACK=6]="BINARY_ACK"})(PacketType||(PacketType={}));class Encoder{constructor(u){this.replacer=u}encode(u){return(u.type===PacketType.EVENT||u.type===PacketType.ACK)&&hasBinary(u)?this.encodeAsBinary({type:u.type===PacketType.EVENT?PacketType.BINARY_EVENT:PacketType.BINARY_ACK,nsp:u.nsp,data:u.data,id:u.id}):[this.encodeAsString(u)]}encodeAsString(u){let f=""+u.type;return(u.type===PacketType.BINARY_EVENT||u.type===PacketType.BINARY_ACK)&&(f+=u.attachments+"-"),u.nsp&&u.nsp!=="/"&&(f+=u.nsp+","),u.id!=null&&(f+=u.id),u.data!=null&&(f+=JSON.stringify(u.data,this.replacer)),f}encodeAsBinary(u){const f=deconstructPacket(u),m=this.encodeAsString(f.packet),v=f.buffers;return v.unshift(m),v}}function isObject$1(p){return Object.prototype.toString.call(p)==="[object Object]"}class Decoder extends Emitter{constructor(u){super(),this.reviver=u}add(u){let f;if(typeof u=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");f=this.decodeString(u);const m=f.type===PacketType.BINARY_EVENT;m||f.type===PacketType.BINARY_ACK?(f.type=m?PacketType.EVENT:PacketType.ACK,this.reconstructor=new BinaryReconstructor(f),f.attachments===0&&super.emitReserved("decoded",f)):super.emitReserved("decoded",f)}else if(isBinary(u)||u.base64)if(this.reconstructor)f=this.reconstructor.takeBinaryData(u),f&&(this.reconstructor=null,super.emitReserved("decoded",f));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+u)}decodeString(u){let f=0;const m={type:Number(u.charAt(0))};if(PacketType[m.type]===void 0)throw new Error("unknown packet type "+m.type);if(m.type===PacketType.BINARY_EVENT||m.type===PacketType.BINARY_ACK){const y=f+1;for(;u.charAt(++f)!=="-"&&f!=u.length;);const w=u.substring(y,f);if(w!=Number(w)||u.charAt(f)!=="-")throw new Error("Illegal attachments");m.attachments=Number(w)}if(u.charAt(f+1)==="/"){const y=f+1;for(;++f&&!(u.charAt(f)===","||f===u.length););m.nsp=u.substring(y,f)}else m.nsp="/";const v=u.charAt(f+1);if(v!==""&&Number(v)==v){const y=f+1;for(;++f;){const w=u.charAt(f);if(w==null||Number(w)!=w){--f;break}if(f===u.length)break}m.id=Number(u.substring(y,f+1))}if(u.charAt(++f)){const y=this.tryParse(u.substr(f));if(Decoder.isPayloadValid(m.type,y))m.data=y;else throw new Error("invalid payload")}return m}tryParse(u){try{return JSON.parse(u,this.reviver)}catch{return!1}}static isPayloadValid(u,f){switch(u){case PacketType.CONNECT:return isObject$1(f);case PacketType.DISCONNECT:return f===void 0;case PacketType.CONNECT_ERROR:return typeof f=="string"||isObject$1(f);case PacketType.EVENT:case PacketType.BINARY_EVENT:return Array.isArray(f)&&(typeof f[0]=="number"||typeof f[0]=="string"&&RESERVED_EVENTS$1.indexOf(f[0])===-1);case PacketType.ACK:case PacketType.BINARY_ACK:return Array.isArray(f)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class BinaryReconstructor{constructor(u){this.packet=u,this.buffers=[],this.reconPack=u}takeBinaryData(u){if(this.buffers.push(u),this.buffers.length===this.reconPack.attachments){const f=reconstructPacket(this.reconPack,this.buffers);return this.finishedReconstruction(),f}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}const parser$1=Object.freeze(Object.defineProperty({__proto__:null,Decoder,Encoder,get PacketType(){return PacketType},protocol},Symbol.toStringTag,{value:"Module"}));function on(p,u,f){return p.on(u,f),function(){p.off(u,f)}}const RESERVED_EVENTS=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class Socket extends Emitter{constructor(u,f,m){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=u,this.nsp=f,m&&m.auth&&(this.auth=m.auth),this._opts=Object.assign({},m),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const u=this.io;this.subs=[on(u,"open",this.onopen.bind(this)),on(u,"packet",this.onpacket.bind(this)),on(u,"error",this.onerror.bind(this)),on(u,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...u){return u.unshift("message"),this.emit.apply(this,u),this}emit(u,...f){if(RESERVED_EVENTS.hasOwnProperty(u))throw new Error('"'+u.toString()+'" is a reserved event name');if(f.unshift(u),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(f),this;const m={type:PacketType.EVENT,data:f};if(m.options={},m.options.compress=this.flags.compress!==!1,typeof f[f.length-1]=="function"){const w=this.ids++,k=f.pop();this._registerAckCallback(w,k),m.id=w}const v=this.io.engine&&this.io.engine.transport&&this.io.engine.transport.writable;return this.flags.volatile&&(!v||!this.connected)||(this.connected?(this.notifyOutgoingListeners(m),this.packet(m)):this.sendBuffer.push(m)),this.flags={},this}_registerAckCallback(u,f){var m;const v=(m=this.flags.timeout)!==null&&m!==void 0?m:this._opts.ackTimeout;if(v===void 0){this.acks[u]=f;return}const y=this.io.setTimeoutFn(()=>{delete this.acks[u];for(let k=0;k<this.sendBuffer.length;k++)this.sendBuffer[k].id===u&&this.sendBuffer.splice(k,1);f.call(this,new Error("operation has timed out"))},v),w=(...k)=>{this.io.clearTimeoutFn(y),f.apply(this,k)};w.withError=!0,this.acks[u]=w}emitWithAck(u,...f){return new Promise((m,v)=>{const y=(w,k)=>w?v(w):m(k);y.withError=!0,f.push(y),this.emit(u,...f)})}_addToQueue(u){let f;typeof u[u.length-1]=="function"&&(f=u.pop());const m={id:this._queueSeq++,tryCount:0,pending:!1,args:u,flags:Object.assign({fromQueue:!0},this.flags)};u.push((v,...y)=>m!==this._queue[0]?void 0:(v!==null?m.tryCount>this._opts.retries&&(this._queue.shift(),f&&f(v)):(this._queue.shift(),f&&f(null,...y)),m.pending=!1,this._drainQueue())),this._queue.push(m),this._drainQueue()}_drainQueue(u=!1){if(!this.connected||this._queue.length===0)return;const f=this._queue[0];f.pending&&!u||(f.pending=!0,f.tryCount++,this.flags=f.flags,this.emit.apply(this,f.args))}packet(u){u.nsp=this.nsp,this.io._packet(u)}onopen(){typeof this.auth=="function"?this.auth(u=>{this._sendConnectPacket(u)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(u){this.packet({type:PacketType.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},u):u})}onerror(u){this.connected||this.emitReserved("connect_error",u)}onclose(u,f){this.connected=!1,delete this.id,this.emitReserved("disconnect",u,f),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(u=>{if(!this.sendBuffer.some(m=>String(m.id)===u)){const m=this.acks[u];delete this.acks[u],m.withError&&m.call(this,new Error("socket has been disconnected"))}})}onpacket(u){if(u.nsp===this.nsp)switch(u.type){case PacketType.CONNECT:u.data&&u.data.sid?this.onconnect(u.data.sid,u.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case PacketType.EVENT:case PacketType.BINARY_EVENT:this.onevent(u);break;case PacketType.ACK:case PacketType.BINARY_ACK:this.onack(u);break;case PacketType.DISCONNECT:this.ondisconnect();break;case PacketType.CONNECT_ERROR:this.destroy();const m=new Error(u.data.message);m.data=u.data.data,this.emitReserved("connect_error",m);break}}onevent(u){const f=u.data||[];u.id!=null&&f.push(this.ack(u.id)),this.connected?this.emitEvent(f):this.receiveBuffer.push(Object.freeze(f))}emitEvent(u){if(this._anyListeners&&this._anyListeners.length){const f=this._anyListeners.slice();for(const m of f)m.apply(this,u)}super.emit.apply(this,u),this._pid&&u.length&&typeof u[u.length-1]=="string"&&(this._lastOffset=u[u.length-1])}ack(u){const f=this;let m=!1;return function(...v){m||(m=!0,f.packet({type:PacketType.ACK,id:u,data:v}))}}onack(u){const f=this.acks[u.id];typeof f=="function"&&(delete this.acks[u.id],f.withError&&u.data.unshift(null),f.apply(this,u.data))}onconnect(u,f){this.id=u,this.recovered=f&&this._pid===f,this._pid=f,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach(u=>this.emitEvent(u)),this.receiveBuffer=[],this.sendBuffer.forEach(u=>{this.notifyOutgoingListeners(u),this.packet(u)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(u=>u()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:PacketType.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(u){return this.flags.compress=u,this}get volatile(){return this.flags.volatile=!0,this}timeout(u){return this.flags.timeout=u,this}onAny(u){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(u),this}prependAny(u){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(u),this}offAny(u){if(!this._anyListeners)return this;if(u){const f=this._anyListeners;for(let m=0;m<f.length;m++)if(u===f[m])return f.splice(m,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(u){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(u),this}prependAnyOutgoing(u){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(u),this}offAnyOutgoing(u){if(!this._anyOutgoingListeners)return this;if(u){const f=this._anyOutgoingListeners;for(let m=0;m<f.length;m++)if(u===f[m])return f.splice(m,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(u){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const f=this._anyOutgoingListeners.slice();for(const m of f)m.apply(this,u.data)}}}function Backoff(p){p=p||{},this.ms=p.min||100,this.max=p.max||1e4,this.factor=p.factor||2,this.jitter=p.jitter>0&&p.jitter<=1?p.jitter:0,this.attempts=0}Backoff.prototype.duration=function(){var p=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var u=Math.random(),f=Math.floor(u*this.jitter*p);p=Math.floor(u*10)&1?p+f:p-f}return Math.min(p,this.max)|0},Backoff.prototype.reset=function(){this.attempts=0},Backoff.prototype.setMin=function(p){this.ms=p},Backoff.prototype.setMax=function(p){this.max=p},Backoff.prototype.setJitter=function(p){this.jitter=p};class Manager extends Emitter{constructor(u,f){var m;super(),this.nsps={},this.subs=[],u&&typeof u=="object"&&(f=u,u=void 0),f=f||{},f.path=f.path||"/socket.io",this.opts=f,installTimerFunctions(this,f),this.reconnection(f.reconnection!==!1),this.reconnectionAttempts(f.reconnectionAttempts||1/0),this.reconnectionDelay(f.reconnectionDelay||1e3),this.reconnectionDelayMax(f.reconnectionDelayMax||5e3),this.randomizationFactor((m=f.randomizationFactor)!==null&&m!==void 0?m:.5),this.backoff=new Backoff({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(f.timeout==null?2e4:f.timeout),this._readyState="closed",this.uri=u;const v=f.parser||parser$1;this.encoder=new v.Encoder,this.decoder=new v.Decoder,this._autoConnect=f.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(u){return arguments.length?(this._reconnection=!!u,this):this._reconnection}reconnectionAttempts(u){return u===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=u,this)}reconnectionDelay(u){var f;return u===void 0?this._reconnectionDelay:(this._reconnectionDelay=u,(f=this.backoff)===null||f===void 0||f.setMin(u),this)}randomizationFactor(u){var f;return u===void 0?this._randomizationFactor:(this._randomizationFactor=u,(f=this.backoff)===null||f===void 0||f.setJitter(u),this)}reconnectionDelayMax(u){var f;return u===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=u,(f=this.backoff)===null||f===void 0||f.setMax(u),this)}timeout(u){return arguments.length?(this._timeout=u,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(u){if(~this._readyState.indexOf("open"))return this;this.engine=new Socket$1(this.uri,this.opts);const f=this.engine,m=this;this._readyState="opening",this.skipReconnect=!1;const v=on(f,"open",function(){m.onopen(),u&&u()}),y=k=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",k),u?u(k):this.maybeReconnectOnOpen()},w=on(f,"error",y);if(this._timeout!==!1){const k=this._timeout,S=this.setTimeoutFn(()=>{v(),y(new Error("timeout")),f.close()},k);this.opts.autoUnref&&S.unref(),this.subs.push(()=>{this.clearTimeoutFn(S)})}return this.subs.push(v),this.subs.push(w),this}connect(u){return this.open(u)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const u=this.engine;this.subs.push(on(u,"ping",this.onping.bind(this)),on(u,"data",this.ondata.bind(this)),on(u,"error",this.onerror.bind(this)),on(u,"close",this.onclose.bind(this)),on(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(u){try{this.decoder.add(u)}catch(f){this.onclose("parse error",f)}}ondecoded(u){nextTick(()=>{this.emitReserved("packet",u)},this.setTimeoutFn)}onerror(u){this.emitReserved("error",u)}socket(u,f){let m=this.nsps[u];return m?this._autoConnect&&!m.active&&m.connect():(m=new Socket(this,u,f),this.nsps[u]=m),m}_destroy(u){const f=Object.keys(this.nsps);for(const m of f)if(this.nsps[m].active)return;this._close()}_packet(u){const f=this.encoder.encode(u);for(let m=0;m<f.length;m++)this.engine.write(f[m],u.options)}cleanup(){this.subs.forEach(u=>u()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close"),this.engine&&this.engine.close()}disconnect(){return this._close()}onclose(u,f){this.cleanup(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",u,f),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const u=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const f=this.backoff.duration();this._reconnecting=!0;const m=this.setTimeoutFn(()=>{u.skipReconnect||(this.emitReserved("reconnect_attempt",u.backoff.attempts),!u.skipReconnect&&u.open(v=>{v?(u._reconnecting=!1,u.reconnect(),this.emitReserved("reconnect_error",v)):u.onreconnect()}))},f);this.opts.autoUnref&&m.unref(),this.subs.push(()=>{this.clearTimeoutFn(m)})}}onreconnect(){const u=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",u)}}const cache={};function lookup$1(p,u){typeof p=="object"&&(u=p,p=void 0),u=u||{};const f=url(p,u.path||"/socket.io"),m=f.source,v=f.id,y=f.path,w=cache[v]&&y in cache[v].nsps,k=u.forceNew||u["force new connection"]||u.multiplex===!1||w;let S;return k?S=new Manager(m,u):(cache[v]||(cache[v]=new Manager(m,u)),S=cache[v]),f.query&&!u.query&&(u.query=f.queryKey),S.socket(f.path,u)}Object.assign(lookup$1,{Manager,Socket,io:lookup$1,connect:lookup$1});const DefaultOptions={heartbeat:!0},createWebsocket=(p,u=DefaultOptions)=>{if(!p)throw"A websocket path must be provided";const{heartbeat:f}={...DefaultOptions,...u},m=location.protocol==="https:",v=m?"wss:":"ws:",y=location.hostname,w=location.port||(m?443:80);let k=lookup$1(`${v}//${y}:${w}`,{path:p,reconnectionAttempts:3,reconnectionDelay:5e3,reconnectionDelayMax:5e3,timeout:4e3,transports:["websocket"]}),S;return f&&(S=setInterval(()=>{k.emit(SocketEvent.Heartbeat)},SocketSessionTTL*500)),k.on("disconnect",()=>{clearInterval(S)}),k.onOther=(M,T)=>{k.on(M,E=>{(E==null?void 0:E.apiSessionId)!==APISessionID&&T(E)})},k},extractFileNameRegex=/filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/;async function downloadStream(p){const u=await p.blob(),f=p.headers.get("Content-Disposition"),v=extractFileNameRegex.exec(f)[1].replace(/['"]/g,""),y=new Blob([u]),w=URL.createObjectURL(y),k=document.createElement("a");k.href=w,k.download=v,k.click(),URL.revokeObjectURL(w)}const shouldDisplaySetting=(p,u)=>{let f=u.dependsOn;return f&&!Array.isArray(f)&&(f=[f]),f!=null&&f.length?f.every(m=>{let v=m,y=null,w=!!m.invert;if(typeof m=="object"&&(v=m.setting,y=m.value),!v)return!1;Array.isArray(y)||(y=[y]);const k=deepGet$1(p,v);return y.some(M=>M==null?k!=null&&k!==!1&&k!=="":M===k)!==w}):!0},columnTypeManyTypeOverrides={[FieldType.DATETIME]:FieldType.STRING,[FieldType.BOOLEAN]:FieldType.STRING,[FieldType.SIGNATURE_SINGLE]:FieldType.ATTACHMENTS},columnTypeManyParser={[FieldType.DATETIME]:(p,u)=>{function f(m){const{timeOnly:v,dateOnly:y}=u||{},w=!y,k=parseDate(m,{enableTime:w});return getDateDisplayValue(k,{enableTime:w,timeOnly:v})}return p.map(m=>f(m))},[FieldType.BOOLEAN]:p=>p.map(u=>!!u),[FieldType.BB_REFERENCE_SINGLE]:p=>[...new Map(p.map(u=>[u._id,u])).values()],[FieldType.BB_REFERENCE]:p=>[...new Map(p.map(u=>[u._id,u])).values()],[FieldType.ARRAY]:p=>Array.from(new Set(p))};function enrichSchemaWithRelColumns(p){return Object.keys(p).reduce((f,m)=>{const v=p[m];if(f[m]=v,v.visible!==!1&&isRelationshipField(v)&&v.columns){const y=(v==null?void 0:v.relationshipType)===RelationshipType.ONE_TO_MANY;for(const w of Object.keys(v.columns)){const k=v.columns[w];if(!k.visible)continue;const S=`${v.name}.${w}`;f[S]={...k,type:k.type,name:S,related:{field:m,subField:w},cellRenderType:!y&&columnTypeManyTypeOverrides[k.type]||k.type}}}return f},{})}function getRelatedTableValues(p,u,f){var y,w,k,S;const m=isRelationshipField(f)&&(f==null?void 0:f.relationshipType)===RelationshipType.ONE_TO_MANY;let v="";if(m)v=(w=(y=p[u.related.field])==null?void 0:y[0])==null?void 0:w[u.related.subField];else{const M=columnTypeManyParser[u.type]||(H=>H),T=(S=(k=p[u.related.field])==null?void 0:k.flatMap(H=>H[u.related.subField]))==null?void 0:S.filter(H=>H!=null),E=M(T||[],u);v=E,[FieldType.STRING,FieldType.NUMBER,FieldType.BIGINT,FieldType.BOOLEAN,FieldType.DATETIME,FieldType.LONGFORM,FieldType.BARCODEQR].includes(u.type)&&(v=E==null?void 0:E.join(", "))}return v}function canBeDisplayColumn(p){return!(!canBeDisplayColumn$1(p.type)||p.related)}function canBeSortColumn(p){return p.calculationType?!0:!(!canBeSortColumn$1(p.type)||p.related)}const getSettingsDefinition=p=>{var f;if(!p)return[];let u=[];return(f=p.settings)==null||f.forEach(m=>{var v;m.section?u=u.concat((v=m.settings||[])==null?void 0:v.map(y=>({...y,sectionDependsOn:m.dependsOn}))):u.push(m)}),u},{buildQuery,limit:queryLimit,runQuery,sort}=QueryUtils;class BaseDataFetch{constructor(u){ua(this,"API");ua(this,"features");ua(this,"options");ua(this,"store");ua(this,"derivedStore");if(this.features={supportsSearch:!1,supportsSort:!1,supportsPagination:!1},this.options={datasource:u.datasource,limit:10,filter:null,query:u.query,sortColumn:null,sortOrder:SortOrder.ASCENDING,sortType:null,paginate:!0,clientSideSearching:!0,clientSideSorting:!0,clientSideLimiting:!0},this.store=writable({rows:[],info:null,schema:null,loading:!1,loaded:!1,query:u.query,pageNumber:0,cursor:null,cursors:[],resetKey:Math.random().toString(),error:null}),this.API=u==null?void 0:u.API,this.options={...this.options,...u},!this.API)throw"An API client is required for fetching data";if(this.getData=this.getData.bind(this),this.getPage=this.getPage.bind(this),this.getInitialData=this.getInitialData.bind(this),this.determineFeatureFlags=this.determineFeatureFlags.bind(this),this.refresh=this.refresh.bind(this),this.update=this.update.bind(this),this.hasNextPage=this.hasNextPage.bind(this),this.hasPrevPage=this.hasPrevPage.bind(this),this.nextPage=this.nextPage.bind(this),this.prevPage=this.prevPage.bind(this),this.derivedStore=derived(this.store,f=>({...f,...this.features,hasNextPage:this.hasNextPage(f),hasPrevPage:this.hasPrevPage(f)})),!this.options.datasource){this.store.update(f=>({...f,loaded:!0}));return}}get subscribe(){return this.derivedStore.subscribe}getDefaultSortColumn(u,f){return u!=null&&u.primaryDisplay&&f[u.primaryDisplay]?u.primaryDisplay:Object.keys(f)[0]}async getInitialData(){const{filter:u,paginate:f}=this.options,m=await this.getDefinition(),v=await this.determineFeatureFlags();this.features={supportsSearch:!!(v!=null&&v.supportsSearch),supportsSort:!!(v!=null&&v.supportsSort),supportsPagination:f&&!!(v!=null&&v.supportsPagination)};let y=this.getSchema(m);if(!y)return;if(y=this.enrichSchema(y),this.options.sortColumn&&!y[this.options.sortColumn]&&(this.options.sortColumn=null),this.options.sortColumn||(this.options.sortColumn=this.getDefaultSortColumn(m,y)),!this.options.sortColumn)this.options.sortOrder=SortOrder.ASCENDING,this.options.sortType=null;else{this.options.sortType=SortType.STRING;const S=y==null?void 0:y[this.options.sortColumn];((S==null?void 0:S.type)===FieldType.NUMBER||(S==null?void 0:S.type)===FieldType.BIGINT||"calculationType"in S&&(S!=null&&S.calculationType))&&(this.options.sortType=SortType.NUMBER),this.options.sortOrder?this.options.sortOrder=this.options.sortOrder.toLowerCase():this.options.sortOrder=SortOrder.ASCENDING}let w=this.options.query;w||(w=buildQuery(u??void 0)),this.store.update(S=>({...S,definition:m,schema:y,query:w,loading:!0,cursors:[],cursor:null}));const k=await this.getPage();this.store.update(S=>({...S,loading:!1,loaded:!0,pageNumber:0,rows:k.rows,info:k.info,cursors:f&&k.hasNextPage?[null,k.cursor]:[null],error:k.error,resetKey:Math.random().toString()}))}async getPage(){const{sortColumn:u,sortOrder:f,sortType:m,limit:v,clientSideSearching:y,clientSideSorting:w,clientSideLimiting:k}=this.options,{query:S}=get_store_value(this.store);let{rows:M,info:T,hasNextPage:E,cursor:H,error:F}=await this.getData();return!this.features.supportsSearch&&y&&(M=runQuery(M,S)),!this.features.supportsSort&&w&&m&&(M=sort(M,u,f,m)),!this.features.supportsPagination&&k&&(M=queryLimit(M,v)),{rows:M,info:T,hasNextPage:E,cursor:H,error:F}}getSchema(u){return(u==null?void 0:u.schema)??void 0}enrichSchema(u){let f={};for(const v of Object.keys(u)){const y=u[v];if(y.type===FieldType.JSON){const w=convertJSONSchemaToTableSchema(y,{squashObjects:!0});if(w)for(const k of Object.keys(w))f[`${v}.${k}`]={type:w[k].type,nestedJSON:!0}}}let m={};return Object.entries({...u,...f}).forEach(([v,y])=>{typeof y=="string"?m[v]={type:y,name:v}:m[v]={...y,type:y.type,name:v}}),m}async determineFeatureFlags(){return{supportsSearch:!1,supportsSort:!1,supportsPagination:!1}}async update(u){let f=!1;for(const[m,v]of Object.entries(u||{})){const y=this.options[m]??null;if(JSON.stringify(v??null)!==JSON.stringify(y)){f=!0;break}}f&&(this.options={...this.options,...fp$1.cloneDeep(u)},await this.getInitialData())}async refresh(){if(get_store_value(this.store).loading)return;this.store.update(S=>({...S,loading:!0}));const{rows:u,info:f,error:m,cursor:v}=await this.getPage();let{cursors:y}=get_store_value(this.store);const{pageNumber:w}=get_store_value(this.store);if(!u.length&&w>0)return this.store.update(S=>({...S,loading:!1,cursors:y.slice(0,w)})),await this.prevPage();y[w+1]!=v&&(y=y.slice(0,w+1),y[w+1]=v),this.store.update(S=>({...S,rows:u,info:f,loading:!1,error:m,cursors:y}))}hasNextPage(u){return u.cursors[u.pageNumber+1]!=null}hasPrevPage(u){return u.pageNumber>0}async nextPage(){const u=get_store_value(this.derivedStore);if(u.loading||!this.options.paginate||!u.hasNextPage)return;const f=u.cursors[u.pageNumber+1];this.store.update(S=>({...S,loading:!0,cursor:f,pageNumber:S.pageNumber+1}));const{rows:m,info:v,hasNextPage:y,cursor:w,error:k}=await this.getPage();this.store.update(S=>{let{cursors:M,pageNumber:T}=S;return y&&(M[T+1]=w),{...S,rows:m,info:v,cursors:M,loading:!1,error:k}})}async prevPage(){const u=get_store_value(this.derivedStore);if(u.loading||!this.options.paginate||!u.hasPrevPage)return;const f=u.cursors[u.pageNumber-1];this.store.update(w=>({...w,loading:!0,cursor:f,pageNumber:w.pageNumber-1}));const{rows:m,info:v,error:y}=await this.getPage();this.store.update(w=>({...w,rows:m,info:v,loading:!1,error:y}))}}class TableFetch extends BaseDataFetch{async determineFeatureFlags(){return{supportsSearch:!0,supportsSort:!0,supportsPagination:!0}}async getDefinition(){const{datasource:u}=this.options;if(!(u!=null&&u.tableId))return null;try{return await this.API.fetchTableDefinition(u.tableId)}catch(f){return this.store.update(m=>({...m,error:f})),null}}async getData(){const{datasource:u,limit:f,sortColumn:m,sortOrder:v,sortType:y,paginate:w}=this.options,{tableId:k}=u,{cursor:S,query:M}=get_store_value(this.store);try{const T=await this.API.searchTable(k,{query:M,limit:f,sort:m,sortOrder:v??SortOrder.ASCENDING,sortType:y,paginate:w,bookmark:S});return{rows:(T==null?void 0:T.rows)||[],hasNextPage:(T==null?void 0:T.hasNextPage)||!1,cursor:(T==null?void 0:T.bookmark)||null}}catch(T){return{rows:[],hasNextPage:!1,error:T}}}}class ViewFetch extends BaseDataFetch{async getDefinition(){const{datasource:u}=this.options;if(!(u!=null&&u.tableId))return null;try{return await this.API.fetchTableDefinition(u.tableId)}catch(f){return this.store.update(m=>({...m,error:f})),null}}getSchema(u){var m,v;const{datasource:f}=this.options;return(v=(m=u==null?void 0:u.views)==null?void 0:m[f==null?void 0:f.name])==null?void 0:v.schema}async getData(){const{datasource:u}=this.options;try{return{rows:await this.API.fetchViewData(u.name,{calculation:u.calculation,field:u.field,groupBy:u.groupBy,tableId:u.tableId})||[]}}catch(f){return console.error(f,{datasource:u}),{rows:[]}}}}class ViewV2Fetch extends BaseDataFetch{async determineFeatureFlags(){return{supportsSearch:!0,supportsSort:!0,supportsPagination:!0}}async getDefinition(){const{datasource:u}=this.options;try{const f=await this.API.viewV2.fetchDefinition(u.id);return f==null?void 0:f.data}catch(f){return this.store.update(m=>({...m,error:f})),null}}getDefaultSortColumn(){return null}async getData(){var T;const{datasource:u,limit:f,sortColumn:m,sortOrder:v,sortType:y,paginate:w}=this.options,{cursor:k,query:S,definition:M}=get_store_value(this.store);if((M==null?void 0:M.type)===ViewV2Type.CALCULATION&&!Object.values(M.schema||{}).some(isCalculationField))return{rows:[],hasNextPage:!1,cursor:null,error:null};!m&&((T=M==null?void 0:M.sort)!=null&&T.field)&&(this.options.sortColumn=M.sort.field,this.options.sortOrder=M.sort.order||SortOrder.ASCENDING);try{const E={query:S,paginate:w,limit:f,bookmark:k,sort:m,sortOrder:v,sortType:y};if(w){const H=await this.API.viewV2.fetch(u.id,{...E,paginate:w});return{rows:(H==null?void 0:H.rows)||[],hasNextPage:(H==null?void 0:H.hasNextPage)||!1,cursor:(H==null?void 0:H.bookmark)||null}}else{const H=await this.API.viewV2.fetch(u.id,{...E,paginate:w});return{rows:(H==null?void 0:H.rows)||[],hasNextPage:!1,cursor:null}}}catch(E){return{rows:[],hasNextPage:!1,cursor:null,error:E}}}}class QueryFetch extends BaseDataFetch{async determineFeatureFlags(){var m,v,y,w,k,S;const u=await this.getDefinition();return{supportsPagination:!!((v=(m=u==null?void 0:u.fields)==null?void 0:m.pagination)!=null&&v.type)&&!!((w=(y=u==null?void 0:u.fields)==null?void 0:y.pagination)!=null&&w.location)&&!!((S=(k=u==null?void 0:u.fields)==null?void 0:k.pagination)!=null&&S.pageParam)}}async getDefinition(){const{datasource:u}=this.options;if(!(u!=null&&u._id))return null;try{const f=await this.API.fetchQueryDefinition(u._id);return f.fields||(f.fields=u.fields),f}catch{return null}}getDefaultSortColumn(){return null}async getData(){var T,E;const{datasource:u,limit:f,paginate:m}=this.options,{supportsPagination:v}=this.features,{cursor:y,definition:w}=get_store_value(this.store),k=(E=(T=w==null?void 0:w.fields)==null?void 0:T.pagination)==null?void 0:E.type,S=cloneDeep$1(u.queryParams||{});for(const H of(u==null?void 0:u.parameters)||[])S[H.name]||(S[H.name]=H.default);const M={parameters:S};if(m&&v){const H=k==="page"?parseInt(y||"1"):y;M.pagination={page:H,limit:f}}try{const H=await this.API.executeQuery(u==null?void 0:u._id,M),{data:F,pagination:Z,...$}=H;let J=null,se=!1;return m&&v&&(k==="page"?(J=M.pagination.page+1,se=(F==null?void 0:F.length)===f&&f>0):(J=Z==null?void 0:Z.cursor,se=J!=null)),{rows:F||[],info:$,cursor:J,hasNextPage:se}}catch{return{rows:[],hasNextPage:!1}}}}class RelationshipFetch extends BaseDataFetch{async getDefinition(){const{datasource:u}=this.options;if(!(u!=null&&u.tableId))return null;try{return await this.API.fetchTableDefinition(u.tableId)}catch(f){return this.store.update(m=>({...m,error:f})),null}}async getData(){const{datasource:u}=this.options;if(!(u!=null&&u.rowId)||!(u!=null&&u.rowTableId))return{rows:[]};try{return{rows:await this.API.fetchRelationshipData(u.rowTableId,u.rowId,u.fieldName)}}catch{return{rows:[]}}}}class NestedProviderFetch extends BaseDataFetch{async getDefinition(){var f,m;const{datasource:u}=this.options;return{schema:(f=u==null?void 0:u.value)==null?void 0:f.schema,primaryDisplay:(m=u==null?void 0:u.value)==null?void 0:m.primaryDisplay}}async getData(){var f;const{datasource:u}=this.options;return{rows:((f=u==null?void 0:u.value)==null?void 0:f.rows)||[],hasNextPage:!1,cursor:null}}}function isArrayOfStrings(p){return Array.isArray(p)&&!!p[0]&&typeof p[0]!="object"}class FieldFetch extends BaseDataFetch{async getDefinition(){const{datasource:u}=this.options;let f;return u.fieldType==="attachment"?f={url:{type:"string"},name:{type:"string"}}:u.fieldType==="array"&&(f={value:{type:"string"}}),{schema:f}}async getData(){const{datasource:u}=this.options,f=(u==null?void 0:u.value)||[];let m;return isArrayOfStrings(f)?m=f.map(v=>({value:v})):m=f,{rows:m||[],hasNextPage:!1,cursor:null}}}class JSONArrayFetch extends FieldFetch{async getDefinition(){const{datasource:u}=this.options;try{const f=await this.API.fetchTableDefinition(u.tableId);return{schema:getJSONArrayDatasourceSchema(f==null?void 0:f.schema,u)}}catch{return null}}}class UserFetch extends BaseDataFetch{constructor(u){super({...u,datasource:{type:"user",tableId:InternalTable.USER_METADATA}})}async determineFeatureFlags(){return{supportsSearch:!0,supportsSort:!1,supportsPagination:!0}}async getDefinition(){return{schema:{}}}async getData(){const{limit:u,paginate:f}=this.options,{cursor:m,query:v}=get_store_value(this.store),{appId:y,paginated:w,...k}=v,S=isSupportedUserSearch(k)?k:{};try{const M={bookmark:m??void 0,query:S??void 0,appId:y,paginate:w||f,limit:u},T=await this.API.searchUsers(M);return{rows:(T==null?void 0:T.data)||[],hasNextPage:(T==null?void 0:T.hasNextPage)||!1,cursor:(T==null?void 0:T.nextPage)||null}}catch(M){return{rows:[],hasNextPage:!1,error:M}}}}class GroupUserFetch extends BaseDataFetch{constructor(u){super({...u,datasource:{type:"groupUser",tableId:InternalTable.USER_METADATA}})}async determineFeatureFlags(){return{supportsSearch:!0,supportsSort:!1,supportsPagination:!0}}async getDefinition(){return{schema:{}}}async getData(){const{query:u,cursor:f}=get_store_value(this.store);try{const m=await this.API.getGroupUsers({id:u.groupId,emailSearch:u.emailSearch,bookmark:f??void 0});return{rows:(m==null?void 0:m.users)||[],hasNextPage:(m==null?void 0:m.hasNextPage)||!1,cursor:(m==null?void 0:m.bookmark)||null}}catch(m){return{rows:[],hasNextPage:!1,error:m}}}}class CustomFetch extends BaseDataFetch{getType(u){return u==null?"string":typeof u==="object"?Array.isArray(u)?"array":"json":isNaN(u)?"string":"number"}parseCustomData(u){if(!u)return[];if(Array.isArray(u))return u;if(typeof u=="string"){try{const f=JSON.parse(u);return Array.isArray(f)?f:[f]}catch{}return u.includes(`
384
384
  `)?u.split(`
385
385
  `).map(f=>f.trim()):u.split(",").map(f=>f.trim())}return[u]}enrichCustomData(u){return u!=null&&u.length?(u=u.filter(f=>f!=null&&f!==""&&!Array.isArray(f)),u.map(f=>{if(typeof f=="object")return f;if(typeof f=="string"){const m=f.split(",").map(y=>y.trim()),v={};for(let y=0;y<m.length;y++){const k=`Value${y===0?"":` ${y+1}`}`;v[k]=m[y]}return v}return{Value:f}})):[]}getCustomData(u){return this.enrichCustomData(this.parseCustomData(u==null?void 0:u.data))}async getDefinition(){const{datasource:u}=this.options,f={},m=this.getCustomData(u);if(!(m!=null&&m.length))return{schema:f};for(const v of m)for(const y of Object.keys(v))if(y!=="_id"&&!f[y]){let w=this.getType(v[y]);const k={};if(w==="string"){const S=[...new Set(m.map(T=>T[y]))];S.length/m.length<=.8&&S.length>1&&(w="options",k.inclusion=S)}else w==="array"&&(k.inclusion=[...new Set(m.map(S=>S[y]).flat())]);f[y]={type:w,constraints:k}}return{schema:f}}async getData(){const{datasource:u}=this.options;return{rows:this.getCustomData(u),hasNextPage:!1,cursor:null}}}class QueryArrayFetch extends FieldFetch{async getDefinition(){const{datasource:u}=this.options;if(!(u!=null&&u.tableId))return null;try{const f=await this.API.fetchQueryDefinition(u.tableId),m=generateQueryArraySchemas(f.schema,f.nestedSchemaFields);return{schema:getJSONArrayDatasourceSchema(m,u)}}catch{return null}}}const DataFetchMap={table:TableFetch,view:ViewFetch,viewV2:ViewV2Fetch,query:QueryFetch,link:RelationshipFetch,user:UserFetch,groupUser:GroupUserFetch,custom:CustomFetch,provider:NestedProviderFetch,field:FieldFetch,jsonarray:JSONArrayFetch,queryarray:QueryArrayFetch},fetchData=({API:p,datasource:u,options:f})=>{const m=DataFetchMap[u==null?void 0:u.type]||TableFetch,v=new m({API:p,datasource:u,...f});return v.getInitialData(),v},createEmptyFetchInstance=({API:p,datasource:u})=>{const f=DataFetchMap[u==null?void 0:u.type];return f?new f({API:p,datasource:u,query:null}):null},getDatasourceDefinition=async({API:p,datasource:u})=>{const f=createEmptyFetchInstance({API:p,datasource:u});return await(f==null?void 0:f.getDefinition())},getDatasourceSchema=({API:p,datasource:u,definition:f})=>{const m=createEmptyFetchInstance({API:p,datasource:u});return m==null?void 0:m.getSchema(f)},createLocalStorageStore=(p,u)=>{const f=writable(u,()=>{y();const w=({key:k})=>k===p&&y();return window.addEventListener("storage",w),()=>window.removeEventListener("storage",w)}),m=w=>{f.set(w),localStorage.setItem(p,JSON.stringify(w))},v=w=>m(w(get_store_value(f))),y=()=>{const w=localStorage.getItem(p);if(w==null)m(u);else try{f.set(JSON.parse(w))}catch{m(u)}};return{...f,set:m,update:v}},SplitPage_svelte_svelte_type_style_lang="",Testimonial_svelte_svelte_type_style_lang="",TestimonialPage_svelte_svelte_type_style_lang="",SignatureModal_svelte_svelte_type_style_lang="";function create_default_slot_2$p(p){let u,f,m,v={darkMode:p[3],value:p[1],saveIcon:!1};return f=new Signature({props:v}),p[8](f),f.$on("update",p[9]),{c(){u=element("div"),create_component(f.$$.fragment),attr(u,"class","signature-wrap modal svelte-1jbgrys")},m(y,w){insert(y,u,w),mount_component(f,u,null),m=!0},p(y,w){const k={};w&8&&(k.darkMode=y[3]),w&2&&(k.value=y[1]),f.$set(k)},i(y){m||(transition_in(f.$$.fragment,y),m=!0)},o(y){transition_out(f.$$.fragment,y),m=!1},d(y){y&&detach(u),p[8](null),destroy_component(f)}}}function create_default_slot_1$B(p){let u;return{c(){u=text$1(p[2])},m(f,m){insert(f,u,m)},p(f,m){m&4&&set_data(u,f[2])},d(f){f&&detach(u)}}}function create_header_slot(p){let u,f,m;return f=new Body({props:{$$slots:{default:[create_default_slot_1$B]},$$scope:{ctx:p}}}),{c(){u=element("div"),create_component(f.$$.fragment),attr(u,"slot","header")},m(v,y){insert(v,u,y),mount_component(f,u,null),m=!0},p(v,y){const w={};y&4100&&(w.$$scope={dirty:y,ctx:v}),f.$set(w)},i(v){m||(transition_in(f.$$.fragment,v),m=!0)},o(v){transition_out(f.$$.fragment,v),m=!1},d(v){v&&detach(u),destroy_component(f)}}}function create_default_slot$1n(p){let u,f;return u=new ModalContent({props:{showConfirmButton:!0,showCancelButton:!1,showCloseIcon:!1,custom:!0,disabled:!p[6],showDivider:!1,onConfirm:p[10],$$slots:{header:[create_header_slot],default:[create_default_slot_2$p]},$$scope:{ctx:p}}}),{c(){create_component(u.$$.fragment)},m(m,v){mount_component(u,m,v),f=!0},p(m,v){const y={};v&64&&(y.disabled=!m[6]),v&33&&(y.onConfirm=m[10]),v&4206&&(y.$$scope={dirty:v,ctx:m}),u.$set(y)},i(m){f||(transition_in(u.$$.fragment,m),f=!0)},o(m){transition_out(u.$$.fragment,m),f=!1},d(m){destroy_component(u,m)}}}function create_fragment$2G(p){let u,f,m={$$slots:{default:[create_default_slot$1n]},$$scope:{ctx:p}};return u=new Modal({props:m}),p[11](u),{c(){create_component(u.$$.fragment)},m(v,y){mount_component(u,v,y),f=!0},p(v,[y]){const w={};y&4207&&(w.$$scope={dirty:y,ctx:v}),u.$set(w)},i(v){f||(transition_in(u.$$.fragment,v),f=!0)},o(v){transition_out(u.$$.fragment,v),f=!1},d(v){p[11](null),destroy_component(u,v)}}}function instance$2E(p,u,f){let{onConfirm:m=()=>{}}=u,{value:v}=u,{title:y}=u,{darkMode:w}=u;const k=()=>{f(6,T=!1),S.show()};let S,M,T=!1;function E($){binding_callbacks[$?"unshift":"push"](()=>{M=$,f(5,M)})}const H=()=>{f(6,T=!0)},F=()=>{m(M)};function Z($){binding_callbacks[$?"unshift":"push"](()=>{S=$,f(4,S)})}return p.$$set=$=>{"onConfirm"in $&&f(0,m=$.onConfirm),"value"in $&&f(1,v=$.value),"title"in $&&f(2,y=$.title),"darkMode"in $&&f(3,w=$.darkMode)},[m,v,y,w,S,M,T,k,E,H,F,Z]}class SignatureModal extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$2E,create_fragment$2G,safe_not_equal,{onConfirm:0,value:1,title:2,darkMode:3,show:7})}get show(){return this.$$.ctx[7]}}function create_if_block$1D(p){let u,f;return u=new AbsTooltip({props:{text:p[3]?getUserLabel(p[0]):null,position:p[2],color:getUserColor(p[0]),$$slots:{default:[create_default_slot$1m]},$$scope:{ctx:p}}}),{c(){create_component(u.$$.fragment)},m(m,v){mount_component(u,m,v),f=!0},p(m,v){const y={};v&9&&(y.text=m[3]?getUserLabel(m[0]):null),v&4&&(y.position=m[2]),v&1&&(y.color=getUserColor(m[0])),v&19&&(y.$$scope={dirty:v,ctx:m}),u.$set(y)},i(m){f||(transition_in(u.$$.fragment,m),f=!0)},o(m){transition_out(u.$$.fragment,m),f=!1},d(m){destroy_component(u,m)}}}function create_default_slot$1m(p){let u,f;return u=new Avatar({props:{size:p[1],initials:getUserInitials(p[0]),color:getUserColor(p[0])}}),{c(){create_component(u.$$.fragment)},m(m,v){mount_component(u,m,v),f=!0},p(m,v){const y={};v&2&&(y.size=m[1]),v&1&&(y.initials=getUserInitials(m[0])),v&1&&(y.color=getUserColor(m[0])),u.$set(y)},i(m){f||(transition_in(u.$$.fragment,m),f=!0)},o(m){transition_out(u.$$.fragment,m),f=!1},d(m){destroy_component(u,m)}}}function create_fragment$2F(p){let u,f,m=p[0]&&create_if_block$1D(p);return{c(){m&&m.c(),u=empty$1()},m(v,y){m&&m.m(v,y),insert(v,u,y),f=!0},p(v,[y]){v[0]?m?(m.p(v,y),y&1&&transition_in(m,1)):(m=create_if_block$1D(v),m.c(),transition_in(m,1),m.m(u.parentNode,u)):m&&(group_outros(),transition_out(m,1,1,()=>{m=null}),check_outros())},i(v){f||(transition_in(m),f=!0)},o(v){transition_out(m),f=!1},d(v){v&&detach(u),m&&m.d(v)}}}function instance$2D(p,u,f){let{user:m}=u,{size:v="S"}=u,{tooltipPosition:y=TooltipPosition.Top}=u,{showTooltip:w=!0}=u;return p.$$set=k=>{"user"in k&&f(0,m=k.user),"size"in k&&f(1,v=k.size),"tooltipPosition"in k&&f(2,y=k.tooltipPosition),"showTooltip"in k&&f(3,w=k.showTooltip)},[m,v,y,w]}class UserAvatar extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$2D,create_fragment$2F,safe_not_equal,{user:0,size:1,tooltipPosition:2,showTooltip:3})}}const UserAvatars_svelte_svelte_type_style_lang$1="",Updating_svelte_svelte_type_style_lang="";function create_else_block_1$9(p){let u;return{c(){u=text$1("Something went wrong!")},m(f,m){insert(f,u,m)},d(f){f&&detach(u)}}}function create_if_block_1$Q(p){let u;return{c(){u=text$1("System update")},m(f,m){insert(f,u,m)},d(f){f&&detach(u)}}}function create_else_block$u(p){let u,f,m,v,y;return{c(){u=text$1(`An error occurred, please try again later.
386
386
  `),f=element("br"),m=text$1(`
@@ -1210,7 +1210,7 @@ grid-template-columns: repeat(auto-fill, minmax(min(${w[26]}px, 100%), 1fr));`})
1210
1210
  height: ${p[1]} !important;
1211
1211
  `},$$slots:{default:[create_default_slot_1$e]},$$scope:{ctx:p}}}),{c(){create_component(u.$$.fragment)},m(m,v){mount_component(u,m,v),f=!0},p(m,v){const y={};v&2&&(y.styles={custom:`
1212
1212
  height: ${m[1]} !important;
1213
- `}),v&532477&&(y.$$scope={dirty:v,ctx:m}),u.$set(y)},i(m){f||(transition_in(u.$$.fragment,m),f=!0)},o(m){transition_out(u.$$.fragment,m),f=!1},d(m){destroy_component(u,m)}}}function create_fragment$L(p){let u,f;return u=new Block({props:{$$slots:{default:[create_default_slot$q]},$$scope:{ctx:p}}}),{c(){create_component(u.$$.fragment)},m(m,v){mount_component(u,m,v),f=!0},p(m,[v]){const y={};v&532479&&(y.$$scope={dirty:v,ctx:m}),u.$set(y)},i(m){f||(transition_in(u.$$.fragment,m),f=!0)},o(m){transition_out(u.$$.fragment,m),f=!1},d(m){destroy_component(u,m)}}}function instance$K(p,u,f){let{dataSource:m}=u,{height:v}=u,{cardTitle:y}=u,{cardSubtitle:w}=u,{cardDescription:k}=u,{cardImageURL:S}=u,{cardSearchField:M}=u,{detailFields:T}=u,{detailTitle:E}=u,{noRowsMessage:H}=u,{autoRefresh:F}=u;const Z=shortid.generate(),$=getContext$1("context"),{generateGoldenSample:J}=getContext$1("sdk");let se,ie;const he=()=>{var ze;const ve=((ze=get_store_value($)[se])==null?void 0:ze.rows)||[],Ae=J(ve);return{[ie]:Ae}};function fe(ve){ie=ve,f(12,ie)}function pe(ve){se=ve,f(11,se)}return p.$$set=ve=>{"dataSource"in ve&&f(0,m=ve.dataSource),"height"in ve&&f(1,v=ve.height),"cardTitle"in ve&&f(2,y=ve.cardTitle),"cardSubtitle"in ve&&f(3,w=ve.cardSubtitle),"cardDescription"in ve&&f(4,k=ve.cardDescription),"cardImageURL"in ve&&f(5,S=ve.cardImageURL),"cardSearchField"in ve&&f(6,M=ve.cardSearchField),"detailFields"in ve&&f(7,T=ve.detailFields),"detailTitle"in ve&&f(8,E=ve.detailTitle),"noRowsMessage"in ve&&f(9,H=ve.noRowsMessage),"autoRefresh"in ve&&f(10,F=ve.autoRefresh)},[m,v,y,w,k,S,M,T,E,H,F,se,ie,Z,he,fe,pe]}class RowExplorer extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$K,create_fragment$L,safe_not_equal,{dataSource:0,height:1,cardTitle:2,cardSubtitle:3,cardDescription:4,cardImageURL:5,cardSearchField:6,detailFields:7,detailTitle:8,noRowsMessage:9,autoRefresh:10,getAdditionalDataContext:14})}get getAdditionalDataContext(){return this.$$.ctx[14]}}const MultiStepFormblock_svelte_svelte_type_style_lang="";function get_each_context$a(p,u,f){const m=p.slice();return m[25]=u[f],m[27]=f,m}function get_each_context_1$1(p,u,f){const m=p.slice();return m[28]=u[f],m[30]=f,m}function create_if_block_1$a(p){let u,f;return u=new BlockComponent({props:{type:"buttongroup",props:{buttons:p[25].buttons}}}),{c(){create_component(u.$$.fragment)},m(m,v){mount_component(u,m,v),f=!0},p(m,v){const y={};v[0]&128&&(y.props={buttons:m[25].buttons}),u.$set(y)},i(m){f||(transition_in(u.$$.fragment,m),f=!0)},o(m){transition_out(u.$$.fragment,m),f=!1},d(m){destroy_component(u,m)}}}function create_default_slot_6$3(p){let u,f,m,v;u=new BlockComponent({props:{type:"heading",props:{text:p[25].title}}});let y=p[4]==="top"&&create_if_block_1$a(p);return{c(){create_component(u.$$.fragment),f=space(),y&&y.c(),m=empty$1()},m(w,k){mount_component(u,w,k),insert(w,f,k),y&&y.m(w,k),insert(w,m,k),v=!0},p(w,k){const S={};k[0]&128&&(S.props={text:w[25].title}),u.$set(S),w[4]==="top"?y?(y.p(w,k),k[0]&16&&transition_in(y,1)):(y=create_if_block_1$a(w),y.c(),transition_in(y,1),y.m(m.parentNode,m)):y&&(group_outros(),transition_out(y,1,1,()=>{y=null}),check_outros())},i(w){v||(transition_in(u.$$.fragment,w),transition_in(y),v=!0)},o(w){transition_out(u.$$.fragment,w),transition_out(y),v=!1},d(w){w&&(detach(f),detach(m)),destroy_component(u,w),y&&y.d(w)}}}function create_default_slot_5$3(p){let u,f;return u=new BlockComponent({props:{type:"container",props:{direction:"row",hAlign:"stretch",vAlign:"center",gap:"M",wrap:!0},order:0,$$slots:{default:[create_default_slot_6$3]},$$scope:{ctx:p}}}),{c(){create_component(u.$$.fragment)},m(m,v){mount_component(u,m,v),f=!0},p(m,v){const y={};v[0]&144|v[1]&1&&(y.$$scope={dirty:v,ctx:m}),u.$set(y)},i(m){f||(transition_in(u.$$.fragment,m),f=!0)},o(m){transition_out(u.$$.fragment,m),f=!1},d(m){destroy_component(u,m)}}}function create_each_block_1$1(p,u){let f,m,v;return m=new FormBlockComponent({props:{field:u[28],schema:u[6],order:u[30]}}),{key:p,first:null,c(){f=empty$1(),create_component(m.$$.fragment),this.first=f},m(y,w){insert(y,f,w),mount_component(m,y,w),v=!0},p(y,w){u=y;const k={};w[0]&128&&(k.field=u[28]),w[0]&64&&(k.schema=u[6]),w[0]&128&&(k.order=u[30]),m.$set(k)},i(y){v||(transition_in(m.$$.fragment,y),v=!0)},o(y){transition_out(m.$$.fragment,y),v=!1},d(y){y&&detach(f),destroy_component(m,y)}}}function create_default_slot_4$4(p){let u,f=[],m=new Map,v,y=ensure_array_like(p[25].fields);const w=k=>`${k[28].field||k[28].name}_${k[30]}`;for(let k=0;k<y.length;k+=1){let S=get_each_context_1$1(p,y,k),M=w(S);m.set(M,f[k]=create_each_block_1$1(M,S))}return{c(){u=element("div");for(let k=0;k<f.length;k+=1)f[k].c();attr(u,"class","form-block fields svelte-1gdgv0g"),toggle_class(u,"mobile",p[8].device.mobile)},m(k,S){insert(k,u,S);for(let M=0;M<f.length;M+=1)f[M]&&f[M].m(u,null);v=!0},p(k,S){S[0]&192&&(y=ensure_array_like(k[25].fields),group_outros(),f=update_keyed_each(f,S,w,1,k,y,m,u,outro_and_destroy_block,create_each_block_1$1,null,get_each_context_1$1),check_outros()),(!v||S[0]&256)&&toggle_class(u,"mobile",k[8].device.mobile)},i(k){if(!v){for(let S=0;S<y.length;S+=1)transition_in(f[S]);v=!0}},o(k){for(let S=0;S<f.length;S+=1)transition_out(f[S]);v=!1},d(k){k&&detach(u);for(let S=0;S<f.length;S+=1)f[S].d()}}}function create_if_block$r(p){let u,f;return u=new BlockComponent({props:{type:"buttongroup",props:{buttons:p[25].buttons,collapsed:p[25].buttonsCollapsed,collapsedText:p[25].buttonsCollapsedText},order:3}}),{c(){create_component(u.$$.fragment)},m(m,v){mount_component(u,m,v),f=!0},p(m,v){const y={};v[0]&128&&(y.props={buttons:m[25].buttons,collapsed:m[25].buttonsCollapsed,collapsedText:m[25].buttonsCollapsedText}),u.$set(y)},i(m){f||(transition_in(u.$$.fragment,m),f=!0)},o(m){transition_out(u.$$.fragment,m),f=!1},d(m){destroy_component(u,m)}}}function create_default_slot_3$7(p){let u,f,m,v,y,w,k,S;u=new BlockComponent({props:{type:"container",props:{direction:"column",gap:"S"},order:0,$$slots:{default:[create_default_slot_5$3]},$$scope:{ctx:p}}}),m=new BlockComponent({props:{type:"text",props:{text:p[25].desc},order:1}}),y=new BlockComponent({props:{type:"container",order:2,$$slots:{default:[create_default_slot_4$4]},$$scope:{ctx:p}}});let M=p[4]==="bottom"&&create_if_block$r(p);return{c(){create_component(u.$$.fragment),f=space(),create_component(m.$$.fragment),v=space(),create_component(y.$$.fragment),w=space(),M&&M.c(),k=empty$1()},m(T,E){mount_component(u,T,E),insert(T,f,E),mount_component(m,T,E),insert(T,v,E),mount_component(y,T,E),insert(T,w,E),M&&M.m(T,E),insert(T,k,E),S=!0},p(T,E){const H={};E[0]&144|E[1]&1&&(H.$$scope={dirty:E,ctx:T}),u.$set(H);const F={};E[0]&128&&(F.props={text:T[25].desc}),m.$set(F);const Z={};E[0]&448|E[1]&1&&(Z.$$scope={dirty:E,ctx:T}),y.$set(Z),T[4]==="bottom"?M?(M.p(T,E),E[0]&16&&transition_in(M,1)):(M=create_if_block$r(T),M.c(),transition_in(M,1),M.m(k.parentNode,k)):M&&(group_outros(),transition_out(M,1,1,()=>{M=null}),check_outros())},i(T){S||(transition_in(u.$$.fragment,T),transition_in(m.$$.fragment,T),transition_in(y.$$.fragment,T),transition_in(M),S=!0)},o(T){transition_out(u.$$.fragment,T),transition_out(m.$$.fragment,T),transition_out(y.$$.fragment,T),transition_out(M),S=!1},d(T){T&&(detach(f),detach(v),detach(w),detach(k)),destroy_component(u,T),destroy_component(m,T),destroy_component(y,T),M&&M.d(T)}}}function create_default_slot_2$9(p){let u,f,m;return u=new BlockComponent({props:{type:"container",props:{gap:"M",direction:"column",hAlign:"stretch",vAlign:"top",size:"shrink"},$$slots:{default:[create_default_slot_3$7]},$$scope:{ctx:p}}}),{c(){create_component(u.$$.fragment),f=space()},m(v,y){mount_component(u,v,y),insert(v,f,y),m=!0},p(v,y){const w={};y[0]&464|y[1]&1&&(w.$$scope={dirty:y,ctx:v}),u.$set(w)},i(v){m||(transition_in(u.$$.fragment,v),m=!0)},o(v){transition_out(u.$$.fragment,v),m=!1},d(v){v&&detach(f),destroy_component(u,v)}}}function create_each_block$a(p,u){let f,m,v;return m=new BlockComponent({props:{type:"formstep",props:{step:u[27]+1,_instanceName:`Step ${u[27]+1}`},$$slots:{default:[create_default_slot_2$9]},$$scope:{ctx:u}}}),{key:p,first:null,c(){f=empty$1(),create_component(m.$$.fragment),this.first=f},m(y,w){insert(y,f,w),mount_component(m,y,w),v=!0},p(y,w){u=y;const k={};w[0]&128&&(k.props={step:u[27]+1,_instanceName:`Step ${u[27]+1}`}),w[0]&464|w[1]&1&&(k.$$scope={dirty:w,ctx:u}),m.$set(k)},i(y){v||(transition_in(m.$$.fragment,y),v=!0)},o(y){transition_out(m.$$.fragment,y),v=!1},d(y){y&&detach(f),destroy_component(m,y)}}}function create_default_slot_1$d(p){let u=[],f=new Map,m,v,y=ensure_array_like(p[7]);const w=k=>k[25]._stepId;for(let k=0;k<y.length;k+=1){let S=get_each_context$a(p,y,k),M=w(S);f.set(M,u[k]=create_each_block$a(M,S))}return{c(){for(let k=0;k<u.length;k+=1)u[k].c();m=empty$1()},m(k,S){for(let M=0;M<u.length;M+=1)u[M]&&u[M].m(k,S);insert(k,m,S),v=!0},p(k,S){S[0]&464&&(y=ensure_array_like(k[7]),group_outros(),u=update_keyed_each(u,S,w,1,k,y,f,m.parentNode,outro_and_destroy_block,create_each_block$a,m,get_each_context$a),check_outros())},i(k){if(!v){for(let S=0;S<y.length;S+=1)transition_in(u[S]);v=!0}},o(k){for(let S=0;S<u.length;S+=1)transition_out(u[S]);v=!1},d(k){k&&detach(m);for(let S=0;S<u.length;S+=1)u[S].d(k)}}}function create_default_slot$p(p){let u,f;return u=new BlockComponent({props:{type:"form",context:"form",props:{size:p[5],dataSource:p[3],actionType:p[0]==="Create"?"Create":"Update",readonly:p[0]==="View"},styles:{normal:{width:"600px","margin-left":"auto","margin-right":"auto"}},$$slots:{default:[create_default_slot_1$d]},$$scope:{ctx:p}}}),{c(){create_component(u.$$.fragment)},m(m,v){mount_component(u,m,v),f=!0},p(m,v){const y={};v[0]&41&&(y.props={size:m[5],dataSource:m[3],actionType:m[0]==="Create"?"Create":"Update",readonly:m[0]==="View"}),v[0]&464|v[1]&1&&(y.$$scope={dirty:v,ctx:m}),u.$set(y)},i(m){f||(transition_in(u.$$.fragment,m),f=!0)},o(m){transition_out(u.$$.fragment,m),f=!1},d(m){destroy_component(u,m)}}}function create_fragment$K(p){let u,f;return u=new FormBlockWrapper({props:{actionType:p[0],dataSource:p[3],rowId:p[1],noRowsMessage:p[2],$$slots:{default:[create_default_slot$p]},$$scope:{ctx:p}}}),{c(){create_component(u.$$.fragment)},m(m,v){mount_component(u,m,v),f=!0},p(m,v){const y={};v[0]&1&&(y.actionType=m[0]),v[0]&8&&(y.dataSource=m[3]),v[0]&2&&(y.rowId=m[1]),v[0]&4&&(y.noRowsMessage=m[2]),v[0]&505|v[1]&1&&(y.$$scope={dirty:v,ctx:m}),u.$set(y)},i(m){f||(transition_in(u.$$.fragment,m),f=!0)},o(m){transition_out(u.$$.fragment,m),f=!1},d(m){destroy_component(u,m)}}}function instance$J(p,u,f){let m,v,y,w,k,S,M;component_subscribe(p,builderStore,Ue=>f(16,k=Ue));let{actionType:T}=u,{rowId:E}=u,{noRowsMessage:H}=u,{steps:F}=u,{dataSource:Z}=u,{buttonPosition:$="bottom"}=u,{size:J}=u;const{fetchDatasourceSchema:se,generateGoldenSample:ie}=getContext$1("sdk"),he=getContext$1("component");component_subscribe(p,he,Ue=>f(17,S=Ue));const fe=getContext$1("context");component_subscribe(p,fe,Ue=>f(8,M=Ue));const pe=writable(1);setContext("current-step",pe);let ve;const Ae=()=>{var be;const Ue=get_store_value(he).id,Ze=((be=get_store_value(fe)[`${Ue}-provider`])==null?void 0:be.rows)||[],Ge=ie(Ze);return{[`${Ue}-repeater`]:Ge}},ze=(Ue,Ze,Ge)=>{if(!Ze)return;let be=Math.min(Ge||0,Ue.length-1);be=Math.max(be,0),pe.set(be+1)},Se=async Ue=>{f(6,ve=await se(Ue)||{})},Le=(Ue,Ze)=>Ue!=null&&Ue.length?Ue.filter(Ge=>Ge.active):Object.values(Ze||{}).filter(Ge=>!Ge.autocolumn).map(Ge=>({name:Ge.name,active:!0})),Ce=(Ue,Ze,Ge)=>{const be=Ue!=null&&Ue.length?Ue:[{}];return be.map((De,Ke)=>{const{title:He,fields:rt,buttons:ft}=De,Mt=buildMultiStepFormBlockDefaultProps({_id:Ge,stepCount:be.length,currentStep:Ke,actionType:T,dataSource:Z});return{...De,_stepId:uuid(),fields:Le(rt||[],Ze),title:He??Mt.title,buttons:ft||Mt.buttons}})};return p.$$set=Ue=>{"actionType"in Ue&&f(0,T=Ue.actionType),"rowId"in Ue&&f(1,E=Ue.rowId),"noRowsMessage"in Ue&&f(2,H=Ue.noRowsMessage),"steps"in Ue&&f(11,F=Ue.steps),"dataSource"in Ue&&f(3,Z=Ue.dataSource),"buttonPosition"in Ue&&f(4,$=Ue.buttonPosition),"size"in Ue&&f(5,J=Ue.size)},p.$$.update=()=>{var Ue;p.$$.dirty[0]&131072&&f(15,m=S.id),p.$$.dirty[0]&131072&&f(14,v=S.selected),p.$$.dirty[0]&65536&&f(13,y=(Ue=k.metadata)==null?void 0:Ue.step),p.$$.dirty[0]&8&&Se(Z),p.$$.dirty[0]&34880&&f(7,w=Ce(F,ve,m)),p.$$.dirty[0]&24704&&ze(w,v,y)},[T,E,H,Z,$,J,ve,w,M,he,fe,F,Ae,y,v,m,k,S]}class MultiStepFormblock extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$J,create_fragment$K,safe_not_equal,{actionType:0,rowId:1,noRowsMessage:2,steps:11,dataSource:3,buttonPosition:4,size:5,getAdditionalDataContext:12},null,[-1,-1])}get getAdditionalDataContext(){return this.$$.ctx[12]}}function create_if_block$q(p){var w,k;let u,f,m,v;u=new Button({props:{onClick:p[8],icon:"ri-filter-3-line",text:"Filter",size:p[0],type:"secondary",quiet:!0,active:((k=(w=p[1])==null?void 0:w.groups)==null?void 0:k.length)>0}});let y={$$slots:{default:[create_default_slot$o]},$$scope:{ctx:p}};return m=new Modal({props:y}),p[19](m),{c(){create_component(u.$$.fragment),f=space(),create_component(m.$$.fragment)},m(S,M){mount_component(u,S,M),insert(S,f,M),mount_component(m,S,M),v=!0},p(S,M){var H,F;const T={};M&1&&(T.size=S[0]),M&2&&(T.active=((F=(H=S[1])==null?void 0:H.groups)==null?void 0:F.length)>0),u.$set(T);const E={};M&134217812&&(E.$$scope={dirty:M,ctx:S}),m.$set(E)},i(S){v||(transition_in(u.$$.fragment,S),transition_in(m.$$.fragment,S),v=!0)},o(S){transition_out(u.$$.fragment,S),transition_out(m.$$.fragment,S),v=!1},d(S){S&&detach(f),destroy_component(u,S),p[19](null),destroy_component(m,S)}}}function create_default_slot_1$c(p){let u,f;return u=new CoreFilterBuilder({props:{filters:p[4],schemaFields:p[6],datasource:p[2],filtersLabel:null}}),u.$on("change",p[18]),{c(){create_component(u.$$.fragment)},m(m,v){mount_component(u,m,v),f=!0},p(m,v){const y={};v&16&&(y.filters=m[4]),v&64&&(y.schemaFields=m[6]),v&4&&(y.datasource=m[2]),u.$set(y)},i(m){f||(transition_in(u.$$.fragment,m),f=!0)},o(m){transition_out(u.$$.fragment,m),f=!1},d(m){destroy_component(u,m)}}}function create_default_slot$o(p){let u,f;return u=new ModalContent({props:{title:"Edit filters",size:"XL",onConfirm:p[9],$$slots:{default:[create_default_slot_1$c]},$$scope:{ctx:p}}}),{c(){create_component(u.$$.fragment)},m(m,v){mount_component(u,m,v),f=!0},p(m,v){const y={};v&134217812&&(y.$$scope={dirty:v,ctx:m}),u.$set(y)},i(m){f||(transition_in(u.$$.fragment,m),f=!0)},o(m){transition_out(u.$$.fragment,m),f=!1},d(m){destroy_component(u,m)}}}function create_fragment$J(p){let u,f,m=p[5]&&create_if_block$q(p);return{c(){m&&m.c(),u=empty$1()},m(v,y){m&&m.m(v,y),insert(v,u,y),f=!0},p(v,[y]){v[5]?m?(m.p(v,y),y&32&&transition_in(m,1)):(m=create_if_block$q(v),m.c(),transition_in(m,1),m.m(u.parentNode,u)):m&&(group_outros(),transition_out(m,1,1,()=>{m=null}),check_outros())},i(v){f||(transition_in(m),f=!0)},o(v){transition_out(m),f=!1},d(v){v&&detach(u),m&&m.d(v)}}}function instance$I(p,u,f){let m,v,y,w,k,S,M,T,{dataProvider:E}=u,{allowedFields:H}=u,{size:F="M"}=u;const Z=getContext$1("component");component_subscribe(p,Z,Ge=>f(17,T=Ge));const{builderStore:$,ActionTypes:J,getAction:se,fetchDatasourceSchema:ie}=getContext$1("sdk");let he,fe,pe,ve=!1,Ae;async function ze(Ge){Ge&&f(12,Ae=await ie(Ge,{enrichRelationships:!0})),f(5,ve=!0)}function Se(Ge,be){if(!ve)return{};let De={};return be!=null&&be.length?be==null||be.forEach(Ke=>{Ge!=null&&Ge[Ke.name]?(De[Ke.name]=Ge[Ke.name],De[Ke.name].displayName=Ke.displayName):Ge!=null&&Ge[Ke]&&(De[Ke]=Ge[Ke])}):De=Ge||{},Object.values(De||{}).filter(Ke=>!BannedSearchTypes.includes(Ke.type)).concat(y?[{name:"_id",type:"string"}]:[])}const Le=()=>{get_store_value($).inBuilder||(f(4,fe=pe?cloneDeep$1(pe):null),he.show())},Ce=()=>{f(1,pe=parseFilter(fe))};onDestroy(()=>{k==null||k(T.id)});const Ue=Ge=>{f(4,fe=Ge.detail)};function Ze(Ge){binding_callbacks[Ge?"unshift":"push"](()=>{he=Ge,f(3,he)})}return p.$$set=Ge=>{"dataProvider"in Ge&&f(10,E=Ge.dataProvider),"allowedFields"in Ge&&f(11,H=Ge.allowedFields),"size"in Ge&&f(0,F=Ge.size)},p.$$.update=()=>{var Ge;if(p.$$.dirty&1024&&f(16,m=E==null?void 0:E.id),p.$$.dirty&1024&&f(2,v=E==null?void 0:E.datasource),p.$$.dirty&4&&(y=["table","link","viewV2"].includes(v==null?void 0:v.type)),p.$$.dirty&65536&&f(14,w=se(m,J.AddDataProviderQueryExtension)),p.$$.dirty&65536&&f(13,k=se(m,J.RemoveDataProviderQueryExtension)),p.$$.dirty&4&&ze(v),p.$$.dirty&6144&&f(6,S=Se(Ae,H)),p.$$.dirty&2&&f(15,M=(Ge=pe==null?void 0:pe.groups)==null?void 0:Ge.reduce((be,De)=>{var Ke;return be+=((Ke=De==null?void 0:De.filters)==null?void 0:Ke.length)||0,be},0)),p.$$.dirty&188418)if(M){const be=buildQuery$1(pe);delete be.onEmptyFilter,w==null||w(T.id,be)}else k==null||k(T.id)},[F,pe,v,he,fe,ve,S,Z,Le,Ce,E,H,Ae,k,w,M,m,T,Ue,Ze]}class DynamicFilter extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$I,create_fragment$J,safe_not_equal,{dataProvider:10,allowedFields:11,size:0})}}function create_default_slot$n(p){let u;const f=p[3].default,m=create_slot(f,p,p[4],null);return{c(){m&&m.c()},m(v,y){m&&m.m(v,y),u=!0},p(v,y){m&&m.p&&(!u||y&16)&&update_slot_base(m,f,v,v[4],u?get_slot_changes(f,v[4],y,null):get_all_dirty_from_scope(v[4]),null)},i(v){u||(transition_in(m,v),u=!0)},o(v){transition_out(m,v),u=!1},d(v){m&&m.d(v)}}}function create_fragment$I(p){let u,f;return u=new p[1]({props:{data:p[0],scope:p[2].Local,$$slots:{default:[create_default_slot$n]},$$scope:{ctx:p}}}),{c(){create_component(u.$$.fragment)},m(m,v){mount_component(u,m,v),f=!0},p(m,[v]){const y={};v&1&&(y.data=m[0]),v&16&&(y.$$scope={dirty:v,ctx:m}),u.$set(y)},i(m){f||(transition_in(u.$$.fragment,m),f=!0)},o(m){transition_out(u.$$.fragment,m),f=!1},d(m){destroy_component(u,m)}}}function instance$H(p,u,f){let{$$slots:m={},$$scope:v}=u,{row:y}=u;const{Provider:w,ContextScopes:k}=getContext$1("sdk");return p.$$set=S=>{"row"in S&&f(0,y=S.row),"$$scope"in S&&f(4,v=S.$$scope)},[y,w,k,m,v]}class SlotRenderer extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$H,create_fragment$I,safe_not_equal,{row:0})}}const Table_svelte_svelte_type_style_lang="";function create_default_slot_1$b(p){let u;const f=p[30].default,m=create_slot(f,p,p[32],null);return{c(){m&&m.c()},m(v,y){m&&m.m(v,y),u=!0},p(v,y){m&&m.p&&(!u||y[1]&2)&&update_slot_base(m,f,v,v[32],u?get_slot_changes(f,v[32],y,null):get_all_dirty_from_scope(v[32]),null)},i(v){u||(transition_in(m,v),u=!0)},o(v){transition_out(m,v),u=!1},d(v){m&&m.d(v)}}}function create_default_slot$m(p){var w;let u,f,m;function v(k){p[31](k)}let y={data:p[8],schema:p[12],loading:p[13],rowCount:p[1],quiet:p[2],compact:p[5],customRenderers:p[18],snippets:p[14],allowSelectRows:p[4]&&p[11],allowEditRows:!1,allowEditColumns:!1,showAutoColumns:!0,disableSorting:!0,autoSortColumns:!((w=p[0])!=null&&w.length),placeholderText:p[6]||"No rows found",$$slots:{default:[create_default_slot_1$b]},$$scope:{ctx:p}};return p[7]!==void 0&&(y.selectedRows=p[7]),u=new Table$1({props:y}),binding_callbacks.push(()=>bind(u,"selectedRows",v)),u.$on("sort",p[19]),u.$on("click",p[20]),{c(){create_component(u.$$.fragment)},m(k,S){mount_component(u,k,S),m=!0},p(k,S){var T;const M={};S[0]&256&&(M.data=k[8]),S[0]&4096&&(M.schema=k[12]),S[0]&8192&&(M.loading=k[13]),S[0]&2&&(M.rowCount=k[1]),S[0]&4&&(M.quiet=k[2]),S[0]&32&&(M.compact=k[5]),S[0]&16384&&(M.snippets=k[14]),S[0]&2064&&(M.allowSelectRows=k[4]&&k[11]),S[0]&1&&(M.autoSortColumns=!((T=k[0])!=null&&T.length)),S[0]&64&&(M.placeholderText=k[6]||"No rows found"),S[1]&2&&(M.$$scope={dirty:S,ctx:k}),!f&&S[0]&128&&(f=!0,M.selectedRows=k[7],add_flush_callback(()=>f=!1)),u.$set(M)},i(k){m||(transition_in(u.$$.fragment,k),m=!0)},o(k){transition_out(u.$$.fragment,k),m=!1},d(k){destroy_component(u,k)}}}function create_if_block$p(p){let u,f=p[7].length+"",m,v,y=p[7].length===1?"":"s",w,k;return{c(){u=element("div"),m=text$1(f),v=text$1(" row"),w=text$1(y),k=text$1(" selected"),attr(u,"class","row-count svelte-9e4ofs")},m(S,M){insert(S,u,M),append$2(u,m),append$2(u,v),append$2(u,w),append$2(u,k)},p(S,M){M[0]&128&&f!==(f=S[7].length+"")&&set_data(m,f),M[0]&128&&y!==(y=S[7].length===1?"":"s")&&set_data(w,y)},d(S){S&&detach(u)}}}function create_fragment$H(p){let u,f,m,v,y,w,k,S;f=new Provider({props:{actions:p[21],data:p[10],$$slots:{default:[create_default_slot$m]},$$scope:{ctx:p}}});let M=p[4]&&p[7].length&&create_if_block$p(p);return{c(){u=element("div"),create_component(f.$$.fragment),m=space(),M&&M.c(),attr(u,"class",v=null_to_empty(p[3])+" svelte-9e4ofs")},m(T,E){insert(T,u,E),mount_component(f,u,null),append$2(u,m),M&&M.m(u,null),w=!0,k||(S=action_destroyer(y=p[17].call(null,u,p[9].styles)),k=!0)},p(T,E){const H={};E[0]&1024&&(H.data=T[10]),E[0]&31223|E[1]&2&&(H.$$scope={dirty:E,ctx:T}),f.$set(H),T[4]&&T[7].length?M?M.p(T,E):(M=create_if_block$p(T),M.c(),M.m(u,null)):M&&(M.d(1),M=null),(!w||E[0]&8&&v!==(v=null_to_empty(T[3])+" svelte-9e4ofs"))&&attr(u,"class",v),y&&is_function(y.update)&&E[0]&512&&y.update.call(null,T[9].styles)},i(T){w||(transition_in(f.$$.fragment,T),w=!0)},o(T){transition_out(f.$$.fragment,T),w=!1},d(T){T&&detach(u),destroy_component(f),M&&M.d(),k=!1,S()}}}function instance$G(p,u,f){let m,v,y,w,k,S,M,T,E,H,F,Z,$,{$$slots:J={},$$scope:se}=u,{dataProvider:ie}=u,{columns:he}=u,{rowCount:fe}=u,{quiet:pe}=u,{size:ve}=u,{allowSelectRows:Ae}=u,{compact:ze}=u,{onClick:Se}=u,{noRowsMessage:Le}=u;const Ce=getContext$1("component");component_subscribe(p,Ce,Xe=>f(9,Z=Xe));const Ue=getContext$1("context");component_subscribe(p,Ue,Xe=>f(29,$=Xe));const{styleable:Ze,getAction:Ge,ActionTypes:be,rowSelectionStore:De,generateGoldenSample:Ke}=getContext$1("sdk"),He=`custom-${Math.random()}`,rt=[{column:He,component:SlotRenderer}];let ft=[];const Mt=()=>({eventContext:{row:Ke(w)}}),$e=(Xe,Gt,Jt,Ht)=>{if(Gt!=null&&Gt.length)return Gt;let Pt=[],Et=[];return Object.entries(Xe).forEach(([Sn,$t])=>{$t.visible!==!1&&($t!=null&&$t.autocolumn?Jt&&Et.push(Sn):Pt.push(Sn))}),Pt.concat(Et).sort((Sn,$t)=>{if(Sn===Ht)return-1;if($t===Ht)return 1;const xn=Xe[Sn].order,sn=Xe[$t].order;return xn===sn?0:xn==null?1:sn==null||xn<sn?-1:1})},je=(Xe,Gt,Jt)=>{let Ht={};return Jt&&(Ht[He]={displayName:null,order:0,sortable:!1,divider:!0,width:"auto",preventSelectRow:!0}),Gt.forEach(Pt=>{const Et=typeof Pt=="string"?Pt:Pt.name;Xe[Et]&&(Ht[Et]=Xe[Et],canBeSortColumn(Xe[Et])||(Ht[Et].sortable=!1),typeof Pt=="object"&&(Ht[Et]={...Ht[Et],...Pt}))}),Ht},Ct=Xe=>{E({column:Xe.detail.column,order:Xe.detail.order})},yt=Xe=>{Se&&Se({row:Xe.detail})},ot=[{type:be.ClearRowSelection,callback:()=>f(7,ft=[])}];onDestroy(()=>{De.actions.updateSelection(Z.id,[])});function Rt(Xe){ft=Xe,f(7,ft),f(8,w),f(22,ie)}return p.$$set=Xe=>{"dataProvider"in Xe&&f(22,ie=Xe.dataProvider),"columns"in Xe&&f(0,he=Xe.columns),"rowCount"in Xe&&f(1,fe=Xe.rowCount),"quiet"in Xe&&f(2,pe=Xe.quiet),"size"in Xe&&f(3,ve=Xe.size),"allowSelectRows"in Xe&&f(4,Ae=Xe.allowSelectRows),"compact"in Xe&&f(5,ze=Xe.compact),"onClick"in Xe&&f(23,Se=Xe.onClick),"noRowsMessage"in Xe&&f(6,Le=Xe.noRowsMessage),"$$scope"in Xe&&f(32,se=Xe.$$scope)},p.$$.update=()=>{var Xe;if(p.$$.dirty[0]&536870912&&f(14,m=$.snippets),p.$$.dirty[0]&512&&f(25,v=Z.children),p.$$.dirty[0]&4194304&&f(13,y=(ie==null?void 0:ie.loading)??!1),p.$$.dirty[0]&4194304&&f(8,w=(ie==null?void 0:ie.rows)||[]),p.$$.dirty[0]&4194304&&f(27,k=(ie==null?void 0:ie.schema)??{}),p.$$.dirty[0]&4194304&&f(28,S=ie==null?void 0:ie.primaryDisplay),p.$$.dirty[0]&402653185&&f(26,M=$e(k,he,!1,S)),p.$$.dirty[0]&234881024&&f(12,T=je(k,M,v)),p.$$.dirty[0]&4194304&&(E=Ge(ie==null?void 0:ie.id,be.SetDataProviderSorting)),p.$$.dirty[0]&4194304&&f(11,H=((Xe=ie==null?void 0:ie.datasource)==null?void 0:Xe.type)==="table"),p.$$.dirty[0]&384&&w){let Gt=w.map(Jt=>Jt._id);Gt.length&&f(7,ft=ft.filter(Jt=>Gt.includes(Jt._id)))}p.$$.dirty[0]&640&&De.actions.updateSelection(Z.id,ft.length?ft[0].tableId:"",ft.map(Gt=>Gt._id)),p.$$.dirty[0]&128&&f(10,F={selectedRows:ft})},[he,fe,pe,ve,Ae,ze,Le,ft,w,Z,F,H,T,y,m,Ce,Ue,Ze,rt,Ct,yt,ot,ie,Se,Mt,v,M,k,S,$,J,Rt,se]}class Table_1 extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$G,create_fragment$H,safe_not_equal,{dataProvider:22,columns:0,rowCount:1,quiet:2,size:3,allowSelectRows:4,compact:5,onClick:23,noRowsMessage:6,getAdditionalDataContext:24},null,[-1,-1])}get getAdditionalDataContext(){return this.$$.ctx[24]}}function get_each_context$9(p,u,f){const m=p.slice();return m[60]=u[f],m[62]=f,m}function create_if_block$o(p){let u,f;return u=new Block({props:{$$slots:{default:[create_default_slot$l]},$$scope:{ctx:p}}}),{c(){create_component(u.$$.fragment)},m(m,v){mount_component(u,m,v),f=!0},p(m,v){const y={};v[0]&2013265919|v[1]&15|v[2]&2&&(y.$$scope={dirty:v,ctx:m}),u.$set(y)},i(m){f||(transition_in(u.$$.fragment,m),f=!0)},o(m){transition_out(u.$$.fragment,m),f=!1},d(m){destroy_component(u,m)}}}function create_if_block_3$4(p){let u,f;return u=new BlockComponent({props:{type:"container",props:{direction:"row",hAlign:"stretch",vAlign:"middle",gap:"M",wrap:!0},styles:{normal:{"margin-bottom":"20px"}},order:0,$$slots:{default:[create_default_slot_5$2]},$$scope:{ctx:p}}}),{c(){create_component(u.$$.fragment)},m(m,v){mount_component(u,m,v),f=!0},p(m,v){const y={};v[0]&302002177|v[2]&2&&(y.$$scope={dirty:v,ctx:m}),u.$set(y)},i(m){f||(transition_in(u.$$.fragment,m),f=!0)},o(m){transition_out(u.$$.fragment,m),f=!1},d(m){destroy_component(u,m)}}}function create_if_block_5$3(p){let u=[],f=new Map,m,v,y=ensure_array_like(p[25]);const w=k=>k[60].name;for(let k=0;k<y.length;k+=1){let S=get_each_context$9(p,y,k),M=w(S);f.set(M,u[k]=create_each_block$9(M,S))}return{c(){for(let k=0;k<u.length;k+=1)u[k].c();m=empty$1()},m(k,S){for(let M=0;M<u.length;M+=1)u[M]&&u[M].m(k,S);insert(k,m,S),v=!0},p(k,S){S[0]&33554432&&(y=ensure_array_like(k[25]),group_outros(),u=update_keyed_each(u,S,w,1,k,y,f,m.parentNode,outro_and_destroy_block,create_each_block$9,m,get_each_context$9),check_outros())},i(k){if(!v){for(let S=0;S<y.length;S+=1)transition_in(u[S]);v=!0}},o(k){for(let S=0;S<u.length;S+=1)transition_out(u[S]);v=!1},d(k){k&&detach(m);for(let S=0;S<u.length;S+=1)u[S].d(k)}}}function create_each_block$9(p,u){let f,m,v;return m=new BlockComponent({props:{type:u[60].componentType,props:{field:u[60].name,placeholder:u[60].name,text:u[60].name,autoWidth:!0},styles:{normal:{width:"192px"}},order:u[62]}}),{key:p,first:null,c(){f=empty$1(),create_component(m.$$.fragment),this.first=f},m(y,w){insert(y,f,w),mount_component(m,y,w),v=!0},p(y,w){u=y;const k={};w[0]&33554432&&(k.type=u[60].componentType),w[0]&33554432&&(k.props={field:u[60].name,placeholder:u[60].name,text:u[60].name,autoWidth:!0}),w[0]&33554432&&(k.order=u[62]),m.$set(k)},i(y){v||(transition_in(m.$$.fragment,y),v=!0)},o(y){transition_out(m.$$.fragment,y),v=!1},d(y){y&&detach(f),destroy_component(m,y)}}}function create_if_block_4$3(p){var m;let u,f;return u=new BlockComponent({props:{type:"button",props:{onClick:p[28],text:p[13],type:"cta"},order:((m=p[25])==null?void 0:m.length)??0}}),{c(){create_component(u.$$.fragment)},m(v,y){mount_component(u,v,y),f=!0},p(v,y){var k;const w={};y[0]&268443648&&(w.props={onClick:v[28],text:v[13],type:"cta"}),y[0]&33554432&&(w.order=((k=v[25])==null?void 0:k.length)??0),u.$set(w)},i(v){f||(transition_in(u.$$.fragment,v),f=!0)},o(v){transition_out(u.$$.fragment,v),f=!1},d(v){destroy_component(u,v)}}}function create_default_slot_6$2(p){var w;let u,f,m,v=((w=p[25])==null?void 0:w.length)&&create_if_block_5$3(p),y=p[12]&&create_if_block_4$3(p);return{c(){v&&v.c(),u=space(),y&&y.c(),f=empty$1()},m(k,S){v&&v.m(k,S),insert(k,u,S),y&&y.m(k,S),insert(k,f,S),m=!0},p(k,S){var M;(M=k[25])!=null&&M.length?v?(v.p(k,S),S[0]&33554432&&transition_in(v,1)):(v=create_if_block_5$3(k),v.c(),transition_in(v,1),v.m(u.parentNode,u)):v&&(group_outros(),transition_out(v,1,1,()=>{v=null}),check_outros()),k[12]?y?(y.p(k,S),S[0]&4096&&transition_in(y,1)):(y=create_if_block_4$3(k),y.c(),transition_in(y,1),y.m(f.parentNode,f)):y&&(group_outros(),transition_out(y,1,1,()=>{y=null}),check_outros())},i(k){m||(transition_in(v),transition_in(y),m=!0)},o(k){transition_out(v),transition_out(y),m=!1},d(k){k&&(detach(u),detach(f)),v&&v.d(k),y&&y.d(k)}}}function create_default_slot_5$2(p){let u,f,m,v;return u=new BlockComponent({props:{type:"heading",props:{text:p[0]},order:0}}),m=new BlockComponent({props:{type:"container",props:{direction:"row",hAlign:"left",vAlign:"center",gap:"M",wrap:!0},order:1,$$slots:{default:[create_default_slot_6$2]},$$scope:{ctx:p}}}),{c(){create_component(u.$$.fragment),f=space(),create_component(m.$$.fragment)},m(y,w){mount_component(u,y,w),insert(y,f,w),mount_component(m,y,w),v=!0},p(y,w){const k={};w[0]&1&&(k.props={text:y[0]}),u.$set(k);const S={};w[0]&302002176|w[2]&2&&(S.$$scope={dirty:w,ctx:y}),m.$set(S)},i(y){v||(transition_in(u.$$.fragment,y),transition_in(m.$$.fragment,y),v=!0)},o(y){transition_out(u.$$.fragment,y),transition_out(m.$$.fragment,y),v=!1},d(y){y&&detach(f),destroy_component(u,y),destroy_component(m,y)}}}function create_default_slot_4$3(p){let u,f;return u=new BlockComponent({props:{type:"table",context:"table",props:{dataProvider:`{{ literal ${makePropSafe(p[26])} }}`,columns:p[5],rowCount:p[6],quiet:p[7],compact:p[8],allowSelectRows:p[10],size:p[9],onClick:p[29],noRowsMessage:p[15]||"No rows found"}}}),{c(){create_component(u.$$.fragment)},m(m,v){mount_component(u,m,v),f=!0},p(m,v){const y={};v[0]&604014560&&(y.props={dataProvider:`{{ literal ${makePropSafe(m[26])} }}`,columns:m[5],rowCount:m[6],quiet:m[7],compact:m[8],allowSelectRows:m[10],size:m[9],onClick:m[29],noRowsMessage:m[15]||"No rows found"}),u.$set(y)},i(m){f||(transition_in(u.$$.fragment,m),f=!0)},o(m){transition_out(u.$$.fragment,m),f=!1},d(m){destroy_component(u,m)}}}function create_if_block_2$7(p){let u,f,m;function v(w){p[49](w)}let y={name:"Details side panel",type:"sidepanel",context:"details-side-panel",order:2,$$slots:{default:[create_default_slot_3$6]},$$scope:{ctx:p}};return p[22]!==void 0&&(y.id=p[22]),u=new BlockComponent({props:y}),binding_callbacks.push(()=>bind(u,"id",v)),{c(){create_component(u.$$.fragment)},m(w,k){mount_component(u,w,k),m=!0},p(w,k){const S={};k[0]&1076297730|k[1]&13|k[2]&2&&(S.$$scope={dirty:k,ctx:w}),!f&&k[0]&4194304&&(f=!0,S.id=w[22],add_flush_callback(()=>f=!1)),u.$set(S)},i(w){m||(transition_in(u.$$.fragment,w),m=!0)},o(w){transition_out(u.$$.fragment,w),m=!1},d(w){destroy_component(u,w)}}}function create_default_slot_3$6(p){let u,f,m;function v(w){p[48](w)}let y={name:"Details form block",type:"formblock",context:"form-edit",props:{dataSource:p[1],buttonPosition:"top",buttons:buildFormBlockButtonConfig({_id:p[33]+"-form-edit",showDeleteButton:p[34]!=="",showSaveButton:!0,saveButtonLabel:p[17]||"Save",deleteButtonLabel:p[34],notificationOverride:p[18],actionType:"Update",dataSource:p[1]}),actionType:"Update",rowId:`{{ ${makePropSafe("state")}.${makePropSafe(p[36])} }}`,fields:p[16]||p[30],title:p[31],labelPosition:"left"}};return p[21]!==void 0&&(y.id=p[21]),u=new BlockComponent({props:y}),binding_callbacks.push(()=>bind(u,"id",v)),{c(){create_component(u.$$.fragment)},m(w,k){mount_component(u,w,k),m=!0},p(w,k){const S={};k[0]&1074200578|k[1]&13&&(S.props={dataSource:w[1],buttonPosition:"top",buttons:buildFormBlockButtonConfig({_id:w[33]+"-form-edit",showDeleteButton:w[34]!=="",showSaveButton:!0,saveButtonLabel:w[17]||"Save",deleteButtonLabel:w[34],notificationOverride:w[18],actionType:"Update",dataSource:w[1]}),actionType:"Update",rowId:`{{ ${makePropSafe("state")}.${makePropSafe(w[36])} }}`,fields:w[16]||w[30],title:w[31],labelPosition:"left"}),!f&&k[0]&2097152&&(f=!0,S.id=w[21],add_flush_callback(()=>f=!1)),u.$set(S)},i(w){m||(transition_in(u.$$.fragment,w),m=!0)},o(w){transition_out(u.$$.fragment,w),m=!1},d(w){destroy_component(u,w)}}}function create_if_block_1$9(p){let u,f,m;function v(w){p[50](w)}let y={name:"New row side panel",type:"sidepanel",context:"new-side-panel",order:3,$$slots:{default:[create_default_slot_2$8]},$$scope:{ctx:p}};return p[23]!==void 0&&(y.id=p[23]),u=new BlockComponent({props:y}),binding_callbacks.push(()=>bind(u,"id",v)),{c(){create_component(u.$$.fragment)},m(w,k){mount_component(u,w,k),m=!0},p(w,k){const S={};k[0]&1074069506|k[1]&4|k[2]&2&&(S.$$scope={dirty:k,ctx:w}),!f&&k[0]&8388608&&(f=!0,S.id=w[23],add_flush_callback(()=>f=!1)),u.$set(S)},i(w){m||(transition_in(u.$$.fragment,w),m=!0)},o(w){transition_out(u.$$.fragment,w),m=!1},d(w){destroy_component(u,w)}}}function create_default_slot_2$8(p){let u,f;return u=new BlockComponent({props:{name:"New row form block",type:"formblock",context:"form-new",props:{dataSource:p[1],buttonPosition:"top",buttons:buildFormBlockButtonConfig({_id:p[33]+"-form-new",showDeleteButton:!1,showSaveButton:!0,saveButtonLabel:"Save",notificationOverride:p[18],actionType:"Create",dataSource:p[1]}),actionType:"Create",fields:p[16]||p[30],title:"Create Row",labelPosition:"left"}}}),{c(){create_component(u.$$.fragment)},m(m,v){mount_component(u,m,v),f=!0},p(m,v){const y={};v[0]&1074069506|v[1]&4&&(y.props={dataSource:m[1],buttonPosition:"top",buttons:buildFormBlockButtonConfig({_id:m[33]+"-form-new",showDeleteButton:!1,showSaveButton:!0,saveButtonLabel:"Save",notificationOverride:m[18],actionType:"Create",dataSource:m[1]}),actionType:"Create",fields:m[16]||m[30],title:"Create Row",labelPosition:"left"}),u.$set(y)},i(m){f||(transition_in(u.$$.fragment,m),f=!0)},o(m){transition_out(u.$$.fragment,m),f=!1},d(m){destroy_component(u,m)}}}function create_default_slot_1$a(p){var F;let u,f,m,v,y,w,k,S=(p[0]||((F=p[25])==null?void 0:F.length)||p[12])&&create_if_block_3$4(p);function M(Z){p[47](Z)}let T={type:"dataprovider",props:{dataSource:p[1],filter:p[32],sortColumn:p[2]||p[24],sortOrder:p[3],paginate:p[4],limit:p[6],autoRefresh:p[19]},context:"provider",order:1,$$slots:{default:[create_default_slot_4$3]},$$scope:{ctx:p}};p[26]!==void 0&&(T.id=p[26]),f=new BlockComponent({props:T}),binding_callbacks.push(()=>bind(f,"id",M));let E=p[11]==="details"&&create_if_block_2$7(p),H=p[12]&&p[14]==="new"&&create_if_block_1$9(p);return{c(){S&&S.c(),u=space(),create_component(f.$$.fragment),v=space(),E&&E.c(),y=space(),H&&H.c(),w=empty$1()},m(Z,$){S&&S.m(Z,$),insert(Z,u,$),mount_component(f,Z,$),insert(Z,v,$),E&&E.m(Z,$),insert(Z,y,$),H&&H.m(Z,$),insert(Z,w,$),k=!0},p(Z,$){var se;Z[0]||(se=Z[25])!=null&&se.length||Z[12]?S?(S.p(Z,$),$[0]&33558529&&transition_in(S,1)):(S=create_if_block_3$4(Z),S.c(),transition_in(S,1),S.m(u.parentNode,u)):S&&(group_outros(),transition_out(S,1,1,()=>{S=null}),check_outros());const J={};$[0]&17301598|$[1]&2&&(J.props={dataSource:Z[1],filter:Z[32],sortColumn:Z[2]||Z[24],sortOrder:Z[3],paginate:Z[4],limit:Z[6],autoRefresh:Z[19]}),$[0]&604014560|$[2]&2&&(J.$$scope={dirty:$,ctx:Z}),!m&&$[0]&67108864&&(m=!0,J.id=Z[26],add_flush_callback(()=>m=!1)),f.$set(J),Z[11]==="details"?E?(E.p(Z,$),$[0]&2048&&transition_in(E,1)):(E=create_if_block_2$7(Z),E.c(),transition_in(E,1),E.m(y.parentNode,y)):E&&(group_outros(),transition_out(E,1,1,()=>{E=null}),check_outros()),Z[12]&&Z[14]==="new"?H?(H.p(Z,$),$[0]&20480&&transition_in(H,1)):(H=create_if_block_1$9(Z),H.c(),transition_in(H,1),H.m(w.parentNode,w)):H&&(group_outros(),transition_out(H,1,1,()=>{H=null}),check_outros())},i(Z){k||(transition_in(S),transition_in(f.$$.fragment,Z),transition_in(E),transition_in(H),k=!0)},o(Z){transition_out(S),transition_out(f.$$.fragment,Z),transition_out(E),transition_out(H),k=!1},d(Z){Z&&(detach(u),detach(v),detach(y),detach(w)),S&&S.d(Z),destroy_component(f,Z),E&&E.d(Z),H&&H.d(Z)}}}function create_default_slot$l(p){let u,f,m;function v(w){p[51](w)}let y={type:"form",props:{dataSource:p[1],disableSchemaValidation:!0,editAutoColumns:!0,size:p[9]},$$slots:{default:[create_default_slot_1$a]},$$scope:{ctx:p}};return p[20]!==void 0&&(y.id=p[20]),u=new BlockComponent({props:y}),binding_callbacks.push(()=>bind(u,"id",v)),{c(){create_component(u.$$.fragment)},m(w,k){mount_component(u,w,k),m=!0},p(w,k){const S={};k[0]&514&&(S.props={dataSource:w[1],disableSchemaValidation:!0,editAutoColumns:!0,size:w[9]}),k[0]&2012217343|k[1]&15|k[2]&2&&(S.$$scope={dirty:k,ctx:w}),!f&&k[0]&1048576&&(f=!0,S.id=w[20],add_flush_callback(()=>f=!1)),u.$set(S)},i(w){m||(transition_in(u.$$.fragment,w),m=!0)},o(w){transition_out(u.$$.fragment,w),m=!1},d(w){destroy_component(u,w)}}}function create_fragment$G(p){let u,f,m=p[27]&&create_if_block$o(p);return{c(){m&&m.c(),u=empty$1()},m(v,y){m&&m.m(v,y),insert(v,u,y),f=!0},p(v,y){v[27]?m?(m.p(v,y),y[0]&134217728&&transition_in(m,1)):(m=create_if_block$o(v),m.c(),transition_in(m,1),m.m(u.parentNode,u)):m&&(group_outros(),transition_out(m,1,1,()=>{m=null}),check_outros())},i(v){f||(transition_in(m),f=!0)},o(v){transition_out(m),f=!1},d(v){v&&detach(u),m&&m.d(v)}}}function instance$F(p,u,f){let m,v,y,w,k,S,M,T,E,{title:H}=u,{dataSource:F}=u,{searchColumns:Z}=u,{filter:$}=u,{sortColumn:J}=u,{sortOrder:se}=u,{paginate:ie}=u,{tableColumns:he}=u,{rowCount:fe}=u,{quiet:pe}=u,{compact:ve}=u,{size:Ae}=u,{allowSelectRows:ze}=u,{clickBehaviour:Se}=u,{onClick:Le}=u,{showTitleButton:Ce}=u,{titleButtonText:Ue}=u,{titleButtonClickBehaviour:Ze}=u,{onClickTitleButton:Ge}=u,{noRowsMessage:be}=u,{sidePanelFields:De}=u,{sidePanelShowDelete:Ke}=u,{sidePanelSaveLabel:He}=u,{sidePanelDeleteLabel:rt}=u,{notificationOverride:ft}=u,{autoRefresh:Mt}=u;const{fetchDatasourceSchema:$e,API:je,generateGoldenSample:Ct}=getContext$1("sdk"),yt=getContext$1("component");component_subscribe(p,yt,Tt=>f(46,E=Tt));const ot=getContext$1("context"),Rt=`ID_${shortid.generate()}`;let Xe,Gt,Jt,Ht,Pt,Et,cn,Sn,$t=!1;const xn=()=>{var Ut;const Tt=(Ut=get_store_value(ot)[Gt])==null?void 0:Ut.rows;return{eventContext:{row:Ct(Tt)}}},sn=Tt=>{let Zt=Ke===!1?"":Tt;return(Zt==null?void 0:Zt.trim())===""?"":Zt||"Delete"},mt=async Tt=>{if((Tt==null?void 0:Tt.type)==="table"){const Zt=await je.fetchTableDefinition(Tt==null?void 0:Tt.tableId);f(44,Et=Zt.schema),f(24,cn=Zt.primaryDisplay)}else Tt&&f(44,Et=await $e(Tt,{enrichRelationships:!0}));f(27,$t=!0)},Mn=Tt=>Tt?Object.entries(Tt).filter(Zt=>!Zt[1].autocolumn).map(Zt=>Zt[0]):[],Dt=(Tt,Zt)=>{if(!Zt||!Tt)return"Edit";const hn=`${makePropSafe(Tt+"-repeater")}.${makePropSafe(Zt)}`;return`{{#if ${hn}}}{{${hn}}}{{else}}Details{{/if}}`};function Wt(Tt){Gt=Tt,f(26,Gt)}function nn(Tt){Jt=Tt,f(21,Jt)}function Ot(Tt){Ht=Tt,f(22,Ht)}function gt(Tt){Pt=Tt,f(23,Pt)}function Xt(Tt){Xe=Tt,f(20,Xe)}return p.$$set=Tt=>{"title"in Tt&&f(0,H=Tt.title),"dataSource"in Tt&&f(1,F=Tt.dataSource),"searchColumns"in Tt&&f(37,Z=Tt.searchColumns),"filter"in Tt&&f(38,$=Tt.filter),"sortColumn"in Tt&&f(2,J=Tt.sortColumn),"sortOrder"in Tt&&f(3,se=Tt.sortOrder),"paginate"in Tt&&f(4,ie=Tt.paginate),"tableColumns"in Tt&&f(5,he=Tt.tableColumns),"rowCount"in Tt&&f(6,fe=Tt.rowCount),"quiet"in Tt&&f(7,pe=Tt.quiet),"compact"in Tt&&f(8,ve=Tt.compact),"size"in Tt&&f(9,Ae=Tt.size),"allowSelectRows"in Tt&&f(10,ze=Tt.allowSelectRows),"clickBehaviour"in Tt&&f(11,Se=Tt.clickBehaviour),"onClick"in Tt&&f(39,Le=Tt.onClick),"showTitleButton"in Tt&&f(12,Ce=Tt.showTitleButton),"titleButtonText"in Tt&&f(13,Ue=Tt.titleButtonText),"titleButtonClickBehaviour"in Tt&&f(14,Ze=Tt.titleButtonClickBehaviour),"onClickTitleButton"in Tt&&f(40,Ge=Tt.onClickTitleButton),"noRowsMessage"in Tt&&f(15,be=Tt.noRowsMessage),"sidePanelFields"in Tt&&f(16,De=Tt.sidePanelFields),"sidePanelShowDelete"in Tt&&f(41,Ke=Tt.sidePanelShowDelete),"sidePanelSaveLabel"in Tt&&f(17,He=Tt.sidePanelSaveLabel),"sidePanelDeleteLabel"in Tt&&f(42,rt=Tt.sidePanelDeleteLabel),"notificationOverride"in Tt&&f(18,ft=Tt.notificationOverride),"autoRefresh"in Tt&&f(19,Mt=Tt.autoRefresh)},p.$$.update=()=>{p.$$.dirty[1]&3072&&f(34,m=sn(rt)),p.$$.dirty[1]&32768&&f(33,v=E.id),p.$$.dirty[0]&2&&f(45,y=(F==null?void 0:F.type)==="table"||(F==null?void 0:F.type)==="viewV2"),p.$$.dirty[0]&2&&mt(F),p.$$.dirty[1]&8256&&enrichSearchColumns(Z,Et).then(Tt=>f(25,Sn=Tt)),p.$$.dirty[0]&34603008|p.$$.dirty[1]&128&&f(32,w=enrichFilter($,Sn,Xe)),p.$$.dirty[0]&18874368&&f(31,k=Dt(Jt,cn)),p.$$.dirty[1]&8192&&f(30,S=Mn(Et)),p.$$.dirty[0]&4196352|p.$$.dirty[1]&16640&&f(29,M=Se==="actions"||!y?Le:[{id:0,"##eventHandlerType":"Update State",parameters:{key:Rt,type:"set",persist:!1,value:`{{ ${makePropSafe("eventContext")}.${makePropSafe("row")}._id }}`}},{id:1,"##eventHandlerType":"Open Side Panel",parameters:{id:Ht}}]),p.$$.dirty[0]&8404992|p.$$.dirty[1]&16896&&f(28,T=Ze==="actions"||!y?Ge:[{id:0,"##eventHandlerType":"Open Side Panel",parameters:{id:Pt}}])},[H,F,J,se,ie,he,fe,pe,ve,Ae,ze,Se,Ce,Ue,Ze,be,De,He,ft,Mt,Xe,Jt,Ht,Pt,cn,Sn,Gt,$t,T,M,S,k,w,v,m,yt,Rt,Z,$,Le,Ge,Ke,rt,xn,Et,y,E,Wt,nn,Ot,gt,Xt]}class TableBlock extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$F,create_fragment$G,safe_not_equal,{title:0,dataSource:1,searchColumns:37,filter:38,sortColumn:2,sortOrder:3,paginate:4,tableColumns:5,rowCount:6,quiet:7,compact:8,size:9,allowSelectRows:10,clickBehaviour:11,onClick:39,showTitleButton:12,titleButtonText:13,titleButtonClickBehaviour:14,onClickTitleButton:40,noRowsMessage:15,sidePanelFields:16,sidePanelShowDelete:41,sidePanelSaveLabel:17,sidePanelDeleteLabel:42,notificationOverride:18,autoRefresh:19,getAdditionalDataContext:43},null,[-1,-1,-1])}get getAdditionalDataContext(){return this.$$.ctx[43]}}const Navigation_svelte_svelte_type_style_lang="";function create_if_block$n(p){let u,f,m,v,y,w;return{c(){u=element("div"),f=element("a"),m=element("img"),attr(m,"class","logo svelte-1ggxdm7"),attr(m,"alt","logo"),src_url_equal(m.src,v=p[0]||"/builder/bblogo.png")||attr(m,"src",v),attr(m,"height","48"),attr(f,"href","/"),attr(u,"class","nav__top svelte-1ggxdm7")},m(k,S){insert(k,u,S),append$2(u,f),append$2(f,m),y||(w=action_destroyer(p[3].call(null,f)),y=!0)},p(k,S){S&1&&!src_url_equal(m.src,v=k[0]||"/builder/bblogo.png")&&attr(m,"src",v)},d(k){k&&detach(u),y=!1,w()}}}function create_fragment$F(p){let u,f,m,v,y,w,k,S=!p[1]&&create_if_block$n(p);const M=p[7].default,T=create_slot(M,p,p[6],null);return{c(){u=element("div"),S&&S.c(),f=space(),m=element("div"),T&&T.c(),attr(m,"class","nav__menu svelte-1ggxdm7"),attr(u,"class","nav svelte-1ggxdm7")},m(E,H){insert(E,u,H),S&&S.m(u,null),append$2(u,f),append$2(u,m),T&&T.m(m,null),y=!0,w||(k=action_destroyer(v=p[4].call(null,u,p[2].styles)),w=!0)},p(E,[H]){E[1]?S&&(S.d(1),S=null):S?S.p(E,H):(S=create_if_block$n(E),S.c(),S.m(u,f)),T&&T.p&&(!y||H&64)&&update_slot_base(T,M,E,E[6],y?get_slot_changes(M,E[6],H,null):get_all_dirty_from_scope(E[6]),null),v&&is_function(v.update)&&H&4&&v.update.call(null,E[2].styles)},i(E){y||(transition_in(T,E),y=!0)},o(E){transition_out(T,E),y=!1},d(E){E&&detach(u),S&&S.d(),T&&T.d(E),w=!1,k()}}}function instance$E(p,u,f){let m,{$$slots:v={},$$scope:y}=u;const{linkable:w,styleable:k}=getContext$1("sdk"),S=getContext$1("component");component_subscribe(p,S,E=>f(2,m=E));let{logoUrl:M}=u,{hideLogo:T}=u;return p.$$set=E=>{"logoUrl"in E&&f(0,M=E.logoUrl),"hideLogo"in E&&f(1,T=E.hideLogo),"$$scope"in E&&f(6,y=E.$$scope)},[M,T,m,w,k,S,y,v]}class Navigation extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$E,create_fragment$F,safe_not_equal,{logoUrl:0,hideLogo:1})}}const CardHorizontal_svelte_svelte_type_style_lang="";function create_if_block$m(p){let u,f;return{c(){u=element("img"),set_style(u,"--imageWidth",p[9]),set_style(u,"--imageHeight",p[10]),attr(u,"class","image svelte-140q71n"),src_url_equal(u.src,f=p[0])||attr(u,"src",f),attr(u,"alt","")},m(m,v){insert(m,u,v)},p(m,v){v&512&&set_style(u,"--imageWidth",m[9]),v&1024&&set_style(u,"--imageHeight",m[10]),v&1&&!src_url_equal(u.src,f=m[0])&&attr(u,"src",f)},d(m){m&&detach(u)}}}function create_fragment$E(p){let u,f,m,v,y,w,k,S,M,T,E,H,F,Z,$,J,se,ie,he,fe,pe=p[11]&&create_if_block$m(p);return{c(){u=element("div"),pe&&pe.c(),f=space(),m=element("div"),v=element("main"),y=element("h2"),w=text$1(p[1]),k=space(),S=element("p"),M=text$1(p[2]),T=space(),E=element("footer"),H=element("p"),F=text$1(p[3]),Z=space(),$=element("a"),J=text$1(p[4]),attr(y,"class","heading svelte-140q71n"),attr(S,"class","text svelte-140q71n"),attr(H,"class","subtext svelte-140q71n"),set_style($,"--linkColor",p[6]),set_style($,"--linkHoverColor",p[7]),attr($,"href",se=p[5]||"/"),attr($,"class","svelte-140q71n"),attr(E,"class","svelte-140q71n"),attr(m,"class","content svelte-140q71n"),attr(u,"class","container svelte-140q71n"),set_style(u,"--cardWidth",p[8])},m(ve,Ae){insert(ve,u,Ae),pe&&pe.m(u,null),append$2(u,f),append$2(u,m),append$2(m,v),append$2(v,y),append$2(y,w),append$2(v,k),append$2(v,S),append$2(S,M),append$2(m,T),append$2(m,E),append$2(E,H),append$2(H,F),append$2(E,Z),append$2(E,$),append$2($,J),he||(fe=[action_destroyer(p[14].call(null,$)),action_destroyer(ie=p[13].call(null,u,p[12].styles))],he=!0)},p(ve,[Ae]){ve[11]?pe?pe.p(ve,Ae):(pe=create_if_block$m(ve),pe.c(),pe.m(u,f)):pe&&(pe.d(1),pe=null),Ae&2&&set_data(w,ve[1]),Ae&4&&set_data(M,ve[2]),Ae&8&&set_data(F,ve[3]),Ae&16&&set_data(J,ve[4]),Ae&64&&set_style($,"--linkColor",ve[6]),Ae&128&&set_style($,"--linkHoverColor",ve[7]),Ae&32&&se!==(se=ve[5]||"/")&&attr($,"href",se),Ae&256&&set_style(u,"--cardWidth",ve[8]),ie&&is_function(ie.update)&&Ae&4096&&ie.update.call(null,ve[12].styles)},i:noop$2,o:noop$2,d(ve){ve&&detach(u),pe&&pe.d(),he=!1,run_all(fe)}}}function instance$D(p,u,f){let m,v;const{styleable:y,linkable:w}=getContext$1("sdk"),k=getContext$1("component");component_subscribe(p,k,fe=>f(12,v=fe));const S="";let{imageUrl:M=""}=u,{heading:T=""}=u,{description:E=""}=u,{subtext:H=""}=u,{linkText:F=""}=u,{linkUrl:Z}=u,{linkColor:$}=u,{linkHoverColor:J}=u,{cardWidth:se}=u,{imageWidth:ie}=u,{imageHeight:he}=u;return p.$$set=fe=>{"imageUrl"in fe&&f(0,M=fe.imageUrl),"heading"in fe&&f(1,T=fe.heading),"description"in fe&&f(2,E=fe.description),"subtext"in fe&&f(3,H=fe.subtext),"linkText"in fe&&f(4,F=fe.linkText),"linkUrl"in fe&&f(5,Z=fe.linkUrl),"linkColor"in fe&&f(6,$=fe.linkColor),"linkHoverColor"in fe&&f(7,J=fe.linkHoverColor),"cardWidth"in fe&&f(8,se=fe.cardWidth),"imageWidth"in fe&&f(9,ie=fe.imageWidth),"imageHeight"in fe&&f(10,he=fe.imageHeight)},p.$$.update=()=>{p.$$.dirty&1&&f(11,m=!!M)},[M,T,E,H,F,Z,$,J,se,ie,he,m,v,y,w,k,S]}class CardHorizontal extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$D,create_fragment$E,safe_not_equal,{className:16,imageUrl:0,heading:1,description:2,subtext:3,linkText:4,linkUrl:5,linkColor:6,linkHoverColor:7,cardWidth:8,imageWidth:9,imageHeight:10})}get className(){return this.$$.ctx[16]}}const StackedList_svelte_svelte_type_style_lang="";function create_if_block$l(p){let u,f,m;return{c(){u=element("div"),f=element("img"),attr(f,"class","image svelte-scr5w"),src_url_equal(f.src,m=p[0])||attr(f,"src",m),attr(f,"alt",""),attr(u,"class","image-block svelte-scr5w")},m(v,y){insert(v,u,y),append$2(u,f)},p(v,y){y&1&&!src_url_equal(f.src,m=v[0])&&attr(f,"src",m)},d(v){v&&detach(u)}}}function create_fragment$D(p){let u,f,m,v,y,w,k,S,M,T,E,H,F,Z=p[4]&&create_if_block$l(p);return{c(){u=element("div"),f=element("a"),m=element("div"),Z&&Z.c(),v=space(),y=element("div"),w=element("div"),k=text$1(p[1]),S=space(),M=element("div"),T=text$1(p[2]),attr(w,"class","heading svelte-scr5w"),attr(M,"class","subheading svelte-scr5w"),attr(y,"class","content svelte-scr5w"),attr(m,"class","stackedlist svelte-scr5w"),attr(f,"href",p[3]),attr(f,"class","svelte-scr5w"),attr(u,"class","container svelte-scr5w")},m($,J){insert($,u,J),append$2(u,f),append$2(f,m),Z&&Z.m(m,null),append$2(m,v),append$2(m,y),append$2(y,w),append$2(w,k),append$2(y,S),append$2(y,M),append$2(M,T),H||(F=[action_destroyer(p[7].call(null,f)),action_destroyer(E=p[6].call(null,u,p[5].styles))],H=!0)},p($,[J]){$[4]?Z?Z.p($,J):(Z=create_if_block$l($),Z.c(),Z.m(m,v)):Z&&(Z.d(1),Z=null),J&2&&set_data(k,$[1]),J&4&&set_data(T,$[2]),J&8&&attr(f,"href",$[3]),E&&is_function(E.update)&&J&32&&E.update.call(null,$[5].styles)},i:noop$2,o:noop$2,d($){$&&detach(u),Z&&Z.d(),H=!1,run_all(F)}}}function instance$C(p,u,f){let m,v;const{styleable:y,linkable:w}=getContext$1("sdk"),k=getContext$1("component");component_subscribe(p,k,H=>f(5,v=H));let{imageUrl:S=""}=u,{heading:M=""}=u,{subheading:T=""}=u,{destinationUrl:E="/"}=u;return p.$$set=H=>{"imageUrl"in H&&f(0,S=H.imageUrl),"heading"in H&&f(1,M=H.heading),"subheading"in H&&f(2,T=H.subheading),"destinationUrl"in H&&f(3,E=H.destinationUrl)},p.$$.update=()=>{p.$$.dirty&1&&f(4,m=!!S)},[S,M,T,E,m,v,y,w,k]}class StackedList extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$C,create_fragment$D,safe_not_equal,{imageUrl:0,heading:1,subheading:2,destinationUrl:3})}}const Card_svelte_svelte_type_style_lang="";function create_if_block$k(p){let u,f;return{c(){u=element("img"),set_style(u,"--imageHeight",p[7]),attr(u,"class","image svelte-9mr74r"),src_url_equal(u.src,f=p[0])||attr(u,"src",f),attr(u,"alt","")},m(m,v){insert(m,u,v)},p(m,v){v&128&&set_style(u,"--imageHeight",m[7]),v&1&&!src_url_equal(u.src,f=m[0])&&attr(u,"src",f)},d(m){m&&detach(u)}}}function create_fragment$C(p){let u,f,m,v,y,w,k,S,M,T,E,H,F,Z,$,J=p[8]&&create_if_block$k(p);return{c(){u=element("div"),J&&J.c(),f=space(),m=element("div"),v=element("h2"),y=text$1(p[1]),w=space(),k=element("h4"),S=text$1(p[2]),M=space(),T=element("a"),E=text$1(p[3]),attr(v,"class","heading svelte-9mr74r"),attr(k,"class","text svelte-9mr74r"),set_style(T,"--linkColor",p[5]),set_style(T,"--linkHoverColor",p[6]),attr(T,"href",H=p[4]||"/"),attr(T,"class","svelte-9mr74r"),attr(m,"class","content svelte-9mr74r"),attr(u,"class","container svelte-9mr74r")},m(se,ie){insert(se,u,ie),J&&J.m(u,null),append$2(u,f),append$2(u,m),append$2(m,v),append$2(v,y),append$2(m,w),append$2(m,k),append$2(k,S),append$2(m,M),append$2(m,T),append$2(T,E),Z||($=[action_destroyer(p[11].call(null,T)),action_destroyer(F=p[10].call(null,u,p[9]))],Z=!0)},p(se,[ie]){se[8]?J?J.p(se,ie):(J=create_if_block$k(se),J.c(),J.m(u,f)):J&&(J.d(1),J=null),ie&2&&set_data(y,se[1]),ie&4&&set_data(S,se[2]),ie&8&&set_data(E,se[3]),ie&32&&set_style(T,"--linkColor",se[5]),ie&64&&set_style(T,"--linkHoverColor",se[6]),ie&16&&H!==(H=se[4]||"/")&&attr(T,"href",H),F&&is_function(F.update)&&ie&512&&F.update.call(null,se[9])},i:noop$2,o:noop$2,d(se){se&&detach(u),J&&J.d(),Z=!1,run_all($)}}}function instance$B(p,u,f){let m,v,y;const{styleable:w,linkable:k}=getContext$1("sdk"),S=getContext$1("component");component_subscribe(p,S,he=>f(15,y=he));const M="";let{imageUrl:T=""}=u,{heading:E=""}=u,{description:H=""}=u,{linkText:F=""}=u,{linkUrl:Z}=u,{linkColor:$}=u,{linkHoverColor:J}=u,{imageHeight:se}=u,{cardWidth:ie}=u;return p.$$set=he=>{"imageUrl"in he&&f(0,T=he.imageUrl),"heading"in he&&f(1,E=he.heading),"description"in he&&f(2,H=he.description),"linkText"in he&&f(3,F=he.linkText),"linkUrl"in he&&f(4,Z=he.linkUrl),"linkColor"in he&&f(5,$=he.linkColor),"linkHoverColor"in he&&f(6,J=he.linkHoverColor),"imageHeight"in he&&f(7,se=he.imageHeight),"cardWidth"in he&&f(14,ie=he.cardWidth)},p.$$.update=()=>{p.$$.dirty&49152&&f(9,m={...y.styles,normal:{...y.styles.normal,width:ie}}),p.$$.dirty&1&&f(8,v=!!T)},[T,E,H,F,Z,$,J,se,v,m,w,k,S,M,ie,y]}class Card extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$B,create_fragment$C,safe_not_equal,{className:13,imageUrl:0,heading:1,description:2,linkText:3,linkUrl:4,linkColor:5,linkHoverColor:6,imageHeight:7,cardWidth:14})}get className(){return this.$$.ctx[13]}}const AppComponents=Object.freeze(Object.defineProperty({__proto__:null,Placeholder,area:AreaChart,attachmentfield:AttachmentField,attachmentsinglefield:AttachmentSingleField,backgroundimage:BackgroundImage,bar:BarChart,bbreferencefield:BBReferenceField,bbreferencesinglefield:BBReferenceSingleField,bigintfield:BigIntField,booleanfield:BooleanField,button:Button,buttongroup:ButtonGroup,candlestick:CandleStickChart,card:Card,cardhorizontal:CardHorizontal,cardsblock:CardsBlock,cardstat:CardStat,chartblock:ChartBlock,codescanner:CodeScannerField,container:Container$8,dataprovider:DataProvider,daterangepicker:DateRangePicker,datetimefield:DateTimeField,divider:Divider,donut:DonutChart,dynamicfilter:DynamicFilter,embed:Embed,embeddedmap:EmbeddedMap,fieldgroup:FieldGroup,form:Form,formblock:FormBlock,formstep:FormStep,gridblock:GridBlock,heading:Heading,histogram:HistogramChart,icon:Icon,image:Image$1,jsonfield:JSONField,layout:Layout,line:LineChart,link:Link,longformfield:LongFormField,markdownviewer:MarkdownViewer_1,modal:Modal_1,multifieldselect:MultiFieldSelect,multistepformblock:MultiStepFormblock,navigation:Navigation,numberfield:NumberField,optionsfield:OptionsField,passwordfield:PasswordField,pie:PieChart,relationshipfield:RelationshipField,repeater:Repeater,repeaterblock:RepeaterBlock,rowexplorer:RowExplorer,s3upload:S3Upload,screenslot:ScreenSlot,section:Section,sidepanel:SidePanel,signaturesinglefield:SignatureField,spectrumcard:SpectrumCard,stackedlist:StackedList,stringfield:StringField,table:Table_1,tableblock:TableBlock,tag:Tag,text:Text$1},Symbol.toStringTag,{value:"Module"})),BudibasePrefix="@budibase/standard-components/",createComponentStore=()=>{const p=writable({customComponentManifest:{},customComponentMap:{},mountedComponents:{}}),u=derived([p,builderStore,devToolsStore,screenStore],([T,E,H,F])=>{var fe;const{inBuilder:Z,selectedComponentId:$}=E;if(!Z&&!H.visible)return{};const J=(fe=F.activeScreen)==null?void 0:fe.props,se=findComponentById(J,$),ie=w(se==null?void 0:se._component),he=findComponentPathById(J,$)||[];return{customComponentManifest:T.customComponentManifest,selectedComponentInstance:T.mountedComponents[$],selectedComponent:se,selectedComponentDefinition:ie,selectedComponentPath:he==null?void 0:he.map(pe=>pe._id),mountedComponentCount:Object.keys(T.mountedComponents).length,screenslotInstance:T.mountedComponents[ScreenslotID]}}),f=(T,E)=>{T&&p.update(H=>{const F=E.component;return F!=null&&F.startsWith("plugin")&&(H.customComponentMap[F]?H.customComponentMap[F].push(T):H.customComponentMap[F]=[T]),H.mountedComponents[T]=E,H})},m=T=>{T&&p.update(E=>{var Z,$;const H=($=(Z=E.mountedComponents[T])==null?void 0:Z.instance)==null?void 0:$.component;let F=E.customComponentMap;return H!=null&&H.startsWith("plugin")&&(F[H]=F[H].filter(J=>J!==T)),delete E.mountedComponents[T],E})},v=T=>get_store_value(p).mountedComponents[T]!=null,y=T=>{var H;const E=(H=get_store_value(screenStore).activeScreen)==null?void 0:H.props;return findComponentById(E,T)},w=T=>{var H,F;if(!T)return null;if(T===ScreenslotType&&(T=`${BudibasePrefix}${T}`),T.startsWith(BudibasePrefix))return T=T.replace(BudibasePrefix,""),T?Manifest[T]:null;const{customComponentManifest:E}=get_store_value(p);return(F=(H=E==null?void 0:E[T])==null?void 0:H.schema)==null?void 0:F.schema};return{...u,actions:{registerInstance:f,unregisterInstance:m,isComponentRegistered:v,getComponentById:y,getComponentDefinition:w,getComponentConstructor:T=>{var H;if(!T)return null;if(T===ScreenslotType)return Router_1;if(T.startsWith(BudibasePrefix)){const F=T.split("/"),Z=F[F.length-1];return AppComponents[Z]}const{customComponentManifest:E}=get_store_value(p);return(H=E==null?void 0:E[T])==null?void 0:H.Component},getComponentInstance:T=>derived(p,E=>E.mountedComponents[T]),registerCustomComponent:({Component:T,schema:E,version:H})=>{var $,J;if(!T||!(($=E==null?void 0:E.schema)!=null&&$.name)||!H)return;const F=`plugin/${E.schema.name}`;p.update(se=>(se.customComponentManifest[F]={Component:T,schema:E},se));const Z=get_store_value(p);(J=Z.customComponentMap[F])!=null&&J.length&&Z.customComponentMap[F].forEach(se=>{var ie;(ie=Z.mountedComponents[se])==null||ie.reload()})}}}},componentStore=createComponentStore(),createUploadStore=()=>{const p=writable([]),u=(v,y)=>{!v||!y||p.update(w=>(w.push({componentId:v,callback:y}),w))},f=v=>{p.update(y=>y.filter(w=>w.componentId!==v))},m=async v=>{if(!v)return;const y=get_store_value(p).find(w=>w.componentId===v);return await(y==null?void 0:y.callback())};return{subscribe:p.subscribe,actions:{registerFileUpload:u,unregisterFileUpload:f,processFileUpload:m}}},uploadStore=createUploadStore(),createRowSelectionStore=()=>{const p=writable({});function u(m,v,y){p.update(w=>(w[m]={tableId:v,selectedRows:y},w))}function f(m){const v=get_store_value(p),y=Object.keys(v).find(w=>w===m);return v[y]}return{subscribe:p.subscribe,set:p.set,actions:{updateSelection:u,getSelection:f}}},rowSelectionStore=createRowSelectionStore(),initialState={loaded:!1,cloud:!1},createEnvironmentStore=()=>{const p=writable(initialState),u={fetchEnvironment:async()=>{try{const f=await API.getEnvironment();p.set({...initialState,...f,loaded:!0})}catch{p.set(initialState)}}};return{subscribe:p.subscribe,actions:u}},environmentStore=createEnvironmentStore(),devToolsEnabled=derived([appStore,builderStore],([p,u])=>!u.inBuilder&&p.isDevApp),currentRole=derived([devToolsEnabled,devToolsStore,authStore],([p,u,f])=>p&&u.role||(f==null?void 0:f.roleId)||Roles.PUBLIC),dndComponentPath=derived([dndParent,screenStore],([p,u])=>{var v;const f=(v=u.activeScreen)==null?void 0:v.props,m=findComponentPathById(f,p)||[];return m==null?void 0:m.map(y=>y._id)}),snippets=derivedMemo([appStore,builderStore],([p,u])=>{var f;return(u==null?void 0:u.snippets)||((f=p==null?void 0:p.application)==null?void 0:f.snippets)||[]}),createRoleStore=()=>{const p=writable([]),u=async()=>{const f=await API.getAccessibleRoles();return p.set(f||[]),f};return{subscribe:p.subscribe,actions:{fetchAccessibleRoles:u}}},roleStore=createRoleStore();currentRole.subscribe(roleStore.actions.fetchAccessibleRoles);const createSidePanelStore=()=>{const u=writable({contentId:null,ignoreClicksOutside:!0}),f=derived(u,k=>({...k,open:k.contentId!=null}));let m;const v=k=>{clearTimeout(m),u.update(S=>(S.contentId=k,S))},y=()=>{m=setTimeout(()=>{u.update(k=>(k.contentId=null,k))},50)},w=k=>{u.update(S=>(S.ignoreClicksOutside=k,S))};return{subscribe:f.subscribe,actions:{open:v,close:y,setIgnoreClicksOutside:w}}},sidePanelStore=createSidePanelStore(),createModalStore=()=>{const u=writable({contentId:null}),f=v=>{u.update(y=>(y.contentId=v,y))},m=()=>{u.update(v=>(v.contentId=null,v))};return{subscribe:u.subscribe,actions:{open:f,close:m}}},modalStore=createModalStore(),createHoverStore=()=>{const p=writable({hoveredComponentId:null});let u;const f=(v,y=!0)=>{clearTimeout(u),v?m(v,y):u=setTimeout(()=>{m(v,y)},10)},m=(v,y=!0)=>{v!==get_store_value(p).hoveredComponentId&&(p.set({hoveredComponentId:v}),y&&eventStore.actions.dispatchEvent("hover-component",{id:v}))};return{...p,actions:{hoverComponent:f}}},hoverStore=createHoverStore(),createContextStore=p=>{const u=writable({});let f=[];const v=derived(p?[p,u]:[u],M=>M.reduce((T,E)=>({...T,...E}),{}));p&&p.actions.observeChanges(M=>{S(M)});const y=(M,T)=>{!M||T===void 0||(u.update(E=>(E[M]=T,E)),S(M))},w=(M,T,E)=>{if(!M||!T)return;const H=`${M}_${T}`;u.update(F=>(F[H]=E,F)),S(H)},k=M=>(f.push(M),()=>{f=f.filter(T=>T!==M)}),S=M=>{f.forEach(T=>T(M))};return{subscribe:v.subscribe,actions:{provideData:y,provideAction:w,observeChanges:k}}},createFeaturesStore=()=>derived([authStore,appStore],([p,u])=>{var w,k;const f=()=>{const S=p;if(S)return S.license},m=()=>{const S=u;if(S!=null&&S.licenseType)return S.licenseType},v=()=>{var M;let S=m();if(!S){const T=f();S=(M=T==null?void 0:T.plan)==null?void 0:M.type}return S?S===PlanType.FREE:!0},y=f();return{logoEnabled:v(),aiEnabled:((w=y==null?void 0:y.features)==null?void 0:w.includes(Feature.AI_CUSTOM_CONFIGS))||((k=y==null?void 0:y.features)==null?void 0:k.includes(Feature.BUDIBASE_AI))}}),featuresStore=createFeaturesStore(),contextActionHandler=async(p,u)=>{const f=getActionContextKey(p),m=u[f];if(m)return await m(p.parameters)},getActionContextKey=p=>{const u=p==null?void 0:p["##eventHandlerType"],f=(m,v)=>`${m}_${v}`;switch(u){case"Scroll To Field":return f(p.parameters.componentId,ActionTypes.ScrollTo);case"Update Field Value":return f(p.parameters.componentId,ActionTypes.UpdateFieldValue);case"Validate Form":return f(p.parameters.componentId,ActionTypes.ValidateForm);case"Refresh Data Provider":return f(p.parameters.componentId,ActionTypes.RefreshDatasource);case"Clear Form":return f(p.parameters.componentId,ActionTypes.ClearForm);case"Change Form Step":return f(p.parameters.componentId,ActionTypes.ChangeFormStep);case"Clear Row Selection":return f(p.parameters.componentId,ActionTypes.ClearRowSelection);default:return null}},getActionDependentContextKeys=p=>{var f;switch(p==null?void 0:p["##eventHandlerType"]){case"Save Row":case"Duplicate Row":if((f=p.parameters)!=null&&f.providerId)return[p.parameters.providerId]}return[]},saveRowHandler=async(p,u)=>{const{fields:f,providerId:m,tableId:v,notificationOverride:y}=p.parameters;let w;if(m?w={...u[m]}:w={},f)for(let[k,S]of Object.entries(f))deepSet(w,k,S);v&&(v.startsWith("view")?w._viewId=v:w.tableId=v);try{const k=await API.saveRow(w);return y||notificationStore.actions.success("Row saved"),await dataSourceStore.actions.invalidateDataSource(v,{invalidateRelationships:!0}),{row:k}}catch{return!1}},duplicateRowHandler=async(p,u)=>{const{fields:f,providerId:m,tableId:v,notificationOverride:y}=p.parameters;if(m){let w={...u[m]};if(f)for(let[k,S]of Object.entries(f))deepSet(w,k,S);v&&(v.startsWith("view")?w._viewId=v:w.tableId=v),delete w._id,delete w._rev;try{const k=await API.saveRow(w);return y||notificationStore.actions.success("Row saved"),await dataSourceStore.actions.invalidateDataSource(v,{invalidateRelationships:!0}),{row:k}}catch{return!1}}},fetchRowHandler=async p=>{const{tableId:u,rowId:f}=p.parameters;if(u&&f)try{return{row:await API.fetchRow(u,f)}}catch{return!1}},deleteRowHandler=async p=>{const{tableId:u,rowId:f,notificationOverride:m}=p.parameters;if(u&&f)try{let v,y=[];if(typeof f=="string")try{y=JSON.parse(f)}catch{y=f.split(",").map(S=>S.trim()).filter(S=>S)}else y=f;if(typeof y=="object"&&y.constructor===Object?v=[y]:Array.isArray(y)?v=y:Number.isInteger(y)&&(v=[String(y)]),!v&&!y)return notificationStore.actions.warning("No valid rows were supplied"),!1;const w=await API.deleteRows(u,v);m||notificationStore.actions.success((w==null?void 0:w.length)==1?"Row deleted":`${w.length} Rows deleted`),await dataSourceStore.actions.invalidateDataSource(u,{invalidateRelationships:!0})}catch(v){console.error(v),notificationStore.actions.error("An error occurred while executing the query")}},triggerAutomationHandler=async p=>{const{fields:u,notificationOverride:f,timeout:m}=p.parameters;try{const v=await API.triggerAutomation(p.parameters.automationId,u,m);if(v.value)return f||notificationStore.actions.success("Automation ran successfully"),{result:v};f||notificationStore.actions.success("Automation triggered")}catch{return!1}},navigationHandler=p=>{let{url:u,peek:f,externalNewTab:m,type:v}=p.parameters;v==="screen"&&u&&!u.startsWith("/")&&(u=`/${u}`),routeStore.actions.navigate(u,f,m),closeSidePanelHandler()},queryExecutionHandler=async p=>{const{queryId:u,queryParams:f,notificationOverride:m}=p.parameters;try{const v=await API.fetchQueryDefinition(u);if((v==null?void 0:v.datasourceId)==null)return notificationStore.actions.error("That query couldn't be found"),!1;const y=await API.executeQuery(u,{parameters:f});return v.readable||(m||notificationStore.actions.success("Query executed successfully"),await dataSourceStore.actions.invalidateDataSource(v.datasourceId)),{result:y}}catch{return notificationStore.actions.error("An error occurred while executing the query"),!1}},logoutHandler=async p=>{var m;await authStore.actions.logOut();let u="/builder/auth/login",f=!1;p.parameters.redirectUrl&&(f=(m=p.parameters.redirectUrl)==null?void 0:m.startsWith("/"),u=routeStore.actions.createFullURL(p.parameters.redirectUrl)),window.location.href=u,f&&window.location.reload()},closeScreenModalHandler=p=>{let u;p!=null&&p.parameters&&(u=p.parameters.url),window.parent.postMessage({type:"close-screen-modal",url:u})},updateStateHandler=p=>{var y;const{type:u,key:f,value:m,persist:v}=p.parameters;u==="set"?stateStore.actions.setValue(f,m,v):u==="delete"&&stateStore.actions.deleteValue(f),(y=get_store_value(routeStore).queryParams)!=null&&y.peek&&window.parent.postMessage({type:"update-state",detail:{type:u,key:f,value:m,persist:v}})},s3UploadHandler=async p=>{const{componentId:u}=p.parameters;if(!u)return;const f=await uploadStore.actions.processFileUpload(u);return{publicUrl:f==null?void 0:f.publicUrl}},exportDataHandler=async p=>{var S,M;let{tableComponentId:u,rows:f,type:m,columns:v,delimiter:y,customHeaders:w}=p.parameters,k;if(!(f!=null&&f.length)){const T=rowSelectionStore.actions.getSelection(u);(S=T==null?void 0:T.selectedRows)!=null&&S.length&&(f=T.selectedRows,k=T.tableId)}if(k||(k=(M=f==null?void 0:f[0])==null?void 0:M.tableId),!(f!=null&&f.length))notificationStore.actions.error("Please select at least one row");else if(!k)notificationStore.actions.error("You can only export data from table datasources");else try{typeof f[0]!="string"&&(f=f.map(E=>E._id));const T=await API.exportRows(k,m,{rows:f,columns:v==null?void 0:v.map(E=>E.name||E),delimiter:y,customHeaders:w});download(new Blob([T],{type:"text/plain"}),`${k}.${m}`)}catch{notificationStore.actions.error("There was an error exporting the data")}},continueIfHandler=p=>{const{type:u,value:f,operator:m,referenceValue:v}=p.parameters;if(!u||!m)return;let y=!1;return f==null&&v==null||f===v?y=!0:y=JSON.stringify(f)===JSON.stringify(v),u==="continue"?m==="equal"?y:!y:m==="equal"?!y:y},showNotificationHandler=p=>{var y,w;const{message:u,type:f,autoDismiss:m,duration:v}=p.parameters;!u||!f||(w=(y=notificationStore.actions)[f])==null||w.call(y,u,m,v)},promptUserHandler=()=>{},openSidePanelHandler=p=>{const{id:u}=p.parameters;u&&sidePanelStore.actions.open(u)},closeSidePanelHandler=()=>{sidePanelStore.actions.close()},openModalHandler=p=>{const{id:u}=p.parameters;u&&modalStore.actions.open(u)},closeModalHandler=()=>{modalStore.actions.close()},downloadFileHandler=async p=>{const{url:u,fileName:f}=p.parameters;try{const{type:m}=p.parameters;if(m==="attachment"){const{tableId:k,rowId:S,attachmentColumn:M}=p.parameters,T=await API.downloadAttachment(k,S,M);await downloadStream(T);return}const v=await fetch(u);if(!v.ok){notificationStore.actions.error(`Failed to download from '${u}'. Server returned status code: ${v.status}`);return}const y=URL.createObjectURL(await v.blob()),w=document.createElement("a");w.href=y,w.download=f,w.click(),URL.revokeObjectURL(y)}catch(m){console.error(m),m.status?notificationStore.actions.error(`Failed to download from '${u}'. Server returned status code: ${m.status}`):notificationStore.actions.error(`Failed to download from '${u}'.`)}},rowActionHandler=async p=>{const{resourceId:u,rowId:f,rowActionId:m}=p.parameters;await API.rowActions.trigger(u,m,f),await dataSourceStore.actions.invalidateDataSource(u,{invalidateRelationships:!0})},handlerMap={"Fetch Row":fetchRowHandler,"Save Row":saveRowHandler,"Duplicate Row":duplicateRowHandler,"Delete Row":deleteRowHandler,"Navigate To":navigationHandler,"Execute Query":queryExecutionHandler,"Trigger Automation":triggerAutomationHandler,"Log Out":logoutHandler,"Close Screen Modal":closeScreenModalHandler,"Update State":updateStateHandler,"Upload File to S3":s3UploadHandler,"Export Data":exportDataHandler,"Continue if / Stop if":continueIfHandler,"Show Notification":showNotificationHandler,"Prompt User":promptUserHandler,"Open Side Panel":openSidePanelHandler,"Close Side Panel":closeSidePanelHandler,"Open Modal":openModalHandler,"Close Modal":closeModalHandler,"Download File":downloadFileHandler,"Row Action":rowActionHandler},confirmTextMap={"Delete Row":"Are you sure you want to delete this row?","Save Row":"Are you sure you want to save this row?","Execute Query":"Are you sure you want to execute this query?","Trigger Automation":"Are you sure you want to trigger this automation?","Prompt User":"Are you sure you want to continue?","Duplicate Row":"Are you sure you want to duplicate this row?"},enrichButtonActions=(p,u)=>{if(!(p!=null&&p.length)||get_store_value(builderStore).inBuilder)return null;if(typeof p=="function")return p;const f=p.map(m=>handlerMap[m["##eventHandlerType"]]||contextActionHandler);return async m=>{var y;let v=u.actions||[];for(let w=0;w<f.length;w++)try{if(!f[w])continue;const k={...u,state:get_store_value(stateStore),actions:v,eventContext:m};let S=p[w];S=enrichDataBindings(S,k);const M=async()=>f[w](S,k);if((y=S.parameters)!=null&&y.confirm)return new Promise(T=>{var se,ie,he,fe;const E=confirmTextMap[S["##eventHandlerType"]],H=((se=S.parameters)==null?void 0:se.confirmText)||E,F=S["##eventHandlerType"],Z=((ie=S.parameters)==null?void 0:ie.customTitleText)||F,$=((he=S.parameters)==null?void 0:he.cancelButtonText)||"Cancel",J=((fe=S.parameters)==null?void 0:fe.confirmButtonText)||"Confirm";confirmationStore.actions.showConfirmation(Z,H,async()=>{const pe=await M();if(pe!==!1){v.push(pe);const ve={...u,actions:v},Ae=enrichButtonActions(p.slice(w+1),ve);T(typeof Ae=="function"?await Ae(m):!0)}else T(!1)},()=>{T(!1)},J,$)});{const T=await M();if(T===!1)return;v.push(T)}}catch(k){console.error("Error while executing button handler"),console.error(k);return}}},propsAreSame=(p,u)=>p===u?!0:typeof p=="function"||typeof u=="function"?!1:JSON.stringify(p)===JSON.stringify(u),enrichProps=(p,u,f)=>{var k;let m={...p},v={};Object.keys(m).forEach(S=>{var M;((M=f==null?void 0:f[S])==null?void 0:M.type)==="event"&&(v[S]=m[S],delete m[S])});let y=m._conditions,w=enrichDataBindings(m,u);return Object.keys(v).forEach(S=>{w[S]=enrichButtonActions(v[S],u)}),(k=w._conditions)!=null&&k.length&&w._conditions.forEach((S,M)=>{var T;((T=f==null?void 0:f[S.setting])==null?void 0:T.type)==="event"&&(S.settingValue=enrichButtonActions(y[M].settingValue,u),S.rand=Math.random())}),w},getActiveConditions=p=>p!=null&&p.length?p.filter(u=>{u.valueType==="number"?(u.referenceValue=parseFloat(u.referenceValue),u.newValue=parseFloat(u.newValue)):u.valueType==="datetime"?(u.referenceValue&&(u.referenceValue=new Date(u.referenceValue).toISOString()),u.newValue&&(u.newValue=new Date(u.newValue).toISOString())):u.valueType==="boolean"&&(u.referenceValue=`${u.referenceValue}`.toLowerCase()==="true",u.newValue=`${u.newValue}`.toLowerCase()==="true");const f={...u,type:u.valueType,field:"newValue",value:u.referenceValue};let m=buildQuery$1([f]);return m.onEmptyFilter=EmptyFilterOption.RETURN_NONE,runQuery$1([f],m).length>0}):[],reduceConditionActions=p=>{let u={},f=null;return p==null||p.forEach(m=>{m.action==="show"?f=!0:m.action==="hide"?f=!1:m.setting&&(u[m.setting]=m.settingValue)}),{settingUpdates:u,visible:f}},EmptyPlaceholder_svelte_svelte_type_style_lang="";function create_if_block$j(p){var v;let u,f=(p[0].name||((v=p[1])==null?void 0:v.name)||"Component")+"",m;return{c(){u=element("div"),m=text$1(f),attr(u,"class","component-placeholder svelte-1uv9ndz")},m(y,w){insert(y,u,w),append$2(u,m)},p(y,w){var k;w&3&&f!==(f=(y[0].name||((k=y[1])==null?void 0:k.name)||"Component")+"")&&set_data(m,f)},d(y){y&&detach(u)}}}function create_fragment$B(p){let u,f=p[2].inBuilder&&create_if_block$j(p);return{c(){f&&f.c(),u=empty$1()},m(m,v){f&&f.m(m,v),insert(m,u,v)},p(m,[v]){m[2].inBuilder?f?f.p(m,v):(f=create_if_block$j(m),f.c(),f.m(u.parentNode,u)):f&&(f.d(1),f=null)},i:noop$2,o:noop$2,d(m){m&&detach(u),f&&f.d(m)}}}function instance$A(p,u,f){let m,v,y;const w=getContext$1("component");component_subscribe(p,w,M=>f(0,v=M));const{builderStore:k,componentStore:S}=getContext$1("sdk");return component_subscribe(p,k,M=>f(2,y=M)),p.$$.update=()=>{p.$$.dirty&1&&f(1,m=S.actions.getComponentDefinition(v.type))},[v,m,y,w,k]}class EmptyPlaceholder extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$A,create_fragment$B,safe_not_equal,{})}}const ScreenPlaceholder_svelte_svelte_type_style_lang="";function create_if_block$i(p){let u,f,m,v,y,w,k;return f=new Heading$1({props:{size:"L",$$slots:{default:[create_default_slot_2$7]},$$scope:{ctx:p}}}),v=new Body({props:{$$slots:{default:[create_default_slot_1$9]},$$scope:{ctx:p}}}),w=new Button$1({props:{cta:!0,icon:"Add",$$slots:{default:[create_default_slot$k]},$$scope:{ctx:p}}}),w.$on("click",p[1].actions.requestAddComponent),{c(){u=element("div"),create_component(f.$$.fragment),m=space(),create_component(v.$$.fragment),y=space(),create_component(w.$$.fragment),attr(u,"class","placeholder svelte-1bc7j1u")},m(S,M){insert(S,u,M),mount_component(f,u,null),append$2(u,m),mount_component(v,u,null),append$2(u,y),mount_component(w,u,null),k=!0},p(S,M){const T={};M&4&&(T.$$scope={dirty:M,ctx:S}),f.$set(T);const E={};M&4&&(E.$$scope={dirty:M,ctx:S}),v.$set(E);const H={};M&4&&(H.$$scope={dirty:M,ctx:S}),w.$set(H)},i(S){k||(transition_in(f.$$.fragment,S),transition_in(v.$$.fragment,S),transition_in(w.$$.fragment,S),k=!0)},o(S){transition_out(f.$$.fragment,S),transition_out(v.$$.fragment,S),transition_out(w.$$.fragment,S),k=!1},d(S){S&&detach(u),destroy_component(f),destroy_component(v),destroy_component(w)}}}function create_default_slot_2$7(p){let u;return{c(){u=text$1("Your screen is empty")},m(f,m){insert(f,u,m)},d(f){f&&detach(u)}}}function create_default_slot_1$9(p){let u;return{c(){u=text$1("Bring your app to life by adding some components!")},m(f,m){insert(f,u,m)},d(f){f&&detach(u)}}}function create_default_slot$k(p){let u;return{c(){u=text$1("Add component")},m(f,m){insert(f,u,m)},d(f){f&&detach(u)}}}function create_fragment$A(p){let u,f,m=p[0].inBuilder&&create_if_block$i(p);return{c(){m&&m.c(),u=empty$1()},m(v,y){m&&m.m(v,y),insert(v,u,y),f=!0},p(v,[y]){v[0].inBuilder?m?(m.p(v,y),y&1&&transition_in(m,1)):(m=create_if_block$i(v),m.c(),transition_in(m,1),m.m(u.parentNode,u)):m&&(group_outros(),transition_out(m,1,1,()=>{m=null}),check_outros())},i(v){f||(transition_in(m),f=!0)},o(v){transition_out(m),f=!1},d(v){v&&detach(u),m&&m.d(v)}}}function instance$z(p,u,f){let m;const{builderStore:v}=getContext$1("sdk");return component_subscribe(p,v,y=>f(0,m=y)),[m,v]}class ScreenPlaceholder extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$z,create_fragment$A,safe_not_equal,{})}}function create_if_block$h(p){let u;function f(y,w){if(y[0].errorType==="setting")return create_if_block_1$8;if(y[0].errorType==="ancestor-setting")return create_if_block_2$6}let m=f(p),v=m&&m(p);return{c(){v&&v.c(),u=empty$1()},m(y,w){v&&v.m(y,w),insert(y,u,w)},p(y,w){m===(m=f(y))&&v?v.p(y,w):(v&&v.d(1),v=m&&m(y),v&&(v.c(),v.m(u.parentNode,u)))},d(y){y&&detach(u),v&&v.d(y)}}}function create_if_block_2$6(p){let u,f,m,v,y=p[0].ancestor.name+"",w,k,S;return{c(){u=element("span"),u.textContent="-",f=space(),m=element("span"),v=text$1("Add "),w=text$1(y),attr(m,"class","spectrum-Link")},m(M,T){insert(M,u,T),insert(M,f,T),insert(M,m,T),append$2(m,v),append$2(m,w),k||(S=listen(m,"click",p[5]),k=!0)},p(M,T){T&1&&y!==(y=M[0].ancestor.name+"")&&set_data(w,y)},d(M){M&&(detach(u),detach(f),detach(m)),k=!1,S()}}}function create_if_block_1$8(p){let u,f,m,v,y;return{c(){u=element("span"),u.textContent="-",f=space(),m=element("span"),m.textContent="Show me",attr(m,"class","spectrum-Link")},m(w,k){insert(w,u,k),insert(w,f,k),insert(w,m,k),v||(y=listen(m,"click",p[4]),v=!0)},p:noop$2,d(w){w&&(detach(u),detach(f),detach(m)),v=!1,y()}}}function create_fragment$z(p){let u,f=p[0]&&create_if_block$h(p);return{c(){f&&f.c(),u=empty$1()},m(m,v){f&&f.m(m,v),insert(m,u,v)},p(m,[v]){m[0]?f?f.p(m,v):(f=create_if_block$h(m),f.c(),f.m(u.parentNode,u)):f&&(f.d(1),f=null)},i:noop$2,o:noop$2,d(m){m&&detach(u),f&&f.d(m)}}}function instance$y(p,u,f){let m,{error:v}=u;const y=getContext$1("component");component_subscribe(p,y,M=>f(1,m=M));const{builderStore:w}=getContext$1("sdk"),k=()=>{w.actions.highlightSetting(v.key)},S=()=>{w.actions.addParentComponent(m.id,v.ancestor.fullType)};return p.$$set=M=>{"error"in M&&f(0,v=M.error)},[v,m,y,w,k,S]}class ComponentErrorStateCTA extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$y,create_fragment$z,safe_not_equal,{error:0})}}const ComponentErrorState_svelte_svelte_type_style_lang="";function create_if_block$g(p){let u,f,m=p[0].errorState&&create_if_block_1$7(p);return{c(){m&&m.c(),u=empty$1()},m(v,y){m&&m.m(v,y),insert(v,u,y),f=!0},p(v,y){v[0].errorState?m?(m.p(v,y),y&1&&transition_in(m,1)):(m=create_if_block_1$7(v),m.c(),transition_in(m,1),m.m(u.parentNode,u)):m&&(group_outros(),transition_out(m,1,1,()=>{m=null}),check_outros())},i(v){f||(transition_in(m),f=!0)},o(v){transition_out(m),f=!1},d(v){v&&detach(u),m&&m.d(v)}}}function create_if_block_1$7(p){let u,f,m,v,y,w,k;f=new Icon$1({props:{name:"Alert",color:"var(--spectrum-global-color-static-red-600)"}});let S=p[1]&&create_if_block_2$5(p);return{c(){u=element("div"),create_component(f.$$.fragment),m=space(),S&&S.c(),attr(u,"class","component-placeholder svelte-129t83p")},m(M,T){insert(M,u,T),mount_component(f,u,null),append$2(u,m),S&&S.m(u,null),y=!0,w||(k=action_destroyer(v=p[5].call(null,u,p[2])),w=!0)},p(M,T){M[1]?S?(S.p(M,T),T&2&&transition_in(S,1)):(S=create_if_block_2$5(M),S.c(),transition_in(S,1),S.m(u,null)):S&&(group_outros(),transition_out(S,1,1,()=>{S=null}),check_outros()),v&&is_function(v.update)&&T&4&&v.update.call(null,M[2])},i(M){y||(transition_in(f.$$.fragment,M),transition_in(S),y=!0)},o(M){transition_out(f.$$.fragment,M),transition_out(S),y=!1},d(M){M&&detach(u),destroy_component(f),S&&S.d(),w=!1,k()}}}function create_if_block_2$5(p){let u,f=p[1].message+"",m,v,y;return v=new ComponentErrorStateCTA({props:{error:p[1]}}),{c(){u=new HtmlTag(!1),m=space(),create_component(v.$$.fragment),u.a=m},m(w,k){u.m(f,w,k),insert(w,m,k),mount_component(v,w,k),y=!0},p(w,k){(!y||k&2)&&f!==(f=w[1].message+"")&&u.p(f);const S={};k&2&&(S.error=w[1]),v.$set(S)},i(w){y||(transition_in(v.$$.fragment,w),y=!0)},o(w){transition_out(v.$$.fragment,w),y=!1},d(w){w&&(u.d(),detach(m)),destroy_component(v,w)}}}function create_fragment$y(p){let u,f,m=p[3].inBuilder&&create_if_block$g(p);return{c(){m&&m.c(),u=empty$1()},m(v,y){m&&m.m(v,y),insert(v,u,y),f=!0},p(v,[y]){v[3].inBuilder?m?(m.p(v,y),y&8&&transition_in(m,1)):(m=create_if_block$g(v),m.c(),transition_in(m,1),m.m(u.parentNode,u)):m&&(group_outros(),transition_out(m,1,1,()=>{m=null}),check_outros())},i(v){f||(transition_in(m),f=!0)},o(v){transition_out(m),f=!1},d(v){v&&detach(u),m&&m.d(v)}}}function instance$x(p,u,f){let m,v,y,w,{componentErrors:k}=u;const S=getContext$1("component");component_subscribe(p,S,E=>f(0,y=E));const{styleable:M,builderStore:T}=getContext$1("sdk");return component_subscribe(p,T,E=>f(3,w=E)),p.$$set=E=>{"componentErrors"in E&&f(7,k=E.componentErrors)},p.$$.update=()=>{p.$$.dirty&1&&f(2,m={...y.styles,normal:{},custom:null,empty:!0}),p.$$.dirty&128&&f(1,v=k==null?void 0:k[0])},[y,v,m,w,S,M,T,k]}class ComponentErrorState extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$x,create_fragment$y,safe_not_equal,{componentErrors:7})}}const buildStyleString=(p,u)=>{let f="";for(let m of Object.keys(p||{}))p[m]!=null&&(f+=`${m}:${p[m]};`);return f+(u||"")},styleable=(p,u={})=>{let f,m,v,y;const w=(S={})=>{p.classList.add(`${S.id}-dom`);let M={};S.empty&&(M.padding="var(--spacing-l)",M.overflow="hidden",S.selected?M.border="2px solid transparent":M.border="2px dashed var(--spectrum-global-color-gray-400)");const T=S.id,E=S.custom||"",{isBlock:H}=S,F={...M,...S.normal},Z={...F,...S.hover||{}};p.setAttribute("draggable",!!S.draggable);const $=J=>{p.style=J};f=()=>{$(buildStyleString(F,E))},m=()=>{$(buildStyleString(Z,E))},v=J=>(builderStore.actions.selectComponent(T),J.preventDefault(),J.stopPropagation(),!1),y=J=>{if(!H)return S.interactive&&S.editable&&builderStore.actions.setEditMode(!0),J.preventDefault(),J.stopPropagation(),!1},p.addEventListener("mouseover",m),p.addEventListener("mouseout",f),S.interactive&&!S.isRoot&&(p.addEventListener("click",v,!1),p.addEventListener("dblclick",y,!1)),f()},k=()=>{p.removeEventListener("mouseover",m),p.removeEventListener("mouseout",f),p.removeEventListener("click",v),p.removeEventListener("dblclick",y)};return w(u),{update:S=>{k(),w(S)},destroy:()=>{k()}}};var GridParams=(p=>(p.HAlign="h-align",p.VAlign="v-align",p.ColStart="col-start",p.ColEnd="col-end",p.RowStart="row-start",p.RowEnd="row-end",p))(GridParams||{}),Devices=(p=>(p.Desktop="desktop",p.Mobile="mobile",p))(Devices||{}),GridDragMode=(p=>(p.Resize="resize",p.Move="move",p))(GridDragMode||{});const getGridVar=(p,u)=>`--grid-${p}-${u}`,isGridEvent=p=>{var m,v,y,w,k,S;if(!(p.target instanceof HTMLElement))return!1;const u=(y=(v=(m=p.target).closest)==null?void 0:v.call(m,".component"))==null?void 0:y.parentNode,f=(w=u==null?void 0:u.closest(".component"))==null?void 0:w.childNodes[0];return((k=p.target.dataset)==null?void 0:k.indicator)==="true"||!!((S=f==null?void 0:f.classList)!=null&&S.contains("grid"))},gridLayout=(p,u)=>{let f;const m=y=>{var he,fe,pe,ve;const{id:w,styles:k,interactive:S,errored:M,definition:T,draggable:E,insideGrid:H,ignoresLayout:F}=y;if(!H)return;if(F){p.classList.add("ignores-layout");return}f=Ae=>{Ae.stopPropagation(),builderStore.actions.selectComponent(w)};let Z=k["--default-width"]??((he=T==null?void 0:T.size)==null?void 0:he.width)??200,$=k["--default-height"]??((fe=T==null?void 0:T.size)==null?void 0:fe.height)??200;M&&(Z=500,$=60),Z+=2*GridSpacing,$+=2*GridSpacing;const J={"--default-width":Z,"--default-height":$},se={"h-align":((pe=T==null?void 0:T.grid)==null?void 0:pe.hAlign)||"stretch","v-align":((ve=T==null?void 0:T.grid)==null?void 0:ve.vAlign)||"center","col-start":1,"col-end":"round(up, calc((var(--grid-spacing) * 2 + var(--default-width)) / var(--col-size) + 1))","row-start":1,"row-end":Math.max(2,Math.ceil($/GridRowHeight)+1)};for(let Ae of Object.values(GridParams)){let ze=getGridVar("desktop",Ae),Se=getGridVar("mobile",Ae);J[ze]=k[ze]??k[Se]??se[Ae],J[Se]=k[Se]??k[ze]??se[Ae]}M&&(J[getGridVar("desktop","h-align")]="stretch",J[getGridVar("mobile","h-align")]="stretch",J[getGridVar("desktop","v-align")]="stretch",J[getGridVar("mobile","v-align")]="stretch");const ie=(Ae,ze,Se)=>{const Le=`${J[getGridVar(ze,Se)]}`;p.dataset[Ae]!==Le&&(p.dataset[Ae]=Le)};ie("gridDesktopRowEnd","desktop","row-end"),ie("gridMobileRowEnd","mobile","row-end"),ie("gridDesktopHAlign","desktop","h-align"),ie("gridMobileHAlign","mobile","h-align"),ie("gridDesktopVAlign","desktop","v-align"),ie("gridMobileVAlign","mobile","v-align"),p.dataset.insideGrid!=="true"&&(p.dataset.insideGrid="true"),p.style=buildStyleString(J),S&&p.addEventListener("click",f,!1),p.setAttribute("draggable",(!!E).toString())},v=()=>{f&&(p.removeEventListener("click",f,!1),f=null)};return m(u),{update(y){v(),m(y)},destroy(){v()}}},Component_svelte_svelte_type_style_lang="";function get_each_context$8(p,u,f){const m=p.slice();return m[83]=u[f],m}function create_if_block$f(p){let u,f,m,v,y,w,k,S,M;const T=[create_if_block_1$6,create_else_block$3],E=[];function H(F,Z){return F[5]?0:1}return f=H(p),m=E[f]=T[f](p),{c(){u=element("div"),m.c(),attr(u,"class",v=null_to_empty(`component ${p[4]}`)+" svelte-1i2u21u"),attr(u,"data-id",p[4]),attr(u,"data-name",p[7]),attr(u,"data-icon",p[24]),attr(u,"data-parent",y=p[16].id),toggle_class(u,"draggable",p[10]),toggle_class(u,"droppable",p[23]),toggle_class(u,"empty",p[14]),toggle_class(u,"interactive",p[11]),toggle_class(u,"editing",p[6]),toggle_class(u,"pad",p[3]),toggle_class(u,"parent",p[13]),toggle_class(u,"block",p[2]),toggle_class(u,"error",p[5]),toggle_class(u,"root",p[1])},m(F,Z){insert(F,u,Z),E[f].m(u,null),k=!0,S||(M=action_destroyer(w=gridLayout.call(null,u,p[21])),S=!0)},p(F,Z){let $=f;f=H(F),f===$?E[f].p(F,Z):(group_outros(),transition_out(E[$],1,1,()=>{E[$]=null}),check_outros(),m=E[f],m?m.p(F,Z):(m=E[f]=T[f](F),m.c()),transition_in(m,1),m.m(u,null)),(!k||Z[0]&16&&v!==(v=null_to_empty(`component ${F[4]}`)+" svelte-1i2u21u"))&&attr(u,"class",v),(!k||Z[0]&16)&&attr(u,"data-id",F[4]),(!k||Z[0]&128)&&attr(u,"data-name",F[7]),(!k||Z[0]&16777216)&&attr(u,"data-icon",F[24]),(!k||Z[0]&65536&&y!==(y=F[16].id))&&attr(u,"data-parent",y),w&&is_function(w.update)&&Z[0]&2097152&&w.update.call(null,F[21]),(!k||Z[0]&1040)&&toggle_class(u,"draggable",F[10]),(!k||Z[0]&8388624)&&toggle_class(u,"droppable",F[23]),(!k||Z[0]&16400)&&toggle_class(u,"empty",F[14]),(!k||Z[0]&2064)&&toggle_class(u,"interactive",F[11]),(!k||Z[0]&80)&&toggle_class(u,"editing",F[6]),(!k||Z[0]&24)&&toggle_class(u,"pad",F[3]),(!k||Z[0]&8208)&&toggle_class(u,"parent",F[13]),(!k||Z[0]&20)&&toggle_class(u,"block",F[2]),(!k||Z[0]&48)&&toggle_class(u,"error",F[5]),(!k||Z[0]&18)&&toggle_class(u,"root",F[1])},i(F){k||(transition_in(m),k=!0)},o(F){transition_out(m),k=!1},d(F){F&&detach(u),E[f].d(),S=!1,M()}}}function create_else_block$3(p){let u,f,m;const v=[p[18]];var y=p[20];function w(k,S){let M={$$slots:{default:[create_default_slot$j]},$$scope:{ctx:k}};for(let T=0;T<v.length;T+=1)M=assign(M,v[T]);return S!==void 0&&S[0]&262144&&(M=assign(M,get_spread_update(v,[get_spread_object(k[18])]))),{props:M}}return y&&(u=construct_svelte_component(y,w(p)),p[57](u)),{c(){u&&create_component(u.$$.fragment),f=empty$1()},m(k,S){u&&mount_component(u,k,S),insert(k,f,S),m=!0},p(k,S){if(S[0]&1048576&&y!==(y=k[20])){if(u){group_outros();const M=u;transition_out(M.$$.fragment,1,0,()=>{destroy_component(M,1)}),check_outros()}y?(u=construct_svelte_component(y,w(k,S)),k[57](u),create_component(u.$$.fragment),transition_in(u.$$.fragment,1),mount_component(u,f.parentNode,f)):u=null}else if(y){const M=S[0]&262144?get_spread_update(v,[get_spread_object(k[18])]):{};S[0]&4615|S[1]&134217728&&(M.$$scope={dirty:S,ctx:k}),u.$set(M)}},i(k){m||(u&&transition_in(u.$$.fragment,k),m=!0)},o(k){u&&transition_out(u.$$.fragment,k),m=!1},d(k){k&&detach(f),p[57](null),u&&destroy_component(u,k)}}}function create_if_block_1$6(p){let u,f;return u=new ComponentErrorState({props:{componentErrors:p[15]}}),{c(){create_component(u.$$.fragment)},m(m,v){mount_component(u,m,v),f=!0},p(m,v){const y={};v[0]&32768&&(y.componentErrors=m[15]),u.$set(y)},i(m){f||(transition_in(u.$$.fragment,m),f=!0)},o(m){transition_out(u.$$.fragment,m),f=!1},d(m){destroy_component(u,m)}}}function create_if_block_5$2(p){let u;const f=p[56].default,m=create_slot(f,p,p[58],null);return{c(){m&&m.c()},m(v,y){m&&m.m(v,y),u=!0},p(v,y){m&&m.p&&(!u||y[1]&134217728)&&update_slot_base(m,f,v,v[58],u?get_slot_changes(f,v[58],y,null):get_all_dirty_from_scope(v[58]),null)},i(v){u||(transition_in(m,v),u=!0)},o(v){transition_out(m,v),u=!1},d(v){m&&m.d(v)}}}function create_if_block_3$3(p){let u,f,m,v;const y=[create_if_block_4$2,create_else_block_1$1],w=[];function k(S,M){return S[1]?0:1}return u=k(p),f=w[u]=y[u](p),{c(){f.c(),m=empty$1()},m(S,M){w[u].m(S,M),insert(S,m,M),v=!0},p(S,M){let T=u;u=k(S),u!==T&&(group_outros(),transition_out(w[T],1,1,()=>{w[T]=null}),check_outros(),f=w[u],f||(f=w[u]=y[u](S),f.c()),transition_in(f,1),f.m(m.parentNode,m))},i(S){v||(transition_in(f),v=!0)},o(S){transition_out(f),v=!1},d(S){S&&detach(m),w[u].d(S)}}}function create_if_block_2$4(p){let u=[],f=new Map,m,v,y=ensure_array_like(p[12]);const w=k=>k[83]._id;for(let k=0;k<y.length;k+=1){let S=get_each_context$8(p,y,k),M=w(S);f.set(M,u[k]=create_each_block$8(M,S))}return{c(){for(let k=0;k<u.length;k+=1)u[k].c();m=empty$1()},m(k,S){for(let M=0;M<u.length;M+=1)u[M]&&u[M].m(k,S);insert(k,m,S),v=!0},p(k,S){S[0]&4097&&(y=ensure_array_like(k[12]),group_outros(),u=update_keyed_each(u,S,w,1,k,y,f,m.parentNode,outro_and_destroy_block,create_each_block$8,m,get_each_context$8),check_outros())},i(k){if(!v){for(let S=0;S<y.length;S+=1)transition_in(u[S]);v=!0}},o(k){for(let S=0;S<u.length;S+=1)transition_out(u[S]);v=!1},d(k){k&&detach(m);for(let S=0;S<u.length;S+=1)u[S].d(k)}}}function create_else_block_1$1(p){let u,f;return u=new EmptyPlaceholder({}),{c(){create_component(u.$$.fragment)},m(m,v){mount_component(u,m,v),f=!0},i(m){f||(transition_in(u.$$.fragment,m),f=!0)},o(m){transition_out(u.$$.fragment,m),f=!1},d(m){destroy_component(u,m)}}}function create_if_block_4$2(p){let u,f;return u=new ScreenPlaceholder({}),{c(){create_component(u.$$.fragment)},m(m,v){mount_component(u,m,v),f=!0},i(m){f||(transition_in(u.$$.fragment,m),f=!0)},o(m){transition_out(u.$$.fragment,m),f=!1},d(m){destroy_component(u,m)}}}function create_each_block$8(p,u){let f,m,v;return m=new Component({props:{instance:u[83],parent:u[0]}}),{key:p,first:null,c(){f=empty$1(),create_component(m.$$.fragment),this.first=f},m(y,w){insert(y,f,w),mount_component(m,y,w),v=!0},p(y,w){u=y;const k={};w[0]&4096&&(k.instance=u[83]),w[0]&1&&(k.parent=u[0]),m.$set(k)},i(y){v||(transition_in(m.$$.fragment,y),v=!0)},o(y){transition_out(m.$$.fragment,y),v=!1},d(y){y&&detach(f),destroy_component(m,y)}}}function create_default_slot$j(p){let u,f,m,v;const y=[create_if_block_2$4,create_if_block_3$3,create_if_block_5$2],w=[];function k(S,M){return S[12].length?0:S[9]?1:S[2]?2:-1}return~(u=k(p))&&(f=w[u]=y[u](p)),{c(){f&&f.c(),m=empty$1()},m(S,M){~u&&w[u].m(S,M),insert(S,m,M),v=!0},p(S,M){let T=u;u=k(S),u===T?~u&&w[u].p(S,M):(f&&(group_outros(),transition_out(w[T],1,1,()=>{w[T]=null}),check_outros()),~u?(f=w[u],f?f.p(S,M):(f=w[u]=y[u](S),f.c()),transition_in(f,1),f.m(m.parentNode,m)):f=null)},i(S){v||(transition_in(f),v=!0)},o(S){transition_out(f),v=!1},d(S){S&&detach(m),~u&&w[u].d(S)}}}function create_fragment$x(p){let u,f,m=p[20]&&p[18]&&(p[19]||p[8])&&!p[22]&&create_if_block$f(p);return{c(){m&&m.c(),u=empty$1()},m(v,y){m&&m.m(v,y),insert(v,u,y),f=!0},p(v,y){v[20]&&v[18]&&(v[19]||v[8])&&!v[22]?m?(m.p(v,y),y[0]&6029568&&transition_in(m,1)):(m=create_if_block$f(v),m.c(),transition_in(m,1),m.m(u.parentNode,u)):m&&(group_outros(),transition_out(m,1,1,()=>{m=null}),check_outros())},i(v){f||(transition_in(m),f=!0)},o(v){transition_out(m),f=!1},d(v){v&&detach(u),m&&m.d(v)}}}let SettingsDefinitionCache={},SettingsDefinitionMapCache={},InstanceSettingsCache={};function instance_1$2(p,u,f){let m,v,y,w,k,S,M,T,E,H,F,Z,$,J,se,ie,he,fe,pe,ve,Ae,ze,Se,Le,Ce,Ue,Ze,Ge,be,De,Ke,He,rt,ft,Mt,$e,je,Ct;component_subscribe(p,appStore,Gn=>f(67,Ke=Gn)),component_subscribe(p,dndIsDragging,Gn=>f(51,ft=Gn)),component_subscribe(p,builderStore,Gn=>f(52,Mt=Gn)),component_subscribe(p,devToolsStore,Gn=>f(53,$e=Gn)),component_subscribe(p,dndComponentPath,Gn=>f(54,je=Gn)),component_subscribe(p,componentStore,Gn=>f(55,Ct=Gn));let{$$slots:yt={},$$scope:ot}=u,{instance:Rt={}}=u,{parent:Xe=null}=u,{isLayout:Gt=!1}=u,{isRoot:Jt=!1}=u,{isBlock:Ht=!1}=u;const Pt=getContext$1("context");component_subscribe(p,Pt,Gn=>f(50,He=Gn));const Et=!!getContext$1("screenslot"),cn=getContext$1("component");component_subscribe(p,cn,Gn=>f(16,rt=Gn));const Sn=writable({});setContext("component",Sn);let $t,xn,sn,mt,Mn,Dt,Wt,nn,Ot,gt,Xt=!0,Tt,Zt,Ut,hn,yn,Vn="",Bn={},An;const Yn=Gn=>{var Pi;return((Pi=Gn==null?void 0:Gn._component)==null?void 0:Pi.endsWith("/container"))&&(Gn==null?void 0:Gn.layout)==="grid"};let Pn=!1;const ri=(Gn,Pi=!1)=>{if(Gn==null)return;const rr=JSON.stringify(Gn),Ui=hashString(rr);if(Ui===gt&&!Pi)return;gt=Ui,f(35,yn=null);const ki=Gn._component;if(f(20,Tt=componentStore.actions.getComponentConstructor(ki)),f(34,Zt=componentStore.actions.getComponentDefinition(ki)),!Zt)return;const ti=`${Zt.name}${(Zt==null?void 0:Zt.deprecated)===!0?"_deprecated":""}`;SettingsDefinitionCache[ti]?(Ut=SettingsDefinitionCache[ti],hn=SettingsDefinitionMapCache[ti]):(Ut=getSettingsDefinition(Zt),hn=Fi(Ut),SettingsDefinitionCache[ti]=Ut,SettingsDefinitionMapCache[ti]=hn);let Ki;InstanceSettingsCache[Ui]?Ki=InstanceSettingsCache[Ui]:(Ki=Dn(Gn,Ut),InstanceSettingsCache[Ui]=Ki),f(29,mt=Ki.staticSettings),sn=Ki.dynamicSettings;const ai=JSON.stringify({...Gn,_children:null}),va=findHBSBlocks(ai).map(ms=>{let ca=ms.replace(/\\"/g,'"');return isJSBinding(ca)?decodeJSBinding(ca):ca});Bn=Ji(Gn,Ut),Vn=va.join(" "),si(Gn,Ut),ur(get_store_value(Pt),hn),An||(An=Pt.actions.observeChanges(ir))},Ji=(Gn,Pi)=>{let rr={};return Pi.forEach(Ui=>{var ki;Ui.type==="event"&&((ki=Gn[Ui.key])==null||ki.forEach(ti=>{var ai;const Ki=getActionContextKey(ti);Ki&&(rr[Ki]=!0),(ai=getActionDependentContextKeys(ti))==null||ai.forEach(va=>{rr[va]=!0})}))}),rr},si=(Gn,Pi)=>{Pi.forEach(rr=>{if(rr.type==="table"){const Ui=Gn[rr.key];Ui&&(Ui.type||(Ui.type="table"),Ui.resourceId||(Ui.type==="viewV2"?Ui.resourceId=Ui.id:Ui.resourceId=Ui.tableId))}})},Fi=Gn=>{let Pi={};return Gn==null||Gn.forEach(rr=>{Pi[rr.key]=rr}),Pi},Dn=(Gn,Pi)=>{var ti;let rr={};Object.entries(Gn).filter(([Ki])=>!Ki.startsWith("_")).forEach(([Ki,ai])=>{rr[Ki]=ai});let Ui={...rr},ki={...rr};return ki._conditions=Gn._conditions,ki._css=(ti=Gn._styles)==null?void 0:ti.custom,Pi==null||Pi.forEach(Ki=>{if(Ki.nested)delete ki[Ki.key];else{const ai=rr[Ki.key];ai==null?delete ki[Ki.key]:typeof ai=="string"&&ai.includes("{{")||Ki.type==="event"||typeof ai=="object"&&JSON.stringify(ai).includes("{{")?delete Ui[Ki.key]:delete ki[Ki.key]}}),{staticSettings:Ui,dynamicSettings:ki}},Ci=()=>{if(!(Mn!=null&&Mn._conditions)){f(33,nn=[]);return}f(33,nn=Mn._conditions.map(Gn=>{var rr,Ui;const Pi=(rr=Rt._conditions)==null?void 0:rr.find(ki=>ki.id===Gn.id);return(Ui=hn[Gn.setting])!=null&&Ui.nested&&Pi?{...Gn,settingValue:Pi.settingValue}:Gn}))},ur=(Gn,Pi)=>{Ot=Date.now();const rr=Ot,Ui=enrichProps(sn,Gn,Pi);rr===Ot&&(f(30,Mn=Ui),Ci())},Qa=Gn=>{if(!(Gn!=null&&Gn.length))return;let Pi=!Gn.find(ki=>ki.action==="show");const rr=getActiveConditions(Gn),Ui=reduceConditionActions(rr);Ui.visible!=null&&(Pi=Ui.visible),f(31,Dt=Ui.settingUpdates),f(19,Xt=Pi)},yr=(Gn,Pi,rr)=>{const Ui={...Gn,...Pi,...rr};if(!Wt)f(32,Wt={...Ui}),f(18,xn=Wt);else{const ki=new Set(Object.keys(Ui));Object.keys(Wt).forEach(ti=>ki.add(ti)),ki.forEach(ti=>{if(!propsAreSame(Ui[ti],Wt[ti])){if(f(32,Wt[ti]=Ui[ti],Wt),ti.startsWith("_"))return;$t!=null&&$t.$$set?$t.$$set({[ti]:Ui[ti]}):f(18,xn[ti]=Ui[ti],xn)}})}},ba=async()=>{const Gn=Ge?v:`${v}-dom`,Pi=document.getElementsByClassName(Gn)[0];Pi&&(get_store_value(dndIsDragging)||Ge&&Pi.classList.contains("dragging")||Pi.scrollIntoView({behavior:"instant",block:"nearest",inline:"start"}))},ir=Gn=>{let Pi=Bn[Gn];if(Pi==null){const rr=Gn==="snippets"?Gn:`[${Gn}]`;Pi=Vn.indexOf(rr)!==-1,Bn[Gn]=Pi}Pi&&ur(He,hn)},wo=()=>{var rr;const Gn=get_store_value(Pt),Pi=(rr=$t==null?void 0:$t.getAdditionalDataContext)==null?void 0:rr.call($t);return{...Gn,...Pi}};onMount(()=>(Ke.isDevApp&&(componentStore.actions.isComponentRegistered(v)||componentStore.actions.registerInstance(v,{component:Rt._component,getSettings:()=>Wt,getRawSettings:()=>({...mt,...sn}),getDataContext:wo,reload:()=>ri(Rt,!0),setEphemeralStyles:Gn=>f(35,yn=Gn),state:Sn})),()=>{componentStore.actions.isComponentRegistered(v)&&componentStore.actions.unregisterInstance(v),An==null||An()}));function za(Gn){binding_callbacks[Gn?"unshift":"push"](()=>{$t=Gn,f(17,$t)})}return p.$$set=Gn=>{"instance"in Gn&&f(0,Rt=Gn.instance),"parent"in Gn&&f(27,Xe=Gn.parent),"isLayout"in Gn&&f(28,Gt=Gn.isLayout),"isRoot"in Gn&&f(1,Jt=Gn.isRoot),"isBlock"in Gn&&f(2,Ht=Gn.isBlock),"$$scope"in Gn&&f(58,ot=Gn.$$scope)},p.$$.update=()=>{var Gn,Pi,rr,Ui,ki;p.$$.dirty[0]&1&&ri(Rt),p.$$.dirty[0]&1&&f(12,m=Rt._children||[]),p.$$.dirty[0]&1&&f(4,v=Rt._id),p.$$.dirty[0]&3&&f(7,y=Jt?"Screen":Rt._instanceName),p.$$.dirty[0]&1|p.$$.dirty[1]&8&&f(24,w=Rt._icon||(Zt==null?void 0:Zt.icon)),p.$$.dirty[0]&16|p.$$.dirty[1]&2097152&&f(38,k=Mt.inBuilder&&Mt.selectedComponentId===v),p.$$.dirty[0]&16|p.$$.dirty[1]&16777216&&f(8,S=(Gn=Ct.selectedComponentPath)==null?void 0:Gn.includes(v)),p.$$.dirty[0]&256|p.$$.dirty[1]&2097152&&f(47,M=S&&Mt.editMode),p.$$.dirty[0]&16|p.$$.dirty[1]&8388608&&f(42,T=je==null?void 0:je.includes(v)),p.$$.dirty[0]&1&&f(15,E=(Pi=Rt==null?void 0:Rt._meta)==null?void 0:Pi.errors),p.$$.dirty[1]&8&&f(13,H=!!(Zt!=null&&Zt.hasChildren)),p.$$.dirty[1]&8&&f(45,F=(Zt==null?void 0:Zt.showEmptyState)!==!1),p.$$.dirty[0]&32768&&f(46,Z=!!(E!=null&&E.find(ti=>ti.errorType==="setting"))),p.$$.dirty[1]&32776&&f(39,$=!!(Zt!=null&&Zt.editable)&&!Z),p.$$.dirty[0]&32768&&f(5,J=(E==null?void 0:E.length)>0),p.$$.dirty[0]&5|p.$$.dirty[1]&2097152&&f(49,se=Mt.inBuilder&&Et&&!Ht&&!Rt.static),p.$$.dirty[0]&4|p.$$.dirty[1]&4194304&&f(48,ie=$e.allowSelection&&!Ht),p.$$.dirty[1]&393216&&f(11,he=se||ie),p.$$.dirty[1]&2097536&&f(6,fe=$&&k&&Mt.editMode),p.$$.dirty[0]&268437510|p.$$.dirty[1]&65544&&f(10,pe=!M&&he&&!Gt&&!Jt&&!Ht&&(Zt==null?void 0:Zt.draggable)!==!1),p.$$.dirty[0]&2048&&f(23,ve=he),p.$$.dirty[0]&16|p.$$.dirty[1]&2097152&&f(22,Ae=Mt.inBuilder&&((rr=Mt.hiddenComponentIds)==null?void 0:rr.includes(v))),p.$$.dirty[0]&14340|p.$$.dirty[1]&32768&&f(14,ze=!Ht&&(he&&!m.length&&H||Z)),p.$$.dirty[0]&16384|p.$$.dirty[1]&16384&&f(9,Se=ze&&F),p.$$.dirty[1]&4&&Qa(nn),p.$$.dirty[0]&1610612736|p.$$.dirty[1]&1&&yr(mt,Mn,Dt),p.$$.dirty[1]&2&&f(40,Le=Wt==null?void 0:Wt._css),p.$$.dirty[1]&128&&k&&ba(),p.$$.dirty[1]&524288&&f(44,Ce=(Ui=He==null?void 0:He.device)==null?void 0:Ui.theme),p.$$.dirty[1]&8192&&f(37,Ue=!(Ce!=null&&Ce.includes("light"))),p.$$.dirty[0]&1|p.$$.dirty[1]&16&&f(41,Ze={...(ki=Rt._styles)==null?void 0:ki.normal,...yn}),p.$$.dirty[0]&134217728&&f(36,Ge=Yn(Xe)),p.$$.dirty[0]&1&&f(43,be=Yn(Rt)),p.$$.dirty[0]&3120|p.$$.dirty[1]&1064&&f(21,De={insideGrid:Ge,ignoresLayout:(Zt==null?void 0:Zt.ignoresLayout)===!0,id:v,interactive:he,styles:Ze,draggable:pe,definition:Zt,errored:J}),p.$$.dirty[0]&10248|p.$$.dirty[1]&6144&&f(3,Pn=Pn||!be&&he&&H&&T),p.$$.dirty[1]&1048576&&f(3,Pn=!1),p.$$.dirty[0]&73719|p.$$.dirty[1]&1984&&Sn.set({id:v,children:m.length,styles:{...Rt._styles,normal:Ze,custom:Le,id:v,empty:Se,selected:k,interactive:he,isRoot:Jt,draggable:pe,editable:$,isBlock:Ht},empty:Se,selected:k,isRoot:Jt,inSelectedPath:S,name:y,editing:fe,type:Rt._component,errorState:J,parent:v,path:[...(rt==null?void 0:rt.path)??[],v],darkMode:Ue})},[Rt,Jt,Ht,Pn,v,J,fe,y,S,Se,pe,he,m,H,ze,E,rt,$t,xn,Xt,Tt,De,Ae,ve,w,Pt,cn,Xe,Gt,mt,Mn,Dt,Wt,nn,Zt,yn,Ge,Ue,k,$,Le,Ze,T,be,Ce,F,Z,M,ie,se,He,ft,Mt,$e,je,Ct,yt,za,ot]}class Component extends SvelteComponent{constructor(u){super(),init$1(this,u,instance_1$2,create_fragment$x,safe_not_equal,{instance:0,parent:27,isLayout:28,isRoot:1,isBlock:2},null,[-1,-1,-1])}}const linkable=(p,u)=>{if(get_store_value(builderStore).inBuilder){p.onclick=f=>{f.preventDefault()};return}link$1(p,u)},getAction=(p,u)=>{var m;if(!p||!u)return null;const f=getContext$1("context");return f?(m=get_store_value(f))==null?void 0:m[`${p}_${u}`]:null},getDatasourceFetchInstance=p=>{const u=DataFetchMap[p==null?void 0:p.type];return u?new u({API,datasource:p,query:null}):null},fetchDatasourceSchema=async(p,u={enrichRelationships:!1,formSchema:!1})=>{var y;const f=getDatasourceFetchInstance(p),m=await(f==null?void 0:f.getDefinition());if(!f||!m)return null;let v;if((p==null?void 0:p.type)!=="query"||!(u!=null&&u.formSchema))v=f.getSchema(m);else if("parameters"in m&&((y=m.parameters)!=null&&y.length)){v={};for(const w of m.parameters)v[w.name]={...w,type:FieldType.STRING}}if(!v)return null;if(p.type==="viewV2")for(const w of Object.keys(v))v[w].visible||delete v[w];if(m&&"sql"in m&&m.sql&&(u!=null&&u.enrichRelationships)){const w=await getRelationshipSchemaAdditions(v);v={...v,...w}}return f.enrichSchema(v)},fetchDatasourceDefinition=async p=>{const u=getDatasourceFetchInstance(p);return await(u==null?void 0:u.getDefinition())},getRelationshipSchemaAdditions=async p=>{if(!p)return null;let u={};for(let f of Object.keys(p)){const m=p[f];if((m==null?void 0:m.type)==="link"){const v=await fetchDatasourceSchema({type:"table",tableId:m==null?void 0:m.tableId});if(!v)continue;Object.keys(v).forEach(y=>{u[`${f}.${y}`]={type:v[y].type,externalType:v[y].externalType}})}}return u},getAPIKey=async()=>{const{apiKey:p}=await API.fetchDeveloperInfo();return p},SDK={API,authStore,appStore,notificationStore,routeStore,rowSelectionStore,screenStore,builderStore,uploadStore,componentStore,environmentStore,sidePanelStore,modalStore,dndIsDragging,currentRole,confirmationStore,roleStore,stateStore,styleable,linkable,getAction,fetchDatasourceSchema,fetchDatasourceDefinition,fetchData,QueryUtils,ContextScopes,getAPIKey,enrichButtonActions,processStringSync,makePropSafe,createContextStore,generateGoldenSample,memo,derivedMemo,createValidatorFromConstraints,Provider,Block,BlockComponent,ActionTypes},NotificationDisplay_svelte_svelte_type_style_lang="";function get_each_context$7(p,u,f){const m=p.slice();return m[2]=u[f].type,m[3]=u[f].icon,m[4]=u[f].message,m[5]=u[f].id,m[6]=u[f].dismissable,m[7]=u[f].count,m}function create_if_block$e(p){let u=[],f=new Map,m,v,y=ensure_array_like(p[0]);const w=k=>k[5];for(let k=0;k<y.length;k+=1){let S=get_each_context$7(p,y,k),M=w(S);f.set(M,u[k]=create_each_block$7(M,S))}return{c(){for(let k=0;k<u.length;k+=1)u[k].c();m=empty$1()},m(k,S){for(let M=0;M<u.length;M+=1)u[M]&&u[M].m(k,S);insert(k,m,S),v=!0},p(k,S){S&1&&(y=ensure_array_like(k[0]),group_outros(),u=update_keyed_each(u,S,w,1,k,y,f,m.parentNode,outro_and_destroy_block,create_each_block$7,m,get_each_context$7),check_outros())},i(k){if(!v){for(let S=0;S<y.length;S+=1)transition_in(u[S]);v=!0}},o(k){for(let S=0;S<u.length;S+=1)transition_out(u[S]);v=!1},d(k){k&&detach(m);for(let S=0;S<u.length;S+=1)u[S].d(k)}}}function create_each_block$7(p,u){let f,m,v,y,w,k;function S(){return u[1](u[5])}return m=new Notification({props:{type:u[2],message:u[7]>1?`(${u[7]}) ${u[4]}`:u[4],icon:u[3],dismissable:u[6]}}),m.$on("dismiss",S),{key:p,first:null,c(){f=element("div"),create_component(m.$$.fragment),v=space(),this.first=f},m(M,T){insert(M,f,T),mount_component(m,f,null),append$2(f,v),k=!0},p(M,T){u=M;const E={};T&1&&(E.type=u[2]),T&1&&(E.message=u[7]>1?`(${u[7]}) ${u[4]}`:u[4]),T&1&&(E.icon=u[3]),T&1&&(E.dismissable=u[6]),m.$set(E)},i(M){k||(transition_in(m.$$.fragment,M),M&&add_render_callback(()=>{k&&(w&&w.end(1),y=create_in_transition(f,fly,{duration:300,y:-20,delay:u[0].delay?300:0}),y.start())}),k=!0)},o(M){transition_out(m.$$.fragment,M),y&&y.invalidate(),M&&(w=create_out_transition(f,fly,{y:-20,duration:150})),k=!1},d(M){M&&detach(f),destroy_component(m),M&&w&&w.end()}}}function create_fragment$w(p){let u,f,m=p[0]&&create_if_block$e(p);return{c(){u=element("div"),m&&m.c(),attr(u,"class","notifications svelte-o2yltz")},m(v,y){insert(v,u,y),m&&m.m(u,null),f=!0},p(v,[y]){v[0]?m?(m.p(v,y),y&1&&transition_in(m,1)):(m=create_if_block$e(v),m.c(),transition_in(m,1),m.m(u,null)):m&&(group_outros(),transition_out(m,1,1,()=>{m=null}),check_outros())},i(v){f||(transition_in(m),f=!0)},o(v){transition_out(m),f=!1},d(v){v&&detach(u),m&&m.d()}}}function instance$w(p,u,f){let m;return component_subscribe(p,notificationStore,y=>f(0,m=y)),[m,y=>notificationStore.actions.dismiss(y)]}class NotificationDisplay extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$w,create_fragment$w,safe_not_equal,{})}}function create_if_block$d(p){let u,f;return u=new Modal({props:{fixed:!0,$$slots:{default:[create_default_slot$i]},$$scope:{ctx:p}}}),u.$on("cancel",confirmationStore.actions.cancel),{c(){create_component(u.$$.fragment)},m(m,v){mount_component(u,m,v),f=!0},p(m,v){const y={};v&3&&(y.$$scope={dirty:v,ctx:m}),u.$set(y)},i(m){f||(transition_in(u.$$.fragment,m),f=!0)},o(m){transition_out(u.$$.fragment,m),f=!1},d(m){destroy_component(u,m)}}}function create_default_slot_1$8(p){let u=p[0].text+"",f;return{c(){f=text$1(u)},m(m,v){insert(m,f,v)},p(m,v){v&1&&u!==(u=m[0].text+"")&&set_data(f,u)},d(m){m&&detach(f)}}}function create_default_slot$i(p){let u,f;return u=new ModalContent({props:{title:p[0].title,onConfirm:confirmationStore.actions.confirm,confirmText:p[0].confirmButtonText,cancelText:p[0].cancelButtonText,$$slots:{default:[create_default_slot_1$8]},$$scope:{ctx:p}}}),{c(){create_component(u.$$.fragment)},m(m,v){mount_component(u,m,v),f=!0},p(m,v){const y={};v&1&&(y.title=m[0].title),v&1&&(y.confirmText=m[0].confirmButtonText),v&1&&(y.cancelText=m[0].cancelButtonText),v&3&&(y.$$scope={dirty:v,ctx:m}),u.$set(y)},i(m){f||(transition_in(u.$$.fragment,m),f=!0)},o(m){transition_out(u.$$.fragment,m),f=!1},d(m){destroy_component(u,m)}}}function create_fragment$v(p){let u,f,m=p[0].showConfirmation&&create_if_block$d(p);return{c(){m&&m.c(),u=empty$1()},m(v,y){m&&m.m(v,y),insert(v,u,y),f=!0},p(v,[y]){v[0].showConfirmation?m?(m.p(v,y),y&1&&transition_in(m,1)):(m=create_if_block$d(v),m.c(),transition_in(m,1),m.m(u.parentNode,u)):m&&(group_outros(),transition_out(m,1,1,()=>{m=null}),check_outros())},i(v){f||(transition_in(m),f=!0)},o(v){transition_out(m),f=!1},d(v){v&&detach(u),m&&m.d(v)}}}function instance$v(p,u,f){let m;return component_subscribe(p,confirmationStore,v=>f(0,m=v)),[m]}class ConfirmationDisplay extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$v,create_fragment$v,safe_not_equal,{})}}const PeekScreenDisplay_svelte_svelte_type_style_lang="";function create_if_block$c(p){let u,f;return u=new Modal({props:{fixed:!0,$$slots:{outside:[create_outside_slot],default:[create_default_slot_2$6]},$$scope:{ctx:p}}}),u.$on("cancel",p[2]),{c(){create_component(u.$$.fragment)},m(m,v){mount_component(u,m,v),f=!0},p(m,v){const y={};v&4099&&(y.$$scope={dirty:v,ctx:m}),u.$set(y)},i(m){f||(transition_in(u.$$.fragment,m),f=!0)},o(m){transition_out(u.$$.fragment,m),f=!1},d(m){destroy_component(u,m)}}}function create_default_slot_3$5(p){let u,f;return{c(){u=element("iframe"),attr(u,"title","Peek"),src_url_equal(u.src,f=p[1].href)||attr(u,"src",f),attr(u,"class","svelte-fm1ndi")},m(m,v){insert(m,u,v),p[5](u)},p(m,v){v&2&&!src_url_equal(u.src,f=m[1].href)&&attr(u,"src",f)},d(m){m&&detach(u),p[5](null)}}}function create_default_slot_2$6(p){let u,f;return u=new ModalContent({props:{showCancelButton:!1,showConfirmButton:!1,size:"L",showDivider:!1,showCloseIcon:!1,$$slots:{default:[create_default_slot_3$5]},$$scope:{ctx:p}}}),{c(){create_component(u.$$.fragment)},m(m,v){mount_component(u,m,v),f=!0},p(m,v){const y={};v&4099&&(y.$$scope={dirty:v,ctx:m}),u.$set(y)},i(m){f||(transition_in(u.$$.fragment,m),f=!0)},o(m){transition_out(u.$$.fragment,m),f=!1},d(m){destroy_component(u,m)}}}function create_default_slot_1$7(p){let u;return{c(){u=text$1("Full screen")},m(f,m){insert(f,u,m)},d(f){f&&detach(u)}}}function create_default_slot$h(p){let u;return{c(){u=text$1("Close")},m(f,m){insert(f,u,m)},d(f){f&&detach(u)}}}function create_outside_slot(p){let u,f,m,v,y;return f=new ActionButton({props:{size:"S",quiet:!0,icon:"OpenIn",$$slots:{default:[create_default_slot_1$7]},$$scope:{ctx:p}}}),f.$on("click",p[3]),v=new ActionButton({props:{size:"S",quiet:!0,icon:"Close",$$slots:{default:[create_default_slot$h]},$$scope:{ctx:p}}}),v.$on("click",p[2]),{c(){u=element("div"),create_component(f.$$.fragment),m=space(),create_component(v.$$.fragment),attr(u,"class","actions spectrum--darkest svelte-fm1ndi"),attr(u,"slot","outside")},m(w,k){insert(w,u,k),mount_component(f,u,null),append$2(u,m),mount_component(v,u,null),y=!0},p(w,k){const S={};k&4096&&(S.$$scope={dirty:k,ctx:w}),f.$set(S);const M={};k&4096&&(M.$$scope={dirty:k,ctx:w}),v.$set(M)},i(w){y||(transition_in(f.$$.fragment,w),transition_in(v.$$.fragment,w),y=!0)},o(w){transition_out(f.$$.fragment,w),transition_out(v.$$.fragment,w),y=!1},d(w){w&&detach(u),destroy_component(f),destroy_component(v)}}}function create_fragment$u(p){let u,f,m=p[1].showPeek&&create_if_block$c(p);return{c(){m&&m.c(),u=empty$1()},m(v,y){m&&m.m(v,y),insert(v,u,y),f=!0},p(v,[y]){v[1].showPeek?m?(m.p(v,y),y&2&&transition_in(m,1)):(m=create_if_block$c(v),m.c(),transition_in(m,1),m.m(u.parentNode,u)):m&&(group_outros(),transition_out(m,1,1,()=>{m=null}),check_outros())},i(v){f||(transition_in(m),f=!0)},o(v){transition_out(m),f=!1},d(v){v&&detach(u),m&&m.d(v)}}}function instance$u(p,u,f){let m;component_subscribe(p,peekStore,$=>f(1,m=$));const v={NOTIFICATION:"notification",CLOSE_SCREEN_MODAL:"close-screen-modal",INVALIDATE_DATASOURCE:"invalidate-datasource",UPDATE_STATE:"update-state"};let y,w=!1;const k=$=>{const{dataSourceId:J,options:se}=$.detail;dataSourceStore.actions.invalidateDataSource(J,se)},S=$=>{const{message:J,type:se,icon:ie,autoDismiss:he}=$.detail;notificationStore.actions.send(J,se,ie,he)},M=$=>{const{type:J,key:se,value:ie,persist:he}=$.detail;J==="set"?stateStore.actions.setValue(se,ie,he):J==="delete"&&stateStore.actions.deleteValue(se)};function T($){var ie;const se={[v.NOTIFICATION]:()=>{S($.data)},[v.CLOSE_SCREEN_MODAL]:()=>{var he;peekStore.actions.hidePeek(),(he=$.data)!=null&&he.url&&routeStore.actions.navigate($.data.url)},[v.INVALIDATE_DATASOURCE]:()=>{k($.data)},[v.UPDATE_STATE]:()=>{M($.data)}}[$.data.type];se?se($):console.warn("Unknown event type",(ie=$==null?void 0:$.data)==null?void 0:ie.type)}const E=()=>{window.addEventListener("message",T)},H=()=>{peekStore.actions.hidePeek(),window.removeEventListener("message",T)},F=()=>{m.external?window.location=m.href:(routeStore.actions.navigate(m.url),H())};onDestroy(()=>{y&&H()});function Z($){binding_callbacks[$?"unshift":"push"](()=>{y=$,f(0,y)})}return p.$$.update=()=>{p.$$.dirty&17&&(y&&!w?(E(),f(4,w=!0)):y||f(4,w=!1))},[y,m,H,F,w,Z]}class PeekScreenDisplay extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$u,create_fragment$u,safe_not_equal,{})}}function create_default_slot$g(p){let u;const f=p[3].default,m=create_slot(f,p,p[4],null);return{c(){m&&m.c()},m(v,y){m&&m.m(v,y),u=!0},p(v,y){m&&m.p&&(!u||y&16)&&update_slot_base(m,f,v,v[4],u?get_slot_changes(f,v[4],y,null):get_all_dirty_from_scope(v[4]),null)},i(v){u||(transition_in(m,v),u=!0)},o(v){transition_out(m,v),u=!1},d(v){m&&m.d(v)}}}function create_fragment$t(p){let u,f;return u=new Provider({props:{key:"user",data:{...p[1],roleId:p[2]},actions:p[0],$$slots:{default:[create_default_slot$g]},$$scope:{ctx:p}}}),{c(){create_component(u.$$.fragment)},m(m,v){mount_component(u,m,v),f=!0},p(m,[v]){const y={};v&6&&(y.data={...m[1],roleId:m[2]}),v&1&&(y.actions=m[0]),v&16&&(y.$$scope={dirty:v,ctx:m}),u.$set(y)},i(m){f||(transition_in(u.$$.fragment,m),f=!0)},o(m){transition_out(u.$$.fragment,m),f=!1},d(m){destroy_component(u,m)}}}function instance$t(p,u,f){let m,v,y;component_subscribe(p,authStore,S=>f(1,v=S)),component_subscribe(p,currentRole,S=>f(2,y=S));let{$$slots:w={},$$scope:k}=u;return p.$$set=S=>{"$$scope"in S&&f(4,k=S.$$scope)},f(0,m=[{type:ActionTypes.RefreshDatasource,callback:()=>authStore.actions.fetchUser(),metadata:{dataSource:{type:"table",tableId:TableNames.USERS}}}]),[m,v,y,w,k]}class UserBindingsProvider extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$t,create_fragment$t,safe_not_equal,{})}}function create_default_slot$f(p){let u;const f=p[5].default,m=create_slot(f,p,p[6],null);return{c(){m&&m.c()},m(v,y){m&&m.m(v,y),u=!0},p(v,y){m&&m.p&&(!u||y&64)&&update_slot_base(m,f,v,v[6],u?get_slot_changes(f,v[6],y,null):get_all_dirty_from_scope(v[6]),null)},i(v){u||(transition_in(m,v),u=!0)},o(v){transition_out(m,v),u=!1},d(v){m&&m.d(v)}}}function create_fragment$s(p){let u,f;return u=new Provider({props:{key:"device",data:p[0],$$slots:{default:[create_default_slot$f]},$$scope:{ctx:p}}}),{c(){create_component(u.$$.fragment)},m(m,v){mount_component(u,m,v),f=!0},p(m,[v]){const y={};v&1&&(y.data=m[0]),v&64&&(y.$$scope={dirty:v,ctx:m}),u.$set(y)},i(m){f||(transition_in(u.$$.fragment,m),f=!0)},o(m){transition_out(u.$$.fragment,m),f=!1},d(m){destroy_component(u,m)}}}const tabletBreakpoint=720,desktopBreakpoint=1280;function instance$s(p,u,f){let m,v,y;component_subscribe(p,themeStore,E=>f(4,y=E));let{$$slots:w={},$$scope:k}=u,S=window.innerWidth,M=window.innerHeight;const T=new ResizeObserver(E=>{var H,F;E!=null&&E[0]&&(f(1,S=(H=E[0].contentRect)==null?void 0:H.width),f(2,M=(F=E[0].contentRect)==null?void 0:F.height))});return onMount(()=>{T.observe(document.getElementById("app-body"))}),onDestroy(()=>{T.unobserve(document.getElementById("app-body"))}),p.$$set=E=>{"$$scope"in E&&f(6,k=E.$$scope)},p.$$.update=()=>{p.$$.dirty&16&&f(3,m=y.theme),p.$$.dirty&14&&f(0,v={mobile:S&&S<tabletBreakpoint,tablet:S&&S>=tabletBreakpoint&&S<desktopBreakpoint,width:S,height:M,theme:m})},[v,S,M,m,y,w,k]}class DeviceBindingsProvider extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$s,create_fragment$s,safe_not_equal,{})}}function create_default_slot$e(p){let u;const f=p[1].default,m=create_slot(f,p,p[2],null);return{c(){m&&m.c()},m(v,y){m&&m.m(v,y),u=!0},p(v,y){m&&m.p&&(!u||y&4)&&update_slot_base(m,f,v,v[2],u?get_slot_changes(f,v[2],y,null):get_all_dirty_from_scope(v[2]),null)},i(v){u||(transition_in(m,v),u=!0)},o(v){transition_out(m,v),u=!1},d(v){m&&m.d(v)}}}function create_fragment$r(p){let u,f;return u=new Provider({props:{key:"state",data:p[0],$$slots:{default:[create_default_slot$e]},$$scope:{ctx:p}}}),{c(){create_component(u.$$.fragment)},m(m,v){mount_component(u,m,v),f=!0},p(m,[v]){const y={};v&1&&(y.data=m[0]),v&4&&(y.$$scope={dirty:v,ctx:m}),u.$set(y)},i(m){f||(transition_in(u.$$.fragment,m),f=!0)},o(m){transition_out(u.$$.fragment,m),f=!1},d(m){destroy_component(u,m)}}}function instance$r(p,u,f){let m;component_subscribe(p,stateStore,w=>f(0,m=w));let{$$slots:v={},$$scope:y}=u;return p.$$set=w=>{"$$scope"in w&&f(2,y=w.$$scope)},[m,v,y]}class StateBindingsProvider extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$r,create_fragment$r,safe_not_equal,{})}}function create_default_slot$d(p){let u;const f=p[1].default,m=create_slot(f,p,p[2],null);return{c(){m&&m.c()},m(v,y){m&&m.m(v,y),u=!0},p(v,y){m&&m.p&&(!u||y&4)&&update_slot_base(m,f,v,v[2],u?get_slot_changes(f,v[2],y,null):get_all_dirty_from_scope(v[2]),null)},i(v){u||(transition_in(m,v),u=!0)},o(v){transition_out(m,v),u=!1},d(v){m&&m.d(v)}}}function create_fragment$q(p){let u,f;return u=new Provider({props:{key:"url",data:p[0].testUrlParams,$$slots:{default:[create_default_slot$d]},$$scope:{ctx:p}}}),{c(){create_component(u.$$.fragment)},m(m,v){mount_component(u,m,v),f=!0},p(m,[v]){const y={};v&1&&(y.data=m[0].testUrlParams),v&4&&(y.$$scope={dirty:v,ctx:m}),u.$set(y)},i(m){f||(transition_in(u.$$.fragment,m),f=!0)},o(m){transition_out(u.$$.fragment,m),f=!1},d(m){destroy_component(u,m)}}}function instance$q(p,u,f){let m;component_subscribe(p,routeStore,w=>f(0,m=w));let{$$slots:v={},$$scope:y}=u;return p.$$set=w=>{"$$scope"in w&&f(2,y=w.$$scope)},[m,v,y]}class TestUrlBindingsProvider extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$q,create_fragment$q,safe_not_equal,{})}}function create_default_slot$c(p){let u;const f=p[1].default,m=create_slot(f,p,p[2],null);return{c(){m&&m.c()},m(v,y){m&&m.m(v,y),u=!0},p(v,y){m&&m.p&&(!u||y&4)&&update_slot_base(m,f,v,v[2],u?get_slot_changes(f,v[2],y,null):get_all_dirty_from_scope(v[2]),null)},i(v){u||(transition_in(m,v),u=!0)},o(v){transition_out(m,v),u=!1},d(v){m&&m.d(v)}}}function create_fragment$p(p){let u,f;return u=new Provider({props:{key:"rowSelection",data:p[0],$$slots:{default:[create_default_slot$c]},$$scope:{ctx:p}}}),{c(){create_component(u.$$.fragment)},m(m,v){mount_component(u,m,v),f=!0},p(m,[v]){const y={};v&1&&(y.data=m[0]),v&4&&(y.$$scope={dirty:v,ctx:m}),u.$set(y)},i(m){f||(transition_in(u.$$.fragment,m),f=!0)},o(m){transition_out(u.$$.fragment,m),f=!1},d(m){destroy_component(u,m)}}}function instance$p(p,u,f){let m;component_subscribe(p,rowSelectionStore,w=>f(0,m=w));let{$$slots:v={},$$scope:y}=u;return p.$$set=w=>{"$$scope"in w&&f(2,y=w.$$scope)},[m,v,y]}class RowSelectionProvider extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$p,create_fragment$p,safe_not_equal,{})}}function create_default_slot$b(p){let u;const f=p[1].default,m=create_slot(f,p,p[2],null);return{c(){m&&m.c()},m(v,y){m&&m.m(v,y),u=!0},p(v,y){m&&m.p&&(!u||y&4)&&update_slot_base(m,f,v,v[2],u?get_slot_changes(f,v[2],y,null):get_all_dirty_from_scope(v[2]),null)},i(v){u||(transition_in(m,v),u=!0)},o(v){transition_out(m,v),u=!1},d(v){m&&m.d(v)}}}function create_fragment$o(p){let u,f;return u=new Provider({props:{key:"query",data:p[0].queryParams,$$slots:{default:[create_default_slot$b]},$$scope:{ctx:p}}}),{c(){create_component(u.$$.fragment)},m(m,v){mount_component(u,m,v),f=!0},p(m,[v]){const y={};v&1&&(y.data=m[0].queryParams),v&4&&(y.$$scope={dirty:v,ctx:m}),u.$set(y)},i(m){f||(transition_in(u.$$.fragment,m),f=!0)},o(m){transition_out(u.$$.fragment,m),f=!1},d(m){destroy_component(u,m)}}}function instance$o(p,u,f){let m;component_subscribe(p,routeStore,w=>f(0,m=w));let{$$slots:v={},$$scope:y}=u;return p.$$set=w=>{"$$scope"in w&&f(2,y=w.$$scope)},[m,v,y]}class QueryParamsProvider extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$o,create_fragment$o,safe_not_equal,{})}}const SettingsButton_svelte_svelte_type_style_lang="";function create_fragment$n(p){let u,f,m,v,y;return f=new Icon$1({props:{name:p[3],size:"S"}}),{c(){u=element("div"),create_component(f.$$.fragment),attr(u,"title",p[4]),attr(u,"class","svelte-1glfigx"),toggle_class(u,"active",p[0]),toggle_class(u,"disabled",p[6])},m(w,k){insert(w,u,k),mount_component(f,u,null),m=!0,v||(y=listen(u,"click",p[10]),v=!0)},p(w,[k]){const S={};k&8&&(S.name=w[3]),f.$set(S),(!m||k&16)&&attr(u,"title",w[4]),(!m||k&1)&&toggle_class(u,"active",w[0]),(!m||k&64)&&toggle_class(u,"disabled",w[6])},i(w){m||(transition_in(f.$$.fragment,w),m=!0)},o(w){transition_out(f.$$.fragment,w),m=!1},d(w){w&&detach(u),destroy_component(f),v=!1,y()}}}function instance$n(p,u,f){let m,{prop:v}=u,{value:y}=u,{icon:w}=u,{title:k}=u,{bool:S=!1}=u,{active:M=!1}=u,{component:T}=u,{disabled:E=!1}=u;const H=createEventDispatcher(),F=()=>{if(v){const Z=S?!m:y;builderStore.actions.updateProp(v,Z)}H("click")};return p.$$set=Z=>{"prop"in Z&&f(1,v=Z.prop),"value"in Z&&f(2,y=Z.value),"icon"in Z&&f(3,w=Z.icon),"title"in Z&&f(4,k=Z.title),"bool"in Z&&f(5,S=Z.bool),"active"in Z&&f(0,M=Z.active),"component"in Z&&f(9,T=Z.component),"disabled"in Z&&f(6,E=Z.disabled)},p.$$.update=()=>{p.$$.dirty&514&&f(7,m=T==null?void 0:T[v]),p.$$.dirty&166&&f(0,M=v&&(S?!!m:m===y))},[M,v,y,w,k,S,E,m,H,T,F]}class SettingsButton extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$n,create_fragment$n,safe_not_equal,{prop:1,value:2,icon:3,title:4,bool:5,active:0,component:9,disabled:6})}}const GridStylesButton_svelte_svelte_type_style_lang="";function create_fragment$m(p){let u,f,m,v,y;return f=new Icon$1({props:{name:p[2],size:"S"}}),{c(){u=element("div"),create_component(f.$$.fragment),attr(u,"title",p[3]),attr(u,"class","svelte-1leo12z"),toggle_class(u,"active",p[5])},m(w,k){insert(w,u,k),mount_component(f,u,null),m=!0,v||(y=listen(u,"click",p[6]),v=!0)},p(w,[k]){const S={};k&4&&(S.name=w[2]),f.$set(S),(!m||k&8)&&attr(u,"title",w[3]),(!m||k&32)&&toggle_class(u,"active",w[5])},i(w){m||(transition_in(f.$$.fragment,w),m=!0)},o(w){transition_out(f.$$.fragment,w),m=!1},d(w){w&&detach(u),destroy_component(f),v=!1,y()}}}function instance$m(p,u,f){let{style:m}=u,{value:v}=u,{icon:y}=u,{title:w}=u,{componentId:k}=u,{active:S}=u;const M=()=>{builderStore.actions.updateStyles({[m]:v},k)};return p.$$set=T=>{"style"in T&&f(0,m=T.style),"value"in T&&f(1,v=T.value),"icon"in T&&f(2,y=T.icon),"title"in T&&f(3,w=T.title),"componentId"in T&&f(4,k=T.componentId),"active"in T&&f(5,S=T.active)},[m,v,y,w,k,S,M]}class GridStylesButton extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$m,create_fragment$m,safe_not_equal,{style:0,value:1,icon:2,title:3,componentId:4,active:5})}}const SettingsColorPicker_svelte_svelte_type_style_lang="";function create_fragment$l(p){let u,f,m;return f=new ColorPicker({props:{size:"S",value:p[1]?null:p[2]}}),f.$on("change",p[4]),{c(){u=element("div"),create_component(f.$$.fragment),attr(u,"class","svelte-2tavi5"),toggle_class(u,"disabled",p[1])},m(v,y){insert(v,u,y),mount_component(f,u,null),m=!0},p(v,[y]){const w={};y&6&&(w.value=v[1]?null:v[2]),f.$set(w),(!m||y&2)&&toggle_class(u,"disabled",v[1])},i(v){m||(transition_in(f.$$.fragment,v),m=!0)},o(v){transition_out(f.$$.fragment,v),m=!1},d(v){v&&detach(u),destroy_component(f)}}}function instance$l(p,u,f){let m,{prop:v}=u,{component:y}=u,{disabled:w=!1}=u;const k=S=>{v&&builderStore.actions.updateProp(v,S.detail)};return p.$$set=S=>{"prop"in S&&f(0,v=S.prop),"component"in S&&f(3,y=S.component),"disabled"in S&&f(1,w=S.disabled)},p.$$.update=()=>{p.$$.dirty&9&&f(2,m=y==null?void 0:y[v])},[v,w,m,y,k]}class SettingsColorPicker extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$l,create_fragment$l,safe_not_equal,{prop:0,component:3,disabled:1})}}const SettingsPicker_svelte_svelte_type_style_lang="";function create_fragment$k(p){let u,f,m;return f=new Select_1({props:{quiet:!0,autoWidth:!0,placeholder:p[2],options:p[1],disabled:p[3],value:p[4]}}),f.$on("change",p[6]),{c(){u=element("div"),create_component(f.$$.fragment),attr(u,"class","svelte-y2na4k")},m(v,y){insert(v,u,y),mount_component(f,u,null),m=!0},p(v,[y]){const w={};y&4&&(w.placeholder=v[2]),y&2&&(w.options=v[1]),y&8&&(w.disabled=v[3]),y&16&&(w.value=v[4]),f.$set(w)},i(v){m||(transition_in(f.$$.fragment,v),m=!0)},o(v){transition_out(f.$$.fragment,v),m=!1},d(v){v&&detach(u),destroy_component(f)}}}function instance$k(p,u,f){let m,{prop:v}=u,{options:y}=u,{label:w}=u,{component:k}=u,{disabled:S=!1}=u;const M=T=>{v&&builderStore.actions.updateProp(v,T.detail)};return p.$$set=T=>{"prop"in T&&f(0,v=T.prop),"options"in T&&f(1,y=T.options),"label"in T&&f(2,w=T.label),"component"in T&&f(5,k=T.component),"disabled"in T&&f(3,S=T.disabled)},p.$$.update=()=>{p.$$.dirty&33&&f(4,m=k==null?void 0:k[v])},[v,y,w,S,m,k,M]}class SettingsPicker extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$k,create_fragment$k,safe_not_equal,{prop:0,options:1,label:2,component:5,disabled:3})}}const SettingsBar_svelte_svelte_type_style_lang="";function get_each_context$6(p,u,f){const m=p.slice();return m[38]=u[f],m[40]=f,m}function get_each_context_1(p,u,f){const m=p.slice();return m[41]=u[f],m}function create_if_block$b(p){let u,f,m,v,y=p[12]&&create_if_block_7$1(p),w=ensure_array_like(p[14]),k=[];for(let T=0;T<w.length;T+=1)k[T]=create_each_block$6(get_each_context$6(p,w,T));const S=T=>transition_out(k[T],1,1,()=>{k[T]=null});let M=!p[13]&&create_if_block_1$5(p);return{c(){u=element("div"),y&&y.c(),f=space();for(let T=0;T<k.length;T+=1)k[T].c();m=space(),M&&M.c(),attr(u,"class","bar svelte-zwufuk"),set_style(u,"top",p[3]+"px"),set_style(u,"left",p[4]+"px"),toggle_class(u,"visible",p[6])},m(T,E){insert(T,u,E),y&&y.m(u,null),append$2(u,f);for(let H=0;H<k.length;H+=1)k[H]&&k[H].m(u,null);append$2(u,m),M&&M.m(u,null),p[29](u),v=!0},p(T,E){if(T[12]?y?(y.p(T,E),E[0]&4096&&transition_in(y,1)):(y=create_if_block_7$1(T),y.c(),transition_in(y,1),y.m(u,f)):y&&(group_outros(),transition_out(y,1,1,()=>{y=null}),check_outros()),E[0]&24578){w=ensure_array_like(T[14]);let H;for(H=0;H<w.length;H+=1){const F=get_each_context$6(T,w,H);k[H]?(k[H].p(F,E),transition_in(k[H],1)):(k[H]=create_each_block$6(F),k[H].c(),transition_in(k[H],1),k[H].m(u,m))}for(group_outros(),H=w.length;H<k.length;H+=1)S(H);check_outros()}T[13]?M&&(group_outros(),transition_out(M,1,1,()=>{M=null}),check_outros()):M?(M.p(T,E),E[0]&8192&&transition_in(M,1)):(M=create_if_block_1$5(T),M.c(),transition_in(M,1),M.m(u,null)),(!v||E[0]&8)&&set_style(u,"top",T[3]+"px"),(!v||E[0]&16)&&set_style(u,"left",T[4]+"px"),(!v||E[0]&64)&&toggle_class(u,"visible",T[6])},i(T){if(!v){transition_in(y);for(let E=0;E<w.length;E+=1)transition_in(k[E]);transition_in(M),v=!0}},o(T){transition_out(y),k=k.filter(Boolean);for(let E=0;E<k.length;E+=1)transition_out(k[E]);transition_out(M),v=!1},d(T){T&&detach(u),y&&y.d(),destroy_each(k,T),M&&M.d(),p[29](null)}}}function create_if_block_7$1(p){let u,f,m,v,y,w,k,S,M,T,E,H,F,Z,$,J,se,ie,he,fe;return u=new GridStylesButton({props:{style:p[11],value:"start",icon:"AlignLeft",title:"Align left",active:p[7]==="start",componentId:p[0]}}),m=new GridStylesButton({props:{style:p[11],value:"center",icon:"AlignCenter",title:"Align center",active:p[7]==="center",componentId:p[0]}}),y=new GridStylesButton({props:{style:p[11],value:"end",icon:"AlignRight",title:"Align right",active:p[7]==="end",componentId:p[0]}}),k=new GridStylesButton({props:{style:p[11],value:"stretch",icon:"MoveLeftRight",title:"Stretch horizontally",active:p[7]==="stretch",componentId:p[0]}}),E=new GridStylesButton({props:{style:p[10],value:"start",icon:"AlignTop",title:"Align top",active:p[8]==="start",componentId:p[0]}}),F=new GridStylesButton({props:{style:p[10],value:"center",icon:"AlignMiddle",title:"Align middle",active:p[8]==="center",componentId:p[0]}}),$=new GridStylesButton({props:{style:p[10],value:"end",icon:"AlignBottom",title:"Align bottom",active:p[8]==="end",componentId:p[0]}}),se=new GridStylesButton({props:{style:p[10],value:"stretch",icon:"MoveUpDown",title:"Stretch vertically",active:p[8]==="stretch",componentId:p[0]}}),{c(){create_component(u.$$.fragment),f=space(),create_component(m.$$.fragment),v=space(),create_component(y.$$.fragment),w=space(),create_component(k.$$.fragment),S=space(),M=element("div"),T=space(),create_component(E.$$.fragment),H=space(),create_component(F.$$.fragment),Z=space(),create_component($.$$.fragment),J=space(),create_component(se.$$.fragment),ie=space(),he=element("div"),attr(M,"class","divider svelte-zwufuk"),attr(he,"class","divider svelte-zwufuk")},m(pe,ve){mount_component(u,pe,ve),insert(pe,f,ve),mount_component(m,pe,ve),insert(pe,v,ve),mount_component(y,pe,ve),insert(pe,w,ve),mount_component(k,pe,ve),insert(pe,S,ve),insert(pe,M,ve),insert(pe,T,ve),mount_component(E,pe,ve),insert(pe,H,ve),mount_component(F,pe,ve),insert(pe,Z,ve),mount_component($,pe,ve),insert(pe,J,ve),mount_component(se,pe,ve),insert(pe,ie,ve),insert(pe,he,ve),fe=!0},p(pe,ve){const Ae={};ve[0]&2048&&(Ae.style=pe[11]),ve[0]&128&&(Ae.active=pe[7]==="start"),ve[0]&1&&(Ae.componentId=pe[0]),u.$set(Ae);const ze={};ve[0]&2048&&(ze.style=pe[11]),ve[0]&128&&(ze.active=pe[7]==="center"),ve[0]&1&&(ze.componentId=pe[0]),m.$set(ze);const Se={};ve[0]&2048&&(Se.style=pe[11]),ve[0]&128&&(Se.active=pe[7]==="end"),ve[0]&1&&(Se.componentId=pe[0]),y.$set(Se);const Le={};ve[0]&2048&&(Le.style=pe[11]),ve[0]&128&&(Le.active=pe[7]==="stretch"),ve[0]&1&&(Le.componentId=pe[0]),k.$set(Le);const Ce={};ve[0]&1024&&(Ce.style=pe[10]),ve[0]&256&&(Ce.active=pe[8]==="start"),ve[0]&1&&(Ce.componentId=pe[0]),E.$set(Ce);const Ue={};ve[0]&1024&&(Ue.style=pe[10]),ve[0]&256&&(Ue.active=pe[8]==="center"),ve[0]&1&&(Ue.componentId=pe[0]),F.$set(Ue);const Ze={};ve[0]&1024&&(Ze.style=pe[10]),ve[0]&256&&(Ze.active=pe[8]==="end"),ve[0]&1&&(Ze.componentId=pe[0]),$.$set(Ze);const Ge={};ve[0]&1024&&(Ge.style=pe[10]),ve[0]&256&&(Ge.active=pe[8]==="stretch"),ve[0]&1&&(Ge.componentId=pe[0]),se.$set(Ge)},i(pe){fe||(transition_in(u.$$.fragment,pe),transition_in(m.$$.fragment,pe),transition_in(y.$$.fragment,pe),transition_in(k.$$.fragment,pe),transition_in(E.$$.fragment,pe),transition_in(F.$$.fragment,pe),transition_in($.$$.fragment,pe),transition_in(se.$$.fragment,pe),fe=!0)},o(pe){transition_out(u.$$.fragment,pe),transition_out(m.$$.fragment,pe),transition_out(y.$$.fragment,pe),transition_out(k.$$.fragment,pe),transition_out(E.$$.fragment,pe),transition_out(F.$$.fragment,pe),transition_out($.$$.fragment,pe),transition_out(se.$$.fragment,pe),fe=!1},d(pe){pe&&(detach(f),detach(v),detach(w),detach(S),detach(M),detach(T),detach(H),detach(Z),detach(J),detach(ie),detach(he)),destroy_component(u,pe),destroy_component(m,pe),destroy_component(y,pe),destroy_component(k,pe),destroy_component(E,pe),destroy_component(F,pe),destroy_component($,pe),destroy_component(se,pe)}}}function create_if_block_6$1(p){let u,f;return u=new SettingsColorPicker({props:{prop:p[38].key,component:p[1],disabled:!!p[38].license}}),{c(){create_component(u.$$.fragment)},m(m,v){mount_component(u,m,v),f=!0},p(m,v){const y={};v[0]&16384&&(y.prop=m[38].key),v[0]&2&&(y.component=m[1]),v[0]&16384&&(y.disabled=!!m[38].license),u.$set(y)},i(m){f||(transition_in(u.$$.fragment,m),f=!0)},o(m){transition_out(u.$$.fragment,m),f=!1},d(m){destroy_component(u,m)}}}function create_if_block_5$1(p){let u,f;return u=new SettingsButton({props:{prop:p[38].key,icon:p[38].barIcon,title:p[38].barTitle||p[38].label,disabled:!!p[38].license,bool:!0,component:p[1]}}),{c(){create_component(u.$$.fragment)},m(m,v){mount_component(u,m,v),f=!0},p(m,v){const y={};v[0]&16384&&(y.prop=m[38].key),v[0]&16384&&(y.icon=m[38].barIcon),v[0]&16384&&(y.title=m[38].barTitle||m[38].label),v[0]&16384&&(y.disabled=!!m[38].license),v[0]&2&&(y.component=m[1]),u.$set(y)},i(m){f||(transition_in(u.$$.fragment,m),f=!0)},o(m){transition_out(u.$$.fragment,m),f=!1},d(m){destroy_component(u,m)}}}function create_if_block_3$2(p){let u,f,m,v;const y=[create_if_block_4$1,create_else_block$2],w=[];function k(S,M){return S[38].barStyle==="buttons"?0:1}return u=k(p),f=w[u]=y[u](p),{c(){f.c(),m=empty$1()},m(S,M){w[u].m(S,M),insert(S,m,M),v=!0},p(S,M){let T=u;u=k(S),u===T?w[u].p(S,M):(group_outros(),transition_out(w[T],1,1,()=>{w[T]=null}),check_outros(),f=w[u],f?f.p(S,M):(f=w[u]=y[u](S),f.c()),transition_in(f,1),f.m(m.parentNode,m))},i(S){v||(transition_in(f),v=!0)},o(S){transition_out(f),v=!1},d(S){S&&detach(m),w[u].d(S)}}}function create_else_block$2(p){let u,f;return u=new SettingsPicker({props:{prop:p[38].key,options:p[38].options,label:p[38].label,disabled:!!p[38].license,component:p[1]}}),{c(){create_component(u.$$.fragment)},m(m,v){mount_component(u,m,v),f=!0},p(m,v){const y={};v[0]&16384&&(y.prop=m[38].key),v[0]&16384&&(y.options=m[38].options),v[0]&16384&&(y.label=m[38].label),v[0]&16384&&(y.disabled=!!m[38].license),v[0]&2&&(y.component=m[1]),u.$set(y)},i(m){f||(transition_in(u.$$.fragment,m),f=!0)},o(m){transition_out(u.$$.fragment,m),f=!1},d(m){destroy_component(u,m)}}}function create_if_block_4$1(p){let u,f,m=ensure_array_like(p[38].options),v=[];for(let w=0;w<m.length;w+=1)v[w]=create_each_block_1(get_each_context_1(p,m,w));const y=w=>transition_out(v[w],1,1,()=>{v[w]=null});return{c(){for(let w=0;w<v.length;w+=1)v[w].c();u=empty$1()},m(w,k){for(let S=0;S<v.length;S+=1)v[S]&&v[S].m(w,k);insert(w,u,k),f=!0},p(w,k){if(k[0]&16386){m=ensure_array_like(w[38].options);let S;for(S=0;S<m.length;S+=1){const M=get_each_context_1(w,m,S);v[S]?(v[S].p(M,k),transition_in(v[S],1)):(v[S]=create_each_block_1(M),v[S].c(),transition_in(v[S],1),v[S].m(u.parentNode,u))}for(group_outros(),S=m.length;S<v.length;S+=1)y(S);check_outros()}},i(w){if(!f){for(let k=0;k<m.length;k+=1)transition_in(v[k]);f=!0}},o(w){v=v.filter(Boolean);for(let k=0;k<v.length;k+=1)transition_out(v[k]);f=!1},d(w){w&&detach(u),destroy_each(v,w)}}}function create_each_block_1(p){let u,f;return u=new SettingsButton({props:{prop:p[38].key,value:p[41].value,icon:p[41].barIcon,title:p[41].barTitle||p[41].label,disabled:!!p[38].license,component:p[1]}}),{c(){create_component(u.$$.fragment)},m(m,v){mount_component(u,m,v),f=!0},p(m,v){const y={};v[0]&16384&&(y.prop=m[38].key),v[0]&16384&&(y.value=m[41].value),v[0]&16384&&(y.icon=m[41].barIcon),v[0]&16384&&(y.title=m[41].barTitle||m[41].label),v[0]&16384&&(y.disabled=!!m[38].license),v[0]&2&&(y.component=m[1]),u.$set(y)},i(m){f||(transition_in(u.$$.fragment,m),f=!0)},o(m){transition_out(u.$$.fragment,m),f=!1},d(m){destroy_component(u,m)}}}function create_if_block_2$3(p){let u;return{c(){u=element("div"),attr(u,"class","divider svelte-zwufuk")},m(f,m){insert(f,u,m)},d(f){f&&detach(u)}}}function create_each_block$6(p){let u,f,m,v,y;const w=[create_if_block_3$2,create_if_block_5$1,create_if_block_6$1],k=[];function S(T,E){return T[38].type==="select"?0:T[38].type==="boolean"?1:T[38].type==="color"?2:-1}~(u=S(p))&&(f=k[u]=w[u](p));let M=p[38].barSeparator!==!1&&(p[14].length!=p[40]+1||!p[13])&&create_if_block_2$3();return{c(){f&&f.c(),m=space(),M&&M.c(),v=empty$1()},m(T,E){~u&&k[u].m(T,E),insert(T,m,E),M&&M.m(T,E),insert(T,v,E),y=!0},p(T,E){let H=u;u=S(T),u===H?~u&&k[u].p(T,E):(f&&(group_outros(),transition_out(k[H],1,1,()=>{k[H]=null}),check_outros()),~u?(f=k[u],f?f.p(T,E):(f=k[u]=w[u](T),f.c()),transition_in(f,1),f.m(m.parentNode,m)):f=null),T[38].barSeparator!==!1&&(T[14].length!=T[40]+1||!T[13])?M||(M=create_if_block_2$3(),M.c(),M.m(v.parentNode,v)):M&&(M.d(1),M=null)},i(T){y||(transition_in(f),y=!0)},o(T){transition_out(f),y=!1},d(T){T&&(detach(m),detach(v)),~u&&k[u].d(T),M&&M.d(T)}}}function create_if_block_1$5(p){let u,f,m,v;return u=new SettingsButton({props:{icon:"Duplicate",title:"Duplicate component"}}),u.$on("click",p[27]),m=new SettingsButton({props:{icon:"Delete",title:"Delete component"}}),m.$on("click",p[28]),{c(){create_component(u.$$.fragment),f=space(),create_component(m.$$.fragment)},m(y,w){mount_component(u,y,w),insert(y,f,w),mount_component(m,y,w),v=!0},p:noop$2,i(y){v||(transition_in(u.$$.fragment,y),transition_in(m.$$.fragment,y),v=!0)},o(y){transition_out(u.$$.fragment,y),transition_out(m.$$.fragment,y),v=!1},d(y){y&&detach(f),destroy_component(u,y),destroy_component(m,y)}}}function create_fragment$j(p){let u,f,m=p[9]&&create_if_block$b(p);return{c(){m&&m.c(),u=empty$1()},m(v,y){m&&m.m(v,y),insert(v,u,y),f=!0},p(v,y){v[9]?m?(m.p(v,y),y[0]&512&&transition_in(m,1)):(m=create_if_block$b(v),m.c(),transition_in(m,1),m.m(u.parentNode,u)):m&&(group_outros(),transition_out(m,1,1,()=>{m=null}),check_outros())},i(v){f||(transition_in(m),f=!0)},o(v){transition_out(m),f=!1},d(v){v&&detach(u),m&&m.d(v)}}}const verticalOffset=36,horizontalOffset=2;function instance_1$1(p,u,f){let m,v,y,w,k,S,M,T,E,H,F,Z,$,J,se,ie,he=noop$2,fe=()=>(he(),he=subscribe(k,Gt=>f(23,ie=Gt)),k),pe,ve,Ae=noop$2,ze=()=>(Ae(),Ae=subscribe(w,Gt=>f(25,ve=Gt)),w),Se;component_subscribe(p,builderStore,Gt=>f(2,se=Gt)),component_subscribe(p,dndIsDragging,Gt=>f(24,pe=Gt)),component_subscribe(p,componentStore,Gt=>f(26,Se=Gt)),p.$$.on_destroy.push(()=>he()),p.$$.on_destroy.push(()=>Ae());const Le=getContext$1("context");component_subscribe(p,Le,Gt=>f(22,J=Gt));const Ce=new MutationObserver(()=>yt());let Ue=0,Ze=0,Ge,be,De=!1,Ke=!1,He=!1,rt,ft;const Mt=()=>{Ce.disconnect(),f(6,De=!1),Ke=!1,f(18,He=!1)},$e=Gt=>{Ce.observe(Gt,{attributes:!0,attributeFilter:["style"]}),Ke=!0},je=(Gt,Jt)=>{var Pt;let Ht=[];return(Pt=Jt==null?void 0:Jt.settings)==null||Pt.forEach(Et=>{Et.section&&shouldDisplaySetting(Gt,Et)?Ht=Ht.concat(Et.settings||[]):Ht.push(Et)}),Ht.filter(Et=>Et.showInBar&&!Et.hidden&&shouldDisplaySetting(Gt,Et))},yt=domDebounce(()=>{var nn;if(!S)return;let Gt=document.getElementsByClassName(m)[0];if(!Gt)return Mt();const Jt=Gt.dataset.insideGrid==="true";if(Jt&&!He){f(18,He=!0);return}else f(18,He=Jt);if(He||(Gt=Gt.getElementsByClassName(`${m}-dom`)[0]||((nn=Gt.children)==null?void 0:nn[0])),!Gt||!be)return Mt();Ke||$e(Gt);const Pt=document.getElementById("clip-root").getBoundingClientRect(),Et=Gt.getBoundingClientRect(),cn=be.offsetWidth,Sn=be.offsetHeight,{scrollX:$t,scrollY:xn,innerWidth:sn}=window;He&&(H?(f(7,rt=Gt.dataset.gridMobileHAlign),f(8,ft=Gt.dataset.gridMobileVAlign)):(f(7,rt=Gt.dataset.gridDesktopHAlign),f(8,ft=Gt.dataset.gridDesktopVAlign)));let mt=Et.top+xn-verticalOffset-Sn;mt<Pt.top-50&&(mt=Pt.top-50),mt<0&&(mt=0);const Mn=Pt.top+Pt.height;mt>Mn-44&&(mt=Mn-44),Et.top<Et.height&&Et.height<80&&(mt=Et.bottom+verticalOffset);let Wt=Et.left+$t+Et.width/2-cn/2;(Wt<0||Wt+cn>sn)&&(Wt=Et.left+$t-horizontalOffset,(Wt<0||Wt+cn>sn)&&(Wt=Et.right+$t-cn+horizontalOffset,(Wt<0||Wt+cn>sn)&&(Wt=horizontalOffset))),Math.round(mt)!==Math.round(Ue)&&f(3,Ue=mt),Math.round(Wt)!==Math.round(Ze)&&f(4,Ze=Wt),f(6,De=!0)});onMount(()=>{yt(),Ge=setInterval(yt,100),document.addEventListener("scroll",yt,!0)}),onDestroy(()=>{clearInterval(Ge),document.removeEventListener("scroll",yt,!0),Mt()});const ot=()=>{builderStore.actions.duplicateComponent(se.selectedComponentId)},Rt=()=>{builderStore.actions.deleteComponent(se.selectedComponentId)};function Xe(Gt){binding_callbacks[Gt?"unshift":"push"](()=>{be=Gt,f(5,be)})}return p.$$.update=()=>{var Gt,Jt,Ht,Pt;p.$$.dirty[0]&4&&f(0,m=se.selectedComponentId),p.$$.dirty[0]&1&&Mt(),p.$$.dirty[0]&67108864&&f(1,v=Se.selectedComponent),p.$$.dirty[0]&67108864&&f(21,y=Se.selectedComponentDefinition),p.$$.dirty[0]&1&&ze(f(16,w=componentStore.actions.getComponentInstance(m))),p.$$.dirty[0]&33554432&&fe(f(15,k=ve==null?void 0:ve.state)),p.$$.dirty[0]&27262976&&f(9,S=(y==null?void 0:y.showSettingsBar)!==!1&&!pe&&y&&!(ie!=null&&ie.errorState)),p.$$.dirty[0]&2097154&&f(14,M=je(v,y)),p.$$.dirty[0]&5&&f(13,T=m===((Jt=(Gt=se.screen)==null?void 0:Gt.props)==null?void 0:Jt._id)),p.$$.dirty[0]&2359296&&f(12,E=He&&(((Ht=y==null?void 0:y.grid)==null?void 0:Ht.hAlign)!=="stretch"||((Pt=y==null?void 0:y.grid)==null?void 0:Pt.vAlign)!=="stretch")),p.$$.dirty[0]&4194304&&f(19,H=J.device.mobile),p.$$.dirty[0]&524288&&f(20,F=H?Devices.Mobile:Devices.Desktop),p.$$.dirty[0]&1048576&&f(11,Z=getGridVar(F,GridParams.HAlign)),p.$$.dirty[0]&1048576&&f(10,$=getGridVar(F,GridParams.VAlign))},[m,v,se,Ue,Ze,be,De,rt,ft,S,$,Z,E,T,M,k,w,Le,He,H,F,y,J,ie,pe,ve,Se,ot,Rt,Xe]}class SettingsBar extends SvelteComponent{constructor(u){super(),init$1(this,u,instance_1$1,create_fragment$j,safe_not_equal,{},null,[-1,-1])}}const Indicator_svelte_svelte_type_style_lang="";function get_each_context$5(p,u,f){const m=p.slice();return m[16]=u[f],m}function create_if_block_1$4(p){let u,f,m,v=p[5]&&create_if_block_3$1(p),y=p[4]&&create_if_block_2$2(p);return{c(){u=element("div"),v&&v.c(),f=space(),y&&y.c(),attr(u,"class","label svelte-1qt4i99"),attr(u,"draggable","true"),attr(u,"data-indicator","true"),attr(u,"data-drag-mode",GridDragMode.Move),attr(u,"data-id",p[8]),toggle_class(u,"flipped",p[14]),toggle_class(u,"line",p[9]),toggle_class(u,"right",p[10])},m(w,k){insert(w,u,k),v&&v.m(u,null),append$2(u,f),y&&y.m(u,null),m=!0},p(w,k){w[5]?v?(v.p(w,k),k&32&&transition_in(v,1)):(v=create_if_block_3$1(w),v.c(),transition_in(v,1),v.m(u,f)):v&&(group_outros(),transition_out(v,1,1,()=>{v=null}),check_outros()),w[4]?y?y.p(w,k):(y=create_if_block_2$2(w),y.c(),y.m(u,null)):y&&(y.d(1),y=null),(!m||k&256)&&attr(u,"data-id",w[8]),(!m||k&16384)&&toggle_class(u,"flipped",w[14]),(!m||k&512)&&toggle_class(u,"line",w[9]),(!m||k&1024)&&toggle_class(u,"right",w[10])},i(w){m||(transition_in(v),m=!0)},o(w){transition_out(v),m=!1},d(w){w&&detach(u),v&&v.d(),y&&y.d()}}}function create_if_block_3$1(p){let u,f;return u=new Icon$1({props:{name:p[5],size:"S",color:"white"}}),{c(){create_component(u.$$.fragment)},m(m,v){mount_component(u,m,v),f=!0},p(m,v){const y={};v&32&&(y.name=m[5]),u.$set(y)},i(m){f||(transition_in(u.$$.fragment,m),f=!0)},o(m){transition_out(u.$$.fragment,m),f=!1},d(m){destroy_component(u,m)}}}function create_if_block_2$2(p){let u,f;return{c(){u=element("div"),f=text$1(p[4]),attr(u,"class","text svelte-1qt4i99")},m(m,v){insert(m,u,v),append$2(u,f)},p(m,v){v&16&&set_data(f,m[4])},d(m){m&&detach(u)}}}function create_if_block$a(p){let u,f=ensure_array_like(p[15]),m=[];for(let v=0;v<f.length;v+=1)m[v]=create_each_block$5(get_each_context$5(p,f,v));return{c(){for(let v=0;v<m.length;v+=1)m[v].c();u=empty$1()},m(v,y){for(let w=0;w<m.length;w+=1)m[w]&&m[w].m(v,y);insert(v,u,y)},p(v,y){if(y&33024){f=ensure_array_like(v[15]);let w;for(w=0;w<f.length;w+=1){const k=get_each_context$5(v,f,w);m[w]?m[w].p(k,y):(m[w]=create_each_block$5(k),m[w].c(),m[w].m(u.parentNode,u))}for(;w<m.length;w+=1)m[w].d(1);m.length=f.length}},d(v){v&&detach(u),destroy_each(m,v)}}}function create_each_block$5(p){let u,f,m;return{c(){u=element("div"),f=element("div"),m=space(),attr(f,"class","anchor-inner svelte-1qt4i99"),attr(u,"class","anchor "+p[16]+" svelte-1qt4i99"),attr(u,"draggable","true"),attr(u,"data-indicator","true"),attr(u,"data-drag-mode",GridDragMode.Resize),attr(u,"data-side",p[16]),attr(u,"data-id",p[8])},m(v,y){insert(v,u,y),append$2(u,f),append$2(u,m)},p(v,y){y&256&&attr(u,"data-id",v[8])},d(v){v&&detach(u)}}}function create_fragment$i(p){let u,f,m,v=(p[4]||p[5])&&create_if_block_1$4(p),y=p[11]&&create_if_block$a(p);return{c(){u=element("div"),v&&v.c(),f=space(),y&&y.c(),attr(u,"class","indicator svelte-1qt4i99"),set_style(u,"top",p[0]+"px"),set_style(u,"left",p[1]+"px"),set_style(u,"width",p[2]+"px"),set_style(u,"height",p[3]+"px"),set_style(u,"--color",p[6]),set_style(u,"--zIndex",p[7]),set_style(u,"--bg",p[12]||"none"),toggle_class(u,"flipped",p[14]),toggle_class(u,"line",p[9]),toggle_class(u,"withText",!!p[4]),toggle_class(u,"vCompact",p[3]<40),toggle_class(u,"hCompact",p[2]<40),toggle_class(u,"animate",p[13])},m(w,k){insert(w,u,k),v&&v.m(u,null),append$2(u,f),y&&y.m(u,null),m=!0},p(w,[k]){w[4]||w[5]?v?(v.p(w,k),k&48&&transition_in(v,1)):(v=create_if_block_1$4(w),v.c(),transition_in(v,1),v.m(u,f)):v&&(group_outros(),transition_out(v,1,1,()=>{v=null}),check_outros()),w[11]?y?y.p(w,k):(y=create_if_block$a(w),y.c(),y.m(u,null)):y&&(y.d(1),y=null),(!m||k&1)&&set_style(u,"top",w[0]+"px"),(!m||k&2)&&set_style(u,"left",w[1]+"px"),(!m||k&4)&&set_style(u,"width",w[2]+"px"),(!m||k&8)&&set_style(u,"height",w[3]+"px"),(!m||k&64)&&set_style(u,"--color",w[6]),(!m||k&128)&&set_style(u,"--zIndex",w[7]),(!m||k&4096)&&set_style(u,"--bg",w[12]||"none"),(!m||k&16384)&&toggle_class(u,"flipped",w[14]),(!m||k&512)&&toggle_class(u,"line",w[9]),(!m||k&16)&&toggle_class(u,"withText",!!w[4]),(!m||k&8)&&toggle_class(u,"vCompact",w[3]<40),(!m||k&4)&&toggle_class(u,"hCompact",w[2]<40),(!m||k&8192)&&toggle_class(u,"animate",w[13])},i(w){m||(transition_in(v),m=!0)},o(w){transition_out(v),m=!1},d(w){w&&detach(u),v&&v.d(),y&&y.d()}}}function instance$j(p,u,f){let m,{top:v}=u,{left:y}=u,{width:w}=u,{height:k}=u,{text:S}=u,{icon:M}=u,{color:T}=u,{zIndex:E}=u,{componentId:H}=u,{line:F=!1}=u,{alignRight:Z=!1}=u,{showResizeAnchors:$=!1}=u,{background:J}=u,{animate:se=!1}=u;const ie=["right","left","top","bottom","bottom-right","bottom-left","top-right","top-left"];return p.$$set=he=>{"top"in he&&f(0,v=he.top),"left"in he&&f(1,y=he.left),"width"in he&&f(2,w=he.width),"height"in he&&f(3,k=he.height),"text"in he&&f(4,S=he.text),"icon"in he&&f(5,M=he.icon),"color"in he&&f(6,T=he.color),"zIndex"in he&&f(7,E=he.zIndex),"componentId"in he&&f(8,H=he.componentId),"line"in he&&f(9,F=he.line),"alignRight"in he&&f(10,Z=he.alignRight),"showResizeAnchors"in he&&f(11,$=he.showResizeAnchors),"background"in he&&f(12,J=he.background),"animate"in he&&f(13,se=he.animate)},p.$$.update=()=>{p.$$.dirty&1&&f(14,m=v<24)},[v,y,w,k,S,M,T,E,H,F,Z,$,J,se,m,ie]}class Indicator extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$j,create_fragment$i,safe_not_equal,{top:0,left:1,width:2,height:3,text:4,icon:5,color:6,zIndex:7,componentId:8,line:9,alignRight:10,showResizeAnchors:11,background:12,animate:13})}}function get_each_context$4(p,u,f){const m=p.slice();return m[30]=u[f],m[32]=f,m}function create_each_block$4(p){let u,f;return u=new Indicator({props:{top:p[30].top,left:p[30].left,width:p[30].width,height:p[30].height,text:p[32]===0?p[2].text:void 0,icon:p[32]===0?p[2].icon:void 0,showResizeAnchors:p[2].allowResizeAnchors&&p[2].insideGrid,color:p[2].error?errorColor:p[2].color,componentId:p[2].componentId,zIndex:p[2].zIndex,background:p[0],animate:p[1]}}),{c(){create_component(u.$$.fragment)},m(m,v){mount_component(u,m,v),f=!0},p(m,v){const y={};v[0]&8&&(y.top=m[30].top),v[0]&8&&(y.left=m[30].left),v[0]&8&&(y.width=m[30].width),v[0]&8&&(y.height=m[30].height),v[0]&4&&(y.text=m[32]===0?m[2].text:void 0),v[0]&4&&(y.icon=m[32]===0?m[2].icon:void 0),v[0]&4&&(y.showResizeAnchors=m[2].allowResizeAnchors&&m[2].insideGrid),v[0]&4&&(y.color=m[2].error?errorColor:m[2].color),v[0]&4&&(y.componentId=m[2].componentId),v[0]&4&&(y.zIndex=m[2].zIndex),v[0]&1&&(y.background=m[0]),v[0]&2&&(y.animate=m[1]),u.$set(y)},i(m){f||(transition_in(u.$$.fragment,m),f=!0)},o(m){transition_out(u.$$.fragment,m),f=!1},d(m){destroy_component(u,m)}}}function create_fragment$h(p){let u,f,m=ensure_array_like(p[3]),v=[];for(let w=0;w<m.length;w+=1)v[w]=create_each_block$4(get_each_context$4(p,m,w));const y=w=>transition_out(v[w],1,1,()=>{v[w]=null});return{c(){for(let w=0;w<v.length;w+=1)v[w].c();u=empty$1()},m(w,k){for(let S=0;S<v.length;S+=1)v[S]&&v[S].m(w,k);insert(w,u,k),f=!0},p(w,k){if(k[0]&15){m=ensure_array_like(w[3]);let S;for(S=0;S<m.length;S+=1){const M=get_each_context$4(w,m,S);v[S]?(v[S].p(M,k),transition_in(v[S],1)):(v[S]=create_each_block$4(M),v[S].c(),transition_in(v[S],1),v[S].m(u.parentNode,u))}for(group_outros(),S=m.length;S<v.length;S+=1)y(S);check_outros()}},i(w){if(!f){for(let k=0;k<m.length;k+=1)transition_in(v[k]);f=!0}},o(w){v=v.filter(Boolean);for(let k=0;k<v.length;k+=1)transition_out(v[k]);f=!1},d(w){w&&detach(u),destroy_each(v,w)}}}const errorColor="var(--spectrum-global-color-static-red-600)";function instance$i(p,u,f){let m,v,y,w;component_subscribe(p,builderStore,De=>f(13,w=De));let{componentId:k}=u,{color:S}=u,{zIndex:M=900}=u,{prefix:T=void 0}=u,{allowResizeAnchors:E=!1}=u,{background:H=void 0}=u,{animate:F=!1}=u,{text:Z=void 0}=u,{icon:$=void 0}=u;const J=memo(u);component_subscribe(p,J,De=>f(12,y=De));const se=new MutationObserver(()=>be()),ie=()=>({componentId:k,color:S,zIndex:M,prefix:T,allowResizeAnchors:E,indicators:[],text:Z,icon:$,insideGrid:!1,error:!1});let he,fe=ie(),pe=!1,ve=!1,Ae=[],ze=0,Se;const Le=()=>{se.disconnect(),pe=!1,ve=!1},Ce=De=>[...document.getElementsByClassName(De)].filter(Ke=>Ke instanceof HTMLElement).slice(0,100),Ue=De=>{se.observe(De,{attributes:!0,attributeFilter:["style"]}),pe=!0},Ze=De=>Ke=>{ze>=Ae.length||(Se.indicators[De].visible=Se.indicators[De].insideModal||Se.indicators[De].insideSidePanel||Ke[0].isIntersecting,++ze===Ae.length&&(f(2,fe=Se),ve=!1))},be=domDebounce(()=>{var $e;if(ve)return;let De=Ce(k);if(!De.length){f(2,fe=ie());return}ve=!0,ze=0,Ae.forEach(je=>je.disconnect()),Ae=[],Se=ie(),pe||Ue(De[0]),Se.insideGrid=(($e=De[0])==null?void 0:$e.dataset.insideGrid)==="true",Z||(Se.text=De[0].dataset.name,Se.prefix&&(Se.text=`${Se.prefix} ${Se.text}`)),$||De[0].dataset.icon&&(Se.icon=De[0].dataset.icon),Se.error=De[0].classList.contains("error");const Ke=window.scrollX,He=window.scrollY;Se.insideGrid||(De=Ce(`${k}-dom`));const rt=De.length>1;if(!De.length){f(2,fe=ie());return}const ft=document.getElementById("app-root");if(!ft)throw"app-root node not found";const Mt=ft.getBoundingClientRect();Se.indicators=De.map((je,Ct)=>{const yt=je.getBoundingClientRect();let ot={top:Math.round(yt.top+He-Mt.top+v),left:Math.round(yt.left+Ke-Mt.left+v),width:Math.round(yt.width+2),height:Math.round(yt.height+2),visible:!0,insideModal:!1,insideSidePanel:!1};if(rt){const Rt=Ze(Ct),Xe=new IntersectionObserver(Rt,{threshold:1,root:ft});Xe.observe(je),Ae.push(Xe),ot.visible=!1,ot.insideSidePanel=!!je.closest(".side-panel"),ot.insideModal=!!je.closest(".modal-content")}return ot}),rt||(f(2,fe=Se),ve=!1)});return onMount(()=>{be(),he=setInterval(be,100),document.addEventListener("scroll",be,!0)}),onDestroy(()=>{se.disconnect(),clearInterval(he),document.removeEventListener("scroll",be,!0)}),p.$$set=De=>{f(29,u=assign(assign({},u),exclude_internal_props(De))),"componentId"in De&&f(5,k=De.componentId),"color"in De&&f(6,S=De.color),"zIndex"in De&&f(7,M=De.zIndex),"prefix"in De&&f(8,T=De.prefix),"allowResizeAnchors"in De&&f(9,E=De.allowResizeAnchors),"background"in De&&f(0,H=De.background),"animate"in De&&f(1,F=De.animate),"text"in De&&f(10,Z=De.text),"icon"in De&&f(11,$=De.icon)},p.$$.update=()=>{p.$$.dirty[0]&32&&Le(),p.$$.dirty[0]&4&&f(3,m=fe.indicators.filter(De=>De.visible)),p.$$.dirty[0]&8192&&(v=w.inBuilder?5:-1),p.$$.dirty[0]&992&&J.set({componentId:k,color:S,zIndex:M,prefix:T,allowResizeAnchors:E}),p.$$.dirty[0]&4096&&be()},u=exclude_internal_props(u),[H,F,fe,m,J,k,S,M,T,E,Z,$,y,w]}class IndicatorSet extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$i,create_fragment$h,safe_not_equal,{componentId:5,color:6,zIndex:7,prefix:8,allowResizeAnchors:9,background:0,animate:1,text:10,icon:11},null,[-1,-1])}}function create_if_block$9(p){let u,f;return u=new IndicatorSet({props:{componentId:p[0].selectedComponentId,color:p[1],zIndex:900,allowResizeAnchors:!0}}),{c(){create_component(u.$$.fragment)},m(m,v){mount_component(u,m,v),f=!0},p(m,v){const y={};v&1&&(y.componentId=m[0].selectedComponentId),v&2&&(y.color=m[1]),u.$set(y)},i(m){f||(transition_in(u.$$.fragment,m),f=!0)},o(m){transition_out(u.$$.fragment,m),f=!1},d(m){destroy_component(u,m)}}}function create_fragment$g(p){let u,f,m=!p[2]&&p[0].selectedComponentId&&create_if_block$9(p);return{c(){m&&m.c(),u=empty$1()},m(v,y){m&&m.m(v,y),insert(v,u,y),f=!0},p(v,[y]){!v[2]&&v[0].selectedComponentId?m?(m.p(v,y),y&5&&transition_in(m,1)):(m=create_if_block$9(v),m.c(),transition_in(m,1),m.m(u.parentNode,u)):m&&(group_outros(),transition_out(m,1,1,()=>{m=null}),check_outros())},i(v){f||(transition_in(m),f=!0)},o(v){transition_out(m),f=!1},d(v){v&&detach(u),m&&m.d(v)}}}function instance$h(p,u,f){let m,v,y;return component_subscribe(p,builderStore,w=>f(0,v=w)),component_subscribe(p,dndIsDragging,w=>f(2,y=w)),p.$$.update=()=>{p.$$.dirty&1&&f(1,m=v.editMode?"var(--spectrum-global-color-static-green-500)":"var(--spectrum-global-color-static-blue-600)")},[v,m,y]}class SelectionIndicator extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$h,create_fragment$g,safe_not_equal,{})}}function create_if_block$8(p){let u,f,m;return u=new IndicatorSet({props:{componentId:p[0],color:"var(--spectrum-global-color-static-blue-200)",zIndex:p[1]?890:910,allowResizeAnchors:!0}}),{c(){create_component(u.$$.fragment),f=space()},m(v,y){mount_component(u,v,y),insert(v,f,y),m=!0},p(v,y){const w={};y&1&&(w.componentId=v[0]),y&2&&(w.zIndex=v[1]?890:910),u.$set(w)},i(v){m||(transition_in(u.$$.fragment,v),m=!0)},o(v){transition_out(u.$$.fragment,v),m=!1},d(v){v&&detach(f),destroy_component(u,v)}}}function create_fragment$f(p){let u,f,m=!p[2]&&p[0]&&create_if_block$8(p);return{c(){m&&m.c(),u=text$1("}")},m(v,y){m&&m.m(v,y),insert(v,u,y),f=!0},p(v,[y]){!v[2]&&v[0]?m?(m.p(v,y),y&5&&transition_in(m,1)):(m=create_if_block$8(v),m.c(),transition_in(m,1),m.m(u.parentNode,u)):m&&(group_outros(),transition_out(m,1,1,()=>{m=null}),check_outros())},i(v){f||(transition_in(m),f=!0)},o(v){transition_out(m),f=!1},d(v){v&&detach(u),m&&m.d(v)}}}function instance$g(p,u,f){let m,v,y,w,k,S;component_subscribe(p,builderStore,E=>f(4,w=E)),component_subscribe(p,hoverStore,E=>f(5,k=E)),component_subscribe(p,dndIsDragging,E=>f(2,S=E));const M=E=>{var Z;const H=E.target;if(E.buttons>0)return;let F;if(H.classList.contains("anchor"))F=H.dataset.id;else{const $=H.closest(".interactive.component:not(.root)");$ instanceof HTMLElement&&(F=(Z=$.dataset)==null?void 0:Z.id)}F!==m&&hoverStore.actions.hoverComponent(F)},T=()=>{hoverStore.actions.hoverComponent(null)};return onMount(()=>{document.addEventListener("mouseover",M),document.body.addEventListener("mouseleave",T)}),onDestroy(()=>{document.removeEventListener("mouseover",M),document.body.removeEventListener("mouseleave",T)}),p.$$.update=()=>{p.$$.dirty&32&&f(0,m=k.hoveredComponentId),p.$$.dirty&16&&f(3,v=w.selectedComponentId),p.$$.dirty&9&&f(1,y=m===v)},[m,y,S,v,w,k]}class HoverIndicator extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$g,create_fragment$f,safe_not_equal,{})}}const CustomThemeWrapper_svelte_svelte_type_style_lang="";function create_fragment$e(p){let u,f,m;const v=p[2].default,y=create_slot(v,p,p[1],null);return{c(){u=element("div"),y&&y.c(),attr(u,"style",f=p[0].customThemeCss),attr(u,"id","theme-root"),attr(u,"class","svelte-11fpj2n")},m(w,k){insert(w,u,k),y&&y.m(u,null),m=!0},p(w,[k]){y&&y.p&&(!m||k&2)&&update_slot_base(y,v,w,w[1],m?get_slot_changes(v,w[1],k,null):get_all_dirty_from_scope(w[1]),null),(!m||k&1&&f!==(f=w[0].customThemeCss))&&attr(u,"style",f)},i(w){m||(transition_in(y,w),m=!0)},o(w){transition_out(y,w),m=!1},d(w){w&&detach(u),y&&y.d(w)}}}function instance$f(p,u,f){let m;component_subscribe(p,themeStore,w=>f(0,m=w));let{$$slots:v={},$$scope:y}=u;return setContext(Context$1.PopoverRoot,"#theme-root"),p.$$set=w=>{"$$scope"in w&&f(1,y=w.$$scope)},[m,y,v]}class CustomThemeWrapper extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$f,create_fragment$e,safe_not_equal,{})}}const ThrottleRate=130;function instance$e(p,u,f){let m,v,y,w,k,S;component_subscribe(p,dndStore,he=>f(0,k=he)),component_subscribe(p,isGridScreen,he=>f(1,S=he));let M=!1;const T=he=>{const fe=document.getElementsByClassName(`${he}-dom`)[0];return fe instanceof HTMLElement?fe:void 0},E=he=>{const fe=he.reduce((ve,Ae)=>ve+Ae,0)/he.length;let pe=0;return he.forEach(ve=>{const Ae=ve-fe;pe+=Ae*Ae}),pe/he.length},H=()=>{if(!M){if(m!=null&&m.id){const he=document.getElementsByClassName(m==null?void 0:m.id)[0];he&&he.removeEventListener("dragend",H)}dndStore.actions.reset()}},F=he=>{var Se,Le;if(isGridEvent(he)||!(he.target instanceof HTMLElement))return;const fe=he.target.closest(".component");if(!(fe instanceof HTMLElement)||!fe.classList.contains("draggable"))return;(Se=he.dataTransfer)==null||Se.setDragImage(new Image,0,0),fe.addEventListener("dragend",H);const pe=fe.dataset.id,ve=fe.dataset.parent,Ae=findComponentById((Le=get_store_value(screenStore).activeScreen)==null?void 0:Le.props,ve),ze=Ae._children.findIndex(Ce=>Ce._id===pe);dndStore.actions.startDraggingExistingComponent({id:pe,bounds:fe.children[0].getBoundingClientRect(),parent:ve,index:ze,name:fe.dataset.name,icon:fe.dataset.icon,type:Ae._children[ze]._component}),builderStore.actions.selectComponent(pe),setTimeout(()=>{dndStore.actions.updateDrop({parent:ve,index:ze})},0)},Z=throttle((he,fe)=>{var He;if(!v)return;let{id:pe,parent:ve,element:Ae,acceptsChildren:ze,empty:Se}=v;if(ze||(pe=ve,Se=!1,Ae=T(ve)),Se){dndStore.actions.updateDrop({parent:pe,index:0});return}const Le=Ae==null?void 0:Ae.getElementsByClassName("component")[0];(Le==null?void 0:Le.parentNode)instanceof HTMLElement&&(Ae=Le.parentNode);let Ce;(Ae==null?void 0:Ae.children.length)===1&&(Ce=document.createElement("div"),Ce.dataset.id=DNDPlaceholderID,Ae.appendChild(Ce));const Ue=[...(Ae==null?void 0:Ae.children)||[]].filter(rt=>rt instanceof HTMLElement).map(rt=>{var $e;const Mt=((($e=rt.children)==null?void 0:$e[0])||rt).getBoundingClientRect();return{placeholder:rt.dataset.id===DNDPlaceholderID,centerX:Mt.left+Mt.width/2,centerY:Mt.top+Mt.height/2,left:Mt.left,right:Mt.right,top:Mt.top,bottom:Mt.bottom}});Ce&&(Ae==null||Ae.removeChild(Ce));const Ze=Object.keys(Ue[0]||{}).filter(rt=>rt!=="placeholder").map(rt=>{const ft=rt,Mt=Ue.map($e=>$e[ft]);return{variance:E(Mt),side:rt}});Ze.sort((rt,ft)=>rt.variance<ft.variance?-1:1);const Ge=["centerX","left","right"].includes((He=Ze[0])==null?void 0:He.side),be=Ue.filter(rt=>!rt.placeholder).map(rt=>Ge?rt.centerY:rt.centerX),De=Ge?fe:he;let Ke=0;for(;Ke<be.length&&be[Ke]<De;)Ke++;dndStore.actions.updateDrop({parent:pe,index:Ke})},ThrottleRate),$=he=>{he.preventDefault(),he.stopPropagation(),Z(he.clientX,he.clientY)},J=he=>{!m||!v||w||$(he)},se=async he=>{var pe,ve;if(!m||w||!(he.target instanceof HTMLElement))return;let fe=(ve=(pe=he.target).closest)==null?void 0:ve.call(pe,`.component:not(.block):not(.${m.id})`);fe instanceof HTMLElement&&fe!=null&&fe.classList.contains("droppable")&&(dndStore.actions.updateTarget({id:fe.dataset.id,parent:fe.dataset.parent,element:T(fe.dataset.id),empty:fe.classList.contains("empty"),acceptsChildren:fe.classList.contains("parent")}),$(he))},ie=async()=>{var Ae,ze,Se,Le,Ce;if(!m||!(y!=null&&y.parent)||(y==null?void 0:y.index)==null)return;if(m.isNew){M=!0,builderStore.actions.dropNewComponent(m.type,y.parent,y.index,(Ae=k.meta)==null?void 0:Ae.props),M=!1,H();return}let he,fe;const pe=findComponentById((ze=get_store_value(screenStore).activeScreen)==null?void 0:ze.props,y.parent);if(!pe||m.parent===y.parent&&m.index===y.index)return;const ve=(Se=pe._children)==null?void 0:Se.filter(Ue=>Ue._id!==DNDPlaceholderID&&Ue._id!==m.id);ve!=null&&ve.length?y.index===0?(he=(Le=ve[0])==null?void 0:Le._id,fe="above"):(he=(Ce=ve[y.index-1])==null?void 0:Ce._id,fe="below"):(he=pe._id,fe="inside"),he&&fe&&(M=!0,await builderStore.actions.moveComponent(m.id,he,fe),M=!1,H())};return onMount(()=>{document.addEventListener("dragstart",F,!1),document.addEventListener("dragover",J,!1),document.addEventListener("dragenter",se,!1),document.addEventListener("drop",ie,!1)}),onDestroy(()=>{document.removeEventListener("dragstart",F,!1),document.removeEventListener("dragover",J,!1),document.removeEventListener("dragenter",se,!1),document.removeEventListener("drop",ie,!1)}),p.$$.update=()=>{p.$$.dirty&1&&(m=k.source),p.$$.dirty&1&&(v=k.target),p.$$.dirty&1&&(y=k.drop),p.$$.dirty&2&&(w=S)},[k,S]}class DNDHandler extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$e,null,safe_not_equal,{})}}function instance_1(p,u,f){let m,v,y,w,k,S,M,T,E,H=noop$2,F=()=>(H(),H=subscribe(w,Ze=>f(8,E=Ze)),w),Z;component_subscribe(p,isGridScreen,Ze=>f(13,S=Ze)),component_subscribe(p,dndSource,Ze=>f(14,M=Ze)),component_subscribe(p,dndIsDragging,Ze=>f(7,T=Ze)),p.$$.on_destroy.push(()=>H());const $=getContext$1("context");component_subscribe(p,$,Ze=>f(9,Z=Ze));const J=new Image(1,1);J.src="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==";let se,ie,he=memo();component_subscribe(p,he,Ze=>f(6,k=Ze));const fe=()=>(se==null?void 0:se.scrollTop)||0,pe=async(Ze,Ge)=>{Ze==null||Ze.setEphemeralStyles(Ge),M!=null&&M.isNew&&Ge&&dndStore.actions.updateNewComponentProps({_styles:{normal:Ge}})},ve=(Ze,Ge,be)=>Math.min(be,Math.max(Ge,Ze)),Ae=domDebounce((Ze,Ge)=>{if(!(ie!=null&&ie.grid))return;const{mode:be,grid:De,domGrid:Ke}=ie,{startX:He,startY:rt,rowStart:ft,rowEnd:Mt,colStart:$e,colEnd:je}=De;if(!Ke)return;const Ct=parseInt(Ke.dataset.cols||""),yt=parseInt(Ke.dataset.colSize||"");if(isNaN(Ct)||isNaN(yt))throw"DOM grid missing required dataset attributes";const ot=Ze-He;let Rt=Math.round(ot/yt);const Xe=Ge-rt+fe();let Gt=Math.round(Xe/GridRowHeight);if(be===GridDragMode.Move){Rt=ve(Rt,1-$e,Ct+1-je),Gt=Math.max(Gt,1-ft);const Jt={[v.colStart]:$e+Rt,[v.colEnd]:je+Rt,[v.rowStart]:ft+Gt,[v.rowEnd]:Mt+Gt};he.set(Jt)}else if(be===GridDragMode.Resize){const{side:Jt}=ie;let Ht={};Jt==="right"?Ht[v.colEnd]=Math.max(je+Rt,$e+1):Jt==="left"?Ht[v.colStart]=Math.min($e+Rt,je-1):Jt==="top"?Ht[v.rowStart]=Math.min(ft+Gt,Mt-1):Jt==="bottom"?Ht[v.rowEnd]=Math.max(Mt+Gt,ft+1):Jt==="bottom-right"?(Ht[v.colEnd]=Math.max(je+Rt,$e+1),Ht[v.rowEnd]=Math.max(Mt+Gt,ft+1)):Jt==="bottom-left"?(Ht[v.colStart]=Math.min($e+Rt,je-1),Ht[v.rowEnd]=Math.max(Mt+Gt,ft+1)):Jt==="top-right"?(Ht[v.colEnd]=Math.max(je+Rt,$e+1),Ht[v.rowStart]=Math.min(ft+Gt,Mt-1)):Jt==="top-left"&&(Ht[v.colStart]=Math.min($e+Rt,je-1),Ht[v.rowStart]=Math.min(ft+Gt,Mt-1)),he.set(Ht)}}),ze=Ze=>{Ze.preventDefault(),Ze.stopPropagation(),Ae(Ze.clientX,Ze.clientY)},Se=()=>{const Ze=document.getElementsByClassName(DNDPlaceholderID)[0],Ge=Ze==null?void 0:Ze.closest(".grid");if(!(Ze instanceof HTMLElement)||!(Ge instanceof HTMLElement))return;const be=getComputedStyle(Ze),De=Ze.getBoundingClientRect();Ze.classList.add("dragging"),Ge.classList.add("highlight"),f(3,ie={domComponent:Ze,domGrid:Ge,id:DNDPlaceholderID,gridId:Ge.parentElement.dataset.id,mode:GridDragMode.Move,grid:{startX:De.left+De.width/2,startY:De.top+De.height/2+fe(),rowStart:parseInt(be.gridRowStart),rowEnd:parseInt(be.gridRowEnd),colStart:parseInt(be.gridColumnStart),colEnd:parseInt(be.gridColumnEnd)}})},Le=Ze=>{if(!isGridEvent(Ze))return;Ze.dataTransfer.setDragImage(J,0,0);let Ge,be,De;Ze.target.dataset.indicator==="true"?(Ge=Ze.target.dataset.dragMode,be=Ze.target.dataset.id,De=Ze.target.dataset.side):(Ge=GridDragMode.Move,be=Ze.target.closest(".component").dataset.id),Ge===GridDragMode.Move&&(Ze.ctrlKey||Ze.metaKey)&&builderStore.actions.duplicateComponent(be,"above",!1);const Ke=document.getElementsByClassName(be)[0],He=Ke==null?void 0:Ke.closest(".grid");if(!(Ke instanceof HTMLElement)||!(He instanceof HTMLElement))return;const rt=getComputedStyle(Ke);Ke.classList.add("dragging"),He.classList.add("highlight"),builderStore.actions.selectComponent(be),f(3,ie={domTarget:Ze.target,domComponent:Ke,domGrid:He,id:be,gridId:He.parentElement.dataset.id,mode:Ge,side:De,grid:{startX:Ze.clientX,startY:Ze.clientY+fe(),rowStart:parseInt(rt.gridRowStart),rowEnd:parseInt(rt.gridRowEnd),colStart:parseInt(rt.gridColumnStart),colEnd:parseInt(rt.gridColumnEnd)}}),ie.domTarget.addEventListener("dragend",Ue,!1)},Ce=Ze=>{if(!ie){T&&(M!=null&&M.isNew)&&S&&Se();return}ze(Ze)},Ue=async()=>{if(!ie)return;const{id:Ze,domTarget:Ge,domGrid:be,domComponent:De}=ie;De.classList.remove("dragging"),be.classList.remove("highlight"),Ge==null||Ge.removeEventListener("dragend",Ue),k&&builderStore.actions.updateStyles(k,Ze),f(3,ie=void 0),he.set(void 0)};return onMount(()=>{se=document.getElementsByClassName("screen-wrapper")[0],document.addEventListener("dragstart",Le,!1),document.addEventListener("dragover",Ce,!1),document.addEventListener("scroll",Ae)}),onDestroy(()=>{document.removeEventListener("dragstart",Le,!1),document.removeEventListener("dragover",Ce,!1),document.removeEventListener("scroll",Ae)}),p.$$.update=()=>{var Ze;p.$$.dirty&512&&f(5,m=(Ze=Z.device)!=null&&Ze.mobile?Devices.Mobile:Devices.Desktop),p.$$.dirty&32&&(v={colStart:getGridVar(m,GridParams.ColStart),colEnd:getGridVar(m,GridParams.ColEnd),rowStart:getGridVar(m,GridParams.RowStart),rowEnd:getGridVar(m,GridParams.RowEnd)}),p.$$.dirty&8&&f(4,y=ie==null?void 0:ie.id),p.$$.dirty&16&&F(f(0,w=componentStore.actions.getComponentInstance(y))),p.$$.dirty&320&&pe(E,k),p.$$.dirty&128&&!T&&Ue()},[w,$,he,ie,y,m,k,T,E,Z]}class GridDNDHandler extends SvelteComponent{constructor(u){super(),init$1(this,u,instance_1,null,safe_not_equal,{})}}function instance$d(p){onMount(()=>{get_store_value(builderStore).inBuilder&&document.addEventListener("keydown",u)}),onDestroy(()=>{get_store_value(builderStore).inBuilder&&document.removeEventListener("keydown",u)});const u=f=>{var y;const m=get_store_value(builderStore);if(!m.inBuilder||m.editMode)return;const v=(y=document.activeElement)==null?void 0:y.tagName.toLowerCase();["input","textarea"].indexOf(v)===-1&&(f.ctrlKey&&f.key==="d"&&f.preventDefault(),builderStore.actions.keyDown(f.key,f.ctrlKey))};return[]}class KeyboardManager extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$d,null,safe_not_equal,{})}}const DevToolsHeader_svelte_svelte_type_style_lang="";function create_default_slot_3$4(p){let u;return{c(){u=text$1("Preview")},m(f,m){insert(f,u,m)},d(f){f&&detach(u)}}}function create_if_block_1$3(p){let u,f;return u=new ActionButton({props:{quiet:!0,icon:"Code",$$slots:{default:[create_default_slot_2$5]},$$scope:{ctx:p}}}),u.$on("click",p[7]),{c(){create_component(u.$$.fragment)},m(m,v){mount_component(u,m,v),f=!0},p(m,v){const y={};v&1024&&(y.$$scope={dirty:v,ctx:m}),u.$set(y)},i(m){f||(transition_in(u.$$.fragment,m),f=!0)},o(m){transition_out(u.$$.fragment,m),f=!1},d(m){destroy_component(u,m)}}}function create_default_slot_2$5(p){let u;return{c(){u=text$1("DevTools")},m(f,m){insert(f,u,m)},d(f){f&&detach(u)}}}function create_if_block$7(p){let u,f,m,v;return u=new ActionButton({props:{quiet:!0,icon:"LinkOut",$$slots:{default:[create_default_slot_1$6]},$$scope:{ctx:p}}}),u.$on("click",p[8]),m=new ActionButton({props:{quiet:!0,icon:"Close",$$slots:{default:[create_default_slot$a]},$$scope:{ctx:p}}}),m.$on("click",p[9]),{c(){create_component(u.$$.fragment),f=space(),create_component(m.$$.fragment)},m(y,w){mount_component(u,y,w),insert(y,f,w),mount_component(m,y,w),v=!0},p(y,w){const k={};w&1024&&(k.$$scope={dirty:w,ctx:y}),u.$set(k);const S={};w&1024&&(S.$$scope={dirty:w,ctx:y}),m.$set(S)},i(y){v||(transition_in(u.$$.fragment,y),transition_in(m.$$.fragment,y),v=!0)},o(y){transition_out(u.$$.fragment,y),transition_out(m.$$.fragment,y),v=!1},d(y){y&&detach(f),destroy_component(u,y),destroy_component(m,y)}}}function create_default_slot_1$6(p){let u;return{c(){u=text$1("Fullscreen")},m(f,m){insert(f,u,m)},d(f){f&&detach(u)}}}function create_default_slot$a(p){let u;return{c(){u=text$1("Close")},m(f,m){insert(f,u,m)},d(f){f&&detach(u)}}}function create_fragment$d(p){let u,f,m,v,y,w,k;f=new Heading$1({props:{size:"XS",$$slots:{default:[create_default_slot_3$4]},$$scope:{ctx:p}}}),v=new Select_1({props:{quiet:!0,options:p[0],value:p[2].role||SELF_ROLE,placeholder:null,autoWidth:!0}}),v.$on("change",p[6]);let S=!p[1].device.mobile&&create_if_block_1$3(p),M=window.parent.isBuilder&&create_if_block$7(p);return{c(){u=element("div"),create_component(f.$$.fragment),m=space(),create_component(v.$$.fragment),y=space(),S&&S.c(),w=space(),M&&M.c(),attr(u,"class","dev-preview-header svelte-1fadx2d"),toggle_class(u,"mobile",p[1].device.mobile)},m(T,E){insert(T,u,E),mount_component(f,u,null),append$2(u,m),mount_component(v,u,null),append$2(u,y),S&&S.m(u,null),append$2(u,w),M&&M.m(u,null),k=!0},p(T,[E]){const H={};E&1024&&(H.$$scope={dirty:E,ctx:T}),f.$set(H);const F={};E&1&&(F.options=T[0]),E&4&&(F.value=T[2].role||SELF_ROLE),v.$set(F),T[1].device.mobile?S&&(group_outros(),transition_out(S,1,1,()=>{S=null}),check_outros()):S?(S.p(T,E),E&2&&transition_in(S,1)):(S=create_if_block_1$3(T),S.c(),transition_in(S,1),S.m(u,w)),window.parent.isBuilder&&M.p(T,E),(!k||E&2)&&toggle_class(u,"mobile",T[1].device.mobile)},i(T){k||(transition_in(f.$$.fragment,T),transition_in(v.$$.fragment,T),transition_in(S),transition_in(M),k=!0)},o(T){transition_out(f.$$.fragment,T),transition_out(v.$$.fragment,T),transition_out(S),transition_out(M),k=!1},d(T){T&&detach(u),destroy_component(f),destroy_component(v),S&&S.d(),M&&M.d()}}}const SELF_ROLE="self";function buildRoleList(p){var f;const u=[];if(u.push({label:"View as yourself",value:SELF_ROLE}),!p)return u;for(let m of p)u.push({label:`View as ${((f=m.uiMetadata)==null?void 0:f.displayName)||m.name}`,value:m._id});return u}function instance$c(p,u,f){let m,v,y,w;component_subscribe(p,devToolsStore,F=>f(2,y=F)),component_subscribe(p,appStore,F=>f(3,w=F));const k=getContext$1("context");component_subscribe(p,k,F=>f(1,v=F));let S;onMount(async()=>{await devToolsStore.actions.changeRole(SELF_ROLE),f(5,S=await API.getRoles())});const M=F=>devToolsStore.actions.changeRole(F.detail),T=()=>devToolsStore.actions.setVisible(!y.visible),E=()=>{var F,Z;(Z=(F=window.parent).closePreview)==null||Z.call(F),window.open(`/${w.appId}`,"_blank")},H=()=>{var F,Z;return(Z=(F=window.parent).closePreview)==null?void 0:Z.call(F)};return p.$$.update=()=>{p.$$.dirty&32&&f(0,m=buildRoleList(S))},[m,v,y,w,k,S,M,T,E,H]}class DevToolsHeader extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$c,create_fragment$d,safe_not_equal,{})}}const DevToolsStat_svelte_svelte_type_style_lang="";function create_fragment$c(p){let u,f,m,v,y,w,k,S;return{c(){u=element("div"),f=element("div"),m=text$1(p[3]),v=space(),y=element("div"),w=text$1(p[2]),attr(f,"class","stat-label svelte-da3g1f"),attr(f,"title",p[3]),attr(y,"class","stat-value svelte-da3g1f"),attr(y,"title",p[2]),toggle_class(y,"copyable",p[1]),toggle_class(y,"empty",p[0]),attr(u,"class","stat svelte-da3g1f")},m(M,T){insert(M,u,T),append$2(u,f),append$2(f,m),append$2(u,v),append$2(u,y),append$2(y,w),k||(S=listen(y,"click",function(){is_function(p[1]?p[4]:null)&&(p[1]?p[4]:null).apply(this,arguments)}),k=!0)},p(M,[T]){p=M,T&8&&set_data(m,p[3]),T&8&&attr(f,"title",p[3]),T&4&&set_data(w,p[2]),T&4&&attr(y,"title",p[2]),T&2&&toggle_class(y,"copyable",p[1]),T&1&&toggle_class(y,"empty",p[0])},i:noop$2,o:noop$2,d(M){M&&detach(u),k=!1,S()}}}function instance$b(p,u,f){let m,v,y,w,{label:k}=u,{value:S}=u,{copyable:M=!1}=u;const T=async()=>{try{await copyToClipboard(S),notificationStore.actions.success("Copied to clipboard")}catch{notificationStore.actions.error("Failed to copy to clipboard. Check the dev console for the value."),console.warn("Failed to copy the value",S)}};return p.$$set=E=>{"label"in E&&f(5,k=E.label),"value"in E&&f(6,S=E.value),"copyable"in E&&f(7,M=E.copyable)},p.$$.update=()=>{p.$$.dirty&32&&f(3,m=k??"-"),p.$$.dirty&64&&f(2,v=S??"-"),p.$$.dirty&64&&f(0,y=S==null),p.$$.dirty&129&&f(1,w=M&&!y)},[y,w,v,m,T,k,S,M]}class DevToolsStat extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$b,create_fragment$c,safe_not_equal,{label:5,value:6,copyable:7})}}function create_if_block$6(p){let u,f;return u=new DevToolsStat({props:{label:"Client load time",value:`${p[0].clientLoadTime} ms`}}),{c(){create_component(u.$$.fragment)},m(m,v){mount_component(u,m,v),f=!0},p(m,v){const y={};v&1&&(y.value=`${m[0].clientLoadTime} ms`),u.$set(y)},i(m){f||(transition_in(u.$$.fragment,m),f=!0)},o(m){transition_out(u.$$.fragment,m),f=!1},d(m){destroy_component(u,m)}}}function create_default_slot$9(p){var he,fe,pe,ve,Ae,ze,Se;let u,f,m,v,y,w,k,S,M,T,E,H,F,Z,$,J,se;u=new DevToolsStat({props:{label:"App",value:(he=p[0].application)==null?void 0:he.name}}),m=new DevToolsStat({props:{label:"Tenant",value:(fe=p[0].application)==null?void 0:fe.tenantId}}),y=new DevToolsStat({props:{label:"Version",value:(pe=p[0].application)==null?void 0:pe.version}});let ie=p[0].clientLoadTime&&create_if_block$6(p);return S=new DevToolsStat({props:{label:"App screens",value:((ve=p[1].screens)==null?void 0:ve.length)||0}}),T=new DevToolsStat({props:{label:"Active screen",value:(Ae=p[1].activeScreen)==null?void 0:Ae.routing.route}}),H=new DevToolsStat({props:{label:"Components",value:p[2].mountedComponentCount}}),Z=new DevToolsStat({props:{label:"User",value:(ze=p[3])==null?void 0:ze.email}}),J=new DevToolsStat({props:{label:"Role",value:(Se=p[3])==null?void 0:Se.roleId}}),{c(){create_component(u.$$.fragment),f=space(),create_component(m.$$.fragment),v=space(),create_component(y.$$.fragment),w=space(),ie&&ie.c(),k=space(),create_component(S.$$.fragment),M=space(),create_component(T.$$.fragment),E=space(),create_component(H.$$.fragment),F=space(),create_component(Z.$$.fragment),$=space(),create_component(J.$$.fragment)},m(Le,Ce){mount_component(u,Le,Ce),insert(Le,f,Ce),mount_component(m,Le,Ce),insert(Le,v,Ce),mount_component(y,Le,Ce),insert(Le,w,Ce),ie&&ie.m(Le,Ce),insert(Le,k,Ce),mount_component(S,Le,Ce),insert(Le,M,Ce),mount_component(T,Le,Ce),insert(Le,E,Ce),mount_component(H,Le,Ce),insert(Le,F,Ce),mount_component(Z,Le,Ce),insert(Le,$,Ce),mount_component(J,Le,Ce),se=!0},p(Le,Ce){var ft,Mt,$e,je,Ct,yt,ot;const Ue={};Ce&1&&(Ue.value=(ft=Le[0].application)==null?void 0:ft.name),u.$set(Ue);const Ze={};Ce&1&&(Ze.value=(Mt=Le[0].application)==null?void 0:Mt.tenantId),m.$set(Ze);const Ge={};Ce&1&&(Ge.value=($e=Le[0].application)==null?void 0:$e.version),y.$set(Ge),Le[0].clientLoadTime?ie?(ie.p(Le,Ce),Ce&1&&transition_in(ie,1)):(ie=create_if_block$6(Le),ie.c(),transition_in(ie,1),ie.m(k.parentNode,k)):ie&&(group_outros(),transition_out(ie,1,1,()=>{ie=null}),check_outros());const be={};Ce&2&&(be.value=((je=Le[1].screens)==null?void 0:je.length)||0),S.$set(be);const De={};Ce&2&&(De.value=(Ct=Le[1].activeScreen)==null?void 0:Ct.routing.route),T.$set(De);const Ke={};Ce&4&&(Ke.value=Le[2].mountedComponentCount),H.$set(Ke);const He={};Ce&8&&(He.value=(yt=Le[3])==null?void 0:yt.email),Z.$set(He);const rt={};Ce&8&&(rt.value=(ot=Le[3])==null?void 0:ot.roleId),J.$set(rt)},i(Le){se||(transition_in(u.$$.fragment,Le),transition_in(m.$$.fragment,Le),transition_in(y.$$.fragment,Le),transition_in(ie),transition_in(S.$$.fragment,Le),transition_in(T.$$.fragment,Le),transition_in(H.$$.fragment,Le),transition_in(Z.$$.fragment,Le),transition_in(J.$$.fragment,Le),se=!0)},o(Le){transition_out(u.$$.fragment,Le),transition_out(m.$$.fragment,Le),transition_out(y.$$.fragment,Le),transition_out(ie),transition_out(S.$$.fragment,Le),transition_out(T.$$.fragment,Le),transition_out(H.$$.fragment,Le),transition_out(Z.$$.fragment,Le),transition_out(J.$$.fragment,Le),se=!1},d(Le){Le&&(detach(f),detach(v),detach(w),detach(k),detach(M),detach(E),detach(F),detach($)),destroy_component(u,Le),destroy_component(m,Le),destroy_component(y,Le),ie&&ie.d(Le),destroy_component(S,Le),destroy_component(T,Le),destroy_component(H,Le),destroy_component(Z,Le),destroy_component(J,Le)}}}function create_fragment$b(p){let u,f;return u=new Layout$1({props:{noPadding:!0,gap:"XS",$$slots:{default:[create_default_slot$9]},$$scope:{ctx:p}}}),{c(){create_component(u.$$.fragment)},m(m,v){mount_component(u,m,v),f=!0},p(m,[v]){const y={};v&31&&(y.$$scope={dirty:v,ctx:m}),u.$set(y)},i(m){f||(transition_in(u.$$.fragment,m),f=!0)},o(m){transition_out(u.$$.fragment,m),f=!1},d(m){destroy_component(u,m)}}}function instance$a(p,u,f){let m,v,y,w;return component_subscribe(p,appStore,k=>f(0,m=k)),component_subscribe(p,screenStore,k=>f(1,v=k)),component_subscribe(p,componentStore,k=>f(2,y=k)),component_subscribe(p,authStore,k=>f(3,w=k)),[m,v,y,w]}class DevToolsStatsTab extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$a,create_fragment$b,safe_not_equal,{})}}function get_each_context$3(p,u,f){const m=p.slice();return m[7]=u[f],m}function create_each_block$3(p){var m;let u,f;return u=new DevToolsStat({props:{copyable:!0,label:p[7].label,value:JSON.stringify((m=p[0]?p[1]:p[2])==null?void 0:m[p[7].key])}}),{c(){create_component(u.$$.fragment)},m(v,y){mount_component(u,v,y),f=!0},p(v,y){var k;const w={};y&8&&(w.label=v[7].label),y&15&&(w.value=JSON.stringify((k=v[0]?v[1]:v[2])==null?void 0:k[v[7].key])),u.$set(w)},i(v){f||(transition_in(u.$$.fragment,v),f=!0)},o(v){transition_out(u.$$.fragment,v),f=!1},d(v){destroy_component(u,v)}}}function create_default_slot_1$5(p){let u,f,m=ensure_array_like(p[3]),v=[];for(let w=0;w<m.length;w+=1)v[w]=create_each_block$3(get_each_context$3(p,m,w));const y=w=>transition_out(v[w],1,1,()=>{v[w]=null});return{c(){for(let w=0;w<v.length;w+=1)v[w].c();u=empty$1()},m(w,k){for(let S=0;S<v.length;S+=1)v[S]&&v[S].m(w,k);insert(w,u,k),f=!0},p(w,k){if(k&15){m=ensure_array_like(w[3]);let S;for(S=0;S<m.length;S+=1){const M=get_each_context$3(w,m,S);v[S]?(v[S].p(M,k),transition_in(v[S],1)):(v[S]=create_each_block$3(M),v[S].c(),transition_in(v[S],1),v[S].m(u.parentNode,u))}for(group_outros(),S=m.length;S<v.length;S+=1)y(S);check_outros()}},i(w){if(!f){for(let k=0;k<m.length;k+=1)transition_in(v[k]);f=!0}},o(w){v=v.filter(Boolean);for(let k=0;k<v.length;k+=1)transition_out(v[k]);f=!1},d(w){w&&detach(u),destroy_each(v,w)}}}function create_default_slot$8(p){let u,f,m,v,y;function w(S){p[6](S)}let k={text:"Show enriched settings"};return p[0]!==void 0&&(k.value=p[0]),u=new Toggle({props:k}),binding_callbacks.push(()=>bind(u,"value",w)),v=new Layout$1({props:{noPadding:!0,gap:"XS",$$slots:{default:[create_default_slot_1$5]},$$scope:{ctx:p}}}),{c(){create_component(u.$$.fragment),m=space(),create_component(v.$$.fragment)},m(S,M){mount_component(u,S,M),insert(S,m,M),mount_component(v,S,M),y=!0},p(S,M){const T={};!f&&M&1&&(f=!0,T.value=S[0],add_flush_callback(()=>f=!1)),u.$set(T);const E={};M&1039&&(E.$$scope={dirty:M,ctx:S}),v.$set(E)},i(S){y||(transition_in(u.$$.fragment,S),transition_in(v.$$.fragment,S),y=!0)},o(S){transition_out(u.$$.fragment,S),transition_out(v.$$.fragment,S),y=!1},d(S){S&&detach(m),destroy_component(u,S),destroy_component(v,S)}}}function create_fragment$a(p){let u,f;return u=new Layout$1({props:{noPadding:!0,gap:"S",$$slots:{default:[create_default_slot$8]},$$scope:{ctx:p}}}),{c(){create_component(u.$$.fragment)},m(m,v){mount_component(u,m,v),f=!0},p(m,[v]){const y={};v&1039&&(y.$$scope={dirty:v,ctx:m}),u.$set(y)},i(m){f||(transition_in(u.$$.fragment,m),f=!0)},o(m){transition_out(u.$$.fragment,m),f=!1},d(m){destroy_component(u,m)}}}function instance$9(p,u,f){let m,v,y,w,k;component_subscribe(p,componentStore,T=>f(5,k=T));let S=!0;function M(T){S=T,f(0,S)}return p.$$.update=()=>{p.$$.dirty&32&&f(4,m=k.selectedComponentInstance),p.$$.dirty&32&&f(3,v=getSettingsDefinition(k.selectedComponentDefinition)),p.$$.dirty&16&&f(2,y=m==null?void 0:m.getRawSettings()),p.$$.dirty&16&&f(1,w=m==null?void 0:m.getSettings())},[S,w,y,v,m,k,M]}class DevToolsComponentSettingsTab extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$9,create_fragment$a,safe_not_equal,{})}}function get_each_context$2(p,u,f){const m=p.slice();return m[9]=u[f],m}function create_default_slot_3$3(p){let u;return{c(){u=text$1("Choose a category to see the value of all its available bindings.")},m(f,m){insert(f,u,m)},d(f){f&&detach(u)}}}function create_if_block_1$2(p){let u,f;return u=new Body({props:{size:"XS",$$slots:{default:[create_default_slot_2$4]},$$scope:{ctx:p}}}),{c(){create_component(u.$$.fragment)},m(m,v){mount_component(u,m,v),f=!0},p(m,v){const y={};v&4096&&(y.$$scope={dirty:v,ctx:m}),u.$set(y)},i(m){f||(transition_in(u.$$.fragment,m),f=!0)},o(m){transition_out(u.$$.fragment,m),f=!1},d(m){destroy_component(u,m)}}}function create_if_block$5(p){let u,f;return u=new Layout$1({props:{noPadding:!0,gap:"XS",$$slots:{default:[create_default_slot_1$4]},$$scope:{ctx:p}}}),{c(){create_component(u.$$.fragment)},m(m,v){mount_component(u,m,v),f=!0},p(m,v){const y={};v&4098&&(y.$$scope={dirty:v,ctx:m}),u.$set(y)},i(m){f||(transition_in(u.$$.fragment,m),f=!0)},o(m){transition_out(u.$$.fragment,m),f=!1},d(m){destroy_component(u,m)}}}function create_default_slot_2$4(p){let u;return{c(){u=text$1("There aren't any bindings available in this category.")},m(f,m){insert(f,u,m)},d(f){f&&detach(u)}}}function create_each_block$2(p){let u,f;return u=new DevToolsStat({props:{copyable:!0,label:p[9][0],value:JSON.stringify(p[9][1])}}),{c(){create_component(u.$$.fragment)},m(m,v){mount_component(u,m,v),f=!0},p(m,v){const y={};v&2&&(y.label=m[9][0]),v&2&&(y.value=JSON.stringify(m[9][1])),u.$set(y)},i(m){f||(transition_in(u.$$.fragment,m),f=!0)},o(m){transition_out(u.$$.fragment,m),f=!1},d(m){destroy_component(u,m)}}}function create_default_slot_1$4(p){let u,f,m=ensure_array_like(p[1]),v=[];for(let w=0;w<m.length;w+=1)v[w]=create_each_block$2(get_each_context$2(p,m,w));const y=w=>transition_out(v[w],1,1,()=>{v[w]=null});return{c(){for(let w=0;w<v.length;w+=1)v[w].c();u=empty$1()},m(w,k){for(let S=0;S<v.length;S+=1)v[S]&&v[S].m(w,k);insert(w,u,k),f=!0},p(w,k){if(k&2){m=ensure_array_like(w[1]);let S;for(S=0;S<m.length;S+=1){const M=get_each_context$2(w,m,S);v[S]?(v[S].p(M,k),transition_in(v[S],1)):(v[S]=create_each_block$2(M),v[S].c(),transition_in(v[S],1),v[S].m(u.parentNode,u))}for(group_outros(),S=m.length;S<v.length;S+=1)y(S);check_outros()}},i(w){if(!f){for(let k=0;k<m.length;k+=1)transition_in(v[k]);f=!0}},o(w){v=v.filter(Boolean);for(let k=0;k<v.length;k+=1)transition_out(v[k]);f=!1},d(w){w&&detach(u),destroy_each(v,w)}}}function create_default_slot$7(p){let u,f,m,v,y,w,k,S,M;u=new Body({props:{size:"S",$$slots:{default:[create_default_slot_3$3]},$$scope:{ctx:p}}});function T($){p[6]($)}let E={label:"Category",options:p[2]};p[0]!==void 0&&(E.value=p[0]),m=new Select_1({props:E}),binding_callbacks.push(()=>bind(m,"value",T));const H=[create_if_block$5,create_if_block_1$2],F=[];function Z($,J){var se;return(se=$[1])!=null&&se.length?0:$[0]?1:-1}return~(w=Z(p))&&(k=F[w]=H[w](p)),{c(){create_component(u.$$.fragment),f=space(),create_component(m.$$.fragment),y=space(),k&&k.c(),S=empty$1()},m($,J){mount_component(u,$,J),insert($,f,J),mount_component(m,$,J),insert($,y,J),~w&&F[w].m($,J),insert($,S,J),M=!0},p($,J){const se={};J&4096&&(se.$$scope={dirty:J,ctx:$}),u.$set(se);const ie={};J&4&&(ie.options=$[2]),!v&&J&1&&(v=!0,ie.value=$[0],add_flush_callback(()=>v=!1)),m.$set(ie);let he=w;w=Z($),w===he?~w&&F[w].p($,J):(k&&(group_outros(),transition_out(F[he],1,1,()=>{F[he]=null}),check_outros()),~w?(k=F[w],k?k.p($,J):(k=F[w]=H[w]($),k.c()),transition_in(k,1),k.m(S.parentNode,S)):k=null)},i($){M||(transition_in(u.$$.fragment,$),transition_in(m.$$.fragment,$),transition_in(k),M=!0)},o($){transition_out(u.$$.fragment,$),transition_out(m.$$.fragment,$),transition_out(k),M=!1},d($){$&&(detach(f),detach(y),detach(S)),destroy_component(u,$),destroy_component(m,$),~w&&F[w].d($)}}}function create_fragment$9(p){let u,f;return u=new Layout$1({props:{noPadding:!0,gap:"S",$$slots:{default:[create_default_slot$7]},$$scope:{ctx:p}}}),{c(){create_component(u.$$.fragment)},m(m,v){mount_component(u,m,v),f=!0},p(m,[v]){const y={};v&4103&&(y.$$scope={dirty:v,ctx:m}),u.$set(y)},i(m){f||(transition_in(u.$$.fragment,m),f=!0)},o(m){transition_out(u.$$.fragment,m),f=!1},d(m){destroy_component(u,m)}}}function instance$8(p,u,f){let m,v,y,w,k;component_subscribe(p,componentStore,H=>f(5,k=H));const S={user:"Current user",state:"State",url:"URL",device:"Device",rowSelection:"Selected rows"};let M;const T=H=>{const F={...H};delete F.key,delete F.closestComponentId,delete F.user_RefreshDataSource;let Z=[],$=[];return Object.keys(F).sort().forEach(J=>{let se=!1;for(let ie of Z)if(J.startsWith(`${ie}_`)){se=!0;break}if(!se)if(Z.push(J),S[J])$.push({label:S[J],value:J});else{const ie=componentStore.actions.getComponentById(J);if(ie)$.push({label:ie._instanceName,value:J});else{if(J.includes("-")){const he=J.split("-"),fe=he[0],pe=componentStore.actions.getComponentById(fe);if(pe){$.push({label:`${pe._instanceName} (${he[1]})`,value:J});return}}$.push({label:"Unknown - "+J,value:J})}}}),$};function E(H){M=H,f(0,M)}return p.$$.update=()=>{p.$$.dirty&32&&f(4,m=k.selectedComponentInstance),p.$$.dirty&16&&f(3,v=m==null?void 0:m.getDataContext()),p.$$.dirty&8&&f(2,y=T(v)),p.$$.dirty&9&&f(1,w=Object.entries((v==null?void 0:v[M])||{}))},[M,w,y,v,m,k,E]}class DevToolsComponentContextTab extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$8,create_fragment$9,safe_not_equal,{})}}const DevToolsComponentTab_svelte_svelte_type_style_lang="";function create_else_block$1(p){let u,f;return u=new Layout$1({props:{noPadding:!0,gap:"S",$$slots:{default:[create_default_slot_4$2]},$$scope:{ctx:p}}}),{c(){create_component(u.$$.fragment)},m(m,v){mount_component(u,m,v),f=!0},p(m,v){const y={};v&33&&(y.$$scope={dirty:v,ctx:m}),u.$set(y)},i(m){f||(transition_in(u.$$.fragment,m),f=!0)},o(m){transition_out(u.$$.fragment,m),f=!1},d(m){destroy_component(u,m)}}}function create_if_block$4(p){let u,f;return u=new Layout$1({props:{noPadding:!0,gap:"S",$$slots:{default:[create_default_slot$6]},$$scope:{ctx:p}}}),{c(){create_component(u.$$.fragment)},m(m,v){mount_component(u,m,v),f=!0},p(m,v){const y={};v&32&&(y.$$scope={dirty:v,ctx:m}),u.$set(y)},i(m){f||(transition_in(u.$$.fragment,m),f=!0)},o(m){transition_out(u.$$.fragment,m),f=!1},d(m){destroy_component(u,m)}}}function create_default_slot_12$1(p){var m;let u=((m=p[0].selectedComponent)==null?void 0:m._instanceName)+"",f;return{c(){f=text$1(u)},m(v,y){insert(v,f,y)},p(v,y){var w;y&1&&u!==(u=((w=v[0].selectedComponent)==null?void 0:w._instanceName)+"")&&set_data(f,u)},d(v){v&&detach(f)}}}function create_default_slot_11$1(p){var y,w;let u,f,m,v;return u=new DevToolsStat({props:{label:"Type",value:(y=p[0].selectedComponentDefinition)==null?void 0:y.name}}),m=new DevToolsStat({props:{copyable:!0,label:"Component ID",value:(w=p[0].selectedComponent)==null?void 0:w._id}}),{c(){create_component(u.$$.fragment),f=space(),create_component(m.$$.fragment)},m(k,S){mount_component(u,k,S),insert(k,f,S),mount_component(m,k,S),v=!0},p(k,S){var E,H;const M={};S&1&&(M.value=(E=k[0].selectedComponentDefinition)==null?void 0:E.name),u.$set(M);const T={};S&1&&(T.value=(H=k[0].selectedComponent)==null?void 0:H._id),m.$set(T)},i(k){v||(transition_in(u.$$.fragment,k),transition_in(m.$$.fragment,k),v=!0)},o(k){transition_out(u.$$.fragment,k),transition_out(m.$$.fragment,k),v=!1},d(k){k&&detach(f),destroy_component(u,k),destroy_component(m,k)}}}function create_default_slot_10$1(p){let u;return{c(){u=text$1("Change component")},m(f,m){insert(f,u,m)},d(f){f&&detach(u)}}}function create_default_slot_9$1(p){let u;return{c(){u=text$1("Reset")},m(f,m){insert(f,u,m)},d(f){f&&detach(u)}}}function create_default_slot_8$1(p){let u,f,m;return f=new DevToolsComponentSettingsTab({}),{c(){u=element("div"),create_component(f.$$.fragment),attr(u,"class","tab-content svelte-1rbkjdg")},m(v,y){insert(v,u,y),mount_component(f,u,null),m=!0},p:noop$2,i(v){m||(transition_in(f.$$.fragment,v),m=!0)},o(v){transition_out(f.$$.fragment,v),m=!1},d(v){v&&detach(u),destroy_component(f)}}}function create_default_slot_7$1(p){let u,f,m;return f=new DevToolsComponentContextTab({}),{c(){u=element("div"),create_component(f.$$.fragment),attr(u,"class","tab-content svelte-1rbkjdg")},m(v,y){insert(v,u,y),mount_component(f,u,null),m=!0},p:noop$2,i(v){m||(transition_in(f.$$.fragment,v),m=!0)},o(v){transition_out(f.$$.fragment,v),m=!1},d(v){v&&detach(u),destroy_component(f)}}}function create_default_slot_6$1(p){let u,f,m,v;return u=new Tab({props:{title:"Settings",$$slots:{default:[create_default_slot_8$1]},$$scope:{ctx:p}}}),m=new Tab({props:{title:"Bindings",$$slots:{default:[create_default_slot_7$1]},$$scope:{ctx:p}}}),{c(){create_component(u.$$.fragment),f=space(),create_component(m.$$.fragment)},m(y,w){mount_component(u,y,w),insert(y,f,w),mount_component(m,y,w),v=!0},p(y,w){const k={};w&32&&(k.$$scope={dirty:w,ctx:y}),u.$set(k);const S={};w&32&&(S.$$scope={dirty:w,ctx:y}),m.$set(S)},i(y){v||(transition_in(u.$$.fragment,y),transition_in(m.$$.fragment,y),v=!0)},o(y){transition_out(u.$$.fragment,y),transition_out(m.$$.fragment,y),v=!1},d(y){y&&detach(f),destroy_component(u,y),destroy_component(m,y)}}}function create_default_slot_5$1(p){let u,f;return u=new Tabs({props:{selected:"Settings",$$slots:{default:[create_default_slot_6$1]},$$scope:{ctx:p}}}),{c(){create_component(u.$$.fragment)},m(m,v){mount_component(u,m,v),f=!0},p(m,v){const y={};v&32&&(y.$$scope={dirty:v,ctx:m}),u.$set(y)},i(m){f||(transition_in(u.$$.fragment,m),f=!0)},o(m){transition_out(u.$$.fragment,m),f=!1},d(m){destroy_component(u,m)}}}function create_default_slot_4$2(p){let u,f,m,v,y,w,k,S,M,T,E,H;return u=new Heading$1({props:{size:"XS",$$slots:{default:[create_default_slot_12$1]},$$scope:{ctx:p}}}),m=new Layout$1({props:{noPadding:!0,gap:"XS",$$slots:{default:[create_default_slot_11$1]},$$scope:{ctx:p}}}),w=new Button$1({props:{cta:!0,$$slots:{default:[create_default_slot_10$1]},$$scope:{ctx:p}}}),w.$on("click",p[3]),S=new Button$1({props:{quiet:!0,secondary:!0,$$slots:{default:[create_default_slot_9$1]},$$scope:{ctx:p}}}),S.$on("click",p[4]),E=new Layout$1({props:{noPadding:!0,gap:"XS",$$slots:{default:[create_default_slot_5$1]},$$scope:{ctx:p}}}),{c(){create_component(u.$$.fragment),f=space(),create_component(m.$$.fragment),v=space(),y=element("div"),create_component(w.$$.fragment),k=space(),create_component(S.$$.fragment),M=space(),T=element("div"),create_component(E.$$.fragment),attr(y,"class","buttons svelte-1rbkjdg"),attr(T,"class","data svelte-1rbkjdg")},m(F,Z){mount_component(u,F,Z),insert(F,f,Z),mount_component(m,F,Z),insert(F,v,Z),insert(F,y,Z),mount_component(w,y,null),append$2(y,k),mount_component(S,y,null),insert(F,M,Z),insert(F,T,Z),mount_component(E,T,null),H=!0},p(F,Z){const $={};Z&33&&($.$$scope={dirty:Z,ctx:F}),u.$set($);const J={};Z&33&&(J.$$scope={dirty:Z,ctx:F}),m.$set(J);const se={};Z&32&&(se.$$scope={dirty:Z,ctx:F}),w.$set(se);const ie={};Z&32&&(ie.$$scope={dirty:Z,ctx:F}),S.$set(ie);const he={};Z&32&&(he.$$scope={dirty:Z,ctx:F}),E.$set(he)},i(F){H||(transition_in(u.$$.fragment,F),transition_in(m.$$.fragment,F),transition_in(w.$$.fragment,F),transition_in(S.$$.fragment,F),transition_in(E.$$.fragment,F),H=!0)},o(F){transition_out(u.$$.fragment,F),transition_out(m.$$.fragment,F),transition_out(w.$$.fragment,F),transition_out(S.$$.fragment,F),transition_out(E.$$.fragment,F),H=!1},d(F){F&&(detach(f),detach(v),detach(y),detach(M),detach(T)),destroy_component(u,F),destroy_component(m,F),destroy_component(w),destroy_component(S),destroy_component(E)}}}function create_default_slot_3$2(p){let u;return{c(){u=text$1("Please choose a component")},m(f,m){insert(f,u,m)},d(f){f&&detach(u)}}}function create_default_slot_2$3(p){let u;return{c(){u=text$1(`Press the button below to enable component selection, then click a
1213
+ `}),v&532477&&(y.$$scope={dirty:v,ctx:m}),u.$set(y)},i(m){f||(transition_in(u.$$.fragment,m),f=!0)},o(m){transition_out(u.$$.fragment,m),f=!1},d(m){destroy_component(u,m)}}}function create_fragment$L(p){let u,f;return u=new Block({props:{$$slots:{default:[create_default_slot$q]},$$scope:{ctx:p}}}),{c(){create_component(u.$$.fragment)},m(m,v){mount_component(u,m,v),f=!0},p(m,[v]){const y={};v&532479&&(y.$$scope={dirty:v,ctx:m}),u.$set(y)},i(m){f||(transition_in(u.$$.fragment,m),f=!0)},o(m){transition_out(u.$$.fragment,m),f=!1},d(m){destroy_component(u,m)}}}function instance$K(p,u,f){let{dataSource:m}=u,{height:v}=u,{cardTitle:y}=u,{cardSubtitle:w}=u,{cardDescription:k}=u,{cardImageURL:S}=u,{cardSearchField:M}=u,{detailFields:T}=u,{detailTitle:E}=u,{noRowsMessage:H}=u,{autoRefresh:F}=u;const Z=shortid.generate(),$=getContext$1("context"),{generateGoldenSample:J}=getContext$1("sdk");let se,ie;const he=()=>{var ze;const ve=((ze=get_store_value($)[se])==null?void 0:ze.rows)||[],Ae=J(ve);return{[ie]:Ae}};function fe(ve){ie=ve,f(12,ie)}function pe(ve){se=ve,f(11,se)}return p.$$set=ve=>{"dataSource"in ve&&f(0,m=ve.dataSource),"height"in ve&&f(1,v=ve.height),"cardTitle"in ve&&f(2,y=ve.cardTitle),"cardSubtitle"in ve&&f(3,w=ve.cardSubtitle),"cardDescription"in ve&&f(4,k=ve.cardDescription),"cardImageURL"in ve&&f(5,S=ve.cardImageURL),"cardSearchField"in ve&&f(6,M=ve.cardSearchField),"detailFields"in ve&&f(7,T=ve.detailFields),"detailTitle"in ve&&f(8,E=ve.detailTitle),"noRowsMessage"in ve&&f(9,H=ve.noRowsMessage),"autoRefresh"in ve&&f(10,F=ve.autoRefresh)},[m,v,y,w,k,S,M,T,E,H,F,se,ie,Z,he,fe,pe]}class RowExplorer extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$K,create_fragment$L,safe_not_equal,{dataSource:0,height:1,cardTitle:2,cardSubtitle:3,cardDescription:4,cardImageURL:5,cardSearchField:6,detailFields:7,detailTitle:8,noRowsMessage:9,autoRefresh:10,getAdditionalDataContext:14})}get getAdditionalDataContext(){return this.$$.ctx[14]}}const MultiStepFormblock_svelte_svelte_type_style_lang="";function get_each_context$a(p,u,f){const m=p.slice();return m[25]=u[f],m[27]=f,m}function get_each_context_1$1(p,u,f){const m=p.slice();return m[28]=u[f],m[30]=f,m}function create_if_block_1$a(p){let u,f;return u=new BlockComponent({props:{type:"buttongroup",props:{buttons:p[25].buttons}}}),{c(){create_component(u.$$.fragment)},m(m,v){mount_component(u,m,v),f=!0},p(m,v){const y={};v[0]&128&&(y.props={buttons:m[25].buttons}),u.$set(y)},i(m){f||(transition_in(u.$$.fragment,m),f=!0)},o(m){transition_out(u.$$.fragment,m),f=!1},d(m){destroy_component(u,m)}}}function create_default_slot_6$3(p){let u,f,m,v;u=new BlockComponent({props:{type:"heading",props:{text:p[25].title}}});let y=p[4]==="top"&&create_if_block_1$a(p);return{c(){create_component(u.$$.fragment),f=space(),y&&y.c(),m=empty$1()},m(w,k){mount_component(u,w,k),insert(w,f,k),y&&y.m(w,k),insert(w,m,k),v=!0},p(w,k){const S={};k[0]&128&&(S.props={text:w[25].title}),u.$set(S),w[4]==="top"?y?(y.p(w,k),k[0]&16&&transition_in(y,1)):(y=create_if_block_1$a(w),y.c(),transition_in(y,1),y.m(m.parentNode,m)):y&&(group_outros(),transition_out(y,1,1,()=>{y=null}),check_outros())},i(w){v||(transition_in(u.$$.fragment,w),transition_in(y),v=!0)},o(w){transition_out(u.$$.fragment,w),transition_out(y),v=!1},d(w){w&&(detach(f),detach(m)),destroy_component(u,w),y&&y.d(w)}}}function create_default_slot_5$3(p){let u,f;return u=new BlockComponent({props:{type:"container",props:{direction:"row",hAlign:"stretch",vAlign:"center",gap:"M",wrap:!0},order:0,$$slots:{default:[create_default_slot_6$3]},$$scope:{ctx:p}}}),{c(){create_component(u.$$.fragment)},m(m,v){mount_component(u,m,v),f=!0},p(m,v){const y={};v[0]&144|v[1]&1&&(y.$$scope={dirty:v,ctx:m}),u.$set(y)},i(m){f||(transition_in(u.$$.fragment,m),f=!0)},o(m){transition_out(u.$$.fragment,m),f=!1},d(m){destroy_component(u,m)}}}function create_each_block_1$1(p,u){let f,m,v;return m=new FormBlockComponent({props:{field:u[28],schema:u[6],order:u[30]}}),{key:p,first:null,c(){f=empty$1(),create_component(m.$$.fragment),this.first=f},m(y,w){insert(y,f,w),mount_component(m,y,w),v=!0},p(y,w){u=y;const k={};w[0]&128&&(k.field=u[28]),w[0]&64&&(k.schema=u[6]),w[0]&128&&(k.order=u[30]),m.$set(k)},i(y){v||(transition_in(m.$$.fragment,y),v=!0)},o(y){transition_out(m.$$.fragment,y),v=!1},d(y){y&&detach(f),destroy_component(m,y)}}}function create_default_slot_4$4(p){let u,f=[],m=new Map,v,y=ensure_array_like(p[25].fields);const w=k=>`${k[28].field||k[28].name}_${k[30]}`;for(let k=0;k<y.length;k+=1){let S=get_each_context_1$1(p,y,k),M=w(S);m.set(M,f[k]=create_each_block_1$1(M,S))}return{c(){u=element("div");for(let k=0;k<f.length;k+=1)f[k].c();attr(u,"class","form-block fields svelte-1gdgv0g"),toggle_class(u,"mobile",p[8].device.mobile)},m(k,S){insert(k,u,S);for(let M=0;M<f.length;M+=1)f[M]&&f[M].m(u,null);v=!0},p(k,S){S[0]&192&&(y=ensure_array_like(k[25].fields),group_outros(),f=update_keyed_each(f,S,w,1,k,y,m,u,outro_and_destroy_block,create_each_block_1$1,null,get_each_context_1$1),check_outros()),(!v||S[0]&256)&&toggle_class(u,"mobile",k[8].device.mobile)},i(k){if(!v){for(let S=0;S<y.length;S+=1)transition_in(f[S]);v=!0}},o(k){for(let S=0;S<f.length;S+=1)transition_out(f[S]);v=!1},d(k){k&&detach(u);for(let S=0;S<f.length;S+=1)f[S].d()}}}function create_if_block$r(p){let u,f;return u=new BlockComponent({props:{type:"buttongroup",props:{buttons:p[25].buttons,collapsed:p[25].buttonsCollapsed,collapsedText:p[25].buttonsCollapsedText},order:3}}),{c(){create_component(u.$$.fragment)},m(m,v){mount_component(u,m,v),f=!0},p(m,v){const y={};v[0]&128&&(y.props={buttons:m[25].buttons,collapsed:m[25].buttonsCollapsed,collapsedText:m[25].buttonsCollapsedText}),u.$set(y)},i(m){f||(transition_in(u.$$.fragment,m),f=!0)},o(m){transition_out(u.$$.fragment,m),f=!1},d(m){destroy_component(u,m)}}}function create_default_slot_3$7(p){let u,f,m,v,y,w,k,S;u=new BlockComponent({props:{type:"container",props:{direction:"column",gap:"S"},order:0,$$slots:{default:[create_default_slot_5$3]},$$scope:{ctx:p}}}),m=new BlockComponent({props:{type:"text",props:{text:p[25].desc},order:1}}),y=new BlockComponent({props:{type:"container",order:2,$$slots:{default:[create_default_slot_4$4]},$$scope:{ctx:p}}});let M=p[4]==="bottom"&&create_if_block$r(p);return{c(){create_component(u.$$.fragment),f=space(),create_component(m.$$.fragment),v=space(),create_component(y.$$.fragment),w=space(),M&&M.c(),k=empty$1()},m(T,E){mount_component(u,T,E),insert(T,f,E),mount_component(m,T,E),insert(T,v,E),mount_component(y,T,E),insert(T,w,E),M&&M.m(T,E),insert(T,k,E),S=!0},p(T,E){const H={};E[0]&144|E[1]&1&&(H.$$scope={dirty:E,ctx:T}),u.$set(H);const F={};E[0]&128&&(F.props={text:T[25].desc}),m.$set(F);const Z={};E[0]&448|E[1]&1&&(Z.$$scope={dirty:E,ctx:T}),y.$set(Z),T[4]==="bottom"?M?(M.p(T,E),E[0]&16&&transition_in(M,1)):(M=create_if_block$r(T),M.c(),transition_in(M,1),M.m(k.parentNode,k)):M&&(group_outros(),transition_out(M,1,1,()=>{M=null}),check_outros())},i(T){S||(transition_in(u.$$.fragment,T),transition_in(m.$$.fragment,T),transition_in(y.$$.fragment,T),transition_in(M),S=!0)},o(T){transition_out(u.$$.fragment,T),transition_out(m.$$.fragment,T),transition_out(y.$$.fragment,T),transition_out(M),S=!1},d(T){T&&(detach(f),detach(v),detach(w),detach(k)),destroy_component(u,T),destroy_component(m,T),destroy_component(y,T),M&&M.d(T)}}}function create_default_slot_2$9(p){let u,f,m;return u=new BlockComponent({props:{type:"container",props:{gap:"M",direction:"column",hAlign:"stretch",vAlign:"top",size:"shrink"},$$slots:{default:[create_default_slot_3$7]},$$scope:{ctx:p}}}),{c(){create_component(u.$$.fragment),f=space()},m(v,y){mount_component(u,v,y),insert(v,f,y),m=!0},p(v,y){const w={};y[0]&464|y[1]&1&&(w.$$scope={dirty:y,ctx:v}),u.$set(w)},i(v){m||(transition_in(u.$$.fragment,v),m=!0)},o(v){transition_out(u.$$.fragment,v),m=!1},d(v){v&&detach(f),destroy_component(u,v)}}}function create_each_block$a(p,u){let f,m,v;return m=new BlockComponent({props:{type:"formstep",props:{step:u[27]+1,_instanceName:`Step ${u[27]+1}`},$$slots:{default:[create_default_slot_2$9]},$$scope:{ctx:u}}}),{key:p,first:null,c(){f=empty$1(),create_component(m.$$.fragment),this.first=f},m(y,w){insert(y,f,w),mount_component(m,y,w),v=!0},p(y,w){u=y;const k={};w[0]&128&&(k.props={step:u[27]+1,_instanceName:`Step ${u[27]+1}`}),w[0]&464|w[1]&1&&(k.$$scope={dirty:w,ctx:u}),m.$set(k)},i(y){v||(transition_in(m.$$.fragment,y),v=!0)},o(y){transition_out(m.$$.fragment,y),v=!1},d(y){y&&detach(f),destroy_component(m,y)}}}function create_default_slot_1$d(p){let u=[],f=new Map,m,v,y=ensure_array_like(p[7]);const w=k=>k[25]._stepId;for(let k=0;k<y.length;k+=1){let S=get_each_context$a(p,y,k),M=w(S);f.set(M,u[k]=create_each_block$a(M,S))}return{c(){for(let k=0;k<u.length;k+=1)u[k].c();m=empty$1()},m(k,S){for(let M=0;M<u.length;M+=1)u[M]&&u[M].m(k,S);insert(k,m,S),v=!0},p(k,S){S[0]&464&&(y=ensure_array_like(k[7]),group_outros(),u=update_keyed_each(u,S,w,1,k,y,f,m.parentNode,outro_and_destroy_block,create_each_block$a,m,get_each_context$a),check_outros())},i(k){if(!v){for(let S=0;S<y.length;S+=1)transition_in(u[S]);v=!0}},o(k){for(let S=0;S<u.length;S+=1)transition_out(u[S]);v=!1},d(k){k&&detach(m);for(let S=0;S<u.length;S+=1)u[S].d(k)}}}function create_default_slot$p(p){let u,f;return u=new BlockComponent({props:{type:"form",context:"form",props:{size:p[5],dataSource:p[3],actionType:p[0]==="Create"?"Create":"Update",readonly:p[0]==="View"},styles:{normal:{width:"600px","margin-left":"auto","margin-right":"auto"}},$$slots:{default:[create_default_slot_1$d]},$$scope:{ctx:p}}}),{c(){create_component(u.$$.fragment)},m(m,v){mount_component(u,m,v),f=!0},p(m,v){const y={};v[0]&41&&(y.props={size:m[5],dataSource:m[3],actionType:m[0]==="Create"?"Create":"Update",readonly:m[0]==="View"}),v[0]&464|v[1]&1&&(y.$$scope={dirty:v,ctx:m}),u.$set(y)},i(m){f||(transition_in(u.$$.fragment,m),f=!0)},o(m){transition_out(u.$$.fragment,m),f=!1},d(m){destroy_component(u,m)}}}function create_fragment$K(p){let u,f;return u=new FormBlockWrapper({props:{actionType:p[0],dataSource:p[3],rowId:p[1],noRowsMessage:p[2],$$slots:{default:[create_default_slot$p]},$$scope:{ctx:p}}}),{c(){create_component(u.$$.fragment)},m(m,v){mount_component(u,m,v),f=!0},p(m,v){const y={};v[0]&1&&(y.actionType=m[0]),v[0]&8&&(y.dataSource=m[3]),v[0]&2&&(y.rowId=m[1]),v[0]&4&&(y.noRowsMessage=m[2]),v[0]&505|v[1]&1&&(y.$$scope={dirty:v,ctx:m}),u.$set(y)},i(m){f||(transition_in(u.$$.fragment,m),f=!0)},o(m){transition_out(u.$$.fragment,m),f=!1},d(m){destroy_component(u,m)}}}function instance$J(p,u,f){let m,v,y,w,k,S,M;component_subscribe(p,builderStore,Ue=>f(16,k=Ue));let{actionType:T}=u,{rowId:E}=u,{noRowsMessage:H}=u,{steps:F}=u,{dataSource:Z}=u,{buttonPosition:$="bottom"}=u,{size:J}=u;const{fetchDatasourceSchema:se,generateGoldenSample:ie}=getContext$1("sdk"),he=getContext$1("component");component_subscribe(p,he,Ue=>f(17,S=Ue));const fe=getContext$1("context");component_subscribe(p,fe,Ue=>f(8,M=Ue));const pe=writable(1);setContext("current-step",pe);let ve;const Ae=()=>{var be;const Ue=get_store_value(he).id,Ze=((be=get_store_value(fe)[`${Ue}-provider`])==null?void 0:be.rows)||[],Ge=ie(Ze);return{[`${Ue}-repeater`]:Ge}},ze=(Ue,Ze,Ge)=>{if(!Ze)return;let be=Math.min(Ge||0,Ue.length-1);be=Math.max(be,0),pe.set(be+1)},Se=async Ue=>{f(6,ve=await se(Ue)||{})},Le=(Ue,Ze)=>Ue!=null&&Ue.length?Ue.filter(Ge=>Ge.active):Object.values(Ze||{}).filter(Ge=>!Ge.autocolumn).map(Ge=>({name:Ge.name,active:!0})),Ce=(Ue,Ze,Ge)=>{const be=Ue!=null&&Ue.length?Ue:[{}];return be.map((De,Ke)=>{const{title:He,fields:rt,buttons:ft}=De,Mt=buildMultiStepFormBlockDefaultProps({_id:Ge,stepCount:be.length,currentStep:Ke,actionType:T,dataSource:Z});return{...De,_stepId:uuid(),fields:Le(rt||[],Ze),title:He??Mt.title,buttons:ft||Mt.buttons}})};return p.$$set=Ue=>{"actionType"in Ue&&f(0,T=Ue.actionType),"rowId"in Ue&&f(1,E=Ue.rowId),"noRowsMessage"in Ue&&f(2,H=Ue.noRowsMessage),"steps"in Ue&&f(11,F=Ue.steps),"dataSource"in Ue&&f(3,Z=Ue.dataSource),"buttonPosition"in Ue&&f(4,$=Ue.buttonPosition),"size"in Ue&&f(5,J=Ue.size)},p.$$.update=()=>{var Ue;p.$$.dirty[0]&131072&&f(15,m=S.id),p.$$.dirty[0]&131072&&f(14,v=S.selected),p.$$.dirty[0]&65536&&f(13,y=(Ue=k.metadata)==null?void 0:Ue.step),p.$$.dirty[0]&8&&Se(Z),p.$$.dirty[0]&34880&&f(7,w=Ce(F,ve,m)),p.$$.dirty[0]&24704&&ze(w,v,y)},[T,E,H,Z,$,J,ve,w,M,he,fe,F,Ae,y,v,m,k,S]}class MultiStepFormblock extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$J,create_fragment$K,safe_not_equal,{actionType:0,rowId:1,noRowsMessage:2,steps:11,dataSource:3,buttonPosition:4,size:5,getAdditionalDataContext:12},null,[-1,-1])}get getAdditionalDataContext(){return this.$$.ctx[12]}}function create_if_block$q(p){var w,k;let u,f,m,v;u=new Button({props:{onClick:p[8],icon:"ri-filter-3-line",text:"Filter",size:p[0],type:"secondary",quiet:!0,active:((k=(w=p[1])==null?void 0:w.groups)==null?void 0:k.length)>0}});let y={$$slots:{default:[create_default_slot$o]},$$scope:{ctx:p}};return m=new Modal({props:y}),p[19](m),{c(){create_component(u.$$.fragment),f=space(),create_component(m.$$.fragment)},m(S,M){mount_component(u,S,M),insert(S,f,M),mount_component(m,S,M),v=!0},p(S,M){var H,F;const T={};M&1&&(T.size=S[0]),M&2&&(T.active=((F=(H=S[1])==null?void 0:H.groups)==null?void 0:F.length)>0),u.$set(T);const E={};M&134217812&&(E.$$scope={dirty:M,ctx:S}),m.$set(E)},i(S){v||(transition_in(u.$$.fragment,S),transition_in(m.$$.fragment,S),v=!0)},o(S){transition_out(u.$$.fragment,S),transition_out(m.$$.fragment,S),v=!1},d(S){S&&detach(f),destroy_component(u,S),p[19](null),destroy_component(m,S)}}}function create_default_slot_1$c(p){let u,f;return u=new CoreFilterBuilder({props:{filters:p[4],schemaFields:p[6],datasource:p[2],filtersLabel:null}}),u.$on("change",p[18]),{c(){create_component(u.$$.fragment)},m(m,v){mount_component(u,m,v),f=!0},p(m,v){const y={};v&16&&(y.filters=m[4]),v&64&&(y.schemaFields=m[6]),v&4&&(y.datasource=m[2]),u.$set(y)},i(m){f||(transition_in(u.$$.fragment,m),f=!0)},o(m){transition_out(u.$$.fragment,m),f=!1},d(m){destroy_component(u,m)}}}function create_default_slot$o(p){let u,f;return u=new ModalContent({props:{title:"Edit filters",size:"XL",onConfirm:p[9],$$slots:{default:[create_default_slot_1$c]},$$scope:{ctx:p}}}),{c(){create_component(u.$$.fragment)},m(m,v){mount_component(u,m,v),f=!0},p(m,v){const y={};v&134217812&&(y.$$scope={dirty:v,ctx:m}),u.$set(y)},i(m){f||(transition_in(u.$$.fragment,m),f=!0)},o(m){transition_out(u.$$.fragment,m),f=!1},d(m){destroy_component(u,m)}}}function create_fragment$J(p){let u,f,m=p[5]&&create_if_block$q(p);return{c(){m&&m.c(),u=empty$1()},m(v,y){m&&m.m(v,y),insert(v,u,y),f=!0},p(v,[y]){v[5]?m?(m.p(v,y),y&32&&transition_in(m,1)):(m=create_if_block$q(v),m.c(),transition_in(m,1),m.m(u.parentNode,u)):m&&(group_outros(),transition_out(m,1,1,()=>{m=null}),check_outros())},i(v){f||(transition_in(m),f=!0)},o(v){transition_out(m),f=!1},d(v){v&&detach(u),m&&m.d(v)}}}function instance$I(p,u,f){let m,v,y,w,k,S,M,T,{dataProvider:E}=u,{allowedFields:H}=u,{size:F="M"}=u;const Z=getContext$1("component");component_subscribe(p,Z,Ge=>f(17,T=Ge));const{builderStore:$,ActionTypes:J,getAction:se,fetchDatasourceSchema:ie}=getContext$1("sdk");let he,fe,pe,ve=!1,Ae;async function ze(Ge){Ge&&f(12,Ae=await ie(Ge,{enrichRelationships:!0})),f(5,ve=!0)}function Se(Ge,be){if(!ve)return{};let De={};return be!=null&&be.length?be==null||be.forEach(Ke=>{Ge!=null&&Ge[Ke.name]?(De[Ke.name]=Ge[Ke.name],De[Ke.name].displayName=Ke.displayName):Ge!=null&&Ge[Ke]&&(De[Ke]=Ge[Ke])}):De=Ge||{},Object.values(De||{}).filter(Ke=>!BannedSearchTypes.includes(Ke.type)).concat(y?[{name:"_id",type:"string"}]:[])}const Le=()=>{get_store_value($).inBuilder||(f(4,fe=pe?cloneDeep$1(pe):null),he.show())},Ce=()=>{f(1,pe=parseFilter(fe))};onDestroy(()=>{k==null||k(T.id)});const Ue=Ge=>{f(4,fe=Ge.detail)};function Ze(Ge){binding_callbacks[Ge?"unshift":"push"](()=>{he=Ge,f(3,he)})}return p.$$set=Ge=>{"dataProvider"in Ge&&f(10,E=Ge.dataProvider),"allowedFields"in Ge&&f(11,H=Ge.allowedFields),"size"in Ge&&f(0,F=Ge.size)},p.$$.update=()=>{var Ge;if(p.$$.dirty&1024&&f(16,m=E==null?void 0:E.id),p.$$.dirty&1024&&f(2,v=E==null?void 0:E.datasource),p.$$.dirty&4&&(y=["table","link","viewV2"].includes(v==null?void 0:v.type)),p.$$.dirty&65536&&f(14,w=se(m,J.AddDataProviderQueryExtension)),p.$$.dirty&65536&&f(13,k=se(m,J.RemoveDataProviderQueryExtension)),p.$$.dirty&4&&ze(v),p.$$.dirty&6144&&f(6,S=Se(Ae,H)),p.$$.dirty&2&&f(15,M=(Ge=pe==null?void 0:pe.groups)==null?void 0:Ge.reduce((be,De)=>{var Ke;return be+=((Ke=De==null?void 0:De.filters)==null?void 0:Ke.length)||0,be},0)),p.$$.dirty&188418)if(M){const be=buildQuery$1(pe);delete be.onEmptyFilter,w==null||w(T.id,be)}else k==null||k(T.id)},[F,pe,v,he,fe,ve,S,Z,Le,Ce,E,H,Ae,k,w,M,m,T,Ue,Ze]}class DynamicFilter extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$I,create_fragment$J,safe_not_equal,{dataProvider:10,allowedFields:11,size:0})}}function create_default_slot$n(p){let u;const f=p[3].default,m=create_slot(f,p,p[4],null);return{c(){m&&m.c()},m(v,y){m&&m.m(v,y),u=!0},p(v,y){m&&m.p&&(!u||y&16)&&update_slot_base(m,f,v,v[4],u?get_slot_changes(f,v[4],y,null):get_all_dirty_from_scope(v[4]),null)},i(v){u||(transition_in(m,v),u=!0)},o(v){transition_out(m,v),u=!1},d(v){m&&m.d(v)}}}function create_fragment$I(p){let u,f;return u=new p[1]({props:{data:p[0],scope:p[2].Local,$$slots:{default:[create_default_slot$n]},$$scope:{ctx:p}}}),{c(){create_component(u.$$.fragment)},m(m,v){mount_component(u,m,v),f=!0},p(m,[v]){const y={};v&1&&(y.data=m[0]),v&16&&(y.$$scope={dirty:v,ctx:m}),u.$set(y)},i(m){f||(transition_in(u.$$.fragment,m),f=!0)},o(m){transition_out(u.$$.fragment,m),f=!1},d(m){destroy_component(u,m)}}}function instance$H(p,u,f){let{$$slots:m={},$$scope:v}=u,{row:y}=u;const{Provider:w,ContextScopes:k}=getContext$1("sdk");return p.$$set=S=>{"row"in S&&f(0,y=S.row),"$$scope"in S&&f(4,v=S.$$scope)},[y,w,k,m,v]}class SlotRenderer extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$H,create_fragment$I,safe_not_equal,{row:0})}}const Table_svelte_svelte_type_style_lang="";function create_default_slot_1$b(p){let u;const f=p[30].default,m=create_slot(f,p,p[32],null);return{c(){m&&m.c()},m(v,y){m&&m.m(v,y),u=!0},p(v,y){m&&m.p&&(!u||y[1]&2)&&update_slot_base(m,f,v,v[32],u?get_slot_changes(f,v[32],y,null):get_all_dirty_from_scope(v[32]),null)},i(v){u||(transition_in(m,v),u=!0)},o(v){transition_out(m,v),u=!1},d(v){m&&m.d(v)}}}function create_default_slot$m(p){var w;let u,f,m;function v(k){p[31](k)}let y={data:p[8],schema:p[12],loading:p[13],rowCount:p[1],quiet:p[2],compact:p[5],customRenderers:p[18],snippets:p[14],allowSelectRows:p[4]&&p[11],allowEditRows:!1,allowEditColumns:!1,showAutoColumns:!0,disableSorting:!0,autoSortColumns:!((w=p[0])!=null&&w.length),placeholderText:p[6]||"No rows found",$$slots:{default:[create_default_slot_1$b]},$$scope:{ctx:p}};return p[7]!==void 0&&(y.selectedRows=p[7]),u=new Table$1({props:y}),binding_callbacks.push(()=>bind(u,"selectedRows",v)),u.$on("sort",p[19]),u.$on("click",p[20]),{c(){create_component(u.$$.fragment)},m(k,S){mount_component(u,k,S),m=!0},p(k,S){var T;const M={};S[0]&256&&(M.data=k[8]),S[0]&4096&&(M.schema=k[12]),S[0]&8192&&(M.loading=k[13]),S[0]&2&&(M.rowCount=k[1]),S[0]&4&&(M.quiet=k[2]),S[0]&32&&(M.compact=k[5]),S[0]&16384&&(M.snippets=k[14]),S[0]&2064&&(M.allowSelectRows=k[4]&&k[11]),S[0]&1&&(M.autoSortColumns=!((T=k[0])!=null&&T.length)),S[0]&64&&(M.placeholderText=k[6]||"No rows found"),S[1]&2&&(M.$$scope={dirty:S,ctx:k}),!f&&S[0]&128&&(f=!0,M.selectedRows=k[7],add_flush_callback(()=>f=!1)),u.$set(M)},i(k){m||(transition_in(u.$$.fragment,k),m=!0)},o(k){transition_out(u.$$.fragment,k),m=!1},d(k){destroy_component(u,k)}}}function create_if_block$p(p){let u,f=p[7].length+"",m,v,y=p[7].length===1?"":"s",w,k;return{c(){u=element("div"),m=text$1(f),v=text$1(" row"),w=text$1(y),k=text$1(" selected"),attr(u,"class","row-count svelte-9e4ofs")},m(S,M){insert(S,u,M),append$2(u,m),append$2(u,v),append$2(u,w),append$2(u,k)},p(S,M){M[0]&128&&f!==(f=S[7].length+"")&&set_data(m,f),M[0]&128&&y!==(y=S[7].length===1?"":"s")&&set_data(w,y)},d(S){S&&detach(u)}}}function create_fragment$H(p){let u,f,m,v,y,w,k,S;f=new Provider({props:{actions:p[21],data:p[10],$$slots:{default:[create_default_slot$m]},$$scope:{ctx:p}}});let M=p[4]&&p[7].length&&create_if_block$p(p);return{c(){u=element("div"),create_component(f.$$.fragment),m=space(),M&&M.c(),attr(u,"class",v=null_to_empty(p[3])+" svelte-9e4ofs")},m(T,E){insert(T,u,E),mount_component(f,u,null),append$2(u,m),M&&M.m(u,null),w=!0,k||(S=action_destroyer(y=p[17].call(null,u,p[9].styles)),k=!0)},p(T,E){const H={};E[0]&1024&&(H.data=T[10]),E[0]&31223|E[1]&2&&(H.$$scope={dirty:E,ctx:T}),f.$set(H),T[4]&&T[7].length?M?M.p(T,E):(M=create_if_block$p(T),M.c(),M.m(u,null)):M&&(M.d(1),M=null),(!w||E[0]&8&&v!==(v=null_to_empty(T[3])+" svelte-9e4ofs"))&&attr(u,"class",v),y&&is_function(y.update)&&E[0]&512&&y.update.call(null,T[9].styles)},i(T){w||(transition_in(f.$$.fragment,T),w=!0)},o(T){transition_out(f.$$.fragment,T),w=!1},d(T){T&&detach(u),destroy_component(f),M&&M.d(),k=!1,S()}}}function instance$G(p,u,f){let m,v,y,w,k,S,M,T,E,H,F,Z,$,{$$slots:J={},$$scope:se}=u,{dataProvider:ie}=u,{columns:he}=u,{rowCount:fe}=u,{quiet:pe}=u,{size:ve}=u,{allowSelectRows:Ae}=u,{compact:ze}=u,{onClick:Se}=u,{noRowsMessage:Le}=u;const Ce=getContext$1("component");component_subscribe(p,Ce,Xe=>f(9,Z=Xe));const Ue=getContext$1("context");component_subscribe(p,Ue,Xe=>f(29,$=Xe));const{styleable:Ze,getAction:Ge,ActionTypes:be,rowSelectionStore:De,generateGoldenSample:Ke}=getContext$1("sdk"),He=`custom-${Math.random()}`,rt=[{column:He,component:SlotRenderer}];let ft=[];const Mt=()=>({eventContext:{row:Ke(w)}}),$e=(Xe,Gt,Jt,Ht)=>{if(Gt!=null&&Gt.length)return Gt;let Pt=[],Et=[];return Object.entries(Xe).forEach(([Sn,$t])=>{$t.visible!==!1&&($t!=null&&$t.autocolumn?Jt&&Et.push(Sn):Pt.push(Sn))}),Pt.concat(Et).sort((Sn,$t)=>{if(Sn===Ht)return-1;if($t===Ht)return 1;const xn=Xe[Sn].order,sn=Xe[$t].order;return xn===sn?0:xn==null?1:sn==null||xn<sn?-1:1})},je=(Xe,Gt,Jt)=>{let Ht={};return Jt&&(Ht[He]={displayName:null,order:0,sortable:!1,divider:!0,width:"auto",preventSelectRow:!0}),Gt.forEach(Pt=>{const Et=typeof Pt=="string"?Pt:Pt.name;Xe[Et]&&(Ht[Et]=Xe[Et],canBeSortColumn(Xe[Et])||(Ht[Et].sortable=!1),typeof Pt=="object"&&(Ht[Et]={...Ht[Et],...Pt}))}),Ht},Ct=Xe=>{E({column:Xe.detail.column,order:Xe.detail.order})},yt=Xe=>{Se&&Se({row:Xe.detail})},ot=[{type:be.ClearRowSelection,callback:()=>f(7,ft=[])}];onDestroy(()=>{De.actions.updateSelection(Z.id,[])});function Rt(Xe){ft=Xe,f(7,ft),f(8,w),f(22,ie)}return p.$$set=Xe=>{"dataProvider"in Xe&&f(22,ie=Xe.dataProvider),"columns"in Xe&&f(0,he=Xe.columns),"rowCount"in Xe&&f(1,fe=Xe.rowCount),"quiet"in Xe&&f(2,pe=Xe.quiet),"size"in Xe&&f(3,ve=Xe.size),"allowSelectRows"in Xe&&f(4,Ae=Xe.allowSelectRows),"compact"in Xe&&f(5,ze=Xe.compact),"onClick"in Xe&&f(23,Se=Xe.onClick),"noRowsMessage"in Xe&&f(6,Le=Xe.noRowsMessage),"$$scope"in Xe&&f(32,se=Xe.$$scope)},p.$$.update=()=>{var Xe;if(p.$$.dirty[0]&536870912&&f(14,m=$.snippets),p.$$.dirty[0]&512&&f(25,v=Z.children),p.$$.dirty[0]&4194304&&f(13,y=(ie==null?void 0:ie.loading)??!1),p.$$.dirty[0]&4194304&&f(8,w=(ie==null?void 0:ie.rows)||[]),p.$$.dirty[0]&4194304&&f(27,k=(ie==null?void 0:ie.schema)??{}),p.$$.dirty[0]&4194304&&f(28,S=ie==null?void 0:ie.primaryDisplay),p.$$.dirty[0]&402653185&&f(26,M=$e(k,he,!1,S)),p.$$.dirty[0]&234881024&&f(12,T=je(k,M,v)),p.$$.dirty[0]&4194304&&(E=Ge(ie==null?void 0:ie.id,be.SetDataProviderSorting)),p.$$.dirty[0]&4194304&&f(11,H=((Xe=ie==null?void 0:ie.datasource)==null?void 0:Xe.type)==="table"),p.$$.dirty[0]&384&&w){let Gt=w.map(Jt=>Jt._id);Gt.length&&f(7,ft=ft.filter(Jt=>Gt.includes(Jt._id)))}p.$$.dirty[0]&640&&De.actions.updateSelection(Z.id,ft.length?ft[0].tableId:"",ft.map(Gt=>Gt._id)),p.$$.dirty[0]&128&&f(10,F={selectedRows:ft})},[he,fe,pe,ve,Ae,ze,Le,ft,w,Z,F,H,T,y,m,Ce,Ue,Ze,rt,Ct,yt,ot,ie,Se,Mt,v,M,k,S,$,J,Rt,se]}class Table_1 extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$G,create_fragment$H,safe_not_equal,{dataProvider:22,columns:0,rowCount:1,quiet:2,size:3,allowSelectRows:4,compact:5,onClick:23,noRowsMessage:6,getAdditionalDataContext:24},null,[-1,-1])}get getAdditionalDataContext(){return this.$$.ctx[24]}}function get_each_context$9(p,u,f){const m=p.slice();return m[60]=u[f],m[62]=f,m}function create_if_block$o(p){let u,f;return u=new Block({props:{$$slots:{default:[create_default_slot$l]},$$scope:{ctx:p}}}),{c(){create_component(u.$$.fragment)},m(m,v){mount_component(u,m,v),f=!0},p(m,v){const y={};v[0]&2013265919|v[1]&15|v[2]&2&&(y.$$scope={dirty:v,ctx:m}),u.$set(y)},i(m){f||(transition_in(u.$$.fragment,m),f=!0)},o(m){transition_out(u.$$.fragment,m),f=!1},d(m){destroy_component(u,m)}}}function create_if_block_3$4(p){let u,f;return u=new BlockComponent({props:{type:"container",props:{direction:"row",hAlign:"stretch",vAlign:"middle",gap:"M",wrap:!0},styles:{normal:{"margin-bottom":"20px"}},order:0,$$slots:{default:[create_default_slot_5$2]},$$scope:{ctx:p}}}),{c(){create_component(u.$$.fragment)},m(m,v){mount_component(u,m,v),f=!0},p(m,v){const y={};v[0]&302002177|v[2]&2&&(y.$$scope={dirty:v,ctx:m}),u.$set(y)},i(m){f||(transition_in(u.$$.fragment,m),f=!0)},o(m){transition_out(u.$$.fragment,m),f=!1},d(m){destroy_component(u,m)}}}function create_if_block_5$3(p){let u=[],f=new Map,m,v,y=ensure_array_like(p[25]);const w=k=>k[60].name;for(let k=0;k<y.length;k+=1){let S=get_each_context$9(p,y,k),M=w(S);f.set(M,u[k]=create_each_block$9(M,S))}return{c(){for(let k=0;k<u.length;k+=1)u[k].c();m=empty$1()},m(k,S){for(let M=0;M<u.length;M+=1)u[M]&&u[M].m(k,S);insert(k,m,S),v=!0},p(k,S){S[0]&33554432&&(y=ensure_array_like(k[25]),group_outros(),u=update_keyed_each(u,S,w,1,k,y,f,m.parentNode,outro_and_destroy_block,create_each_block$9,m,get_each_context$9),check_outros())},i(k){if(!v){for(let S=0;S<y.length;S+=1)transition_in(u[S]);v=!0}},o(k){for(let S=0;S<u.length;S+=1)transition_out(u[S]);v=!1},d(k){k&&detach(m);for(let S=0;S<u.length;S+=1)u[S].d(k)}}}function create_each_block$9(p,u){let f,m,v;return m=new BlockComponent({props:{type:u[60].componentType,props:{field:u[60].name,placeholder:u[60].name,text:u[60].name,autoWidth:!0},styles:{normal:{width:"192px"}},order:u[62]}}),{key:p,first:null,c(){f=empty$1(),create_component(m.$$.fragment),this.first=f},m(y,w){insert(y,f,w),mount_component(m,y,w),v=!0},p(y,w){u=y;const k={};w[0]&33554432&&(k.type=u[60].componentType),w[0]&33554432&&(k.props={field:u[60].name,placeholder:u[60].name,text:u[60].name,autoWidth:!0}),w[0]&33554432&&(k.order=u[62]),m.$set(k)},i(y){v||(transition_in(m.$$.fragment,y),v=!0)},o(y){transition_out(m.$$.fragment,y),v=!1},d(y){y&&detach(f),destroy_component(m,y)}}}function create_if_block_4$3(p){var m;let u,f;return u=new BlockComponent({props:{type:"button",props:{onClick:p[28],text:p[13],type:"cta"},order:((m=p[25])==null?void 0:m.length)??0}}),{c(){create_component(u.$$.fragment)},m(v,y){mount_component(u,v,y),f=!0},p(v,y){var k;const w={};y[0]&268443648&&(w.props={onClick:v[28],text:v[13],type:"cta"}),y[0]&33554432&&(w.order=((k=v[25])==null?void 0:k.length)??0),u.$set(w)},i(v){f||(transition_in(u.$$.fragment,v),f=!0)},o(v){transition_out(u.$$.fragment,v),f=!1},d(v){destroy_component(u,v)}}}function create_default_slot_6$2(p){var w;let u,f,m,v=((w=p[25])==null?void 0:w.length)&&create_if_block_5$3(p),y=p[12]&&create_if_block_4$3(p);return{c(){v&&v.c(),u=space(),y&&y.c(),f=empty$1()},m(k,S){v&&v.m(k,S),insert(k,u,S),y&&y.m(k,S),insert(k,f,S),m=!0},p(k,S){var M;(M=k[25])!=null&&M.length?v?(v.p(k,S),S[0]&33554432&&transition_in(v,1)):(v=create_if_block_5$3(k),v.c(),transition_in(v,1),v.m(u.parentNode,u)):v&&(group_outros(),transition_out(v,1,1,()=>{v=null}),check_outros()),k[12]?y?(y.p(k,S),S[0]&4096&&transition_in(y,1)):(y=create_if_block_4$3(k),y.c(),transition_in(y,1),y.m(f.parentNode,f)):y&&(group_outros(),transition_out(y,1,1,()=>{y=null}),check_outros())},i(k){m||(transition_in(v),transition_in(y),m=!0)},o(k){transition_out(v),transition_out(y),m=!1},d(k){k&&(detach(u),detach(f)),v&&v.d(k),y&&y.d(k)}}}function create_default_slot_5$2(p){let u,f,m,v;return u=new BlockComponent({props:{type:"heading",props:{text:p[0]},order:0}}),m=new BlockComponent({props:{type:"container",props:{direction:"row",hAlign:"left",vAlign:"center",gap:"M",wrap:!0},order:1,$$slots:{default:[create_default_slot_6$2]},$$scope:{ctx:p}}}),{c(){create_component(u.$$.fragment),f=space(),create_component(m.$$.fragment)},m(y,w){mount_component(u,y,w),insert(y,f,w),mount_component(m,y,w),v=!0},p(y,w){const k={};w[0]&1&&(k.props={text:y[0]}),u.$set(k);const S={};w[0]&302002176|w[2]&2&&(S.$$scope={dirty:w,ctx:y}),m.$set(S)},i(y){v||(transition_in(u.$$.fragment,y),transition_in(m.$$.fragment,y),v=!0)},o(y){transition_out(u.$$.fragment,y),transition_out(m.$$.fragment,y),v=!1},d(y){y&&detach(f),destroy_component(u,y),destroy_component(m,y)}}}function create_default_slot_4$3(p){let u,f;return u=new BlockComponent({props:{type:"table",context:"table",props:{dataProvider:`{{ literal ${makePropSafe(p[26])} }}`,columns:p[5],rowCount:p[6],quiet:p[7],compact:p[8],allowSelectRows:p[10],size:p[9],onClick:p[29],noRowsMessage:p[15]||"No rows found"}}}),{c(){create_component(u.$$.fragment)},m(m,v){mount_component(u,m,v),f=!0},p(m,v){const y={};v[0]&604014560&&(y.props={dataProvider:`{{ literal ${makePropSafe(m[26])} }}`,columns:m[5],rowCount:m[6],quiet:m[7],compact:m[8],allowSelectRows:m[10],size:m[9],onClick:m[29],noRowsMessage:m[15]||"No rows found"}),u.$set(y)},i(m){f||(transition_in(u.$$.fragment,m),f=!0)},o(m){transition_out(u.$$.fragment,m),f=!1},d(m){destroy_component(u,m)}}}function create_if_block_2$7(p){let u,f,m;function v(w){p[49](w)}let y={name:"Details side panel",type:"sidepanel",context:"details-side-panel",order:2,$$slots:{default:[create_default_slot_3$6]},$$scope:{ctx:p}};return p[22]!==void 0&&(y.id=p[22]),u=new BlockComponent({props:y}),binding_callbacks.push(()=>bind(u,"id",v)),{c(){create_component(u.$$.fragment)},m(w,k){mount_component(u,w,k),m=!0},p(w,k){const S={};k[0]&1076297730|k[1]&13|k[2]&2&&(S.$$scope={dirty:k,ctx:w}),!f&&k[0]&4194304&&(f=!0,S.id=w[22],add_flush_callback(()=>f=!1)),u.$set(S)},i(w){m||(transition_in(u.$$.fragment,w),m=!0)},o(w){transition_out(u.$$.fragment,w),m=!1},d(w){destroy_component(u,w)}}}function create_default_slot_3$6(p){let u,f,m;function v(w){p[48](w)}let y={name:"Details form block",type:"formblock",context:"form-edit",props:{dataSource:p[1],buttonPosition:"top",buttons:buildFormBlockButtonConfig({_id:p[33]+"-form-edit",showDeleteButton:p[34]!=="",showSaveButton:!0,saveButtonLabel:p[17]||"Save",deleteButtonLabel:p[34],notificationOverride:p[18],actionType:"Update",dataSource:p[1]}),actionType:"Update",rowId:`{{ ${makePropSafe("state")}.${makePropSafe(p[36])} }}`,fields:p[16]||p[30],title:p[31],labelPosition:"left"}};return p[21]!==void 0&&(y.id=p[21]),u=new BlockComponent({props:y}),binding_callbacks.push(()=>bind(u,"id",v)),{c(){create_component(u.$$.fragment)},m(w,k){mount_component(u,w,k),m=!0},p(w,k){const S={};k[0]&1074200578|k[1]&13&&(S.props={dataSource:w[1],buttonPosition:"top",buttons:buildFormBlockButtonConfig({_id:w[33]+"-form-edit",showDeleteButton:w[34]!=="",showSaveButton:!0,saveButtonLabel:w[17]||"Save",deleteButtonLabel:w[34],notificationOverride:w[18],actionType:"Update",dataSource:w[1]}),actionType:"Update",rowId:`{{ ${makePropSafe("state")}.${makePropSafe(w[36])} }}`,fields:w[16]||w[30],title:w[31],labelPosition:"left"}),!f&&k[0]&2097152&&(f=!0,S.id=w[21],add_flush_callback(()=>f=!1)),u.$set(S)},i(w){m||(transition_in(u.$$.fragment,w),m=!0)},o(w){transition_out(u.$$.fragment,w),m=!1},d(w){destroy_component(u,w)}}}function create_if_block_1$9(p){let u,f,m;function v(w){p[50](w)}let y={name:"New row side panel",type:"sidepanel",context:"new-side-panel",order:3,$$slots:{default:[create_default_slot_2$8]},$$scope:{ctx:p}};return p[23]!==void 0&&(y.id=p[23]),u=new BlockComponent({props:y}),binding_callbacks.push(()=>bind(u,"id",v)),{c(){create_component(u.$$.fragment)},m(w,k){mount_component(u,w,k),m=!0},p(w,k){const S={};k[0]&1074069506|k[1]&4|k[2]&2&&(S.$$scope={dirty:k,ctx:w}),!f&&k[0]&8388608&&(f=!0,S.id=w[23],add_flush_callback(()=>f=!1)),u.$set(S)},i(w){m||(transition_in(u.$$.fragment,w),m=!0)},o(w){transition_out(u.$$.fragment,w),m=!1},d(w){destroy_component(u,w)}}}function create_default_slot_2$8(p){let u,f;return u=new BlockComponent({props:{name:"New row form block",type:"formblock",context:"form-new",props:{dataSource:p[1],buttonPosition:"top",buttons:buildFormBlockButtonConfig({_id:p[33]+"-form-new",showDeleteButton:!1,showSaveButton:!0,saveButtonLabel:"Save",notificationOverride:p[18],actionType:"Create",dataSource:p[1]}),actionType:"Create",fields:p[16]||p[30],title:"Create Row",labelPosition:"left"}}}),{c(){create_component(u.$$.fragment)},m(m,v){mount_component(u,m,v),f=!0},p(m,v){const y={};v[0]&1074069506|v[1]&4&&(y.props={dataSource:m[1],buttonPosition:"top",buttons:buildFormBlockButtonConfig({_id:m[33]+"-form-new",showDeleteButton:!1,showSaveButton:!0,saveButtonLabel:"Save",notificationOverride:m[18],actionType:"Create",dataSource:m[1]}),actionType:"Create",fields:m[16]||m[30],title:"Create Row",labelPosition:"left"}),u.$set(y)},i(m){f||(transition_in(u.$$.fragment,m),f=!0)},o(m){transition_out(u.$$.fragment,m),f=!1},d(m){destroy_component(u,m)}}}function create_default_slot_1$a(p){var F;let u,f,m,v,y,w,k,S=(p[0]||((F=p[25])==null?void 0:F.length)||p[12])&&create_if_block_3$4(p);function M(Z){p[47](Z)}let T={type:"dataprovider",props:{dataSource:p[1],filter:p[32],sortColumn:p[2]||p[24],sortOrder:p[3],paginate:p[4],limit:p[6],autoRefresh:p[19]},context:"provider",order:1,$$slots:{default:[create_default_slot_4$3]},$$scope:{ctx:p}};p[26]!==void 0&&(T.id=p[26]),f=new BlockComponent({props:T}),binding_callbacks.push(()=>bind(f,"id",M));let E=p[11]==="details"&&create_if_block_2$7(p),H=p[12]&&p[14]==="new"&&create_if_block_1$9(p);return{c(){S&&S.c(),u=space(),create_component(f.$$.fragment),v=space(),E&&E.c(),y=space(),H&&H.c(),w=empty$1()},m(Z,$){S&&S.m(Z,$),insert(Z,u,$),mount_component(f,Z,$),insert(Z,v,$),E&&E.m(Z,$),insert(Z,y,$),H&&H.m(Z,$),insert(Z,w,$),k=!0},p(Z,$){var se;Z[0]||(se=Z[25])!=null&&se.length||Z[12]?S?(S.p(Z,$),$[0]&33558529&&transition_in(S,1)):(S=create_if_block_3$4(Z),S.c(),transition_in(S,1),S.m(u.parentNode,u)):S&&(group_outros(),transition_out(S,1,1,()=>{S=null}),check_outros());const J={};$[0]&17301598|$[1]&2&&(J.props={dataSource:Z[1],filter:Z[32],sortColumn:Z[2]||Z[24],sortOrder:Z[3],paginate:Z[4],limit:Z[6],autoRefresh:Z[19]}),$[0]&604014560|$[2]&2&&(J.$$scope={dirty:$,ctx:Z}),!m&&$[0]&67108864&&(m=!0,J.id=Z[26],add_flush_callback(()=>m=!1)),f.$set(J),Z[11]==="details"?E?(E.p(Z,$),$[0]&2048&&transition_in(E,1)):(E=create_if_block_2$7(Z),E.c(),transition_in(E,1),E.m(y.parentNode,y)):E&&(group_outros(),transition_out(E,1,1,()=>{E=null}),check_outros()),Z[12]&&Z[14]==="new"?H?(H.p(Z,$),$[0]&20480&&transition_in(H,1)):(H=create_if_block_1$9(Z),H.c(),transition_in(H,1),H.m(w.parentNode,w)):H&&(group_outros(),transition_out(H,1,1,()=>{H=null}),check_outros())},i(Z){k||(transition_in(S),transition_in(f.$$.fragment,Z),transition_in(E),transition_in(H),k=!0)},o(Z){transition_out(S),transition_out(f.$$.fragment,Z),transition_out(E),transition_out(H),k=!1},d(Z){Z&&(detach(u),detach(v),detach(y),detach(w)),S&&S.d(Z),destroy_component(f,Z),E&&E.d(Z),H&&H.d(Z)}}}function create_default_slot$l(p){let u,f,m;function v(w){p[51](w)}let y={type:"form",props:{dataSource:p[1],disableSchemaValidation:!0,editAutoColumns:!0,size:p[9]},$$slots:{default:[create_default_slot_1$a]},$$scope:{ctx:p}};return p[20]!==void 0&&(y.id=p[20]),u=new BlockComponent({props:y}),binding_callbacks.push(()=>bind(u,"id",v)),{c(){create_component(u.$$.fragment)},m(w,k){mount_component(u,w,k),m=!0},p(w,k){const S={};k[0]&514&&(S.props={dataSource:w[1],disableSchemaValidation:!0,editAutoColumns:!0,size:w[9]}),k[0]&2012217343|k[1]&15|k[2]&2&&(S.$$scope={dirty:k,ctx:w}),!f&&k[0]&1048576&&(f=!0,S.id=w[20],add_flush_callback(()=>f=!1)),u.$set(S)},i(w){m||(transition_in(u.$$.fragment,w),m=!0)},o(w){transition_out(u.$$.fragment,w),m=!1},d(w){destroy_component(u,w)}}}function create_fragment$G(p){let u,f,m=p[27]&&create_if_block$o(p);return{c(){m&&m.c(),u=empty$1()},m(v,y){m&&m.m(v,y),insert(v,u,y),f=!0},p(v,y){v[27]?m?(m.p(v,y),y[0]&134217728&&transition_in(m,1)):(m=create_if_block$o(v),m.c(),transition_in(m,1),m.m(u.parentNode,u)):m&&(group_outros(),transition_out(m,1,1,()=>{m=null}),check_outros())},i(v){f||(transition_in(m),f=!0)},o(v){transition_out(m),f=!1},d(v){v&&detach(u),m&&m.d(v)}}}function instance$F(p,u,f){let m,v,y,w,k,S,M,T,E,{title:H}=u,{dataSource:F}=u,{searchColumns:Z}=u,{filter:$}=u,{sortColumn:J}=u,{sortOrder:se}=u,{paginate:ie}=u,{tableColumns:he}=u,{rowCount:fe}=u,{quiet:pe}=u,{compact:ve}=u,{size:Ae}=u,{allowSelectRows:ze}=u,{clickBehaviour:Se}=u,{onClick:Le}=u,{showTitleButton:Ce}=u,{titleButtonText:Ue}=u,{titleButtonClickBehaviour:Ze}=u,{onClickTitleButton:Ge}=u,{noRowsMessage:be}=u,{sidePanelFields:De}=u,{sidePanelShowDelete:Ke}=u,{sidePanelSaveLabel:He}=u,{sidePanelDeleteLabel:rt}=u,{notificationOverride:ft}=u,{autoRefresh:Mt}=u;const{fetchDatasourceSchema:$e,API:je,generateGoldenSample:Ct}=getContext$1("sdk"),yt=getContext$1("component");component_subscribe(p,yt,Tt=>f(46,E=Tt));const ot=getContext$1("context"),Rt=`ID_${shortid.generate()}`;let Xe,Gt,Jt,Ht,Pt,Et,cn,Sn,$t=!1;const xn=()=>{var Ut;const Tt=(Ut=get_store_value(ot)[Gt])==null?void 0:Ut.rows;return{eventContext:{row:Ct(Tt)}}},sn=Tt=>{let Zt=Ke===!1?"":Tt;return(Zt==null?void 0:Zt.trim())===""?"":Zt||"Delete"},mt=async Tt=>{if((Tt==null?void 0:Tt.type)==="table"){const Zt=await je.fetchTableDefinition(Tt==null?void 0:Tt.tableId);f(44,Et=Zt.schema),f(24,cn=Zt.primaryDisplay)}else Tt&&f(44,Et=await $e(Tt,{enrichRelationships:!0}));f(27,$t=!0)},Mn=Tt=>Tt?Object.entries(Tt).filter(Zt=>!Zt[1].autocolumn).map(Zt=>Zt[0]):[],Dt=(Tt,Zt)=>{if(!Zt||!Tt)return"Edit";const hn=`${makePropSafe(Tt+"-repeater")}.${makePropSafe(Zt)}`;return`{{#if ${hn}}}{{${hn}}}{{else}}Details{{/if}}`};function Wt(Tt){Gt=Tt,f(26,Gt)}function nn(Tt){Jt=Tt,f(21,Jt)}function Ot(Tt){Ht=Tt,f(22,Ht)}function gt(Tt){Pt=Tt,f(23,Pt)}function Xt(Tt){Xe=Tt,f(20,Xe)}return p.$$set=Tt=>{"title"in Tt&&f(0,H=Tt.title),"dataSource"in Tt&&f(1,F=Tt.dataSource),"searchColumns"in Tt&&f(37,Z=Tt.searchColumns),"filter"in Tt&&f(38,$=Tt.filter),"sortColumn"in Tt&&f(2,J=Tt.sortColumn),"sortOrder"in Tt&&f(3,se=Tt.sortOrder),"paginate"in Tt&&f(4,ie=Tt.paginate),"tableColumns"in Tt&&f(5,he=Tt.tableColumns),"rowCount"in Tt&&f(6,fe=Tt.rowCount),"quiet"in Tt&&f(7,pe=Tt.quiet),"compact"in Tt&&f(8,ve=Tt.compact),"size"in Tt&&f(9,Ae=Tt.size),"allowSelectRows"in Tt&&f(10,ze=Tt.allowSelectRows),"clickBehaviour"in Tt&&f(11,Se=Tt.clickBehaviour),"onClick"in Tt&&f(39,Le=Tt.onClick),"showTitleButton"in Tt&&f(12,Ce=Tt.showTitleButton),"titleButtonText"in Tt&&f(13,Ue=Tt.titleButtonText),"titleButtonClickBehaviour"in Tt&&f(14,Ze=Tt.titleButtonClickBehaviour),"onClickTitleButton"in Tt&&f(40,Ge=Tt.onClickTitleButton),"noRowsMessage"in Tt&&f(15,be=Tt.noRowsMessage),"sidePanelFields"in Tt&&f(16,De=Tt.sidePanelFields),"sidePanelShowDelete"in Tt&&f(41,Ke=Tt.sidePanelShowDelete),"sidePanelSaveLabel"in Tt&&f(17,He=Tt.sidePanelSaveLabel),"sidePanelDeleteLabel"in Tt&&f(42,rt=Tt.sidePanelDeleteLabel),"notificationOverride"in Tt&&f(18,ft=Tt.notificationOverride),"autoRefresh"in Tt&&f(19,Mt=Tt.autoRefresh)},p.$$.update=()=>{p.$$.dirty[1]&3072&&f(34,m=sn(rt)),p.$$.dirty[1]&32768&&f(33,v=E.id),p.$$.dirty[0]&2&&f(45,y=(F==null?void 0:F.type)==="table"||(F==null?void 0:F.type)==="viewV2"),p.$$.dirty[0]&2&&mt(F),p.$$.dirty[1]&8256&&enrichSearchColumns(Z,Et).then(Tt=>f(25,Sn=Tt)),p.$$.dirty[0]&34603008|p.$$.dirty[1]&128&&f(32,w=enrichFilter($,Sn,Xe)),p.$$.dirty[0]&18874368&&f(31,k=Dt(Jt,cn)),p.$$.dirty[1]&8192&&f(30,S=Mn(Et)),p.$$.dirty[0]&4196352|p.$$.dirty[1]&16640&&f(29,M=Se==="actions"||!y?Le:[{id:0,"##eventHandlerType":"Update State",parameters:{key:Rt,type:"set",persist:!1,value:`{{ ${makePropSafe("eventContext")}.${makePropSafe("row")}._id }}`}},{id:1,"##eventHandlerType":"Open Side Panel",parameters:{id:Ht}}]),p.$$.dirty[0]&8404992|p.$$.dirty[1]&16896&&f(28,T=Ze==="actions"||!y?Ge:[{id:0,"##eventHandlerType":"Open Side Panel",parameters:{id:Pt}}])},[H,F,J,se,ie,he,fe,pe,ve,Ae,ze,Se,Ce,Ue,Ze,be,De,He,ft,Mt,Xe,Jt,Ht,Pt,cn,Sn,Gt,$t,T,M,S,k,w,v,m,yt,Rt,Z,$,Le,Ge,Ke,rt,xn,Et,y,E,Wt,nn,Ot,gt,Xt]}class TableBlock extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$F,create_fragment$G,safe_not_equal,{title:0,dataSource:1,searchColumns:37,filter:38,sortColumn:2,sortOrder:3,paginate:4,tableColumns:5,rowCount:6,quiet:7,compact:8,size:9,allowSelectRows:10,clickBehaviour:11,onClick:39,showTitleButton:12,titleButtonText:13,titleButtonClickBehaviour:14,onClickTitleButton:40,noRowsMessage:15,sidePanelFields:16,sidePanelShowDelete:41,sidePanelSaveLabel:17,sidePanelDeleteLabel:42,notificationOverride:18,autoRefresh:19,getAdditionalDataContext:43},null,[-1,-1,-1])}get getAdditionalDataContext(){return this.$$.ctx[43]}}const Navigation_svelte_svelte_type_style_lang="";function create_if_block$n(p){let u,f,m,v,y,w;return{c(){u=element("div"),f=element("a"),m=element("img"),attr(m,"class","logo svelte-1ggxdm7"),attr(m,"alt","logo"),src_url_equal(m.src,v=p[0]||"/builder/bblogo.png")||attr(m,"src",v),attr(m,"height","48"),attr(f,"href","/"),attr(u,"class","nav__top svelte-1ggxdm7")},m(k,S){insert(k,u,S),append$2(u,f),append$2(f,m),y||(w=action_destroyer(p[3].call(null,f)),y=!0)},p(k,S){S&1&&!src_url_equal(m.src,v=k[0]||"/builder/bblogo.png")&&attr(m,"src",v)},d(k){k&&detach(u),y=!1,w()}}}function create_fragment$F(p){let u,f,m,v,y,w,k,S=!p[1]&&create_if_block$n(p);const M=p[7].default,T=create_slot(M,p,p[6],null);return{c(){u=element("div"),S&&S.c(),f=space(),m=element("div"),T&&T.c(),attr(m,"class","nav__menu svelte-1ggxdm7"),attr(u,"class","nav svelte-1ggxdm7")},m(E,H){insert(E,u,H),S&&S.m(u,null),append$2(u,f),append$2(u,m),T&&T.m(m,null),y=!0,w||(k=action_destroyer(v=p[4].call(null,u,p[2].styles)),w=!0)},p(E,[H]){E[1]?S&&(S.d(1),S=null):S?S.p(E,H):(S=create_if_block$n(E),S.c(),S.m(u,f)),T&&T.p&&(!y||H&64)&&update_slot_base(T,M,E,E[6],y?get_slot_changes(M,E[6],H,null):get_all_dirty_from_scope(E[6]),null),v&&is_function(v.update)&&H&4&&v.update.call(null,E[2].styles)},i(E){y||(transition_in(T,E),y=!0)},o(E){transition_out(T,E),y=!1},d(E){E&&detach(u),S&&S.d(),T&&T.d(E),w=!1,k()}}}function instance$E(p,u,f){let m,{$$slots:v={},$$scope:y}=u;const{linkable:w,styleable:k}=getContext$1("sdk"),S=getContext$1("component");component_subscribe(p,S,E=>f(2,m=E));let{logoUrl:M}=u,{hideLogo:T}=u;return p.$$set=E=>{"logoUrl"in E&&f(0,M=E.logoUrl),"hideLogo"in E&&f(1,T=E.hideLogo),"$$scope"in E&&f(6,y=E.$$scope)},[M,T,m,w,k,S,y,v]}class Navigation extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$E,create_fragment$F,safe_not_equal,{logoUrl:0,hideLogo:1})}}const CardHorizontal_svelte_svelte_type_style_lang="";function create_if_block$m(p){let u,f;return{c(){u=element("img"),set_style(u,"--imageWidth",p[9]),set_style(u,"--imageHeight",p[10]),attr(u,"class","image svelte-140q71n"),src_url_equal(u.src,f=p[0])||attr(u,"src",f),attr(u,"alt","")},m(m,v){insert(m,u,v)},p(m,v){v&512&&set_style(u,"--imageWidth",m[9]),v&1024&&set_style(u,"--imageHeight",m[10]),v&1&&!src_url_equal(u.src,f=m[0])&&attr(u,"src",f)},d(m){m&&detach(u)}}}function create_fragment$E(p){let u,f,m,v,y,w,k,S,M,T,E,H,F,Z,$,J,se,ie,he,fe,pe=p[11]&&create_if_block$m(p);return{c(){u=element("div"),pe&&pe.c(),f=space(),m=element("div"),v=element("main"),y=element("h2"),w=text$1(p[1]),k=space(),S=element("p"),M=text$1(p[2]),T=space(),E=element("footer"),H=element("p"),F=text$1(p[3]),Z=space(),$=element("a"),J=text$1(p[4]),attr(y,"class","heading svelte-140q71n"),attr(S,"class","text svelte-140q71n"),attr(H,"class","subtext svelte-140q71n"),set_style($,"--linkColor",p[6]),set_style($,"--linkHoverColor",p[7]),attr($,"href",se=p[5]||"/"),attr($,"class","svelte-140q71n"),attr(E,"class","svelte-140q71n"),attr(m,"class","content svelte-140q71n"),attr(u,"class","container svelte-140q71n"),set_style(u,"--cardWidth",p[8])},m(ve,Ae){insert(ve,u,Ae),pe&&pe.m(u,null),append$2(u,f),append$2(u,m),append$2(m,v),append$2(v,y),append$2(y,w),append$2(v,k),append$2(v,S),append$2(S,M),append$2(m,T),append$2(m,E),append$2(E,H),append$2(H,F),append$2(E,Z),append$2(E,$),append$2($,J),he||(fe=[action_destroyer(p[14].call(null,$)),action_destroyer(ie=p[13].call(null,u,p[12].styles))],he=!0)},p(ve,[Ae]){ve[11]?pe?pe.p(ve,Ae):(pe=create_if_block$m(ve),pe.c(),pe.m(u,f)):pe&&(pe.d(1),pe=null),Ae&2&&set_data(w,ve[1]),Ae&4&&set_data(M,ve[2]),Ae&8&&set_data(F,ve[3]),Ae&16&&set_data(J,ve[4]),Ae&64&&set_style($,"--linkColor",ve[6]),Ae&128&&set_style($,"--linkHoverColor",ve[7]),Ae&32&&se!==(se=ve[5]||"/")&&attr($,"href",se),Ae&256&&set_style(u,"--cardWidth",ve[8]),ie&&is_function(ie.update)&&Ae&4096&&ie.update.call(null,ve[12].styles)},i:noop$2,o:noop$2,d(ve){ve&&detach(u),pe&&pe.d(),he=!1,run_all(fe)}}}function instance$D(p,u,f){let m,v;const{styleable:y,linkable:w}=getContext$1("sdk"),k=getContext$1("component");component_subscribe(p,k,fe=>f(12,v=fe));const S="";let{imageUrl:M=""}=u,{heading:T=""}=u,{description:E=""}=u,{subtext:H=""}=u,{linkText:F=""}=u,{linkUrl:Z}=u,{linkColor:$}=u,{linkHoverColor:J}=u,{cardWidth:se}=u,{imageWidth:ie}=u,{imageHeight:he}=u;return p.$$set=fe=>{"imageUrl"in fe&&f(0,M=fe.imageUrl),"heading"in fe&&f(1,T=fe.heading),"description"in fe&&f(2,E=fe.description),"subtext"in fe&&f(3,H=fe.subtext),"linkText"in fe&&f(4,F=fe.linkText),"linkUrl"in fe&&f(5,Z=fe.linkUrl),"linkColor"in fe&&f(6,$=fe.linkColor),"linkHoverColor"in fe&&f(7,J=fe.linkHoverColor),"cardWidth"in fe&&f(8,se=fe.cardWidth),"imageWidth"in fe&&f(9,ie=fe.imageWidth),"imageHeight"in fe&&f(10,he=fe.imageHeight)},p.$$.update=()=>{p.$$.dirty&1&&f(11,m=!!M)},[M,T,E,H,F,Z,$,J,se,ie,he,m,v,y,w,k,S]}class CardHorizontal extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$D,create_fragment$E,safe_not_equal,{className:16,imageUrl:0,heading:1,description:2,subtext:3,linkText:4,linkUrl:5,linkColor:6,linkHoverColor:7,cardWidth:8,imageWidth:9,imageHeight:10})}get className(){return this.$$.ctx[16]}}const StackedList_svelte_svelte_type_style_lang="";function create_if_block$l(p){let u,f,m;return{c(){u=element("div"),f=element("img"),attr(f,"class","image svelte-scr5w"),src_url_equal(f.src,m=p[0])||attr(f,"src",m),attr(f,"alt",""),attr(u,"class","image-block svelte-scr5w")},m(v,y){insert(v,u,y),append$2(u,f)},p(v,y){y&1&&!src_url_equal(f.src,m=v[0])&&attr(f,"src",m)},d(v){v&&detach(u)}}}function create_fragment$D(p){let u,f,m,v,y,w,k,S,M,T,E,H,F,Z=p[4]&&create_if_block$l(p);return{c(){u=element("div"),f=element("a"),m=element("div"),Z&&Z.c(),v=space(),y=element("div"),w=element("div"),k=text$1(p[1]),S=space(),M=element("div"),T=text$1(p[2]),attr(w,"class","heading svelte-scr5w"),attr(M,"class","subheading svelte-scr5w"),attr(y,"class","content svelte-scr5w"),attr(m,"class","stackedlist svelte-scr5w"),attr(f,"href",p[3]),attr(f,"class","svelte-scr5w"),attr(u,"class","container svelte-scr5w")},m($,J){insert($,u,J),append$2(u,f),append$2(f,m),Z&&Z.m(m,null),append$2(m,v),append$2(m,y),append$2(y,w),append$2(w,k),append$2(y,S),append$2(y,M),append$2(M,T),H||(F=[action_destroyer(p[7].call(null,f)),action_destroyer(E=p[6].call(null,u,p[5].styles))],H=!0)},p($,[J]){$[4]?Z?Z.p($,J):(Z=create_if_block$l($),Z.c(),Z.m(m,v)):Z&&(Z.d(1),Z=null),J&2&&set_data(k,$[1]),J&4&&set_data(T,$[2]),J&8&&attr(f,"href",$[3]),E&&is_function(E.update)&&J&32&&E.update.call(null,$[5].styles)},i:noop$2,o:noop$2,d($){$&&detach(u),Z&&Z.d(),H=!1,run_all(F)}}}function instance$C(p,u,f){let m,v;const{styleable:y,linkable:w}=getContext$1("sdk"),k=getContext$1("component");component_subscribe(p,k,H=>f(5,v=H));let{imageUrl:S=""}=u,{heading:M=""}=u,{subheading:T=""}=u,{destinationUrl:E="/"}=u;return p.$$set=H=>{"imageUrl"in H&&f(0,S=H.imageUrl),"heading"in H&&f(1,M=H.heading),"subheading"in H&&f(2,T=H.subheading),"destinationUrl"in H&&f(3,E=H.destinationUrl)},p.$$.update=()=>{p.$$.dirty&1&&f(4,m=!!S)},[S,M,T,E,m,v,y,w,k]}class StackedList extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$C,create_fragment$D,safe_not_equal,{imageUrl:0,heading:1,subheading:2,destinationUrl:3})}}const Card_svelte_svelte_type_style_lang="";function create_if_block$k(p){let u,f;return{c(){u=element("img"),set_style(u,"--imageHeight",p[7]),attr(u,"class","image svelte-9mr74r"),src_url_equal(u.src,f=p[0])||attr(u,"src",f),attr(u,"alt","")},m(m,v){insert(m,u,v)},p(m,v){v&128&&set_style(u,"--imageHeight",m[7]),v&1&&!src_url_equal(u.src,f=m[0])&&attr(u,"src",f)},d(m){m&&detach(u)}}}function create_fragment$C(p){let u,f,m,v,y,w,k,S,M,T,E,H,F,Z,$,J=p[8]&&create_if_block$k(p);return{c(){u=element("div"),J&&J.c(),f=space(),m=element("div"),v=element("h2"),y=text$1(p[1]),w=space(),k=element("h4"),S=text$1(p[2]),M=space(),T=element("a"),E=text$1(p[3]),attr(v,"class","heading svelte-9mr74r"),attr(k,"class","text svelte-9mr74r"),set_style(T,"--linkColor",p[5]),set_style(T,"--linkHoverColor",p[6]),attr(T,"href",H=p[4]||"/"),attr(T,"class","svelte-9mr74r"),attr(m,"class","content svelte-9mr74r"),attr(u,"class","container svelte-9mr74r")},m(se,ie){insert(se,u,ie),J&&J.m(u,null),append$2(u,f),append$2(u,m),append$2(m,v),append$2(v,y),append$2(m,w),append$2(m,k),append$2(k,S),append$2(m,M),append$2(m,T),append$2(T,E),Z||($=[action_destroyer(p[11].call(null,T)),action_destroyer(F=p[10].call(null,u,p[9]))],Z=!0)},p(se,[ie]){se[8]?J?J.p(se,ie):(J=create_if_block$k(se),J.c(),J.m(u,f)):J&&(J.d(1),J=null),ie&2&&set_data(y,se[1]),ie&4&&set_data(S,se[2]),ie&8&&set_data(E,se[3]),ie&32&&set_style(T,"--linkColor",se[5]),ie&64&&set_style(T,"--linkHoverColor",se[6]),ie&16&&H!==(H=se[4]||"/")&&attr(T,"href",H),F&&is_function(F.update)&&ie&512&&F.update.call(null,se[9])},i:noop$2,o:noop$2,d(se){se&&detach(u),J&&J.d(),Z=!1,run_all($)}}}function instance$B(p,u,f){let m,v,y;const{styleable:w,linkable:k}=getContext$1("sdk"),S=getContext$1("component");component_subscribe(p,S,he=>f(15,y=he));const M="";let{imageUrl:T=""}=u,{heading:E=""}=u,{description:H=""}=u,{linkText:F=""}=u,{linkUrl:Z}=u,{linkColor:$}=u,{linkHoverColor:J}=u,{imageHeight:se}=u,{cardWidth:ie}=u;return p.$$set=he=>{"imageUrl"in he&&f(0,T=he.imageUrl),"heading"in he&&f(1,E=he.heading),"description"in he&&f(2,H=he.description),"linkText"in he&&f(3,F=he.linkText),"linkUrl"in he&&f(4,Z=he.linkUrl),"linkColor"in he&&f(5,$=he.linkColor),"linkHoverColor"in he&&f(6,J=he.linkHoverColor),"imageHeight"in he&&f(7,se=he.imageHeight),"cardWidth"in he&&f(14,ie=he.cardWidth)},p.$$.update=()=>{p.$$.dirty&49152&&f(9,m={...y.styles,normal:{...y.styles.normal,width:ie}}),p.$$.dirty&1&&f(8,v=!!T)},[T,E,H,F,Z,$,J,se,v,m,w,k,S,M,ie,y]}class Card extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$B,create_fragment$C,safe_not_equal,{className:13,imageUrl:0,heading:1,description:2,linkText:3,linkUrl:4,linkColor:5,linkHoverColor:6,imageHeight:7,cardWidth:14})}get className(){return this.$$.ctx[13]}}const AppComponents=Object.freeze(Object.defineProperty({__proto__:null,Placeholder,area:AreaChart,attachmentfield:AttachmentField,attachmentsinglefield:AttachmentSingleField,backgroundimage:BackgroundImage,bar:BarChart,bbreferencefield:BBReferenceField,bbreferencesinglefield:BBReferenceSingleField,bigintfield:BigIntField,booleanfield:BooleanField,button:Button,buttongroup:ButtonGroup,candlestick:CandleStickChart,card:Card,cardhorizontal:CardHorizontal,cardsblock:CardsBlock,cardstat:CardStat,chartblock:ChartBlock,codescanner:CodeScannerField,container:Container$8,dataprovider:DataProvider,daterangepicker:DateRangePicker,datetimefield:DateTimeField,divider:Divider,donut:DonutChart,dynamicfilter:DynamicFilter,embed:Embed,embeddedmap:EmbeddedMap,fieldgroup:FieldGroup,form:Form,formblock:FormBlock,formstep:FormStep,gridblock:GridBlock,heading:Heading,histogram:HistogramChart,icon:Icon,image:Image$1,jsonfield:JSONField,layout:Layout,line:LineChart,link:Link,longformfield:LongFormField,markdownviewer:MarkdownViewer_1,modal:Modal_1,multifieldselect:MultiFieldSelect,multistepformblock:MultiStepFormblock,navigation:Navigation,numberfield:NumberField,optionsfield:OptionsField,passwordfield:PasswordField,pie:PieChart,relationshipfield:RelationshipField,repeater:Repeater,repeaterblock:RepeaterBlock,rowexplorer:RowExplorer,s3upload:S3Upload,screenslot:ScreenSlot,section:Section,sidepanel:SidePanel,signaturesinglefield:SignatureField,spectrumcard:SpectrumCard,stackedlist:StackedList,stringfield:StringField,table:Table_1,tableblock:TableBlock,tag:Tag,text:Text$1},Symbol.toStringTag,{value:"Module"})),BudibasePrefix="@budibase/standard-components/",createComponentStore=()=>{const p=writable({customComponentManifest:{},customComponentMap:{},mountedComponents:{}}),u=derived([p,builderStore,devToolsStore,screenStore],([T,E,H,F])=>{var fe;const{inBuilder:Z,selectedComponentId:$}=E;if(!Z&&!H.visible)return{};const J=(fe=F.activeScreen)==null?void 0:fe.props,se=findComponentById(J,$),ie=w(se==null?void 0:se._component),he=findComponentPathById(J,$)||[];return{customComponentManifest:T.customComponentManifest,selectedComponentInstance:T.mountedComponents[$],selectedComponent:se,selectedComponentDefinition:ie,selectedComponentPath:he==null?void 0:he.map(pe=>pe._id),mountedComponentCount:Object.keys(T.mountedComponents).length,screenslotInstance:T.mountedComponents[ScreenslotID]}}),f=(T,E)=>{T&&p.update(H=>{const F=E.component;return F!=null&&F.startsWith("plugin")&&(H.customComponentMap[F]?H.customComponentMap[F].push(T):H.customComponentMap[F]=[T]),H.mountedComponents[T]=E,H})},m=T=>{T&&p.update(E=>{var Z,$;const H=($=(Z=E.mountedComponents[T])==null?void 0:Z.instance)==null?void 0:$.component;let F=E.customComponentMap;return H!=null&&H.startsWith("plugin")&&(F[H]=F[H].filter(J=>J!==T)),delete E.mountedComponents[T],E})},v=T=>get_store_value(p).mountedComponents[T]!=null,y=T=>{var H;const E=(H=get_store_value(screenStore).activeScreen)==null?void 0:H.props;return findComponentById(E,T)},w=T=>{var H,F;if(!T)return null;if(T===ScreenslotType&&(T=`${BudibasePrefix}${T}`),T.startsWith(BudibasePrefix))return T=T.replace(BudibasePrefix,""),T?Manifest[T]:null;const{customComponentManifest:E}=get_store_value(p);return(F=(H=E==null?void 0:E[T])==null?void 0:H.schema)==null?void 0:F.schema};return{...u,actions:{registerInstance:f,unregisterInstance:m,isComponentRegistered:v,getComponentById:y,getComponentDefinition:w,getComponentConstructor:T=>{var H;if(!T)return null;if(T===ScreenslotType)return Router_1;if(T.startsWith(BudibasePrefix)){const F=T.split("/"),Z=F[F.length-1];return AppComponents[Z]}const{customComponentManifest:E}=get_store_value(p);return(H=E==null?void 0:E[T])==null?void 0:H.Component},getComponentInstance:T=>derived(p,E=>E.mountedComponents[T]),registerCustomComponent:({Component:T,schema:E,version:H})=>{var $,J;if(!T||!(($=E==null?void 0:E.schema)!=null&&$.name)||!H)return;const F=`plugin/${E.schema.name}`;p.update(se=>(se.customComponentManifest[F]={Component:T,schema:E},se));const Z=get_store_value(p);(J=Z.customComponentMap[F])!=null&&J.length&&Z.customComponentMap[F].forEach(se=>{var ie;(ie=Z.mountedComponents[se])==null||ie.reload()})}}}},componentStore=createComponentStore(),createUploadStore=()=>{const p=writable([]),u=(v,y)=>{!v||!y||p.update(w=>(w.push({componentId:v,callback:y}),w))},f=v=>{p.update(y=>y.filter(w=>w.componentId!==v))},m=async v=>{if(!v)return;const y=get_store_value(p).find(w=>w.componentId===v);return await(y==null?void 0:y.callback())};return{subscribe:p.subscribe,actions:{registerFileUpload:u,unregisterFileUpload:f,processFileUpload:m}}},uploadStore=createUploadStore(),createRowSelectionStore=()=>{const p=writable({});function u(m,v,y){p.update(w=>(w[m]={tableId:v,selectedRows:y},w))}function f(m){const v=get_store_value(p),y=Object.keys(v).find(w=>w===m);return v[y]}return{subscribe:p.subscribe,set:p.set,actions:{updateSelection:u,getSelection:f}}},rowSelectionStore=createRowSelectionStore(),initialState={loaded:!1,cloud:!1},createEnvironmentStore=()=>{const p=writable(initialState),u={fetchEnvironment:async()=>{try{const f=await API.getEnvironment();p.set({...initialState,...f,loaded:!0})}catch{p.set(initialState)}}};return{subscribe:p.subscribe,actions:u}},environmentStore=createEnvironmentStore(),devToolsEnabled=derived([appStore,builderStore],([p,u])=>!u.inBuilder&&p.isDevApp),currentRole=derived([devToolsEnabled,devToolsStore,authStore],([p,u,f])=>p&&u.role||(f==null?void 0:f.roleId)||Roles.PUBLIC),dndComponentPath=derived([dndParent,screenStore],([p,u])=>{var v;const f=(v=u.activeScreen)==null?void 0:v.props,m=findComponentPathById(f,p)||[];return m==null?void 0:m.map(y=>y._id)}),snippets=derivedMemo([appStore,builderStore],([p,u])=>{var f;return(u==null?void 0:u.snippets)||((f=p==null?void 0:p.application)==null?void 0:f.snippets)||[]}),createRoleStore=()=>{const p=writable([]),u=async()=>{const f=await API.getAccessibleRoles();return p.set(f||[]),f};return{subscribe:p.subscribe,actions:{fetchAccessibleRoles:u}}},roleStore=createRoleStore();currentRole.subscribe(roleStore.actions.fetchAccessibleRoles);const createSidePanelStore=()=>{const u=writable({contentId:null,ignoreClicksOutside:!0}),f=derived(u,k=>({...k,open:k.contentId!=null}));let m;const v=k=>{clearTimeout(m),u.update(S=>(S.contentId=k,S))},y=()=>{m=setTimeout(()=>{u.update(k=>(k.contentId=null,k))},50)},w=k=>{u.update(S=>(S.ignoreClicksOutside=k,S))};return{subscribe:f.subscribe,actions:{open:v,close:y,setIgnoreClicksOutside:w}}},sidePanelStore=createSidePanelStore(),createModalStore=()=>{const u=writable({contentId:null}),f=v=>{u.update(y=>(y.contentId=v,y))},m=()=>{u.update(v=>(v.contentId=null,v))};return{subscribe:u.subscribe,actions:{open:f,close:m}}},modalStore=createModalStore(),createHoverStore=()=>{const p=writable({hoveredComponentId:null});let u;const f=(v,y=!0)=>{clearTimeout(u),v?m(v,y):u=setTimeout(()=>{m(v,y)},10)},m=(v,y=!0)=>{v!==get_store_value(p).hoveredComponentId&&(p.set({hoveredComponentId:v}),y&&eventStore.actions.dispatchEvent("hover-component",{id:v}))};return{...p,actions:{hoverComponent:f}}},hoverStore=createHoverStore(),createContextStore=p=>{const u=writable({});let f=[];const v=derived(p?[p,u]:[u],M=>M.reduce((T,E)=>({...T,...E}),{}));p&&p.actions.observeChanges(M=>{S(M)});const y=(M,T)=>{!M||T===void 0||(u.update(E=>(E[M]=T,E)),S(M))},w=(M,T,E)=>{if(!M||!T)return;const H=`${M}_${T}`;u.update(F=>(F[H]=E,F)),S(H)},k=M=>(f.push(M),()=>{f=f.filter(T=>T!==M)}),S=M=>{f.forEach(T=>T(M))};return{subscribe:v.subscribe,actions:{provideData:y,provideAction:w,observeChanges:k}}},createFeaturesStore=()=>derived([authStore,appStore],([p,u])=>{var w,k;const f=()=>{const S=p;if(S)return S.license},m=()=>{const S=u;if(S!=null&&S.licenseType)return S.licenseType},v=()=>{var M;let S=m();if(!S){const T=f();S=(M=T==null?void 0:T.plan)==null?void 0:M.type}return S?S===PlanType.FREE:!0},y=f();return{logoEnabled:v(),aiEnabled:((w=y==null?void 0:y.features)==null?void 0:w.includes(Feature.AI_CUSTOM_CONFIGS))||((k=y==null?void 0:y.features)==null?void 0:k.includes(Feature.BUDIBASE_AI))}}),featuresStore=createFeaturesStore(),contextActionHandler=async(p,u)=>{const f=getActionContextKey(p),m=u[f];if(m)return await m(p.parameters)},getActionContextKey=p=>{const u=p==null?void 0:p["##eventHandlerType"],f=(m,v)=>`${m}_${v}`;switch(u){case"Scroll To Field":return f(p.parameters.componentId,ActionTypes.ScrollTo);case"Update Field Value":return f(p.parameters.componentId,ActionTypes.UpdateFieldValue);case"Validate Form":return f(p.parameters.componentId,ActionTypes.ValidateForm);case"Refresh Data Provider":return f(p.parameters.componentId,ActionTypes.RefreshDatasource);case"Clear Form":return f(p.parameters.componentId,ActionTypes.ClearForm);case"Change Form Step":return f(p.parameters.componentId,ActionTypes.ChangeFormStep);case"Clear Row Selection":return f(p.parameters.componentId,ActionTypes.ClearRowSelection);default:return null}},getActionDependentContextKeys=p=>{var f;switch(p==null?void 0:p["##eventHandlerType"]){case"Save Row":case"Duplicate Row":if((f=p.parameters)!=null&&f.providerId)return[p.parameters.providerId]}return[]},saveRowHandler=async(p,u)=>{const{fields:f,providerId:m,tableId:v,notificationOverride:y}=p.parameters;let w;if(m?w={...u[m]}:w={},f)for(let[k,S]of Object.entries(f))deepSet(w,k,S);v&&(v.startsWith("view")?w._viewId=v:w.tableId=v);try{const k=await API.saveRow(w);return y||notificationStore.actions.success("Row saved"),await dataSourceStore.actions.invalidateDataSource(v,{invalidateRelationships:!0}),{row:k}}catch{return!1}},duplicateRowHandler=async(p,u)=>{const{fields:f,providerId:m,tableId:v,notificationOverride:y}=p.parameters;if(m){let w={...u[m]};if(f)for(let[k,S]of Object.entries(f))deepSet(w,k,S);v&&(v.startsWith("view")?w._viewId=v:w.tableId=v),delete w._id,delete w._rev;try{const k=await API.saveRow(w);return y||notificationStore.actions.success("Row saved"),await dataSourceStore.actions.invalidateDataSource(v,{invalidateRelationships:!0}),{row:k}}catch{return!1}}},fetchRowHandler=async p=>{const{tableId:u,rowId:f}=p.parameters;if(u&&f)try{return{row:await API.fetchRow(u,f)}}catch{return!1}},deleteRowHandler=async p=>{const{tableId:u,rowId:f,notificationOverride:m}=p.parameters;if(u&&f)try{let v,y=[];if(typeof f=="string")try{y=JSON.parse(f)}catch{y=f.split(",").map(S=>S.trim()).filter(S=>S)}else y=f;if(typeof y=="object"&&y.constructor===Object?v=[y]:Array.isArray(y)?v=y:Number.isInteger(y)&&(v=[String(y)]),!v&&!y)return notificationStore.actions.warning("No valid rows were supplied"),!1;const w=await API.deleteRows(u,v);m||notificationStore.actions.success((w==null?void 0:w.length)==1?"Row deleted":`${w.length} Rows deleted`),await dataSourceStore.actions.invalidateDataSource(u,{invalidateRelationships:!0})}catch(v){console.error(v),notificationStore.actions.error("An error occurred while executing the query")}},triggerAutomationHandler=async p=>{const{fields:u,notificationOverride:f,timeout:m}=p.parameters;try{const v=await API.triggerAutomation(p.parameters.automationId,u,m);if(v.value)return f||notificationStore.actions.success("Automation ran successfully"),{result:v};f||notificationStore.actions.success("Automation triggered")}catch{return!1}},navigationHandler=p=>{let{url:u,peek:f,externalNewTab:m,type:v}=p.parameters;v==="screen"&&u&&!u.startsWith("/")&&(u=`/${u}`),routeStore.actions.navigate(u,f,m),closeSidePanelHandler()},queryExecutionHandler=async p=>{const{queryId:u,queryParams:f,notificationOverride:m}=p.parameters;try{const v=await API.fetchQueryDefinition(u);if((v==null?void 0:v.datasourceId)==null)return notificationStore.actions.error("That query couldn't be found"),!1;const y=await API.executeQuery(u,{parameters:f});return v.readable||(m||notificationStore.actions.success("Query executed successfully"),await dataSourceStore.actions.invalidateDataSource(v.datasourceId)),{result:y}}catch{return notificationStore.actions.error("An error occurred while executing the query"),!1}},logoutHandler=async p=>{var m;await authStore.actions.logOut();let u="/builder/auth/login",f=!1;p.parameters.redirectUrl&&(f=(m=p.parameters.redirectUrl)==null?void 0:m.startsWith("/"),u=routeStore.actions.createFullURL(p.parameters.redirectUrl)),window.location.href=u,f&&window.location.reload()},closeScreenModalHandler=p=>{let u;p!=null&&p.parameters&&(u=p.parameters.url),window.parent.postMessage({type:"close-screen-modal",url:u})},updateStateHandler=p=>{var y;const{type:u,key:f,value:m,persist:v}=p.parameters;u==="set"?stateStore.actions.setValue(f,m,v):u==="delete"&&stateStore.actions.deleteValue(f),(y=get_store_value(routeStore).queryParams)!=null&&y.peek&&window.parent.postMessage({type:"update-state",detail:{type:u,key:f,value:m,persist:v}})},s3UploadHandler=async p=>{const{componentId:u}=p.parameters;if(!u)return;const f=await uploadStore.actions.processFileUpload(u);return{publicUrl:f==null?void 0:f.publicUrl}},exportDataHandler=async p=>{var S,M;let{tableComponentId:u,rows:f,type:m,columns:v,delimiter:y,customHeaders:w}=p.parameters,k;if(!(f!=null&&f.length)){const T=rowSelectionStore.actions.getSelection(u);(S=T==null?void 0:T.selectedRows)!=null&&S.length&&(f=T.selectedRows,k=T.tableId)}if(k||(k=(M=f==null?void 0:f[0])==null?void 0:M.tableId),!(f!=null&&f.length))notificationStore.actions.error("Please select at least one row");else if(!k)notificationStore.actions.error("You can only export data from table datasources");else try{typeof f[0]!="string"&&(f=f.map(E=>E._id));const T=await API.exportRows(k,m,{rows:f,columns:v==null?void 0:v.map(E=>E.name||E),delimiter:y,customHeaders:w});download(new Blob([T],{type:"text/plain"}),`${k}.${m}`)}catch{notificationStore.actions.error("There was an error exporting the data")}},continueIfHandler=p=>{const{type:u,value:f,operator:m,referenceValue:v}=p.parameters;if(!u||!m)return;let y=!1;return f==null&&v==null||f===v?y=!0:y=JSON.stringify(f)===JSON.stringify(v),u==="continue"?m==="equal"?y:!y:m==="equal"?!y:y},showNotificationHandler=p=>{var y,w;const{message:u,type:f,autoDismiss:m,duration:v}=p.parameters;!u||!f||(w=(y=notificationStore.actions)[f])==null||w.call(y,u,m,v)},promptUserHandler=()=>{},openSidePanelHandler=p=>{const{id:u}=p.parameters;u&&sidePanelStore.actions.open(u)},closeSidePanelHandler=()=>{sidePanelStore.actions.close()},openModalHandler=p=>{const{id:u}=p.parameters;u&&modalStore.actions.open(u)},closeModalHandler=()=>{modalStore.actions.close()},downloadFileHandler=async p=>{const{url:u,fileName:f}=p.parameters;try{const{type:m}=p.parameters;if(m==="attachment"){const{tableId:k,rowId:S,attachmentColumn:M}=p.parameters,T=await API.downloadAttachment(k,S,M);await downloadStream(T);return}const v=await fetch(u);if(!v.ok){notificationStore.actions.error(`Failed to download from '${u}'. Server returned status code: ${v.status}`);return}const y=URL.createObjectURL(await v.blob()),w=document.createElement("a");w.href=y,w.download=f,w.click(),URL.revokeObjectURL(y)}catch(m){console.error(m),m.status?notificationStore.actions.error(`Failed to download from '${u}'. Server returned status code: ${m.status}`):notificationStore.actions.error(`Failed to download from '${u}'.`)}},rowActionHandler=async p=>{const{resourceId:u,rowId:f,rowActionId:m}=p.parameters;await API.rowActions.trigger(u,m,f),await dataSourceStore.actions.invalidateDataSource(u,{invalidateRelationships:!0})},handlerMap={"Fetch Row":fetchRowHandler,"Save Row":saveRowHandler,"Duplicate Row":duplicateRowHandler,"Delete Row":deleteRowHandler,"Navigate To":navigationHandler,"Execute Query":queryExecutionHandler,"Trigger Automation":triggerAutomationHandler,"Log Out":logoutHandler,"Close Screen Modal":closeScreenModalHandler,"Update State":updateStateHandler,"Upload File to S3":s3UploadHandler,"Export Data":exportDataHandler,"Continue if / Stop if":continueIfHandler,"Show Notification":showNotificationHandler,"Prompt User":promptUserHandler,"Open Side Panel":openSidePanelHandler,"Close Side Panel":closeSidePanelHandler,"Open Modal":openModalHandler,"Close Modal":closeModalHandler,"Download File":downloadFileHandler,"Row Action":rowActionHandler},confirmTextMap={"Delete Row":"Are you sure you want to delete this row?","Save Row":"Are you sure you want to save this row?","Execute Query":"Are you sure you want to execute this query?","Trigger Automation":"Are you sure you want to trigger this automation?","Prompt User":"Are you sure you want to continue?","Duplicate Row":"Are you sure you want to duplicate this row?"},enrichButtonActions=(p,u)=>{if(!(p!=null&&p.length)||get_store_value(builderStore).inBuilder)return null;if(typeof p=="function")return p;const f=p.map(m=>handlerMap[m["##eventHandlerType"]]||contextActionHandler);return async m=>{var y;let v=u.actions||[];for(let w=0;w<f.length;w++)try{if(!f[w])continue;const k={...u,state:get_store_value(stateStore),actions:v,eventContext:m};let S=p[w];S=enrichDataBindings(S,k);const M=async()=>f[w](S,k);if((y=S.parameters)!=null&&y.confirm)return new Promise(T=>{var se,ie,he,fe;const E=confirmTextMap[S["##eventHandlerType"]],H=((se=S.parameters)==null?void 0:se.confirmText)||E,F=S["##eventHandlerType"],Z=((ie=S.parameters)==null?void 0:ie.customTitleText)||F,$=((he=S.parameters)==null?void 0:he.cancelButtonText)||"Cancel",J=((fe=S.parameters)==null?void 0:fe.confirmButtonText)||"Confirm";confirmationStore.actions.showConfirmation(Z,H,async()=>{const pe=await M();if(pe!==!1){v.push(pe);const ve={...u,actions:v},Ae=enrichButtonActions(p.slice(w+1),ve);T(typeof Ae=="function"?await Ae(m):!0)}else T(!1)},()=>{T(!1)},J,$)});{const T=await M();if(T===!1)return;v.push(T)}}catch(k){console.error("Error while executing button handler"),console.error(k);return}}},propsAreSame=(p,u)=>p===u?!0:typeof p=="function"||typeof u=="function"?!1:JSON.stringify(p)===JSON.stringify(u),enrichProps=(p,u,f)=>{var k;let m={...p},v={};Object.keys(m).forEach(S=>{var M;((M=f==null?void 0:f[S])==null?void 0:M.type)==="event"&&(v[S]=m[S],delete m[S])});let y=m._conditions,w=enrichDataBindings(m,u);return Object.keys(v).forEach(S=>{w[S]=enrichButtonActions(v[S],u)}),(k=w._conditions)!=null&&k.length&&w._conditions.forEach((S,M)=>{var T;((T=f==null?void 0:f[S.setting])==null?void 0:T.type)==="event"&&(S.settingValue=enrichButtonActions(y[M].settingValue,u),S.rand=Math.random())}),w},getActiveConditions=p=>p!=null&&p.length?p.filter(u=>{u.valueType==="number"?(u.referenceValue=parseFloat(u.referenceValue),u.newValue=parseFloat(u.newValue)):u.valueType==="datetime"?(u.referenceValue&&(u.referenceValue=new Date(u.referenceValue).toISOString()),u.newValue&&(u.newValue=new Date(u.newValue).toISOString())):u.valueType==="boolean"&&(u.referenceValue=`${u.referenceValue}`.toLowerCase()==="true",u.newValue=`${u.newValue}`.toLowerCase()==="true");const f={...u,type:u.valueType,field:"newValue",value:u.referenceValue};let m=buildQuery$1([f]);return m.onEmptyFilter=EmptyFilterOption.RETURN_NONE,runQuery$1([f],m).length>0}):[],reduceConditionActions=p=>{let u={},f=null;return p==null||p.forEach(m=>{m.action==="show"?f=!0:m.action==="hide"?f=!1:m.setting&&(u[m.setting]=m.settingValue)}),{settingUpdates:u,visible:f}},EmptyPlaceholder_svelte_svelte_type_style_lang="";function create_if_block$j(p){var v;let u,f=(p[0].name||((v=p[1])==null?void 0:v.name)||"Component")+"",m;return{c(){u=element("div"),m=text$1(f),attr(u,"class","component-placeholder svelte-1uv9ndz")},m(y,w){insert(y,u,w),append$2(u,m)},p(y,w){var k;w&3&&f!==(f=(y[0].name||((k=y[1])==null?void 0:k.name)||"Component")+"")&&set_data(m,f)},d(y){y&&detach(u)}}}function create_fragment$B(p){let u,f=p[2].inBuilder&&create_if_block$j(p);return{c(){f&&f.c(),u=empty$1()},m(m,v){f&&f.m(m,v),insert(m,u,v)},p(m,[v]){m[2].inBuilder?f?f.p(m,v):(f=create_if_block$j(m),f.c(),f.m(u.parentNode,u)):f&&(f.d(1),f=null)},i:noop$2,o:noop$2,d(m){m&&detach(u),f&&f.d(m)}}}function instance$A(p,u,f){let m,v,y;const w=getContext$1("component");component_subscribe(p,w,M=>f(0,v=M));const{builderStore:k,componentStore:S}=getContext$1("sdk");return component_subscribe(p,k,M=>f(2,y=M)),p.$$.update=()=>{p.$$.dirty&1&&f(1,m=S.actions.getComponentDefinition(v.type))},[v,m,y,w,k]}class EmptyPlaceholder extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$A,create_fragment$B,safe_not_equal,{})}}const ScreenPlaceholder_svelte_svelte_type_style_lang="";function create_if_block$i(p){let u,f,m,v,y,w,k;return f=new Heading$1({props:{size:"L",$$slots:{default:[create_default_slot_2$7]},$$scope:{ctx:p}}}),v=new Body({props:{$$slots:{default:[create_default_slot_1$9]},$$scope:{ctx:p}}}),w=new Button$1({props:{cta:!0,icon:"Add",$$slots:{default:[create_default_slot$k]},$$scope:{ctx:p}}}),w.$on("click",p[1].actions.requestAddComponent),{c(){u=element("div"),create_component(f.$$.fragment),m=space(),create_component(v.$$.fragment),y=space(),create_component(w.$$.fragment),attr(u,"class","placeholder svelte-1bc7j1u")},m(S,M){insert(S,u,M),mount_component(f,u,null),append$2(u,m),mount_component(v,u,null),append$2(u,y),mount_component(w,u,null),k=!0},p(S,M){const T={};M&4&&(T.$$scope={dirty:M,ctx:S}),f.$set(T);const E={};M&4&&(E.$$scope={dirty:M,ctx:S}),v.$set(E);const H={};M&4&&(H.$$scope={dirty:M,ctx:S}),w.$set(H)},i(S){k||(transition_in(f.$$.fragment,S),transition_in(v.$$.fragment,S),transition_in(w.$$.fragment,S),k=!0)},o(S){transition_out(f.$$.fragment,S),transition_out(v.$$.fragment,S),transition_out(w.$$.fragment,S),k=!1},d(S){S&&detach(u),destroy_component(f),destroy_component(v),destroy_component(w)}}}function create_default_slot_2$7(p){let u;return{c(){u=text$1("Your screen is empty")},m(f,m){insert(f,u,m)},d(f){f&&detach(u)}}}function create_default_slot_1$9(p){let u;return{c(){u=text$1("Bring your app to life by adding some components!")},m(f,m){insert(f,u,m)},d(f){f&&detach(u)}}}function create_default_slot$k(p){let u;return{c(){u=text$1("Add component")},m(f,m){insert(f,u,m)},d(f){f&&detach(u)}}}function create_fragment$A(p){let u,f,m=p[0].inBuilder&&create_if_block$i(p);return{c(){m&&m.c(),u=empty$1()},m(v,y){m&&m.m(v,y),insert(v,u,y),f=!0},p(v,[y]){v[0].inBuilder?m?(m.p(v,y),y&1&&transition_in(m,1)):(m=create_if_block$i(v),m.c(),transition_in(m,1),m.m(u.parentNode,u)):m&&(group_outros(),transition_out(m,1,1,()=>{m=null}),check_outros())},i(v){f||(transition_in(m),f=!0)},o(v){transition_out(m),f=!1},d(v){v&&detach(u),m&&m.d(v)}}}function instance$z(p,u,f){let m;const{builderStore:v}=getContext$1("sdk");return component_subscribe(p,v,y=>f(0,m=y)),[m,v]}class ScreenPlaceholder extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$z,create_fragment$A,safe_not_equal,{})}}function create_if_block$h(p){let u;function f(y,w){if(y[0].errorType==="setting")return create_if_block_1$8;if(y[0].errorType==="ancestor-setting")return create_if_block_2$6}let m=f(p),v=m&&m(p);return{c(){v&&v.c(),u=empty$1()},m(y,w){v&&v.m(y,w),insert(y,u,w)},p(y,w){m===(m=f(y))&&v?v.p(y,w):(v&&v.d(1),v=m&&m(y),v&&(v.c(),v.m(u.parentNode,u)))},d(y){y&&detach(u),v&&v.d(y)}}}function create_if_block_2$6(p){let u,f,m,v,y=p[0].ancestor.name+"",w,k,S;return{c(){u=element("span"),u.textContent="-",f=space(),m=element("span"),v=text$1("Add "),w=text$1(y),attr(m,"class","spectrum-Link")},m(M,T){insert(M,u,T),insert(M,f,T),insert(M,m,T),append$2(m,v),append$2(m,w),k||(S=listen(m,"click",p[5]),k=!0)},p(M,T){T&1&&y!==(y=M[0].ancestor.name+"")&&set_data(w,y)},d(M){M&&(detach(u),detach(f),detach(m)),k=!1,S()}}}function create_if_block_1$8(p){let u,f,m,v,y;return{c(){u=element("span"),u.textContent="-",f=space(),m=element("span"),m.textContent="Show me",attr(m,"class","spectrum-Link")},m(w,k){insert(w,u,k),insert(w,f,k),insert(w,m,k),v||(y=listen(m,"click",p[4]),v=!0)},p:noop$2,d(w){w&&(detach(u),detach(f),detach(m)),v=!1,y()}}}function create_fragment$z(p){let u,f=p[0]&&create_if_block$h(p);return{c(){f&&f.c(),u=empty$1()},m(m,v){f&&f.m(m,v),insert(m,u,v)},p(m,[v]){m[0]?f?f.p(m,v):(f=create_if_block$h(m),f.c(),f.m(u.parentNode,u)):f&&(f.d(1),f=null)},i:noop$2,o:noop$2,d(m){m&&detach(u),f&&f.d(m)}}}function instance$y(p,u,f){let m,{error:v}=u;const y=getContext$1("component");component_subscribe(p,y,M=>f(1,m=M));const{builderStore:w}=getContext$1("sdk"),k=()=>{w.actions.highlightSetting(v.key)},S=()=>{w.actions.addParentComponent(m.id,v.ancestor.fullType)};return p.$$set=M=>{"error"in M&&f(0,v=M.error)},[v,m,y,w,k,S]}class ComponentErrorStateCTA extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$y,create_fragment$z,safe_not_equal,{error:0})}}const ComponentErrorState_svelte_svelte_type_style_lang="";function create_if_block$g(p){let u,f,m=p[0].errorState&&create_if_block_1$7(p);return{c(){m&&m.c(),u=empty$1()},m(v,y){m&&m.m(v,y),insert(v,u,y),f=!0},p(v,y){v[0].errorState?m?(m.p(v,y),y&1&&transition_in(m,1)):(m=create_if_block_1$7(v),m.c(),transition_in(m,1),m.m(u.parentNode,u)):m&&(group_outros(),transition_out(m,1,1,()=>{m=null}),check_outros())},i(v){f||(transition_in(m),f=!0)},o(v){transition_out(m),f=!1},d(v){v&&detach(u),m&&m.d(v)}}}function create_if_block_1$7(p){let u,f,m,v,y,w,k;f=new Icon$1({props:{name:"Alert",color:"var(--spectrum-global-color-static-red-600)"}});let S=p[1]&&create_if_block_2$5(p);return{c(){u=element("div"),create_component(f.$$.fragment),m=space(),S&&S.c(),attr(u,"class","component-placeholder svelte-129t83p")},m(M,T){insert(M,u,T),mount_component(f,u,null),append$2(u,m),S&&S.m(u,null),y=!0,w||(k=action_destroyer(v=p[5].call(null,u,p[2])),w=!0)},p(M,T){M[1]?S?(S.p(M,T),T&2&&transition_in(S,1)):(S=create_if_block_2$5(M),S.c(),transition_in(S,1),S.m(u,null)):S&&(group_outros(),transition_out(S,1,1,()=>{S=null}),check_outros()),v&&is_function(v.update)&&T&4&&v.update.call(null,M[2])},i(M){y||(transition_in(f.$$.fragment,M),transition_in(S),y=!0)},o(M){transition_out(f.$$.fragment,M),transition_out(S),y=!1},d(M){M&&detach(u),destroy_component(f),S&&S.d(),w=!1,k()}}}function create_if_block_2$5(p){let u,f=p[1].message+"",m,v,y;return v=new ComponentErrorStateCTA({props:{error:p[1]}}),{c(){u=new HtmlTag(!1),m=space(),create_component(v.$$.fragment),u.a=m},m(w,k){u.m(f,w,k),insert(w,m,k),mount_component(v,w,k),y=!0},p(w,k){(!y||k&2)&&f!==(f=w[1].message+"")&&u.p(f);const S={};k&2&&(S.error=w[1]),v.$set(S)},i(w){y||(transition_in(v.$$.fragment,w),y=!0)},o(w){transition_out(v.$$.fragment,w),y=!1},d(w){w&&(u.d(),detach(m)),destroy_component(v,w)}}}function create_fragment$y(p){let u,f,m=p[3].inBuilder&&create_if_block$g(p);return{c(){m&&m.c(),u=empty$1()},m(v,y){m&&m.m(v,y),insert(v,u,y),f=!0},p(v,[y]){v[3].inBuilder?m?(m.p(v,y),y&8&&transition_in(m,1)):(m=create_if_block$g(v),m.c(),transition_in(m,1),m.m(u.parentNode,u)):m&&(group_outros(),transition_out(m,1,1,()=>{m=null}),check_outros())},i(v){f||(transition_in(m),f=!0)},o(v){transition_out(m),f=!1},d(v){v&&detach(u),m&&m.d(v)}}}function instance$x(p,u,f){let m,v,y,w,{componentErrors:k}=u;const S=getContext$1("component");component_subscribe(p,S,E=>f(0,y=E));const{styleable:M,builderStore:T}=getContext$1("sdk");return component_subscribe(p,T,E=>f(3,w=E)),p.$$set=E=>{"componentErrors"in E&&f(7,k=E.componentErrors)},p.$$.update=()=>{p.$$.dirty&1&&f(2,m={...y.styles,normal:{},custom:null,empty:!0}),p.$$.dirty&128&&f(1,v=k==null?void 0:k[0])},[y,v,m,w,S,M,T,k]}class ComponentErrorState extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$x,create_fragment$y,safe_not_equal,{componentErrors:7})}}const buildStyleString=(p,u)=>{let f="";for(let m of Object.keys(p||{}))p[m]!=null&&(f+=`${m}:${p[m]};`);return f+(u||"")},styleable=(p,u={})=>{let f,m,v,y;const w=(S={})=>{p.classList.add(`${S.id}-dom`);let M={};S.empty&&(M.padding="var(--spacing-l)",M.overflow="hidden",S.selected?M.border="2px solid transparent":M.border="2px dashed var(--spectrum-global-color-gray-400)");const T=S.id,E=S.custom||"",{isBlock:H}=S,F={...M,...S.normal},Z={...F,...S.hover||{}};p.setAttribute("draggable",!!S.draggable);const $=J=>{p.style=J};f=()=>{$(buildStyleString(F,E))},m=()=>{$(buildStyleString(Z,E))},v=J=>(builderStore.actions.selectComponent(T),J.preventDefault(),J.stopPropagation(),!1),y=J=>{if(!H)return S.interactive&&S.editable&&builderStore.actions.setEditMode(!0),J.preventDefault(),J.stopPropagation(),!1},p.addEventListener("mouseover",m),p.addEventListener("mouseout",f),S.interactive&&!S.isRoot&&(p.addEventListener("click",v,!1),p.addEventListener("dblclick",y,!1)),f()},k=()=>{p.removeEventListener("mouseover",m),p.removeEventListener("mouseout",f),p.removeEventListener("click",v),p.removeEventListener("dblclick",y)};return w(u),{update:S=>{k(),w(S)},destroy:()=>{k()}}};var GridParams=(p=>(p.HAlign="h-align",p.VAlign="v-align",p.ColStart="col-start",p.ColEnd="col-end",p.RowStart="row-start",p.RowEnd="row-end",p))(GridParams||{}),Devices=(p=>(p.Desktop="desktop",p.Mobile="mobile",p))(Devices||{}),GridDragMode=(p=>(p.Resize="resize",p.Move="move",p))(GridDragMode||{});const getGridVar=(p,u)=>`--grid-${p}-${u}`,isGridEvent=p=>{var m,v,y,w,k,S;if(!(p.target instanceof HTMLElement))return!1;const u=(y=(v=(m=p.target).closest)==null?void 0:v.call(m,".component"))==null?void 0:y.parentNode,f=(w=u==null?void 0:u.closest(".component"))==null?void 0:w.childNodes[0];return((k=p.target.dataset)==null?void 0:k.indicator)==="true"||!!((S=f==null?void 0:f.classList)!=null&&S.contains("grid"))},gridLayout=(p,u)=>{let f;const m=y=>{var he,fe,pe,ve;const{id:w,styles:k,interactive:S,errored:M,definition:T,draggable:E,insideGrid:H,ignoresLayout:F}=y;if(!H)return;if(F){p.classList.add("ignores-layout");return}f=Ae=>{Ae.stopPropagation(),builderStore.actions.selectComponent(w)};let Z=k["--default-width"]??((he=T==null?void 0:T.size)==null?void 0:he.width)??200,$=k["--default-height"]??((fe=T==null?void 0:T.size)==null?void 0:fe.height)??200;M&&(Z=500,$=60),Z+=2*GridSpacing,$+=2*GridSpacing;const J={"--default-width":Z,"--default-height":$},se={"h-align":((pe=T==null?void 0:T.grid)==null?void 0:pe.hAlign)||"stretch","v-align":((ve=T==null?void 0:T.grid)==null?void 0:ve.vAlign)||"center","col-start":1,"col-end":"round(up, calc((var(--grid-spacing) * 2 + var(--default-width)) / var(--col-size) + 1))","row-start":1,"row-end":Math.max(2,Math.ceil($/GridRowHeight)+1)};for(let Ae of Object.values(GridParams)){let ze=getGridVar("desktop",Ae),Se=getGridVar("mobile",Ae);J[ze]=k[ze]??k[Se]??se[Ae],J[Se]=k[Se]??k[ze]??se[Ae]}M&&(J[getGridVar("desktop","h-align")]="stretch",J[getGridVar("mobile","h-align")]="stretch",J[getGridVar("desktop","v-align")]="stretch",J[getGridVar("mobile","v-align")]="stretch");const ie=(Ae,ze,Se)=>{const Le=`${J[getGridVar(ze,Se)]}`;p.dataset[Ae]!==Le&&(p.dataset[Ae]=Le)};ie("gridDesktopRowEnd","desktop","row-end"),ie("gridMobileRowEnd","mobile","row-end"),ie("gridDesktopHAlign","desktop","h-align"),ie("gridMobileHAlign","mobile","h-align"),ie("gridDesktopVAlign","desktop","v-align"),ie("gridMobileVAlign","mobile","v-align"),p.dataset.insideGrid!=="true"&&(p.dataset.insideGrid="true"),p.style=buildStyleString(J),S&&p.addEventListener("click",f,!1),p.setAttribute("draggable",(!!E).toString())},v=()=>{f&&(p.removeEventListener("click",f,!1),f=null)};return m(u),{update(y){v(),m(y)},destroy(){v()}}},Component_svelte_svelte_type_style_lang="";function get_each_context$8(p,u,f){const m=p.slice();return m[83]=u[f],m}function create_if_block$f(p){let u,f,m,v,y,w,k,S,M;const T=[create_if_block_1$6,create_else_block$3],E=[];function H(F,Z){return F[5]?0:1}return f=H(p),m=E[f]=T[f](p),{c(){u=element("div"),m.c(),attr(u,"class",v=null_to_empty(`component ${p[4]}`)+" svelte-1i2u21u"),attr(u,"data-id",p[4]),attr(u,"data-name",p[7]),attr(u,"data-icon",p[24]),attr(u,"data-parent",y=p[16].id),toggle_class(u,"draggable",p[10]),toggle_class(u,"droppable",p[23]),toggle_class(u,"empty",p[14]),toggle_class(u,"interactive",p[11]),toggle_class(u,"editing",p[6]),toggle_class(u,"pad",p[3]),toggle_class(u,"parent",p[13]),toggle_class(u,"block",p[2]),toggle_class(u,"error",p[5]),toggle_class(u,"root",p[1])},m(F,Z){insert(F,u,Z),E[f].m(u,null),k=!0,S||(M=action_destroyer(w=gridLayout.call(null,u,p[21])),S=!0)},p(F,Z){let $=f;f=H(F),f===$?E[f].p(F,Z):(group_outros(),transition_out(E[$],1,1,()=>{E[$]=null}),check_outros(),m=E[f],m?m.p(F,Z):(m=E[f]=T[f](F),m.c()),transition_in(m,1),m.m(u,null)),(!k||Z[0]&16&&v!==(v=null_to_empty(`component ${F[4]}`)+" svelte-1i2u21u"))&&attr(u,"class",v),(!k||Z[0]&16)&&attr(u,"data-id",F[4]),(!k||Z[0]&128)&&attr(u,"data-name",F[7]),(!k||Z[0]&16777216)&&attr(u,"data-icon",F[24]),(!k||Z[0]&65536&&y!==(y=F[16].id))&&attr(u,"data-parent",y),w&&is_function(w.update)&&Z[0]&2097152&&w.update.call(null,F[21]),(!k||Z[0]&1040)&&toggle_class(u,"draggable",F[10]),(!k||Z[0]&8388624)&&toggle_class(u,"droppable",F[23]),(!k||Z[0]&16400)&&toggle_class(u,"empty",F[14]),(!k||Z[0]&2064)&&toggle_class(u,"interactive",F[11]),(!k||Z[0]&80)&&toggle_class(u,"editing",F[6]),(!k||Z[0]&24)&&toggle_class(u,"pad",F[3]),(!k||Z[0]&8208)&&toggle_class(u,"parent",F[13]),(!k||Z[0]&20)&&toggle_class(u,"block",F[2]),(!k||Z[0]&48)&&toggle_class(u,"error",F[5]),(!k||Z[0]&18)&&toggle_class(u,"root",F[1])},i(F){k||(transition_in(m),k=!0)},o(F){transition_out(m),k=!1},d(F){F&&detach(u),E[f].d(),S=!1,M()}}}function create_else_block$3(p){let u,f,m;const v=[p[18]];var y=p[20];function w(k,S){let M={$$slots:{default:[create_default_slot$j]},$$scope:{ctx:k}};for(let T=0;T<v.length;T+=1)M=assign(M,v[T]);return S!==void 0&&S[0]&262144&&(M=assign(M,get_spread_update(v,[get_spread_object(k[18])]))),{props:M}}return y&&(u=construct_svelte_component(y,w(p)),p[57](u)),{c(){u&&create_component(u.$$.fragment),f=empty$1()},m(k,S){u&&mount_component(u,k,S),insert(k,f,S),m=!0},p(k,S){if(S[0]&1048576&&y!==(y=k[20])){if(u){group_outros();const M=u;transition_out(M.$$.fragment,1,0,()=>{destroy_component(M,1)}),check_outros()}y?(u=construct_svelte_component(y,w(k,S)),k[57](u),create_component(u.$$.fragment),transition_in(u.$$.fragment,1),mount_component(u,f.parentNode,f)):u=null}else if(y){const M=S[0]&262144?get_spread_update(v,[get_spread_object(k[18])]):{};S[0]&4615|S[1]&134217728&&(M.$$scope={dirty:S,ctx:k}),u.$set(M)}},i(k){m||(u&&transition_in(u.$$.fragment,k),m=!0)},o(k){u&&transition_out(u.$$.fragment,k),m=!1},d(k){k&&detach(f),p[57](null),u&&destroy_component(u,k)}}}function create_if_block_1$6(p){let u,f;return u=new ComponentErrorState({props:{componentErrors:p[15]}}),{c(){create_component(u.$$.fragment)},m(m,v){mount_component(u,m,v),f=!0},p(m,v){const y={};v[0]&32768&&(y.componentErrors=m[15]),u.$set(y)},i(m){f||(transition_in(u.$$.fragment,m),f=!0)},o(m){transition_out(u.$$.fragment,m),f=!1},d(m){destroy_component(u,m)}}}function create_if_block_5$2(p){let u;const f=p[56].default,m=create_slot(f,p,p[58],null);return{c(){m&&m.c()},m(v,y){m&&m.m(v,y),u=!0},p(v,y){m&&m.p&&(!u||y[1]&134217728)&&update_slot_base(m,f,v,v[58],u?get_slot_changes(f,v[58],y,null):get_all_dirty_from_scope(v[58]),null)},i(v){u||(transition_in(m,v),u=!0)},o(v){transition_out(m,v),u=!1},d(v){m&&m.d(v)}}}function create_if_block_3$3(p){let u,f,m,v;const y=[create_if_block_4$2,create_else_block_1$1],w=[];function k(S,M){return S[1]?0:1}return u=k(p),f=w[u]=y[u](p),{c(){f.c(),m=empty$1()},m(S,M){w[u].m(S,M),insert(S,m,M),v=!0},p(S,M){let T=u;u=k(S),u!==T&&(group_outros(),transition_out(w[T],1,1,()=>{w[T]=null}),check_outros(),f=w[u],f||(f=w[u]=y[u](S),f.c()),transition_in(f,1),f.m(m.parentNode,m))},i(S){v||(transition_in(f),v=!0)},o(S){transition_out(f),v=!1},d(S){S&&detach(m),w[u].d(S)}}}function create_if_block_2$4(p){let u=[],f=new Map,m,v,y=ensure_array_like(p[12]);const w=k=>k[83]._id;for(let k=0;k<y.length;k+=1){let S=get_each_context$8(p,y,k),M=w(S);f.set(M,u[k]=create_each_block$8(M,S))}return{c(){for(let k=0;k<u.length;k+=1)u[k].c();m=empty$1()},m(k,S){for(let M=0;M<u.length;M+=1)u[M]&&u[M].m(k,S);insert(k,m,S),v=!0},p(k,S){S[0]&4097&&(y=ensure_array_like(k[12]),group_outros(),u=update_keyed_each(u,S,w,1,k,y,f,m.parentNode,outro_and_destroy_block,create_each_block$8,m,get_each_context$8),check_outros())},i(k){if(!v){for(let S=0;S<y.length;S+=1)transition_in(u[S]);v=!0}},o(k){for(let S=0;S<u.length;S+=1)transition_out(u[S]);v=!1},d(k){k&&detach(m);for(let S=0;S<u.length;S+=1)u[S].d(k)}}}function create_else_block_1$1(p){let u,f;return u=new EmptyPlaceholder({}),{c(){create_component(u.$$.fragment)},m(m,v){mount_component(u,m,v),f=!0},i(m){f||(transition_in(u.$$.fragment,m),f=!0)},o(m){transition_out(u.$$.fragment,m),f=!1},d(m){destroy_component(u,m)}}}function create_if_block_4$2(p){let u,f;return u=new ScreenPlaceholder({}),{c(){create_component(u.$$.fragment)},m(m,v){mount_component(u,m,v),f=!0},i(m){f||(transition_in(u.$$.fragment,m),f=!0)},o(m){transition_out(u.$$.fragment,m),f=!1},d(m){destroy_component(u,m)}}}function create_each_block$8(p,u){let f,m,v;return m=new Component({props:{instance:u[83],parent:u[0]}}),{key:p,first:null,c(){f=empty$1(),create_component(m.$$.fragment),this.first=f},m(y,w){insert(y,f,w),mount_component(m,y,w),v=!0},p(y,w){u=y;const k={};w[0]&4096&&(k.instance=u[83]),w[0]&1&&(k.parent=u[0]),m.$set(k)},i(y){v||(transition_in(m.$$.fragment,y),v=!0)},o(y){transition_out(m.$$.fragment,y),v=!1},d(y){y&&detach(f),destroy_component(m,y)}}}function create_default_slot$j(p){let u,f,m,v;const y=[create_if_block_2$4,create_if_block_3$3,create_if_block_5$2],w=[];function k(S,M){return S[12].length?0:S[9]?1:S[2]?2:-1}return~(u=k(p))&&(f=w[u]=y[u](p)),{c(){f&&f.c(),m=empty$1()},m(S,M){~u&&w[u].m(S,M),insert(S,m,M),v=!0},p(S,M){let T=u;u=k(S),u===T?~u&&w[u].p(S,M):(f&&(group_outros(),transition_out(w[T],1,1,()=>{w[T]=null}),check_outros()),~u?(f=w[u],f?f.p(S,M):(f=w[u]=y[u](S),f.c()),transition_in(f,1),f.m(m.parentNode,m)):f=null)},i(S){v||(transition_in(f),v=!0)},o(S){transition_out(f),v=!1},d(S){S&&detach(m),~u&&w[u].d(S)}}}function create_fragment$x(p){let u,f,m=p[20]&&p[18]&&(p[19]||p[8])&&!p[22]&&create_if_block$f(p);return{c(){m&&m.c(),u=empty$1()},m(v,y){m&&m.m(v,y),insert(v,u,y),f=!0},p(v,y){v[20]&&v[18]&&(v[19]||v[8])&&!v[22]?m?(m.p(v,y),y[0]&6029568&&transition_in(m,1)):(m=create_if_block$f(v),m.c(),transition_in(m,1),m.m(u.parentNode,u)):m&&(group_outros(),transition_out(m,1,1,()=>{m=null}),check_outros())},i(v){f||(transition_in(m),f=!0)},o(v){transition_out(m),f=!1},d(v){v&&detach(u),m&&m.d(v)}}}let SettingsDefinitionCache={},SettingsDefinitionMapCache={},InstanceSettingsCache={};function instance_1$2(p,u,f){let m,v,y,w,k,S,M,T,E,H,F,Z,$,J,se,ie,he,fe,pe,ve,Ae,ze,Se,Le,Ce,Ue,Ze,Ge,be,De,Ke,He,rt,ft,Mt,$e,je,Ct;component_subscribe(p,appStore,Gn=>f(67,Ke=Gn)),component_subscribe(p,dndIsDragging,Gn=>f(51,ft=Gn)),component_subscribe(p,builderStore,Gn=>f(52,Mt=Gn)),component_subscribe(p,devToolsStore,Gn=>f(53,$e=Gn)),component_subscribe(p,dndComponentPath,Gn=>f(54,je=Gn)),component_subscribe(p,componentStore,Gn=>f(55,Ct=Gn));let{$$slots:yt={},$$scope:ot}=u,{instance:Rt={}}=u,{parent:Xe=null}=u,{isLayout:Gt=!1}=u,{isRoot:Jt=!1}=u,{isBlock:Ht=!1}=u;const Pt=getContext$1("context");component_subscribe(p,Pt,Gn=>f(50,He=Gn));const Et=!!getContext$1("screenslot"),cn=getContext$1("component");component_subscribe(p,cn,Gn=>f(16,rt=Gn));const Sn=writable({});setContext("component",Sn);let $t,xn,sn,mt,Mn,Dt,Wt,nn,Ot,gt,Xt=!0,Tt,Zt,Ut,hn,yn,Vn="",Bn={},An;const Yn=Gn=>{var Pi;return((Pi=Gn==null?void 0:Gn._component)==null?void 0:Pi.endsWith("/container"))&&(Gn==null?void 0:Gn.layout)==="grid"};let Pn=!1;const ri=(Gn,Pi=!1)=>{if(Gn==null)return;const rr=JSON.stringify(Gn),Ui=hashString(rr);if(Ui===gt&&!Pi)return;gt=Ui,f(35,yn=null);const ki=Gn._component;if(f(20,Tt=componentStore.actions.getComponentConstructor(ki)),f(34,Zt=componentStore.actions.getComponentDefinition(ki)),!Zt)return;const ti=`${Zt.name}${(Zt==null?void 0:Zt.deprecated)===!0?"_deprecated":""}`;SettingsDefinitionCache[ti]?(Ut=SettingsDefinitionCache[ti],hn=SettingsDefinitionMapCache[ti]):(Ut=getSettingsDefinition(Zt),hn=Fi(Ut),SettingsDefinitionCache[ti]=Ut,SettingsDefinitionMapCache[ti]=hn);let Ki;InstanceSettingsCache[Ui]?Ki=InstanceSettingsCache[Ui]:(Ki=Dn(Gn,Ut),InstanceSettingsCache[Ui]=Ki),f(29,mt=Ki.staticSettings),sn=Ki.dynamicSettings;const ai=JSON.stringify({...Gn,_children:null}),va=findHBSBlocks(ai).map(ms=>{let ca=ms.replace(/\\"/g,'"');return isJSBinding(ca)?decodeJSBinding(ca):ca});Bn=Ji(Gn,Ut),Vn=va.join(" "),si(Gn,Ut),ur(get_store_value(Pt),hn),An||(An=Pt.actions.observeChanges(ir))},Ji=(Gn,Pi)=>{let rr={};return Pi.forEach(Ui=>{var ki;Ui.type==="event"&&((ki=Gn[Ui.key])==null||ki.forEach(ti=>{var ai;const Ki=getActionContextKey(ti);Ki&&(rr[Ki]=!0),(ai=getActionDependentContextKeys(ti))==null||ai.forEach(va=>{rr[va]=!0})}))}),rr},si=(Gn,Pi)=>{Pi.forEach(rr=>{if(rr.type==="table"){const Ui=Gn[rr.key];Ui&&(Ui.type||(Ui.type="table"),Ui.resourceId||(Ui.type==="viewV2"?Ui.resourceId=Ui.id:Ui.resourceId=Ui.tableId))}})},Fi=Gn=>{let Pi={};return Gn==null||Gn.forEach(rr=>{Pi[rr.key]=rr}),Pi},Dn=(Gn,Pi)=>{var ti;let rr={};Object.entries(Gn).filter(([Ki])=>!Ki.startsWith("_")).forEach(([Ki,ai])=>{rr[Ki]=ai});let Ui={...rr},ki={...rr};return ki._conditions=Gn._conditions,ki._css=(ti=Gn._styles)==null?void 0:ti.custom,Pi==null||Pi.forEach(Ki=>{if(Ki.nested)delete ki[Ki.key];else{const ai=rr[Ki.key];ai==null?delete ki[Ki.key]:typeof ai=="string"&&ai.includes("{{")||Ki.type==="event"||typeof ai=="object"&&JSON.stringify(ai).includes("{{")?delete Ui[Ki.key]:delete ki[Ki.key]}}),{staticSettings:Ui,dynamicSettings:ki}},Ci=()=>{if(!(Mn!=null&&Mn._conditions)){f(33,nn=[]);return}f(33,nn=Mn._conditions.map(Gn=>{var rr,Ui;const Pi=(rr=Rt._conditions)==null?void 0:rr.find(ki=>ki.id===Gn.id);return(Ui=hn[Gn.setting])!=null&&Ui.nested&&Pi?{...Gn,settingValue:Pi.settingValue}:Gn}))},ur=(Gn,Pi)=>{Ot=Date.now();const rr=Ot,Ui=enrichProps(sn,Gn,Pi);rr===Ot&&(f(30,Mn=Ui),Ci())},Qa=Gn=>{if(!(Gn!=null&&Gn.length))return;let Pi=!Gn.find(ki=>ki.action==="show");const rr=getActiveConditions(Gn),Ui=reduceConditionActions(rr);Ui.visible!=null&&(Pi=Ui.visible),f(31,Dt=Ui.settingUpdates),f(19,Xt=Pi)},yr=(Gn,Pi,rr)=>{const Ui={...Gn,...Pi,...rr};if(!Wt)f(32,Wt={...Ui}),f(18,xn=Wt);else{const ki=new Set(Object.keys(Ui));Object.keys(Wt).forEach(ti=>ki.add(ti)),ki.forEach(ti=>{if(!propsAreSame(Ui[ti],Wt[ti])){if(f(32,Wt[ti]=Ui[ti],Wt),ti.startsWith("_"))return;$t!=null&&$t.$$set?$t.$$set({[ti]:Ui[ti]}):f(18,xn[ti]=Ui[ti],xn)}})}},ba=async()=>{const Gn=Ge?v:`${v}-dom`,Pi=document.getElementsByClassName(Gn)[0];Pi&&(get_store_value(dndIsDragging)||Ge&&Pi.classList.contains("dragging")||Pi.scrollIntoView({behavior:"instant",block:"nearest",inline:"start"}))},ir=Gn=>{let Pi=Bn[Gn];if(Pi==null){const rr=Gn==="snippets"?Gn:`[${Gn}]`;Pi=Vn.indexOf(rr)!==-1,Bn[Gn]=Pi}Pi&&ur(He,hn)},wo=()=>{var rr;const Gn=get_store_value(Pt),Pi=(rr=$t==null?void 0:$t.getAdditionalDataContext)==null?void 0:rr.call($t);return{...Gn,...Pi}};onMount(()=>(Ke.isDevApp&&(componentStore.actions.isComponentRegistered(v)||componentStore.actions.registerInstance(v,{component:Rt._component,getSettings:()=>Wt,getRawSettings:()=>({...mt,...sn}),getDataContext:wo,reload:()=>ri(Rt,!0),setEphemeralStyles:Gn=>f(35,yn=Gn),state:Sn})),()=>{componentStore.actions.isComponentRegistered(v)&&componentStore.actions.unregisterInstance(v),An==null||An()}));function za(Gn){binding_callbacks[Gn?"unshift":"push"](()=>{$t=Gn,f(17,$t)})}return p.$$set=Gn=>{"instance"in Gn&&f(0,Rt=Gn.instance),"parent"in Gn&&f(27,Xe=Gn.parent),"isLayout"in Gn&&f(28,Gt=Gn.isLayout),"isRoot"in Gn&&f(1,Jt=Gn.isRoot),"isBlock"in Gn&&f(2,Ht=Gn.isBlock),"$$scope"in Gn&&f(58,ot=Gn.$$scope)},p.$$.update=()=>{var Gn,Pi,rr,Ui,ki;p.$$.dirty[0]&1&&ri(Rt),p.$$.dirty[0]&1&&f(12,m=Rt._children||[]),p.$$.dirty[0]&1&&f(4,v=Rt._id),p.$$.dirty[0]&3&&f(7,y=Jt?"Screen":Rt._instanceName),p.$$.dirty[0]&1|p.$$.dirty[1]&8&&f(24,w=Rt._icon||(Zt==null?void 0:Zt.icon)),p.$$.dirty[0]&16|p.$$.dirty[1]&2097152&&f(38,k=Mt.inBuilder&&Mt.selectedComponentId===v),p.$$.dirty[0]&16|p.$$.dirty[1]&16777216&&f(8,S=(Gn=Ct.selectedComponentPath)==null?void 0:Gn.includes(v)),p.$$.dirty[0]&256|p.$$.dirty[1]&2097152&&f(47,M=S&&Mt.editMode),p.$$.dirty[0]&16|p.$$.dirty[1]&8388608&&f(42,T=je==null?void 0:je.includes(v)),p.$$.dirty[0]&1&&f(15,E=(Pi=Rt==null?void 0:Rt._meta)==null?void 0:Pi.errors),p.$$.dirty[1]&8&&f(13,H=!!(Zt!=null&&Zt.hasChildren)),p.$$.dirty[1]&8&&f(45,F=(Zt==null?void 0:Zt.showEmptyState)!==!1),p.$$.dirty[0]&32768&&f(46,Z=!!(E!=null&&E.find(ti=>ti.errorType==="setting"))),p.$$.dirty[1]&32776&&f(39,$=!!(Zt!=null&&Zt.editable)&&!Z),p.$$.dirty[0]&32768&&f(5,J=(E==null?void 0:E.length)>0),p.$$.dirty[0]&5|p.$$.dirty[1]&2097152&&f(49,se=Mt.inBuilder&&Et&&!Ht&&!Rt.static),p.$$.dirty[0]&4|p.$$.dirty[1]&4194304&&f(48,ie=$e.allowSelection&&!Ht),p.$$.dirty[1]&393216&&f(11,he=se||ie),p.$$.dirty[1]&2097536&&f(6,fe=$&&k&&Mt.editMode),p.$$.dirty[0]&268437510|p.$$.dirty[1]&65544&&f(10,pe=!M&&he&&!Gt&&!Jt&&!Ht&&(Zt==null?void 0:Zt.draggable)!==!1),p.$$.dirty[0]&2048&&f(23,ve=he),p.$$.dirty[0]&16|p.$$.dirty[1]&2097152&&f(22,Ae=Mt.inBuilder&&((rr=Mt.hiddenComponentIds)==null?void 0:rr.includes(v))),p.$$.dirty[0]&14340|p.$$.dirty[1]&32768&&f(14,ze=!Ht&&(he&&!m.length&&H||Z)),p.$$.dirty[0]&16384|p.$$.dirty[1]&16384&&f(9,Se=ze&&F),p.$$.dirty[1]&4&&Qa(nn),p.$$.dirty[0]&1610612736|p.$$.dirty[1]&1&&yr(mt,Mn,Dt),p.$$.dirty[1]&2&&f(40,Le=Wt==null?void 0:Wt._css),p.$$.dirty[1]&128&&k&&ba(),p.$$.dirty[1]&524288&&f(44,Ce=(Ui=He==null?void 0:He.device)==null?void 0:Ui.theme),p.$$.dirty[1]&8192&&f(37,Ue=!(Ce!=null&&Ce.includes("light"))),p.$$.dirty[0]&1|p.$$.dirty[1]&16&&f(41,Ze={...(ki=Rt._styles)==null?void 0:ki.normal,...yn}),p.$$.dirty[0]&134217728&&f(36,Ge=Yn(Xe)),p.$$.dirty[0]&1&&f(43,be=Yn(Rt)),p.$$.dirty[0]&3120|p.$$.dirty[1]&1064&&f(21,De={insideGrid:Ge,ignoresLayout:(Zt==null?void 0:Zt.ignoresLayout)===!0,id:v,interactive:he,styles:Ze,draggable:pe,definition:Zt,errored:J}),p.$$.dirty[0]&10248|p.$$.dirty[1]&6144&&f(3,Pn=Pn||!be&&he&&H&&T),p.$$.dirty[1]&1048576&&f(3,Pn=!1),p.$$.dirty[0]&73719|p.$$.dirty[1]&1984&&Sn.set({id:v,children:m.length,styles:{...Rt._styles,normal:Ze,custom:Le,id:v,empty:Se,selected:k,interactive:he,isRoot:Jt,draggable:pe,editable:$,isBlock:Ht},empty:Se,selected:k,isRoot:Jt,inSelectedPath:S,name:y,editing:fe,type:Rt._component,errorState:J,parent:v,path:[...(rt==null?void 0:rt.path)??[],v],darkMode:Ue})},[Rt,Jt,Ht,Pn,v,J,fe,y,S,Se,pe,he,m,H,ze,E,rt,$t,xn,Xt,Tt,De,Ae,ve,w,Pt,cn,Xe,Gt,mt,Mn,Dt,Wt,nn,Zt,yn,Ge,Ue,k,$,Le,Ze,T,be,Ce,F,Z,M,ie,se,He,ft,Mt,$e,je,Ct,yt,za,ot]}class Component extends SvelteComponent{constructor(u){super(),init$1(this,u,instance_1$2,create_fragment$x,safe_not_equal,{instance:0,parent:27,isLayout:28,isRoot:1,isBlock:2},null,[-1,-1,-1])}}const linkable=(p,u)=>{if(get_store_value(builderStore).inBuilder){p.onclick=f=>{f.preventDefault()};return}link$1(p,u)},getAction=(p,u)=>{var m;if(!p||!u)return null;const f=getContext$1("context");return f?(m=get_store_value(f))==null?void 0:m[`${p}_${u}`]:null},getDatasourceFetchInstance=p=>{const u=DataFetchMap[p==null?void 0:p.type];return u?new u({API,datasource:p,query:null}):null},fetchDatasourceSchema=async(p,u={enrichRelationships:!1,formSchema:!1})=>{var y;const f=getDatasourceFetchInstance(p),m=await(f==null?void 0:f.getDefinition());if(!f||!m)return null;let v;if((p==null?void 0:p.type)!=="query"||!(u!=null&&u.formSchema))v=f.getSchema(m);else if("parameters"in m&&((y=m.parameters)!=null&&y.length)){v={};for(const w of m.parameters)v[w.name]={...w,type:FieldType.STRING}}if(!v)return null;if(p.type==="viewV2")for(const w of Object.keys(v))v[w].visible||delete v[w];if(m&&"sql"in m&&m.sql&&(u!=null&&u.enrichRelationships)){const w=await getRelationshipSchemaAdditions(v);v={...v,...w}}return f.enrichSchema(v)},fetchDatasourceDefinition=async p=>{const u=getDatasourceFetchInstance(p);return await(u==null?void 0:u.getDefinition())},getRelationshipSchemaAdditions=async p=>{if(!p)return null;let u={};for(let f of Object.keys(p)){const m=p[f];if((m==null?void 0:m.type)==="link"){const v=await fetchDatasourceSchema({type:"table",tableId:m==null?void 0:m.tableId});if(!v)continue;Object.keys(v).forEach(y=>{u[`${f}.${y}`]={type:v[y].type,externalType:v[y].externalType}})}}return u},getAPIKey=async()=>{const{apiKey:p}=await API.fetchDeveloperInfo();return p},SDK={API,authStore,appStore,notificationStore,routeStore,rowSelectionStore,screenStore,builderStore,uploadStore,componentStore,environmentStore,sidePanelStore,modalStore,dndIsDragging,currentRole,confirmationStore,roleStore,stateStore,styleable,linkable,getAction,fetchDatasourceSchema,fetchDatasourceDefinition,fetchData,QueryUtils,ContextScopes:ComponentContextScopes,getAPIKey,enrichButtonActions,processStringSync,makePropSafe,createContextStore,generateGoldenSample,memo,derivedMemo,createValidatorFromConstraints,Provider,Block,BlockComponent,ActionTypes},NotificationDisplay_svelte_svelte_type_style_lang="";function get_each_context$7(p,u,f){const m=p.slice();return m[2]=u[f].type,m[3]=u[f].icon,m[4]=u[f].message,m[5]=u[f].id,m[6]=u[f].dismissable,m[7]=u[f].count,m}function create_if_block$e(p){let u=[],f=new Map,m,v,y=ensure_array_like(p[0]);const w=k=>k[5];for(let k=0;k<y.length;k+=1){let S=get_each_context$7(p,y,k),M=w(S);f.set(M,u[k]=create_each_block$7(M,S))}return{c(){for(let k=0;k<u.length;k+=1)u[k].c();m=empty$1()},m(k,S){for(let M=0;M<u.length;M+=1)u[M]&&u[M].m(k,S);insert(k,m,S),v=!0},p(k,S){S&1&&(y=ensure_array_like(k[0]),group_outros(),u=update_keyed_each(u,S,w,1,k,y,f,m.parentNode,outro_and_destroy_block,create_each_block$7,m,get_each_context$7),check_outros())},i(k){if(!v){for(let S=0;S<y.length;S+=1)transition_in(u[S]);v=!0}},o(k){for(let S=0;S<u.length;S+=1)transition_out(u[S]);v=!1},d(k){k&&detach(m);for(let S=0;S<u.length;S+=1)u[S].d(k)}}}function create_each_block$7(p,u){let f,m,v,y,w,k;function S(){return u[1](u[5])}return m=new Notification({props:{type:u[2],message:u[7]>1?`(${u[7]}) ${u[4]}`:u[4],icon:u[3],dismissable:u[6]}}),m.$on("dismiss",S),{key:p,first:null,c(){f=element("div"),create_component(m.$$.fragment),v=space(),this.first=f},m(M,T){insert(M,f,T),mount_component(m,f,null),append$2(f,v),k=!0},p(M,T){u=M;const E={};T&1&&(E.type=u[2]),T&1&&(E.message=u[7]>1?`(${u[7]}) ${u[4]}`:u[4]),T&1&&(E.icon=u[3]),T&1&&(E.dismissable=u[6]),m.$set(E)},i(M){k||(transition_in(m.$$.fragment,M),M&&add_render_callback(()=>{k&&(w&&w.end(1),y=create_in_transition(f,fly,{duration:300,y:-20,delay:u[0].delay?300:0}),y.start())}),k=!0)},o(M){transition_out(m.$$.fragment,M),y&&y.invalidate(),M&&(w=create_out_transition(f,fly,{y:-20,duration:150})),k=!1},d(M){M&&detach(f),destroy_component(m),M&&w&&w.end()}}}function create_fragment$w(p){let u,f,m=p[0]&&create_if_block$e(p);return{c(){u=element("div"),m&&m.c(),attr(u,"class","notifications svelte-o2yltz")},m(v,y){insert(v,u,y),m&&m.m(u,null),f=!0},p(v,[y]){v[0]?m?(m.p(v,y),y&1&&transition_in(m,1)):(m=create_if_block$e(v),m.c(),transition_in(m,1),m.m(u,null)):m&&(group_outros(),transition_out(m,1,1,()=>{m=null}),check_outros())},i(v){f||(transition_in(m),f=!0)},o(v){transition_out(m),f=!1},d(v){v&&detach(u),m&&m.d()}}}function instance$w(p,u,f){let m;return component_subscribe(p,notificationStore,y=>f(0,m=y)),[m,y=>notificationStore.actions.dismiss(y)]}class NotificationDisplay extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$w,create_fragment$w,safe_not_equal,{})}}function create_if_block$d(p){let u,f;return u=new Modal({props:{fixed:!0,$$slots:{default:[create_default_slot$i]},$$scope:{ctx:p}}}),u.$on("cancel",confirmationStore.actions.cancel),{c(){create_component(u.$$.fragment)},m(m,v){mount_component(u,m,v),f=!0},p(m,v){const y={};v&3&&(y.$$scope={dirty:v,ctx:m}),u.$set(y)},i(m){f||(transition_in(u.$$.fragment,m),f=!0)},o(m){transition_out(u.$$.fragment,m),f=!1},d(m){destroy_component(u,m)}}}function create_default_slot_1$8(p){let u=p[0].text+"",f;return{c(){f=text$1(u)},m(m,v){insert(m,f,v)},p(m,v){v&1&&u!==(u=m[0].text+"")&&set_data(f,u)},d(m){m&&detach(f)}}}function create_default_slot$i(p){let u,f;return u=new ModalContent({props:{title:p[0].title,onConfirm:confirmationStore.actions.confirm,confirmText:p[0].confirmButtonText,cancelText:p[0].cancelButtonText,$$slots:{default:[create_default_slot_1$8]},$$scope:{ctx:p}}}),{c(){create_component(u.$$.fragment)},m(m,v){mount_component(u,m,v),f=!0},p(m,v){const y={};v&1&&(y.title=m[0].title),v&1&&(y.confirmText=m[0].confirmButtonText),v&1&&(y.cancelText=m[0].cancelButtonText),v&3&&(y.$$scope={dirty:v,ctx:m}),u.$set(y)},i(m){f||(transition_in(u.$$.fragment,m),f=!0)},o(m){transition_out(u.$$.fragment,m),f=!1},d(m){destroy_component(u,m)}}}function create_fragment$v(p){let u,f,m=p[0].showConfirmation&&create_if_block$d(p);return{c(){m&&m.c(),u=empty$1()},m(v,y){m&&m.m(v,y),insert(v,u,y),f=!0},p(v,[y]){v[0].showConfirmation?m?(m.p(v,y),y&1&&transition_in(m,1)):(m=create_if_block$d(v),m.c(),transition_in(m,1),m.m(u.parentNode,u)):m&&(group_outros(),transition_out(m,1,1,()=>{m=null}),check_outros())},i(v){f||(transition_in(m),f=!0)},o(v){transition_out(m),f=!1},d(v){v&&detach(u),m&&m.d(v)}}}function instance$v(p,u,f){let m;return component_subscribe(p,confirmationStore,v=>f(0,m=v)),[m]}class ConfirmationDisplay extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$v,create_fragment$v,safe_not_equal,{})}}const PeekScreenDisplay_svelte_svelte_type_style_lang="";function create_if_block$c(p){let u,f;return u=new Modal({props:{fixed:!0,$$slots:{outside:[create_outside_slot],default:[create_default_slot_2$6]},$$scope:{ctx:p}}}),u.$on("cancel",p[2]),{c(){create_component(u.$$.fragment)},m(m,v){mount_component(u,m,v),f=!0},p(m,v){const y={};v&4099&&(y.$$scope={dirty:v,ctx:m}),u.$set(y)},i(m){f||(transition_in(u.$$.fragment,m),f=!0)},o(m){transition_out(u.$$.fragment,m),f=!1},d(m){destroy_component(u,m)}}}function create_default_slot_3$5(p){let u,f;return{c(){u=element("iframe"),attr(u,"title","Peek"),src_url_equal(u.src,f=p[1].href)||attr(u,"src",f),attr(u,"class","svelte-fm1ndi")},m(m,v){insert(m,u,v),p[5](u)},p(m,v){v&2&&!src_url_equal(u.src,f=m[1].href)&&attr(u,"src",f)},d(m){m&&detach(u),p[5](null)}}}function create_default_slot_2$6(p){let u,f;return u=new ModalContent({props:{showCancelButton:!1,showConfirmButton:!1,size:"L",showDivider:!1,showCloseIcon:!1,$$slots:{default:[create_default_slot_3$5]},$$scope:{ctx:p}}}),{c(){create_component(u.$$.fragment)},m(m,v){mount_component(u,m,v),f=!0},p(m,v){const y={};v&4099&&(y.$$scope={dirty:v,ctx:m}),u.$set(y)},i(m){f||(transition_in(u.$$.fragment,m),f=!0)},o(m){transition_out(u.$$.fragment,m),f=!1},d(m){destroy_component(u,m)}}}function create_default_slot_1$7(p){let u;return{c(){u=text$1("Full screen")},m(f,m){insert(f,u,m)},d(f){f&&detach(u)}}}function create_default_slot$h(p){let u;return{c(){u=text$1("Close")},m(f,m){insert(f,u,m)},d(f){f&&detach(u)}}}function create_outside_slot(p){let u,f,m,v,y;return f=new ActionButton({props:{size:"S",quiet:!0,icon:"OpenIn",$$slots:{default:[create_default_slot_1$7]},$$scope:{ctx:p}}}),f.$on("click",p[3]),v=new ActionButton({props:{size:"S",quiet:!0,icon:"Close",$$slots:{default:[create_default_slot$h]},$$scope:{ctx:p}}}),v.$on("click",p[2]),{c(){u=element("div"),create_component(f.$$.fragment),m=space(),create_component(v.$$.fragment),attr(u,"class","actions spectrum--darkest svelte-fm1ndi"),attr(u,"slot","outside")},m(w,k){insert(w,u,k),mount_component(f,u,null),append$2(u,m),mount_component(v,u,null),y=!0},p(w,k){const S={};k&4096&&(S.$$scope={dirty:k,ctx:w}),f.$set(S);const M={};k&4096&&(M.$$scope={dirty:k,ctx:w}),v.$set(M)},i(w){y||(transition_in(f.$$.fragment,w),transition_in(v.$$.fragment,w),y=!0)},o(w){transition_out(f.$$.fragment,w),transition_out(v.$$.fragment,w),y=!1},d(w){w&&detach(u),destroy_component(f),destroy_component(v)}}}function create_fragment$u(p){let u,f,m=p[1].showPeek&&create_if_block$c(p);return{c(){m&&m.c(),u=empty$1()},m(v,y){m&&m.m(v,y),insert(v,u,y),f=!0},p(v,[y]){v[1].showPeek?m?(m.p(v,y),y&2&&transition_in(m,1)):(m=create_if_block$c(v),m.c(),transition_in(m,1),m.m(u.parentNode,u)):m&&(group_outros(),transition_out(m,1,1,()=>{m=null}),check_outros())},i(v){f||(transition_in(m),f=!0)},o(v){transition_out(m),f=!1},d(v){v&&detach(u),m&&m.d(v)}}}function instance$u(p,u,f){let m;component_subscribe(p,peekStore,$=>f(1,m=$));const v={NOTIFICATION:"notification",CLOSE_SCREEN_MODAL:"close-screen-modal",INVALIDATE_DATASOURCE:"invalidate-datasource",UPDATE_STATE:"update-state"};let y,w=!1;const k=$=>{const{dataSourceId:J,options:se}=$.detail;dataSourceStore.actions.invalidateDataSource(J,se)},S=$=>{const{message:J,type:se,icon:ie,autoDismiss:he}=$.detail;notificationStore.actions.send(J,se,ie,he)},M=$=>{const{type:J,key:se,value:ie,persist:he}=$.detail;J==="set"?stateStore.actions.setValue(se,ie,he):J==="delete"&&stateStore.actions.deleteValue(se)};function T($){var ie;const se={[v.NOTIFICATION]:()=>{S($.data)},[v.CLOSE_SCREEN_MODAL]:()=>{var he;peekStore.actions.hidePeek(),(he=$.data)!=null&&he.url&&routeStore.actions.navigate($.data.url)},[v.INVALIDATE_DATASOURCE]:()=>{k($.data)},[v.UPDATE_STATE]:()=>{M($.data)}}[$.data.type];se?se($):console.warn("Unknown event type",(ie=$==null?void 0:$.data)==null?void 0:ie.type)}const E=()=>{window.addEventListener("message",T)},H=()=>{peekStore.actions.hidePeek(),window.removeEventListener("message",T)},F=()=>{m.external?window.location=m.href:(routeStore.actions.navigate(m.url),H())};onDestroy(()=>{y&&H()});function Z($){binding_callbacks[$?"unshift":"push"](()=>{y=$,f(0,y)})}return p.$$.update=()=>{p.$$.dirty&17&&(y&&!w?(E(),f(4,w=!0)):y||f(4,w=!1))},[y,m,H,F,w,Z]}class PeekScreenDisplay extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$u,create_fragment$u,safe_not_equal,{})}}function create_default_slot$g(p){let u;const f=p[3].default,m=create_slot(f,p,p[4],null);return{c(){m&&m.c()},m(v,y){m&&m.m(v,y),u=!0},p(v,y){m&&m.p&&(!u||y&16)&&update_slot_base(m,f,v,v[4],u?get_slot_changes(f,v[4],y,null):get_all_dirty_from_scope(v[4]),null)},i(v){u||(transition_in(m,v),u=!0)},o(v){transition_out(m,v),u=!1},d(v){m&&m.d(v)}}}function create_fragment$t(p){let u,f;return u=new Provider({props:{key:"user",data:{...p[1],roleId:p[2]},actions:p[0],$$slots:{default:[create_default_slot$g]},$$scope:{ctx:p}}}),{c(){create_component(u.$$.fragment)},m(m,v){mount_component(u,m,v),f=!0},p(m,[v]){const y={};v&6&&(y.data={...m[1],roleId:m[2]}),v&1&&(y.actions=m[0]),v&16&&(y.$$scope={dirty:v,ctx:m}),u.$set(y)},i(m){f||(transition_in(u.$$.fragment,m),f=!0)},o(m){transition_out(u.$$.fragment,m),f=!1},d(m){destroy_component(u,m)}}}function instance$t(p,u,f){let m,v,y;component_subscribe(p,authStore,S=>f(1,v=S)),component_subscribe(p,currentRole,S=>f(2,y=S));let{$$slots:w={},$$scope:k}=u;return p.$$set=S=>{"$$scope"in S&&f(4,k=S.$$scope)},f(0,m=[{type:ActionTypes.RefreshDatasource,callback:()=>authStore.actions.fetchUser(),metadata:{dataSource:{type:"table",tableId:TableNames.USERS}}}]),[m,v,y,w,k]}class UserBindingsProvider extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$t,create_fragment$t,safe_not_equal,{})}}function create_default_slot$f(p){let u;const f=p[5].default,m=create_slot(f,p,p[6],null);return{c(){m&&m.c()},m(v,y){m&&m.m(v,y),u=!0},p(v,y){m&&m.p&&(!u||y&64)&&update_slot_base(m,f,v,v[6],u?get_slot_changes(f,v[6],y,null):get_all_dirty_from_scope(v[6]),null)},i(v){u||(transition_in(m,v),u=!0)},o(v){transition_out(m,v),u=!1},d(v){m&&m.d(v)}}}function create_fragment$s(p){let u,f;return u=new Provider({props:{key:"device",data:p[0],$$slots:{default:[create_default_slot$f]},$$scope:{ctx:p}}}),{c(){create_component(u.$$.fragment)},m(m,v){mount_component(u,m,v),f=!0},p(m,[v]){const y={};v&1&&(y.data=m[0]),v&64&&(y.$$scope={dirty:v,ctx:m}),u.$set(y)},i(m){f||(transition_in(u.$$.fragment,m),f=!0)},o(m){transition_out(u.$$.fragment,m),f=!1},d(m){destroy_component(u,m)}}}const tabletBreakpoint=720,desktopBreakpoint=1280;function instance$s(p,u,f){let m,v,y;component_subscribe(p,themeStore,E=>f(4,y=E));let{$$slots:w={},$$scope:k}=u,S=window.innerWidth,M=window.innerHeight;const T=new ResizeObserver(E=>{var H,F;E!=null&&E[0]&&(f(1,S=(H=E[0].contentRect)==null?void 0:H.width),f(2,M=(F=E[0].contentRect)==null?void 0:F.height))});return onMount(()=>{T.observe(document.getElementById("app-body"))}),onDestroy(()=>{T.unobserve(document.getElementById("app-body"))}),p.$$set=E=>{"$$scope"in E&&f(6,k=E.$$scope)},p.$$.update=()=>{p.$$.dirty&16&&f(3,m=y.theme),p.$$.dirty&14&&f(0,v={mobile:S&&S<tabletBreakpoint,tablet:S&&S>=tabletBreakpoint&&S<desktopBreakpoint,width:S,height:M,theme:m})},[v,S,M,m,y,w,k]}class DeviceBindingsProvider extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$s,create_fragment$s,safe_not_equal,{})}}function create_default_slot$e(p){let u;const f=p[1].default,m=create_slot(f,p,p[2],null);return{c(){m&&m.c()},m(v,y){m&&m.m(v,y),u=!0},p(v,y){m&&m.p&&(!u||y&4)&&update_slot_base(m,f,v,v[2],u?get_slot_changes(f,v[2],y,null):get_all_dirty_from_scope(v[2]),null)},i(v){u||(transition_in(m,v),u=!0)},o(v){transition_out(m,v),u=!1},d(v){m&&m.d(v)}}}function create_fragment$r(p){let u,f;return u=new Provider({props:{key:"state",data:p[0],$$slots:{default:[create_default_slot$e]},$$scope:{ctx:p}}}),{c(){create_component(u.$$.fragment)},m(m,v){mount_component(u,m,v),f=!0},p(m,[v]){const y={};v&1&&(y.data=m[0]),v&4&&(y.$$scope={dirty:v,ctx:m}),u.$set(y)},i(m){f||(transition_in(u.$$.fragment,m),f=!0)},o(m){transition_out(u.$$.fragment,m),f=!1},d(m){destroy_component(u,m)}}}function instance$r(p,u,f){let m;component_subscribe(p,stateStore,w=>f(0,m=w));let{$$slots:v={},$$scope:y}=u;return p.$$set=w=>{"$$scope"in w&&f(2,y=w.$$scope)},[m,v,y]}class StateBindingsProvider extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$r,create_fragment$r,safe_not_equal,{})}}function create_default_slot$d(p){let u;const f=p[1].default,m=create_slot(f,p,p[2],null);return{c(){m&&m.c()},m(v,y){m&&m.m(v,y),u=!0},p(v,y){m&&m.p&&(!u||y&4)&&update_slot_base(m,f,v,v[2],u?get_slot_changes(f,v[2],y,null):get_all_dirty_from_scope(v[2]),null)},i(v){u||(transition_in(m,v),u=!0)},o(v){transition_out(m,v),u=!1},d(v){m&&m.d(v)}}}function create_fragment$q(p){let u,f;return u=new Provider({props:{key:"url",data:p[0].testUrlParams,$$slots:{default:[create_default_slot$d]},$$scope:{ctx:p}}}),{c(){create_component(u.$$.fragment)},m(m,v){mount_component(u,m,v),f=!0},p(m,[v]){const y={};v&1&&(y.data=m[0].testUrlParams),v&4&&(y.$$scope={dirty:v,ctx:m}),u.$set(y)},i(m){f||(transition_in(u.$$.fragment,m),f=!0)},o(m){transition_out(u.$$.fragment,m),f=!1},d(m){destroy_component(u,m)}}}function instance$q(p,u,f){let m;component_subscribe(p,routeStore,w=>f(0,m=w));let{$$slots:v={},$$scope:y}=u;return p.$$set=w=>{"$$scope"in w&&f(2,y=w.$$scope)},[m,v,y]}class TestUrlBindingsProvider extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$q,create_fragment$q,safe_not_equal,{})}}function create_default_slot$c(p){let u;const f=p[1].default,m=create_slot(f,p,p[2],null);return{c(){m&&m.c()},m(v,y){m&&m.m(v,y),u=!0},p(v,y){m&&m.p&&(!u||y&4)&&update_slot_base(m,f,v,v[2],u?get_slot_changes(f,v[2],y,null):get_all_dirty_from_scope(v[2]),null)},i(v){u||(transition_in(m,v),u=!0)},o(v){transition_out(m,v),u=!1},d(v){m&&m.d(v)}}}function create_fragment$p(p){let u,f;return u=new Provider({props:{key:"rowSelection",data:p[0],$$slots:{default:[create_default_slot$c]},$$scope:{ctx:p}}}),{c(){create_component(u.$$.fragment)},m(m,v){mount_component(u,m,v),f=!0},p(m,[v]){const y={};v&1&&(y.data=m[0]),v&4&&(y.$$scope={dirty:v,ctx:m}),u.$set(y)},i(m){f||(transition_in(u.$$.fragment,m),f=!0)},o(m){transition_out(u.$$.fragment,m),f=!1},d(m){destroy_component(u,m)}}}function instance$p(p,u,f){let m;component_subscribe(p,rowSelectionStore,w=>f(0,m=w));let{$$slots:v={},$$scope:y}=u;return p.$$set=w=>{"$$scope"in w&&f(2,y=w.$$scope)},[m,v,y]}class RowSelectionProvider extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$p,create_fragment$p,safe_not_equal,{})}}function create_default_slot$b(p){let u;const f=p[1].default,m=create_slot(f,p,p[2],null);return{c(){m&&m.c()},m(v,y){m&&m.m(v,y),u=!0},p(v,y){m&&m.p&&(!u||y&4)&&update_slot_base(m,f,v,v[2],u?get_slot_changes(f,v[2],y,null):get_all_dirty_from_scope(v[2]),null)},i(v){u||(transition_in(m,v),u=!0)},o(v){transition_out(m,v),u=!1},d(v){m&&m.d(v)}}}function create_fragment$o(p){let u,f;return u=new Provider({props:{key:"query",data:p[0].queryParams,$$slots:{default:[create_default_slot$b]},$$scope:{ctx:p}}}),{c(){create_component(u.$$.fragment)},m(m,v){mount_component(u,m,v),f=!0},p(m,[v]){const y={};v&1&&(y.data=m[0].queryParams),v&4&&(y.$$scope={dirty:v,ctx:m}),u.$set(y)},i(m){f||(transition_in(u.$$.fragment,m),f=!0)},o(m){transition_out(u.$$.fragment,m),f=!1},d(m){destroy_component(u,m)}}}function instance$o(p,u,f){let m;component_subscribe(p,routeStore,w=>f(0,m=w));let{$$slots:v={},$$scope:y}=u;return p.$$set=w=>{"$$scope"in w&&f(2,y=w.$$scope)},[m,v,y]}class QueryParamsProvider extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$o,create_fragment$o,safe_not_equal,{})}}const SettingsButton_svelte_svelte_type_style_lang="";function create_fragment$n(p){let u,f,m,v,y;return f=new Icon$1({props:{name:p[3],size:"S"}}),{c(){u=element("div"),create_component(f.$$.fragment),attr(u,"title",p[4]),attr(u,"class","svelte-1glfigx"),toggle_class(u,"active",p[0]),toggle_class(u,"disabled",p[6])},m(w,k){insert(w,u,k),mount_component(f,u,null),m=!0,v||(y=listen(u,"click",p[10]),v=!0)},p(w,[k]){const S={};k&8&&(S.name=w[3]),f.$set(S),(!m||k&16)&&attr(u,"title",w[4]),(!m||k&1)&&toggle_class(u,"active",w[0]),(!m||k&64)&&toggle_class(u,"disabled",w[6])},i(w){m||(transition_in(f.$$.fragment,w),m=!0)},o(w){transition_out(f.$$.fragment,w),m=!1},d(w){w&&detach(u),destroy_component(f),v=!1,y()}}}function instance$n(p,u,f){let m,{prop:v}=u,{value:y}=u,{icon:w}=u,{title:k}=u,{bool:S=!1}=u,{active:M=!1}=u,{component:T}=u,{disabled:E=!1}=u;const H=createEventDispatcher(),F=()=>{if(v){const Z=S?!m:y;builderStore.actions.updateProp(v,Z)}H("click")};return p.$$set=Z=>{"prop"in Z&&f(1,v=Z.prop),"value"in Z&&f(2,y=Z.value),"icon"in Z&&f(3,w=Z.icon),"title"in Z&&f(4,k=Z.title),"bool"in Z&&f(5,S=Z.bool),"active"in Z&&f(0,M=Z.active),"component"in Z&&f(9,T=Z.component),"disabled"in Z&&f(6,E=Z.disabled)},p.$$.update=()=>{p.$$.dirty&514&&f(7,m=T==null?void 0:T[v]),p.$$.dirty&166&&f(0,M=v&&(S?!!m:m===y))},[M,v,y,w,k,S,E,m,H,T,F]}class SettingsButton extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$n,create_fragment$n,safe_not_equal,{prop:1,value:2,icon:3,title:4,bool:5,active:0,component:9,disabled:6})}}const GridStylesButton_svelte_svelte_type_style_lang="";function create_fragment$m(p){let u,f,m,v,y;return f=new Icon$1({props:{name:p[2],size:"S"}}),{c(){u=element("div"),create_component(f.$$.fragment),attr(u,"title",p[3]),attr(u,"class","svelte-1leo12z"),toggle_class(u,"active",p[5])},m(w,k){insert(w,u,k),mount_component(f,u,null),m=!0,v||(y=listen(u,"click",p[6]),v=!0)},p(w,[k]){const S={};k&4&&(S.name=w[2]),f.$set(S),(!m||k&8)&&attr(u,"title",w[3]),(!m||k&32)&&toggle_class(u,"active",w[5])},i(w){m||(transition_in(f.$$.fragment,w),m=!0)},o(w){transition_out(f.$$.fragment,w),m=!1},d(w){w&&detach(u),destroy_component(f),v=!1,y()}}}function instance$m(p,u,f){let{style:m}=u,{value:v}=u,{icon:y}=u,{title:w}=u,{componentId:k}=u,{active:S}=u;const M=()=>{builderStore.actions.updateStyles({[m]:v},k)};return p.$$set=T=>{"style"in T&&f(0,m=T.style),"value"in T&&f(1,v=T.value),"icon"in T&&f(2,y=T.icon),"title"in T&&f(3,w=T.title),"componentId"in T&&f(4,k=T.componentId),"active"in T&&f(5,S=T.active)},[m,v,y,w,k,S,M]}class GridStylesButton extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$m,create_fragment$m,safe_not_equal,{style:0,value:1,icon:2,title:3,componentId:4,active:5})}}const SettingsColorPicker_svelte_svelte_type_style_lang="";function create_fragment$l(p){let u,f,m;return f=new ColorPicker({props:{size:"S",value:p[1]?null:p[2]}}),f.$on("change",p[4]),{c(){u=element("div"),create_component(f.$$.fragment),attr(u,"class","svelte-2tavi5"),toggle_class(u,"disabled",p[1])},m(v,y){insert(v,u,y),mount_component(f,u,null),m=!0},p(v,[y]){const w={};y&6&&(w.value=v[1]?null:v[2]),f.$set(w),(!m||y&2)&&toggle_class(u,"disabled",v[1])},i(v){m||(transition_in(f.$$.fragment,v),m=!0)},o(v){transition_out(f.$$.fragment,v),m=!1},d(v){v&&detach(u),destroy_component(f)}}}function instance$l(p,u,f){let m,{prop:v}=u,{component:y}=u,{disabled:w=!1}=u;const k=S=>{v&&builderStore.actions.updateProp(v,S.detail)};return p.$$set=S=>{"prop"in S&&f(0,v=S.prop),"component"in S&&f(3,y=S.component),"disabled"in S&&f(1,w=S.disabled)},p.$$.update=()=>{p.$$.dirty&9&&f(2,m=y==null?void 0:y[v])},[v,w,m,y,k]}class SettingsColorPicker extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$l,create_fragment$l,safe_not_equal,{prop:0,component:3,disabled:1})}}const SettingsPicker_svelte_svelte_type_style_lang="";function create_fragment$k(p){let u,f,m;return f=new Select_1({props:{quiet:!0,autoWidth:!0,placeholder:p[2],options:p[1],disabled:p[3],value:p[4]}}),f.$on("change",p[6]),{c(){u=element("div"),create_component(f.$$.fragment),attr(u,"class","svelte-y2na4k")},m(v,y){insert(v,u,y),mount_component(f,u,null),m=!0},p(v,[y]){const w={};y&4&&(w.placeholder=v[2]),y&2&&(w.options=v[1]),y&8&&(w.disabled=v[3]),y&16&&(w.value=v[4]),f.$set(w)},i(v){m||(transition_in(f.$$.fragment,v),m=!0)},o(v){transition_out(f.$$.fragment,v),m=!1},d(v){v&&detach(u),destroy_component(f)}}}function instance$k(p,u,f){let m,{prop:v}=u,{options:y}=u,{label:w}=u,{component:k}=u,{disabled:S=!1}=u;const M=T=>{v&&builderStore.actions.updateProp(v,T.detail)};return p.$$set=T=>{"prop"in T&&f(0,v=T.prop),"options"in T&&f(1,y=T.options),"label"in T&&f(2,w=T.label),"component"in T&&f(5,k=T.component),"disabled"in T&&f(3,S=T.disabled)},p.$$.update=()=>{p.$$.dirty&33&&f(4,m=k==null?void 0:k[v])},[v,y,w,S,m,k,M]}class SettingsPicker extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$k,create_fragment$k,safe_not_equal,{prop:0,options:1,label:2,component:5,disabled:3})}}const SettingsBar_svelte_svelte_type_style_lang="";function get_each_context$6(p,u,f){const m=p.slice();return m[38]=u[f],m[40]=f,m}function get_each_context_1(p,u,f){const m=p.slice();return m[41]=u[f],m}function create_if_block$b(p){let u,f,m,v,y=p[12]&&create_if_block_7$1(p),w=ensure_array_like(p[14]),k=[];for(let T=0;T<w.length;T+=1)k[T]=create_each_block$6(get_each_context$6(p,w,T));const S=T=>transition_out(k[T],1,1,()=>{k[T]=null});let M=!p[13]&&create_if_block_1$5(p);return{c(){u=element("div"),y&&y.c(),f=space();for(let T=0;T<k.length;T+=1)k[T].c();m=space(),M&&M.c(),attr(u,"class","bar svelte-zwufuk"),set_style(u,"top",p[3]+"px"),set_style(u,"left",p[4]+"px"),toggle_class(u,"visible",p[6])},m(T,E){insert(T,u,E),y&&y.m(u,null),append$2(u,f);for(let H=0;H<k.length;H+=1)k[H]&&k[H].m(u,null);append$2(u,m),M&&M.m(u,null),p[29](u),v=!0},p(T,E){if(T[12]?y?(y.p(T,E),E[0]&4096&&transition_in(y,1)):(y=create_if_block_7$1(T),y.c(),transition_in(y,1),y.m(u,f)):y&&(group_outros(),transition_out(y,1,1,()=>{y=null}),check_outros()),E[0]&24578){w=ensure_array_like(T[14]);let H;for(H=0;H<w.length;H+=1){const F=get_each_context$6(T,w,H);k[H]?(k[H].p(F,E),transition_in(k[H],1)):(k[H]=create_each_block$6(F),k[H].c(),transition_in(k[H],1),k[H].m(u,m))}for(group_outros(),H=w.length;H<k.length;H+=1)S(H);check_outros()}T[13]?M&&(group_outros(),transition_out(M,1,1,()=>{M=null}),check_outros()):M?(M.p(T,E),E[0]&8192&&transition_in(M,1)):(M=create_if_block_1$5(T),M.c(),transition_in(M,1),M.m(u,null)),(!v||E[0]&8)&&set_style(u,"top",T[3]+"px"),(!v||E[0]&16)&&set_style(u,"left",T[4]+"px"),(!v||E[0]&64)&&toggle_class(u,"visible",T[6])},i(T){if(!v){transition_in(y);for(let E=0;E<w.length;E+=1)transition_in(k[E]);transition_in(M),v=!0}},o(T){transition_out(y),k=k.filter(Boolean);for(let E=0;E<k.length;E+=1)transition_out(k[E]);transition_out(M),v=!1},d(T){T&&detach(u),y&&y.d(),destroy_each(k,T),M&&M.d(),p[29](null)}}}function create_if_block_7$1(p){let u,f,m,v,y,w,k,S,M,T,E,H,F,Z,$,J,se,ie,he,fe;return u=new GridStylesButton({props:{style:p[11],value:"start",icon:"AlignLeft",title:"Align left",active:p[7]==="start",componentId:p[0]}}),m=new GridStylesButton({props:{style:p[11],value:"center",icon:"AlignCenter",title:"Align center",active:p[7]==="center",componentId:p[0]}}),y=new GridStylesButton({props:{style:p[11],value:"end",icon:"AlignRight",title:"Align right",active:p[7]==="end",componentId:p[0]}}),k=new GridStylesButton({props:{style:p[11],value:"stretch",icon:"MoveLeftRight",title:"Stretch horizontally",active:p[7]==="stretch",componentId:p[0]}}),E=new GridStylesButton({props:{style:p[10],value:"start",icon:"AlignTop",title:"Align top",active:p[8]==="start",componentId:p[0]}}),F=new GridStylesButton({props:{style:p[10],value:"center",icon:"AlignMiddle",title:"Align middle",active:p[8]==="center",componentId:p[0]}}),$=new GridStylesButton({props:{style:p[10],value:"end",icon:"AlignBottom",title:"Align bottom",active:p[8]==="end",componentId:p[0]}}),se=new GridStylesButton({props:{style:p[10],value:"stretch",icon:"MoveUpDown",title:"Stretch vertically",active:p[8]==="stretch",componentId:p[0]}}),{c(){create_component(u.$$.fragment),f=space(),create_component(m.$$.fragment),v=space(),create_component(y.$$.fragment),w=space(),create_component(k.$$.fragment),S=space(),M=element("div"),T=space(),create_component(E.$$.fragment),H=space(),create_component(F.$$.fragment),Z=space(),create_component($.$$.fragment),J=space(),create_component(se.$$.fragment),ie=space(),he=element("div"),attr(M,"class","divider svelte-zwufuk"),attr(he,"class","divider svelte-zwufuk")},m(pe,ve){mount_component(u,pe,ve),insert(pe,f,ve),mount_component(m,pe,ve),insert(pe,v,ve),mount_component(y,pe,ve),insert(pe,w,ve),mount_component(k,pe,ve),insert(pe,S,ve),insert(pe,M,ve),insert(pe,T,ve),mount_component(E,pe,ve),insert(pe,H,ve),mount_component(F,pe,ve),insert(pe,Z,ve),mount_component($,pe,ve),insert(pe,J,ve),mount_component(se,pe,ve),insert(pe,ie,ve),insert(pe,he,ve),fe=!0},p(pe,ve){const Ae={};ve[0]&2048&&(Ae.style=pe[11]),ve[0]&128&&(Ae.active=pe[7]==="start"),ve[0]&1&&(Ae.componentId=pe[0]),u.$set(Ae);const ze={};ve[0]&2048&&(ze.style=pe[11]),ve[0]&128&&(ze.active=pe[7]==="center"),ve[0]&1&&(ze.componentId=pe[0]),m.$set(ze);const Se={};ve[0]&2048&&(Se.style=pe[11]),ve[0]&128&&(Se.active=pe[7]==="end"),ve[0]&1&&(Se.componentId=pe[0]),y.$set(Se);const Le={};ve[0]&2048&&(Le.style=pe[11]),ve[0]&128&&(Le.active=pe[7]==="stretch"),ve[0]&1&&(Le.componentId=pe[0]),k.$set(Le);const Ce={};ve[0]&1024&&(Ce.style=pe[10]),ve[0]&256&&(Ce.active=pe[8]==="start"),ve[0]&1&&(Ce.componentId=pe[0]),E.$set(Ce);const Ue={};ve[0]&1024&&(Ue.style=pe[10]),ve[0]&256&&(Ue.active=pe[8]==="center"),ve[0]&1&&(Ue.componentId=pe[0]),F.$set(Ue);const Ze={};ve[0]&1024&&(Ze.style=pe[10]),ve[0]&256&&(Ze.active=pe[8]==="end"),ve[0]&1&&(Ze.componentId=pe[0]),$.$set(Ze);const Ge={};ve[0]&1024&&(Ge.style=pe[10]),ve[0]&256&&(Ge.active=pe[8]==="stretch"),ve[0]&1&&(Ge.componentId=pe[0]),se.$set(Ge)},i(pe){fe||(transition_in(u.$$.fragment,pe),transition_in(m.$$.fragment,pe),transition_in(y.$$.fragment,pe),transition_in(k.$$.fragment,pe),transition_in(E.$$.fragment,pe),transition_in(F.$$.fragment,pe),transition_in($.$$.fragment,pe),transition_in(se.$$.fragment,pe),fe=!0)},o(pe){transition_out(u.$$.fragment,pe),transition_out(m.$$.fragment,pe),transition_out(y.$$.fragment,pe),transition_out(k.$$.fragment,pe),transition_out(E.$$.fragment,pe),transition_out(F.$$.fragment,pe),transition_out($.$$.fragment,pe),transition_out(se.$$.fragment,pe),fe=!1},d(pe){pe&&(detach(f),detach(v),detach(w),detach(S),detach(M),detach(T),detach(H),detach(Z),detach(J),detach(ie),detach(he)),destroy_component(u,pe),destroy_component(m,pe),destroy_component(y,pe),destroy_component(k,pe),destroy_component(E,pe),destroy_component(F,pe),destroy_component($,pe),destroy_component(se,pe)}}}function create_if_block_6$1(p){let u,f;return u=new SettingsColorPicker({props:{prop:p[38].key,component:p[1],disabled:!!p[38].license}}),{c(){create_component(u.$$.fragment)},m(m,v){mount_component(u,m,v),f=!0},p(m,v){const y={};v[0]&16384&&(y.prop=m[38].key),v[0]&2&&(y.component=m[1]),v[0]&16384&&(y.disabled=!!m[38].license),u.$set(y)},i(m){f||(transition_in(u.$$.fragment,m),f=!0)},o(m){transition_out(u.$$.fragment,m),f=!1},d(m){destroy_component(u,m)}}}function create_if_block_5$1(p){let u,f;return u=new SettingsButton({props:{prop:p[38].key,icon:p[38].barIcon,title:p[38].barTitle||p[38].label,disabled:!!p[38].license,bool:!0,component:p[1]}}),{c(){create_component(u.$$.fragment)},m(m,v){mount_component(u,m,v),f=!0},p(m,v){const y={};v[0]&16384&&(y.prop=m[38].key),v[0]&16384&&(y.icon=m[38].barIcon),v[0]&16384&&(y.title=m[38].barTitle||m[38].label),v[0]&16384&&(y.disabled=!!m[38].license),v[0]&2&&(y.component=m[1]),u.$set(y)},i(m){f||(transition_in(u.$$.fragment,m),f=!0)},o(m){transition_out(u.$$.fragment,m),f=!1},d(m){destroy_component(u,m)}}}function create_if_block_3$2(p){let u,f,m,v;const y=[create_if_block_4$1,create_else_block$2],w=[];function k(S,M){return S[38].barStyle==="buttons"?0:1}return u=k(p),f=w[u]=y[u](p),{c(){f.c(),m=empty$1()},m(S,M){w[u].m(S,M),insert(S,m,M),v=!0},p(S,M){let T=u;u=k(S),u===T?w[u].p(S,M):(group_outros(),transition_out(w[T],1,1,()=>{w[T]=null}),check_outros(),f=w[u],f?f.p(S,M):(f=w[u]=y[u](S),f.c()),transition_in(f,1),f.m(m.parentNode,m))},i(S){v||(transition_in(f),v=!0)},o(S){transition_out(f),v=!1},d(S){S&&detach(m),w[u].d(S)}}}function create_else_block$2(p){let u,f;return u=new SettingsPicker({props:{prop:p[38].key,options:p[38].options,label:p[38].label,disabled:!!p[38].license,component:p[1]}}),{c(){create_component(u.$$.fragment)},m(m,v){mount_component(u,m,v),f=!0},p(m,v){const y={};v[0]&16384&&(y.prop=m[38].key),v[0]&16384&&(y.options=m[38].options),v[0]&16384&&(y.label=m[38].label),v[0]&16384&&(y.disabled=!!m[38].license),v[0]&2&&(y.component=m[1]),u.$set(y)},i(m){f||(transition_in(u.$$.fragment,m),f=!0)},o(m){transition_out(u.$$.fragment,m),f=!1},d(m){destroy_component(u,m)}}}function create_if_block_4$1(p){let u,f,m=ensure_array_like(p[38].options),v=[];for(let w=0;w<m.length;w+=1)v[w]=create_each_block_1(get_each_context_1(p,m,w));const y=w=>transition_out(v[w],1,1,()=>{v[w]=null});return{c(){for(let w=0;w<v.length;w+=1)v[w].c();u=empty$1()},m(w,k){for(let S=0;S<v.length;S+=1)v[S]&&v[S].m(w,k);insert(w,u,k),f=!0},p(w,k){if(k[0]&16386){m=ensure_array_like(w[38].options);let S;for(S=0;S<m.length;S+=1){const M=get_each_context_1(w,m,S);v[S]?(v[S].p(M,k),transition_in(v[S],1)):(v[S]=create_each_block_1(M),v[S].c(),transition_in(v[S],1),v[S].m(u.parentNode,u))}for(group_outros(),S=m.length;S<v.length;S+=1)y(S);check_outros()}},i(w){if(!f){for(let k=0;k<m.length;k+=1)transition_in(v[k]);f=!0}},o(w){v=v.filter(Boolean);for(let k=0;k<v.length;k+=1)transition_out(v[k]);f=!1},d(w){w&&detach(u),destroy_each(v,w)}}}function create_each_block_1(p){let u,f;return u=new SettingsButton({props:{prop:p[38].key,value:p[41].value,icon:p[41].barIcon,title:p[41].barTitle||p[41].label,disabled:!!p[38].license,component:p[1]}}),{c(){create_component(u.$$.fragment)},m(m,v){mount_component(u,m,v),f=!0},p(m,v){const y={};v[0]&16384&&(y.prop=m[38].key),v[0]&16384&&(y.value=m[41].value),v[0]&16384&&(y.icon=m[41].barIcon),v[0]&16384&&(y.title=m[41].barTitle||m[41].label),v[0]&16384&&(y.disabled=!!m[38].license),v[0]&2&&(y.component=m[1]),u.$set(y)},i(m){f||(transition_in(u.$$.fragment,m),f=!0)},o(m){transition_out(u.$$.fragment,m),f=!1},d(m){destroy_component(u,m)}}}function create_if_block_2$3(p){let u;return{c(){u=element("div"),attr(u,"class","divider svelte-zwufuk")},m(f,m){insert(f,u,m)},d(f){f&&detach(u)}}}function create_each_block$6(p){let u,f,m,v,y;const w=[create_if_block_3$2,create_if_block_5$1,create_if_block_6$1],k=[];function S(T,E){return T[38].type==="select"?0:T[38].type==="boolean"?1:T[38].type==="color"?2:-1}~(u=S(p))&&(f=k[u]=w[u](p));let M=p[38].barSeparator!==!1&&(p[14].length!=p[40]+1||!p[13])&&create_if_block_2$3();return{c(){f&&f.c(),m=space(),M&&M.c(),v=empty$1()},m(T,E){~u&&k[u].m(T,E),insert(T,m,E),M&&M.m(T,E),insert(T,v,E),y=!0},p(T,E){let H=u;u=S(T),u===H?~u&&k[u].p(T,E):(f&&(group_outros(),transition_out(k[H],1,1,()=>{k[H]=null}),check_outros()),~u?(f=k[u],f?f.p(T,E):(f=k[u]=w[u](T),f.c()),transition_in(f,1),f.m(m.parentNode,m)):f=null),T[38].barSeparator!==!1&&(T[14].length!=T[40]+1||!T[13])?M||(M=create_if_block_2$3(),M.c(),M.m(v.parentNode,v)):M&&(M.d(1),M=null)},i(T){y||(transition_in(f),y=!0)},o(T){transition_out(f),y=!1},d(T){T&&(detach(m),detach(v)),~u&&k[u].d(T),M&&M.d(T)}}}function create_if_block_1$5(p){let u,f,m,v;return u=new SettingsButton({props:{icon:"Duplicate",title:"Duplicate component"}}),u.$on("click",p[27]),m=new SettingsButton({props:{icon:"Delete",title:"Delete component"}}),m.$on("click",p[28]),{c(){create_component(u.$$.fragment),f=space(),create_component(m.$$.fragment)},m(y,w){mount_component(u,y,w),insert(y,f,w),mount_component(m,y,w),v=!0},p:noop$2,i(y){v||(transition_in(u.$$.fragment,y),transition_in(m.$$.fragment,y),v=!0)},o(y){transition_out(u.$$.fragment,y),transition_out(m.$$.fragment,y),v=!1},d(y){y&&detach(f),destroy_component(u,y),destroy_component(m,y)}}}function create_fragment$j(p){let u,f,m=p[9]&&create_if_block$b(p);return{c(){m&&m.c(),u=empty$1()},m(v,y){m&&m.m(v,y),insert(v,u,y),f=!0},p(v,y){v[9]?m?(m.p(v,y),y[0]&512&&transition_in(m,1)):(m=create_if_block$b(v),m.c(),transition_in(m,1),m.m(u.parentNode,u)):m&&(group_outros(),transition_out(m,1,1,()=>{m=null}),check_outros())},i(v){f||(transition_in(m),f=!0)},o(v){transition_out(m),f=!1},d(v){v&&detach(u),m&&m.d(v)}}}const verticalOffset=36,horizontalOffset=2;function instance_1$1(p,u,f){let m,v,y,w,k,S,M,T,E,H,F,Z,$,J,se,ie,he=noop$2,fe=()=>(he(),he=subscribe(k,Gt=>f(23,ie=Gt)),k),pe,ve,Ae=noop$2,ze=()=>(Ae(),Ae=subscribe(w,Gt=>f(25,ve=Gt)),w),Se;component_subscribe(p,builderStore,Gt=>f(2,se=Gt)),component_subscribe(p,dndIsDragging,Gt=>f(24,pe=Gt)),component_subscribe(p,componentStore,Gt=>f(26,Se=Gt)),p.$$.on_destroy.push(()=>he()),p.$$.on_destroy.push(()=>Ae());const Le=getContext$1("context");component_subscribe(p,Le,Gt=>f(22,J=Gt));const Ce=new MutationObserver(()=>yt());let Ue=0,Ze=0,Ge,be,De=!1,Ke=!1,He=!1,rt,ft;const Mt=()=>{Ce.disconnect(),f(6,De=!1),Ke=!1,f(18,He=!1)},$e=Gt=>{Ce.observe(Gt,{attributes:!0,attributeFilter:["style"]}),Ke=!0},je=(Gt,Jt)=>{var Pt;let Ht=[];return(Pt=Jt==null?void 0:Jt.settings)==null||Pt.forEach(Et=>{Et.section&&shouldDisplaySetting(Gt,Et)?Ht=Ht.concat(Et.settings||[]):Ht.push(Et)}),Ht.filter(Et=>Et.showInBar&&!Et.hidden&&shouldDisplaySetting(Gt,Et))},yt=domDebounce(()=>{var nn;if(!S)return;let Gt=document.getElementsByClassName(m)[0];if(!Gt)return Mt();const Jt=Gt.dataset.insideGrid==="true";if(Jt&&!He){f(18,He=!0);return}else f(18,He=Jt);if(He||(Gt=Gt.getElementsByClassName(`${m}-dom`)[0]||((nn=Gt.children)==null?void 0:nn[0])),!Gt||!be)return Mt();Ke||$e(Gt);const Pt=document.getElementById("clip-root").getBoundingClientRect(),Et=Gt.getBoundingClientRect(),cn=be.offsetWidth,Sn=be.offsetHeight,{scrollX:$t,scrollY:xn,innerWidth:sn}=window;He&&(H?(f(7,rt=Gt.dataset.gridMobileHAlign),f(8,ft=Gt.dataset.gridMobileVAlign)):(f(7,rt=Gt.dataset.gridDesktopHAlign),f(8,ft=Gt.dataset.gridDesktopVAlign)));let mt=Et.top+xn-verticalOffset-Sn;mt<Pt.top-50&&(mt=Pt.top-50),mt<0&&(mt=0);const Mn=Pt.top+Pt.height;mt>Mn-44&&(mt=Mn-44),Et.top<Et.height&&Et.height<80&&(mt=Et.bottom+verticalOffset);let Wt=Et.left+$t+Et.width/2-cn/2;(Wt<0||Wt+cn>sn)&&(Wt=Et.left+$t-horizontalOffset,(Wt<0||Wt+cn>sn)&&(Wt=Et.right+$t-cn+horizontalOffset,(Wt<0||Wt+cn>sn)&&(Wt=horizontalOffset))),Math.round(mt)!==Math.round(Ue)&&f(3,Ue=mt),Math.round(Wt)!==Math.round(Ze)&&f(4,Ze=Wt),f(6,De=!0)});onMount(()=>{yt(),Ge=setInterval(yt,100),document.addEventListener("scroll",yt,!0)}),onDestroy(()=>{clearInterval(Ge),document.removeEventListener("scroll",yt,!0),Mt()});const ot=()=>{builderStore.actions.duplicateComponent(se.selectedComponentId)},Rt=()=>{builderStore.actions.deleteComponent(se.selectedComponentId)};function Xe(Gt){binding_callbacks[Gt?"unshift":"push"](()=>{be=Gt,f(5,be)})}return p.$$.update=()=>{var Gt,Jt,Ht,Pt;p.$$.dirty[0]&4&&f(0,m=se.selectedComponentId),p.$$.dirty[0]&1&&Mt(),p.$$.dirty[0]&67108864&&f(1,v=Se.selectedComponent),p.$$.dirty[0]&67108864&&f(21,y=Se.selectedComponentDefinition),p.$$.dirty[0]&1&&ze(f(16,w=componentStore.actions.getComponentInstance(m))),p.$$.dirty[0]&33554432&&fe(f(15,k=ve==null?void 0:ve.state)),p.$$.dirty[0]&27262976&&f(9,S=(y==null?void 0:y.showSettingsBar)!==!1&&!pe&&y&&!(ie!=null&&ie.errorState)),p.$$.dirty[0]&2097154&&f(14,M=je(v,y)),p.$$.dirty[0]&5&&f(13,T=m===((Jt=(Gt=se.screen)==null?void 0:Gt.props)==null?void 0:Jt._id)),p.$$.dirty[0]&2359296&&f(12,E=He&&(((Ht=y==null?void 0:y.grid)==null?void 0:Ht.hAlign)!=="stretch"||((Pt=y==null?void 0:y.grid)==null?void 0:Pt.vAlign)!=="stretch")),p.$$.dirty[0]&4194304&&f(19,H=J.device.mobile),p.$$.dirty[0]&524288&&f(20,F=H?Devices.Mobile:Devices.Desktop),p.$$.dirty[0]&1048576&&f(11,Z=getGridVar(F,GridParams.HAlign)),p.$$.dirty[0]&1048576&&f(10,$=getGridVar(F,GridParams.VAlign))},[m,v,se,Ue,Ze,be,De,rt,ft,S,$,Z,E,T,M,k,w,Le,He,H,F,y,J,ie,pe,ve,Se,ot,Rt,Xe]}class SettingsBar extends SvelteComponent{constructor(u){super(),init$1(this,u,instance_1$1,create_fragment$j,safe_not_equal,{},null,[-1,-1])}}const Indicator_svelte_svelte_type_style_lang="";function get_each_context$5(p,u,f){const m=p.slice();return m[16]=u[f],m}function create_if_block_1$4(p){let u,f,m,v=p[5]&&create_if_block_3$1(p),y=p[4]&&create_if_block_2$2(p);return{c(){u=element("div"),v&&v.c(),f=space(),y&&y.c(),attr(u,"class","label svelte-1qt4i99"),attr(u,"draggable","true"),attr(u,"data-indicator","true"),attr(u,"data-drag-mode",GridDragMode.Move),attr(u,"data-id",p[8]),toggle_class(u,"flipped",p[14]),toggle_class(u,"line",p[9]),toggle_class(u,"right",p[10])},m(w,k){insert(w,u,k),v&&v.m(u,null),append$2(u,f),y&&y.m(u,null),m=!0},p(w,k){w[5]?v?(v.p(w,k),k&32&&transition_in(v,1)):(v=create_if_block_3$1(w),v.c(),transition_in(v,1),v.m(u,f)):v&&(group_outros(),transition_out(v,1,1,()=>{v=null}),check_outros()),w[4]?y?y.p(w,k):(y=create_if_block_2$2(w),y.c(),y.m(u,null)):y&&(y.d(1),y=null),(!m||k&256)&&attr(u,"data-id",w[8]),(!m||k&16384)&&toggle_class(u,"flipped",w[14]),(!m||k&512)&&toggle_class(u,"line",w[9]),(!m||k&1024)&&toggle_class(u,"right",w[10])},i(w){m||(transition_in(v),m=!0)},o(w){transition_out(v),m=!1},d(w){w&&detach(u),v&&v.d(),y&&y.d()}}}function create_if_block_3$1(p){let u,f;return u=new Icon$1({props:{name:p[5],size:"S",color:"white"}}),{c(){create_component(u.$$.fragment)},m(m,v){mount_component(u,m,v),f=!0},p(m,v){const y={};v&32&&(y.name=m[5]),u.$set(y)},i(m){f||(transition_in(u.$$.fragment,m),f=!0)},o(m){transition_out(u.$$.fragment,m),f=!1},d(m){destroy_component(u,m)}}}function create_if_block_2$2(p){let u,f;return{c(){u=element("div"),f=text$1(p[4]),attr(u,"class","text svelte-1qt4i99")},m(m,v){insert(m,u,v),append$2(u,f)},p(m,v){v&16&&set_data(f,m[4])},d(m){m&&detach(u)}}}function create_if_block$a(p){let u,f=ensure_array_like(p[15]),m=[];for(let v=0;v<f.length;v+=1)m[v]=create_each_block$5(get_each_context$5(p,f,v));return{c(){for(let v=0;v<m.length;v+=1)m[v].c();u=empty$1()},m(v,y){for(let w=0;w<m.length;w+=1)m[w]&&m[w].m(v,y);insert(v,u,y)},p(v,y){if(y&33024){f=ensure_array_like(v[15]);let w;for(w=0;w<f.length;w+=1){const k=get_each_context$5(v,f,w);m[w]?m[w].p(k,y):(m[w]=create_each_block$5(k),m[w].c(),m[w].m(u.parentNode,u))}for(;w<m.length;w+=1)m[w].d(1);m.length=f.length}},d(v){v&&detach(u),destroy_each(m,v)}}}function create_each_block$5(p){let u,f,m;return{c(){u=element("div"),f=element("div"),m=space(),attr(f,"class","anchor-inner svelte-1qt4i99"),attr(u,"class","anchor "+p[16]+" svelte-1qt4i99"),attr(u,"draggable","true"),attr(u,"data-indicator","true"),attr(u,"data-drag-mode",GridDragMode.Resize),attr(u,"data-side",p[16]),attr(u,"data-id",p[8])},m(v,y){insert(v,u,y),append$2(u,f),append$2(u,m)},p(v,y){y&256&&attr(u,"data-id",v[8])},d(v){v&&detach(u)}}}function create_fragment$i(p){let u,f,m,v=(p[4]||p[5])&&create_if_block_1$4(p),y=p[11]&&create_if_block$a(p);return{c(){u=element("div"),v&&v.c(),f=space(),y&&y.c(),attr(u,"class","indicator svelte-1qt4i99"),set_style(u,"top",p[0]+"px"),set_style(u,"left",p[1]+"px"),set_style(u,"width",p[2]+"px"),set_style(u,"height",p[3]+"px"),set_style(u,"--color",p[6]),set_style(u,"--zIndex",p[7]),set_style(u,"--bg",p[12]||"none"),toggle_class(u,"flipped",p[14]),toggle_class(u,"line",p[9]),toggle_class(u,"withText",!!p[4]),toggle_class(u,"vCompact",p[3]<40),toggle_class(u,"hCompact",p[2]<40),toggle_class(u,"animate",p[13])},m(w,k){insert(w,u,k),v&&v.m(u,null),append$2(u,f),y&&y.m(u,null),m=!0},p(w,[k]){w[4]||w[5]?v?(v.p(w,k),k&48&&transition_in(v,1)):(v=create_if_block_1$4(w),v.c(),transition_in(v,1),v.m(u,f)):v&&(group_outros(),transition_out(v,1,1,()=>{v=null}),check_outros()),w[11]?y?y.p(w,k):(y=create_if_block$a(w),y.c(),y.m(u,null)):y&&(y.d(1),y=null),(!m||k&1)&&set_style(u,"top",w[0]+"px"),(!m||k&2)&&set_style(u,"left",w[1]+"px"),(!m||k&4)&&set_style(u,"width",w[2]+"px"),(!m||k&8)&&set_style(u,"height",w[3]+"px"),(!m||k&64)&&set_style(u,"--color",w[6]),(!m||k&128)&&set_style(u,"--zIndex",w[7]),(!m||k&4096)&&set_style(u,"--bg",w[12]||"none"),(!m||k&16384)&&toggle_class(u,"flipped",w[14]),(!m||k&512)&&toggle_class(u,"line",w[9]),(!m||k&16)&&toggle_class(u,"withText",!!w[4]),(!m||k&8)&&toggle_class(u,"vCompact",w[3]<40),(!m||k&4)&&toggle_class(u,"hCompact",w[2]<40),(!m||k&8192)&&toggle_class(u,"animate",w[13])},i(w){m||(transition_in(v),m=!0)},o(w){transition_out(v),m=!1},d(w){w&&detach(u),v&&v.d(),y&&y.d()}}}function instance$j(p,u,f){let m,{top:v}=u,{left:y}=u,{width:w}=u,{height:k}=u,{text:S}=u,{icon:M}=u,{color:T}=u,{zIndex:E}=u,{componentId:H}=u,{line:F=!1}=u,{alignRight:Z=!1}=u,{showResizeAnchors:$=!1}=u,{background:J}=u,{animate:se=!1}=u;const ie=["right","left","top","bottom","bottom-right","bottom-left","top-right","top-left"];return p.$$set=he=>{"top"in he&&f(0,v=he.top),"left"in he&&f(1,y=he.left),"width"in he&&f(2,w=he.width),"height"in he&&f(3,k=he.height),"text"in he&&f(4,S=he.text),"icon"in he&&f(5,M=he.icon),"color"in he&&f(6,T=he.color),"zIndex"in he&&f(7,E=he.zIndex),"componentId"in he&&f(8,H=he.componentId),"line"in he&&f(9,F=he.line),"alignRight"in he&&f(10,Z=he.alignRight),"showResizeAnchors"in he&&f(11,$=he.showResizeAnchors),"background"in he&&f(12,J=he.background),"animate"in he&&f(13,se=he.animate)},p.$$.update=()=>{p.$$.dirty&1&&f(14,m=v<24)},[v,y,w,k,S,M,T,E,H,F,Z,$,J,se,m,ie]}class Indicator extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$j,create_fragment$i,safe_not_equal,{top:0,left:1,width:2,height:3,text:4,icon:5,color:6,zIndex:7,componentId:8,line:9,alignRight:10,showResizeAnchors:11,background:12,animate:13})}}function get_each_context$4(p,u,f){const m=p.slice();return m[30]=u[f],m[32]=f,m}function create_each_block$4(p){let u,f;return u=new Indicator({props:{top:p[30].top,left:p[30].left,width:p[30].width,height:p[30].height,text:p[32]===0?p[2].text:void 0,icon:p[32]===0?p[2].icon:void 0,showResizeAnchors:p[2].allowResizeAnchors&&p[2].insideGrid,color:p[2].error?errorColor:p[2].color,componentId:p[2].componentId,zIndex:p[2].zIndex,background:p[0],animate:p[1]}}),{c(){create_component(u.$$.fragment)},m(m,v){mount_component(u,m,v),f=!0},p(m,v){const y={};v[0]&8&&(y.top=m[30].top),v[0]&8&&(y.left=m[30].left),v[0]&8&&(y.width=m[30].width),v[0]&8&&(y.height=m[30].height),v[0]&4&&(y.text=m[32]===0?m[2].text:void 0),v[0]&4&&(y.icon=m[32]===0?m[2].icon:void 0),v[0]&4&&(y.showResizeAnchors=m[2].allowResizeAnchors&&m[2].insideGrid),v[0]&4&&(y.color=m[2].error?errorColor:m[2].color),v[0]&4&&(y.componentId=m[2].componentId),v[0]&4&&(y.zIndex=m[2].zIndex),v[0]&1&&(y.background=m[0]),v[0]&2&&(y.animate=m[1]),u.$set(y)},i(m){f||(transition_in(u.$$.fragment,m),f=!0)},o(m){transition_out(u.$$.fragment,m),f=!1},d(m){destroy_component(u,m)}}}function create_fragment$h(p){let u,f,m=ensure_array_like(p[3]),v=[];for(let w=0;w<m.length;w+=1)v[w]=create_each_block$4(get_each_context$4(p,m,w));const y=w=>transition_out(v[w],1,1,()=>{v[w]=null});return{c(){for(let w=0;w<v.length;w+=1)v[w].c();u=empty$1()},m(w,k){for(let S=0;S<v.length;S+=1)v[S]&&v[S].m(w,k);insert(w,u,k),f=!0},p(w,k){if(k[0]&15){m=ensure_array_like(w[3]);let S;for(S=0;S<m.length;S+=1){const M=get_each_context$4(w,m,S);v[S]?(v[S].p(M,k),transition_in(v[S],1)):(v[S]=create_each_block$4(M),v[S].c(),transition_in(v[S],1),v[S].m(u.parentNode,u))}for(group_outros(),S=m.length;S<v.length;S+=1)y(S);check_outros()}},i(w){if(!f){for(let k=0;k<m.length;k+=1)transition_in(v[k]);f=!0}},o(w){v=v.filter(Boolean);for(let k=0;k<v.length;k+=1)transition_out(v[k]);f=!1},d(w){w&&detach(u),destroy_each(v,w)}}}const errorColor="var(--spectrum-global-color-static-red-600)";function instance$i(p,u,f){let m,v,y,w;component_subscribe(p,builderStore,De=>f(13,w=De));let{componentId:k}=u,{color:S}=u,{zIndex:M=900}=u,{prefix:T=void 0}=u,{allowResizeAnchors:E=!1}=u,{background:H=void 0}=u,{animate:F=!1}=u,{text:Z=void 0}=u,{icon:$=void 0}=u;const J=memo(u);component_subscribe(p,J,De=>f(12,y=De));const se=new MutationObserver(()=>be()),ie=()=>({componentId:k,color:S,zIndex:M,prefix:T,allowResizeAnchors:E,indicators:[],text:Z,icon:$,insideGrid:!1,error:!1});let he,fe=ie(),pe=!1,ve=!1,Ae=[],ze=0,Se;const Le=()=>{se.disconnect(),pe=!1,ve=!1},Ce=De=>[...document.getElementsByClassName(De)].filter(Ke=>Ke instanceof HTMLElement).slice(0,100),Ue=De=>{se.observe(De,{attributes:!0,attributeFilter:["style"]}),pe=!0},Ze=De=>Ke=>{ze>=Ae.length||(Se.indicators[De].visible=Se.indicators[De].insideModal||Se.indicators[De].insideSidePanel||Ke[0].isIntersecting,++ze===Ae.length&&(f(2,fe=Se),ve=!1))},be=domDebounce(()=>{var $e;if(ve)return;let De=Ce(k);if(!De.length){f(2,fe=ie());return}ve=!0,ze=0,Ae.forEach(je=>je.disconnect()),Ae=[],Se=ie(),pe||Ue(De[0]),Se.insideGrid=(($e=De[0])==null?void 0:$e.dataset.insideGrid)==="true",Z||(Se.text=De[0].dataset.name,Se.prefix&&(Se.text=`${Se.prefix} ${Se.text}`)),$||De[0].dataset.icon&&(Se.icon=De[0].dataset.icon),Se.error=De[0].classList.contains("error");const Ke=window.scrollX,He=window.scrollY;Se.insideGrid||(De=Ce(`${k}-dom`));const rt=De.length>1;if(!De.length){f(2,fe=ie());return}const ft=document.getElementById("app-root");if(!ft)throw"app-root node not found";const Mt=ft.getBoundingClientRect();Se.indicators=De.map((je,Ct)=>{const yt=je.getBoundingClientRect();let ot={top:Math.round(yt.top+He-Mt.top+v),left:Math.round(yt.left+Ke-Mt.left+v),width:Math.round(yt.width+2),height:Math.round(yt.height+2),visible:!0,insideModal:!1,insideSidePanel:!1};if(rt){const Rt=Ze(Ct),Xe=new IntersectionObserver(Rt,{threshold:1,root:ft});Xe.observe(je),Ae.push(Xe),ot.visible=!1,ot.insideSidePanel=!!je.closest(".side-panel"),ot.insideModal=!!je.closest(".modal-content")}return ot}),rt||(f(2,fe=Se),ve=!1)});return onMount(()=>{be(),he=setInterval(be,100),document.addEventListener("scroll",be,!0)}),onDestroy(()=>{se.disconnect(),clearInterval(he),document.removeEventListener("scroll",be,!0)}),p.$$set=De=>{f(29,u=assign(assign({},u),exclude_internal_props(De))),"componentId"in De&&f(5,k=De.componentId),"color"in De&&f(6,S=De.color),"zIndex"in De&&f(7,M=De.zIndex),"prefix"in De&&f(8,T=De.prefix),"allowResizeAnchors"in De&&f(9,E=De.allowResizeAnchors),"background"in De&&f(0,H=De.background),"animate"in De&&f(1,F=De.animate),"text"in De&&f(10,Z=De.text),"icon"in De&&f(11,$=De.icon)},p.$$.update=()=>{p.$$.dirty[0]&32&&Le(),p.$$.dirty[0]&4&&f(3,m=fe.indicators.filter(De=>De.visible)),p.$$.dirty[0]&8192&&(v=w.inBuilder?5:-1),p.$$.dirty[0]&992&&J.set({componentId:k,color:S,zIndex:M,prefix:T,allowResizeAnchors:E}),p.$$.dirty[0]&4096&&be()},u=exclude_internal_props(u),[H,F,fe,m,J,k,S,M,T,E,Z,$,y,w]}class IndicatorSet extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$i,create_fragment$h,safe_not_equal,{componentId:5,color:6,zIndex:7,prefix:8,allowResizeAnchors:9,background:0,animate:1,text:10,icon:11},null,[-1,-1])}}function create_if_block$9(p){let u,f;return u=new IndicatorSet({props:{componentId:p[0].selectedComponentId,color:p[1],zIndex:900,allowResizeAnchors:!0}}),{c(){create_component(u.$$.fragment)},m(m,v){mount_component(u,m,v),f=!0},p(m,v){const y={};v&1&&(y.componentId=m[0].selectedComponentId),v&2&&(y.color=m[1]),u.$set(y)},i(m){f||(transition_in(u.$$.fragment,m),f=!0)},o(m){transition_out(u.$$.fragment,m),f=!1},d(m){destroy_component(u,m)}}}function create_fragment$g(p){let u,f,m=!p[2]&&p[0].selectedComponentId&&create_if_block$9(p);return{c(){m&&m.c(),u=empty$1()},m(v,y){m&&m.m(v,y),insert(v,u,y),f=!0},p(v,[y]){!v[2]&&v[0].selectedComponentId?m?(m.p(v,y),y&5&&transition_in(m,1)):(m=create_if_block$9(v),m.c(),transition_in(m,1),m.m(u.parentNode,u)):m&&(group_outros(),transition_out(m,1,1,()=>{m=null}),check_outros())},i(v){f||(transition_in(m),f=!0)},o(v){transition_out(m),f=!1},d(v){v&&detach(u),m&&m.d(v)}}}function instance$h(p,u,f){let m,v,y;return component_subscribe(p,builderStore,w=>f(0,v=w)),component_subscribe(p,dndIsDragging,w=>f(2,y=w)),p.$$.update=()=>{p.$$.dirty&1&&f(1,m=v.editMode?"var(--spectrum-global-color-static-green-500)":"var(--spectrum-global-color-static-blue-600)")},[v,m,y]}class SelectionIndicator extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$h,create_fragment$g,safe_not_equal,{})}}function create_if_block$8(p){let u,f,m;return u=new IndicatorSet({props:{componentId:p[0],color:"var(--spectrum-global-color-static-blue-200)",zIndex:p[1]?890:910,allowResizeAnchors:!0}}),{c(){create_component(u.$$.fragment),f=space()},m(v,y){mount_component(u,v,y),insert(v,f,y),m=!0},p(v,y){const w={};y&1&&(w.componentId=v[0]),y&2&&(w.zIndex=v[1]?890:910),u.$set(w)},i(v){m||(transition_in(u.$$.fragment,v),m=!0)},o(v){transition_out(u.$$.fragment,v),m=!1},d(v){v&&detach(f),destroy_component(u,v)}}}function create_fragment$f(p){let u,f,m=!p[2]&&p[0]&&create_if_block$8(p);return{c(){m&&m.c(),u=text$1("}")},m(v,y){m&&m.m(v,y),insert(v,u,y),f=!0},p(v,[y]){!v[2]&&v[0]?m?(m.p(v,y),y&5&&transition_in(m,1)):(m=create_if_block$8(v),m.c(),transition_in(m,1),m.m(u.parentNode,u)):m&&(group_outros(),transition_out(m,1,1,()=>{m=null}),check_outros())},i(v){f||(transition_in(m),f=!0)},o(v){transition_out(m),f=!1},d(v){v&&detach(u),m&&m.d(v)}}}function instance$g(p,u,f){let m,v,y,w,k,S;component_subscribe(p,builderStore,E=>f(4,w=E)),component_subscribe(p,hoverStore,E=>f(5,k=E)),component_subscribe(p,dndIsDragging,E=>f(2,S=E));const M=E=>{var Z;const H=E.target;if(E.buttons>0)return;let F;if(H.classList.contains("anchor"))F=H.dataset.id;else{const $=H.closest(".interactive.component:not(.root)");$ instanceof HTMLElement&&(F=(Z=$.dataset)==null?void 0:Z.id)}F!==m&&hoverStore.actions.hoverComponent(F)},T=()=>{hoverStore.actions.hoverComponent(null)};return onMount(()=>{document.addEventListener("mouseover",M),document.body.addEventListener("mouseleave",T)}),onDestroy(()=>{document.removeEventListener("mouseover",M),document.body.removeEventListener("mouseleave",T)}),p.$$.update=()=>{p.$$.dirty&32&&f(0,m=k.hoveredComponentId),p.$$.dirty&16&&f(3,v=w.selectedComponentId),p.$$.dirty&9&&f(1,y=m===v)},[m,y,S,v,w,k]}class HoverIndicator extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$g,create_fragment$f,safe_not_equal,{})}}const CustomThemeWrapper_svelte_svelte_type_style_lang="";function create_fragment$e(p){let u,f,m;const v=p[2].default,y=create_slot(v,p,p[1],null);return{c(){u=element("div"),y&&y.c(),attr(u,"style",f=p[0].customThemeCss),attr(u,"id","theme-root"),attr(u,"class","svelte-11fpj2n")},m(w,k){insert(w,u,k),y&&y.m(u,null),m=!0},p(w,[k]){y&&y.p&&(!m||k&2)&&update_slot_base(y,v,w,w[1],m?get_slot_changes(v,w[1],k,null):get_all_dirty_from_scope(w[1]),null),(!m||k&1&&f!==(f=w[0].customThemeCss))&&attr(u,"style",f)},i(w){m||(transition_in(y,w),m=!0)},o(w){transition_out(y,w),m=!1},d(w){w&&detach(u),y&&y.d(w)}}}function instance$f(p,u,f){let m;component_subscribe(p,themeStore,w=>f(0,m=w));let{$$slots:v={},$$scope:y}=u;return setContext(Context$1.PopoverRoot,"#theme-root"),p.$$set=w=>{"$$scope"in w&&f(1,y=w.$$scope)},[m,y,v]}class CustomThemeWrapper extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$f,create_fragment$e,safe_not_equal,{})}}const ThrottleRate=130;function instance$e(p,u,f){let m,v,y,w,k,S;component_subscribe(p,dndStore,he=>f(0,k=he)),component_subscribe(p,isGridScreen,he=>f(1,S=he));let M=!1;const T=he=>{const fe=document.getElementsByClassName(`${he}-dom`)[0];return fe instanceof HTMLElement?fe:void 0},E=he=>{const fe=he.reduce((ve,Ae)=>ve+Ae,0)/he.length;let pe=0;return he.forEach(ve=>{const Ae=ve-fe;pe+=Ae*Ae}),pe/he.length},H=()=>{if(!M){if(m!=null&&m.id){const he=document.getElementsByClassName(m==null?void 0:m.id)[0];he&&he.removeEventListener("dragend",H)}dndStore.actions.reset()}},F=he=>{var Se,Le;if(isGridEvent(he)||!(he.target instanceof HTMLElement))return;const fe=he.target.closest(".component");if(!(fe instanceof HTMLElement)||!fe.classList.contains("draggable"))return;(Se=he.dataTransfer)==null||Se.setDragImage(new Image,0,0),fe.addEventListener("dragend",H);const pe=fe.dataset.id,ve=fe.dataset.parent,Ae=findComponentById((Le=get_store_value(screenStore).activeScreen)==null?void 0:Le.props,ve),ze=Ae._children.findIndex(Ce=>Ce._id===pe);dndStore.actions.startDraggingExistingComponent({id:pe,bounds:fe.children[0].getBoundingClientRect(),parent:ve,index:ze,name:fe.dataset.name,icon:fe.dataset.icon,type:Ae._children[ze]._component}),builderStore.actions.selectComponent(pe),setTimeout(()=>{dndStore.actions.updateDrop({parent:ve,index:ze})},0)},Z=throttle((he,fe)=>{var He;if(!v)return;let{id:pe,parent:ve,element:Ae,acceptsChildren:ze,empty:Se}=v;if(ze||(pe=ve,Se=!1,Ae=T(ve)),Se){dndStore.actions.updateDrop({parent:pe,index:0});return}const Le=Ae==null?void 0:Ae.getElementsByClassName("component")[0];(Le==null?void 0:Le.parentNode)instanceof HTMLElement&&(Ae=Le.parentNode);let Ce;(Ae==null?void 0:Ae.children.length)===1&&(Ce=document.createElement("div"),Ce.dataset.id=DNDPlaceholderID,Ae.appendChild(Ce));const Ue=[...(Ae==null?void 0:Ae.children)||[]].filter(rt=>rt instanceof HTMLElement).map(rt=>{var $e;const Mt=((($e=rt.children)==null?void 0:$e[0])||rt).getBoundingClientRect();return{placeholder:rt.dataset.id===DNDPlaceholderID,centerX:Mt.left+Mt.width/2,centerY:Mt.top+Mt.height/2,left:Mt.left,right:Mt.right,top:Mt.top,bottom:Mt.bottom}});Ce&&(Ae==null||Ae.removeChild(Ce));const Ze=Object.keys(Ue[0]||{}).filter(rt=>rt!=="placeholder").map(rt=>{const ft=rt,Mt=Ue.map($e=>$e[ft]);return{variance:E(Mt),side:rt}});Ze.sort((rt,ft)=>rt.variance<ft.variance?-1:1);const Ge=["centerX","left","right"].includes((He=Ze[0])==null?void 0:He.side),be=Ue.filter(rt=>!rt.placeholder).map(rt=>Ge?rt.centerY:rt.centerX),De=Ge?fe:he;let Ke=0;for(;Ke<be.length&&be[Ke]<De;)Ke++;dndStore.actions.updateDrop({parent:pe,index:Ke})},ThrottleRate),$=he=>{he.preventDefault(),he.stopPropagation(),Z(he.clientX,he.clientY)},J=he=>{!m||!v||w||$(he)},se=async he=>{var pe,ve;if(!m||w||!(he.target instanceof HTMLElement))return;let fe=(ve=(pe=he.target).closest)==null?void 0:ve.call(pe,`.component:not(.block):not(.${m.id})`);fe instanceof HTMLElement&&fe!=null&&fe.classList.contains("droppable")&&(dndStore.actions.updateTarget({id:fe.dataset.id,parent:fe.dataset.parent,element:T(fe.dataset.id),empty:fe.classList.contains("empty"),acceptsChildren:fe.classList.contains("parent")}),$(he))},ie=async()=>{var Ae,ze,Se,Le,Ce;if(!m||!(y!=null&&y.parent)||(y==null?void 0:y.index)==null)return;if(m.isNew){M=!0,builderStore.actions.dropNewComponent(m.type,y.parent,y.index,(Ae=k.meta)==null?void 0:Ae.props),M=!1,H();return}let he,fe;const pe=findComponentById((ze=get_store_value(screenStore).activeScreen)==null?void 0:ze.props,y.parent);if(!pe||m.parent===y.parent&&m.index===y.index)return;const ve=(Se=pe._children)==null?void 0:Se.filter(Ue=>Ue._id!==DNDPlaceholderID&&Ue._id!==m.id);ve!=null&&ve.length?y.index===0?(he=(Le=ve[0])==null?void 0:Le._id,fe="above"):(he=(Ce=ve[y.index-1])==null?void 0:Ce._id,fe="below"):(he=pe._id,fe="inside"),he&&fe&&(M=!0,await builderStore.actions.moveComponent(m.id,he,fe),M=!1,H())};return onMount(()=>{document.addEventListener("dragstart",F,!1),document.addEventListener("dragover",J,!1),document.addEventListener("dragenter",se,!1),document.addEventListener("drop",ie,!1)}),onDestroy(()=>{document.removeEventListener("dragstart",F,!1),document.removeEventListener("dragover",J,!1),document.removeEventListener("dragenter",se,!1),document.removeEventListener("drop",ie,!1)}),p.$$.update=()=>{p.$$.dirty&1&&(m=k.source),p.$$.dirty&1&&(v=k.target),p.$$.dirty&1&&(y=k.drop),p.$$.dirty&2&&(w=S)},[k,S]}class DNDHandler extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$e,null,safe_not_equal,{})}}function instance_1(p,u,f){let m,v,y,w,k,S,M,T,E,H=noop$2,F=()=>(H(),H=subscribe(w,Ze=>f(8,E=Ze)),w),Z;component_subscribe(p,isGridScreen,Ze=>f(13,S=Ze)),component_subscribe(p,dndSource,Ze=>f(14,M=Ze)),component_subscribe(p,dndIsDragging,Ze=>f(7,T=Ze)),p.$$.on_destroy.push(()=>H());const $=getContext$1("context");component_subscribe(p,$,Ze=>f(9,Z=Ze));const J=new Image(1,1);J.src="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==";let se,ie,he=memo();component_subscribe(p,he,Ze=>f(6,k=Ze));const fe=()=>(se==null?void 0:se.scrollTop)||0,pe=async(Ze,Ge)=>{Ze==null||Ze.setEphemeralStyles(Ge),M!=null&&M.isNew&&Ge&&dndStore.actions.updateNewComponentProps({_styles:{normal:Ge}})},ve=(Ze,Ge,be)=>Math.min(be,Math.max(Ge,Ze)),Ae=domDebounce((Ze,Ge)=>{if(!(ie!=null&&ie.grid))return;const{mode:be,grid:De,domGrid:Ke}=ie,{startX:He,startY:rt,rowStart:ft,rowEnd:Mt,colStart:$e,colEnd:je}=De;if(!Ke)return;const Ct=parseInt(Ke.dataset.cols||""),yt=parseInt(Ke.dataset.colSize||"");if(isNaN(Ct)||isNaN(yt))throw"DOM grid missing required dataset attributes";const ot=Ze-He;let Rt=Math.round(ot/yt);const Xe=Ge-rt+fe();let Gt=Math.round(Xe/GridRowHeight);if(be===GridDragMode.Move){Rt=ve(Rt,1-$e,Ct+1-je),Gt=Math.max(Gt,1-ft);const Jt={[v.colStart]:$e+Rt,[v.colEnd]:je+Rt,[v.rowStart]:ft+Gt,[v.rowEnd]:Mt+Gt};he.set(Jt)}else if(be===GridDragMode.Resize){const{side:Jt}=ie;let Ht={};Jt==="right"?Ht[v.colEnd]=Math.max(je+Rt,$e+1):Jt==="left"?Ht[v.colStart]=Math.min($e+Rt,je-1):Jt==="top"?Ht[v.rowStart]=Math.min(ft+Gt,Mt-1):Jt==="bottom"?Ht[v.rowEnd]=Math.max(Mt+Gt,ft+1):Jt==="bottom-right"?(Ht[v.colEnd]=Math.max(je+Rt,$e+1),Ht[v.rowEnd]=Math.max(Mt+Gt,ft+1)):Jt==="bottom-left"?(Ht[v.colStart]=Math.min($e+Rt,je-1),Ht[v.rowEnd]=Math.max(Mt+Gt,ft+1)):Jt==="top-right"?(Ht[v.colEnd]=Math.max(je+Rt,$e+1),Ht[v.rowStart]=Math.min(ft+Gt,Mt-1)):Jt==="top-left"&&(Ht[v.colStart]=Math.min($e+Rt,je-1),Ht[v.rowStart]=Math.min(ft+Gt,Mt-1)),he.set(Ht)}}),ze=Ze=>{Ze.preventDefault(),Ze.stopPropagation(),Ae(Ze.clientX,Ze.clientY)},Se=()=>{const Ze=document.getElementsByClassName(DNDPlaceholderID)[0],Ge=Ze==null?void 0:Ze.closest(".grid");if(!(Ze instanceof HTMLElement)||!(Ge instanceof HTMLElement))return;const be=getComputedStyle(Ze),De=Ze.getBoundingClientRect();Ze.classList.add("dragging"),Ge.classList.add("highlight"),f(3,ie={domComponent:Ze,domGrid:Ge,id:DNDPlaceholderID,gridId:Ge.parentElement.dataset.id,mode:GridDragMode.Move,grid:{startX:De.left+De.width/2,startY:De.top+De.height/2+fe(),rowStart:parseInt(be.gridRowStart),rowEnd:parseInt(be.gridRowEnd),colStart:parseInt(be.gridColumnStart),colEnd:parseInt(be.gridColumnEnd)}})},Le=Ze=>{if(!isGridEvent(Ze))return;Ze.dataTransfer.setDragImage(J,0,0);let Ge,be,De;Ze.target.dataset.indicator==="true"?(Ge=Ze.target.dataset.dragMode,be=Ze.target.dataset.id,De=Ze.target.dataset.side):(Ge=GridDragMode.Move,be=Ze.target.closest(".component").dataset.id),Ge===GridDragMode.Move&&(Ze.ctrlKey||Ze.metaKey)&&builderStore.actions.duplicateComponent(be,"above",!1);const Ke=document.getElementsByClassName(be)[0],He=Ke==null?void 0:Ke.closest(".grid");if(!(Ke instanceof HTMLElement)||!(He instanceof HTMLElement))return;const rt=getComputedStyle(Ke);Ke.classList.add("dragging"),He.classList.add("highlight"),builderStore.actions.selectComponent(be),f(3,ie={domTarget:Ze.target,domComponent:Ke,domGrid:He,id:be,gridId:He.parentElement.dataset.id,mode:Ge,side:De,grid:{startX:Ze.clientX,startY:Ze.clientY+fe(),rowStart:parseInt(rt.gridRowStart),rowEnd:parseInt(rt.gridRowEnd),colStart:parseInt(rt.gridColumnStart),colEnd:parseInt(rt.gridColumnEnd)}}),ie.domTarget.addEventListener("dragend",Ue,!1)},Ce=Ze=>{if(!ie){T&&(M!=null&&M.isNew)&&S&&Se();return}ze(Ze)},Ue=async()=>{if(!ie)return;const{id:Ze,domTarget:Ge,domGrid:be,domComponent:De}=ie;De.classList.remove("dragging"),be.classList.remove("highlight"),Ge==null||Ge.removeEventListener("dragend",Ue),k&&builderStore.actions.updateStyles(k,Ze),f(3,ie=void 0),he.set(void 0)};return onMount(()=>{se=document.getElementsByClassName("screen-wrapper")[0],document.addEventListener("dragstart",Le,!1),document.addEventListener("dragover",Ce,!1),document.addEventListener("scroll",Ae)}),onDestroy(()=>{document.removeEventListener("dragstart",Le,!1),document.removeEventListener("dragover",Ce,!1),document.removeEventListener("scroll",Ae)}),p.$$.update=()=>{var Ze;p.$$.dirty&512&&f(5,m=(Ze=Z.device)!=null&&Ze.mobile?Devices.Mobile:Devices.Desktop),p.$$.dirty&32&&(v={colStart:getGridVar(m,GridParams.ColStart),colEnd:getGridVar(m,GridParams.ColEnd),rowStart:getGridVar(m,GridParams.RowStart),rowEnd:getGridVar(m,GridParams.RowEnd)}),p.$$.dirty&8&&f(4,y=ie==null?void 0:ie.id),p.$$.dirty&16&&F(f(0,w=componentStore.actions.getComponentInstance(y))),p.$$.dirty&320&&pe(E,k),p.$$.dirty&128&&!T&&Ue()},[w,$,he,ie,y,m,k,T,E,Z]}class GridDNDHandler extends SvelteComponent{constructor(u){super(),init$1(this,u,instance_1,null,safe_not_equal,{})}}function instance$d(p){onMount(()=>{get_store_value(builderStore).inBuilder&&document.addEventListener("keydown",u)}),onDestroy(()=>{get_store_value(builderStore).inBuilder&&document.removeEventListener("keydown",u)});const u=f=>{var y;const m=get_store_value(builderStore);if(!m.inBuilder||m.editMode)return;const v=(y=document.activeElement)==null?void 0:y.tagName.toLowerCase();["input","textarea"].indexOf(v)===-1&&(f.ctrlKey&&f.key==="d"&&f.preventDefault(),builderStore.actions.keyDown(f.key,f.ctrlKey))};return[]}class KeyboardManager extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$d,null,safe_not_equal,{})}}const DevToolsHeader_svelte_svelte_type_style_lang="";function create_default_slot_3$4(p){let u;return{c(){u=text$1("Preview")},m(f,m){insert(f,u,m)},d(f){f&&detach(u)}}}function create_if_block_1$3(p){let u,f;return u=new ActionButton({props:{quiet:!0,icon:"Code",$$slots:{default:[create_default_slot_2$5]},$$scope:{ctx:p}}}),u.$on("click",p[7]),{c(){create_component(u.$$.fragment)},m(m,v){mount_component(u,m,v),f=!0},p(m,v){const y={};v&1024&&(y.$$scope={dirty:v,ctx:m}),u.$set(y)},i(m){f||(transition_in(u.$$.fragment,m),f=!0)},o(m){transition_out(u.$$.fragment,m),f=!1},d(m){destroy_component(u,m)}}}function create_default_slot_2$5(p){let u;return{c(){u=text$1("DevTools")},m(f,m){insert(f,u,m)},d(f){f&&detach(u)}}}function create_if_block$7(p){let u,f,m,v;return u=new ActionButton({props:{quiet:!0,icon:"LinkOut",$$slots:{default:[create_default_slot_1$6]},$$scope:{ctx:p}}}),u.$on("click",p[8]),m=new ActionButton({props:{quiet:!0,icon:"Close",$$slots:{default:[create_default_slot$a]},$$scope:{ctx:p}}}),m.$on("click",p[9]),{c(){create_component(u.$$.fragment),f=space(),create_component(m.$$.fragment)},m(y,w){mount_component(u,y,w),insert(y,f,w),mount_component(m,y,w),v=!0},p(y,w){const k={};w&1024&&(k.$$scope={dirty:w,ctx:y}),u.$set(k);const S={};w&1024&&(S.$$scope={dirty:w,ctx:y}),m.$set(S)},i(y){v||(transition_in(u.$$.fragment,y),transition_in(m.$$.fragment,y),v=!0)},o(y){transition_out(u.$$.fragment,y),transition_out(m.$$.fragment,y),v=!1},d(y){y&&detach(f),destroy_component(u,y),destroy_component(m,y)}}}function create_default_slot_1$6(p){let u;return{c(){u=text$1("Fullscreen")},m(f,m){insert(f,u,m)},d(f){f&&detach(u)}}}function create_default_slot$a(p){let u;return{c(){u=text$1("Close")},m(f,m){insert(f,u,m)},d(f){f&&detach(u)}}}function create_fragment$d(p){let u,f,m,v,y,w,k;f=new Heading$1({props:{size:"XS",$$slots:{default:[create_default_slot_3$4]},$$scope:{ctx:p}}}),v=new Select_1({props:{quiet:!0,options:p[0],value:p[2].role||SELF_ROLE,placeholder:null,autoWidth:!0}}),v.$on("change",p[6]);let S=!p[1].device.mobile&&create_if_block_1$3(p),M=window.parent.isBuilder&&create_if_block$7(p);return{c(){u=element("div"),create_component(f.$$.fragment),m=space(),create_component(v.$$.fragment),y=space(),S&&S.c(),w=space(),M&&M.c(),attr(u,"class","dev-preview-header svelte-1fadx2d"),toggle_class(u,"mobile",p[1].device.mobile)},m(T,E){insert(T,u,E),mount_component(f,u,null),append$2(u,m),mount_component(v,u,null),append$2(u,y),S&&S.m(u,null),append$2(u,w),M&&M.m(u,null),k=!0},p(T,[E]){const H={};E&1024&&(H.$$scope={dirty:E,ctx:T}),f.$set(H);const F={};E&1&&(F.options=T[0]),E&4&&(F.value=T[2].role||SELF_ROLE),v.$set(F),T[1].device.mobile?S&&(group_outros(),transition_out(S,1,1,()=>{S=null}),check_outros()):S?(S.p(T,E),E&2&&transition_in(S,1)):(S=create_if_block_1$3(T),S.c(),transition_in(S,1),S.m(u,w)),window.parent.isBuilder&&M.p(T,E),(!k||E&2)&&toggle_class(u,"mobile",T[1].device.mobile)},i(T){k||(transition_in(f.$$.fragment,T),transition_in(v.$$.fragment,T),transition_in(S),transition_in(M),k=!0)},o(T){transition_out(f.$$.fragment,T),transition_out(v.$$.fragment,T),transition_out(S),transition_out(M),k=!1},d(T){T&&detach(u),destroy_component(f),destroy_component(v),S&&S.d(),M&&M.d()}}}const SELF_ROLE="self";function buildRoleList(p){var f;const u=[];if(u.push({label:"View as yourself",value:SELF_ROLE}),!p)return u;for(let m of p)u.push({label:`View as ${((f=m.uiMetadata)==null?void 0:f.displayName)||m.name}`,value:m._id});return u}function instance$c(p,u,f){let m,v,y,w;component_subscribe(p,devToolsStore,F=>f(2,y=F)),component_subscribe(p,appStore,F=>f(3,w=F));const k=getContext$1("context");component_subscribe(p,k,F=>f(1,v=F));let S;onMount(async()=>{await devToolsStore.actions.changeRole(SELF_ROLE),f(5,S=await API.getRoles())});const M=F=>devToolsStore.actions.changeRole(F.detail),T=()=>devToolsStore.actions.setVisible(!y.visible),E=()=>{var F,Z;(Z=(F=window.parent).closePreview)==null||Z.call(F),window.open(`/${w.appId}`,"_blank")},H=()=>{var F,Z;return(Z=(F=window.parent).closePreview)==null?void 0:Z.call(F)};return p.$$.update=()=>{p.$$.dirty&32&&f(0,m=buildRoleList(S))},[m,v,y,w,k,S,M,T,E,H]}class DevToolsHeader extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$c,create_fragment$d,safe_not_equal,{})}}const DevToolsStat_svelte_svelte_type_style_lang="";function create_fragment$c(p){let u,f,m,v,y,w,k,S;return{c(){u=element("div"),f=element("div"),m=text$1(p[3]),v=space(),y=element("div"),w=text$1(p[2]),attr(f,"class","stat-label svelte-da3g1f"),attr(f,"title",p[3]),attr(y,"class","stat-value svelte-da3g1f"),attr(y,"title",p[2]),toggle_class(y,"copyable",p[1]),toggle_class(y,"empty",p[0]),attr(u,"class","stat svelte-da3g1f")},m(M,T){insert(M,u,T),append$2(u,f),append$2(f,m),append$2(u,v),append$2(u,y),append$2(y,w),k||(S=listen(y,"click",function(){is_function(p[1]?p[4]:null)&&(p[1]?p[4]:null).apply(this,arguments)}),k=!0)},p(M,[T]){p=M,T&8&&set_data(m,p[3]),T&8&&attr(f,"title",p[3]),T&4&&set_data(w,p[2]),T&4&&attr(y,"title",p[2]),T&2&&toggle_class(y,"copyable",p[1]),T&1&&toggle_class(y,"empty",p[0])},i:noop$2,o:noop$2,d(M){M&&detach(u),k=!1,S()}}}function instance$b(p,u,f){let m,v,y,w,{label:k}=u,{value:S}=u,{copyable:M=!1}=u;const T=async()=>{try{await copyToClipboard(S),notificationStore.actions.success("Copied to clipboard")}catch{notificationStore.actions.error("Failed to copy to clipboard. Check the dev console for the value."),console.warn("Failed to copy the value",S)}};return p.$$set=E=>{"label"in E&&f(5,k=E.label),"value"in E&&f(6,S=E.value),"copyable"in E&&f(7,M=E.copyable)},p.$$.update=()=>{p.$$.dirty&32&&f(3,m=k??"-"),p.$$.dirty&64&&f(2,v=S??"-"),p.$$.dirty&64&&f(0,y=S==null),p.$$.dirty&129&&f(1,w=M&&!y)},[y,w,v,m,T,k,S,M]}class DevToolsStat extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$b,create_fragment$c,safe_not_equal,{label:5,value:6,copyable:7})}}function create_if_block$6(p){let u,f;return u=new DevToolsStat({props:{label:"Client load time",value:`${p[0].clientLoadTime} ms`}}),{c(){create_component(u.$$.fragment)},m(m,v){mount_component(u,m,v),f=!0},p(m,v){const y={};v&1&&(y.value=`${m[0].clientLoadTime} ms`),u.$set(y)},i(m){f||(transition_in(u.$$.fragment,m),f=!0)},o(m){transition_out(u.$$.fragment,m),f=!1},d(m){destroy_component(u,m)}}}function create_default_slot$9(p){var he,fe,pe,ve,Ae,ze,Se;let u,f,m,v,y,w,k,S,M,T,E,H,F,Z,$,J,se;u=new DevToolsStat({props:{label:"App",value:(he=p[0].application)==null?void 0:he.name}}),m=new DevToolsStat({props:{label:"Tenant",value:(fe=p[0].application)==null?void 0:fe.tenantId}}),y=new DevToolsStat({props:{label:"Version",value:(pe=p[0].application)==null?void 0:pe.version}});let ie=p[0].clientLoadTime&&create_if_block$6(p);return S=new DevToolsStat({props:{label:"App screens",value:((ve=p[1].screens)==null?void 0:ve.length)||0}}),T=new DevToolsStat({props:{label:"Active screen",value:(Ae=p[1].activeScreen)==null?void 0:Ae.routing.route}}),H=new DevToolsStat({props:{label:"Components",value:p[2].mountedComponentCount}}),Z=new DevToolsStat({props:{label:"User",value:(ze=p[3])==null?void 0:ze.email}}),J=new DevToolsStat({props:{label:"Role",value:(Se=p[3])==null?void 0:Se.roleId}}),{c(){create_component(u.$$.fragment),f=space(),create_component(m.$$.fragment),v=space(),create_component(y.$$.fragment),w=space(),ie&&ie.c(),k=space(),create_component(S.$$.fragment),M=space(),create_component(T.$$.fragment),E=space(),create_component(H.$$.fragment),F=space(),create_component(Z.$$.fragment),$=space(),create_component(J.$$.fragment)},m(Le,Ce){mount_component(u,Le,Ce),insert(Le,f,Ce),mount_component(m,Le,Ce),insert(Le,v,Ce),mount_component(y,Le,Ce),insert(Le,w,Ce),ie&&ie.m(Le,Ce),insert(Le,k,Ce),mount_component(S,Le,Ce),insert(Le,M,Ce),mount_component(T,Le,Ce),insert(Le,E,Ce),mount_component(H,Le,Ce),insert(Le,F,Ce),mount_component(Z,Le,Ce),insert(Le,$,Ce),mount_component(J,Le,Ce),se=!0},p(Le,Ce){var ft,Mt,$e,je,Ct,yt,ot;const Ue={};Ce&1&&(Ue.value=(ft=Le[0].application)==null?void 0:ft.name),u.$set(Ue);const Ze={};Ce&1&&(Ze.value=(Mt=Le[0].application)==null?void 0:Mt.tenantId),m.$set(Ze);const Ge={};Ce&1&&(Ge.value=($e=Le[0].application)==null?void 0:$e.version),y.$set(Ge),Le[0].clientLoadTime?ie?(ie.p(Le,Ce),Ce&1&&transition_in(ie,1)):(ie=create_if_block$6(Le),ie.c(),transition_in(ie,1),ie.m(k.parentNode,k)):ie&&(group_outros(),transition_out(ie,1,1,()=>{ie=null}),check_outros());const be={};Ce&2&&(be.value=((je=Le[1].screens)==null?void 0:je.length)||0),S.$set(be);const De={};Ce&2&&(De.value=(Ct=Le[1].activeScreen)==null?void 0:Ct.routing.route),T.$set(De);const Ke={};Ce&4&&(Ke.value=Le[2].mountedComponentCount),H.$set(Ke);const He={};Ce&8&&(He.value=(yt=Le[3])==null?void 0:yt.email),Z.$set(He);const rt={};Ce&8&&(rt.value=(ot=Le[3])==null?void 0:ot.roleId),J.$set(rt)},i(Le){se||(transition_in(u.$$.fragment,Le),transition_in(m.$$.fragment,Le),transition_in(y.$$.fragment,Le),transition_in(ie),transition_in(S.$$.fragment,Le),transition_in(T.$$.fragment,Le),transition_in(H.$$.fragment,Le),transition_in(Z.$$.fragment,Le),transition_in(J.$$.fragment,Le),se=!0)},o(Le){transition_out(u.$$.fragment,Le),transition_out(m.$$.fragment,Le),transition_out(y.$$.fragment,Le),transition_out(ie),transition_out(S.$$.fragment,Le),transition_out(T.$$.fragment,Le),transition_out(H.$$.fragment,Le),transition_out(Z.$$.fragment,Le),transition_out(J.$$.fragment,Le),se=!1},d(Le){Le&&(detach(f),detach(v),detach(w),detach(k),detach(M),detach(E),detach(F),detach($)),destroy_component(u,Le),destroy_component(m,Le),destroy_component(y,Le),ie&&ie.d(Le),destroy_component(S,Le),destroy_component(T,Le),destroy_component(H,Le),destroy_component(Z,Le),destroy_component(J,Le)}}}function create_fragment$b(p){let u,f;return u=new Layout$1({props:{noPadding:!0,gap:"XS",$$slots:{default:[create_default_slot$9]},$$scope:{ctx:p}}}),{c(){create_component(u.$$.fragment)},m(m,v){mount_component(u,m,v),f=!0},p(m,[v]){const y={};v&31&&(y.$$scope={dirty:v,ctx:m}),u.$set(y)},i(m){f||(transition_in(u.$$.fragment,m),f=!0)},o(m){transition_out(u.$$.fragment,m),f=!1},d(m){destroy_component(u,m)}}}function instance$a(p,u,f){let m,v,y,w;return component_subscribe(p,appStore,k=>f(0,m=k)),component_subscribe(p,screenStore,k=>f(1,v=k)),component_subscribe(p,componentStore,k=>f(2,y=k)),component_subscribe(p,authStore,k=>f(3,w=k)),[m,v,y,w]}class DevToolsStatsTab extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$a,create_fragment$b,safe_not_equal,{})}}function get_each_context$3(p,u,f){const m=p.slice();return m[7]=u[f],m}function create_each_block$3(p){var m;let u,f;return u=new DevToolsStat({props:{copyable:!0,label:p[7].label,value:JSON.stringify((m=p[0]?p[1]:p[2])==null?void 0:m[p[7].key])}}),{c(){create_component(u.$$.fragment)},m(v,y){mount_component(u,v,y),f=!0},p(v,y){var k;const w={};y&8&&(w.label=v[7].label),y&15&&(w.value=JSON.stringify((k=v[0]?v[1]:v[2])==null?void 0:k[v[7].key])),u.$set(w)},i(v){f||(transition_in(u.$$.fragment,v),f=!0)},o(v){transition_out(u.$$.fragment,v),f=!1},d(v){destroy_component(u,v)}}}function create_default_slot_1$5(p){let u,f,m=ensure_array_like(p[3]),v=[];for(let w=0;w<m.length;w+=1)v[w]=create_each_block$3(get_each_context$3(p,m,w));const y=w=>transition_out(v[w],1,1,()=>{v[w]=null});return{c(){for(let w=0;w<v.length;w+=1)v[w].c();u=empty$1()},m(w,k){for(let S=0;S<v.length;S+=1)v[S]&&v[S].m(w,k);insert(w,u,k),f=!0},p(w,k){if(k&15){m=ensure_array_like(w[3]);let S;for(S=0;S<m.length;S+=1){const M=get_each_context$3(w,m,S);v[S]?(v[S].p(M,k),transition_in(v[S],1)):(v[S]=create_each_block$3(M),v[S].c(),transition_in(v[S],1),v[S].m(u.parentNode,u))}for(group_outros(),S=m.length;S<v.length;S+=1)y(S);check_outros()}},i(w){if(!f){for(let k=0;k<m.length;k+=1)transition_in(v[k]);f=!0}},o(w){v=v.filter(Boolean);for(let k=0;k<v.length;k+=1)transition_out(v[k]);f=!1},d(w){w&&detach(u),destroy_each(v,w)}}}function create_default_slot$8(p){let u,f,m,v,y;function w(S){p[6](S)}let k={text:"Show enriched settings"};return p[0]!==void 0&&(k.value=p[0]),u=new Toggle({props:k}),binding_callbacks.push(()=>bind(u,"value",w)),v=new Layout$1({props:{noPadding:!0,gap:"XS",$$slots:{default:[create_default_slot_1$5]},$$scope:{ctx:p}}}),{c(){create_component(u.$$.fragment),m=space(),create_component(v.$$.fragment)},m(S,M){mount_component(u,S,M),insert(S,m,M),mount_component(v,S,M),y=!0},p(S,M){const T={};!f&&M&1&&(f=!0,T.value=S[0],add_flush_callback(()=>f=!1)),u.$set(T);const E={};M&1039&&(E.$$scope={dirty:M,ctx:S}),v.$set(E)},i(S){y||(transition_in(u.$$.fragment,S),transition_in(v.$$.fragment,S),y=!0)},o(S){transition_out(u.$$.fragment,S),transition_out(v.$$.fragment,S),y=!1},d(S){S&&detach(m),destroy_component(u,S),destroy_component(v,S)}}}function create_fragment$a(p){let u,f;return u=new Layout$1({props:{noPadding:!0,gap:"S",$$slots:{default:[create_default_slot$8]},$$scope:{ctx:p}}}),{c(){create_component(u.$$.fragment)},m(m,v){mount_component(u,m,v),f=!0},p(m,[v]){const y={};v&1039&&(y.$$scope={dirty:v,ctx:m}),u.$set(y)},i(m){f||(transition_in(u.$$.fragment,m),f=!0)},o(m){transition_out(u.$$.fragment,m),f=!1},d(m){destroy_component(u,m)}}}function instance$9(p,u,f){let m,v,y,w,k;component_subscribe(p,componentStore,T=>f(5,k=T));let S=!0;function M(T){S=T,f(0,S)}return p.$$.update=()=>{p.$$.dirty&32&&f(4,m=k.selectedComponentInstance),p.$$.dirty&32&&f(3,v=getSettingsDefinition(k.selectedComponentDefinition)),p.$$.dirty&16&&f(2,y=m==null?void 0:m.getRawSettings()),p.$$.dirty&16&&f(1,w=m==null?void 0:m.getSettings())},[S,w,y,v,m,k,M]}class DevToolsComponentSettingsTab extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$9,create_fragment$a,safe_not_equal,{})}}function get_each_context$2(p,u,f){const m=p.slice();return m[9]=u[f],m}function create_default_slot_3$3(p){let u;return{c(){u=text$1("Choose a category to see the value of all its available bindings.")},m(f,m){insert(f,u,m)},d(f){f&&detach(u)}}}function create_if_block_1$2(p){let u,f;return u=new Body({props:{size:"XS",$$slots:{default:[create_default_slot_2$4]},$$scope:{ctx:p}}}),{c(){create_component(u.$$.fragment)},m(m,v){mount_component(u,m,v),f=!0},p(m,v){const y={};v&4096&&(y.$$scope={dirty:v,ctx:m}),u.$set(y)},i(m){f||(transition_in(u.$$.fragment,m),f=!0)},o(m){transition_out(u.$$.fragment,m),f=!1},d(m){destroy_component(u,m)}}}function create_if_block$5(p){let u,f;return u=new Layout$1({props:{noPadding:!0,gap:"XS",$$slots:{default:[create_default_slot_1$4]},$$scope:{ctx:p}}}),{c(){create_component(u.$$.fragment)},m(m,v){mount_component(u,m,v),f=!0},p(m,v){const y={};v&4098&&(y.$$scope={dirty:v,ctx:m}),u.$set(y)},i(m){f||(transition_in(u.$$.fragment,m),f=!0)},o(m){transition_out(u.$$.fragment,m),f=!1},d(m){destroy_component(u,m)}}}function create_default_slot_2$4(p){let u;return{c(){u=text$1("There aren't any bindings available in this category.")},m(f,m){insert(f,u,m)},d(f){f&&detach(u)}}}function create_each_block$2(p){let u,f;return u=new DevToolsStat({props:{copyable:!0,label:p[9][0],value:JSON.stringify(p[9][1])}}),{c(){create_component(u.$$.fragment)},m(m,v){mount_component(u,m,v),f=!0},p(m,v){const y={};v&2&&(y.label=m[9][0]),v&2&&(y.value=JSON.stringify(m[9][1])),u.$set(y)},i(m){f||(transition_in(u.$$.fragment,m),f=!0)},o(m){transition_out(u.$$.fragment,m),f=!1},d(m){destroy_component(u,m)}}}function create_default_slot_1$4(p){let u,f,m=ensure_array_like(p[1]),v=[];for(let w=0;w<m.length;w+=1)v[w]=create_each_block$2(get_each_context$2(p,m,w));const y=w=>transition_out(v[w],1,1,()=>{v[w]=null});return{c(){for(let w=0;w<v.length;w+=1)v[w].c();u=empty$1()},m(w,k){for(let S=0;S<v.length;S+=1)v[S]&&v[S].m(w,k);insert(w,u,k),f=!0},p(w,k){if(k&2){m=ensure_array_like(w[1]);let S;for(S=0;S<m.length;S+=1){const M=get_each_context$2(w,m,S);v[S]?(v[S].p(M,k),transition_in(v[S],1)):(v[S]=create_each_block$2(M),v[S].c(),transition_in(v[S],1),v[S].m(u.parentNode,u))}for(group_outros(),S=m.length;S<v.length;S+=1)y(S);check_outros()}},i(w){if(!f){for(let k=0;k<m.length;k+=1)transition_in(v[k]);f=!0}},o(w){v=v.filter(Boolean);for(let k=0;k<v.length;k+=1)transition_out(v[k]);f=!1},d(w){w&&detach(u),destroy_each(v,w)}}}function create_default_slot$7(p){let u,f,m,v,y,w,k,S,M;u=new Body({props:{size:"S",$$slots:{default:[create_default_slot_3$3]},$$scope:{ctx:p}}});function T($){p[6]($)}let E={label:"Category",options:p[2]};p[0]!==void 0&&(E.value=p[0]),m=new Select_1({props:E}),binding_callbacks.push(()=>bind(m,"value",T));const H=[create_if_block$5,create_if_block_1$2],F=[];function Z($,J){var se;return(se=$[1])!=null&&se.length?0:$[0]?1:-1}return~(w=Z(p))&&(k=F[w]=H[w](p)),{c(){create_component(u.$$.fragment),f=space(),create_component(m.$$.fragment),y=space(),k&&k.c(),S=empty$1()},m($,J){mount_component(u,$,J),insert($,f,J),mount_component(m,$,J),insert($,y,J),~w&&F[w].m($,J),insert($,S,J),M=!0},p($,J){const se={};J&4096&&(se.$$scope={dirty:J,ctx:$}),u.$set(se);const ie={};J&4&&(ie.options=$[2]),!v&&J&1&&(v=!0,ie.value=$[0],add_flush_callback(()=>v=!1)),m.$set(ie);let he=w;w=Z($),w===he?~w&&F[w].p($,J):(k&&(group_outros(),transition_out(F[he],1,1,()=>{F[he]=null}),check_outros()),~w?(k=F[w],k?k.p($,J):(k=F[w]=H[w]($),k.c()),transition_in(k,1),k.m(S.parentNode,S)):k=null)},i($){M||(transition_in(u.$$.fragment,$),transition_in(m.$$.fragment,$),transition_in(k),M=!0)},o($){transition_out(u.$$.fragment,$),transition_out(m.$$.fragment,$),transition_out(k),M=!1},d($){$&&(detach(f),detach(y),detach(S)),destroy_component(u,$),destroy_component(m,$),~w&&F[w].d($)}}}function create_fragment$9(p){let u,f;return u=new Layout$1({props:{noPadding:!0,gap:"S",$$slots:{default:[create_default_slot$7]},$$scope:{ctx:p}}}),{c(){create_component(u.$$.fragment)},m(m,v){mount_component(u,m,v),f=!0},p(m,[v]){const y={};v&4103&&(y.$$scope={dirty:v,ctx:m}),u.$set(y)},i(m){f||(transition_in(u.$$.fragment,m),f=!0)},o(m){transition_out(u.$$.fragment,m),f=!1},d(m){destroy_component(u,m)}}}function instance$8(p,u,f){let m,v,y,w,k;component_subscribe(p,componentStore,H=>f(5,k=H));const S={user:"Current user",state:"State",url:"URL",device:"Device",rowSelection:"Selected rows"};let M;const T=H=>{const F={...H};delete F.key,delete F.closestComponentId,delete F.user_RefreshDataSource;let Z=[],$=[];return Object.keys(F).sort().forEach(J=>{let se=!1;for(let ie of Z)if(J.startsWith(`${ie}_`)){se=!0;break}if(!se)if(Z.push(J),S[J])$.push({label:S[J],value:J});else{const ie=componentStore.actions.getComponentById(J);if(ie)$.push({label:ie._instanceName,value:J});else{if(J.includes("-")){const he=J.split("-"),fe=he[0],pe=componentStore.actions.getComponentById(fe);if(pe){$.push({label:`${pe._instanceName} (${he[1]})`,value:J});return}}$.push({label:"Unknown - "+J,value:J})}}}),$};function E(H){M=H,f(0,M)}return p.$$.update=()=>{p.$$.dirty&32&&f(4,m=k.selectedComponentInstance),p.$$.dirty&16&&f(3,v=m==null?void 0:m.getDataContext()),p.$$.dirty&8&&f(2,y=T(v)),p.$$.dirty&9&&f(1,w=Object.entries((v==null?void 0:v[M])||{}))},[M,w,y,v,m,k,E]}class DevToolsComponentContextTab extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$8,create_fragment$9,safe_not_equal,{})}}const DevToolsComponentTab_svelte_svelte_type_style_lang="";function create_else_block$1(p){let u,f;return u=new Layout$1({props:{noPadding:!0,gap:"S",$$slots:{default:[create_default_slot_4$2]},$$scope:{ctx:p}}}),{c(){create_component(u.$$.fragment)},m(m,v){mount_component(u,m,v),f=!0},p(m,v){const y={};v&33&&(y.$$scope={dirty:v,ctx:m}),u.$set(y)},i(m){f||(transition_in(u.$$.fragment,m),f=!0)},o(m){transition_out(u.$$.fragment,m),f=!1},d(m){destroy_component(u,m)}}}function create_if_block$4(p){let u,f;return u=new Layout$1({props:{noPadding:!0,gap:"S",$$slots:{default:[create_default_slot$6]},$$scope:{ctx:p}}}),{c(){create_component(u.$$.fragment)},m(m,v){mount_component(u,m,v),f=!0},p(m,v){const y={};v&32&&(y.$$scope={dirty:v,ctx:m}),u.$set(y)},i(m){f||(transition_in(u.$$.fragment,m),f=!0)},o(m){transition_out(u.$$.fragment,m),f=!1},d(m){destroy_component(u,m)}}}function create_default_slot_12$1(p){var m;let u=((m=p[0].selectedComponent)==null?void 0:m._instanceName)+"",f;return{c(){f=text$1(u)},m(v,y){insert(v,f,y)},p(v,y){var w;y&1&&u!==(u=((w=v[0].selectedComponent)==null?void 0:w._instanceName)+"")&&set_data(f,u)},d(v){v&&detach(f)}}}function create_default_slot_11$1(p){var y,w;let u,f,m,v;return u=new DevToolsStat({props:{label:"Type",value:(y=p[0].selectedComponentDefinition)==null?void 0:y.name}}),m=new DevToolsStat({props:{copyable:!0,label:"Component ID",value:(w=p[0].selectedComponent)==null?void 0:w._id}}),{c(){create_component(u.$$.fragment),f=space(),create_component(m.$$.fragment)},m(k,S){mount_component(u,k,S),insert(k,f,S),mount_component(m,k,S),v=!0},p(k,S){var E,H;const M={};S&1&&(M.value=(E=k[0].selectedComponentDefinition)==null?void 0:E.name),u.$set(M);const T={};S&1&&(T.value=(H=k[0].selectedComponent)==null?void 0:H._id),m.$set(T)},i(k){v||(transition_in(u.$$.fragment,k),transition_in(m.$$.fragment,k),v=!0)},o(k){transition_out(u.$$.fragment,k),transition_out(m.$$.fragment,k),v=!1},d(k){k&&detach(f),destroy_component(u,k),destroy_component(m,k)}}}function create_default_slot_10$1(p){let u;return{c(){u=text$1("Change component")},m(f,m){insert(f,u,m)},d(f){f&&detach(u)}}}function create_default_slot_9$1(p){let u;return{c(){u=text$1("Reset")},m(f,m){insert(f,u,m)},d(f){f&&detach(u)}}}function create_default_slot_8$1(p){let u,f,m;return f=new DevToolsComponentSettingsTab({}),{c(){u=element("div"),create_component(f.$$.fragment),attr(u,"class","tab-content svelte-1rbkjdg")},m(v,y){insert(v,u,y),mount_component(f,u,null),m=!0},p:noop$2,i(v){m||(transition_in(f.$$.fragment,v),m=!0)},o(v){transition_out(f.$$.fragment,v),m=!1},d(v){v&&detach(u),destroy_component(f)}}}function create_default_slot_7$1(p){let u,f,m;return f=new DevToolsComponentContextTab({}),{c(){u=element("div"),create_component(f.$$.fragment),attr(u,"class","tab-content svelte-1rbkjdg")},m(v,y){insert(v,u,y),mount_component(f,u,null),m=!0},p:noop$2,i(v){m||(transition_in(f.$$.fragment,v),m=!0)},o(v){transition_out(f.$$.fragment,v),m=!1},d(v){v&&detach(u),destroy_component(f)}}}function create_default_slot_6$1(p){let u,f,m,v;return u=new Tab({props:{title:"Settings",$$slots:{default:[create_default_slot_8$1]},$$scope:{ctx:p}}}),m=new Tab({props:{title:"Bindings",$$slots:{default:[create_default_slot_7$1]},$$scope:{ctx:p}}}),{c(){create_component(u.$$.fragment),f=space(),create_component(m.$$.fragment)},m(y,w){mount_component(u,y,w),insert(y,f,w),mount_component(m,y,w),v=!0},p(y,w){const k={};w&32&&(k.$$scope={dirty:w,ctx:y}),u.$set(k);const S={};w&32&&(S.$$scope={dirty:w,ctx:y}),m.$set(S)},i(y){v||(transition_in(u.$$.fragment,y),transition_in(m.$$.fragment,y),v=!0)},o(y){transition_out(u.$$.fragment,y),transition_out(m.$$.fragment,y),v=!1},d(y){y&&detach(f),destroy_component(u,y),destroy_component(m,y)}}}function create_default_slot_5$1(p){let u,f;return u=new Tabs({props:{selected:"Settings",$$slots:{default:[create_default_slot_6$1]},$$scope:{ctx:p}}}),{c(){create_component(u.$$.fragment)},m(m,v){mount_component(u,m,v),f=!0},p(m,v){const y={};v&32&&(y.$$scope={dirty:v,ctx:m}),u.$set(y)},i(m){f||(transition_in(u.$$.fragment,m),f=!0)},o(m){transition_out(u.$$.fragment,m),f=!1},d(m){destroy_component(u,m)}}}function create_default_slot_4$2(p){let u,f,m,v,y,w,k,S,M,T,E,H;return u=new Heading$1({props:{size:"XS",$$slots:{default:[create_default_slot_12$1]},$$scope:{ctx:p}}}),m=new Layout$1({props:{noPadding:!0,gap:"XS",$$slots:{default:[create_default_slot_11$1]},$$scope:{ctx:p}}}),w=new Button$1({props:{cta:!0,$$slots:{default:[create_default_slot_10$1]},$$scope:{ctx:p}}}),w.$on("click",p[3]),S=new Button$1({props:{quiet:!0,secondary:!0,$$slots:{default:[create_default_slot_9$1]},$$scope:{ctx:p}}}),S.$on("click",p[4]),E=new Layout$1({props:{noPadding:!0,gap:"XS",$$slots:{default:[create_default_slot_5$1]},$$scope:{ctx:p}}}),{c(){create_component(u.$$.fragment),f=space(),create_component(m.$$.fragment),v=space(),y=element("div"),create_component(w.$$.fragment),k=space(),create_component(S.$$.fragment),M=space(),T=element("div"),create_component(E.$$.fragment),attr(y,"class","buttons svelte-1rbkjdg"),attr(T,"class","data svelte-1rbkjdg")},m(F,Z){mount_component(u,F,Z),insert(F,f,Z),mount_component(m,F,Z),insert(F,v,Z),insert(F,y,Z),mount_component(w,y,null),append$2(y,k),mount_component(S,y,null),insert(F,M,Z),insert(F,T,Z),mount_component(E,T,null),H=!0},p(F,Z){const $={};Z&33&&($.$$scope={dirty:Z,ctx:F}),u.$set($);const J={};Z&33&&(J.$$scope={dirty:Z,ctx:F}),m.$set(J);const se={};Z&32&&(se.$$scope={dirty:Z,ctx:F}),w.$set(se);const ie={};Z&32&&(ie.$$scope={dirty:Z,ctx:F}),S.$set(ie);const he={};Z&32&&(he.$$scope={dirty:Z,ctx:F}),E.$set(he)},i(F){H||(transition_in(u.$$.fragment,F),transition_in(m.$$.fragment,F),transition_in(w.$$.fragment,F),transition_in(S.$$.fragment,F),transition_in(E.$$.fragment,F),H=!0)},o(F){transition_out(u.$$.fragment,F),transition_out(m.$$.fragment,F),transition_out(w.$$.fragment,F),transition_out(S.$$.fragment,F),transition_out(E.$$.fragment,F),H=!1},d(F){F&&(detach(f),detach(v),detach(y),detach(M),detach(T)),destroy_component(u,F),destroy_component(m,F),destroy_component(w),destroy_component(S),destroy_component(E)}}}function create_default_slot_3$2(p){let u;return{c(){u=text$1("Please choose a component")},m(f,m){insert(f,u,m)},d(f){f&&detach(u)}}}function create_default_slot_2$3(p){let u;return{c(){u=text$1(`Press the button below to enable component selection, then click a
1214
1214
  component in your app to view its settings and available data bindings.`)},m(f,m){insert(f,u,m)},d(f){f&&detach(u)}}}function create_default_slot_1$3(p){let u;return{c(){u=text$1("Choose component")},m(f,m){insert(f,u,m)},d(f){f&&detach(u)}}}function create_default_slot$6(p){let u,f,m,v,y,w,k;return u=new Heading$1({props:{size:"XS",$$slots:{default:[create_default_slot_3$2]},$$scope:{ctx:p}}}),m=new Body({props:{size:"S",$$slots:{default:[create_default_slot_2$3]},$$scope:{ctx:p}}}),w=new Button$1({props:{cta:!0,$$slots:{default:[create_default_slot_1$3]},$$scope:{ctx:p}}}),w.$on("click",p[2]),{c(){create_component(u.$$.fragment),f=space(),create_component(m.$$.fragment),v=space(),y=element("div"),create_component(w.$$.fragment)},m(S,M){mount_component(u,S,M),insert(S,f,M),mount_component(m,S,M),insert(S,v,M),insert(S,y,M),mount_component(w,y,null),k=!0},p(S,M){const T={};M&32&&(T.$$scope={dirty:M,ctx:S}),u.$set(T);const E={};M&32&&(E.$$scope={dirty:M,ctx:S}),m.$set(E);const H={};M&32&&(H.$$scope={dirty:M,ctx:S}),w.$set(H)},i(S){k||(transition_in(u.$$.fragment,S),transition_in(m.$$.fragment,S),transition_in(w.$$.fragment,S),k=!0)},o(S){transition_out(u.$$.fragment,S),transition_out(m.$$.fragment,S),transition_out(w.$$.fragment,S),k=!1},d(S){S&&(detach(f),detach(v),detach(y)),destroy_component(u,S),destroy_component(m,S),destroy_component(w)}}}function create_fragment$8(p){let u,f,m,v;const y=[create_if_block$4,create_else_block$1],w=[];function k(S,M){return S[1].selectedComponentId?1:0}return u=k(p),f=w[u]=y[u](p),{c(){f.c(),m=empty$1()},m(S,M){w[u].m(S,M),insert(S,m,M),v=!0},p(S,[M]){let T=u;u=k(S),u===T?w[u].p(S,M):(group_outros(),transition_out(w[T],1,1,()=>{w[T]=null}),check_outros(),f=w[u],f?f.p(S,M):(f=w[u]=y[u](S),f.c()),transition_in(f,1),f.m(m.parentNode,m))},i(S){v||(transition_in(f),v=!0)},o(S){transition_out(f),v=!1},d(S){S&&detach(m),w[u].d(S)}}}function instance$7(p,u,f){let m,v;component_subscribe(p,componentStore,S=>f(0,m=S)),component_subscribe(p,builderStore,S=>f(1,v=S));const y=()=>devToolsStore.actions.setAllowSelection(!0),w=()=>devToolsStore.actions.setAllowSelection(!0),k=()=>builderStore.actions.selectComponent(null);return p.$$.update=()=>{p.$$.dirty&1&&(m.selectedComponentInstance||builderStore.actions.selectComponent(null))},[m,v,y,w,k]}class DevToolsComponentTab extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$7,create_fragment$8,safe_not_equal,{})}}const DevTools_svelte_svelte_type_style_lang="";function create_if_block$3(p){let u,f;return u=new Layout$1({props:{noPadding:!0,gap:"XS",$$slots:{default:[create_default_slot$5]},$$scope:{ctx:p}}}),{c(){create_component(u.$$.fragment)},m(m,v){mount_component(u,m,v),f=!0},i(m){f||(transition_in(u.$$.fragment,m),f=!0)},o(m){transition_out(u.$$.fragment,m),f=!1},d(m){destroy_component(u,m)}}}function create_default_slot_4$1(p){let u;return{c(){u=text$1("Budibase DevTools")},m(f,m){insert(f,u,m)},d(f){f&&detach(u)}}}function create_default_slot_3$1(p){let u,f,m;return f=new DevToolsStatsTab({}),{c(){u=element("div"),create_component(f.$$.fragment),attr(u,"class","tab-content svelte-1aby6jg")},m(v,y){insert(v,u,y),mount_component(f,u,null),m=!0},p:noop$2,i(v){m||(transition_in(f.$$.fragment,v),m=!0)},o(v){transition_out(f.$$.fragment,v),m=!1},d(v){v&&detach(u),destroy_component(f)}}}function create_default_slot_2$2(p){let u,f,m;return f=new DevToolsComponentTab({}),{c(){u=element("div"),create_component(f.$$.fragment),attr(u,"class","tab-content svelte-1aby6jg")},m(v,y){insert(v,u,y),mount_component(f,u,null),m=!0},p:noop$2,i(v){m||(transition_in(f.$$.fragment,v),m=!0)},o(v){transition_out(f.$$.fragment,v),m=!1},d(v){v&&detach(u),destroy_component(f)}}}function create_default_slot_1$2(p){let u,f,m,v;return u=new Tab({props:{title:"Application",$$slots:{default:[create_default_slot_3$1]},$$scope:{ctx:p}}}),m=new Tab({props:{title:"Components",$$slots:{default:[create_default_slot_2$2]},$$scope:{ctx:p}}}),{c(){create_component(u.$$.fragment),f=space(),create_component(m.$$.fragment)},m(y,w){mount_component(u,y,w),insert(y,f,w),mount_component(m,y,w),v=!0},p(y,w){const k={};w&16&&(k.$$scope={dirty:w,ctx:y}),u.$set(k);const S={};w&16&&(S.$$scope={dirty:w,ctx:y}),m.$set(S)},i(y){v||(transition_in(u.$$.fragment,y),transition_in(m.$$.fragment,y),v=!0)},o(y){transition_out(u.$$.fragment,y),transition_out(m.$$.fragment,y),v=!1},d(y){y&&detach(f),destroy_component(u,y),destroy_component(m,y)}}}function create_default_slot$5(p){let u,f,m,v,y,w,k;return f=new Heading$1({props:{size:"XS",$$slots:{default:[create_default_slot_4$1]},$$scope:{ctx:p}}}),v=new Icon$1({props:{hoverable:!0,name:"Close"}}),v.$on("click",p[3]),w=new Tabs({props:{selected:"Application",$$slots:{default:[create_default_slot_1$2]},$$scope:{ctx:p}}}),{c(){u=element("div"),create_component(f.$$.fragment),m=space(),create_component(v.$$.fragment),y=space(),create_component(w.$$.fragment),attr(u,"class","header svelte-1aby6jg")},m(S,M){insert(S,u,M),mount_component(f,u,null),append$2(u,m),mount_component(v,u,null),insert(S,y,M),mount_component(w,S,M),k=!0},p(S,M){const T={};M&16&&(T.$$scope={dirty:M,ctx:S}),f.$set(T);const E={};M&16&&(E.$$scope={dirty:M,ctx:S}),w.$set(E)},i(S){k||(transition_in(f.$$.fragment,S),transition_in(v.$$.fragment,S),transition_in(w.$$.fragment,S),k=!0)},o(S){transition_out(f.$$.fragment,S),transition_out(v.$$.fragment,S),transition_out(w.$$.fragment,S),k=!1},d(S){S&&(detach(u),detach(y)),destroy_component(f),destroy_component(v),destroy_component(w,S)}}}function create_fragment$7(p){let u,f,m=p[0].visible&&create_if_block$3(p);return{c(){u=element("div"),m&&m.c(),attr(u,"class","devtools svelte-1aby6jg"),toggle_class(u,"hidden",!p[0].visible),toggle_class(u,"mobile",p[1].device.mobile)},m(v,y){insert(v,u,y),m&&m.m(u,null),f=!0},p(v,[y]){v[0].visible?m?y&1&&transition_in(m,1):(m=create_if_block$3(v),m.c(),transition_in(m,1),m.m(u,null)):m&&(group_outros(),transition_out(m,1,1,()=>{m=null}),check_outros()),(!f||y&1)&&toggle_class(u,"hidden",!v[0].visible),(!f||y&2)&&toggle_class(u,"mobile",v[1].device.mobile)},i(v){f||(transition_in(m),f=!0)},o(v){transition_out(m),f=!1},d(v){v&&detach(u),m&&m.d()}}}function instance$6(p,u,f){let m,v;component_subscribe(p,devToolsStore,k=>f(0,m=k));const y=getContext$1("context");return component_subscribe(p,y,k=>f(1,v=k)),[m,v,y,()=>devToolsStore.actions.setVisible(!1)]}class DevTools extends SvelteComponent{constructor(u){super(),init$1(this,u,instance$6,create_fragment$7,safe_not_equal,{})}}const FreeFooter_svelte_svelte_type_style_lang="";function create_default_slot$4(p){let u,f;return{c(){u=text$1("Made with "),f=element("span"),f.textContent="Budibase",attr(f,"class","svelte-zvk6ne")},m(m,v){insert(m,u,v),insert(m,f,v)},p:noop$2,d(m){m&&(detach(u),detach(f))}}}function create_fragment$6(p){let u,f,m;return f=new Link$1({props:{href:"https://www.budibase.com/?utm_source=budibase-apps-public-screens&utm_medium=badge&utm_campaign=made-in-budibase",target:"_blank",$$slots:{default:[create_default_slot$4]},$$scope:{ctx:p}}}),{c(){u=element("div"),create_component(f.$$.fragment),attr(u,"class","free-footer svelte-zvk6ne")},m(v,y){insert(v,u,y),mount_component(f,u,null),m=!0},p(v,[y]){const w={};y&1&&(w.$$scope={dirty:y,ctx:v}),f.$set(w)},i(v){m||(transition_in(f.$$.fragment,v),m=!0)},o(v){transition_out(f.$$.fragment,v),m=!1},d(v){v&&detach(u),destroy_component(f)}}}class FreeFooter extends SvelteComponent{constructor(u){super(),init$1(this,u,null,create_fragment$6,safe_not_equal,{})}}const MaintenanceScreen_svelte_svelte_type_style_lang="";function get_each_context$1(p,u,f){const m=p.slice();return m[1]=u[f],m}function create_if_block$2(p){let u,f;return u=new Layout$1({props:{$$slots:{default:[create_default_slot$3]},$$scope:{ctx:p}}}),{c(){create_component(u.$$.fragment)},m(m,v){mount_component(u,m,v),f=!0},i(m){f||(transition_in(u.$$.fragment,m),f=!0)},o(m){transition_out(u.$$.fragment,m),f=!1},d(m){destroy_component(u,m)}}}function create_default_slot_2$1(p){let u;return{c(){u=text$1("Budibase installation requires maintenance")},m(f,m){insert(f,u,m)},d(f){f&&detach(u)}}}function create_default_slot_1$1(p){let u;return{c(){u=text$1(`The administrator of this Budibase installation needs to take actions
1215
1215
  to update components that are out of date. Please contact them and
1216
1216
  show them this warning. More information will be available when they