@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.
|
@@ -3,7 +3,7 @@ var Q4=Object.defineProperty;var Y4=(to,ue,eo)=>ue in to?Q4(to,ue,{enumerable:!0
|
|
|
3
3
|
`}const co=lo+`100% {${io(eo,1-eo)}}
|
|
4
4
|
}`,uo=`__svelte_${hash(co)}_${ao}`,fo=get_root_for_style(to),{stylesheet:po,rules:ho}=managed_styles.get(fo)||create_style_information(fo,to);ho[uo]||(ho[uo]=!0,po.insertRule(`@keyframes ${uo} ${co}`,po.cssRules.length));const _o=to.style.animation||"";return to.style.animation=`${_o?`${_o}, `:""}${uo} ${no}ms linear ${ro}ms 1 both`,active+=1,uo}function delete_rule(to,ue){const eo=(to.style.animation||"").split(", "),no=eo.filter(ue?oo=>oo.indexOf(ue)<0:oo=>oo.indexOf("__svelte")===-1),ro=eo.length-no.length;ro&&(to.style.animation=no.join(", "),active-=ro,active||clear_rules())}function clear_rules(){raf(()=>{active||(managed_styles.forEach(to=>{const{ownerNode:ue}=to.stylesheet;ue&&detach(ue)}),managed_styles.clear())})}function create_animation(to,ue,eo,no){if(!ue)return noop$7;const ro=to.getBoundingClientRect();if(ue.left===ro.left&&ue.right===ro.right&&ue.top===ro.top&&ue.bottom===ro.bottom)return noop$7;const{delay:oo=0,duration:io=300,easing:ao=identity$6,start:so=now$2()+oo,end:lo=so+io,tick:co=noop$7,css:uo}=eo(to,{from:ue,to:ro},no);let fo=!0,po=!1,ho;function _o(){uo&&(ho=create_rule(to,0,1,io,oo,ao,uo)),oo||(po=!0)}function go(){uo&&delete_rule(to,ho),fo=!1}return loop$1(bo=>{if(!po&&bo>=so&&(po=!0),po&&bo>=lo&&(co(1,0),go()),!fo)return!1;if(po){const vo=bo-so,yo=0+1*ao(vo/io);co(yo,1-yo)}return!0}),_o(),co(0,1),go}function fix_position(to){const ue=getComputedStyle(to);if(ue.position!=="absolute"&&ue.position!=="fixed"){const{width:eo,height:no}=ue,ro=to.getBoundingClientRect();to.style.position="absolute",to.style.width=eo,to.style.height=no,add_transform(to,ro)}}function add_transform(to,ue){const eo=to.getBoundingClientRect();if(ue.left!==eo.left||ue.top!==eo.top){const no=getComputedStyle(to),ro=no.transform==="none"?"":no.transform;to.style.transform=`${ro} translate(${ue.left-eo.left}px, ${ue.top-eo.top}px)`}}let current_component;function set_current_component(to){current_component=to}function get_current_component(){if(!current_component)throw new Error("Function called outside component initialization");return current_component}function onMount(to){get_current_component().$$.on_mount.push(to)}function onDestroy(to){get_current_component().$$.on_destroy.push(to)}function createEventDispatcher(){const to=get_current_component();return(ue,eo,{cancelable:no=!1}={})=>{const ro=to.$$.callbacks[ue];if(ro){const oo=custom_event(ue,eo,{cancelable:no});return ro.slice().forEach(io=>{io.call(to,oo)}),!oo.defaultPrevented}return!0}}function setContext(to,ue){return get_current_component().$$.context.set(to,ue),ue}function getContext$1(to){return get_current_component().$$.context.get(to)}function hasContext(to){return get_current_component().$$.context.has(to)}function bubble(to,ue){const eo=to.$$.callbacks[ue.type];eo&&eo.slice().forEach(no=>no.call(this,ue))}const dirty_components=[],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(to){render_callbacks.push(to)}function add_flush_callback(to){flush_callbacks.push(to)}const seen_callbacks=new Set;let flushidx=0;function flush(){if(flushidx!==0)return;const to=current_component;do{try{for(;flushidx<dirty_components.length;){const ue=dirty_components[flushidx];flushidx++,set_current_component(ue),update(ue.$$)}}catch(ue){throw dirty_components.length=0,flushidx=0,ue}for(set_current_component(null),dirty_components.length=0,flushidx=0;binding_callbacks.length;)binding_callbacks.pop()();for(let ue=0;ue<render_callbacks.length;ue+=1){const eo=render_callbacks[ue];seen_callbacks.has(eo)||(seen_callbacks.add(eo),eo())}render_callbacks.length=0}while(dirty_components.length);for(;flush_callbacks.length;)flush_callbacks.pop()();update_scheduled=!1,seen_callbacks.clear(),set_current_component(to)}function update(to){if(to.fragment!==null){to.update(),run_all(to.before_update);const ue=to.dirty;to.dirty=[-1],to.fragment&&to.fragment.p(to.ctx,ue),to.after_update.forEach(add_render_callback)}}function flush_render_callbacks(to){const ue=[],eo=[];render_callbacks.forEach(no=>to.indexOf(no)===-1?ue.push(no):eo.push(no)),eo.forEach(no=>no()),render_callbacks=ue}let promise;function wait(){return promise||(promise=Promise.resolve(),promise.then(()=>{promise=null})),promise}function dispatch$1(to,ue,eo){to.dispatchEvent(custom_event(`${ue?"intro":"outro"}${eo}`))}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(to,ue){to&&to.i&&(outroing.delete(to),to.i(ue))}function transition_out(to,ue,eo,no){if(to&&to.o){if(outroing.has(to))return;outroing.add(to),outros.c.push(()=>{outroing.delete(to),no&&(eo&&to.d(1),no())}),to.o(ue)}else no&&no()}const null_transition={duration:0};function create_in_transition(to,ue,eo){const no={direction:"in"};let ro=ue(to,eo,no),oo=!1,io,ao,so=0;function lo(){io&&delete_rule(to,io)}function co(){const{delay:fo=0,duration:po=300,easing:ho=identity$6,tick:_o=noop$7,css:go}=ro||null_transition;go&&(io=create_rule(to,0,1,po,fo,ho,go,so++)),_o(0,1);const bo=now$2()+fo,vo=bo+po;ao&&ao.abort(),oo=!0,add_render_callback(()=>dispatch$1(to,!0,"start")),ao=loop$1(yo=>{if(oo){if(yo>=vo)return _o(1,0),dispatch$1(to,!0,"end"),lo(),oo=!1;if(yo>=bo){const $o=ho((yo-bo)/po);_o($o,1-$o)}}return oo})}let uo=!1;return{start(){uo||(uo=!0,delete_rule(to),is_function(ro)?(ro=ro(no),wait().then(co)):co())},invalidate(){uo=!1},end(){oo&&(lo(),oo=!1)}}}function create_out_transition(to,ue,eo){const no={direction:"out"};let ro=ue(to,eo,no),oo=!0,io;const ao=outros;ao.r+=1;let so;function lo(){const{delay:co=0,duration:uo=300,easing:fo=identity$6,tick:po=noop$7,css:ho}=ro||null_transition;ho&&(io=create_rule(to,1,0,uo,co,fo,ho));const _o=now$2()+co,go=_o+uo;add_render_callback(()=>dispatch$1(to,!1,"start")),"inert"in to&&(so=to.inert,to.inert=!0),loop$1(bo=>{if(oo){if(bo>=go)return po(0,1),dispatch$1(to,!1,"end"),--ao.r||run_all(ao.c),!1;if(bo>=_o){const vo=fo((bo-_o)/uo);po(1-vo,vo)}}return oo})}return is_function(ro)?wait().then(()=>{ro=ro(no),lo()}):lo(),{end(co){co&&"inert"in to&&(to.inert=so),co&&ro.tick&&ro.tick(1,0),oo&&(io&&delete_rule(to,io),oo=!1)}}}function create_bidirectional_transition(to,ue,eo,no){let oo=ue(to,eo,{direction:"both"}),io=no?0:1,ao=null,so=null,lo=null,co;function uo(){lo&&delete_rule(to,lo)}function fo(ho,_o){const go=ho.b-io;return _o*=Math.abs(go),{a:io,b:ho.b,d:go,duration:_o,start:ho.start,end:ho.start+_o,group:ho.group}}function po(ho){const{delay:_o=0,duration:go=300,easing:bo=identity$6,tick:vo=noop$7,css:yo}=oo||null_transition,$o={start:now$2()+_o,b:ho};ho||($o.group=outros,outros.r+=1),"inert"in to&&(ho?co!==void 0&&(to.inert=co):(co=to.inert,to.inert=!0)),ao||so?so=$o:(yo&&(uo(),lo=create_rule(to,io,ho,go,_o,bo,yo)),ho&&vo(0,1),ao=fo($o,go),add_render_callback(()=>dispatch$1(to,ho,"start")),loop$1(ko=>{if(so&&ko>so.start&&(ao=fo(so,go),so=null,dispatch$1(to,ao.b,"start"),yo&&(uo(),lo=create_rule(to,io,ao.b,ao.duration,0,bo,oo.css))),ao){if(ko>=ao.end)vo(io=ao.b,1-io),dispatch$1(to,ao.b,"end"),so||(ao.b?uo():--ao.group.r||run_all(ao.group.c)),ao=null;else if(ko>=ao.start){const So=ko-ao.start;io=ao.a+ao.d*bo(So/ao.duration),vo(io,1-io)}}return!!(ao||so)}))}return{run(ho){is_function(oo)?wait().then(()=>{oo=oo({direction:ho?"in":"out"}),po(ho)}):po(ho)},end(){uo(),ao=so=null}}}function handle_promise(to,ue){const eo=ue.token={};function no(ro,oo,io,ao){if(ue.token!==eo)return;ue.resolved=ao;let so=ue.ctx;io!==void 0&&(so=so.slice(),so[io]=ao);const lo=ro&&(ue.current=ro)(so);let co=!1;ue.block&&(ue.blocks?ue.blocks.forEach((uo,fo)=>{fo!==oo&&uo&&(group_outros(),transition_out(uo,1,1,()=>{ue.blocks[fo]===uo&&(ue.blocks[fo]=null)}),check_outros())}):ue.block.d(1),lo.c(),transition_in(lo,1),lo.m(ue.mount(),ue.anchor),co=!0),ue.block=lo,ue.blocks&&(ue.blocks[oo]=lo),co&&flush()}if(is_promise(to)){const ro=get_current_component();if(to.then(oo=>{set_current_component(ro),no(ue.then,1,ue.value,oo),set_current_component(null)},oo=>{if(set_current_component(ro),no(ue.catch,2,ue.error,oo),set_current_component(null),!ue.hasCatch)throw oo}),ue.current!==ue.pending)return no(ue.pending,0),!0}else{if(ue.current!==ue.then)return no(ue.then,1,ue.value,to),!0;ue.resolved=to}}function update_await_block_branch(to,ue,eo){const no=ue.slice(),{resolved:ro}=to;to.current===to.then&&(no[to.value]=ro),to.current===to.catch&&(no[to.error]=ro),to.block.p(no,eo)}function ensure_array_like(to){return(to==null?void 0:to.length)!==void 0?to:Array.from(to)}function destroy_block(to,ue){to.d(1),ue.delete(to.key)}function outro_and_destroy_block(to,ue){transition_out(to,1,1,()=>{ue.delete(to.key)})}function fix_and_outro_and_destroy_block(to,ue){to.f(),outro_and_destroy_block(to,ue)}function update_keyed_each(to,ue,eo,no,ro,oo,io,ao,so,lo,co,uo){let fo=to.length,po=oo.length,ho=fo;const _o={};for(;ho--;)_o[to[ho].key]=ho;const go=[],bo=new Map,vo=new Map,yo=[];for(ho=po;ho--;){const Ao=uo(ro,oo,ho),Mo=eo(Ao);let Eo=io.get(Mo);Eo?no&&yo.push(()=>Eo.p(Ao,ue)):(Eo=lo(Mo,Ao),Eo.c()),bo.set(Mo,go[ho]=Eo),Mo in _o&&vo.set(Mo,Math.abs(ho-_o[Mo]))}const $o=new Set,ko=new Set;function So(Ao){transition_in(Ao,1),Ao.m(ao,co),io.set(Ao.key,Ao),co=Ao.first,po--}for(;fo&&po;){const Ao=go[po-1],Mo=to[fo-1],Eo=Ao.key,To=Mo.key;Ao===Mo?(co=Ao.first,fo--,po--):bo.has(To)?!io.has(Eo)||$o.has(Eo)?So(Ao):ko.has(To)?fo--:vo.get(Eo)>vo.get(To)?(ko.add(Eo),So(Ao)):($o.add(To),fo--):(so(Mo,io),fo--)}for(;fo--;){const Ao=to[fo];bo.has(Ao.key)||so(Ao,io)}for(;po;)So(go[po-1]);return run_all(yo),go}function get_spread_update(to,ue){const eo={},no={},ro={$$scope:1};let oo=to.length;for(;oo--;){const io=to[oo],ao=ue[oo];if(ao){for(const so in io)so in ao||(no[so]=1);for(const so in ao)ro[so]||(eo[so]=ao[so],ro[so]=1);to[oo]=ao}else for(const so in io)ro[so]=1}for(const io in no)io in eo||(eo[io]=void 0);return eo}function get_spread_object(to){return typeof to=="object"&&to!==null?to:{}}function bind$2(to,ue,eo){const no=to.$$.props[ue];no!==void 0&&(to.$$.bound[no]=eo,eo(to.$$.ctx[no]))}function create_component(to){to&&to.c()}function mount_component(to,ue,eo){const{fragment:no,after_update:ro}=to.$$;no&&no.m(ue,eo),add_render_callback(()=>{const oo=to.$$.on_mount.map(run$3).filter(is_function);to.$$.on_destroy?to.$$.on_destroy.push(...oo):run_all(oo),to.$$.on_mount=[]}),ro.forEach(add_render_callback)}function destroy_component(to,ue){const eo=to.$$;eo.fragment!==null&&(flush_render_callbacks(eo.after_update),run_all(eo.on_destroy),eo.fragment&&eo.fragment.d(ue),eo.on_destroy=eo.fragment=null,eo.ctx=[])}function make_dirty(to,ue){to.$$.dirty[0]===-1&&(dirty_components.push(to),schedule_update(),to.$$.dirty.fill(0)),to.$$.dirty[ue/31|0]|=1<<ue%31}function init$3(to,ue,eo,no,ro,oo,io=null,ao=[-1]){const so=current_component;set_current_component(to);const lo=to.$$={fragment:null,ctx:[],props:oo,update:noop$7,not_equal:ro,bound:blank_object(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(ue.context||(so?so.$$.context:[])),callbacks:blank_object(),dirty:ao,skip_bound:!1,root:ue.target||so.$$.root};io&&io(lo.root);let co=!1;if(lo.ctx=eo?eo(to,ue.props||{},(uo,fo,...po)=>{const ho=po.length?po[0]:fo;return lo.ctx&&ro(lo.ctx[uo],lo.ctx[uo]=ho)&&(!lo.skip_bound&&lo.bound[uo]&&lo.bound[uo](ho),co&&make_dirty(to,uo)),fo}):[],lo.update(),co=!0,run_all(lo.before_update),lo.fragment=no?no(lo.ctx):!1,ue.target){if(ue.hydrate){const uo=children$1(ue.target);lo.fragment&&lo.fragment.l(uo),uo.forEach(detach)}else lo.fragment&&lo.fragment.c();ue.intro&&transition_in(to.$$.fragment),mount_component(to,ue.target,ue.anchor),flush()}set_current_component(so)}class SvelteComponent{constructor(){pc(this,"$$");pc(this,"$$set")}$destroy(){destroy_component(this,1),this.$destroy=noop$7}$on(ue,eo){if(!is_function(eo))return noop$7;const no=this.$$.callbacks[ue]||(this.$$.callbacks[ue]=[]);return no.push(eo),()=>{const ro=no.indexOf(eo);ro!==-1&&no.splice(ro,1)}}$set(ue){this.$$set&&!is_empty(ue)&&(this.$$.skip_bound=!0,this.$$set(ue),this.$$.skip_bound=!1)}}const PUBLIC_VERSION="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(PUBLIC_VERSION);const defaultConfig$1={queryHandler:{parse:to=>fromEntries(new URLSearchParams(to)),stringify:to=>"?"+new URLSearchParams(to).toString()},urlTransform:{apply:to=>to,remove:to=>to},useHash:!1};function fromEntries(to){return[...to].reduce((ue,[eo,no])=>(ue[eo]=no,ue),{})}const MATCH_PARAM=RegExp(/\:([^/()]+)/g);function handleScroll(to,ue){if(navigator.userAgent.includes("jsdom"))return!1;ue&&scrollAncestorsToTop(to),handleHash()}function handleHash(){if(navigator.userAgent.includes("jsdom"))return!1;const{hash:to}=window.location;if(to){const ue=document.getElementById(to.substring(1));ue&&ue.scrollIntoView()}}function scrollAncestorsToTop(to){to&&to.scrollTo&&to.dataset.routify!=="scroll-lock"&&to.dataset["routify-scroll"]!=="lock"&&(to.style["scroll-behavior"]="auto",to.scrollTo({top:0,behavior:"auto"}),to.style["scroll-behavior"]="",scrollAncestorsToTop(to.parentElement))}const pathToRegex=(to,ue)=>{const eo=ue?"":"/?$";return to=to.replace(/\/_fallback?$/,"(/|$)"),to=to.replace(/\/index$/,"(/index)?"),to=to.replace(MATCH_PARAM,"([^/]+)")+eo,to=`^${to}`,to},pathToParamKeys=to=>{const ue=[];let eo;for(;eo=MATCH_PARAM.exec(to);)ue.push(eo[1]);return ue},pathToRank=({path:to})=>to.split("/").filter(Boolean).map(ue=>ue==="_fallback"?"A":ue.startsWith(":")?"B":"C").join("");function suppressComponentWarnings(to,ue){suppressComponentWarnings._console=suppressComponentWarnings._console||{log:console.log,warn:console.warn};const{_console:eo}=suppressComponentWarnings,no=to.componentFile.name.replace(/Proxy<_?(.+)>/,"$1").replace(/^Index$/,to.component.shortPath.split("/").pop()).replace(/^./,oo=>oo.toUpperCase()).replace(/\:(.+)/,"U5B$1u5D"),ro=[`<${no}> received an unexpected slot "default".`,`<${no}> was created with unknown prop 'scoped'`,`<${no}> was created with unknown prop 'scopedSync'`];for(const oo of["log","warn"])console[oo]=(...io)=>{ro.includes(io[0])||eo[oo](...io)},ue().then(()=>{console[oo]=eo[oo]})}function currentLocation(){let to=window.location.pathname+window.location.search+window.location.hash;const{url:ue,options:eo}=resolvePrefetch(to);return{...parseUrl(ue),options:eo}}function resolvePrefetch(to){const[ue,eo]=to.split("__[[routify_url_options]]__"),no=JSON.parse(decodeURIComponent(eo||"")||"{}");return window.routify=window.routify||{},window.routify.prefetched=no.prefetch,{url:ue,options:no}}function parseUrl(to){defaultConfig$1.useHash&&(to=to.replace(/.*#(.+)/,"$1"));const ue=to.startsWith("/")?window.location.origin:void 0,eo=new URL(to,ue),no=eo.pathname+eo.search+eo.hash;return{url:eo,fullpath:no}}function resolveUrl(to,ue,eo){const no=defaultConfig$1.useHash?"#":"";let ro;return ro=populateUrl(to,ue,eo),ro=defaultConfig$1.urlTransform.apply(ro),ro=no+ro,ro}function populateUrl(to,ue,eo){const no=Object.assign({},eo,ue),ro=getQueryString(to,ue);for(const[oo,io]of Object.entries(no))to=to.replace(new RegExp(`:${oo}(/|$)`),io+"$1");return`${to}${ro}`}function getQueryString(to,ue){if(!defaultConfig$1.queryHandler)return"";const eo=pathToParamKeys(to),no={};return ue&&Object.entries(ue).forEach(([ro,oo])=>{eo.includes(ro)||(no[ro]=oo)}),defaultConfig$1.queryHandler.stringify(no).replace(/\?$/,"")}function create_fragment$c5(to){let ue;const eo=to[2].default,no=create_slot(eo,to,to[1],null);return{c(){no&&no.c()},m(ro,oo){no&&no.m(ro,oo),ue=!0},p(ro,[oo]){no&&no.p&&(!ue||oo&2)&&update_slot_base(no,eo,ro,ro[1],ue?get_slot_changes(eo,ro[1],oo,null):get_all_dirty_from_scope(ro[1]),null)},i(ro){ue||(transition_in(no,ro),ue=!0)},o(ro){transition_out(no,ro),ue=!1},d(ro){no&&no.d(ro)}}}function instance$c2(to,ue,eo){let{$$slots:no={},$$scope:ro}=ue,{scoped:oo={}}=ue;return to.$$set=io=>{"scoped"in io&&eo(0,oo=io.scoped),"$$scope"in io&&eo(1,ro=io.$$scope)},[oo,ro,no]}class Noop extends SvelteComponent{constructor(ue){super(),init$3(this,ue,instance$c2,create_fragment$c5,safe_not_equal,{scoped:0})}}const subscriber_queue=[];function readable(to,ue){return{subscribe:writable(to,ue).subscribe}}function writable(to,ue=noop$7){let eo;const no=new Set;function ro(ao){if(safe_not_equal(to,ao)&&(to=ao,eo)){const so=!subscriber_queue.length;for(const lo of no)lo[1](),subscriber_queue.push(lo,to);if(so){for(let lo=0;lo<subscriber_queue.length;lo+=2)subscriber_queue[lo][0](subscriber_queue[lo+1]);subscriber_queue.length=0}}}function oo(ao){ro(ao(to))}function io(ao,so=noop$7){const lo=[ao,so];return no.add(lo),no.size===1&&(eo=ue(ro,oo)||noop$7),ao(to),()=>{no.delete(lo),no.size===0&&eo&&(eo(),eo=null)}}return{set:ro,update:oo,subscribe:io}}function derived(to,ue,eo){const no=!Array.isArray(to),ro=no?[to]:to;if(!ro.every(Boolean))throw new Error("derived() expects stores as input, got a falsy value");const oo=ue.length<2;return readable(eo,(io,ao)=>{let so=!1;const lo=[];let co=0,uo=noop$7;const fo=()=>{if(co)return;uo();const ho=ue(no?lo[0]:lo,io,ao);oo?io(ho):uo=is_function(ho)?ho:noop$7},po=ro.map((ho,_o)=>subscribe(ho,go=>{lo[_o]=go,co&=~(1<<_o),so&&fo()},()=>{co|=1<<_o}));return so=!0,fo(),function(){run_all(po),uo(),so=!1}})}window.routify=window.routify||{};const route=writable(null),routes$1=writable([]);routes$1.subscribe(to=>window.routify.routes=to);let rootContext=writable({component:{params:{}}});const urlRoute=writable(null),prefetchPath=writable(""),isChangingPage=writable(!0);async function onPageLoaded({page:to,metatags:ue,afterPageLoad:eo,parentNode:no}){const ro=to.last!==to;setTimeout(()=>handleScroll(no,ro));const{path:oo}=to,{options:io}=currentLocation(),ao=io.prefetch;for(const so of eo._hooks)so&&await so(to.api);ue.update(),dispatchEvent(new CustomEvent("app-loaded")),parent.postMessage({msg:"app-loaded",prefetched:window.routify.prefetched,path:oo,prefetchId:ao},"*"),window.routify.appLoaded=!0,window.routify.stopAutoReady=!1}function urlToRoute(to,ue=!1){to=defaultConfig$1.urlTransform.remove(to);let{pathname:eo,search:no}=parseUrl(to).url;const ro=get_store_value(routes$1),oo=ro.find(co=>eo===co.meta.name)||ro.find(co=>eo.match(co.regex));if(!oo)throw new Error(`Route could not be found for "${eo}".`);const io=ue?Object.create(oo):oo,{route:ao,redirectPath:so,rewritePath:lo}=resolveRedirects(io,ro);return lo&&({pathname:eo,search:no}=parseUrl(resolveUrl(lo,ao.params)).url,so&&(ao.redirectTo=resolveUrl(so,ao.params||{}))),defaultConfig$1.queryHandler&&(ao.params=Object.assign({},defaultConfig$1.queryHandler.parse(no))),assignParamsToRouteAndLayouts(ao,eo),ao.leftover=to.replace(new RegExp(ao.regex),""),ao}function assignParamsToRouteAndLayouts(to,ue){if(to.paramKeys){const eo=layoutByPos(to.layouts),no=ue.split("/").filter(Boolean);getRouteProps(to.path).forEach((oo,io)=>{oo&&(to.params[oo]=no[io],eo[io]?eo[io].param={[oo]:no[io]}:to.param={[oo]:no[io]})})}}function resolveRedirects(to,ue,eo,no){const{redirect:ro,rewrite:oo}=to.meta;if(ro||oo){eo=ro?ro.path||ro:eo,no=oo?oo.path||oo:eo;const io=ro&&ro.params,ao=oo&&oo.params,so=ue.find(lo=>lo.path.replace(/\/index$/,"")===no);return so===to&&console.error(`${no} is redirecting to itself`),so||console.error(`${to.path} is redirecting to non-existent path: ${no}`),(io||ao)&&(so.params=Object.assign({},so.params,io,ao)),resolveRedirects(so,ue,eo,no)}return{route:to,redirectPath:eo,rewritePath:no}}function layoutByPos(to){const ue=[];return to.forEach(eo=>{ue[eo.path.split("/").filter(Boolean).length-1]=eo}),ue}function getRouteProps(to){return to.split("/").filter(Boolean).map(ue=>ue.match(/\:(.+)/)).map(ue=>ue&&ue[1])}function get_each_context$2j(to,ue,eo){const no=to.slice();return no[1]=ue[eo],no}function create_each_block$2j(to,ue){let eo,no;return{key:to,first:null,c(){eo=element("iframe"),src_url_equal(eo.src,no=ue[1].url)||attr(eo,"src",no),attr(eo,"frameborder","0"),attr(eo,"title","routify prefetcher"),this.first=eo},m(ro,oo){insert$2(ro,eo,oo)},p(ro,oo){ue=ro,oo&1&&!src_url_equal(eo.src,no=ue[1].url)&&attr(eo,"src",no)},d(ro){ro&&detach(eo)}}}function create_fragment$c4(to){let ue,eo=[],no=new Map,ro=ensure_array_like(to[0]);const oo=io=>io[1].options.prefetch;for(let io=0;io<ro.length;io+=1){let ao=get_each_context$2j(to,ro,io),so=oo(ao);no.set(so,eo[io]=create_each_block$2j(so,ao))}return{c(){ue=element("div");for(let io=0;io<eo.length;io+=1)eo[io].c();attr(ue,"id","__routify_iframes"),set_style(ue,"display","none")},m(io,ao){insert$2(io,ue,ao);for(let so=0;so<eo.length;so+=1)eo[so]&&eo[so].m(ue,null)},p(io,[ao]){ao&1&&(ro=ensure_array_like(io[0]),eo=update_keyed_each(eo,ao,oo,1,io,ro,no,ue,destroy_block,create_each_block$2j,null,get_each_context$2j))},i:noop$7,o:noop$7,d(io){io&&detach(ue);for(let ao=0;ao<eo.length;ao+=1)eo[ao].d()}}}const iframeNum=2,defaults$4={validFor:60,timeout:5e3,gracePeriod:1e3},queue$1=writable([]),actives=derived(queue$1,to=>to.slice(0,iframeNum));actives.subscribe(to=>to.forEach(({options:ue})=>{setTimeout(()=>removeFromQueue(ue.prefetch),ue.timeout)}));function prefetch$1(to,ue={}){if(prefetch$1.id=prefetch$1.id||1,to=to.href||to,ue={...defaults$4,...ue},ue.prefetch=prefetch$1.id++,window.routify.prefetched||navigator.userAgent.match("jsdom"))return!1;queue$1.update(eo=>(eo.some(no=>no.options.path===to)||eo.push({url:`${to}__[[routify_url_options]]__${encodeURIComponent(JSON.stringify(ue))}`,options:ue}),eo))}function removeFromQueue(to){const ue=to.data?to.data.prefetchId:to;if(!ue)return null;const eo=get_store_value(queue$1).find(no=>no&&no.options.prefetch==ue);if(eo){const{gracePeriod:no}=eo.options,ro=new Promise(io=>setTimeout(io,no)),oo=new Promise(io=>{window.requestIdleCallback?window.requestIdleCallback(io):setTimeout(io,no+1e3)});Promise.all([ro,oo]).then(()=>{queue$1.update(io=>io.filter(ao=>ao.options.prefetch!=ue))})}}addEventListener("message",removeFromQueue,!1);function instance$c1(to,ue,eo){let no;return component_subscribe(to,actives,ro=>eo(0,no=ro)),[no]}class Prefetcher extends SvelteComponent{constructor(ue){super(),init$3(this,ue,instance$c1,create_fragment$c4,safe_not_equal,{})}}function getRoutifyContext(){return getContext$1("routify")||rootContext}const nodes={subscribe(to){const ue=[];return derived(routes$1,eo=>{eo.forEach(ro=>{const oo=ro.layouts.map(io=>io.api).filter(io=>!ue.includes(io));ue.push(ro.api,...oo)});const no=ue.find;return ue.find=(ro,...oo)=>typeof ro=="string"?ue.find(io=>io.meta.name===ro)||ue.find(io=>io.path===ro):no.bind(ue)(ro,...oo),ue}).subscribe(to)}},components$1=nodes,page={subscribe(to){return derived(route,ue=>ue.api).subscribe(to)}},node$2={subscribe(to){const ue=getRoutifyContext();return derived(ue,eo=>eo.component.api).subscribe(to)}},layout$1={subscribe(to){const ue=getRoutifyContext();return derived(ue,eo=>eo.layout.api).subscribe(to)}},context={subscribe(to){return getRoutifyContext().subscribe(to)}},ready={subscribe(to){window.routify.stopAutoReady=!0;async function ue(){await tick(),await onPageLoaded({page:get_store_value(route),metatags,afterPageLoad})}return to(ue),()=>{}}},afterPageLoad={_hooks:[to=>isChangingPage.set(!1)],subscribe:hookHandler},beforeUrlChange={_hooks:[],subscribe:hookHandler};function hookHandler(to){const ue=this._hooks,eo=ue.length;return to(no=>{ue[eo]=no}),(...no)=>{delete ue[eo],to(...no)}}const params={subscribe(to){const ue=getRoutifyContext();return derived(ue,eo=>eo.route.params).subscribe(to)}},leftover={subscribe(to){return derived(route,ue=>ue.leftover).subscribe(to)}};function isAncestor(to,ue,eo=!0){to=to.__file||to,ue=ue.__file||ue;const no=ue.parent===to.parent;return!to.isIndex||ue.shortPath===to.shortPath?!1:no&&!ue.isDir?!!eo:ue.shortPath.startsWith(to.shortPath)}const meta$2={subscribe(to){const ue=getRoutifyContext();return derived(ue,eo=>eo.layout.meta).subscribe(to)}},url$3={subscribe(to){const ue=getRoutifyContext();return derived(ue,eo=>makeUrlHelper(eo,eo.route,eo.routes)).subscribe(to)}};function makeUrlHelper(to,ue,eo){return function(ro,oo={},io){const{component:ao}=to,so=Object.assign({},ue.params,ao.params);let lo=ro&&ro.nodeType&&ro;lo&&(ro=ro.getAttribute("href")),ro=ro?po(ro):ao.shortPath;const co=eo.find(ho=>[ho.shortPath||"/",ho.path].includes(ro));if(co&&co.meta.preload==="proximity"&&window.requestIdleCallback){const ho=routify.appLoaded?0:1500;setTimeout(()=>{window.requestIdleCallback(()=>co.api.preload())},ho)}io&&io.strict!==!1||(ro=ro.replace(/index$/,""));let fo=resolveUrl(ro,oo,so);if(lo)return lo.href=fo,{update(ho){lo.href=resolveUrl(ro,ho,so)}};return fo;function po(ho){if(ho.match(/^\.\.?\//)){let[,_o,go]=ho.match(/^([\.\/]+)(.*)/),bo=ao.path.replace(/\/$/,"");const vo=_o.match(/\.\.\//g)||[];ao.isPage&&vo.push(null),vo.forEach(()=>bo=bo.replace(/\/[^\/]+\/?$/,"")),ho=`${bo}/${go}`.replace(/\/$/,""),ho=ho||"/"}else if(!ho.match(/^\//)){const _o=eo.find(go=>go.meta.name===ho);_o&&(ho=_o.shortPath)}return ho}}}const goto={subscribe(to){const ue=getContext$1("routifyupdatepage");return derived(url$3,eo=>function(ro,oo,io,ao){const so=eo(ro,oo);io?ue(so,ao):history.pushState({},null,so)}).subscribe(to)}},redirect={subscribe(to){const ue=getContext$1("routifyupdatepage");return derived(url$3,eo=>function(ro,oo,io,ao){const so=eo(ro,oo);io?ue(so,ao):history.replaceState({},null,so)}).subscribe(to)}},isActive={subscribe(to){return derived([url$3,route],([ue,eo])=>function(ro="",oo={},{strict:io}={strict:!0}){ro=ue(ro,oo,{strict:io});const ao=ue(eo.path,oo,{strict:io}),so=new RegExp("^"+ro+"($|/)");return!!ao.match(so)}).subscribe(to)}};function precache(to,ue){(typeof to=="string"?urlToRoute(to):to).component()}function prefetch(to,ue){prefetch$1(to,ue)}function getConcestor(to,ue){const eo=to.__file,no=ue.__file,ro=[...eo.lineage,eo],oo=[...no.lineage,no];let io=ro[0],ao=[ro[0].api,oo[0].api];return ro.forEach((so,lo)=>{const co=oo[lo];co&&so.parent===co.parent&&(io=so.parent,ao=[so.api,co.api])}),[io.api,ao[0],ao[1]]}function getDirection$1(to,ue,eo){const no=to.findIndex(oo=>ue.path.startsWith(oo)),ro=to.findIndex(oo=>eo.path.startsWith(oo));return no-ro}function focus(to){focusIsSet||(focusIsSet=!0,to.setAttribute("tabindex","0"),to.focus(),setTimeout(()=>focusIsSet=!1))}let focusIsSet=!1;const _metatags={subscribe(to){return this._origin=this.getOrigin(),to(metatags)},props:{},templates:{},services:{plain:{propField:"name",valueField:"content"},twitter:{propField:"name",valueField:"content"},og:{propField:"property",valueField:"content"}},plugins:[{name:"applyTemplate",condition:()=>!0,action:(to,ue)=>{const eo=_metatags.getLongest(_metatags.templates,to)||(no=>no);return[to,eo(ue)]}},{name:"createMeta",condition:()=>!0,action(to,ue){_metatags.writeMeta(to,ue)}},{name:"createOG",condition:to=>!to.match(":"),action(to,ue){_metatags.writeMeta(`og:${to}`,ue)}},{name:"createTitle",condition:to=>to==="title",action(to,ue){document.title=ue}}],getLongest(to,ue){const eo=to[ue];if(eo){const no=get_store_value(route).path,io=Object.keys(to[ue]).filter(ao=>no.includes(ao)).sort((ao,so)=>so.length-ao.length)[0];return eo[io]}},writeMeta(to,ue){const eo=document.getElementsByTagName("head")[0],no=to.match(/(.+)\:/),ro=no&&no[1]||"plain",{propField:oo,valueField:io}=metatags.services[ro]||metatags.services.plain,ao=document.querySelector(`meta[${oo}='${to}']`);ao&&ao.remove();const so=document.createElement("meta");so.setAttribute(oo,to),so.setAttribute(io,ue),so.setAttribute("data-origin","routify"),eo.appendChild(so)},set(to,ue){typeof to=="string"&&_metatags.plugins.forEach(eo=>{eo.condition(to,ue)&&([to,ue]=eo.action(to,ue)||[to,ue])})},clear(){const to=document.querySelector("meta");to&&to.remove()},template(to,ue){const eo=_metatags.getOrigin;_metatags.templates[to]=_metatags.templates[to]||{},_metatags.templates[to][eo]=ue},update(){Object.keys(_metatags.props).forEach(to=>{let ue=_metatags.getLongest(_metatags.props,to);_metatags.plugins.forEach(eo=>{eo.condition(to,ue)&&([to,ue]=eo.action(to,ue)||[to,ue])})})},batchedUpdate(){_metatags._pendingUpdate||(_metatags._pendingUpdate=!0,setTimeout(()=>{_metatags._pendingUpdate=!1,this.update()}))},_updateQueued:!1,_origin:!1,getOrigin(){if(this._origin)return this._origin;const to=getRoutifyContext();return to&&get_store_value(to).path||"/"},_pendingUpdate:!1},metatags=new Proxy(_metatags,{set(to,ue,eo,no){const{props:ro}=to;return Reflect.has(to,ue)?Reflect.set(to,ue,eo,no):(ro[ue]=ro[ue]||{},ro[ue][to.getOrigin()]=eo),window.routify.appLoaded&&to.batchedUpdate(),!0}});function get_each_context$2i(to,ue,eo){const no=to.slice();return no[21]=ue[eo].component,no[22]=ue[eo].componentFile,no[2]=ue[eo].decorator,no[1]=ue[eo].nodes,no}function create_if_block_1$35(to){let ue=[],eo=new Map,no,ro,oo=ensure_array_like([to[4]]);const io=ao=>ao[7];for(let ao=0;ao<1;ao+=1){let so=get_each_context$2i(to,oo,ao),lo=io(so);eo.set(lo,ue[ao]=create_each_block$2i(lo,so))}return{c(){for(let ao=0;ao<1;ao+=1)ue[ao].c();no=empty$2()},m(ao,so){for(let lo=0;lo<1;lo+=1)ue[lo]&&ue[lo].m(ao,so);insert$2(ao,no,so),ro=!0},p(ao,so){so&33554621&&(oo=ensure_array_like([ao[4]]),group_outros(),ue=update_keyed_each(ue,so,io,1,ao,oo,eo,no.parentNode,outro_and_destroy_block,create_each_block$2i,no,get_each_context$2i),check_outros())},i(ao){if(!ro){for(let so=0;so<1;so+=1)transition_in(ue[so]);ro=!0}},o(ao){for(let so=0;so<1;so+=1)transition_out(ue[so]);ro=!1},d(ao){ao&&detach(no);for(let so=0;so<1;so+=1)ue[so].d(ao)}}}function create_if_block_2$1V(to){let ue,eo;return ue=new Route({props:{decorator:to[2],nodes:to[1],scoped:{...to[0],...to[25]}}}),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},p(no,ro){const oo={};ro&4&&(oo.decorator=no[2]),ro&16&&(oo.nodes=no[1]),ro&33554433&&(oo.scoped={...no[0],...no[25]}),ue.$set(oo)},i(no){eo||(transition_in(ue.$$.fragment,no),eo=!0)},o(no){transition_out(ue.$$.fragment,no),eo=!1},d(no){destroy_component(ue,no)}}}function create_default_slot_1$4q(to){let ue,eo,no=to[21]&&to[1].length&&create_if_block_2$1V(to);return{c(){no&&no.c(),ue=empty$2()},m(ro,oo){no&&no.m(ro,oo),insert$2(ro,ue,oo),eo=!0},p(ro,oo){ro[21]&&ro[1].length?no?(no.p(ro,oo),oo&16&&transition_in(no,1)):(no=create_if_block_2$1V(ro),no.c(),transition_in(no,1),no.m(ue.parentNode,ue)):no&&(group_outros(),transition_out(no,1,1,()=>{no=null}),check_outros())},i(ro){eo||(transition_in(no),eo=!0)},o(ro){transition_out(no),eo=!1},d(ro){ro&&detach(ue),no&&no.d(ro)}}}function create_default_slot$77(to){let ue,eo,no;const ro=[{scoped:to[0]},{scopedSync:to[5]},to[3].param||{}];var oo=to[22];function io(ao,so){let lo={$$slots:{default:[create_default_slot_1$4q,({scoped:co,decorator:uo})=>({25:co,2:uo}),({scoped:co,decorator:uo})=>(co?33554432:0)|(uo?4:0)]},$$scope:{ctx:ao}};for(let co=0;co<ro.length;co+=1)lo=assign$1(lo,ro[co]);return so!==void 0&&so&41&&(lo=assign$1(lo,get_spread_update(ro,[so&1&&{scoped:ao[0]},so&32&&{scopedSync:ao[5]},so&8&&get_spread_object(ao[3].param||{})]))),{props:lo}}return oo&&(ue=construct_svelte_component(oo,io(to))),{c(){ue&&create_component(ue.$$.fragment),eo=space$1()},m(ao,so){ue&&mount_component(ue,ao,so),insert$2(ao,eo,so),no=!0},p(ao,so){if(so&16&&oo!==(oo=ao[22])){if(ue){group_outros();const lo=ue;transition_out(lo.$$.fragment,1,0,()=>{destroy_component(lo,1)}),check_outros()}oo?(ue=construct_svelte_component(oo,io(ao,so)),create_component(ue.$$.fragment),transition_in(ue.$$.fragment,1),mount_component(ue,eo.parentNode,eo)):ue=null}else if(oo){const lo=so&41?get_spread_update(ro,[so&1&&{scoped:ao[0]},so&32&&{scopedSync:ao[5]},so&8&&get_spread_object(ao[3].param||{})]):{};so&100663317&&(lo.$$scope={dirty:so,ctx:ao}),ue.$set(lo)}},i(ao){no||(ue&&transition_in(ue.$$.fragment,ao),no=!0)},o(ao){ue&&transition_out(ue.$$.fragment,ao),no=!1},d(ao){ao&&detach(eo),ue&&destroy_component(ue,ao)}}}function create_each_block$2i(to,ue){let eo,no,ro,oo;var io=ue[2];function ao(so,lo){return{props:{scoped:so[0],$$slots:{default:[create_default_slot$77]},$$scope:{ctx:so}}}}return io&&(no=construct_svelte_component(io,ao(ue))),{key:to,first:null,c(){eo=empty$2(),no&&create_component(no.$$.fragment),ro=empty$2(),this.first=eo},m(so,lo){insert$2(so,eo,lo),no&&mount_component(no,so,lo),insert$2(so,ro,lo),oo=!0},p(so,lo){if(ue=so,lo&16&&io!==(io=ue[2])){if(no){group_outros();const co=no;transition_out(co.$$.fragment,1,0,()=>{destroy_component(co,1)}),check_outros()}io?(no=construct_svelte_component(io,ao(ue)),create_component(no.$$.fragment),transition_in(no.$$.fragment,1),mount_component(no,ro.parentNode,ro)):no=null}else if(io){const co={};lo&1&&(co.scoped=ue[0]),lo&67108925&&(co.$$scope={dirty:lo,ctx:ue}),no.$set(co)}},i(so){oo||(no&&transition_in(no.$$.fragment,so),oo=!0)},o(so){no&&transition_out(no.$$.fragment,so),oo=!1},d(so){so&&(detach(eo),detach(ro)),no&&destroy_component(no,so)}}}function create_if_block$5F(to){let ue,eo,no;return{c(){ue=element("div"),set_style(ue,"display","contents")},m(ro,oo){insert$2(ro,ue,oo),eo||(no=action_destroyer(to[10].call(null,ue)),eo=!0)},d(ro){ro&&detach(ue),eo=!1,no()}}}function create_fragment$c3(to){let ue,eo,no,ro=to[4]&&create_if_block_1$35(to),oo=!to[6]&&create_if_block$5F(to);return{c(){ro&&ro.c(),ue=space$1(),oo&&oo.c(),eo=empty$2()},m(io,ao){ro&&ro.m(io,ao),insert$2(io,ue,ao),oo&&oo.m(io,ao),insert$2(io,eo,ao),no=!0},p(io,[ao]){io[4]?ro?(ro.p(io,ao),ao&16&&transition_in(ro,1)):(ro=create_if_block_1$35(io),ro.c(),transition_in(ro,1),ro.m(ue.parentNode,ue)):ro&&(group_outros(),transition_out(ro,1,1,()=>{ro=null}),check_outros()),io[6]?oo&&(oo.d(1),oo=null):oo||(oo=create_if_block$5F(io),oo.c(),oo.m(eo.parentNode,eo))},i(io){no||(transition_in(ro),no=!0)},o(io){transition_out(ro),no=!1},d(io){io&&(detach(ue),detach(eo)),ro&&ro.d(io),oo&&oo.d(io)}}}function instance$c0(to,ue,eo){let no,ro,oo,io,ao;component_subscribe(to,route,Mo=>eo(14,oo=Mo)),component_subscribe(to,routes$1,Mo=>eo(16,ao=Mo));let{nodes:so=[]}=ue,{scoped:lo={}}=ue,{decorator:co=void 0}=ue,uo=null,fo=null,po={},ho,_o=1;const go=writable(null);component_subscribe(to,go,Mo=>eo(4,ro=Mo));const bo=getContext$1("routify")||rootContext;component_subscribe(to,bo,Mo=>eo(15,io=Mo));const vo=Mo=>eo(6,ho=Mo.parentNode);setContext("routify",go);let yo=[];function $o(Mo){let Eo=Mo.component();Eo instanceof Promise?Eo.then(ko):ko(Eo)}function ko(Mo){eo(5,po={...lo});const Eo={...ro,nodes:fo,decorator:co||Noop,layout:uo.isLayout?uo:io.layout,component:uo,route:oo,routes:ao,componentFile:Mo,parentNode:ho||io.parentNode};go.set(Eo),set_store_value(bo,io.child=uo,io),fo.length===0&&So()}async function So(){await new Promise(Eo=>setTimeout(Eo));const Mo=ro.component.path===oo.path;!window.routify.stopAutoReady&&Mo&&onPageLoaded({page:ro.component,metatags,afterPageLoad,parentNode:ho})}function Ao({meta:Mo,path:Eo,param:To,params:Io}){return JSON.stringify({path:Eo,invalidate:_o,param:(Mo["param-is-page"]||Mo["slug-is-page"])&&To,queryParams:Mo["query-params-is-page"]&&Io})}return to.$$set=Mo=>{"nodes"in Mo&&eo(1,so=Mo.nodes),"scoped"in Mo&&eo(0,lo=Mo.scoped),"decorator"in Mo&&eo(2,co=Mo.decorator)},to.$$.update=()=>{to.$$.dirty&6146&&yo!==so&&(eo(12,yo=so),eo(3,[uo,...fo]=[...so],uo),eo(3,uo.api.reset=()=>eo(11,_o++,_o),uo)),to.$$.dirty&8&&$o(uo),to.$$.dirty&2064&&eo(7,no=ro&&_o&&Ao(ro.component)),to.$$.dirty&16&&ro&&suppressComponentWarnings(ro,tick)},[lo,so,co,uo,ro,po,ho,no,go,bo,vo,_o,yo]}class Route extends SvelteComponent{constructor(ue){super(),init$3(this,ue,instance$c0,create_fragment$c3,safe_not_equal,{nodes:1,scoped:0,decorator:2})}}function init$2(to,ue){let eo=!1;function no(oo,io){const ao=oo||currentLocation().fullpath,so=urlToRoute(ao);so.redirectTo&&(history.replaceStateNative({},null,so.redirectTo),delete so.redirectTo);const uo=[...(io&&urlToRoute(currentLocation().fullpath,to)||so).layouts,so];eo&&delete eo.last,so.last=eo,eo=so,oo||urlRoute.set(so),route.set(so),so.api.preload().then(()=>{isChangingPage.set(!0),ue(uo)})}const ro=createEventListeners(no);return{updatePage:no,destroy:ro}}function createEventListeners(to){["pushState","replaceState"].forEach(ro=>{history[ro+"Native"]||(history[ro+"Native"]=history[ro]),history[ro]=async function(oo={},io,ao){const so=location.pathname+location.search+location.hash;if(ao===so)return!1;const{id:lo,path:co,params:uo}=get_store_value(route);oo={id:lo,path:co,params:uo,...oo};const fo=new Event(ro.toLowerCase());if(Object.assign(fo,{state:oo,title:io,url:ao}),await runHooksBeforeUrlChange(fo,ao))return history[ro+"Native"].apply(this,[oo,io,ao]),dispatchEvent(fo)}});let ue=!1;const eo={click:handleClick$1,pushstate:()=>to(),replacestate:()=>to(),popstate:async ro=>{ue?ue=!1:await runHooksBeforeUrlChange(ro,currentLocation().fullpath)?to():(ue=!0,ro.preventDefault(),history.go(1))}};return Object.entries(eo).forEach(ro=>addEventListener(...ro)),()=>{Object.entries(eo).forEach(ro=>removeEventListener(...ro))}}function handleClick$1(to){const ue=to.target.closest("a")||to.composedPath().find(oo=>oo.tagName==="A"),eo=ue&&ue.href;if(to.ctrlKey||to.metaKey||to.altKey||to.shiftKey||to.button||to.defaultPrevented||!eo||ue.target||ue.host!==location.host)return;const no=new URL(eo),ro=no.pathname+no.search+no.hash;to.preventDefault(),history.pushState({},"",ro)}async function runHooksBeforeUrlChange(to,ue){const eo=urlToRoute(ue).api;for(const no of beforeUrlChange._hooks.filter(Boolean))if(!await no(to,eo,{url:ue}))return!1;return!0}function create_if_block$5E(to){let ue,eo;return ue=new Route({props:{nodes:to[0]}}),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},p(no,ro){const oo={};ro&1&&(oo.nodes=no[0]),ue.$set(oo)},i(no){eo||(transition_in(ue.$$.fragment,no),eo=!0)},o(no){transition_out(ue.$$.fragment,no),eo=!1},d(no){destroy_component(ue,no)}}}function create_fragment$c2(to){let ue,eo,no,ro=to[0]&&to[1]!==null&&create_if_block$5E(to);return eo=new Prefetcher({}),{c(){ro&&ro.c(),ue=space$1(),create_component(eo.$$.fragment)},m(oo,io){ro&&ro.m(oo,io),insert$2(oo,ue,io),mount_component(eo,oo,io),no=!0},p(oo,[io]){oo[0]&&oo[1]!==null?ro?(ro.p(oo,io),io&3&&transition_in(ro,1)):(ro=create_if_block$5E(oo),ro.c(),transition_in(ro,1),ro.m(ue.parentNode,ue)):ro&&(group_outros(),transition_out(ro,1,1,()=>{ro=null}),check_outros())},i(oo){no||(transition_in(ro),transition_in(eo.$$.fragment,oo),no=!0)},o(oo){transition_out(ro),transition_out(eo.$$.fragment,oo),no=!1},d(oo){oo&&detach(ue),ro&&ro.d(oo),destroy_component(eo,oo)}}}function instance$b$(to,ue,eo){let no;component_subscribe(to,route,po=>eo(1,no=po));let{routes:ro}=ue,{config:oo={}}=ue,io,ao;window.routify=window.routify||{},window.routify.inBrowser=!window.navigator.userAgent.match("jsdom"),Object.assign(defaultConfig$1,oo),setContext("routifyupdatepage",(...po)=>ao&&ao.updatePage(...po));const lo=po=>eo(0,io=po),co=()=>{ao&&(ao.destroy(),ao=null)};let uo=null;const fo=()=>{clearTimeout(uo),uo=setTimeout(()=>{co(),ao=init$2(ro,lo),routes$1.set(ro),ao.updatePage()})};return onDestroy(co),to.$$set=po=>{"routes"in po&&eo(2,ro=po.routes),"config"in po&&eo(3,oo=po.config)},to.$$.update=()=>{to.$$.dirty&4&&ro&&fo()},[io,no,ro,oo]}class Router extends SvelteComponent{constructor(ue){super(),init$3(this,ue,instance$b$,create_fragment$c2,safe_not_equal,{routes:2,config:3})}}function createNodeMiddleware(to){const ue=async function(no){return await nodeMiddleware(to,{file:no.tree,state:{treePayload:no},scope:{}})};return ue.sync=function(no){return nodeMiddlewareSync(to,{file:no.tree,state:{treePayload:no},scope:{}})},ue}async function nodeMiddleware(to,ue){const eo=await to(ue);if(eo===!1)return!1;const no=eo||ue.file;if(no.children){const ro=await Promise.all(no.children.map(async oo=>nodeMiddleware(to,{state:ue.state,scope:clone$4(ue.scope||{}),parent:ue.file,file:await oo})));no.children=ro.filter(Boolean)}return no}function nodeMiddlewareSync(to,ue){const eo=to(ue);if(eo===!1)return!1;const no=eo||ue.file;if(no.children){const ro=no.children.map(oo=>nodeMiddlewareSync(to,{state:ue.state,scope:clone$4(ue.scope||{}),parent:ue.file,file:oo}));no.children=ro.filter(Boolean)}return no}function clone$4(to){return JSON.parse(JSON.stringify(to))}const setRegex=createNodeMiddleware(({file:to})=>{(to.isPage||to.isFallback)&&(to.regex=pathToRegex(to.path,to.isFallback))}),setParamKeys=createNodeMiddleware(({file:to})=>{to.paramKeys=pathToParamKeys(to.path)}),setShortPath=createNodeMiddleware(({file:to})=>{to.isFallback||to.isIndex?to.shortPath=to.path.replace(/\/[^/]+$/,""):to.shortPath=to.path}),setRank=createNodeMiddleware(({file:to})=>{to.ranking=pathToRank(to)}),addMetaChildren=createNodeMiddleware(({file:to})=>{const ue=to,eo=to.meta&&to.meta.children||[];eo.length&&(ue.children=ue.children||[],ue.children.push(...eo.map(no=>({isMeta:!0,...no,meta:no}))))}),setIsIndexable=createNodeMiddleware(to=>{const{file:ue}=to,{isFallback:eo,meta:no}=ue,ro=ue.path.split("/").pop().startsWith(":"),oo=ue.path.endsWith("/index"),io=no.index||no.index===0,ao=no.index===!1;ue.isIndexable=io||!eo&&!ro&&!oo&&!ao,ue.isNonIndexable=!ue.isIndexable}),assignRelations=createNodeMiddleware(({file:to,parent:ue})=>{Object.defineProperty(to,"parent",{get:()=>ue}),Object.defineProperty(to,"nextSibling",{get:()=>_getSibling(to,1)}),Object.defineProperty(to,"prevSibling",{get:()=>_getSibling(to,-1)}),Object.defineProperty(to,"lineage",{get:()=>_getLineage(ue)})});function _getLineage(to,ue=[]){return to&&(ue.unshift(to),_getLineage(to.parent,ue)),ue}function _getSibling(to,ue){if(!to.root){const eo=to.parent.children.filter(ro=>ro.isIndexable),no=eo.indexOf(to);return eo[no+ue]}}const assignIndex=createNodeMiddleware(({file:to,parent:ue})=>{to.isIndex&&Object.defineProperty(ue,"index",{get:()=>to})}),assignLayout=createNodeMiddleware(({file:to,scope:ue})=>{Object.defineProperty(to,"layouts",{get:()=>eo(to)});function eo(no){if(!no.isLayout&&no.meta.reset)return[];const{parent:ro}=no,oo=ro&&ro.component&&ro,io=oo&&(oo.isReset||oo.meta.reset),ao=ro&&!io&&eo(ro)||[];return oo&&ao.push(oo),ao}}),createFlatList=to=>{createNodeMiddleware(ue=>{(ue.file.isPage||ue.file.isFallback)&&ue.state.treePayload.routes.push(ue.file)}).sync(to),to.routes.sort((ue,eo)=>ue.ranking>=eo.ranking?-1:1)},setPrototype=createNodeMiddleware(({file:to})=>{const ue=to.root?so:to.children?to.isPage?io:no:to.isReset?ao:to.isLayout?eo:to.isFallback?ro:oo;Object.setPrototypeOf(to,ue.prototype);function eo(){}function no(){}function ro(){}function oo(){}function io(){}function ao(){}function so(){}}),miscPlugins=Object.freeze(Object.defineProperty({__proto__:null,addMetaChildren,assignIndex,assignLayout,assignRelations,createFlatList,setIsIndexable,setParamKeys,setPrototype,setRank,setRegex,setShortPath},Symbol.toStringTag,{value:"Module"})),defaultNode={isDir:!1,ext:"svelte",isLayout:!1,isReset:!1,isIndex:!1,isFallback:!1,isPage:!1,ownMeta:{},meta:{recursive:!0,preload:!1,prerender:!0},id:"__fallback"};function restoreDefaults(to){return Object.entries(defaultNode).forEach(([ue,eo])=>{typeof to[ue]>"u"&&(to[ue]=eo)}),to.children&&(to.children=to.children.map(restoreDefaults)),to}const assignAPI=createNodeMiddleware(({file:to})=>{to.api=new ClientApi(to)});class ClientApi{constructor(ue){this.__file=ue,Object.defineProperty(this,"__file",{enumerable:!1}),this.isMeta=!!ue.isMeta,this.path=ue.path,this.title=_prettyName(ue),this.meta=ue.meta}get parent(){return!this.__file.root&&this.__file.parent.api}get children(){return(this.__file.children||this.__file.isLayout&&this.__file.parent.children||[]).filter(ue=>!ue.isNonIndexable).sort((ue,eo)=>ue.isMeta&&eo.isMeta?0:(ue=(ue.meta.index||ue.meta.title||ue.path).toString(),eo=(eo.meta.index||eo.meta.title||eo.path).toString(),ue.localeCompare(eo,void 0,{numeric:!0,sensitivity:"base"}))).map(({api:ue})=>ue)}get next(){return _navigate(this,1)}get prev(){return _navigate(this,-1)}async preload(){const ue=[...this.__file.layouts,this.__file,this.index&&this.index.__file].filter(Boolean).map(eo=>eo.component());await Promise.all(ue)}get component(){return this.__file.component?this.__file.component():this.__file.index?this.__file.index.component():!1}get componentWithIndex(){return new Promise(ue=>Promise.all([this.component,this.index&&this.index.component]).then(eo=>ue(eo)))}get index(){const ue=this.__file.children&&this.__file.children.find(eo=>eo.isIndex);return ue&&ue.api}}function _navigate(to,ue){if(!to.__file.root){const no=to.parent.children.indexOf(to);return to.parent.children[no+ue]}}function _prettyName(to){return typeof to.meta.title<"u"?to.meta.title:(to.shortPath||to.path).split("/").pop().replace(/-/g," ")}const plugins$2={...miscPlugins,restoreDefaults:({tree:to})=>restoreDefaults(to),assignAPI};function buildClientTree(to){const ue=["restoreDefaults","setParamKeys","setRegex","setShortPath","setRank","assignLayout","setPrototype","addMetaChildren","assignRelations","setIsIndexable","assignIndex","assignAPI","createFlatList"],eo={tree:to,routes:[]};for(let no of ue)(plugins$2[no].sync||plugins$2[no])(eo);return eo}const routify$1=Object.freeze(Object.defineProperty({__proto__:null,Route,Router,afterPageLoad,beforeUrlChange,buildClientTree,components:components$1,context,focus,getConcestor,getDirection:getDirection$1,goto,isActive,isAncestor,isChangingPage,layout:layout$1,leftover,makeUrlHelper,meta:meta$2,metatags,node:node$2,nodes,page,params,precache,prefetch,prefetchPath,ready,redirect,rootContext,route,routes:routes$1,url:url$3,urlRoute},Symbol.toStringTag,{value:"Module"})),bbui="",indexVars$F="";var PopoverAlignment=(to=>(to.Left="left",to.Right="right",to.LeftOutside="left-outside",to.RightOutside="right-outside",to.Center="center",to.RightContextMenu="right-context-menu",to.LeftContextMenu="left-context-menu",to))(PopoverAlignment||{}),TooltipPosition=(to=>(to.Top="top",to.Right="right",to.Bottom="bottom",to.Left="left",to))(TooltipPosition||{}),TooltipType=(to=>(to.Default="default",to.Info="info",to.Positive="positive",to.Negative="negative",to))(TooltipType||{});const indexVars$E="";function create_fragment$c1(to){let ue,eo,no,ro,oo;const io=to[2].default,ao=create_slot(io,to,to[1],null);return{c(){ue=element("div"),ao&&ao.c(),ue.hidden=!0},m(so,lo){insert$2(so,ue,lo),ao&&ao.m(ue,null),no=!0,ro||(oo=action_destroyer(eo=portal$1.call(null,ue,to[0])),ro=!0)},p(so,[lo]){ao&&ao.p&&(!no||lo&2)&&update_slot_base(ao,io,so,so[1],no?get_slot_changes(io,so[1],lo,null):get_all_dirty_from_scope(so[1]),null),eo&&is_function(eo.update)&&lo&1&&eo.update.call(null,so[0])},i(so){no||(transition_in(ao,so),no=!0)},o(so){transition_out(ao,so),no=!1},d(so){so&&detach(ue),ao&&ao.d(so),ro=!1,oo()}}}function portal$1(to,ue="body"){let eo;async function no(oo){if(ue=oo,typeof ue=="string"){if(eo=document.querySelector(ue),eo===null&&(await tick(),eo=document.querySelector(ue)),eo===null)throw new Error(`No element found matching css selector: "${ue}"`)}else if(ue instanceof HTMLElement)eo=ue;else throw new TypeError(`Unknown portal target type: ${ue===null?"null":typeof ue}. Allowed types: string (CSS selector) or HTMLElement.`);eo.appendChild(to),to.hidden=!1}function ro(){to.parentNode&&to.parentNode.removeChild(to)}return no(ue),{update:no,destroy:ro}}function instance$b_(to,ue,eo){let{$$slots:no={},$$scope:ro}=ue,{target:oo="body"}=ue;return to.$$set=io=>{"target"in io&&eo(0,oo=io.target),"$$scope"in io&&eo(1,ro=io.$$scope)},[oo,ro,no]}let Portal$1=class extends SvelteComponent{constructor(ue){super(),init$3(this,ue,instance$b_,create_fragment$c1,safe_not_equal,{target:0})}};function cubicOut(to){const ue=to-1;return ue*ue*ue+1}function fade(to,{delay:ue=0,duration:eo=400,easing:no=identity$6}={}){const ro=+getComputedStyle(to).opacity;return{delay:ue,duration:eo,easing:no,css:oo=>`opacity: ${oo*ro}`}}function fly(to,{delay:ue=0,duration:eo=400,easing:no=cubicOut,x:ro=0,y:oo=0,opacity:io=0}={}){const ao=getComputedStyle(to),so=+ao.opacity,lo=ao.transform==="none"?"":ao.transform,co=so*(1-io),[uo,fo]=split_css_unit(ro),[po,ho]=split_css_unit(oo);return{delay:ue,duration:eo,easing:no,css:(_o,go)=>`
|
|
5
5
|
transform: ${lo} translate(${(1-_o)*uo}${fo}, ${(1-_o)*po}${ho});
|
|
6
|
-
opacity: ${so-co*go}`}}function slide(to,{delay:ue=0,duration:eo=400,easing:no=cubicOut,axis:ro="y"}={}){const oo=getComputedStyle(to),io=+oo.opacity,ao=ro==="y"?"height":"width",so=parseFloat(oo[ao]),lo=ro==="y"?["top","bottom"]:["left","right"],co=lo.map(bo=>`${bo[0].toUpperCase()}${bo.slice(1)}`),uo=parseFloat(oo[`padding${co[0]}`]),fo=parseFloat(oo[`padding${co[1]}`]),po=parseFloat(oo[`margin${co[0]}`]),ho=parseFloat(oo[`margin${co[1]}`]),_o=parseFloat(oo[`border${co[0]}Width`]),go=parseFloat(oo[`border${co[1]}Width`]);return{delay:ue,duration:eo,easing:no,css:bo=>`overflow: hidden;opacity: ${Math.min(bo*20,1)*io};${ao}: ${bo*so}px;padding-${lo[0]}: ${bo*uo}px;padding-${lo[1]}: ${bo*fo}px;margin-${lo[0]}: ${bo*po}px;margin-${lo[1]}: ${bo*ho}px;border-${lo[0]}-width: ${bo*_o}px;border-${lo[1]}-width: ${bo*go}px;`}}const indexVars$D="",AbsTooltip_svelte_svelte_type_style_lang="";function create_if_block$5D(to){let ue,eo;return ue=new Portal$1({props:{target:".spectrum",$$slots:{default:[create_default_slot$76]},$$scope:{ctx:to}}}),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},p(no,ro){const oo={};ro&132815&&(oo.$$scope={dirty:ro,ctx:no}),ue.$set(oo)},i(no){eo||(transition_in(ue.$$.fragment,no),eo=!0)},o(no){transition_out(ue.$$.fragment,no),eo=!1},d(no){destroy_component(ue,no)}}}function create_default_slot$76(to){let ue,eo,no,ro,oo,io,ao,so,lo;return{c(){ue=element("span"),eo=element("span"),no=text(to[2]),ro=space$1(),oo=element("span"),attr(eo,"class","spectrum-Tooltip-label svelte-9a74k9"),attr(oo,"class","spectrum-Tooltip-tip svelte-9a74k9"),attr(oo,"style",to[9]),attr(ue,"class",io="spectrum-Tooltip spectrum-Tooltip--"+to[1]+" spectrum-Tooltip--"+to[0]+" is-open svelte-9a74k9"),attr(ue,"style",ao=`left:${to[6]}px;top:${to[7]}px;${to[10]}`),toggle_class(ue,"noWrap",to[3])},m(co,uo){insert$2(co,ue,uo),append$2(ue,eo),append$2(eo,no),append$2(ue,ro),append$2(ue,oo),lo=!0},p(co,uo){(!lo||uo&4)&&set_data(no,co[2]),(!lo||uo&512)&&attr(oo,"style",co[9]),(!lo||uo&3&&io!==(io="spectrum-Tooltip spectrum-Tooltip--"+co[1]+" spectrum-Tooltip--"+co[0]+" is-open svelte-9a74k9"))&&attr(ue,"class",io),(!lo||uo&1216&&ao!==(ao=`left:${co[6]}px;top:${co[7]}px;${co[10]}`))&&attr(ue,"style",ao),(!lo||uo&11)&&toggle_class(ue,"noWrap",co[3])},i(co){lo||(co&&add_render_callback(()=>{lo&&(so||(so=create_bidirectional_transition(ue,fade,{duration:130},!0)),so.run(1))}),lo=!0)},o(co){co&&(so||(so=create_bidirectional_transition(ue,fade,{duration:130},!1)),so.run(0)),lo=!1},d(co){co&&detach(ue),co&&so&&so.end()}}}function create_fragment$c0(to){let ue,eo,no,ro,oo,io;const ao=to[13].default,so=create_slot(ao,to,to[17],null);let lo=to[8]&&to[2]&&to[6]!=null&&to[7]!=null&&create_if_block$5D(to);return{c(){ue=element("div"),so&&so.c(),eo=space$1(),lo&&lo.c(),no=empty$2(),attr(ue,"class","abs-tooltip svelte-9a74k9")},m(co,uo){insert$2(co,ue,uo),so&&so.m(ue,null),to[14](ue),insert$2(co,eo,uo),lo&&lo.m(co,uo),insert$2(co,no,uo),ro=!0,oo||(io=[listen(ue,"focus",null),listen(ue,"mouseover",to[15]),listen(ue,"mouseleave",to[16])],oo=!0)},p(co,[uo]){so&&so.p&&(!ro||uo&131072)&&update_slot_base(so,ao,co,co[17],ro?get_slot_changes(ao,co[17],uo,null):get_all_dirty_from_scope(co[17]),null),co[8]&&co[2]&&co[6]!=null&&co[7]!=null?lo?(lo.p(co,uo),uo&452&&transition_in(lo,1)):(lo=create_if_block$5D(co),lo.c(),transition_in(lo,1),lo.m(no.parentNode,no)):lo&&(group_outros(),transition_out(lo,1,1,()=>{lo=null}),check_outros())},i(co){ro||(transition_in(so,co),transition_in(lo),ro=!0)},o(co){transition_out(so,co),transition_out(lo),ro=!1},d(co){co&&(detach(ue),detach(eo),detach(no)),so&&so.d(co),to[14](null),lo&&lo.d(co),oo=!1,run_all(io)}}}function instance$bZ(to,ue,eo){let no,ro,{$$slots:oo={},$$scope:io}=ue,{position:ao=TooltipPosition.Top}=ue,{type:so=TooltipType.Default}=ue,{text:lo=""}=ue,{fixed:co=!1}=ue,{color:uo=void 0}=ue,{noWrap:fo=!1}=ue,po,ho=!1,_o,go,bo=!1,vo,yo;const $o=()=>{var No;const To=(No=po==null?void 0:po.children)==null?void 0:No[0];if(!To){eo(6,_o=void 0),eo(7,go=void 0);return}const Io=To.getBoundingClientRect();ao===TooltipPosition.Top?(eo(6,_o=Io.left+Io.width/2),eo(7,go=Io.top)):ao===TooltipPosition.Right?(eo(6,_o=Io.left+Io.width),eo(7,go=Io.top+Io.height/2)):ao===TooltipPosition.Bottom?(eo(6,_o=Io.left+Io.width/2),eo(7,go=Io.top+Io.height)):ao===TooltipPosition.Left&&(eo(6,_o=Io.left),eo(7,go=Io.top+Io.height/2))},ko=()=>{$o(),yo=setInterval($o,100),eo(8,bo=!0)},So=()=>{clearTimeout(vo),clearInterval(yo),eo(8,bo=!1)};onDestroy(So);function Ao(To){binding_callbacks[To?"unshift":"push"](()=>{po=To,eo(5,po)})}const Mo=()=>eo(4,ho=!0),Eo=()=>eo(4,ho=!1);return to.$$set=To=>{"position"in To&&eo(0,ao=To.position),"type"in To&&eo(1,so=To.type),"text"in To&&eo(2,lo=To.text),"fixed"in To&&eo(11,co=To.fixed),"color"in To&&eo(12,uo=To.color),"noWrap"in To&&eo(3,fo=To.noWrap),"$$scope"in To&&eo(17,io=To.$$scope)},to.$$.update=()=>{to.$$.dirty&2064&&(ho||co?vo=setTimeout(ko,200):So()),to.$$.dirty&4096&&eo(10,no=uo?`background:${uo};`:null),to.$$.dirty&4096&&eo(9,ro=uo?`border-top-color:${uo};`:null)},[ao,so,lo,fo,ho,po,_o,go,bo,ro,no,co,uo,oo,Ao,Mo,Eo,io]}class AbsTooltip extends SvelteComponent{constructor(ue){super(),init$3(this,ue,instance$bZ,create_fragment$c0,safe_not_equal,{position:0,type:1,text:2,fixed:11,color:12,noWrap:3})}}const Icon_svelte_svelte_type_style_lang="";function create_default_slot$75(to){let ue,eo,no,ro,oo,io,ao,so;return{c(){ue=element("div"),eo=svg_element("svg"),no=svg_element("use"),set_style(no,"pointer-events","none"),xlink_attr(no,"xlink:href",ro="#spectrum-icon-18-"+to[0]),attr(eo,"class",oo="spectrum-Icon spectrum-Icon--size"+to[1]+" svelte-ksxkvj"),attr(eo,"focusable","false"),attr(eo,"aria-hidden",to[2]),attr(eo,"aria-label",to[0]),attr(eo,"style",io=`${to[5]?`color: ${to[5]};`:""} ${to[6]?`--hover-color: ${to[6]}`:"--hover-color: var(--spectrum-alias-icon-color-selected-hover)"}`),toggle_class(eo,"hoverable",to[3]),toggle_class(eo,"disabled",to[4]),attr(ue,"class","icon svelte-ksxkvj"),toggle_class(ue,"newStyles",to[12])},m(lo,co){insert$2(lo,ue,co),append$2(ue,eo),append$2(eo,no),ao||(so=[listen(eo,"contextmenu",to[13]),listen(eo,"click",to[14])],ao=!0)},p(lo,co){co&1&&ro!==(ro="#spectrum-icon-18-"+lo[0])&&xlink_attr(no,"xlink:href",ro),co&2&&oo!==(oo="spectrum-Icon spectrum-Icon--size"+lo[1]+" svelte-ksxkvj")&&attr(eo,"class",oo),co&4&&attr(eo,"aria-hidden",lo[2]),co&1&&attr(eo,"aria-label",lo[0]),co&96&&io!==(io=`${lo[5]?`color: ${lo[5]};`:""} ${lo[6]?`--hover-color: ${lo[6]}`:"--hover-color: var(--spectrum-alias-icon-color-selected-hover)"}`)&&attr(eo,"style",io),co&10&&toggle_class(eo,"hoverable",lo[3]),co&18&&toggle_class(eo,"disabled",lo[4]),co&4096&&toggle_class(ue,"newStyles",lo[12])},d(lo){lo&&detach(ue),ao=!1,run_all(so)}}}function create_fragment$b$(to){let ue,eo;return ue=new AbsTooltip({props:{text:to[7],type:to[9],position:to[8],color:to[10],noWrap:to[11],$$slots:{default:[create_default_slot$75]},$$scope:{ctx:to}}}),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},p(no,[ro]){const oo={};ro&128&&(oo.text=no[7]),ro&512&&(oo.type=no[9]),ro&256&&(oo.position=no[8]),ro&1024&&(oo.color=no[10]),ro&2048&&(oo.noWrap=no[11]),ro&36991&&(oo.$$scope={dirty:ro,ctx:no}),ue.$set(oo)},i(no){eo||(transition_in(ue.$$.fragment,no),eo=!0)},o(no){transition_out(ue.$$.fragment,no),eo=!1},d(no){destroy_component(ue,no)}}}function instance$bY(to,ue,eo){let{name:no="Add"}=ue,{size:ro="M"}=ue,{hidden:oo=!1}=ue,{hoverable:io=!1}=ue,{disabled:ao=!1}=ue,{color:so=void 0}=ue,{hoverColor:lo=void 0}=ue,{tooltip:co=void 0}=ue,{tooltipPosition:uo=TooltipPosition.Bottom}=ue,{tooltipType:fo=TooltipType.Default}=ue,{tooltipColor:po=void 0}=ue,{tooltipWrap:ho=!0}=ue,{newStyles:_o=!1}=ue;function go(vo){bubble.call(this,to,vo)}function bo(vo){bubble.call(this,to,vo)}return to.$$set=vo=>{"name"in vo&&eo(0,no=vo.name),"size"in vo&&eo(1,ro=vo.size),"hidden"in vo&&eo(2,oo=vo.hidden),"hoverable"in vo&&eo(3,io=vo.hoverable),"disabled"in vo&&eo(4,ao=vo.disabled),"color"in vo&&eo(5,so=vo.color),"hoverColor"in vo&&eo(6,lo=vo.hoverColor),"tooltip"in vo&&eo(7,co=vo.tooltip),"tooltipPosition"in vo&&eo(8,uo=vo.tooltipPosition),"tooltipType"in vo&&eo(9,fo=vo.tooltipType),"tooltipColor"in vo&&eo(10,po=vo.tooltipColor),"tooltipWrap"in vo&&eo(11,ho=vo.tooltipWrap),"newStyles"in vo&&eo(12,_o=vo.newStyles)},[no,ro,oo,io,ao,so,lo,co,uo,fo,po,ho,_o,go,bo]}class Icon extends SvelteComponent{constructor(ue){super(),init$3(this,ue,instance$bY,create_fragment$b$,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$5C(to){let ue,eo,no;return eo=new AbsTooltip({props:{text:to[0],$$slots:{default:[create_default_slot$74]},$$scope:{ctx:to}}}),{c(){ue=element("div"),create_component(eo.$$.fragment),attr(ue,"class","icon-container svelte-19tap7e")},m(ro,oo){insert$2(ro,ue,oo),mount_component(eo,ue,null),no=!0},p(ro,oo){const io={};oo&1&&(io.text=ro[0]),oo&38&&(io.$$scope={dirty:oo,ctx:ro}),eo.$set(io)},i(ro){no||(transition_in(eo.$$.fragment,ro),no=!0)},o(ro){transition_out(eo.$$.fragment,ro),no=!1},d(ro){ro&&detach(ue),destroy_component(eo)}}}function create_default_slot$74(to){let ue,eo,no,ro,oo;return eo=new Icon({props:{name:"InfoOutline",size:"S",disabled:to[2],hoverable:!0}}),{c(){ue=element("div"),create_component(eo.$$.fragment),attr(ue,"class","icon svelte-19tap7e"),toggle_class(ue,"icon-small",to[1]==="M"||to[1]==="S")},m(io,ao){insert$2(io,ue,ao),mount_component(eo,ue,null),no=!0,ro||(oo=listen(ue,"focus",to[4]),ro=!0)},p(io,ao){const so={};ao&4&&(so.disabled=io[2]),eo.$set(so),(!no||ao&2)&&toggle_class(ue,"icon-small",io[1]==="M"||io[1]==="S")},i(io){no||(transition_in(eo.$$.fragment,io),no=!0)},o(io){transition_out(eo.$$.fragment,io),no=!1},d(io){io&&detach(ue),destroy_component(eo),ro=!1,oo()}}}function create_fragment$b_(to){let ue,eo,no;const ro=to[3].default,oo=create_slot(ro,to,to[5],null);let io=to[0]&&create_if_block$5C(to);return{c(){ue=element("div"),oo&&oo.c(),eo=space$1(),io&&io.c(),attr(ue,"class","svelte-19tap7e"),toggle_class(ue,"container",!!to[0])},m(ao,so){insert$2(ao,ue,so),oo&&oo.m(ue,null),append$2(ue,eo),io&&io.m(ue,null),no=!0},p(ao,[so]){oo&&oo.p&&(!no||so&32)&&update_slot_base(oo,ro,ao,ao[5],no?get_slot_changes(ro,ao[5],so,null):get_all_dirty_from_scope(ao[5]),null),ao[0]?io?(io.p(ao,so),so&1&&transition_in(io,1)):(io=create_if_block$5C(ao),io.c(),transition_in(io,1),io.m(ue,null)):io&&(group_outros(),transition_out(io,1,1,()=>{io=null}),check_outros()),(!no||so&1)&&toggle_class(ue,"container",!!ao[0])},i(ao){no||(transition_in(oo,ao),transition_in(io),no=!0)},o(ao){transition_out(oo,ao),transition_out(io),no=!1},d(ao){ao&&detach(ue),oo&&oo.d(ao),io&&io.d()}}}function instance$bX(to,ue,eo){let{$$slots:no={},$$scope:ro}=ue,{tooltip:oo=""}=ue,{size:io="M"}=ue,{disabled:ao=!0}=ue;function so(lo){bubble.call(this,to,lo)}return to.$$set=lo=>{"tooltip"in lo&&eo(0,oo=lo.tooltip),"size"in lo&&eo(1,io=lo.size),"disabled"in lo&&eo(2,ao=lo.disabled),"$$scope"in lo&&eo(5,ro=lo.$$scope)},[oo,io,ao,no,so,ro]}class TooltipWrapper extends SvelteComponent{constructor(ue){super(),init$3(this,ue,instance$bX,create_fragment$b_,safe_not_equal,{tooltip:0,size:1,disabled:2})}}const FieldLabel_svelte_svelte_type_style_lang="";function create_default_slot$73(to){let ue,eo=(to[1]||"")+"",no,ro;return{c(){ue=element("label"),no=text(eo),attr(ue,"for",to[0]),attr(ue,"class",ro=null_to_empty(`spectrum-FieldLabel spectrum-FieldLabel--sizeM spectrum-Form-itemLabel ${to[3]}`)+" svelte-dqoj9e")},m(oo,io){insert$2(oo,ue,io),append$2(ue,no)},p(oo,io){io&2&&eo!==(eo=(oo[1]||"")+"")&&set_data(no,eo),io&1&&attr(ue,"for",oo[0]),io&8&&ro!==(ro=null_to_empty(`spectrum-FieldLabel spectrum-FieldLabel--sizeM spectrum-Form-itemLabel ${oo[3]}`)+" svelte-dqoj9e")&&attr(ue,"class",ro)},d(oo){oo&&detach(ue)}}}function create_fragment$bZ(to){let ue,eo;return ue=new TooltipWrapper({props:{tooltip:to[2],size:"S",$$slots:{default:[create_default_slot$73]},$$scope:{ctx:to}}}),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},p(no,[ro]){const oo={};ro&4&&(oo.tooltip=no[2]),ro&43&&(oo.$$scope={dirty:ro,ctx:no}),ue.$set(oo)},i(no){eo||(transition_in(ue.$$.fragment,no),eo=!0)},o(no){transition_out(ue.$$.fragment,no),eo=!1},d(no){destroy_component(ue,no)}}}function instance$bW(to,ue,eo){let no,{forId:ro}=ue,{label:oo}=ue,{position:io="above"}=ue,{tooltip:ao=""}=ue;return to.$$set=so=>{"forId"in so&&eo(0,ro=so.forId),"label"in so&&eo(1,oo=so.label),"position"in so&&eo(4,io=so.position),"tooltip"in so&&eo(2,ao=so.tooltip)},to.$$.update=()=>{to.$$.dirty&16&&eo(3,no=io==="above"?"":`spectrum-FieldLabel--${io}`)},[ro,oo,ao,no,io]}class FieldLabel extends SvelteComponent{constructor(ue){super(),init$3(this,ue,instance$bW,create_fragment$bZ,safe_not_equal,{forId:0,label:1,position:4,tooltip:2})}}const Field_svelte_svelte_type_style_lang="";function create_if_block_2$1U(to){let ue,eo;return ue=new FieldLabel({props:{forId:to[0],label:to[1],position:to[2],tooltip:to[5]}}),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},p(no,ro){const oo={};ro&1&&(oo.forId=no[0]),ro&2&&(oo.label=no[1]),ro&4&&(oo.position=no[2]),ro&32&&(oo.tooltip=no[5]),ue.$set(oo)},i(no){eo||(transition_in(ue.$$.fragment,no),eo=!0)},o(no){transition_out(ue.$$.fragment,no),eo=!1},d(no){destroy_component(ue,no)}}}function create_if_block_1$34(to){let ue,eo,no,ro,oo,io;return eo=new Icon({props:{name:"HelpOutline"}}),{c(){ue=element("div"),create_component(eo.$$.fragment),no=space$1(),ro=element("span"),oo=text(to[4]),attr(ro,"class","svelte-e52e9j"),attr(ue,"class","helpText svelte-e52e9j")},m(ao,so){insert$2(ao,ue,so),mount_component(eo,ue,null),append$2(ue,no),append$2(ue,ro),append$2(ro,oo),io=!0},p(ao,so){(!io||so&16)&&set_data(oo,ao[4])},i(ao){io||(transition_in(eo.$$.fragment,ao),io=!0)},o(ao){transition_out(eo.$$.fragment,ao),io=!1},d(ao){ao&&detach(ue),destroy_component(eo)}}}function create_if_block$5B(to){let ue,eo;return{c(){ue=element("div"),eo=text(to[3]),attr(ue,"class","error svelte-e52e9j")},m(no,ro){insert$2(no,ue,ro),append$2(ue,eo)},p(no,ro){ro&8&&set_data(eo,no[3])},i:noop$7,o:noop$7,d(no){no&&detach(ue)}}}function create_fragment$bY(to){let ue,eo,no,ro,oo,io,ao,so=to[1]&&create_if_block_2$1U(to);const lo=to[7].default,co=create_slot(lo,to,to[6],null),uo=[create_if_block$5B,create_if_block_1$34],fo=[];function po(ho,_o){return ho[3]?0:ho[4]?1:-1}return~(oo=po(to))&&(io=fo[oo]=uo[oo](to)),{c(){ue=element("div"),so&&so.c(),eo=space$1(),no=element("div"),co&&co.c(),ro=space$1(),io&&io.c(),attr(no,"class","spectrum-Form-itemField svelte-e52e9j"),attr(ue,"class","spectrum-Form-item svelte-e52e9j"),toggle_class(ue,"above",to[2]==="above")},m(ho,_o){insert$2(ho,ue,_o),so&&so.m(ue,null),append$2(ue,eo),append$2(ue,no),co&&co.m(no,null),append$2(no,ro),~oo&&fo[oo].m(no,null),ao=!0},p(ho,[_o]){ho[1]?so?(so.p(ho,_o),_o&2&&transition_in(so,1)):(so=create_if_block_2$1U(ho),so.c(),transition_in(so,1),so.m(ue,eo)):so&&(group_outros(),transition_out(so,1,1,()=>{so=null}),check_outros()),co&&co.p&&(!ao||_o&64)&&update_slot_base(co,lo,ho,ho[6],ao?get_slot_changes(lo,ho[6],_o,null):get_all_dirty_from_scope(ho[6]),null);let go=oo;oo=po(ho),oo===go?~oo&&fo[oo].p(ho,_o):(io&&(group_outros(),transition_out(fo[go],1,1,()=>{fo[go]=null}),check_outros()),~oo?(io=fo[oo],io?io.p(ho,_o):(io=fo[oo]=uo[oo](ho),io.c()),transition_in(io,1),io.m(no,null)):io=null),(!ao||_o&4)&&toggle_class(ue,"above",ho[2]==="above")},i(ho){ao||(transition_in(so),transition_in(co,ho),transition_in(io),ao=!0)},o(ho){transition_out(so),transition_out(co,ho),transition_out(io),ao=!1},d(ho){ho&&detach(ue),so&&so.d(),co&&co.d(ho),~oo&&fo[oo].d()}}}function instance$bV(to,ue,eo){let{$$slots:no={},$$scope:ro}=ue,{id:oo=void 0}=ue,{label:io=void 0}=ue,{labelPosition:ao="above"}=ue,{error:so=void 0}=ue,{helpText:lo=void 0}=ue,{tooltip:co=void 0}=ue;return to.$$set=uo=>{"id"in uo&&eo(0,oo=uo.id),"label"in uo&&eo(1,io=uo.label),"labelPosition"in uo&&eo(2,ao=uo.labelPosition),"error"in uo&&eo(3,so=uo.error),"helpText"in uo&&eo(4,lo=uo.helpText),"tooltip"in uo&&eo(5,co=uo.tooltip),"$$scope"in uo&&eo(6,ro=uo.$$scope)},[oo,io,ao,so,lo,co,ro,no]}class Field extends SvelteComponent{constructor(ue){super(),init$3(this,ue,instance$bV,create_fragment$bY,safe_not_equal,{id:0,label:1,labelPosition:2,error:3,helpText:4,tooltip:5})}}const indexVars$C="",TextField_svelte_svelte_type_style_lang="";function create_fragment$bX(to){let ue,eo,no,ro,oo,io,ao,so;return{c(){ue=element("div"),eo=element("input"),eo.disabled=to[3],eo.readOnly=to[5],attr(eo,"id",to[4]),eo.value=no=to[0]??"",attr(eo,"placeholder",ro=to[1]??""),attr(eo,"type",to[2]),attr(eo,"class","spectrum-Textfield-input svelte-1pznijr"),attr(eo,"style",oo=to[7]?`text-align: ${to[7]};`:""),attr(eo,"inputmode",io=to[15](to[2])),attr(eo,"autocomplete",to[10]),attr(ue,"class","spectrum-Textfield svelte-1pznijr"),toggle_class(ue,"spectrum-Textfield--quiet",to[6]),toggle_class(ue,"is-disabled",to[3]),toggle_class(ue,"is-focused",to[9])},m(lo,co){insert$2(lo,ue,co),append$2(ue,eo),to[24](eo),ao||(so=[listen(eo,"click",to[19]),listen(eo,"blur",to[20]),listen(eo,"focus",to[21]),listen(eo,"input",to[22]),listen(eo,"keyup",to[23]),listen(eo,"blur",to[12]),listen(eo,"focus",to[11]),listen(eo,"input",to[13]),listen(eo,"keyup",to[14])],ao=!0)},p(lo,[co]){co&8&&(eo.disabled=lo[3]),co&32&&(eo.readOnly=lo[5]),co&16&&attr(eo,"id",lo[4]),co&1&&no!==(no=lo[0]??"")&&eo.value!==no&&(eo.value=no),co&2&&ro!==(ro=lo[1]??"")&&attr(eo,"placeholder",ro),co&4&&attr(eo,"type",lo[2]),co&128&&oo!==(oo=lo[7]?`text-align: ${lo[7]};`:"")&&attr(eo,"style",oo),co&4&&io!==(io=lo[15](lo[2]))&&attr(eo,"inputmode",io),co&1024&&attr(eo,"autocomplete",lo[10]),co&64&&toggle_class(ue,"spectrum-Textfield--quiet",lo[6]),co&8&&toggle_class(ue,"is-disabled",lo[3]),co&512&&toggle_class(ue,"is-focused",lo[9])},i:noop$7,o:noop$7,d(lo){lo&&detach(ue),to[24](null),ao=!1,run_all(so)}}}function instance$bU(to,ue,eo){let no,{value:ro=null}=ue,{placeholder:oo=void 0}=ue,{type:io="text"}=ue,{disabled:ao=!1}=ue,{id:so=null}=ue,{readonly:lo=!1}=ue,{updateOnChange:co=!0}=ue,{quiet:uo=!1}=ue,{align:fo=void 0}=ue,{autofocus:po=!1}=ue,{autocomplete:ho}=ue;const _o=createEventDispatcher();let go,bo=!1;const vo=zo=>{if(!(lo||ao)){if(io==="number"){const Po=parseFloat(zo);zo=isNaN(Po)?null:Po}_o("change",zo)}},yo=()=>{lo||ao||eo(9,bo=!0)},$o=zo=>{var Po;lo||ao||(eo(9,bo=!1),vo((Po=zo==null?void 0:zo.target)==null?void 0:Po.value))},ko=zo=>{var Po;lo||!co||ao||vo((Po=zo.target)==null?void 0:Po.value)},So=zo=>{var Po;lo||ao||zo.key==="Enter"&&vo((Po=zo.target)==null?void 0:Po.value)},Ao=zo=>zo==="bigint"?"numeric":zo==="number"?"decimal":"text";onMount(async()=>{ao||(eo(9,bo=po||!1),bo&&(await tick(),go.focus()))});function Mo(zo){bubble.call(this,to,zo)}function Eo(zo){bubble.call(this,to,zo)}function To(zo){bubble.call(this,to,zo)}function Io(zo){bubble.call(this,to,zo)}function No(zo){bubble.call(this,to,zo)}function xo(zo){binding_callbacks[zo?"unshift":"push"](()=>{go=zo,eo(8,go)})}return to.$$set=zo=>{"value"in zo&&eo(0,ro=zo.value),"placeholder"in zo&&eo(1,oo=zo.placeholder),"type"in zo&&eo(2,io=zo.type),"disabled"in zo&&eo(3,ao=zo.disabled),"id"in zo&&eo(4,so=zo.id),"readonly"in zo&&eo(5,lo=zo.readonly),"updateOnChange"in zo&&eo(16,co=zo.updateOnChange),"quiet"in zo&&eo(6,uo=zo.quiet),"align"in zo&&eo(7,fo=zo.align),"autofocus"in zo&&eo(17,po=zo.autofocus),"autocomplete"in zo&&eo(18,ho=zo.autocomplete)},to.$$.update=()=>{to.$$.dirty&262144&&eo(10,no=typeof ho=="boolean"?ho?"on":"off":void 0)},[ro,oo,io,ao,so,lo,uo,fo,go,bo,no,yo,$o,ko,So,Ao,co,po,ho,Mo,Eo,To,Io,No,xo]}class TextField extends SvelteComponent{constructor(ue){super(),init$3(this,ue,instance$bU,create_fragment$bX,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$72(to){let ue,eo;return ue=new TextField({props:{updateOnChange:to[8],disabled:to[5],readonly:to[6],value:to[0],placeholder:to[3],type:to[4],quiet:to[9],autofocus:to[10],autocomplete:to[11]}}),ue.$on("change",to[13]),ue.$on("click",to[14]),ue.$on("input",to[15]),ue.$on("blur",to[16]),ue.$on("focus",to[17]),ue.$on("keyup",to[18]),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},p(no,ro){const oo={};ro&256&&(oo.updateOnChange=no[8]),ro&32&&(oo.disabled=no[5]),ro&64&&(oo.readonly=no[6]),ro&1&&(oo.value=no[0]),ro&8&&(oo.placeholder=no[3]),ro&16&&(oo.type=no[4]),ro&512&&(oo.quiet=no[9]),ro&1024&&(oo.autofocus=no[10]),ro&2048&&(oo.autocomplete=no[11]),ue.$set(oo)},i(no){eo||(transition_in(ue.$$.fragment,no),eo=!0)},o(no){transition_out(ue.$$.fragment,no),eo=!1},d(no){destroy_component(ue,no)}}}function create_fragment$bW(to){let ue,eo;return ue=new Field({props:{helpText:to[12],label:to[1],labelPosition:to[2],error:to[7],$$slots:{default:[create_default_slot$72]},$$scope:{ctx:to}}}),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},p(no,[ro]){const oo={};ro&4096&&(oo.helpText=no[12]),ro&2&&(oo.label=no[1]),ro&4&&(oo.labelPosition=no[2]),ro&128&&(oo.error=no[7]),ro&1052537&&(oo.$$scope={dirty:ro,ctx:no}),ue.$set(oo)},i(no){eo||(transition_in(ue.$$.fragment,no),eo=!0)},o(no){transition_out(ue.$$.fragment,no),eo=!1},d(no){destroy_component(ue,no)}}}function instance$bT(to,ue,eo){let{value:no=void 0}=ue,{label:ro=void 0}=ue,{labelPosition:oo="above"}=ue,{placeholder:io=void 0}=ue,{type:ao="text"}=ue,{disabled:so=!1}=ue,{readonly:lo=!1}=ue,{error:co=void 0}=ue,{updateOnChange:uo=!0}=ue,{quiet:fo=!1}=ue,{autofocus:po=void 0}=ue,{autocomplete:ho=void 0}=ue,{helpText:_o=void 0}=ue;const go=createEventDispatcher(),bo=Ao=>{eo(0,no=Ao.detail),go("change",Ao.detail)};function vo(Ao){bubble.call(this,to,Ao)}function yo(Ao){bubble.call(this,to,Ao)}function $o(Ao){bubble.call(this,to,Ao)}function ko(Ao){bubble.call(this,to,Ao)}function So(Ao){bubble.call(this,to,Ao)}return to.$$set=Ao=>{"value"in Ao&&eo(0,no=Ao.value),"label"in Ao&&eo(1,ro=Ao.label),"labelPosition"in Ao&&eo(2,oo=Ao.labelPosition),"placeholder"in Ao&&eo(3,io=Ao.placeholder),"type"in Ao&&eo(4,ao=Ao.type),"disabled"in Ao&&eo(5,so=Ao.disabled),"readonly"in Ao&&eo(6,lo=Ao.readonly),"error"in Ao&&eo(7,co=Ao.error),"updateOnChange"in Ao&&eo(8,uo=Ao.updateOnChange),"quiet"in Ao&&eo(9,fo=Ao.quiet),"autofocus"in Ao&&eo(10,po=Ao.autofocus),"autocomplete"in Ao&&eo(11,ho=Ao.autocomplete),"helpText"in Ao&&eo(12,_o=Ao.helpText)},[no,ro,oo,io,ao,so,lo,co,uo,fo,po,ho,_o,bo,vo,yo,$o,ko,So]}let Input$5=class extends SvelteComponent{constructor(ue){super(),init$3(this,ue,instance$bT,create_fragment$bW,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$B="",indexVars$A="",Stepper_svelte_svelte_type_style_lang="";function create_fragment$bV(to){let ue,eo,no,ro,oo,io,ao,so,lo,co,uo;return{c(){ue=element("div"),eo=element("div"),no=element("input"),oo=space$1(),io=element("span"),ao=element("button"),ao.innerHTML='<svg class="spectrum-Icon spectrum-UIIcon-ChevronUp75" focusable="false" aria-hidden="true"><use xlink:href="#spectrum-css-icon-Chevron75"></use></svg>',so=space$1(),lo=element("button"),lo.innerHTML='<svg class="spectrum-Icon spectrum-UIIcon-ChevronDown75" focusable="false" aria-hidden="true"><use xlink:href="#spectrum-css-icon-Chevron75"></use></svg>',no.disabled=to[1],no.readOnly=to[3],attr(no,"id",to[2]),attr(no,"placeholder",ro=to[0]||""),attr(no,"type","number"),attr(no,"class","spectrum-Textfield-input spectrum-Stepper-input"),attr(eo,"class","spectrum-Textfield spectrum-Stepper-textfield"),attr(ao,"class","spectrum-ActionButton spectrum-ActionButton--sizeM spectrum-Stepper-stepUp"),attr(ao,"tabindex","-1"),attr(lo,"class","spectrum-ActionButton spectrum-ActionButton--sizeM spectrum-Stepper-stepDown"),attr(lo,"tabindex","-1"),attr(io,"class","spectrum-Stepper-buttons"),attr(ue,"class","spectrum-Stepper svelte-c6q2wy"),toggle_class(ue,"spectrum-Stepper--quiet",to[4]),toggle_class(ue,"is-disabled",to[1]),toggle_class(ue,"is-focused",to[5])},m(fo,po){insert$2(fo,ue,po),append$2(ue,eo),append$2(eo,no),set_input_value(no,to[6]),append$2(ue,oo),append$2(ue,io),append$2(io,ao),append$2(io,so),append$2(io,lo),co||(uo=[listen(no,"input",to[23]),listen(no,"click",to[18]),listen(no,"blur",to[19]),listen(no,"focus",to[20]),listen(no,"input",to[21]),listen(no,"keyup",to[22]),listen(no,"blur",to[8]),listen(no,"focus",to[7]),listen(no,"input",to[9]),listen(no,"keyup",to[10]),listen(ao,"click",to[11]),listen(lo,"click",to[12])],co=!0)},p(fo,[po]){po&2&&(no.disabled=fo[1]),po&8&&(no.readOnly=fo[3]),po&4&&attr(no,"id",fo[2]),po&1&&ro!==(ro=fo[0]||"")&&attr(no,"placeholder",ro),po&64&&to_number(no.value)!==fo[6]&&set_input_value(no,fo[6]),po&16&&toggle_class(ue,"spectrum-Stepper--quiet",fo[4]),po&2&&toggle_class(ue,"is-disabled",fo[1]),po&32&&toggle_class(ue,"is-focused",fo[5])},i:noop$7,o:noop$7,d(fo){fo&&detach(ue),co=!1,run_all(uo)}}}function instance$bS(to,ue,eo){let{value:no=null}=ue,{placeholder:ro=null}=ue,{disabled:oo=!1}=ue,{id:io=null}=ue,{readonly:ao=!1}=ue,{updateOnChange:so=!0}=ue,{quiet:lo=!1}=ue,{min:co}=ue,{max:uo}=ue,{step:fo}=ue;const po=createEventDispatcher();let ho=!1,_o=no;const go=xo=>{if(ao)return;const zo=parseFloat(xo);xo=isNaN(zo)?null:zo,xo!=null&&(co!=null&&xo<co?xo=co:uo!=null&&xo>uo&&(xo=uo)),po("change",xo),eo(6,_o=xo)},bo=()=>{ao||eo(5,ho=!0)},vo=xo=>{ao||(eo(5,ho=!1),go(xo.target.value))},yo=xo=>{ao||!so||go(xo.target.value)},$o=xo=>{ao||xo.key==="Enter"&&go(xo.target.value)},ko=()=>{no==null||isNaN(no)?go(fo):go(no+fo)},So=()=>{no==null||isNaN(no)?go(fo):go(no-fo)};function Ao(xo){bubble.call(this,to,xo)}function Mo(xo){bubble.call(this,to,xo)}function Eo(xo){bubble.call(this,to,xo)}function To(xo){bubble.call(this,to,xo)}function Io(xo){bubble.call(this,to,xo)}function No(){_o=to_number(this.value),eo(6,_o),eo(14,no)}return to.$$set=xo=>{"value"in xo&&eo(14,no=xo.value),"placeholder"in xo&&eo(0,ro=xo.placeholder),"disabled"in xo&&eo(1,oo=xo.disabled),"id"in xo&&eo(2,io=xo.id),"readonly"in xo&&eo(3,ao=xo.readonly),"updateOnChange"in xo&&eo(15,so=xo.updateOnChange),"quiet"in xo&&eo(4,lo=xo.quiet),"min"in xo&&eo(16,co=xo.min),"max"in xo&&eo(17,uo=xo.max),"step"in xo&&eo(13,fo=xo.step)},to.$$.update=()=>{to.$$.dirty&16384&&eo(6,_o=no),to.$$.dirty&8192&&eo(13,fo=fo==null||isNaN(fo)?1:fo)},[ro,oo,io,ao,lo,ho,_o,bo,vo,yo,$o,ko,So,fo,no,so,co,uo,Ao,Mo,Eo,To,Io,No]}class Stepper extends SvelteComponent{constructor(ue){super(),init$3(this,ue,instance$bS,create_fragment$bV,safe_not_equal,{value:14,placeholder:0,disabled:1,id:2,readonly:3,updateOnChange:15,quiet:4,min:16,max:17,step:13})}}function create_default_slot$71(to){let ue,eo;return ue=new Stepper({props:{updateOnChange:to[7],error:to[6],disabled:to[4],readonly:to[5],value:to[0],placeholder:to[3],quiet:to[8],min:to[9],max:to[10],step:to[11]}}),ue.$on("change",to[13]),ue.$on("click",to[14]),ue.$on("input",to[15]),ue.$on("blur",to[16]),ue.$on("focus",to[17]),ue.$on("keyup",to[18]),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},p(no,ro){const oo={};ro&128&&(oo.updateOnChange=no[7]),ro&64&&(oo.error=no[6]),ro&16&&(oo.disabled=no[4]),ro&32&&(oo.readonly=no[5]),ro&1&&(oo.value=no[0]),ro&8&&(oo.placeholder=no[3]),ro&256&&(oo.quiet=no[8]),ro&512&&(oo.min=no[9]),ro&1024&&(oo.max=no[10]),ro&2048&&(oo.step=no[11]),ue.$set(oo)},i(no){eo||(transition_in(ue.$$.fragment,no),eo=!0)},o(no){transition_out(ue.$$.fragment,no),eo=!1},d(no){destroy_component(ue,no)}}}function create_fragment$bU(to){let ue,eo;return ue=new Field({props:{helpText:to[12],label:to[1],labelPosition:to[2],error:to[6],$$slots:{default:[create_default_slot$71]},$$scope:{ctx:to}}}),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},p(no,[ro]){const oo={};ro&4096&&(oo.helpText=no[12]),ro&2&&(oo.label=no[1]),ro&4&&(oo.labelPosition=no[2]),ro&64&&(oo.error=no[6]),ro&1052665&&(oo.$$scope={dirty:ro,ctx:no}),ue.$set(oo)},i(no){eo||(transition_in(ue.$$.fragment,no),eo=!0)},o(no){transition_out(ue.$$.fragment,no),eo=!1},d(no){destroy_component(ue,no)}}}function instance$bR(to,ue,eo){let{value:no=null}=ue,{label:ro=null}=ue,{labelPosition:oo="above"}=ue,{placeholder:io=null}=ue,{disabled:ao=!1}=ue,{readonly:so=!1}=ue,{error:lo=null}=ue,{updateOnChange:co=!0}=ue,{quiet:uo=!1}=ue,{min:fo=null}=ue,{max:po=null}=ue,{step:ho=1}=ue,{helpText:_o=null}=ue;const go=createEventDispatcher(),bo=Ao=>{eo(0,no=Ao.detail),go("change",Ao.detail)};function vo(Ao){bubble.call(this,to,Ao)}function yo(Ao){bubble.call(this,to,Ao)}function $o(Ao){bubble.call(this,to,Ao)}function ko(Ao){bubble.call(this,to,Ao)}function So(Ao){bubble.call(this,to,Ao)}return to.$$set=Ao=>{"value"in Ao&&eo(0,no=Ao.value),"label"in Ao&&eo(1,ro=Ao.label),"labelPosition"in Ao&&eo(2,oo=Ao.labelPosition),"placeholder"in Ao&&eo(3,io=Ao.placeholder),"disabled"in Ao&&eo(4,ao=Ao.disabled),"readonly"in Ao&&eo(5,so=Ao.readonly),"error"in Ao&&eo(6,lo=Ao.error),"updateOnChange"in Ao&&eo(7,co=Ao.updateOnChange),"quiet"in Ao&&eo(8,uo=Ao.quiet),"min"in Ao&&eo(9,fo=Ao.min),"max"in Ao&&eo(10,po=Ao.max),"step"in Ao&&eo(11,ho=Ao.step),"helpText"in Ao&&eo(12,_o=Ao.helpText)},[no,ro,oo,io,ao,so,lo,co,uo,fo,po,ho,_o,bo,vo,yo,$o,ko,So]}class Stepper_1 extends SvelteComponent{constructor(ue){super(),init$3(this,ue,instance$bR,create_fragment$bU,safe_not_equal,{value:0,label:1,labelPosition:2,placeholder:3,disabled:4,readonly:5,error:6,updateOnChange:7,quiet:8,min:9,max:10,step:11,helpText:12})}}const TextArea_svelte_svelte_type_style_lang="";function create_fragment$bT(to){let ue,eo,no,ro,oo,io,ao,so;return{c(){ue=element("div"),eo=element("textarea"),attr(eo,"placeholder",no=to[1]||""),attr(eo,"class","spectrum-Textfield-input svelte-1kmb9uq"),attr(eo,"style",ro=to[5]?`text-align: ${to[5]}`:""),eo.disabled=to[2],eo.readOnly=to[3],attr(eo,"id",to[4]),eo.value=oo=to[0]||"",attr(ue,"style",io=`${to[9]}${to[8]}`),attr(ue,"class","spectrum-Textfield spectrum-Textfield--multiline svelte-1kmb9uq"),toggle_class(ue,"is-disabled",to[2]),toggle_class(ue,"is-focused",to[6])},m(lo,co){insert$2(lo,ue,co),append$2(ue,eo),to[14](eo),ao||(so=[listen(eo,"focus",to[15]),listen(eo,"blur",to[10])],ao=!0)},p(lo,[co]){co&2&&no!==(no=lo[1]||"")&&attr(eo,"placeholder",no),co&32&&ro!==(ro=lo[5]?`text-align: ${lo[5]}`:"")&&attr(eo,"style",ro),co&4&&(eo.disabled=lo[2]),co&8&&(eo.readOnly=lo[3]),co&16&&attr(eo,"id",lo[4]),co&1&&oo!==(oo=lo[0]||"")&&(eo.value=oo),co&768&&io!==(io=`${lo[9]}${lo[8]}`)&&attr(ue,"style",io),co&4&&toggle_class(ue,"is-disabled",lo[2]),co&64&&toggle_class(ue,"is-focused",lo[6])},i:noop$7,o:noop$7,d(lo){lo&&detach(ue),to[14](null),ao=!1,run_all(so)}}}function instance$bQ(to,ue,eo){let no,ro,{value:oo=""}=ue,{placeholder:io=null}=ue,{disabled:ao=!1}=ue,{readonly:so=!1}=ue,{id:lo=null}=ue,{height:co=null}=ue,{minHeight:uo=null}=ue;const fo=()=>({start:_o.selectionStart,end:_o.selectionEnd});let{align:po=null}=ue,ho=!1,_o;const go=createEventDispatcher(),bo=ko=>{go("change",ko.target.value),eo(6,ho=!1)},vo=(ko,So)=>!ko||So==null?"":isNaN(So)?`${ko}:${So};`:`${ko}:${So}px;`;function yo(ko){binding_callbacks[ko?"unshift":"push"](()=>{_o=ko,eo(7,_o)})}const $o=()=>eo(6,ho=!0);return to.$$set=ko=>{"value"in ko&&eo(0,oo=ko.value),"placeholder"in ko&&eo(1,io=ko.placeholder),"disabled"in ko&&eo(2,ao=ko.disabled),"readonly"in ko&&eo(3,so=ko.readonly),"id"in ko&&eo(4,lo=ko.id),"height"in ko&&eo(11,co=ko.height),"minHeight"in ko&&eo(12,uo=ko.minHeight),"align"in ko&&eo(5,po=ko.align)},to.$$.update=()=>{to.$$.dirty&2048&&eo(9,no=vo("height",co)),to.$$.dirty&4096&&eo(8,ro=vo("min-height",uo))},[oo,io,ao,so,lo,po,ho,_o,ro,no,bo,co,uo,fo,yo,$o]}class TextArea extends SvelteComponent{constructor(ue){super(),init$3(this,ue,instance$bQ,create_fragment$bT,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]}}function create_default_slot$70(to){let ue,eo,no;function ro(io){to[11](io)}let oo={error:to[6],disabled:to[5],value:to[0],placeholder:to[4],height:to[7],minHeight:to[8]};return to[1]!==void 0&&(oo.getCaretPosition=to[1]),ue=new TextArea({props:oo}),binding_callbacks.push(()=>bind$2(ue,"getCaretPosition",ro)),ue.$on("change",to[10]),{c(){create_component(ue.$$.fragment)},m(io,ao){mount_component(ue,io,ao),no=!0},p(io,ao){const so={};ao&64&&(so.error=io[6]),ao&32&&(so.disabled=io[5]),ao&1&&(so.value=io[0]),ao&16&&(so.placeholder=io[4]),ao&128&&(so.height=io[7]),ao&256&&(so.minHeight=io[8]),!eo&&ao&2&&(eo=!0,so.getCaretPosition=io[1],add_flush_callback(()=>eo=!1)),ue.$set(so)},i(io){no||(transition_in(ue.$$.fragment,io),no=!0)},o(io){transition_out(ue.$$.fragment,io),no=!1},d(io){destroy_component(ue,io)}}}function create_fragment$bS(to){let ue,eo;return ue=new Field({props:{helpText:to[9],label:to[2],labelPosition:to[3],error:to[6],$$slots:{default:[create_default_slot$70]},$$scope:{ctx:to}}}),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},p(no,[ro]){const oo={};ro&512&&(oo.helpText=no[9]),ro&4&&(oo.label=no[2]),ro&8&&(oo.labelPosition=no[3]),ro&64&&(oo.error=no[6]),ro&8691&&(oo.$$scope={dirty:ro,ctx:no}),ue.$set(oo)},i(no){eo||(transition_in(ue.$$.fragment,no),eo=!0)},o(no){transition_out(ue.$$.fragment,no),eo=!1},d(no){destroy_component(ue,no)}}}function instance$bP(to,ue,eo){let{value:no=null}=ue,{label:ro=null}=ue,{labelPosition:oo="above"}=ue,{placeholder:io=null}=ue,{disabled:ao=!1}=ue,{error:so=null}=ue,{getCaretPosition:lo=null}=ue,{height:co=null}=ue,{minHeight:uo=null}=ue,{helpText:fo=null}=ue;const po=createEventDispatcher(),ho=go=>{eo(0,no=go.detail),po("change",go.detail)};function _o(go){lo=go,eo(1,lo)}return to.$$set=go=>{"value"in go&&eo(0,no=go.value),"label"in go&&eo(2,ro=go.label),"labelPosition"in go&&eo(3,oo=go.labelPosition),"placeholder"in go&&eo(4,io=go.placeholder),"disabled"in go&&eo(5,ao=go.disabled),"error"in go&&eo(6,so=go.error),"getCaretPosition"in go&&eo(1,lo=go.getCaretPosition),"height"in go&&eo(7,co=go.height),"minHeight"in go&&eo(8,uo=go.minHeight),"helpText"in go&&eo(9,fo=go.helpText)},[no,lo,ro,oo,io,ao,so,co,uo,fo,ho,_o]}class TextArea_1 extends SvelteComponent{constructor(ue){super(),init$3(this,ue,instance$bP,create_fragment$bS,safe_not_equal,{value:0,label:2,labelPosition:3,placeholder:4,disabled:5,error:6,getCaretPosition:1,height:7,minHeight:8,helpText:9})}}const indexVars$z="",indexVars$y="",indexVars$x="",ignoredClasses=[".download-js-link",".spectrum-Menu",".date-time-popover"],conditionallyIgnoredClasses=[".spectrum-Underlay",".drawer-wrapper",".spectrum-Popover"];let clickHandlers=[],candidateTarget;const handleClick=to=>{const ue=to.target||to.relatedTarget;if(!ue.closest('[data-ignore-click-outside="true"]')){for(let eo of ignoredClasses)if(ue.closest(eo))return;clickHandlers.forEach(eo=>{var no;if(!eo.element.contains(ue)){for(let ro of conditionallyIgnoredClasses){const oo=eo.anchor.closest(ro)!=null;if(ue.closest(ro)!=null&&!oo)return}(no=eo.callback)==null||no.call(eo,to)}})}},handleMouseUp=to=>{candidateTarget===to.target&&handleClick(to),candidateTarget=void 0},handleMouseDown=to=>{to.button===0&&(candidateTarget=to.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=(to,ue,eo,no)=>{let ro=clickHandlers.find(oo=>oo.id===to);ro?ro.callback=no:clickHandlers.push({id:to,element:ue,anchor:eo,callback:no})},removeHandler=to=>{clickHandlers=clickHandlers.filter(ue=>ue.id!==to)},clickOutside=(to,ue)=>{const eo=Math.random(),no=io=>typeof io=="function",ro=io=>io!=null&&typeof io=="object",oo=io=>{let ao,so=to;no(io)?ao=io:ro(io)&&(ao=io.callback,io.anchor&&(so=io.anchor)),updateHandler(eo,to,so,ao)};return oo(ue),{update:oo,destroy:()=>removeHandler(eo)}},indexVars$w="",Search_svelte_svelte_type_style_lang="";function create_fragment$bR(to){let ue,eo,no,ro,oo,io,ao,so,lo,co,uo,fo;return{c(){ue=element("div"),eo=element("div"),no=svg_element("svg"),ro=svg_element("use"),oo=space$1(),io=element("input"),lo=space$1(),co=element("button"),co.innerHTML='<svg class="spectrum-Icon spectrum-UIIcon-Cross75" focusable="false" aria-hidden="true"><use xlink:href="#spectrum-css-icon-Cross75"></use></svg>',xlink_attr(ro,"xlink:href","#spectrum-icon-18-Magnify"),attr(no,"class","spectrum-Icon spectrum-Icon--sizeM spectrum-Textfield-icon"),attr(no,"focusable","false"),attr(no,"aria-hidden","true"),io.disabled=to[3],attr(io,"id",to[4]),io.value=ao=to[1]||"",attr(io,"placeholder",so=to[2]||""),attr(io,"type","search"),attr(io,"class","spectrum-Textfield-input spectrum-Search-input svelte-d7zw73"),attr(io,"autocomplete","off"),attr(eo,"class","spectrum-Textfield svelte-d7zw73"),toggle_class(eo,"spectrum-Textfield--quiet",to[5]),toggle_class(eo,"is-focused",to[6]),toggle_class(eo,"is-disabled",to[3]),attr(co,"type","reset"),attr(co,"class","spectrum-ClearButton spectrum-Search-clearButton svelte-d7zw73"),attr(ue,"class","spectrum-Search svelte-d7zw73"),toggle_class(ue,"is-disabled",to[3])},m(po,ho){insert$2(po,ue,ho),append$2(ue,eo),append$2(eo,no),append$2(no,ro),append$2(eo,oo),append$2(eo,io),to[17](io),append$2(ue,lo),append$2(ue,co),uo||(fo=[listen(io,"click",to[13]),listen(io,"blur",to[14]),listen(io,"focus",to[15]),listen(io,"input",to[16]),listen(io,"blur",to[9]),listen(io,"focus",to[8]),listen(io,"input",to[10]),listen(io,"keyup",to[11]),listen(co,"click",to[18])],uo=!0)},p(po,[ho]){ho&8&&(io.disabled=po[3]),ho&16&&attr(io,"id",po[4]),ho&2&&ao!==(ao=po[1]||"")&&io.value!==ao&&(io.value=ao),ho&4&&so!==(so=po[2]||"")&&attr(io,"placeholder",so),ho&32&&toggle_class(eo,"spectrum-Textfield--quiet",po[5]),ho&64&&toggle_class(eo,"is-focused",po[6]),ho&8&&toggle_class(eo,"is-disabled",po[3]),ho&8&&toggle_class(ue,"is-disabled",po[3])},i:noop$7,o:noop$7,d(po){po&&detach(ue),to[17](null),uo=!1,run_all(fo)}}}function instance$bO(to,ue,eo){let{value:no=null}=ue,{placeholder:ro=void 0}=ue,{disabled:oo=!1}=ue,{id:io=null}=ue,{updateOnChange:ao=!0}=ue,{quiet:so=!1}=ue,{inputRef:lo=void 0}=ue;const co=createEventDispatcher();let uo=!1;const fo=Ao=>{co("change",Ao)},po=()=>{eo(6,uo=!0)},ho=Ao=>{eo(6,uo=!1),fo(Ao.target.value)},_o=Ao=>{ao&&fo(Ao.target.value)},go=Ao=>{Ao.key==="Enter"&&fo(Ao.target.value)};function bo(Ao){bubble.call(this,to,Ao)}function vo(Ao){bubble.call(this,to,Ao)}function yo(Ao){bubble.call(this,to,Ao)}function $o(Ao){bubble.call(this,to,Ao)}function ko(Ao){binding_callbacks[Ao?"unshift":"push"](()=>{lo=Ao,eo(0,lo)})}const So=()=>fo("");return to.$$set=Ao=>{"value"in Ao&&eo(1,no=Ao.value),"placeholder"in Ao&&eo(2,ro=Ao.placeholder),"disabled"in Ao&&eo(3,oo=Ao.disabled),"id"in Ao&&eo(4,io=Ao.id),"updateOnChange"in Ao&&eo(12,ao=Ao.updateOnChange),"quiet"in Ao&&eo(5,so=Ao.quiet),"inputRef"in Ao&&eo(0,lo=Ao.inputRef)},[lo,no,ro,oo,io,so,uo,fo,po,ho,_o,go,ao,bo,vo,yo,$o,ko,So]}class Search extends SvelteComponent{constructor(ue){super(),init$3(this,ue,instance$bO,create_fragment$bR,safe_not_equal,{value:1,placeholder:2,disabled:3,id:4,updateOnChange:12,quiet:5,inputRef:0})}}const indexVars$v="",StatusLight_svelte_svelte_type_style_lang="";function create_fragment$bQ(to){let ue,eo,no,ro,oo,io;const ao=to[21].default,so=create_slot(ao,to,to[20],null);return{c(){ue=element("div"),so&&so.c(),attr(ue,"class",eo="spectrum-StatusLight spectrum-StatusLight--size"+to[0]+" svelte-1wk2ay6"),attr(ue,"style",no=`--color: ${to[16]??"var(--spectrum-global-color-gray-400)"};`),toggle_class(ue,"custom",!!to[16]),toggle_class(ue,"square",to[17]),toggle_class(ue,"hoverable",to[18]),toggle_class(ue,"spectrum-StatusLight--celery",to[1]),toggle_class(ue,"spectrum-StatusLight--yellow",to[2]),toggle_class(ue,"spectrum-StatusLight--fuchsia",to[3]),toggle_class(ue,"spectrum-StatusLight--indigo",to[4]),toggle_class(ue,"spectrum-StatusLight--seafoam",to[5]),toggle_class(ue,"spectrum-StatusLight--chartreuse",to[6]),toggle_class(ue,"spectrum-StatusLight--magenta",to[7]),toggle_class(ue,"spectrum-StatusLight--purple",to[8]),toggle_class(ue,"spectrum-StatusLight--neutral",to[9]),toggle_class(ue,"spectrum-StatusLight--info",to[10]),toggle_class(ue,"spectrum-StatusLight--positive",to[11]),toggle_class(ue,"spectrum-StatusLight--notice",to[12]),toggle_class(ue,"spectrum-StatusLight--negative",to[13]),toggle_class(ue,"spectrum-StatusLight--disabled",to[14]),toggle_class(ue,"spectrum-StatusLight--active",to[15]),toggle_class(ue,"withText",!!to[19].default)},m(lo,co){insert$2(lo,ue,co),so&&so.m(ue,null),ro=!0,oo||(io=listen(ue,"click",to[22]),oo=!0)},p(lo,[co]){so&&so.p&&(!ro||co&1048576)&&update_slot_base(so,ao,lo,lo[20],ro?get_slot_changes(ao,lo[20],co,null):get_all_dirty_from_scope(lo[20]),null),(!ro||co&1&&eo!==(eo="spectrum-StatusLight spectrum-StatusLight--size"+lo[0]+" svelte-1wk2ay6"))&&attr(ue,"class",eo),(!ro||co&65536&&no!==(no=`--color: ${lo[16]??"var(--spectrum-global-color-gray-400)"};`))&&attr(ue,"style",no),(!ro||co&65537)&&toggle_class(ue,"custom",!!lo[16]),(!ro||co&131073)&&toggle_class(ue,"square",lo[17]),(!ro||co&262145)&&toggle_class(ue,"hoverable",lo[18]),(!ro||co&3)&&toggle_class(ue,"spectrum-StatusLight--celery",lo[1]),(!ro||co&5)&&toggle_class(ue,"spectrum-StatusLight--yellow",lo[2]),(!ro||co&9)&&toggle_class(ue,"spectrum-StatusLight--fuchsia",lo[3]),(!ro||co&17)&&toggle_class(ue,"spectrum-StatusLight--indigo",lo[4]),(!ro||co&33)&&toggle_class(ue,"spectrum-StatusLight--seafoam",lo[5]),(!ro||co&65)&&toggle_class(ue,"spectrum-StatusLight--chartreuse",lo[6]),(!ro||co&129)&&toggle_class(ue,"spectrum-StatusLight--magenta",lo[7]),(!ro||co&257)&&toggle_class(ue,"spectrum-StatusLight--purple",lo[8]),(!ro||co&513)&&toggle_class(ue,"spectrum-StatusLight--neutral",lo[9]),(!ro||co&1025)&&toggle_class(ue,"spectrum-StatusLight--info",lo[10]),(!ro||co&2049)&&toggle_class(ue,"spectrum-StatusLight--positive",lo[11]),(!ro||co&4097)&&toggle_class(ue,"spectrum-StatusLight--notice",lo[12]),(!ro||co&8193)&&toggle_class(ue,"spectrum-StatusLight--negative",lo[13]),(!ro||co&16385)&&toggle_class(ue,"spectrum-StatusLight--disabled",lo[14]),(!ro||co&32769)&&toggle_class(ue,"spectrum-StatusLight--active",lo[15]),(!ro||co&524289)&&toggle_class(ue,"withText",!!lo[19].default)},i(lo){ro||(transition_in(so,lo),ro=!0)},o(lo){transition_out(so,lo),ro=!1},d(lo){lo&&detach(ue),so&&so.d(lo),oo=!1,io()}}}function instance$bN(to,ue,eo){let{$$slots:no={},$$scope:ro}=ue;const oo=compute_slots(no);let{size:io="M"}=ue,{celery:ao=!1}=ue,{yellow:so=!1}=ue,{fuchsia:lo=!1}=ue,{indigo:co=!1}=ue,{seafoam:uo=!1}=ue,{chartreuse:fo=!1}=ue,{magenta:po=!1}=ue,{purple:ho=!1}=ue,{neutral:_o=!1}=ue,{info:go=!1}=ue,{positive:bo=!1}=ue,{notice:vo=!1}=ue,{negative:yo=!1}=ue,{disabled:$o=!1}=ue,{active:ko=!1}=ue,{color:So=void 0}=ue,{square:Ao=!1}=ue,{hoverable:Mo=!1}=ue;function Eo(To){bubble.call(this,to,To)}return to.$$set=To=>{"size"in To&&eo(0,io=To.size),"celery"in To&&eo(1,ao=To.celery),"yellow"in To&&eo(2,so=To.yellow),"fuchsia"in To&&eo(3,lo=To.fuchsia),"indigo"in To&&eo(4,co=To.indigo),"seafoam"in To&&eo(5,uo=To.seafoam),"chartreuse"in To&&eo(6,fo=To.chartreuse),"magenta"in To&&eo(7,po=To.magenta),"purple"in To&&eo(8,ho=To.purple),"neutral"in To&&eo(9,_o=To.neutral),"info"in To&&eo(10,go=To.info),"positive"in To&&eo(11,bo=To.positive),"notice"in To&&eo(12,vo=To.notice),"negative"in To&&eo(13,yo=To.negative),"disabled"in To&&eo(14,$o=To.disabled),"active"in To&&eo(15,ko=To.active),"color"in To&&eo(16,So=To.color),"square"in To&&eo(17,Ao=To.square),"hoverable"in To&&eo(18,Mo=To.hoverable),"$$scope"in To&&eo(20,ro=To.$$scope)},[io,ao,so,lo,co,uo,fo,po,ho,_o,go,bo,vo,yo,$o,ko,So,Ao,Mo,oo,ro,no,Eo]}class StatusLight extends SvelteComponent{constructor(ue){super(),init$3(this,ue,instance$bN,create_fragment$bQ,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(to,ue){let eo,no=ue;const ro=()=>oo(no),oo=ao=>{const{anchor:so,align:lo,maxHeight:co,maxWidth:uo,minWidth:fo,useAnchorWidth:po,offset:ho=5,customUpdate:_o,resizable:go,wrap:bo}=ao;if(!so)return;const vo=so.getBoundingClientRect(),yo=to.getBoundingClientRect(),$o=window.innerWidth,ko=window.innerHeight,So=8;let Ao={maxHeight:co,minWidth:po?vo.width:fo,maxWidth:po?vo.width:uo,left:0,top:0};if(typeof _o=="function")Ao=_o(vo,yo,{...Ao,offset:ao.offset});else{const Mo=()=>Ao.left+yo.width>$o&&vo.left>$o-vo.right,Eo=()=>Ao.top+yo.height>ko&&vo.top>ko-vo.bottom,To=xo=>{!Ao.maxHeight&&go&&(Ao.maxHeight=xo)},Io=xo=>{switch(xo){case"StartToStart":default:Ao.left=vo.left;break;case"EndToEnd":Ao.left=vo.right-yo.width;break;case"StartToEnd":Ao.left=vo.right+ho;break;case"EndToStart":Ao.left=vo.left-yo.width-ho;break;case"MidPoint":Ao.left=vo.left+vo.width/2-yo.width/2;break;case"ScreenEdge":Ao.left=$o-yo.width-So;break}},No=xo=>{switch(xo){case"StartToStart":Ao.top=vo.top,To(ko-vo.top-So);break;case"EndToEnd":Ao.top=vo.bottom-yo.height,To(vo.bottom-So);break;case"StartToEnd":default:Ao.top=vo.bottom+ho,To(ko-vo.bottom-So);break;case"EndToStart":Ao.top=vo.top-yo.height-ho,To(vo.top-So);break;case"MidPoint":Ao.top=vo.top+vo.height/2-yo.height/2;break;case"ScreenEdge":Ao.top=ko-yo.height-So,To(ko-2*So);break}};lo===PopoverAlignment.Right?Io("EndToEnd"):lo===PopoverAlignment.RightOutside||lo===PopoverAlignment.RightContextMenu?Io("StartToEnd"):lo===PopoverAlignment.LeftOutside||lo===PopoverAlignment.LeftContextMenu?Io("EndToStart"):lo===PopoverAlignment.Center?Io("MidPoint"):Io("StartToStart"),lo===PopoverAlignment.RightOutside||lo===PopoverAlignment.LeftOutside?No("MidPoint"):lo===PopoverAlignment.RightContextMenu||lo===PopoverAlignment.LeftContextMenu?(No("StartToStart"),Ao.top&&(Ao.top-=5)):No("StartToEnd"),Mo()&&(lo===PopoverAlignment.Left?Io("EndToEnd"):lo===PopoverAlignment.RightOutside&&Io("EndToStart")),Eo()&&(bo?(No("MidPoint"),Eo()&&No("ScreenEdge"),Io("StartToEnd"),Mo()&&Io("EndToStart")):lo===PopoverAlignment.LeftOutside||lo===PopoverAlignment.RightOutside?No("ScreenEdge"):No("EndToStart"))}for(const[Mo,Eo]of Object.entries(Ao)){const To=Mo;Eo!=null?to.style[To]=`${Eo}px`:to.style[To]=""}},io=ao=>{no=ao,eo&&eo.disconnect();const{anchor:so}=ao;so&&(eo=new ResizeObserver(()=>oo(ao)),eo.observe(so),eo.observe(to),eo.observe(document.body))};return to.style.position="fixed",to.style.zIndex="9999",document.addEventListener("scroll",ro,!0),io(ue),{update:io,destroy(){eo&&eo.disconnect(),document.removeEventListener("scroll",ro,!0)}}}const Context$1={Modal:"bbui-modal",PopoverRoot:"bbui-popover-root"},Popover_svelte_svelte_type_style_lang="";function create_if_block$5A(to){let ue,eo;return ue=new Portal$1({props:{target:to[17],$$slots:{default:[create_default_slot$6$]},$$scope:{ctx:to}}}),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},p(no,ro){const oo={};ro&131072&&(oo.target=no[17]),ro&537001982&&(oo.$$scope={dirty:ro,ctx:no}),ue.$set(oo)},i(no){eo||(transition_in(ue.$$.fragment,no),eo=!0)},o(no){transition_out(ue.$$.fragment,no),eo=!1},d(no){destroy_component(ue,no)}}}function create_default_slot$6$(to){let ue,eo,no,ro,oo,io,ao;const so=to[26].default,lo=create_slot(so,to,to[29],null);return{c(){ue=element("div"),lo&&lo.c(),attr(ue,"tabindex","0"),attr(ue,"class","spectrum-Popover is-open svelte-1kml6bp"),attr(ue,"role","presentation"),set_style(ue,"height",to[9]),set_style(ue,"--customZIndex",to[11]),toggle_class(ue,"customZIndex",to[11]),toggle_class(ue,"hidden",!to[13]),toggle_class(ue,"blockPointerEvents",to[16])},m(co,uo){insert$2(co,ue,uo),lo&&lo.m(ue,null),oo=!0,io||(ao=[action_destroyer(eo=positionDropdown.call(null,ue,{anchor:to[1],align:to[2],maxHeight:to[5],maxWidth:to[4],minWidth:to[3],useAnchorWidth:to[6],offset:to[8],customUpdate:to[12],resizable:to[14],wrap:to[15]})),action_destroyer(no=clickOutside.call(null,ue,{callback:to[7]?to[18]:clickOutside_function,anchor:to[1]})),listen(ue,"keydown",to[19]),listen(ue,"mouseenter",to[27]),listen(ue,"mouseleave",to[28])],io=!0)},p(co,uo){to=co,lo&&lo.p&&(!oo||uo&536870912)&&update_slot_base(lo,so,to,to[29],oo?get_slot_changes(so,to[29],uo,null):get_all_dirty_from_scope(to[29]),null),(!oo||uo&512)&&set_style(ue,"height",to[9]),(!oo||uo&2048)&&set_style(ue,"--customZIndex",to[11]),eo&&is_function(eo.update)&&uo&53630&&eo.update.call(null,{anchor:to[1],align:to[2],maxHeight:to[5],maxWidth:to[4],minWidth:to[3],useAnchorWidth:to[6],offset:to[8],customUpdate:to[12],resizable:to[14],wrap:to[15]}),no&&is_function(no.update)&&uo&130&&no.update.call(null,{callback:to[7]?to[18]:clickOutside_function,anchor:to[1]}),(!oo||uo&2048)&&toggle_class(ue,"customZIndex",to[11]),(!oo||uo&8192)&&toggle_class(ue,"hidden",!to[13]),(!oo||uo&65536)&&toggle_class(ue,"blockPointerEvents",to[16])},i(co){oo||(transition_in(lo,co),co&&add_render_callback(()=>{oo&&(ro||(ro=create_bidirectional_transition(ue,fly,{y:-20,duration:to[10]?animationDuration:0},!0)),ro.run(1))}),oo=!0)},o(co){transition_out(lo,co),co&&(ro||(ro=create_bidirectional_transition(ue,fly,{y:-20,duration:to[10]?animationDuration:0},!1)),ro.run(0)),oo=!1},d(co){co&&detach(ue),lo&&lo.d(co),co&&ro&&ro.end(),io=!1,run_all(ao)}}}function create_fragment$bP(to){let ue,eo,no=to[0]&&create_if_block$5A(to);return{c(){no&&no.c(),ue=empty$2()},m(ro,oo){no&&no.m(ro,oo),insert$2(ro,ue,oo),eo=!0},p(ro,[oo]){ro[0]?no?(no.p(ro,oo),oo&1&&transition_in(no,1)):(no=create_if_block$5A(ro),no.c(),transition_in(no,1),no.m(ue.parentNode,ue)):no&&(group_outros(),transition_out(no,1,1,()=>{no=null}),check_outros())},i(ro){eo||(transition_in(no),eo=!0)},o(ro){transition_out(no),eo=!1},d(ro){ro&&detach(ue),no&&no.d(ro)}}}const animationDuration=260,clickOutside_function=()=>{};function instance$bM(to,ue,eo){let no,{$$slots:ro={},$$scope:oo}=ue,{anchor:io}=ue,{align:ao=PopoverAlignment.Right}=ue,{portalTarget:so=void 0}=ue,{minWidth:lo=void 0}=ue,{maxWidth:co=void 0}=ue,{maxHeight:uo=void 0}=ue,{open:fo=!1}=ue,{useAnchorWidth:po=!1}=ue,{dismissible:ho=!0}=ue,{offset:_o=4}=ue,{customHeight:go=void 0}=ue,{animate:bo=!0}=ue,{customZIndex:vo=void 0}=ue,{handlePositionUpdate:yo=void 0}=ue,{showPopover:$o=!0}=ue,{clickOutsideOverride:ko=!1}=ue,{resizable:So=!0}=ue,{wrap:Ao=!1}=ue;const Mo=createEventDispatcher();let Eo,To=!1;const Io=()=>{Mo("open"),eo(0,fo=!0)},No=()=>{Mo("close"),eo(0,fo=!1)},xo=()=>{fo?No():Io()},zo=Fo=>{if(!ko&&fo){let Wo=Fo.target,Go=!1;for(;!Go&&Wo&&Wo.parentNode;)Go=Wo===io,Wo=Wo.parentNode;Go&&Fo.stopPropagation(),No()}},Po=Fo=>{ko&&fo&&Fo.key==="Escape"&&No()};onDestroy(()=>{clearTimeout(Eo)});function Bo(Fo){bubble.call(this,to,Fo)}function qo(Fo){bubble.call(this,to,Fo)}return to.$$set=Fo=>{"anchor"in Fo&&eo(1,io=Fo.anchor),"align"in Fo&&eo(2,ao=Fo.align),"portalTarget"in Fo&&eo(20,so=Fo.portalTarget),"minWidth"in Fo&&eo(3,lo=Fo.minWidth),"maxWidth"in Fo&&eo(4,co=Fo.maxWidth),"maxHeight"in Fo&&eo(5,uo=Fo.maxHeight),"open"in Fo&&eo(0,fo=Fo.open),"useAnchorWidth"in Fo&&eo(6,po=Fo.useAnchorWidth),"dismissible"in Fo&&eo(7,ho=Fo.dismissible),"offset"in Fo&&eo(8,_o=Fo.offset),"customHeight"in Fo&&eo(9,go=Fo.customHeight),"animate"in Fo&&eo(10,bo=Fo.animate),"customZIndex"in Fo&&eo(11,vo=Fo.customZIndex),"handlePositionUpdate"in Fo&&eo(12,yo=Fo.handlePositionUpdate),"showPopover"in Fo&&eo(13,$o=Fo.showPopover),"clickOutsideOverride"in Fo&&eo(21,ko=Fo.clickOutsideOverride),"resizable"in Fo&&eo(14,So=Fo.resizable),"wrap"in Fo&&eo(15,Ao=Fo.wrap),"$$scope"in Fo&&eo(29,oo=Fo.$$scope)},to.$$.update=()=>{to.$$.dirty&1048576&&eo(17,no=so||getContext$1(Context$1.PopoverRoot)||".spectrum"),to.$$.dirty&33555457&&fo&&bo&&(eo(16,To=!0),clearTimeout(Eo),eo(25,Eo=setTimeout(()=>{eo(16,To=!1)},animationDuration/2)))},[fo,io,ao,lo,co,uo,po,ho,_o,go,bo,vo,yo,$o,So,Ao,To,no,zo,Po,so,ko,Io,No,xo,Eo,ro,Bo,qo,oo]}class Popover extends SvelteComponent{constructor(ue){super(),init$3(this,ue,instance$bM,create_fragment$bP,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$u="",Tags_svelte_svelte_type_style_lang="";function create_fragment$bO(to){let ue,eo;const no=to[1].default,ro=create_slot(no,to,to[0],null);return{c(){ue=element("div"),ro&&ro.c(),attr(ue,"class","spectrum-Tags svelte-17cj8k0"),attr(ue,"role","list"),attr(ue,"aria-label","list")},m(oo,io){insert$2(oo,ue,io),ro&&ro.m(ue,null),eo=!0},p(oo,[io]){ro&&ro.p&&(!eo||io&1)&&update_slot_base(ro,no,oo,oo[0],eo?get_slot_changes(no,oo[0],io,null):get_all_dirty_from_scope(oo[0]),null)},i(oo){eo||(transition_in(ro,oo),eo=!0)},o(oo){transition_out(ro,oo),eo=!1},d(oo){oo&&detach(ue),ro&&ro.d(oo)}}}function instance$bL(to,ue,eo){let{$$slots:no={},$$scope:ro}=ue;return to.$$set=oo=>{"$$scope"in oo&&eo(0,ro=oo.$$scope)},[ro,no]}class Tags extends SvelteComponent{constructor(ue){super(),init$3(this,ue,instance$bL,create_fragment$bO,safe_not_equal,{})}}const indexVars$t="",Avatar_svelte_svelte_type_style_lang="";function create_else_block$21(to){let ue,eo=(to[3]||"")+"",no;return{c(){ue=element("div"),no=text(eo),attr(ue,"class","spectrum-Avatar svelte-xutedg"),attr(ue,"style",to[4]),toggle_class(ue,"is-disabled",to[2])},m(ro,oo){insert$2(ro,ue,oo),append$2(ue,no)},p(ro,oo){oo&8&&eo!==(eo=(ro[3]||"")+"")&&set_data(no,eo),oo&16&&attr(ue,"style",ro[4]),oo&4&&toggle_class(ue,"is-disabled",ro[2])},d(ro){ro&&detach(ue)}}}function create_if_block$5z(to){let ue,eo;return{c(){ue=element("img"),attr(ue,"class","spectrum-Avatar"),src_url_equal(ue.src,eo=to[1])||attr(ue,"src",eo),attr(ue,"alt","Avatar"),set_style(ue,"width","var("+to[5].get(to[0])+")"),set_style(ue,"height","var("+to[5].get(to[0])+")"),toggle_class(ue,"is-disabled",to[2])},m(no,ro){insert$2(no,ue,ro)},p(no,ro){ro&2&&!src_url_equal(ue.src,eo=no[1])&&attr(ue,"src",eo),ro&1&&set_style(ue,"width","var("+no[5].get(no[0])+")"),ro&1&&set_style(ue,"height","var("+no[5].get(no[0])+")"),ro&4&&toggle_class(ue,"is-disabled",no[2])},d(no){no&&detach(ue)}}}function create_fragment$bN(to){let ue;function eo(oo,io){return oo[1]?create_if_block$5z:create_else_block$21}let no=eo(to),ro=no(to);return{c(){ro.c(),ue=empty$2()},m(oo,io){ro.m(oo,io),insert$2(oo,ue,io)},p(oo,[io]){no===(no=eo(oo))&&ro?ro.p(oo,io):(ro.d(1),ro=no(oo),ro&&(ro.c(),ro.m(ue.parentNode,ue)))},i:noop$7,o:noop$7,d(oo){oo&&detach(ue),ro.d(oo)}}}const DefaultColor="#3aab87";function instance$bK(to,ue,eo){let no,ro,oo=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:io="M"}=ue,{url:ao=""}=ue,{disabled:so=!1}=ue,{initials:lo="JD"}=ue,{color:co=null}=ue;const uo=po=>po!=null&&po.length?`hsl(${po[0].toLowerCase().charCodeAt(0)%26/26*360}, 50%, 50%)`:DefaultColor,fo=(po,ho)=>{const _o=`var(${oo.get(po)})`,go=`calc(${_o} / 2)`;return`width:${_o}; height:${_o}; font-size:${go}; background:${ho};`};return to.$$set=po=>{"size"in po&&eo(0,io=po.size),"url"in po&&eo(1,ao=po.url),"disabled"in po&&eo(2,so=po.disabled),"initials"in po&&eo(3,lo=po.initials),"color"in po&&eo(6,co=po.color)},to.$$.update=()=>{to.$$.dirty&72&&eo(7,no=co||uo(lo)),to.$$.dirty&129&&eo(4,ro=fo(io,no))},[io,ao,so,lo,ro,oo,co,no]}class Avatar extends SvelteComponent{constructor(ue){super(),init$3(this,ue,instance$bK,create_fragment$bN,safe_not_equal,{size:0,url:1,disabled:2,initials:3,color:6})}}function create_fragment$bM(to){let ue,eo,no,ro,oo;return{c(){ue=element("button"),eo=svg_element("svg"),no=svg_element("use"),xlink_attr(no,"xlink:href","#spectrum-css-icon-Cross75"),attr(eo,"class","spectrum-Icon spectrum-UIIcon-Cross75"),attr(eo,"focusable","false"),attr(eo,"aria-hidden","true"),attr(ue,"class","spectrum-ClearButton"),ue.disabled=to[1],toggle_class(ue,"spectrum-ClearButton--small",to[0])},m(io,ao){insert$2(io,ue,ao),append$2(ue,eo),append$2(eo,no),ro||(oo=listen(ue,"click",to[2]),ro=!0)},p(io,[ao]){ao&2&&(ue.disabled=io[1]),ao&1&&toggle_class(ue,"spectrum-ClearButton--small",io[0])},i:noop$7,o:noop$7,d(io){io&&detach(ue),ro=!1,oo()}}}function instance$bJ(to,ue,eo){let{small:no=!1}=ue,{disabled:ro}=ue;function oo(io){bubble.call(this,to,io)}return to.$$set=io=>{"small"in io&&eo(0,no=io.small),"disabled"in io&&eo(1,ro=io.disabled)},[no,ro,oo]}class ClearButton extends SvelteComponent{constructor(ue){super(),init$3(this,ue,instance$bJ,create_fragment$bM,safe_not_equal,{small:0,disabled:1})}}const Tag_svelte_svelte_type_style_lang="";function create_if_block_2$1T(to){let ue,eo;return ue=new Avatar({props:{url:to[1]}}),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},p(no,ro){const oo={};ro&2&&(oo.url=no[1]),ue.$set(oo)},i(no){eo||(transition_in(ue.$$.fragment,no),eo=!0)},o(no){transition_out(ue.$$.fragment,no),eo=!1},d(no){destroy_component(ue,no)}}}function create_if_block_1$33(to){let ue,eo,no;return{c(){ue=svg_element("svg"),eo=svg_element("use"),xlink_attr(eo,"xlink:href",no="#spectrum-icon-24-"+to[0]),attr(ue,"class","spectrum-Icon spectrum-Icon--sizeS"),attr(ue,"focusable","false"),attr(ue,"aria-hidden","true"),attr(ue,"aria-label","Tag")},m(ro,oo){insert$2(ro,ue,oo),append$2(ue,eo)},p(ro,oo){oo&1&&no!==(no="#spectrum-icon-24-"+ro[0])&&xlink_attr(eo,"xlink:href",no)},d(ro){ro&&detach(ue)}}}function create_if_block$5y(to){let ue,eo;return ue=new ClearButton({}),ue.$on("click",to[7]),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},i(no){eo||(transition_in(ue.$$.fragment,no),eo=!0)},o(no){transition_out(ue.$$.fragment,no),eo=!1},d(no){destroy_component(ue,no)}}}function create_fragment$bL(to){let ue,eo,no,ro,oo,io,ao=to[1]&&create_if_block_2$1T(to),so=to[0]&&create_if_block_1$33(to);const lo=to[6].default,co=create_slot(lo,to,to[5],null);let uo=to[4]&&create_if_block$5y(to);return{c(){ue=element("div"),ao&&ao.c(),eo=space$1(),so&&so.c(),no=space$1(),ro=element("span"),co&&co.c(),oo=space$1(),uo&&uo.c(),attr(ro,"class","spectrum-Tags-itemLabel"),attr(ue,"class","spectrum-Tags-item svelte-16fqld8"),attr(ue,"role","listitem"),toggle_class(ue,"is-invalid",to[2]),toggle_class(ue,"is-disabled",to[3])},m(fo,po){insert$2(fo,ue,po),ao&&ao.m(ue,null),append$2(ue,eo),so&&so.m(ue,null),append$2(ue,no),append$2(ue,ro),co&&co.m(ro,null),append$2(ue,oo),uo&&uo.m(ue,null),io=!0},p(fo,[po]){fo[1]?ao?(ao.p(fo,po),po&2&&transition_in(ao,1)):(ao=create_if_block_2$1T(fo),ao.c(),transition_in(ao,1),ao.m(ue,eo)):ao&&(group_outros(),transition_out(ao,1,1,()=>{ao=null}),check_outros()),fo[0]?so?so.p(fo,po):(so=create_if_block_1$33(fo),so.c(),so.m(ue,no)):so&&(so.d(1),so=null),co&&co.p&&(!io||po&32)&&update_slot_base(co,lo,fo,fo[5],io?get_slot_changes(lo,fo[5],po,null):get_all_dirty_from_scope(fo[5]),null),fo[4]?uo?po&16&&transition_in(uo,1):(uo=create_if_block$5y(fo),uo.c(),transition_in(uo,1),uo.m(ue,null)):uo&&(group_outros(),transition_out(uo,1,1,()=>{uo=null}),check_outros()),(!io||po&4)&&toggle_class(ue,"is-invalid",fo[2]),(!io||po&8)&&toggle_class(ue,"is-disabled",fo[3])},i(fo){io||(transition_in(ao),transition_in(co,fo),transition_in(uo),io=!0)},o(fo){transition_out(ao),transition_out(co,fo),transition_out(uo),io=!1},d(fo){fo&&detach(ue),ao&&ao.d(),so&&so.d(),co&&co.d(fo),uo&&uo.d()}}}function instance$bI(to,ue,eo){let{$$slots:no={},$$scope:ro}=ue,{icon:oo=""}=ue,{avatar:io=""}=ue,{invalid:ao=!1}=ue,{disabled:so=!1}=ue,{closable:lo=!1}=ue;function co(uo){bubble.call(this,to,uo)}return to.$$set=uo=>{"icon"in uo&&eo(0,oo=uo.icon),"avatar"in uo&&eo(1,io=uo.avatar),"invalid"in uo&&eo(2,ao=uo.invalid),"disabled"in uo&&eo(3,so=uo.disabled),"closable"in uo&&eo(4,lo=uo.closable),"$$scope"in uo&&eo(5,ro=uo.$$scope)},[oo,io,ao,so,lo,ro,no,co]}let Tag$1=class extends SvelteComponent{constructor(ue){super(),init$3(this,ue,instance$bI,create_fragment$bL,safe_not_equal,{icon:0,avatar:1,invalid:2,disabled:3,closable:4})}};const indexVars$s="";function create_fragment$bK(to){let ue,eo,no,ro,oo,io,ao,so,lo,co,uo,fo,po,ho;return{c(){ue=element("div"),eo=element("div"),no=space$1(),ro=element("div"),oo=element("div"),io=element("div"),ao=element("div"),so=space$1(),lo=element("div"),co=element("div"),uo=element("div"),attr(eo,"class","spectrum-ProgressCircle-track"),attr(ao,"class","spectrum-ProgressCircle-fill"),attr(io,"class","spectrum-ProgressCircle-fillSubMask1"),attr(io,"style",to[3]),attr(oo,"class","spectrum-ProgressCircle-fillMask1"),attr(uo,"class","spectrum-ProgressCircle-fill"),attr(co,"class","spectrum-ProgressCircle-fillSubMask2"),attr(co,"style",to[4]),attr(lo,"class","spectrum-ProgressCircle-fillMask2"),attr(ro,"class","spectrum-ProgressCircle-fills"),attr(ue,"class",fo="spectrum-ProgressCircle spectrum-ProgressCircle--"+convertSize(to[0])),toggle_class(ue,"spectrum-ProgressCircle--indeterminate",to[1]==null),toggle_class(ue,"spectrum-ProgressCircle--overBackground",to[2])},m(_o,go){insert$2(_o,ue,go),append$2(ue,eo),append$2(ue,no),append$2(ue,ro),append$2(ro,oo),append$2(oo,io),append$2(io,ao),append$2(ro,so),append$2(ro,lo),append$2(lo,co),append$2(co,uo),po||(ho=listen(ue,"click",to[7]),po=!0)},p(_o,[go]){go&8&&attr(io,"style",_o[3]),go&16&&attr(co,"style",_o[4]),go&1&&fo!==(fo="spectrum-ProgressCircle spectrum-ProgressCircle--"+convertSize(_o[0]))&&attr(ue,"class",fo),go&3&&toggle_class(ue,"spectrum-ProgressCircle--indeterminate",_o[1]==null),go&5&&toggle_class(ue,"spectrum-ProgressCircle--overBackground",_o[2])},i:noop$7,o:noop$7,d(_o){_o&&detach(ue),po=!1,ho()}}}function convertSize(to){switch(to){case"S":return"small";case"L":return"large";default:return}}function instance$bH(to,ue,eo){let{size:no="M"}=ue,{value:ro=null}=ue,{minValue:oo=0}=ue,{maxValue:io=100}=ue,ao,so;function lo(fo){if(fo){let po=(fo-oo)/(io-oo)*100,ho;po>0&&po<=50?(ho=-180+po/50*180,eo(3,ao=`transform: rotate(${ho}deg);`),eo(4,so="transform: rotate(-180deg);")):po>50&&(ho=-180+(po-50)/50*180,eo(3,ao="transform: rotate(0deg);"),eo(4,so=`transform: rotate(${ho}deg);`))}}let{overBackground:co=!1}=ue;function uo(fo){bubble.call(this,to,fo)}return to.$$set=fo=>{"size"in fo&&eo(0,no=fo.size),"value"in fo&&eo(1,ro=fo.value),"minValue"in fo&&eo(5,oo=fo.minValue),"maxValue"in fo&&eo(6,io=fo.maxValue),"overBackground"in fo&&eo(2,co=fo.overBackground)},to.$$.update=()=>{to.$$.dirty&2&&lo(ro)},[no,ro,co,ao,so,oo,io,uo]}class ProgressCircle extends SvelteComponent{constructor(ue){super(),init$3(this,ue,instance$bH,create_fragment$bK,safe_not_equal,{size:0,value:1,minValue:5,maxValue:6,overBackground:2})}}const Picker_svelte_svelte_type_style_lang="";function get_each_context$2h(to,ue,eo){const no=to.slice();return no[49]=ue[eo],no[51]=eo,no}function create_if_block_11$6(to){let ue,eo,no,ro;const oo=[create_if_block_12$4,create_else_block_1$z],io=[];function ao(so,lo){return so[17]?1:0}return ue=ao(to),eo=io[ue]=oo[ue](to),{c(){eo.c(),no=empty$2()},m(so,lo){io[ue].m(so,lo),insert$2(so,no,lo),ro=!0},p(so,lo){let co=ue;ue=ao(so),ue===co?io[ue].p(so,lo):(group_outros(),transition_out(io[co],1,1,()=>{io[co]=null}),check_outros(),eo=io[ue],eo?eo.p(so,lo):(eo=io[ue]=oo[ue](so),eo.c()),transition_in(eo,1),eo.m(no.parentNode,no))},i(so){ro||(transition_in(eo),ro=!0)},o(so){transition_out(eo),ro=!1},d(so){so&&detach(no),io[ue].d(so)}}}function create_else_block_1$z(to){let ue,eo,no;return{c(){ue=element("span"),eo=element("img"),src_url_equal(eo.src,no=to[5])||attr(eo,"src",no),attr(eo,"alt","icon"),attr(eo,"width","15"),attr(eo,"height","15"),attr(ue,"class","option-extra icon field-icon svelte-1jmtv0w")},m(ro,oo){insert$2(ro,ue,oo),append$2(ue,eo)},p(ro,oo){oo[0]&32&&!src_url_equal(eo.src,no=ro[5])&&attr(eo,"src",no)},i:noop$7,o:noop$7,d(ro){ro&&detach(ue)}}}function create_if_block_12$4(to){let ue,eo,no;return eo=new Icon({props:{size:"S",name:to[5]}}),{c(){ue=element("span"),create_component(eo.$$.fragment),attr(ue,"class","option-extra icon svelte-1jmtv0w")},m(ro,oo){insert$2(ro,ue,oo),mount_component(eo,ue,null),no=!0},p(ro,oo){const io={};oo[0]&32&&(io.name=ro[5]),eo.$set(io)},i(ro){no||(transition_in(eo.$$.fragment,ro),no=!0)},o(ro){transition_out(eo.$$.fragment,ro),no=!1},d(ro){ro&&detach(ue),destroy_component(eo)}}}function create_if_block_10$a(to){let ue,eo,no;return eo=new StatusLight({props:{square:!0,color:to[6]}}),{c(){ue=element("span"),create_component(eo.$$.fragment),attr(ue,"class","option-extra svelte-1jmtv0w")},m(ro,oo){insert$2(ro,ue,oo),mount_component(eo,ue,null),no=!0},p(ro,oo){const io={};oo[0]&64&&(io.color=ro[6]),eo.$set(io)},i(ro){no||(transition_in(eo.$$.fragment,ro),no=!0)},o(ro){transition_out(eo.$$.fragment,ro),no=!1},d(ro){ro&&detach(ue),destroy_component(eo)}}}function create_if_block_9$h(to){let ue,eo;return ue=new Search({props:{value:to[0],disabled:to[3],placeholder:"Search"}}),ue.$on("change",to[37]),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},p(no,ro){const oo={};ro[0]&1&&(oo.value=no[0]),ro[0]&8&&(oo.disabled=no[3]),ue.$set(oo)},i(no){eo||(transition_in(ue.$$.fragment,no),eo=!0)},o(no){transition_out(ue.$$.fragment,no),eo=!1},d(no){destroy_component(ue,no)}}}function create_if_block_8$k(to){let ue,eo,no,ro,oo,io,ao,so;return{c(){ue=element("li"),eo=element("span"),no=text(to[8]),ro=space$1(),oo=svg_element("svg"),io=svg_element("use"),attr(eo,"class","spectrum-Menu-itemLabel svelte-1jmtv0w"),xlink_attr(io,"xlink:href","#spectrum-css-icon-Checkmark100"),attr(oo,"class","spectrum-Icon spectrum-UIIcon-Checkmark100 spectrum-Menu-checkmark spectrum-Menu-itemIcon svelte-1jmtv0w"),attr(oo,"focusable","false"),attr(oo,"aria-hidden","true"),attr(ue,"class","spectrum-Menu-item placeholder svelte-1jmtv0w"),attr(ue,"role","option"),attr(ue,"aria-selected","true"),attr(ue,"tabindex","0"),toggle_class(ue,"is-selected",to[7])},m(lo,co){insert$2(lo,ue,co),append$2(ue,eo),append$2(eo,no),append$2(ue,ro),append$2(ue,oo),append$2(oo,io),ao||(so=listen(ue,"click",to[38]),ao=!0)},p(lo,co){co[0]&256&&set_data(no,lo[8]),co[0]&128&&toggle_class(ue,"is-selected",lo[7])},d(lo){lo&&detach(ue),ao=!1,so()}}}function create_if_block_2$1S(to){let ue,eo,no=ensure_array_like(to[30]),ro=[];for(let io=0;io<no.length;io+=1)ro[io]=create_each_block$2h(get_each_context$2h(to,no,io));const oo=io=>transition_out(ro[io],1,1,()=>{ro[io]=null});return{c(){for(let io=0;io<ro.length;io+=1)ro[io].c();ue=empty$2()},m(io,ao){for(let so=0;so<ro.length;so+=1)ro[so]&&ro[so].m(io,ao);insert$2(io,ue,ao),eo=!0},p(io,ao){if(ao[0]&1275330048){no=ensure_array_like(io[30]);let so;for(so=0;so<no.length;so+=1){const lo=get_each_context$2h(io,no,so);ro[so]?(ro[so].p(lo,ao),transition_in(ro[so],1)):(ro[so]=create_each_block$2h(lo),ro[so].c(),transition_in(ro[so],1),ro[so].m(ue.parentNode,ue))}for(group_outros(),so=no.length;so<ro.length;so+=1)oo(so);check_outros()}},i(io){if(!eo){for(let ao=0;ao<no.length;ao+=1)transition_in(ro[ao]);eo=!0}},o(io){ro=ro.filter(Boolean);for(let ao=0;ao<ro.length;ao+=1)transition_out(ro[ao]);eo=!1},d(io){io&&detach(ue),destroy_each(ro,io)}}}function create_if_block_6$w(to){let ue,eo,no,ro;const oo=[create_if_block_7$s,create_else_block$20],io=[];function ao(so,lo){return so[17]?0:1}return eo=ao(to),no=io[eo]=oo[eo](to),{c(){ue=element("span"),no.c(),attr(ue,"class","option-extra icon svelte-1jmtv0w")},m(so,lo){insert$2(so,ue,lo),io[eo].m(ue,null),ro=!0},p(so,lo){let co=eo;eo=ao(so),eo===co?io[eo].p(so,lo):(group_outros(),transition_out(io[co],1,1,()=>{io[co]=null}),check_outros(),no=io[eo],no?no.p(so,lo):(no=io[eo]=oo[eo](so),no.c()),transition_in(no,1),no.m(ue,null))},i(so){ro||(transition_in(no),ro=!0)},o(so){transition_out(no),ro=!1},d(so){so&&detach(ue),io[eo].d()}}}function create_else_block$20(to){let ue,eo;return ue=new Icon({props:{size:"S",name:to[14](to[49],to[51])}}),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},p(no,ro){const oo={};ro[0]&1073758208&&(oo.name=no[14](no[49],no[51])),ue.$set(oo)},i(no){eo||(transition_in(ue.$$.fragment,no),eo=!0)},o(no){transition_out(ue.$$.fragment,no),eo=!1},d(no){destroy_component(ue,no)}}}function create_if_block_7$s(to){let ue,eo;return{c(){ue=element("img"),src_url_equal(ue.src,eo=to[14](to[49],to[51]))||attr(ue,"src",eo),attr(ue,"alt","icon"),attr(ue,"width","15"),attr(ue,"height","15")},m(no,ro){insert$2(no,ue,ro)},p(no,ro){ro[0]&1073758208&&!src_url_equal(ue.src,eo=no[14](no[49],no[51]))&&attr(ue,"src",eo)},i:noop$7,o:noop$7,d(no){no&&detach(ue)}}}function create_if_block_5$H(to){let ue,eo,no;return eo=new StatusLight({props:{square:!0,color:to[15](to[49],to[51])}}),{c(){ue=element("span"),create_component(eo.$$.fragment),attr(ue,"class","option-extra svelte-1jmtv0w")},m(ro,oo){insert$2(ro,ue,oo),mount_component(eo,ue,null),no=!0},p(ro,oo){const io={};oo[0]&1073774592&&(io.color=ro[15](ro[49],ro[51])),eo.$set(io)},i(ro){no||(transition_in(eo.$$.fragment,ro),no=!0)},o(ro){transition_out(eo.$$.fragment,ro),no=!1},d(ro){ro&&detach(ue),destroy_component(eo)}}}function create_if_block_4$V(to){let ue,eo=to[16](to[49],to[51])+"",no;return{c(){ue=element("span"),no=text(eo),attr(ue,"class","subtitle-text svelte-1jmtv0w")},m(ro,oo){insert$2(ro,ue,oo),append$2(ue,no)},p(ro,oo){oo[0]&1073807360&&eo!==(eo=ro[16](ro[49],ro[51])+"")&&set_data(no,eo)},d(ro){ro&&detach(ue)}}}function create_if_block_3$1i(to){let ue,eo,no;return eo=new Tags({props:{$$slots:{default:[create_default_slot_1$4p]},$$scope:{ctx:to}}}),{c(){ue=element("span"),create_component(eo.$$.fragment),attr(ue,"class","option-tag svelte-1jmtv0w")},m(ro,oo){insert$2(ro,ue,oo),mount_component(eo,ue,null),no=!0},p(ro,oo){const io={};oo[0]&1073741824|oo[1]&2097152&&(io.$$scope={dirty:oo,ctx:ro}),eo.$set(io)},i(ro){no||(transition_in(eo.$$.fragment,ro),no=!0)},o(ro){transition_out(eo.$$.fragment,ro),no=!1},d(ro){ro&&detach(ue),destroy_component(eo)}}}function create_default_slot_2$36(to){let ue=to[49].tag+"",eo;return{c(){eo=text(ue)},m(no,ro){insert$2(no,eo,ro)},p(no,ro){ro[0]&1073741824&&ue!==(ue=no[49].tag+"")&&set_data(eo,ue)},d(no){no&&detach(eo)}}}function create_default_slot_1$4p(to){let ue,eo;return ue=new Tag$1({props:{icon:"LockClosed",$$slots:{default:[create_default_slot_2$36]},$$scope:{ctx:to}}}),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},p(no,ro){const oo={};ro[0]&1073741824|ro[1]&2097152&&(oo.$$scope={dirty:ro,ctx:no}),ue.$set(oo)},i(no){eo||(transition_in(ue.$$.fragment,no),eo=!0)},o(no){transition_out(ue.$$.fragment,no),eo=!1},d(no){destroy_component(ue,no)}}}function create_each_block$2h(to){let ue,eo=to[14](to[49],to[51]),no,ro=to[15](to[49],to[51]),oo,io,ao=to[12](to[49],to[51])+"",so,lo,co=to[16](to[49],to[51]),uo,fo,po,ho,_o,go,bo,vo,yo=eo&&create_if_block_6$w(to),$o=ro&&create_if_block_5$H(to),ko=co&&create_if_block_4$V(to),So=to[49].tag&&create_if_block_3$1i(to);function Ao(){return to[39](to[49],to[51])}function Mo(...To){return to[40](to[49],...To)}function Eo(...To){return to[41](to[49],...To)}return{c(){ue=element("li"),yo&&yo.c(),no=space$1(),$o&&$o.c(),oo=space$1(),io=element("span"),so=text(ao),lo=space$1(),ko&&ko.c(),uo=space$1(),So&&So.c(),fo=space$1(),po=svg_element("svg"),ho=svg_element("use"),_o=space$1(),attr(io,"class","spectrum-Menu-itemLabel svelte-1jmtv0w"),xlink_attr(ho,"xlink:href","#spectrum-css-icon-Checkmark100"),attr(po,"class","spectrum-Icon spectrum-UIIcon-Checkmark100 spectrum-Menu-checkmark spectrum-Menu-itemIcon svelte-1jmtv0w"),attr(po,"focusable","false"),attr(po,"aria-hidden","true"),attr(ue,"class","spectrum-Menu-item svelte-1jmtv0w"),attr(ue,"role","option"),attr(ue,"aria-selected","true"),attr(ue,"tabindex","0"),toggle_class(ue,"is-selected",to[9](to[13](to[49],to[51]))),toggle_class(ue,"is-disabled",!to[10](to[49]))},m(To,Io){insert$2(To,ue,Io),yo&&yo.m(ue,null),append$2(ue,no),$o&&$o.m(ue,null),append$2(ue,oo),append$2(ue,io),append$2(io,so),append$2(io,lo),ko&&ko.m(io,null),append$2(ue,uo),So&&So.m(ue,null),append$2(ue,fo),append$2(ue,po),append$2(po,ho),append$2(ue,_o),go=!0,bo||(vo=[listen(ue,"click",Ao),listen(ue,"mouseenter",Mo),listen(ue,"mouseleave",Eo)],bo=!0)},p(To,Io){to=To,Io[0]&1073758208&&(eo=to[14](to[49],to[51])),eo?yo?(yo.p(to,Io),Io[0]&1073758208&&transition_in(yo,1)):(yo=create_if_block_6$w(to),yo.c(),transition_in(yo,1),yo.m(ue,no)):yo&&(group_outros(),transition_out(yo,1,1,()=>{yo=null}),check_outros()),Io[0]&1073774592&&(ro=to[15](to[49],to[51])),ro?$o?($o.p(to,Io),Io[0]&1073774592&&transition_in($o,1)):($o=create_if_block_5$H(to),$o.c(),transition_in($o,1),$o.m(ue,oo)):$o&&(group_outros(),transition_out($o,1,1,()=>{$o=null}),check_outros()),(!go||Io[0]&1073745920)&&ao!==(ao=to[12](to[49],to[51])+"")&&set_data(so,ao),Io[0]&1073807360&&(co=to[16](to[49],to[51])),co?ko?ko.p(to,Io):(ko=create_if_block_4$V(to),ko.c(),ko.m(io,null)):ko&&(ko.d(1),ko=null),to[49].tag?So?(So.p(to,Io),Io[0]&1073741824&&transition_in(So,1)):(So=create_if_block_3$1i(to),So.c(),transition_in(So,1),So.m(ue,fo)):So&&(group_outros(),transition_out(So,1,1,()=>{So=null}),check_outros()),(!go||Io[0]&1073750528)&&toggle_class(ue,"is-selected",to[9](to[13](to[49],to[51]))),(!go||Io[0]&1073742848)&&toggle_class(ue,"is-disabled",!to[10](to[49]))},i(To){go||(transition_in(yo),transition_in($o),transition_in(So),go=!0)},o(To){transition_out(yo),transition_out($o),transition_out(So),go=!1},d(To){To&&detach(ue),yo&&yo.d(),$o&&$o.d(),ko&&ko.d(),So&&So.d(),bo=!1,run_all(vo)}}}function create_if_block_1$32(to){let ue,eo,no;return eo=new ProgressCircle({props:{size:"S"}}),{c(){ue=element("div"),create_component(eo.$$.fragment),attr(ue,"class","loading svelte-1jmtv0w"),toggle_class(ue,"loading--withAutocomplete",to[20])},m(ro,oo){insert$2(ro,ue,oo),mount_component(eo,ue,null),no=!0},p(ro,oo){(!no||oo[0]&1048576)&&toggle_class(ue,"loading--withAutocomplete",ro[20])},i(ro){no||(transition_in(eo.$$.fragment,ro),no=!0)},o(ro){transition_out(eo.$$.fragment,ro),no=!1},d(ro){ro&&detach(ue),destroy_component(eo)}}}function create_if_block$5x(to){let ue,eo;return{c(){ue=element("div"),eo=text(to[23]),attr(ue,"class","footer svelte-1jmtv0w")},m(no,ro){insert$2(no,ue,ro),append$2(ue,eo)},p(no,ro){ro[0]&8388608&&set_data(eo,no[23])},d(no){no&&detach(ue)}}}function create_default_slot$6_(to){let ue,eo,no,ro,oo,io,ao,so,lo,co,uo=to[20]&&create_if_block_9$h(to),fo=to[8]&&create_if_block_8$k(to),po=to[30].length&&create_if_block_2$1S(to),ho=to[25]&&create_if_block_1$32(to),_o=to[23]&&create_if_block$5x(to);return{c(){ue=element("div"),uo&&uo.c(),eo=space$1(),no=element("ul"),fo&&fo.c(),ro=space$1(),po&&po.c(),oo=space$1(),ho&&ho.c(),io=space$1(),_o&&_o.c(),attr(no,"class","spectrum-Menu"),attr(no,"role","listbox"),attr(ue,"class","popover-content svelte-1jmtv0w"),toggle_class(ue,"auto-width",to[19])},m(go,bo){insert$2(go,ue,bo),uo&&uo.m(ue,null),append$2(ue,eo),append$2(ue,no),fo&&fo.m(no,null),append$2(no,ro),po&&po.m(no,null),to[42](no),append$2(ue,oo),ho&&ho.m(ue,null),append$2(ue,io),_o&&_o.m(ue,null),so=!0,lo||(co=action_destroyer(ao=clickOutside.call(null,ue,to[43])),lo=!0)},p(go,bo){go[20]?uo?(uo.p(go,bo),bo[0]&1048576&&transition_in(uo,1)):(uo=create_if_block_9$h(go),uo.c(),transition_in(uo,1),uo.m(ue,eo)):uo&&(group_outros(),transition_out(uo,1,1,()=>{uo=null}),check_outros()),go[8]?fo?fo.p(go,bo):(fo=create_if_block_8$k(go),fo.c(),fo.m(no,ro)):fo&&(fo.d(1),fo=null),go[30].length?po?(po.p(go,bo),bo[0]&1073741824&&transition_in(po,1)):(po=create_if_block_2$1S(go),po.c(),transition_in(po,1),po.m(no,null)):po&&(group_outros(),transition_out(po,1,1,()=>{po=null}),check_outros()),go[25]?ho?(ho.p(go,bo),bo[0]&33554432&&transition_in(ho,1)):(ho=create_if_block_1$32(go),ho.c(),transition_in(ho,1),ho.m(ue,io)):ho&&(group_outros(),transition_out(ho,1,1,()=>{ho=null}),check_outros()),go[23]?_o?_o.p(go,bo):(_o=create_if_block$5x(go),_o.c(),_o.m(ue,null)):_o&&(_o.d(1),_o=null),ao&&is_function(ao.update)&&bo[0]&2&&ao.update.call(null,go[43]),(!so||bo[0]&524288)&&toggle_class(ue,"auto-width",go[19])},i(go){so||(transition_in(uo),transition_in(po),transition_in(ho),so=!0)},o(go){transition_out(uo),transition_out(po),transition_out(ho),so=!1},d(go){go&&detach(ue),uo&&uo.d(),fo&&fo.d(),po&&po.d(),to[42](null),ho&&ho.d(),_o&&_o.d(),lo=!1,co()}}}function create_fragment$bJ(to){let ue,eo,no,ro,oo,io,ao,so,lo,co,uo,fo,po,ho=to[5]&&create_if_block_11$6(to),_o=to[6]&&create_if_block_10$a(to);return co=new Popover({props:{anchor:to[24]?to[24]:to[29],align:to[22]||PopoverAlignment.Left,open:to[1],useAnchorWidth:!to[19],maxWidth:to[19]?400:void 0,customHeight:to[21],maxHeight:360,$$slots:{default:[create_default_slot$6_]},$$scope:{ctx:to}}}),co.$on("close",to[44]),{c(){ue=element("button"),ho&&ho.c(),eo=space$1(),_o&&_o.c(),no=space$1(),ro=element("span"),oo=text(to[4]),io=space$1(),ao=svg_element("svg"),so=svg_element("use"),lo=space$1(),create_component(co.$$.fragment),attr(ro,"class","spectrum-Picker-label svelte-1jmtv0w"),toggle_class(ro,"is-placeholder",to[7]),toggle_class(ro,"auto-width",to[19]),xlink_attr(so,"xlink:href","#spectrum-css-icon-Chevron100"),attr(ao,"class","spectrum-Icon spectrum-UIIcon-ChevronDown100 spectrum-Picker-menuIcon"),attr(ao,"focusable","false"),attr(ao,"aria-hidden","true"),attr(ue,"id",to[2]),attr(ue,"class","spectrum-Picker spectrum-Picker--sizeM svelte-1jmtv0w"),ue.disabled=to[3],attr(ue,"aria-haspopup","listbox"),toggle_class(ue,"spectrum-Picker--quiet",to[18]),toggle_class(ue,"is-open",to[1])},m(go,bo){insert$2(go,ue,bo),ho&&ho.m(ue,null),append$2(ue,eo),_o&&_o.m(ue,null),append$2(ue,no),append$2(ue,ro),append$2(ro,oo),append$2(ue,io),append$2(ue,ao),append$2(ao,so),to[36](ue),insert$2(go,lo,bo),mount_component(co,go,bo),uo=!0,fo||(po=listen(ue,"click",to[31]),fo=!0)},p(go,bo){go[5]?ho?(ho.p(go,bo),bo[0]&32&&transition_in(ho,1)):(ho=create_if_block_11$6(go),ho.c(),transition_in(ho,1),ho.m(ue,eo)):ho&&(group_outros(),transition_out(ho,1,1,()=>{ho=null}),check_outros()),go[6]?_o?(_o.p(go,bo),bo[0]&64&&transition_in(_o,1)):(_o=create_if_block_10$a(go),_o.c(),transition_in(_o,1),_o.m(ue,no)):_o&&(group_outros(),transition_out(_o,1,1,()=>{_o=null}),check_outros()),(!uo||bo[0]&16)&&set_data(oo,go[4]),(!uo||bo[0]&128)&&toggle_class(ro,"is-placeholder",go[7]),(!uo||bo[0]&524288)&&toggle_class(ro,"auto-width",go[19]),(!uo||bo[0]&4)&&attr(ue,"id",go[2]),(!uo||bo[0]&8)&&(ue.disabled=go[3]),(!uo||bo[0]&262144)&&toggle_class(ue,"spectrum-Picker--quiet",go[18]),(!uo||bo[0]&2)&&toggle_class(ue,"is-open",go[1]);const vo={};bo[0]&553648128&&(vo.anchor=go[24]?go[24]:go[29]),bo[0]&4194304&&(vo.align=go[22]||PopoverAlignment.Left),bo[0]&2&&(vo.open=go[1]),bo[0]&524288&&(vo.useAnchorWidth=!go[19]),bo[0]&524288&&(vo.maxWidth=go[19]?400:void 0),bo[0]&2097152&&(vo.customHeight=go[21]),bo[0]&1587281803|bo[1]&2097152&&(vo.$$scope={dirty:bo,ctx:go}),co.$set(vo)},i(go){uo||(transition_in(ho),transition_in(_o),transition_in(co.$$.fragment,go),uo=!0)},o(go){transition_out(ho),transition_out(_o),transition_out(co.$$.fragment,go),uo=!1},d(go){go&&(detach(ue),detach(lo)),ho&&ho.d(),_o&&_o.d(),to[36](null),destroy_component(co,go),fo=!1,po()}}}function instance$bG(to,ue,eo){let no,ro,{id:oo=void 0}=ue,{disabled:io=!1}=ue,{fieldText:ao=""}=ue,{fieldIcon:so=""}=ue,{fieldColour:lo=""}=ue,{isPlaceholder:co=!1}=ue,{placeholderOption:uo=void 0}=ue,{options:fo=[]}=ue,{isOptionSelected:po=Ea=>Ea}=ue,{isOptionEnabled:ho=(Ea,Sa)=>Ea}=ue,{onSelectOption:_o=()=>{}}=ue,{getOptionLabel:go=(Ea,Sa)=>`${Ea}`}=ue,{getOptionValue:bo=(Ea,Sa)=>Ea}=ue,{getOptionIcon:vo=(Ea,Sa)=>(Ea==null?void 0:Ea.icon)??void 0}=ue,{getOptionColour:yo=(Ea,Sa)=>(Ea==null?void 0:Ea.colour)??void 0}=ue,{getOptionSubtitle:$o=(Ea,Sa)=>(Ea==null?void 0:Ea.subtitle)??void 0}=ue,{useOptionIconImage:ko=!1}=ue,{open:So=!1}=ue,{readonly:Ao=!1}=ue,{quiet:Mo=!1}=ue,{autoWidth:Eo=!1}=ue,{autocomplete:To=!1}=ue,{sort:Io=!1}=ue,{searchTerm:No=null}=ue,{customPopoverHeight:xo=void 0}=ue,{align:zo=PopoverAlignment.Left}=ue,{footer:Po=void 0}=ue,{customAnchor:Bo=void 0}=ue,{loading:qo=!1}=ue,{onOptionMouseenter:Fo=()=>{}}=ue,{onOptionMouseleave:Wo=()=>{}}=ue;const Go=createEventDispatcher();let Yo,Xo;const Qo=Ea=>{Ea.preventDefault(),Ea.stopPropagation(),Go("click"),!Ao&&(eo(0,No=null),eo(1,So=!So))},Jo=(Ea,Sa,Ra)=>!(Ea!=null&&Ea.length)||!Array.isArray(Ea)?[]:Ra?Ea.sort(($a,ds)=>{const Ma=Sa($a),ga=Sa(ds);return Ma>ga?1:-1}):Ea,na=(Ea,Sa,Ra)=>{if(To&&Sa){const $a=Sa.toLowerCase();return Ea.filter(ds=>`${Ra(ds)}`.toLowerCase().includes($a))}return Ea},Ko=Ea=>{Ea.target.scrollHeight-Ea.target.clientHeight-Ea.target.scrollTop<100&&Go("loadMore")};onDestroy(()=>{Xo==null||Xo.removeEventListener("scroll",null)});function ia(Ea){binding_callbacks[Ea?"unshift":"push"](()=>{Yo=Ea,eo(29,Yo)})}const ea=Ea=>eo(0,No=Ea.detail),sa=()=>_o(null),Aa=(Ea,Sa)=>_o(bo(Ea,Sa)),pa=(Ea,Sa)=>Fo(Sa,Ea),va=(Ea,Sa)=>Wo(Sa,Ea);function ha(Ea){binding_callbacks[Ea?"unshift":"push"](()=>{Xo=Ea,eo(28,Xo)})}const La=()=>{eo(1,So=!1)},Ba=()=>eo(1,So=!1);return to.$$set=Ea=>{"id"in Ea&&eo(2,oo=Ea.id),"disabled"in Ea&&eo(3,io=Ea.disabled),"fieldText"in Ea&&eo(4,ao=Ea.fieldText),"fieldIcon"in Ea&&eo(5,so=Ea.fieldIcon),"fieldColour"in Ea&&eo(6,lo=Ea.fieldColour),"isPlaceholder"in Ea&&eo(7,co=Ea.isPlaceholder),"placeholderOption"in Ea&&eo(8,uo=Ea.placeholderOption),"options"in Ea&&eo(32,fo=Ea.options),"isOptionSelected"in Ea&&eo(9,po=Ea.isOptionSelected),"isOptionEnabled"in Ea&&eo(10,ho=Ea.isOptionEnabled),"onSelectOption"in Ea&&eo(11,_o=Ea.onSelectOption),"getOptionLabel"in Ea&&eo(12,go=Ea.getOptionLabel),"getOptionValue"in Ea&&eo(13,bo=Ea.getOptionValue),"getOptionIcon"in Ea&&eo(14,vo=Ea.getOptionIcon),"getOptionColour"in Ea&&eo(15,yo=Ea.getOptionColour),"getOptionSubtitle"in Ea&&eo(16,$o=Ea.getOptionSubtitle),"useOptionIconImage"in Ea&&eo(17,ko=Ea.useOptionIconImage),"open"in Ea&&eo(1,So=Ea.open),"readonly"in Ea&&eo(33,Ao=Ea.readonly),"quiet"in Ea&&eo(18,Mo=Ea.quiet),"autoWidth"in Ea&&eo(19,Eo=Ea.autoWidth),"autocomplete"in Ea&&eo(20,To=Ea.autocomplete),"sort"in Ea&&eo(34,Io=Ea.sort),"searchTerm"in Ea&&eo(0,No=Ea.searchTerm),"customPopoverHeight"in Ea&&eo(21,xo=Ea.customPopoverHeight),"align"in Ea&&eo(22,zo=Ea.align),"footer"in Ea&&eo(23,Po=Ea.footer),"customAnchor"in Ea&&eo(24,Bo=Ea.customAnchor),"loading"in Ea&&eo(25,qo=Ea.loading),"onOptionMouseenter"in Ea&&eo(26,Fo=Ea.onOptionMouseenter),"onOptionMouseleave"in Ea&&eo(27,Wo=Ea.onOptionMouseleave)},to.$$.update=()=>{to.$$.dirty[0]&4096|to.$$.dirty[1]&10&&eo(35,no=Jo(fo,go,Io)),to.$$.dirty[0]&4097|to.$$.dirty[1]&16&&eo(30,ro=na(no,No,go)),to.$$.dirty[0]&268435456&&(Xo==null||Xo.addEventListener("scroll",Ko))},[No,So,oo,io,ao,so,lo,co,uo,po,ho,_o,go,bo,vo,yo,$o,ko,Mo,Eo,To,xo,zo,Po,Bo,qo,Fo,Wo,Xo,Yo,ro,Qo,fo,Ao,Io,no,ia,ea,sa,Aa,pa,va,ha,La,Ba]}class Picker extends SvelteComponent{constructor(ue){super(),init$3(this,ue,instance$bG,create_fragment$bJ,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$bI(to){let ue,eo,no,ro;function oo(so){to[32](so)}function io(so){to[33](so)}let ao={quiet:to[15],id:to[3],disabled:to[5],readonly:to[14],fieldText:to[27],fieldIcon:to[26],fieldColour:to[25],options:to[6],autoWidth:to[16],align:to[19],footer:to[20],getOptionLabel:to[7],getOptionValue:to[8],getOptionIcon:to[9],getOptionColour:to[10],getOptionSubtitle:to[11],useOptionIconImage:to[12],isOptionEnabled:to[13],autocomplete:to[17],sort:to[18],onOptionMouseenter:to[22],onOptionMouseleave:to[23],isPlaceholder:to[2]==null||to[2]==="",placeholderOption:to[4]===!1?void 0:to[4]||"Choose an option",isOptionSelected:to[31],onSelectOption:to[29],loading:to[21],customPopoverHeight:to[24]};return to[0]!==void 0&&(ao.open=to[0]),to[1]!==void 0&&(ao.searchTerm=to[1]),ue=new Picker({props:ao}),binding_callbacks.push(()=>bind$2(ue,"open",oo)),binding_callbacks.push(()=>bind$2(ue,"searchTerm",io)),ue.$on("click",to[34]),ue.$on("loadMore",to[35]),{c(){create_component(ue.$$.fragment)},m(so,lo){mount_component(ue,so,lo),ro=!0},p(so,lo){const co={};lo[0]&32768&&(co.quiet=so[15]),lo[0]&8&&(co.id=so[3]),lo[0]&32&&(co.disabled=so[5]),lo[0]&16384&&(co.readonly=so[14]),lo[0]&134217728&&(co.fieldText=so[27]),lo[0]&67108864&&(co.fieldIcon=so[26]),lo[0]&33554432&&(co.fieldColour=so[25]),lo[0]&64&&(co.options=so[6]),lo[0]&65536&&(co.autoWidth=so[16]),lo[0]&524288&&(co.align=so[19]),lo[0]&1048576&&(co.footer=so[20]),lo[0]&128&&(co.getOptionLabel=so[7]),lo[0]&256&&(co.getOptionValue=so[8]),lo[0]&512&&(co.getOptionIcon=so[9]),lo[0]&1024&&(co.getOptionColour=so[10]),lo[0]&2048&&(co.getOptionSubtitle=so[11]),lo[0]&4096&&(co.useOptionIconImage=so[12]),lo[0]&8192&&(co.isOptionEnabled=so[13]),lo[0]&131072&&(co.autocomplete=so[17]),lo[0]&262144&&(co.sort=so[18]),lo[0]&4194304&&(co.onOptionMouseenter=so[22]),lo[0]&8388608&&(co.onOptionMouseleave=so[23]),lo[0]&4&&(co.isPlaceholder=so[2]==null||so[2]===""),lo[0]&16&&(co.placeholderOption=so[4]===!1?void 0:so[4]||"Choose an option"),lo[0]&4&&(co.isOptionSelected=so[31]),lo[0]&2097152&&(co.loading=so[21]),lo[0]&16777216&&(co.customPopoverHeight=so[24]),!eo&&lo[0]&1&&(eo=!0,co.open=so[0],add_flush_callback(()=>eo=!1)),!no&&lo[0]&2&&(no=!0,co.searchTerm=so[1],add_flush_callback(()=>no=!1)),ue.$set(co)},i(so){ro||(transition_in(ue.$$.fragment,so),ro=!0)},o(so){transition_out(ue.$$.fragment,so),ro=!1},d(so){destroy_component(ue,so)}}}function instance$bF(to,ue,eo){let no,ro,oo,{value:io=null}=ue,{id:ao=void 0}=ue,{placeholder:so="Choose an option"}=ue,{disabled:lo=!1}=ue,{options:co=[]}=ue,{getOptionLabel:uo=(Ko,ia)=>`${Ko}`}=ue,{getOptionValue:fo=(Ko,ia)=>Ko}=ue,{getOptionIcon:po=(Ko,ia)=>(Ko==null?void 0:Ko.icon)??void 0}=ue,{getOptionColour:ho=(Ko,ia)=>(Ko==null?void 0:Ko.colour)??void 0}=ue,{getOptionSubtitle:_o=(Ko,ia)=>(Ko==null?void 0:Ko.subtitle)??void 0}=ue,{compare:go=(Ko,ia)=>Ko===ia}=ue,{useOptionIconImage:bo=!1}=ue,{isOptionEnabled:vo=(Ko,ia)=>Ko}=ue,{readonly:yo=!1}=ue,{quiet:$o=!1}=ue,{autoWidth:ko=!1}=ue,{autocomplete:So=!1}=ue,{sort:Ao=!1}=ue,{align:Mo=PopoverAlignment.Left}=ue,{footer:Eo=void 0}=ue,{open:To=!1}=ue,{searchTerm:Io=void 0}=ue,{loading:No=void 0}=ue,{onOptionMouseenter:xo=()=>{}}=ue,{onOptionMouseleave:zo=()=>{}}=ue,{customPopoverHeight:Po=void 0}=ue;const Bo=createEventDispatcher();function qo(Ko,ia){return typeof go=="function"?go(Ko,ia):Ko===ia}const Fo=(Ko,ia,ea)=>{if(!(ea!=null&&ea.length))return"";const sa=ea.findIndex((Aa,pa)=>qo(fo(Aa,pa),ia));return sa!==-1?Ko(ea[sa],sa):null},Wo=(Ko,ia,ea)=>Ko==null||Ko===""?ea===!1?"":ea||"Choose an option":Fo(uo,Ko,ia)||"Choose an option",Go=Ko=>{Bo("change",Ko),eo(0,To=!1)},Yo=Ko=>qo(Ko,io);function Xo(Ko){To=Ko,eo(0,To)}function Qo(Ko){Io=Ko,eo(1,Io)}function Jo(Ko){bubble.call(this,to,Ko)}function na(Ko){bubble.call(this,to,Ko)}return to.$$set=Ko=>{"value"in Ko&&eo(2,io=Ko.value),"id"in Ko&&eo(3,ao=Ko.id),"placeholder"in Ko&&eo(4,so=Ko.placeholder),"disabled"in Ko&&eo(5,lo=Ko.disabled),"options"in Ko&&eo(6,co=Ko.options),"getOptionLabel"in Ko&&eo(7,uo=Ko.getOptionLabel),"getOptionValue"in Ko&&eo(8,fo=Ko.getOptionValue),"getOptionIcon"in Ko&&eo(9,po=Ko.getOptionIcon),"getOptionColour"in Ko&&eo(10,ho=Ko.getOptionColour),"getOptionSubtitle"in Ko&&eo(11,_o=Ko.getOptionSubtitle),"compare"in Ko&&eo(30,go=Ko.compare),"useOptionIconImage"in Ko&&eo(12,bo=Ko.useOptionIconImage),"isOptionEnabled"in Ko&&eo(13,vo=Ko.isOptionEnabled),"readonly"in Ko&&eo(14,yo=Ko.readonly),"quiet"in Ko&&eo(15,$o=Ko.quiet),"autoWidth"in Ko&&eo(16,ko=Ko.autoWidth),"autocomplete"in Ko&&eo(17,So=Ko.autocomplete),"sort"in Ko&&eo(18,Ao=Ko.sort),"align"in Ko&&eo(19,Mo=Ko.align),"footer"in Ko&&eo(20,Eo=Ko.footer),"open"in Ko&&eo(0,To=Ko.open),"searchTerm"in Ko&&eo(1,Io=Ko.searchTerm),"loading"in Ko&&eo(21,No=Ko.loading),"onOptionMouseenter"in Ko&&eo(22,xo=Ko.onOptionMouseenter),"onOptionMouseleave"in Ko&&eo(23,zo=Ko.onOptionMouseleave),"customPopoverHeight"in Ko&&eo(24,Po=Ko.customPopoverHeight)},to.$$.update=()=>{to.$$.dirty[0]&84&&eo(27,no=Wo(io,co,so)),to.$$.dirty[0]&580&&eo(26,ro=Fo(po,io,co)),to.$$.dirty[0]&1092&&eo(25,oo=Fo(ho,io,co))},[To,Io,io,ao,so,lo,co,uo,fo,po,ho,_o,bo,vo,yo,$o,ko,So,Ao,Mo,Eo,No,xo,zo,Po,oo,ro,no,qo,Go,go,Yo,Xo,Qo,Jo,na]}class Select extends SvelteComponent{constructor(ue){super(),init$3(this,ue,instance$bF,create_fragment$bI,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$6Z(to){let ue,eo;return ue=new Select({props:{quiet:to[15],disabled:to[2],readonly:to[3],value:to[0],options:to[7],placeholder:to[6],autoWidth:to[16],sort:to[17],align:to[21],footer:to[22],getOptionLabel:to[8],getOptionValue:to[9],getOptionIcon:to[11],getOptionColour:to[12],getOptionSubtitle:to[10],useOptionIconImage:to[13],isOptionEnabled:to[14],autocomplete:to[19],customPopoverHeight:to[20],compare:to[24],onOptionMouseenter:to[25],onOptionMouseleave:to[26]}}),ue.$on("change",to[27]),ue.$on("click",to[28]),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},p(no,ro){const oo={};ro[0]&32768&&(oo.quiet=no[15]),ro[0]&4&&(oo.disabled=no[2]),ro[0]&8&&(oo.readonly=no[3]),ro[0]&1&&(oo.value=no[0]),ro[0]&128&&(oo.options=no[7]),ro[0]&64&&(oo.placeholder=no[6]),ro[0]&65536&&(oo.autoWidth=no[16]),ro[0]&131072&&(oo.sort=no[17]),ro[0]&2097152&&(oo.align=no[21]),ro[0]&4194304&&(oo.footer=no[22]),ro[0]&256&&(oo.getOptionLabel=no[8]),ro[0]&512&&(oo.getOptionValue=no[9]),ro[0]&2048&&(oo.getOptionIcon=no[11]),ro[0]&4096&&(oo.getOptionColour=no[12]),ro[0]&1024&&(oo.getOptionSubtitle=no[10]),ro[0]&8192&&(oo.useOptionIconImage=no[13]),ro[0]&16384&&(oo.isOptionEnabled=no[14]),ro[0]&524288&&(oo.autocomplete=no[19]),ro[0]&1048576&&(oo.customPopoverHeight=no[20]),ro[0]&16777216&&(oo.compare=no[24]),ro[0]&33554432&&(oo.onOptionMouseenter=no[25]),ro[0]&67108864&&(oo.onOptionMouseleave=no[26]),ue.$set(oo)},i(no){eo||(transition_in(ue.$$.fragment,no),eo=!0)},o(no){transition_out(ue.$$.fragment,no),eo=!1},d(no){destroy_component(ue,no)}}}function create_fragment$bH(to){let ue,eo;return ue=new Field({props:{helpText:to[23],label:to[1],labelPosition:to[4],error:to[5],tooltip:to[18],$$slots:{default:[create_default_slot$6Z]},$$scope:{ctx:to}}}),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},p(no,ro){const oo={};ro[0]&8388608&&(oo.helpText=no[23]),ro[0]&2&&(oo.label=no[1]),ro[0]&16&&(oo.labelPosition=no[4]),ro[0]&32&&(oo.error=no[5]),ro[0]&262144&&(oo.tooltip=no[18]),ro[0]&125566925|ro[1]&1&&(oo.$$scope={dirty:ro,ctx:no}),ue.$set(oo)},i(no){eo||(transition_in(ue.$$.fragment,no),eo=!0)},o(no){transition_out(ue.$$.fragment,no),eo=!1},d(no){destroy_component(ue,no)}}}function instance$bE(to,ue,eo){let{value:no=void 0}=ue,{label:ro=void 0}=ue,{disabled:oo=!1}=ue,{readonly:io=!1}=ue,{labelPosition:ao="above"}=ue,{error:so=void 0}=ue,{placeholder:lo="Choose an option"}=ue,{options:co=[]}=ue,{getOptionLabel:uo=(Fo,Wo)=>Bo(Fo,"label")}=ue,{getOptionValue:fo=(Fo,Wo)=>Bo(Fo,"value")}=ue,{getOptionSubtitle:po=(Fo,Wo)=>Fo==null?void 0:Fo.subtitle}=ue,{getOptionIcon:ho=(Fo,Wo)=>Fo==null?void 0:Fo.icon}=ue,{getOptionColour:_o=(Fo,Wo)=>Fo==null?void 0:Fo.colour}=ue,{useOptionIconImage:go=!1}=ue,{isOptionEnabled:bo=void 0}=ue,{quiet:vo=!1}=ue,{autoWidth:yo=!1}=ue,{sort:$o=!1}=ue,{tooltip:ko=void 0}=ue,{autocomplete:So=!1}=ue,{customPopoverHeight:Ao=void 0}=ue,{align:Mo=PopoverAlignment.Left}=ue,{footer:Eo=void 0}=ue,{helpText:To=void 0}=ue,{compare:Io=void 0}=ue,{onOptionMouseenter:No=()=>{}}=ue,{onOptionMouseleave:xo=()=>{}}=ue;const zo=createEventDispatcher(),Po=Fo=>{eo(0,no=Fo.detail),zo("change",Fo.detail)},Bo=(Fo,Wo)=>Fo&&typeof Fo=="object"?Fo[Wo]:Fo;function qo(Fo){bubble.call(this,to,Fo)}return to.$$set=Fo=>{"value"in Fo&&eo(0,no=Fo.value),"label"in Fo&&eo(1,ro=Fo.label),"disabled"in Fo&&eo(2,oo=Fo.disabled),"readonly"in Fo&&eo(3,io=Fo.readonly),"labelPosition"in Fo&&eo(4,ao=Fo.labelPosition),"error"in Fo&&eo(5,so=Fo.error),"placeholder"in Fo&&eo(6,lo=Fo.placeholder),"options"in Fo&&eo(7,co=Fo.options),"getOptionLabel"in Fo&&eo(8,uo=Fo.getOptionLabel),"getOptionValue"in Fo&&eo(9,fo=Fo.getOptionValue),"getOptionSubtitle"in Fo&&eo(10,po=Fo.getOptionSubtitle),"getOptionIcon"in Fo&&eo(11,ho=Fo.getOptionIcon),"getOptionColour"in Fo&&eo(12,_o=Fo.getOptionColour),"useOptionIconImage"in Fo&&eo(13,go=Fo.useOptionIconImage),"isOptionEnabled"in Fo&&eo(14,bo=Fo.isOptionEnabled),"quiet"in Fo&&eo(15,vo=Fo.quiet),"autoWidth"in Fo&&eo(16,yo=Fo.autoWidth),"sort"in Fo&&eo(17,$o=Fo.sort),"tooltip"in Fo&&eo(18,ko=Fo.tooltip),"autocomplete"in Fo&&eo(19,So=Fo.autocomplete),"customPopoverHeight"in Fo&&eo(20,Ao=Fo.customPopoverHeight),"align"in Fo&&eo(21,Mo=Fo.align),"footer"in Fo&&eo(22,Eo=Fo.footer),"helpText"in Fo&&eo(23,To=Fo.helpText),"compare"in Fo&&eo(24,Io=Fo.compare),"onOptionMouseenter"in Fo&&eo(25,No=Fo.onOptionMouseenter),"onOptionMouseleave"in Fo&&eo(26,xo=Fo.onOptionMouseleave)},[no,ro,oo,io,ao,so,lo,co,uo,fo,po,ho,_o,go,bo,vo,yo,$o,ko,So,Ao,Mo,Eo,To,Io,No,xo,Po,qo]}let Select_1$1=class extends SvelteComponent{constructor(ue){super(),init$3(this,ue,instance$bE,create_fragment$bH,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$r="",Combobox_svelte_svelte_type_style_lang="";function get_each_context$2g(to,ue,eo){const no=to.slice();return no[22]=ue[eo],no}function create_if_block$5w(to){let ue,eo=ensure_array_like(to[5]),no=[];for(let ro=0;ro<eo.length;ro+=1)no[ro]=create_each_block$2g(get_each_context$2g(to,eo,ro));return{c(){for(let ro=0;ro<no.length;ro+=1)no[ro].c();ue=empty$2()},m(ro,oo){for(let io=0;io<no.length;io+=1)no[io]&&no[io].m(ro,oo);insert$2(ro,ue,oo)},p(ro,oo){if(oo&8417){eo=ensure_array_like(ro[5]);let io;for(io=0;io<eo.length;io+=1){const ao=get_each_context$2g(ro,eo,io);no[io]?no[io].p(ao,oo):(no[io]=create_each_block$2g(ao),no[io].c(),no[io].m(ue.parentNode,ue))}for(;io<no.length;io+=1)no[io].d(1);no.length=eo.length}},d(ro){ro&&detach(ue),destroy_each(no,ro)}}}function create_each_block$2g(to){let ue,eo,no=to[6](to[22])+"",ro,oo,io,ao,so,lo,co;function uo(){return to[18](to[22])}return{c(){ue=element("li"),eo=element("span"),ro=text(no),oo=space$1(),io=svg_element("svg"),ao=svg_element("use"),so=space$1(),attr(eo,"class","spectrum-Menu-itemLabel svelte-otlbol"),xlink_attr(ao,"xlink:href","#spectrum-css-icon-Checkmark100"),attr(io,"class","spectrum-Icon spectrum-UIIcon-Checkmark100 spectrum-Menu-checkmark spectrum-Menu-itemIcon"),attr(io,"focusable","false"),attr(io,"aria-hidden","true"),attr(ue,"class","spectrum-Menu-item"),attr(ue,"role","option"),attr(ue,"aria-selected","true"),attr(ue,"tabindex","0"),toggle_class(ue,"is-selected",to[7](to[22])===to[0])},m(fo,po){insert$2(fo,ue,po),append$2(ue,eo),append$2(eo,ro),append$2(ue,oo),append$2(ue,io),append$2(io,ao),append$2(ue,so),lo||(co=listen(ue,"click",uo),lo=!0)},p(fo,po){to=fo,po&96&&no!==(no=to[6](to[22])+"")&&set_data(ro,no),po&161&&toggle_class(ue,"is-selected",to[7](to[22])===to[0])},d(fo){fo&&detach(ue),lo=!1,co()}}}function create_default_slot$6Y(to){let ue,eo,no=to[5]&&Array.isArray(to[5]),ro,oo,io,ao=no&&create_if_block$5w(to);return{c(){ue=element("div"),eo=element("ul"),ao&&ao.c(),attr(eo,"class","spectrum-Menu"),attr(eo,"role","listbox"),attr(ue,"class","popover-content svelte-otlbol")},m(so,lo){insert$2(so,ue,lo),append$2(ue,eo),ao&&ao.m(eo,null),oo||(io=action_destroyer(ro=clickOutside.call(null,ue,to[19])),oo=!0)},p(so,lo){lo&32&&(no=so[5]&&Array.isArray(so[5])),no?ao?ao.p(so,lo):(ao=create_if_block$5w(so),ao.c(),ao.m(eo,null)):ao&&(ao.d(1),ao=null),ro&&is_function(ro.update)&&lo&256&&ro.update.call(null,so[19])},d(so){so&&detach(ue),ao&&ao.d(),oo=!1,io()}}}function create_fragment$bG(to){let ue,eo,no,ro,oo,io,ao,so,lo,co,uo,fo,po,ho;return uo=new Popover({props:{anchor:to[10],open:to[8],align:PopoverAlignment.Left,useAnchorWidth:!0,$$slots:{default:[create_default_slot$6Y]},$$scope:{ctx:to}}}),uo.$on("close",to[20]),{c(){ue=element("div"),eo=element("div"),no=element("input"),io=space$1(),ao=element("button"),so=svg_element("svg"),lo=svg_element("use"),co=space$1(),create_component(uo.$$.fragment),attr(no,"id",to[1]),attr(no,"type","text"),no.value=ro=to[0]||"",attr(no,"placeholder",oo=to[2]||""),no.disabled=to[3],no.readOnly=to[4],attr(no,"class","spectrum-Textfield-input spectrum-InputGroup-input svelte-otlbol"),attr(eo,"class","spectrum-Textfield spectrum-InputGroup-textfield svelte-otlbol"),toggle_class(eo,"is-disabled",to[3]),toggle_class(eo,"is-focused",to[8]||to[9]),xlink_attr(lo,"xlink:href","#spectrum-css-icon-Chevron100"),attr(so,"class","spectrum-Icon spectrum-UIIcon-ChevronDown100 spectrum-Picker-menuIcon spectrum-InputGroup-icon"),attr(so,"focusable","false"),attr(so,"aria-hidden","true"),attr(ao,"class","spectrum-Picker spectrum-Picker--sizeM spectrum-InputGroup-button"),attr(ao,"tabindex","-1"),attr(ao,"aria-haspopup","true"),ao.disabled=to[3],attr(ue,"class","spectrum-InputGroup svelte-otlbol"),toggle_class(ue,"is-focused",to[8]||to[9]),toggle_class(ue,"is-disabled",to[3])},m(_o,go){insert$2(_o,ue,go),append$2(ue,eo),append$2(eo,no),append$2(ue,io),append$2(ue,ao),append$2(ao,so),append$2(so,lo),to[17](ue),insert$2(_o,co,go),mount_component(uo,_o,go),fo=!0,po||(ho=[listen(no,"focus",to[14]),listen(no,"blur",to[15]),listen(no,"change",to[12]),listen(ao,"click",to[16])],po=!0)},p(_o,[go]){(!fo||go&2)&&attr(no,"id",_o[1]),(!fo||go&1&&ro!==(ro=_o[0]||"")&&no.value!==ro)&&(no.value=ro),(!fo||go&4&&oo!==(oo=_o[2]||""))&&attr(no,"placeholder",oo),(!fo||go&8)&&(no.disabled=_o[3]),(!fo||go&16)&&(no.readOnly=_o[4]),(!fo||go&8)&&toggle_class(eo,"is-disabled",_o[3]),(!fo||go&768)&&toggle_class(eo,"is-focused",_o[8]||_o[9]),(!fo||go&8)&&(ao.disabled=_o[3]),(!fo||go&768)&&toggle_class(ue,"is-focused",_o[8]||_o[9]),(!fo||go&8)&&toggle_class(ue,"is-disabled",_o[3]);const bo={};go&1024&&(bo.anchor=_o[10]),go&256&&(bo.open=_o[8]),go&33554913&&(bo.$$scope={dirty:go,ctx:_o}),uo.$set(bo)},i(_o){fo||(transition_in(uo.$$.fragment,_o),fo=!0)},o(_o){transition_out(uo.$$.fragment,_o),fo=!1},d(_o){_o&&(detach(ue),detach(co)),to[17](null),destroy_component(uo,_o),po=!1,run_all(ho)}}}function instance$bD(to,ue,eo){let{value:no=void 0}=ue,{id:ro=void 0}=ue,{placeholder:oo="Choose an option or type"}=ue,{disabled:io=!1}=ue,{readonly:ao=!1}=ue,{options:so=[]}=ue,{getOptionLabel:lo=Eo=>`${Eo}`}=ue,{getOptionValue:co=Eo=>`${Eo}`}=ue;const uo=createEventDispatcher();let fo=!1,po=!1,ho;const _o=Eo=>{uo("change",Eo),eo(8,fo=!1)},go=Eo=>{const To=Eo.currentTarget.value;uo("type",To),_o(To)},bo=Eo=>{uo("pick",Eo),_o(Eo)},vo=()=>eo(9,po=!0),yo=()=>{eo(9,po=!1),uo("blur")},$o=()=>eo(8,fo=!fo);function ko(Eo){binding_callbacks[Eo?"unshift":"push"](()=>{ho=Eo,eo(10,ho)})}const So=Eo=>bo(co(Eo)),Ao=()=>{eo(8,fo=!1)},Mo=()=>eo(8,fo=!1);return to.$$set=Eo=>{"value"in Eo&&eo(0,no=Eo.value),"id"in Eo&&eo(1,ro=Eo.id),"placeholder"in Eo&&eo(2,oo=Eo.placeholder),"disabled"in Eo&&eo(3,io=Eo.disabled),"readonly"in Eo&&eo(4,ao=Eo.readonly),"options"in Eo&&eo(5,so=Eo.options),"getOptionLabel"in Eo&&eo(6,lo=Eo.getOptionLabel),"getOptionValue"in Eo&&eo(7,co=Eo.getOptionValue)},[no,ro,oo,io,ao,so,lo,co,fo,po,ho,uo,go,bo,vo,yo,$o,ko,So,Ao,Mo]}class Combobox extends SvelteComponent{constructor(ue){super(),init$3(this,ue,instance$bD,create_fragment$bG,safe_not_equal,{value:0,id:1,placeholder:2,disabled:3,readonly:4,options:5,getOptionLabel:6,getOptionValue:7})}}function create_default_slot$6X(to){let ue,eo;return ue=new Combobox({props:{error:to[5],disabled:to[2],value:to[0],options:to[7],placeholder:to[6],readonly:to[3],getOptionLabel:to[9],getOptionValue:to[10]}}),ue.$on("change",to[11]),ue.$on("pick",to[12]),ue.$on("type",to[13]),ue.$on("blur",to[14]),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},p(no,ro){const oo={};ro&32&&(oo.error=no[5]),ro&4&&(oo.disabled=no[2]),ro&1&&(oo.value=no[0]),ro&128&&(oo.options=no[7]),ro&64&&(oo.placeholder=no[6]),ro&8&&(oo.readonly=no[3]),ro&512&&(oo.getOptionLabel=no[9]),ro&1024&&(oo.getOptionValue=no[10]),ue.$set(oo)},i(no){eo||(transition_in(ue.$$.fragment,no),eo=!0)},o(no){transition_out(ue.$$.fragment,no),eo=!1},d(no){destroy_component(ue,no)}}}function create_fragment$bF(to){let ue,eo;return ue=new Field({props:{helpText:to[8],label:to[1],labelPosition:to[4],error:to[5],$$slots:{default:[create_default_slot$6X]},$$scope:{ctx:to}}}),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},p(no,[ro]){const oo={};ro&256&&(oo.helpText=no[8]),ro&2&&(oo.label=no[1]),ro&16&&(oo.labelPosition=no[4]),ro&32&&(oo.error=no[5]),ro&132845&&(oo.$$scope={dirty:ro,ctx:no}),ue.$set(oo)},i(no){eo||(transition_in(ue.$$.fragment,no),eo=!0)},o(no){transition_out(ue.$$.fragment,no),eo=!1},d(no){destroy_component(ue,no)}}}function instance$bC(to,ue,eo){let{value:no=null}=ue,{label:ro=void 0}=ue,{disabled:oo=!1}=ue,{readonly:io=!1}=ue,{labelPosition:ao="above"}=ue,{error:so=null}=ue,{placeholder:lo="Choose an option or type"}=ue,{options:co=[]}=ue,{helpText:uo=null}=ue,{getOptionLabel:fo=$o=>go($o,"label")}=ue,{getOptionValue:po=$o=>go($o,"value")}=ue;const ho=createEventDispatcher(),_o=$o=>{eo(0,no=$o.detail),ho("change",$o.detail)},go=($o,ko)=>$o&&typeof $o=="object"?$o[ko]:$o;function bo($o){bubble.call(this,to,$o)}function vo($o){bubble.call(this,to,$o)}function yo($o){bubble.call(this,to,$o)}return to.$$set=$o=>{"value"in $o&&eo(0,no=$o.value),"label"in $o&&eo(1,ro=$o.label),"disabled"in $o&&eo(2,oo=$o.disabled),"readonly"in $o&&eo(3,io=$o.readonly),"labelPosition"in $o&&eo(4,ao=$o.labelPosition),"error"in $o&&eo(5,so=$o.error),"placeholder"in $o&&eo(6,lo=$o.placeholder),"options"in $o&&eo(7,co=$o.options),"helpText"in $o&&eo(8,uo=$o.helpText),"getOptionLabel"in $o&&eo(9,fo=$o.getOptionLabel),"getOptionValue"in $o&&eo(10,po=$o.getOptionValue)},[no,ro,oo,io,ao,so,lo,co,uo,fo,po,_o,bo,vo,yo]}class Combobox_1 extends SvelteComponent{constructor(ue){super(),init$3(this,ue,instance$bC,create_fragment$bF,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$q="",indexVars$p="",indexVars$o="";var AIOperationEnum=(to=>(to.SUMMARISE_TEXT="SUMMARISE_TEXT",to.CLEAN_DATA="CLEAN_DATA",to.TRANSLATE="TRANSLATE",to.CATEGORISE_TEXT="CATEGORISE_TEXT",to.SENTIMENT_ANALYSIS="SENTIMENT_ANALYSIS",to.PROMPT="PROMPT",to.SEARCH_WEB="SEARCH_WEB",to))(AIOperationEnum||{}),OperationFieldTypeEnum=(to=>(to.MULTI_COLUMN="columns",to.COLUMN="column",to.BINDABLE_TEXT="prompt",to))(OperationFieldTypeEnum||{}),Event$1=(to=>(to.USER_CREATED="user:created",to.USER_UPDATED="user:updated",to.USER_DELETED="user:deleted",to.USER_ONBOARDING_COMPLETE="user:onboarding:complete",to.USER_PERMISSION_ADMIN_ASSIGNED="user:admin:assigned",to.USER_PERMISSION_ADMIN_REMOVED="user:admin:removed",to.USER_PERMISSION_BUILDER_ASSIGNED="user:builder:assigned",to.USER_PERMISSION_BUILDER_REMOVED="user:builder:removed",to.USER_INVITED="user:invited",to.USER_INVITED_ACCEPTED="user:invite:accepted",to.USER_PASSWORD_FORCE_RESET="user:password:force:reset",to.USER_PASSWORD_UPDATED="user:password:updated",to.USER_PASSWORD_RESET_REQUESTED="user:password:reset:requested",to.USER_PASSWORD_RESET="user:password:reset",to.USER_DATA_COLLABORATION="user:data:collaboration",to.EMAIL_SMTP_CREATED="email:smtp:created",to.EMAIL_SMTP_UPDATED="email:smtp:updated",to.AI_CONFIG_CREATED="ai:config:created",to.AI_CONFIG_UPDATED="ai:config:updated",to.AUTH_SSO_CREATED="auth:sso:created",to.AUTH_SSO_UPDATED="auth:sso:updated",to.AUTH_SSO_ACTIVATED="auth:sso:activated",to.AUTH_SSO_DEACTIVATED="auth:sso:deactivated",to.AUTH_LOGIN="auth:login",to.AUTH_LOGOUT="auth:logout",to.ORG_NAME_UPDATED="org:info:name:updated",to.ORG_LOGO_UPDATED="org:info:logo:updated",to.ORG_PLATFORM_URL_UPDATED="org:platformurl:updated",to.INSTALLATION_VERSION_CHECKED="installation:version:checked",to.INSTALLATION_VERSION_UPGRADED="installation:version:upgraded",to.INSTALLATION_VERSION_DOWNGRADED="installation:version:downgraded",to.INSTALLATION_FIRST_STARTUP="installation:firstStartup",to.ANALYTICS_OPT_OUT="analytics:opt:out",to.ANALYTICS_OPT_IN="analytics:opt:in",to.APP_CREATED="app:created",to.APP_UPDATED="app:updated",to.APP_DELETED="app:deleted",to.APP_DUPLICATED="app:duplicated",to.APP_PUBLISHED="app:published",to.APP_UNPUBLISHED="app:unpublished",to.APP_TEMPLATE_IMPORTED="app:template:imported",to.APP_FILE_IMPORTED="app:file:imported",to.APP_VERSION_UPDATED="app:version:updated",to.APP_VERSION_REVERTED="app:version:reverted",to.APP_REVERTED="app:reverted",to.APP_EXPORTED="app:exported",to.ROLE_CREATED="role:created",to.ROLE_UPDATED="role:updated",to.ROLE_DELETED="role:deleted",to.ROLE_ASSIGNED="role:assigned",to.ROLE_UNASSIGNED="role:unassigned",to.SERVED_BUILDER="served:builder",to.SERVED_APP="served:app",to.SERVED_APP_PREVIEW="served:app:preview",to.DATASOURCE_CREATED="datasource:created",to.DATASOURCE_UPDATED="datasource:updated",to.DATASOURCE_DELETED="datasource:deleted",to.QUERY_CREATED="query:created",to.QUERY_UPDATED="query:updated",to.QUERY_DELETED="query:deleted",to.QUERY_IMPORT="query:import",to.QUERIES_RUN="queries:run",to.QUERY_PREVIEWED="query:previewed",to.TABLE_CREATED="table:created",to.TABLE_UPDATED="table:updated",to.TABLE_DELETED="table:deleted",to.TABLE_EXPORTED="table:exported",to.TABLE_IMPORTED="table:imported",to.TABLE_DATA_IMPORTED="table:data:imported",to.VIEW_CREATED="view:created",to.VIEW_UPDATED="view:updated",to.VIEW_DELETED="view:deleted",to.VIEW_EXPORTED="view:exported",to.VIEW_FILTER_CREATED="view:filter:created",to.VIEW_FILTER_UPDATED="view:filter:updated",to.VIEW_FILTER_DELETED="view:filter:deleted",to.VIEW_CALCULATION_CREATED="view:calculation:created",to.VIEW_CALCULATION_UPDATED="view:calculation:updated",to.VIEW_CALCULATION_DELETED="view:calculation:deleted",to.VIEW_JOIN_CREATED="view:join:created",to.ROWS_CREATED="rows:created",to.ROWS_IMPORTED="rows:imported",to.COMPONENT_CREATED="component:created",to.COMPONENT_DELETED="component:deleted",to.SCREEN_CREATED="screen:created",to.SCREEN_DELETED="screen:deleted",to.LAYOUT_CREATED="layout:created",to.LAYOUT_DELETED="layout:deleted",to.AUTOMATION_CREATED="automation:created",to.AUTOMATION_DELETED="automation:deleted",to.AUTOMATION_TESTED="automation:tested",to.AUTOMATIONS_RUN="automations:run",to.AUTOMATION_STEP_CREATED="automation:step:created",to.AUTOMATION_STEP_DELETED="automation:step:deleted",to.AUTOMATION_TRIGGER_UPDATED="automation:trigger:updated",to.LICENSE_PLAN_CHANGED="license:plan:changed",to.LICENSE_ACTIVATED="license:activated",to.LICENSE_PAYMENT_FAILED="license:payment:failed",to.LICENSE_PAYMENT_RECOVERED="license:payment:recovered",to.LICENSE_CHECKOUT_OPENED="license:checkout:opened",to.LICENSE_CHECKOUT_SUCCESS="license:checkout:success",to.LICENSE_PORTAL_OPENED="license:portal:opened",to.ACCOUNT_CREATED="account:created",to.ACCOUNT_DELETED="account:deleted",to.ACCOUNT_VERIFIED="account:verified",to.APP_BACKFILL_SUCCEEDED="app:backfill:succeeded",to.APP_BACKFILL_FAILED="app:backfill:failed",to.TENANT_BACKFILL_SUCCEEDED="tenant:backfill:succeeded",to.TENANT_BACKFILL_FAILED="tenant:backfill:failed",to.INSTALLATION_BACKFILL_SUCCEEDED="installation:backfill:succeeded",to.INSTALLATION_BACKFILL_FAILED="installation:backfill:failed",to.USER_GROUP_CREATED="user_group:created",to.USER_GROUP_UPDATED="user_group:updated",to.USER_GROUP_DELETED="user_group:deleted",to.USER_GROUP_USERS_ADDED="user_group:user_added",to.USER_GROUP_USERS_REMOVED="user_group:users_deleted",to.USER_GROUP_PERMISSIONS_EDITED="user_group:permissions_edited",to.USER_GROUP_ONBOARDING="user_group:onboarding_added",to.PLUGIN_INIT="plugin:init",to.PLUGIN_IMPORTED="plugin:imported",to.PLUGIN_DELETED="plugin:deleted",to.APP_BACKUP_RESTORED="app:backup:restored",to.APP_BACKUP_TRIGGERED="app:backup:triggered",to.ENVIRONMENT_VARIABLE_CREATED="environment_variable:created",to.ENVIRONMENT_VARIABLE_DELETED="environment_variable:deleted",to.ENVIRONMENT_VARIABLE_UPGRADE_PANEL_OPENED="environment_variable:upgrade_panel_opened",to.AUDIT_LOGS_FILTERED="audit_log:filtered",to.AUDIT_LOGS_DOWNLOADED="audit_log:downloaded",to.ROW_ACTION_CREATED="row_action:created",to))(Event$1||{}),PlanType$1=(to=>(to.FREE="free",to.PRO="pro",to.TEAM="team",to.PREMIUM="premium",to.PREMIUM_PLUS="premium_plus",to.PREMIUM_PLUS_TRIAL="premium_plus_trial",to.BUSINESS="business",to.ENTERPRISE_BASIC="enterprise_basic",to.ENTERPRISE_BASIC_TRIAL="enterprise_basic_trial",to.ENTERPRISE="enterprise",to))(PlanType$1||{}),PlanModel$1=(to=>(to.PER_USER="perUser",to.PER_CREATOR_PER_USER="per_creator_per_user",to))(PlanModel$1||{}),StaticQuotaName=(to=>(to.ROWS="rows",to.APPS="apps",to.USERS="users",to.CREATORS="creators",to.USER_GROUPS="userGroups",to.PLUGINS="plugins",to.AI_CUSTOM_CONFIGS="aiCustomConfigs",to))(StaticQuotaName||{}),MonthlyQuotaName=(to=>(to.QUERIES="queries",to.AUTOMATIONS="automations",to.BUDIBASE_AI_CREDITS="budibaseAICredits",to))(MonthlyQuotaName||{}),Feature=(to=>(to.USER_GROUPS="userGroups",to.APP_BACKUPS="appBackups",to.ENVIRONMENT_VARIABLES="environmentVariables",to.AUDIT_LOGS="auditLogs",to.ENFORCEABLE_SSO="enforceableSSO",to.BRANDING="branding",to.SCIM="scim",to.SYNC_AUTOMATIONS="syncAutomations",to.TRIGGER_AUTOMATION_RUN="triggerAutomationRun",to.APP_BUILDERS="appBuilders",to.OFFLINE="offline",to.EXPANDED_PUBLIC_API="expandedPublicApi",to.VIEW_PERMISSIONS="viewPermissions",to.VIEW_READONLY_COLUMNS="viewReadonlyColumns",to.BUDIBASE_AI="budibaseAI",to.AI_CUSTOM_CONFIGS="aiCustomConfigs",to))(Feature||{}),SourceName=(to=>(to.POSTGRES="POSTGRES",to.DYNAMODB="DYNAMODB",to.MONGODB="MONGODB",to.ELASTICSEARCH="ELASTICSEARCH",to.COUCHDB="COUCHDB",to.SQL_SERVER="SQL_SERVER",to.S3="S3",to.AIRTABLE="AIRTABLE",to.MYSQL="MYSQL",to.ARANGODB="ARANGODB",to.REST="REST",to.ORACLE="ORACLE",to.GOOGLE_SHEETS="GOOGLE_SHEETS",to.FIRESTORE="FIRESTORE",to.REDIS="REDIS",to.SNOWFLAKE="SNOWFLAKE",to.BUDIBASE="BUDIBASE",to))(SourceName||{}),DatasourceFeature=(to=>(to.CONNECTION_CHECKING="connection",to.FETCH_TABLE_NAMES="fetch_table_names",to.EXPORT_SCHEMA="export_schema",to))(DatasourceFeature||{}),BasicOperator=(to=>(to.EQUAL="equal",to.NOT_EQUAL="notEqual",to.EMPTY="empty",to.NOT_EMPTY="notEmpty",to.FUZZY="fuzzy",to.STRING="string",to))(BasicOperator||{}),ArrayOperator=(to=>(to.CONTAINS="contains",to.NOT_CONTAINS="notContains",to.CONTAINS_ANY="containsAny",to.ONE_OF="oneOf",to))(ArrayOperator||{}),RangeOperator=(to=>(to.RANGE="range",to))(RangeOperator||{}),LogicalOperator=(to=>(to.AND="$and",to.OR="$or",to))(LogicalOperator||{});function isLogicalSearchOperator(to){return Object.values(LogicalOperator).includes(to)}function isBasicSearchOperator(to){return Object.values(BasicOperator).includes(to)}function isArraySearchOperator(to){return Object.values(ArrayOperator).includes(to)}function isRangeSearchOperator(to){return Object.values(RangeOperator).includes(to)}var InternalSearchFilterOperator=(to=>(to.COMPLEX_ID_OPERATOR="_complexIdOperator",to))(InternalSearchFilterOperator||{}),EmptyFilterOption=(to=>(to.RETURN_ALL="all",to.RETURN_NONE="none",to))(EmptyFilterOption||{}),UILogicalOperator=(to=>(to.ALL="all",to.ANY="any",to))(UILogicalOperator||{});const FeatureFlagDefaults={USE_ZOD_VALIDATOR:!1,DIRECT_LOGIN_TO_ACCOUNT_PORTAL:!1};Event$1.PLUGIN_INIT;var PermissionSource=(to=>(to.EXPLICIT="EXPLICIT",to.INHERITED="INHERITED",to.BASE="BASE",to))(PermissionSource||{}),RowExportFormat=(to=>(to.CSV="csv",to.JSON="json",to.JSON_WITH_SCHEMA="jsonWithSchema",to))(RowExportFormat||{}),AutomationIOType=(to=>(to.OBJECT="object",to.STRING="string",to.BOOLEAN="boolean",to.NUMBER="number",to.ARRAY="array",to.JSON="json",to.DATE="date",to.ATTACHMENT="attachment",to))(AutomationIOType||{}),AutomationCustomIOType=(to=>(to.TABLE="table",to.ROW="row",to.ROWS="rows",to.WIDE="wide",to.QUERY="query",to.QUERY_PARAMS="queryParams",to.QUERY_LIMIT="queryLimit",to.LOOP_OPTION="loopOption",to.ITEM="item",to.CODE="code",to.FILTERS="filters",to.COLUMN="column",to.TRIGGER_SCHEMA="triggerSchema",to.CRON="cron",to.WEBHOOK_URL="webhookUrl",to.AUTOMATION="automation",to.AUTOMATION_FIELDS="automationFields",to.MULTI_ATTACHMENTS="multi_attachments",to.TRIGGER_FILTER="trigger_filter",to))(AutomationCustomIOType||{}),AutomationTriggerStepId=(to=>(to.ROW_SAVED="ROW_SAVED",to.ROW_UPDATED="ROW_UPDATED",to.ROW_DELETED="ROW_DELETED",to.WEBHOOK="WEBHOOK",to.APP="APP",to.CRON="CRON",to.ROW_ACTION="ROW_ACTION",to))(AutomationTriggerStepId||{}),AutomationStepType=(to=>(to.LOGIC="LOGIC",to.ACTION="ACTION",to.TRIGGER="TRIGGER",to))(AutomationStepType||{}),AutomationActionStepId=(to=>(to.SEND_EMAIL_SMTP="SEND_EMAIL_SMTP",to.CREATE_ROW="CREATE_ROW",to.UPDATE_ROW="UPDATE_ROW",to.DELETE_ROW="DELETE_ROW",to.EXECUTE_BASH="EXECUTE_BASH",to.OUTGOING_WEBHOOK="OUTGOING_WEBHOOK",to.EXECUTE_SCRIPT="EXECUTE_SCRIPT",to.EXECUTE_QUERY="EXECUTE_QUERY",to.SERVER_LOG="SERVER_LOG",to.DELAY="DELAY",to.FILTER="FILTER",to.QUERY_ROWS="QUERY_ROWS",to.LOOP="LOOP",to.COLLECT="COLLECT",to.OPENAI="OPENAI",to.TRIGGER_AUTOMATION_RUN="TRIGGER_AUTOMATION_RUN",to.BRANCH="BRANCH",to.discord="discord",to.slack="slack",to.zapier="zapier",to.integromat="integromat",to.n8n="n8n",to))(AutomationActionStepId||{});[...Object.values(AutomationActionStepId),...Object.values(AutomationTriggerStepId)];var AutomationFeature=(to=>(to.LOOPING="LOOPING",to))(AutomationFeature||{}),AutomationEventType=(to=>(to.ROW_SAVE="row:save",to.ROW_UPDATE="row:update",to.ROW_DELETE="row:delete",to.APP_TRIGGER="app:trigger",to.CRON_TRIGGER="cron:trigger",to.WEBHOOK_TRIGGER="web:trigger",to.ROW_ACTION="row:action",to))(AutomationEventType||{}),SourceType=(to=>(to.DATASOURCE="datasource",to.QUERY="query",to.TABLE="table",to.VIEW="view",to))(SourceType||{}),HttpMethod=(to=>(to.GET="GET",to.POST="POST",to.PATCH="PATCH",to.PUT="PUT",to.HEAD="HEAD",to.DELETE="DELETE",to))(HttpMethod||{});const INTERNAL_TABLE_SOURCE_ID="bb_internal";var FieldType=(to=>(to.STRING="string",to.LONGFORM="longform",to.OPTIONS="options",to.NUMBER="number",to.BOOLEAN="boolean",to.ARRAY="array",to.DATETIME="datetime",to.ATTACHMENTS="attachment",to.ATTACHMENT_SINGLE="attachment_single",to.LINK="link",to.FORMULA="formula",to.AUTO="auto",to.AI="ai",to.JSON="json",to.INTERNAL="internal",to.BARCODEQR="barcodeqr",to.SIGNATURE_SINGLE="signature_single",to.BIGINT="bigint",to.BB_REFERENCE="bb_reference",to.BB_REFERENCE_SINGLE="bb_reference_single",to))(FieldType||{});const NumericTypes=["number","bigint"];function isNumeric$1(to){return NumericTypes.includes(to)}const GroupByTypes=["string","longform","options","number","boolean","datetime","bigint","ai"];function canGroupBy(to){return GroupByTypes.includes(to)}var RelationshipType=(to=>(to.ONE_TO_MANY="one-to-many",to.MANY_TO_ONE="many-to-one",to.MANY_TO_MANY="many-to-many",to))(RelationshipType||{}),AutoFieldSubType=(to=>(to.CREATED_BY="createdBy",to.CREATED_AT="createdAt",to.UPDATED_BY="updatedBy",to.UPDATED_AT="updatedAt",to.AUTO_ID="autoID",to))(AutoFieldSubType||{}),FormulaType=(to=>(to.STATIC="static",to.DYNAMIC="dynamic",to.AI="ai",to))(FormulaType||{}),BBReferenceFieldSubType=(to=>(to.USER="user",to.USERS="users",to))(BBReferenceFieldSubType||{});function isRelationshipField(to){return to.type===FieldType.LINK}var CalculationType=(to=>(to.SUM="sum",to.AVG="avg",to.COUNT="count",to.MIN="min",to.MAX="max",to))(CalculationType||{}),ViewV2Type=(to=>(to.CALCULATION="calculation",to))(ViewV2Type||{});const SEPARATOR$1="_",prefixed=to=>`${to}${SEPARATOR$1}`;var DocumentType=(to=>(to.USER="us",to.GROUP="gr",to.WORKSPACE="workspace",to.CONFIG="config",to.TEMPLATE="template",to.APP="app",to.DEV="dev",to.APP_DEV="app_dev",to.APP_METADATA="app_metadata",to.ROLE="role",to.MIGRATIONS="migrations",to.DEV_INFO="devinfo",to.AUTOMATION_LOG="log_au",to.ACCOUNT_METADATA="acc_metadata",to.PLUGIN="plg",to.DATASOURCE="datasource",to.DATASOURCE_PLUS="datasource_plus",to.APP_BACKUP="backup",to.TABLE="ta",to.ROW="ro",to.AUTOMATION="au",to.LINK="li",to.WEBHOOK="wh",to.INSTANCE="inst",to.LAYOUT="layout",to.SCREEN="screen",to.QUERY="query",to.DEPLOYMENTS="deployments",to.METADATA="metadata",to.MEM_VIEW="view",to.USER_FLAG="flag",to.AUTOMATION_METADATA="meta_au",to.AUDIT_LOG="al",to.APP_MIGRATION_METADATA="_design/migrations",to.SCIM_LOG="scimlog",to.ROW_ACTIONS="ra",to))(DocumentType||{});Object.values(DocumentType).sort((to,ue)=>ue.length-to.length);var InternalTable=(to=>(to.USER_METADATA="ta_users",to))(InternalTable||{}),VirtualDocumentType=(to=>(to.VIEW="view",to.ROW_ACTION="row_action",to))(VirtualDocumentType||{});Object.values(VirtualDocumentType).sort((to,ue)=>ue.length-to.length);var Theme=(to=>(to.LIGHTEST="lightest",to.LIGHT="light",to.DARK="dark",to.DARKEST="darkest",to.NORD="nord",to.MIDNIGHT="midnight",to))(Theme||{}),DeploymentStatus=(to=>(to.SUCCESS="SUCCESS",to.PENDING="PENDING",to.FAILURE="FAILURE",to))(DeploymentStatus||{});const isConfig=to=>"type"in to&&"config"in to,isSCIMConfig=to=>to.type==="scim";var ConfigType=(to=>(to.SETTINGS="settings",to.ACCOUNT="account",to.SMTP="smtp",to.GOOGLE="google",to.OIDC="oidc",to.OIDC_LOGOS="logos_oidc",to.SCIM="scim",to.AI="ai",to))(ConfigType||{});function isSSOUser(to){return!!to.providerType}var PluginType=(to=>(to.DATASOURCE="datasource",to.COMPONENT="component",to.AUTOMATION="automation",to))(PluginType||{});Object.values(PluginType);StaticQuotaName.ROWS,MonthlyQuotaName.QUERIES,MonthlyQuotaName.AUTOMATIONS;MonthlyQuotaName.QUERIES,MonthlyQuotaName.AUTOMATIONS;var SortOrder=(to=>(to.ASCENDING="ascending",to.DESCENDING="descending",to))(SortOrder||{}),SortType=(to=>(to.STRING="string",to.NUMBER="number",to))(SortType||{}),util$h;(function(to){to.assertEqual=ro=>ro;function ue(ro){}to.assertIs=ue;function eo(ro){throw new Error}to.assertNever=eo,to.arrayToEnum=ro=>{const oo={};for(const io of ro)oo[io]=io;return oo},to.getValidEnumValues=ro=>{const oo=to.objectKeys(ro).filter(ao=>typeof ro[ro[ao]]!="number"),io={};for(const ao of oo)io[ao]=ro[ao];return to.objectValues(io)},to.objectValues=ro=>to.objectKeys(ro).map(function(oo){return ro[oo]}),to.objectKeys=typeof Object.keys=="function"?ro=>Object.keys(ro):ro=>{const oo=[];for(const io in ro)Object.prototype.hasOwnProperty.call(ro,io)&&oo.push(io);return oo},to.find=(ro,oo)=>{for(const io of ro)if(oo(io))return io},to.isInteger=typeof Number.isInteger=="function"?ro=>Number.isInteger(ro):ro=>typeof ro=="number"&&isFinite(ro)&&Math.floor(ro)===ro;function no(ro,oo=" | "){return ro.map(io=>typeof io=="string"?`'${io}'`:io).join(oo)}to.joinValues=no,to.jsonStringifyReplacer=(ro,oo)=>typeof oo=="bigint"?oo.toString():oo})(util$h||(util$h={}));var objectUtil;(function(to){to.mergeShapes=(ue,eo)=>({...ue,...eo})})(objectUtil||(objectUtil={}));const ZodParsedType=util$h.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),getParsedType=to=>{switch(typeof to){case"undefined":return ZodParsedType.undefined;case"string":return ZodParsedType.string;case"number":return isNaN(to)?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(to)?ZodParsedType.array:to===null?ZodParsedType.null:to.then&&typeof to.then=="function"&&to.catch&&typeof to.catch=="function"?ZodParsedType.promise:typeof Map<"u"&&to instanceof Map?ZodParsedType.map:typeof Set<"u"&&to instanceof Set?ZodParsedType.set:typeof Date<"u"&&to instanceof Date?ZodParsedType.date:ZodParsedType.object;default:return ZodParsedType.unknown}},ZodIssueCode=util$h.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=to=>JSON.stringify(to,null,2).replace(/"([^"]+)":/g,"$1:");class ZodError extends Error{constructor(ue){super(),this.issues=[],this.addIssue=no=>{this.issues=[...this.issues,no]},this.addIssues=(no=[])=>{this.issues=[...this.issues,...no]};const eo=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,eo):this.__proto__=eo,this.name="ZodError",this.issues=ue}get errors(){return this.issues}format(ue){const eo=ue||function(oo){return oo.message},no={_errors:[]},ro=oo=>{for(const io of oo.issues)if(io.code==="invalid_union")io.unionErrors.map(ro);else if(io.code==="invalid_return_type")ro(io.returnTypeError);else if(io.code==="invalid_arguments")ro(io.argumentsError);else if(io.path.length===0)no._errors.push(eo(io));else{let ao=no,so=0;for(;so<io.path.length;){const lo=io.path[so];so===io.path.length-1?(ao[lo]=ao[lo]||{_errors:[]},ao[lo]._errors.push(eo(io))):ao[lo]=ao[lo]||{_errors:[]},ao=ao[lo],so++}}};return ro(this),no}static assert(ue){if(!(ue instanceof ZodError))throw new Error(`Not a ZodError: ${ue}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,util$h.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(ue=eo=>eo.message){const eo={},no=[];for(const ro of this.issues)ro.path.length>0?(eo[ro.path[0]]=eo[ro.path[0]]||[],eo[ro.path[0]].push(ue(ro))):no.push(ue(ro));return{formErrors:no,fieldErrors:eo}}get formErrors(){return this.flatten()}}ZodError.create=to=>new ZodError(to);const errorMap=(to,ue)=>{let eo;switch(to.code){case ZodIssueCode.invalid_type:to.received===ZodParsedType.undefined?eo="Required":eo=`Expected ${to.expected}, received ${to.received}`;break;case ZodIssueCode.invalid_literal:eo=`Invalid literal value, expected ${JSON.stringify(to.expected,util$h.jsonStringifyReplacer)}`;break;case ZodIssueCode.unrecognized_keys:eo=`Unrecognized key(s) in object: ${util$h.joinValues(to.keys,", ")}`;break;case ZodIssueCode.invalid_union:eo="Invalid input";break;case ZodIssueCode.invalid_union_discriminator:eo=`Invalid discriminator value. Expected ${util$h.joinValues(to.options)}`;break;case ZodIssueCode.invalid_enum_value:eo=`Invalid enum value. Expected ${util$h.joinValues(to.options)}, received '${to.received}'`;break;case ZodIssueCode.invalid_arguments:eo="Invalid function arguments";break;case ZodIssueCode.invalid_return_type:eo="Invalid function return type";break;case ZodIssueCode.invalid_date:eo="Invalid date";break;case ZodIssueCode.invalid_string:typeof to.validation=="object"?"includes"in to.validation?(eo=`Invalid input: must include "${to.validation.includes}"`,typeof to.validation.position=="number"&&(eo=`${eo} at one or more positions greater than or equal to ${to.validation.position}`)):"startsWith"in to.validation?eo=`Invalid input: must start with "${to.validation.startsWith}"`:"endsWith"in to.validation?eo=`Invalid input: must end with "${to.validation.endsWith}"`:util$h.assertNever(to.validation):to.validation!=="regex"?eo=`Invalid ${to.validation}`:eo="Invalid";break;case ZodIssueCode.too_small:to.type==="array"?eo=`Array must contain ${to.exact?"exactly":to.inclusive?"at least":"more than"} ${to.minimum} element(s)`:to.type==="string"?eo=`String must contain ${to.exact?"exactly":to.inclusive?"at least":"over"} ${to.minimum} character(s)`:to.type==="number"?eo=`Number must be ${to.exact?"exactly equal to ":to.inclusive?"greater than or equal to ":"greater than "}${to.minimum}`:to.type==="date"?eo=`Date must be ${to.exact?"exactly equal to ":to.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(to.minimum))}`:eo="Invalid input";break;case ZodIssueCode.too_big:to.type==="array"?eo=`Array must contain ${to.exact?"exactly":to.inclusive?"at most":"less than"} ${to.maximum} element(s)`:to.type==="string"?eo=`String must contain ${to.exact?"exactly":to.inclusive?"at most":"under"} ${to.maximum} character(s)`:to.type==="number"?eo=`Number must be ${to.exact?"exactly":to.inclusive?"less than or equal to":"less than"} ${to.maximum}`:to.type==="bigint"?eo=`BigInt must be ${to.exact?"exactly":to.inclusive?"less than or equal to":"less than"} ${to.maximum}`:to.type==="date"?eo=`Date must be ${to.exact?"exactly":to.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(to.maximum))}`:eo="Invalid input";break;case ZodIssueCode.custom:eo="Invalid input";break;case ZodIssueCode.invalid_intersection_types:eo="Intersection results could not be merged";break;case ZodIssueCode.not_multiple_of:eo=`Number must be a multiple of ${to.multipleOf}`;break;case ZodIssueCode.not_finite:eo="Number must be finite";break;default:eo=ue.defaultError,util$h.assertNever(to)}return{message:eo}};let overrideErrorMap=errorMap;function setErrorMap(to){overrideErrorMap=to}function getErrorMap(){return overrideErrorMap}const makeIssue=to=>{const{data:ue,path:eo,errorMaps:no,issueData:ro}=to,oo=[...eo,...ro.path||[]],io={...ro,path:oo};if(ro.message!==void 0)return{...ro,path:oo,message:ro.message};let ao="";const so=no.filter(lo=>!!lo).slice().reverse();for(const lo of so)ao=lo(io,{data:ue,defaultError:ao}).message;return{...ro,path:oo,message:ao}},EMPTY_PATH=[];function addIssueToContext(to,ue){const eo=getErrorMap(),no=makeIssue({issueData:ue,data:to.data,path:to.path,errorMaps:[to.common.contextualErrorMap,to.schemaErrorMap,eo,eo===errorMap?void 0:errorMap].filter(ro=>!!ro)});to.common.issues.push(no)}class ParseStatus{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(ue,eo){const no=[];for(const ro of eo){if(ro.status==="aborted")return INVALID$3;ro.status==="dirty"&&ue.dirty(),no.push(ro.value)}return{status:ue.value,value:no}}static async mergeObjectAsync(ue,eo){const no=[];for(const ro of eo){const oo=await ro.key,io=await ro.value;no.push({key:oo,value:io})}return ParseStatus.mergeObjectSync(ue,no)}static mergeObjectSync(ue,eo){const no={};for(const ro of eo){const{key:oo,value:io}=ro;if(oo.status==="aborted"||io.status==="aborted")return INVALID$3;oo.status==="dirty"&&ue.dirty(),io.status==="dirty"&&ue.dirty(),oo.value!=="__proto__"&&(typeof io.value<"u"||ro.alwaysSet)&&(no[oo.value]=io.value)}return{status:ue.value,value:no}}}const INVALID$3=Object.freeze({status:"aborted"}),DIRTY=to=>({status:"dirty",value:to}),OK=to=>({status:"valid",value:to}),isAborted=to=>to.status==="aborted",isDirty=to=>to.status==="dirty",isValid$2=to=>to.status==="valid",isAsync=to=>typeof Promise<"u"&&to instanceof Promise;function __classPrivateFieldGet(to,ue,eo,no){if(eo==="a"&&!no)throw new TypeError("Private accessor was defined without a getter");if(typeof ue=="function"?to!==ue||!no:!ue.has(to))throw new TypeError("Cannot read private member from an object whose class did not declare it");return eo==="m"?no:eo==="a"?no.call(to):no?no.value:ue.get(to)}function __classPrivateFieldSet(to,ue,eo,no,ro){if(no==="m")throw new TypeError("Private method is not writable");if(no==="a"&&!ro)throw new TypeError("Private accessor was defined without a setter");if(typeof ue=="function"?to!==ue||!ro:!ue.has(to))throw new TypeError("Cannot write private member to an object whose class did not declare it");return no==="a"?ro.call(to,eo):ro?ro.value=eo:ue.set(to,eo),eo}typeof SuppressedError=="function"&&SuppressedError;var errorUtil;(function(to){to.errToObj=ue=>typeof ue=="string"?{message:ue}:ue||{},to.toString=ue=>typeof ue=="string"?ue:ue==null?void 0:ue.message})(errorUtil||(errorUtil={}));var _ZodEnum_cache,_ZodNativeEnum_cache;class ParseInputLazyPath{constructor(ue,eo,no,ro){this._cachedPath=[],this.parent=ue,this.data=eo,this._path=no,this._key=ro}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=(to,ue)=>{if(isValid$2(ue))return{success:!0,data:ue.value};if(!to.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const eo=new ZodError(to.common.issues);return this._error=eo,this._error}}};function processCreateParams(to){if(!to)return{};const{errorMap:ue,invalid_type_error:eo,required_error:no,description:ro}=to;if(ue&&(eo||no))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return ue?{errorMap:ue,description:ro}:{errorMap:(io,ao)=>{var so,lo;const{message:co}=to;return io.code==="invalid_enum_value"?{message:co??ao.defaultError}:typeof ao.data>"u"?{message:(so=co??no)!==null&&so!==void 0?so:ao.defaultError}:io.code!=="invalid_type"?{message:ao.defaultError}:{message:(lo=co??eo)!==null&&lo!==void 0?lo:ao.defaultError}},description:ro}}class ZodType{constructor(ue){this.spa=this.safeParseAsync,this._def=ue,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(ue){return getParsedType(ue.data)}_getOrReturnCtx(ue,eo){return eo||{common:ue.parent.common,data:ue.data,parsedType:getParsedType(ue.data),schemaErrorMap:this._def.errorMap,path:ue.path,parent:ue.parent}}_processInputParams(ue){return{status:new ParseStatus,ctx:{common:ue.parent.common,data:ue.data,parsedType:getParsedType(ue.data),schemaErrorMap:this._def.errorMap,path:ue.path,parent:ue.parent}}}_parseSync(ue){const eo=this._parse(ue);if(isAsync(eo))throw new Error("Synchronous parse encountered promise.");return eo}_parseAsync(ue){const eo=this._parse(ue);return Promise.resolve(eo)}parse(ue,eo){const no=this.safeParse(ue,eo);if(no.success)return no.data;throw no.error}safeParse(ue,eo){var no;const ro={common:{issues:[],async:(no=eo==null?void 0:eo.async)!==null&&no!==void 0?no:!1,contextualErrorMap:eo==null?void 0:eo.errorMap},path:(eo==null?void 0:eo.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:ue,parsedType:getParsedType(ue)},oo=this._parseSync({data:ue,path:ro.path,parent:ro});return handleResult(ro,oo)}async parseAsync(ue,eo){const no=await this.safeParseAsync(ue,eo);if(no.success)return no.data;throw no.error}async safeParseAsync(ue,eo){const no={common:{issues:[],contextualErrorMap:eo==null?void 0:eo.errorMap,async:!0},path:(eo==null?void 0:eo.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:ue,parsedType:getParsedType(ue)},ro=this._parse({data:ue,path:no.path,parent:no}),oo=await(isAsync(ro)?ro:Promise.resolve(ro));return handleResult(no,oo)}refine(ue,eo){const no=ro=>typeof eo=="string"||typeof eo>"u"?{message:eo}:typeof eo=="function"?eo(ro):eo;return this._refinement((ro,oo)=>{const io=ue(ro),ao=()=>oo.addIssue({code:ZodIssueCode.custom,...no(ro)});return typeof Promise<"u"&&io instanceof Promise?io.then(so=>so?!0:(ao(),!1)):io?!0:(ao(),!1)})}refinement(ue,eo){return this._refinement((no,ro)=>ue(no)?!0:(ro.addIssue(typeof eo=="function"?eo(no,ro):eo),!1))}_refinement(ue){return new ZodEffects({schema:this,typeName:ZodFirstPartyTypeKind.ZodEffects,effect:{type:"refinement",refinement:ue}})}superRefine(ue){return this._refinement(ue)}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(ue){return ZodUnion.create([this,ue],this._def)}and(ue){return ZodIntersection.create(this,ue,this._def)}transform(ue){return new ZodEffects({...processCreateParams(this._def),schema:this,typeName:ZodFirstPartyTypeKind.ZodEffects,effect:{type:"transform",transform:ue}})}default(ue){const eo=typeof ue=="function"?ue:()=>ue;return new ZodDefault({...processCreateParams(this._def),innerType:this,defaultValue:eo,typeName:ZodFirstPartyTypeKind.ZodDefault})}brand(){return new ZodBranded({typeName:ZodFirstPartyTypeKind.ZodBranded,type:this,...processCreateParams(this._def)})}catch(ue){const eo=typeof ue=="function"?ue:()=>ue;return new ZodCatch({...processCreateParams(this._def),innerType:this,catchValue:eo,typeName:ZodFirstPartyTypeKind.ZodCatch})}describe(ue){const eo=this.constructor;return new eo({...this._def,description:ue})}pipe(ue){return ZodPipeline.create(this,ue)}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(to){let ue="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return to.precision?ue=`${ue}\\.\\d{${to.precision}}`:to.precision==null&&(ue=`${ue}(\\.\\d+)?`),ue}function timeRegex(to){return new RegExp(`^${timeRegexSource(to)}$`)}function datetimeRegex(to){let ue=`${dateRegexSource}T${timeRegexSource(to)}`;const eo=[];return eo.push(to.local?"Z?":"Z"),to.offset&&eo.push("([+-]\\d{2}:?\\d{2})"),ue=`${ue}(${eo.join("|")})`,new RegExp(`^${ue}$`)}function isValidIP(to,ue){return!!((ue==="v4"||!ue)&&ipv4Regex.test(to)||(ue==="v6"||!ue)&&ipv6Regex.test(to))}class ZodString extends ZodType{_parse(ue){if(this._def.coerce&&(ue.data=String(ue.data)),this._getType(ue)!==ZodParsedType.string){const oo=this._getOrReturnCtx(ue);return addIssueToContext(oo,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.string,received:oo.parsedType}),INVALID$3}const no=new ParseStatus;let ro;for(const oo of this._def.checks)if(oo.kind==="min")ue.data.length<oo.value&&(ro=this._getOrReturnCtx(ue,ro),addIssueToContext(ro,{code:ZodIssueCode.too_small,minimum:oo.value,type:"string",inclusive:!0,exact:!1,message:oo.message}),no.dirty());else if(oo.kind==="max")ue.data.length>oo.value&&(ro=this._getOrReturnCtx(ue,ro),addIssueToContext(ro,{code:ZodIssueCode.too_big,maximum:oo.value,type:"string",inclusive:!0,exact:!1,message:oo.message}),no.dirty());else if(oo.kind==="length"){const io=ue.data.length>oo.value,ao=ue.data.length<oo.value;(io||ao)&&(ro=this._getOrReturnCtx(ue,ro),io?addIssueToContext(ro,{code:ZodIssueCode.too_big,maximum:oo.value,type:"string",inclusive:!0,exact:!0,message:oo.message}):ao&&addIssueToContext(ro,{code:ZodIssueCode.too_small,minimum:oo.value,type:"string",inclusive:!0,exact:!0,message:oo.message}),no.dirty())}else if(oo.kind==="email")emailRegex.test(ue.data)||(ro=this._getOrReturnCtx(ue,ro),addIssueToContext(ro,{validation:"email",code:ZodIssueCode.invalid_string,message:oo.message}),no.dirty());else if(oo.kind==="emoji")emojiRegex||(emojiRegex=new RegExp(_emojiRegex,"u")),emojiRegex.test(ue.data)||(ro=this._getOrReturnCtx(ue,ro),addIssueToContext(ro,{validation:"emoji",code:ZodIssueCode.invalid_string,message:oo.message}),no.dirty());else if(oo.kind==="uuid")uuidRegex.test(ue.data)||(ro=this._getOrReturnCtx(ue,ro),addIssueToContext(ro,{validation:"uuid",code:ZodIssueCode.invalid_string,message:oo.message}),no.dirty());else if(oo.kind==="nanoid")nanoidRegex.test(ue.data)||(ro=this._getOrReturnCtx(ue,ro),addIssueToContext(ro,{validation:"nanoid",code:ZodIssueCode.invalid_string,message:oo.message}),no.dirty());else if(oo.kind==="cuid")cuidRegex.test(ue.data)||(ro=this._getOrReturnCtx(ue,ro),addIssueToContext(ro,{validation:"cuid",code:ZodIssueCode.invalid_string,message:oo.message}),no.dirty());else if(oo.kind==="cuid2")cuid2Regex.test(ue.data)||(ro=this._getOrReturnCtx(ue,ro),addIssueToContext(ro,{validation:"cuid2",code:ZodIssueCode.invalid_string,message:oo.message}),no.dirty());else if(oo.kind==="ulid")ulidRegex.test(ue.data)||(ro=this._getOrReturnCtx(ue,ro),addIssueToContext(ro,{validation:"ulid",code:ZodIssueCode.invalid_string,message:oo.message}),no.dirty());else if(oo.kind==="url")try{new URL(ue.data)}catch{ro=this._getOrReturnCtx(ue,ro),addIssueToContext(ro,{validation:"url",code:ZodIssueCode.invalid_string,message:oo.message}),no.dirty()}else oo.kind==="regex"?(oo.regex.lastIndex=0,oo.regex.test(ue.data)||(ro=this._getOrReturnCtx(ue,ro),addIssueToContext(ro,{validation:"regex",code:ZodIssueCode.invalid_string,message:oo.message}),no.dirty())):oo.kind==="trim"?ue.data=ue.data.trim():oo.kind==="includes"?ue.data.includes(oo.value,oo.position)||(ro=this._getOrReturnCtx(ue,ro),addIssueToContext(ro,{code:ZodIssueCode.invalid_string,validation:{includes:oo.value,position:oo.position},message:oo.message}),no.dirty()):oo.kind==="toLowerCase"?ue.data=ue.data.toLowerCase():oo.kind==="toUpperCase"?ue.data=ue.data.toUpperCase():oo.kind==="startsWith"?ue.data.startsWith(oo.value)||(ro=this._getOrReturnCtx(ue,ro),addIssueToContext(ro,{code:ZodIssueCode.invalid_string,validation:{startsWith:oo.value},message:oo.message}),no.dirty()):oo.kind==="endsWith"?ue.data.endsWith(oo.value)||(ro=this._getOrReturnCtx(ue,ro),addIssueToContext(ro,{code:ZodIssueCode.invalid_string,validation:{endsWith:oo.value},message:oo.message}),no.dirty()):oo.kind==="datetime"?datetimeRegex(oo).test(ue.data)||(ro=this._getOrReturnCtx(ue,ro),addIssueToContext(ro,{code:ZodIssueCode.invalid_string,validation:"datetime",message:oo.message}),no.dirty()):oo.kind==="date"?dateRegex.test(ue.data)||(ro=this._getOrReturnCtx(ue,ro),addIssueToContext(ro,{code:ZodIssueCode.invalid_string,validation:"date",message:oo.message}),no.dirty()):oo.kind==="time"?timeRegex(oo).test(ue.data)||(ro=this._getOrReturnCtx(ue,ro),addIssueToContext(ro,{code:ZodIssueCode.invalid_string,validation:"time",message:oo.message}),no.dirty()):oo.kind==="duration"?durationRegex.test(ue.data)||(ro=this._getOrReturnCtx(ue,ro),addIssueToContext(ro,{validation:"duration",code:ZodIssueCode.invalid_string,message:oo.message}),no.dirty()):oo.kind==="ip"?isValidIP(ue.data,oo.version)||(ro=this._getOrReturnCtx(ue,ro),addIssueToContext(ro,{validation:"ip",code:ZodIssueCode.invalid_string,message:oo.message}),no.dirty()):oo.kind==="base64"?base64Regex.test(ue.data)||(ro=this._getOrReturnCtx(ue,ro),addIssueToContext(ro,{validation:"base64",code:ZodIssueCode.invalid_string,message:oo.message}),no.dirty()):util$h.assertNever(oo);return{status:no.value,value:ue.data}}_regex(ue,eo,no){return this.refinement(ro=>ue.test(ro),{validation:eo,code:ZodIssueCode.invalid_string,...errorUtil.errToObj(no)})}_addCheck(ue){return new ZodString({...this._def,checks:[...this._def.checks,ue]})}email(ue){return this._addCheck({kind:"email",...errorUtil.errToObj(ue)})}url(ue){return this._addCheck({kind:"url",...errorUtil.errToObj(ue)})}emoji(ue){return this._addCheck({kind:"emoji",...errorUtil.errToObj(ue)})}uuid(ue){return this._addCheck({kind:"uuid",...errorUtil.errToObj(ue)})}nanoid(ue){return this._addCheck({kind:"nanoid",...errorUtil.errToObj(ue)})}cuid(ue){return this._addCheck({kind:"cuid",...errorUtil.errToObj(ue)})}cuid2(ue){return this._addCheck({kind:"cuid2",...errorUtil.errToObj(ue)})}ulid(ue){return this._addCheck({kind:"ulid",...errorUtil.errToObj(ue)})}base64(ue){return this._addCheck({kind:"base64",...errorUtil.errToObj(ue)})}ip(ue){return this._addCheck({kind:"ip",...errorUtil.errToObj(ue)})}datetime(ue){var eo,no;return typeof ue=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:ue}):this._addCheck({kind:"datetime",precision:typeof(ue==null?void 0:ue.precision)>"u"?null:ue==null?void 0:ue.precision,offset:(eo=ue==null?void 0:ue.offset)!==null&&eo!==void 0?eo:!1,local:(no=ue==null?void 0:ue.local)!==null&&no!==void 0?no:!1,...errorUtil.errToObj(ue==null?void 0:ue.message)})}date(ue){return this._addCheck({kind:"date",message:ue})}time(ue){return typeof ue=="string"?this._addCheck({kind:"time",precision:null,message:ue}):this._addCheck({kind:"time",precision:typeof(ue==null?void 0:ue.precision)>"u"?null:ue==null?void 0:ue.precision,...errorUtil.errToObj(ue==null?void 0:ue.message)})}duration(ue){return this._addCheck({kind:"duration",...errorUtil.errToObj(ue)})}regex(ue,eo){return this._addCheck({kind:"regex",regex:ue,...errorUtil.errToObj(eo)})}includes(ue,eo){return this._addCheck({kind:"includes",value:ue,position:eo==null?void 0:eo.position,...errorUtil.errToObj(eo==null?void 0:eo.message)})}startsWith(ue,eo){return this._addCheck({kind:"startsWith",value:ue,...errorUtil.errToObj(eo)})}endsWith(ue,eo){return this._addCheck({kind:"endsWith",value:ue,...errorUtil.errToObj(eo)})}min(ue,eo){return this._addCheck({kind:"min",value:ue,...errorUtil.errToObj(eo)})}max(ue,eo){return this._addCheck({kind:"max",value:ue,...errorUtil.errToObj(eo)})}length(ue,eo){return this._addCheck({kind:"length",value:ue,...errorUtil.errToObj(eo)})}nonempty(ue){return this.min(1,errorUtil.errToObj(ue))}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(ue=>ue.kind==="datetime")}get isDate(){return!!this._def.checks.find(ue=>ue.kind==="date")}get isTime(){return!!this._def.checks.find(ue=>ue.kind==="time")}get isDuration(){return!!this._def.checks.find(ue=>ue.kind==="duration")}get isEmail(){return!!this._def.checks.find(ue=>ue.kind==="email")}get isURL(){return!!this._def.checks.find(ue=>ue.kind==="url")}get isEmoji(){return!!this._def.checks.find(ue=>ue.kind==="emoji")}get isUUID(){return!!this._def.checks.find(ue=>ue.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(ue=>ue.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(ue=>ue.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(ue=>ue.kind==="cuid2")}get isULID(){return!!this._def.checks.find(ue=>ue.kind==="ulid")}get isIP(){return!!this._def.checks.find(ue=>ue.kind==="ip")}get isBase64(){return!!this._def.checks.find(ue=>ue.kind==="base64")}get minLength(){let ue=null;for(const eo of this._def.checks)eo.kind==="min"&&(ue===null||eo.value>ue)&&(ue=eo.value);return ue}get maxLength(){let ue=null;for(const eo of this._def.checks)eo.kind==="max"&&(ue===null||eo.value<ue)&&(ue=eo.value);return ue}}ZodString.create=to=>{var ue;return new ZodString({checks:[],typeName:ZodFirstPartyTypeKind.ZodString,coerce:(ue=to==null?void 0:to.coerce)!==null&&ue!==void 0?ue:!1,...processCreateParams(to)})};function floatSafeRemainder(to,ue){const eo=(to.toString().split(".")[1]||"").length,no=(ue.toString().split(".")[1]||"").length,ro=eo>no?eo:no,oo=parseInt(to.toFixed(ro).replace(".","")),io=parseInt(ue.toFixed(ro).replace(".",""));return oo%io/Math.pow(10,ro)}class ZodNumber extends ZodType{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(ue){if(this._def.coerce&&(ue.data=Number(ue.data)),this._getType(ue)!==ZodParsedType.number){const oo=this._getOrReturnCtx(ue);return addIssueToContext(oo,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.number,received:oo.parsedType}),INVALID$3}let no;const ro=new ParseStatus;for(const oo of this._def.checks)oo.kind==="int"?util$h.isInteger(ue.data)||(no=this._getOrReturnCtx(ue,no),addIssueToContext(no,{code:ZodIssueCode.invalid_type,expected:"integer",received:"float",message:oo.message}),ro.dirty()):oo.kind==="min"?(oo.inclusive?ue.data<oo.value:ue.data<=oo.value)&&(no=this._getOrReturnCtx(ue,no),addIssueToContext(no,{code:ZodIssueCode.too_small,minimum:oo.value,type:"number",inclusive:oo.inclusive,exact:!1,message:oo.message}),ro.dirty()):oo.kind==="max"?(oo.inclusive?ue.data>oo.value:ue.data>=oo.value)&&(no=this._getOrReturnCtx(ue,no),addIssueToContext(no,{code:ZodIssueCode.too_big,maximum:oo.value,type:"number",inclusive:oo.inclusive,exact:!1,message:oo.message}),ro.dirty()):oo.kind==="multipleOf"?floatSafeRemainder(ue.data,oo.value)!==0&&(no=this._getOrReturnCtx(ue,no),addIssueToContext(no,{code:ZodIssueCode.not_multiple_of,multipleOf:oo.value,message:oo.message}),ro.dirty()):oo.kind==="finite"?Number.isFinite(ue.data)||(no=this._getOrReturnCtx(ue,no),addIssueToContext(no,{code:ZodIssueCode.not_finite,message:oo.message}),ro.dirty()):util$h.assertNever(oo);return{status:ro.value,value:ue.data}}gte(ue,eo){return this.setLimit("min",ue,!0,errorUtil.toString(eo))}gt(ue,eo){return this.setLimit("min",ue,!1,errorUtil.toString(eo))}lte(ue,eo){return this.setLimit("max",ue,!0,errorUtil.toString(eo))}lt(ue,eo){return this.setLimit("max",ue,!1,errorUtil.toString(eo))}setLimit(ue,eo,no,ro){return new ZodNumber({...this._def,checks:[...this._def.checks,{kind:ue,value:eo,inclusive:no,message:errorUtil.toString(ro)}]})}_addCheck(ue){return new ZodNumber({...this._def,checks:[...this._def.checks,ue]})}int(ue){return this._addCheck({kind:"int",message:errorUtil.toString(ue)})}positive(ue){return this._addCheck({kind:"min",value:0,inclusive:!1,message:errorUtil.toString(ue)})}negative(ue){return this._addCheck({kind:"max",value:0,inclusive:!1,message:errorUtil.toString(ue)})}nonpositive(ue){return this._addCheck({kind:"max",value:0,inclusive:!0,message:errorUtil.toString(ue)})}nonnegative(ue){return this._addCheck({kind:"min",value:0,inclusive:!0,message:errorUtil.toString(ue)})}multipleOf(ue,eo){return this._addCheck({kind:"multipleOf",value:ue,message:errorUtil.toString(eo)})}finite(ue){return this._addCheck({kind:"finite",message:errorUtil.toString(ue)})}safe(ue){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:errorUtil.toString(ue)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:errorUtil.toString(ue)})}get minValue(){let ue=null;for(const eo of this._def.checks)eo.kind==="min"&&(ue===null||eo.value>ue)&&(ue=eo.value);return ue}get maxValue(){let ue=null;for(const eo of this._def.checks)eo.kind==="max"&&(ue===null||eo.value<ue)&&(ue=eo.value);return ue}get isInt(){return!!this._def.checks.find(ue=>ue.kind==="int"||ue.kind==="multipleOf"&&util$h.isInteger(ue.value))}get isFinite(){let ue=null,eo=null;for(const no of this._def.checks){if(no.kind==="finite"||no.kind==="int"||no.kind==="multipleOf")return!0;no.kind==="min"?(eo===null||no.value>eo)&&(eo=no.value):no.kind==="max"&&(ue===null||no.value<ue)&&(ue=no.value)}return Number.isFinite(eo)&&Number.isFinite(ue)}}ZodNumber.create=to=>new ZodNumber({checks:[],typeName:ZodFirstPartyTypeKind.ZodNumber,coerce:(to==null?void 0:to.coerce)||!1,...processCreateParams(to)});class ZodBigInt extends ZodType{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(ue){if(this._def.coerce&&(ue.data=BigInt(ue.data)),this._getType(ue)!==ZodParsedType.bigint){const oo=this._getOrReturnCtx(ue);return addIssueToContext(oo,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.bigint,received:oo.parsedType}),INVALID$3}let no;const ro=new ParseStatus;for(const oo of this._def.checks)oo.kind==="min"?(oo.inclusive?ue.data<oo.value:ue.data<=oo.value)&&(no=this._getOrReturnCtx(ue,no),addIssueToContext(no,{code:ZodIssueCode.too_small,type:"bigint",minimum:oo.value,inclusive:oo.inclusive,message:oo.message}),ro.dirty()):oo.kind==="max"?(oo.inclusive?ue.data>oo.value:ue.data>=oo.value)&&(no=this._getOrReturnCtx(ue,no),addIssueToContext(no,{code:ZodIssueCode.too_big,type:"bigint",maximum:oo.value,inclusive:oo.inclusive,message:oo.message}),ro.dirty()):oo.kind==="multipleOf"?ue.data%oo.value!==BigInt(0)&&(no=this._getOrReturnCtx(ue,no),addIssueToContext(no,{code:ZodIssueCode.not_multiple_of,multipleOf:oo.value,message:oo.message}),ro.dirty()):util$h.assertNever(oo);return{status:ro.value,value:ue.data}}gte(ue,eo){return this.setLimit("min",ue,!0,errorUtil.toString(eo))}gt(ue,eo){return this.setLimit("min",ue,!1,errorUtil.toString(eo))}lte(ue,eo){return this.setLimit("max",ue,!0,errorUtil.toString(eo))}lt(ue,eo){return this.setLimit("max",ue,!1,errorUtil.toString(eo))}setLimit(ue,eo,no,ro){return new ZodBigInt({...this._def,checks:[...this._def.checks,{kind:ue,value:eo,inclusive:no,message:errorUtil.toString(ro)}]})}_addCheck(ue){return new ZodBigInt({...this._def,checks:[...this._def.checks,ue]})}positive(ue){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:errorUtil.toString(ue)})}negative(ue){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:errorUtil.toString(ue)})}nonpositive(ue){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:errorUtil.toString(ue)})}nonnegative(ue){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:errorUtil.toString(ue)})}multipleOf(ue,eo){return this._addCheck({kind:"multipleOf",value:ue,message:errorUtil.toString(eo)})}get minValue(){let ue=null;for(const eo of this._def.checks)eo.kind==="min"&&(ue===null||eo.value>ue)&&(ue=eo.value);return ue}get maxValue(){let ue=null;for(const eo of this._def.checks)eo.kind==="max"&&(ue===null||eo.value<ue)&&(ue=eo.value);return ue}}ZodBigInt.create=to=>{var ue;return new ZodBigInt({checks:[],typeName:ZodFirstPartyTypeKind.ZodBigInt,coerce:(ue=to==null?void 0:to.coerce)!==null&&ue!==void 0?ue:!1,...processCreateParams(to)})};class ZodBoolean extends ZodType{_parse(ue){if(this._def.coerce&&(ue.data=!!ue.data),this._getType(ue)!==ZodParsedType.boolean){const no=this._getOrReturnCtx(ue);return addIssueToContext(no,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.boolean,received:no.parsedType}),INVALID$3}return OK(ue.data)}}ZodBoolean.create=to=>new ZodBoolean({typeName:ZodFirstPartyTypeKind.ZodBoolean,coerce:(to==null?void 0:to.coerce)||!1,...processCreateParams(to)});class ZodDate extends ZodType{_parse(ue){if(this._def.coerce&&(ue.data=new Date(ue.data)),this._getType(ue)!==ZodParsedType.date){const oo=this._getOrReturnCtx(ue);return addIssueToContext(oo,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.date,received:oo.parsedType}),INVALID$3}if(isNaN(ue.data.getTime())){const oo=this._getOrReturnCtx(ue);return addIssueToContext(oo,{code:ZodIssueCode.invalid_date}),INVALID$3}const no=new ParseStatus;let ro;for(const oo of this._def.checks)oo.kind==="min"?ue.data.getTime()<oo.value&&(ro=this._getOrReturnCtx(ue,ro),addIssueToContext(ro,{code:ZodIssueCode.too_small,message:oo.message,inclusive:!0,exact:!1,minimum:oo.value,type:"date"}),no.dirty()):oo.kind==="max"?ue.data.getTime()>oo.value&&(ro=this._getOrReturnCtx(ue,ro),addIssueToContext(ro,{code:ZodIssueCode.too_big,message:oo.message,inclusive:!0,exact:!1,maximum:oo.value,type:"date"}),no.dirty()):util$h.assertNever(oo);return{status:no.value,value:new Date(ue.data.getTime())}}_addCheck(ue){return new ZodDate({...this._def,checks:[...this._def.checks,ue]})}min(ue,eo){return this._addCheck({kind:"min",value:ue.getTime(),message:errorUtil.toString(eo)})}max(ue,eo){return this._addCheck({kind:"max",value:ue.getTime(),message:errorUtil.toString(eo)})}get minDate(){let ue=null;for(const eo of this._def.checks)eo.kind==="min"&&(ue===null||eo.value>ue)&&(ue=eo.value);return ue!=null?new Date(ue):null}get maxDate(){let ue=null;for(const eo of this._def.checks)eo.kind==="max"&&(ue===null||eo.value<ue)&&(ue=eo.value);return ue!=null?new Date(ue):null}}ZodDate.create=to=>new ZodDate({checks:[],coerce:(to==null?void 0:to.coerce)||!1,typeName:ZodFirstPartyTypeKind.ZodDate,...processCreateParams(to)});class ZodSymbol extends ZodType{_parse(ue){if(this._getType(ue)!==ZodParsedType.symbol){const no=this._getOrReturnCtx(ue);return addIssueToContext(no,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.symbol,received:no.parsedType}),INVALID$3}return OK(ue.data)}}ZodSymbol.create=to=>new ZodSymbol({typeName:ZodFirstPartyTypeKind.ZodSymbol,...processCreateParams(to)});class ZodUndefined extends ZodType{_parse(ue){if(this._getType(ue)!==ZodParsedType.undefined){const no=this._getOrReturnCtx(ue);return addIssueToContext(no,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.undefined,received:no.parsedType}),INVALID$3}return OK(ue.data)}}ZodUndefined.create=to=>new ZodUndefined({typeName:ZodFirstPartyTypeKind.ZodUndefined,...processCreateParams(to)});class ZodNull extends ZodType{_parse(ue){if(this._getType(ue)!==ZodParsedType.null){const no=this._getOrReturnCtx(ue);return addIssueToContext(no,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.null,received:no.parsedType}),INVALID$3}return OK(ue.data)}}ZodNull.create=to=>new ZodNull({typeName:ZodFirstPartyTypeKind.ZodNull,...processCreateParams(to)});class ZodAny extends ZodType{constructor(){super(...arguments),this._any=!0}_parse(ue){return OK(ue.data)}}ZodAny.create=to=>new ZodAny({typeName:ZodFirstPartyTypeKind.ZodAny,...processCreateParams(to)});class ZodUnknown extends ZodType{constructor(){super(...arguments),this._unknown=!0}_parse(ue){return OK(ue.data)}}ZodUnknown.create=to=>new ZodUnknown({typeName:ZodFirstPartyTypeKind.ZodUnknown,...processCreateParams(to)});class ZodNever extends ZodType{_parse(ue){const eo=this._getOrReturnCtx(ue);return addIssueToContext(eo,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.never,received:eo.parsedType}),INVALID$3}}ZodNever.create=to=>new ZodNever({typeName:ZodFirstPartyTypeKind.ZodNever,...processCreateParams(to)});class ZodVoid extends ZodType{_parse(ue){if(this._getType(ue)!==ZodParsedType.undefined){const no=this._getOrReturnCtx(ue);return addIssueToContext(no,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.void,received:no.parsedType}),INVALID$3}return OK(ue.data)}}ZodVoid.create=to=>new ZodVoid({typeName:ZodFirstPartyTypeKind.ZodVoid,...processCreateParams(to)});class ZodArray extends ZodType{_parse(ue){const{ctx:eo,status:no}=this._processInputParams(ue),ro=this._def;if(eo.parsedType!==ZodParsedType.array)return addIssueToContext(eo,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.array,received:eo.parsedType}),INVALID$3;if(ro.exactLength!==null){const io=eo.data.length>ro.exactLength.value,ao=eo.data.length<ro.exactLength.value;(io||ao)&&(addIssueToContext(eo,{code:io?ZodIssueCode.too_big:ZodIssueCode.too_small,minimum:ao?ro.exactLength.value:void 0,maximum:io?ro.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:ro.exactLength.message}),no.dirty())}if(ro.minLength!==null&&eo.data.length<ro.minLength.value&&(addIssueToContext(eo,{code:ZodIssueCode.too_small,minimum:ro.minLength.value,type:"array",inclusive:!0,exact:!1,message:ro.minLength.message}),no.dirty()),ro.maxLength!==null&&eo.data.length>ro.maxLength.value&&(addIssueToContext(eo,{code:ZodIssueCode.too_big,maximum:ro.maxLength.value,type:"array",inclusive:!0,exact:!1,message:ro.maxLength.message}),no.dirty()),eo.common.async)return Promise.all([...eo.data].map((io,ao)=>ro.type._parseAsync(new ParseInputLazyPath(eo,io,eo.path,ao)))).then(io=>ParseStatus.mergeArray(no,io));const oo=[...eo.data].map((io,ao)=>ro.type._parseSync(new ParseInputLazyPath(eo,io,eo.path,ao)));return ParseStatus.mergeArray(no,oo)}get element(){return this._def.type}min(ue,eo){return new ZodArray({...this._def,minLength:{value:ue,message:errorUtil.toString(eo)}})}max(ue,eo){return new ZodArray({...this._def,maxLength:{value:ue,message:errorUtil.toString(eo)}})}length(ue,eo){return new ZodArray({...this._def,exactLength:{value:ue,message:errorUtil.toString(eo)}})}nonempty(ue){return this.min(1,ue)}}ZodArray.create=(to,ue)=>new ZodArray({type:to,minLength:null,maxLength:null,exactLength:null,typeName:ZodFirstPartyTypeKind.ZodArray,...processCreateParams(ue)});function deepPartialify(to){if(to instanceof ZodObject){const ue={};for(const eo in to.shape){const no=to.shape[eo];ue[eo]=ZodOptional.create(deepPartialify(no))}return new ZodObject({...to._def,shape:()=>ue})}else return to instanceof ZodArray?new ZodArray({...to._def,type:deepPartialify(to.element)}):to instanceof ZodOptional?ZodOptional.create(deepPartialify(to.unwrap())):to instanceof ZodNullable?ZodNullable.create(deepPartialify(to.unwrap())):to instanceof ZodTuple?ZodTuple.create(to.items.map(ue=>deepPartialify(ue))):to}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 ue=this._def.shape(),eo=util$h.objectKeys(ue);return this._cached={shape:ue,keys:eo}}_parse(ue){if(this._getType(ue)!==ZodParsedType.object){const lo=this._getOrReturnCtx(ue);return addIssueToContext(lo,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.object,received:lo.parsedType}),INVALID$3}const{status:no,ctx:ro}=this._processInputParams(ue),{shape:oo,keys:io}=this._getCached(),ao=[];if(!(this._def.catchall instanceof ZodNever&&this._def.unknownKeys==="strip"))for(const lo in ro.data)io.includes(lo)||ao.push(lo);const so=[];for(const lo of io){const co=oo[lo],uo=ro.data[lo];so.push({key:{status:"valid",value:lo},value:co._parse(new ParseInputLazyPath(ro,uo,ro.path,lo)),alwaysSet:lo in ro.data})}if(this._def.catchall instanceof ZodNever){const lo=this._def.unknownKeys;if(lo==="passthrough")for(const co of ao)so.push({key:{status:"valid",value:co},value:{status:"valid",value:ro.data[co]}});else if(lo==="strict")ao.length>0&&(addIssueToContext(ro,{code:ZodIssueCode.unrecognized_keys,keys:ao}),no.dirty());else if(lo!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const lo=this._def.catchall;for(const co of ao){const uo=ro.data[co];so.push({key:{status:"valid",value:co},value:lo._parse(new ParseInputLazyPath(ro,uo,ro.path,co)),alwaysSet:co in ro.data})}}return ro.common.async?Promise.resolve().then(async()=>{const lo=[];for(const co of so){const uo=await co.key,fo=await co.value;lo.push({key:uo,value:fo,alwaysSet:co.alwaysSet})}return lo}).then(lo=>ParseStatus.mergeObjectSync(no,lo)):ParseStatus.mergeObjectSync(no,so)}get shape(){return this._def.shape()}strict(ue){return errorUtil.errToObj,new ZodObject({...this._def,unknownKeys:"strict",...ue!==void 0?{errorMap:(eo,no)=>{var ro,oo,io,ao;const so=(io=(oo=(ro=this._def).errorMap)===null||oo===void 0?void 0:oo.call(ro,eo,no).message)!==null&&io!==void 0?io:no.defaultError;return eo.code==="unrecognized_keys"?{message:(ao=errorUtil.errToObj(ue).message)!==null&&ao!==void 0?ao:so}:{message:so}}}:{}})}strip(){return new ZodObject({...this._def,unknownKeys:"strip"})}passthrough(){return new ZodObject({...this._def,unknownKeys:"passthrough"})}extend(ue){return new ZodObject({...this._def,shape:()=>({...this._def.shape(),...ue})})}merge(ue){return new ZodObject({unknownKeys:ue._def.unknownKeys,catchall:ue._def.catchall,shape:()=>({...this._def.shape(),...ue._def.shape()}),typeName:ZodFirstPartyTypeKind.ZodObject})}setKey(ue,eo){return this.augment({[ue]:eo})}catchall(ue){return new ZodObject({...this._def,catchall:ue})}pick(ue){const eo={};return util$h.objectKeys(ue).forEach(no=>{ue[no]&&this.shape[no]&&(eo[no]=this.shape[no])}),new ZodObject({...this._def,shape:()=>eo})}omit(ue){const eo={};return util$h.objectKeys(this.shape).forEach(no=>{ue[no]||(eo[no]=this.shape[no])}),new ZodObject({...this._def,shape:()=>eo})}deepPartial(){return deepPartialify(this)}partial(ue){const eo={};return util$h.objectKeys(this.shape).forEach(no=>{const ro=this.shape[no];ue&&!ue[no]?eo[no]=ro:eo[no]=ro.optional()}),new ZodObject({...this._def,shape:()=>eo})}required(ue){const eo={};return util$h.objectKeys(this.shape).forEach(no=>{if(ue&&!ue[no])eo[no]=this.shape[no];else{let oo=this.shape[no];for(;oo instanceof ZodOptional;)oo=oo._def.innerType;eo[no]=oo}}),new ZodObject({...this._def,shape:()=>eo})}keyof(){return createZodEnum(util$h.objectKeys(this.shape))}}ZodObject.create=(to,ue)=>new ZodObject({shape:()=>to,unknownKeys:"strip",catchall:ZodNever.create(),typeName:ZodFirstPartyTypeKind.ZodObject,...processCreateParams(ue)});ZodObject.strictCreate=(to,ue)=>new ZodObject({shape:()=>to,unknownKeys:"strict",catchall:ZodNever.create(),typeName:ZodFirstPartyTypeKind.ZodObject,...processCreateParams(ue)});ZodObject.lazycreate=(to,ue)=>new ZodObject({shape:to,unknownKeys:"strip",catchall:ZodNever.create(),typeName:ZodFirstPartyTypeKind.ZodObject,...processCreateParams(ue)});class ZodUnion extends ZodType{_parse(ue){const{ctx:eo}=this._processInputParams(ue),no=this._def.options;function ro(oo){for(const ao of oo)if(ao.result.status==="valid")return ao.result;for(const ao of oo)if(ao.result.status==="dirty")return eo.common.issues.push(...ao.ctx.common.issues),ao.result;const io=oo.map(ao=>new ZodError(ao.ctx.common.issues));return addIssueToContext(eo,{code:ZodIssueCode.invalid_union,unionErrors:io}),INVALID$3}if(eo.common.async)return Promise.all(no.map(async oo=>{const io={...eo,common:{...eo.common,issues:[]},parent:null};return{result:await oo._parseAsync({data:eo.data,path:eo.path,parent:io}),ctx:io}})).then(ro);{let oo;const io=[];for(const so of no){const lo={...eo,common:{...eo.common,issues:[]},parent:null},co=so._parseSync({data:eo.data,path:eo.path,parent:lo});if(co.status==="valid")return co;co.status==="dirty"&&!oo&&(oo={result:co,ctx:lo}),lo.common.issues.length&&io.push(lo.common.issues)}if(oo)return eo.common.issues.push(...oo.ctx.common.issues),oo.result;const ao=io.map(so=>new ZodError(so));return addIssueToContext(eo,{code:ZodIssueCode.invalid_union,unionErrors:ao}),INVALID$3}}get options(){return this._def.options}}ZodUnion.create=(to,ue)=>new ZodUnion({options:to,typeName:ZodFirstPartyTypeKind.ZodUnion,...processCreateParams(ue)});const getDiscriminator=to=>to instanceof ZodLazy?getDiscriminator(to.schema):to instanceof ZodEffects?getDiscriminator(to.innerType()):to instanceof ZodLiteral?[to.value]:to instanceof ZodEnum?to.options:to instanceof ZodNativeEnum?util$h.objectValues(to.enum):to instanceof ZodDefault?getDiscriminator(to._def.innerType):to instanceof ZodUndefined?[void 0]:to instanceof ZodNull?[null]:to instanceof ZodOptional?[void 0,...getDiscriminator(to.unwrap())]:to instanceof ZodNullable?[null,...getDiscriminator(to.unwrap())]:to instanceof ZodBranded||to instanceof ZodReadonly?getDiscriminator(to.unwrap()):to instanceof ZodCatch?getDiscriminator(to._def.innerType):[];class ZodDiscriminatedUnion extends ZodType{_parse(ue){const{ctx:eo}=this._processInputParams(ue);if(eo.parsedType!==ZodParsedType.object)return addIssueToContext(eo,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.object,received:eo.parsedType}),INVALID$3;const no=this.discriminator,ro=eo.data[no],oo=this.optionsMap.get(ro);return oo?eo.common.async?oo._parseAsync({data:eo.data,path:eo.path,parent:eo}):oo._parseSync({data:eo.data,path:eo.path,parent:eo}):(addIssueToContext(eo,{code:ZodIssueCode.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[no]}),INVALID$3)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(ue,eo,no){const ro=new Map;for(const oo of eo){const io=getDiscriminator(oo.shape[ue]);if(!io.length)throw new Error(`A discriminator value for key \`${ue}\` could not be extracted from all schema options`);for(const ao of io){if(ro.has(ao))throw new Error(`Discriminator property ${String(ue)} has duplicate value ${String(ao)}`);ro.set(ao,oo)}}return new ZodDiscriminatedUnion({typeName:ZodFirstPartyTypeKind.ZodDiscriminatedUnion,discriminator:ue,options:eo,optionsMap:ro,...processCreateParams(no)})}}function mergeValues(to,ue){const eo=getParsedType(to),no=getParsedType(ue);if(to===ue)return{valid:!0,data:to};if(eo===ZodParsedType.object&&no===ZodParsedType.object){const ro=util$h.objectKeys(ue),oo=util$h.objectKeys(to).filter(ao=>ro.indexOf(ao)!==-1),io={...to,...ue};for(const ao of oo){const so=mergeValues(to[ao],ue[ao]);if(!so.valid)return{valid:!1};io[ao]=so.data}return{valid:!0,data:io}}else if(eo===ZodParsedType.array&&no===ZodParsedType.array){if(to.length!==ue.length)return{valid:!1};const ro=[];for(let oo=0;oo<to.length;oo++){const io=to[oo],ao=ue[oo],so=mergeValues(io,ao);if(!so.valid)return{valid:!1};ro.push(so.data)}return{valid:!0,data:ro}}else return eo===ZodParsedType.date&&no===ZodParsedType.date&&+to==+ue?{valid:!0,data:to}:{valid:!1}}class ZodIntersection extends ZodType{_parse(ue){const{status:eo,ctx:no}=this._processInputParams(ue),ro=(oo,io)=>{if(isAborted(oo)||isAborted(io))return INVALID$3;const ao=mergeValues(oo.value,io.value);return ao.valid?((isDirty(oo)||isDirty(io))&&eo.dirty(),{status:eo.value,value:ao.data}):(addIssueToContext(no,{code:ZodIssueCode.invalid_intersection_types}),INVALID$3)};return no.common.async?Promise.all([this._def.left._parseAsync({data:no.data,path:no.path,parent:no}),this._def.right._parseAsync({data:no.data,path:no.path,parent:no})]).then(([oo,io])=>ro(oo,io)):ro(this._def.left._parseSync({data:no.data,path:no.path,parent:no}),this._def.right._parseSync({data:no.data,path:no.path,parent:no}))}}ZodIntersection.create=(to,ue,eo)=>new ZodIntersection({left:to,right:ue,typeName:ZodFirstPartyTypeKind.ZodIntersection,...processCreateParams(eo)});class ZodTuple extends ZodType{_parse(ue){const{status:eo,ctx:no}=this._processInputParams(ue);if(no.parsedType!==ZodParsedType.array)return addIssueToContext(no,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.array,received:no.parsedType}),INVALID$3;if(no.data.length<this._def.items.length)return addIssueToContext(no,{code:ZodIssueCode.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),INVALID$3;!this._def.rest&&no.data.length>this._def.items.length&&(addIssueToContext(no,{code:ZodIssueCode.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),eo.dirty());const oo=[...no.data].map((io,ao)=>{const so=this._def.items[ao]||this._def.rest;return so?so._parse(new ParseInputLazyPath(no,io,no.path,ao)):null}).filter(io=>!!io);return no.common.async?Promise.all(oo).then(io=>ParseStatus.mergeArray(eo,io)):ParseStatus.mergeArray(eo,oo)}get items(){return this._def.items}rest(ue){return new ZodTuple({...this._def,rest:ue})}}ZodTuple.create=(to,ue)=>{if(!Array.isArray(to))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new ZodTuple({items:to,typeName:ZodFirstPartyTypeKind.ZodTuple,rest:null,...processCreateParams(ue)})};class ZodRecord extends ZodType{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(ue){const{status:eo,ctx:no}=this._processInputParams(ue);if(no.parsedType!==ZodParsedType.object)return addIssueToContext(no,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.object,received:no.parsedType}),INVALID$3;const ro=[],oo=this._def.keyType,io=this._def.valueType;for(const ao in no.data)ro.push({key:oo._parse(new ParseInputLazyPath(no,ao,no.path,ao)),value:io._parse(new ParseInputLazyPath(no,no.data[ao],no.path,ao)),alwaysSet:ao in no.data});return no.common.async?ParseStatus.mergeObjectAsync(eo,ro):ParseStatus.mergeObjectSync(eo,ro)}get element(){return this._def.valueType}static create(ue,eo,no){return eo instanceof ZodType?new ZodRecord({keyType:ue,valueType:eo,typeName:ZodFirstPartyTypeKind.ZodRecord,...processCreateParams(no)}):new ZodRecord({keyType:ZodString.create(),valueType:ue,typeName:ZodFirstPartyTypeKind.ZodRecord,...processCreateParams(eo)})}}class ZodMap extends ZodType{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(ue){const{status:eo,ctx:no}=this._processInputParams(ue);if(no.parsedType!==ZodParsedType.map)return addIssueToContext(no,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.map,received:no.parsedType}),INVALID$3;const ro=this._def.keyType,oo=this._def.valueType,io=[...no.data.entries()].map(([ao,so],lo)=>({key:ro._parse(new ParseInputLazyPath(no,ao,no.path,[lo,"key"])),value:oo._parse(new ParseInputLazyPath(no,so,no.path,[lo,"value"]))}));if(no.common.async){const ao=new Map;return Promise.resolve().then(async()=>{for(const so of io){const lo=await so.key,co=await so.value;if(lo.status==="aborted"||co.status==="aborted")return INVALID$3;(lo.status==="dirty"||co.status==="dirty")&&eo.dirty(),ao.set(lo.value,co.value)}return{status:eo.value,value:ao}})}else{const ao=new Map;for(const so of io){const lo=so.key,co=so.value;if(lo.status==="aborted"||co.status==="aborted")return INVALID$3;(lo.status==="dirty"||co.status==="dirty")&&eo.dirty(),ao.set(lo.value,co.value)}return{status:eo.value,value:ao}}}}ZodMap.create=(to,ue,eo)=>new ZodMap({valueType:ue,keyType:to,typeName:ZodFirstPartyTypeKind.ZodMap,...processCreateParams(eo)});class ZodSet extends ZodType{_parse(ue){const{status:eo,ctx:no}=this._processInputParams(ue);if(no.parsedType!==ZodParsedType.set)return addIssueToContext(no,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.set,received:no.parsedType}),INVALID$3;const ro=this._def;ro.minSize!==null&&no.data.size<ro.minSize.value&&(addIssueToContext(no,{code:ZodIssueCode.too_small,minimum:ro.minSize.value,type:"set",inclusive:!0,exact:!1,message:ro.minSize.message}),eo.dirty()),ro.maxSize!==null&&no.data.size>ro.maxSize.value&&(addIssueToContext(no,{code:ZodIssueCode.too_big,maximum:ro.maxSize.value,type:"set",inclusive:!0,exact:!1,message:ro.maxSize.message}),eo.dirty());const oo=this._def.valueType;function io(so){const lo=new Set;for(const co of so){if(co.status==="aborted")return INVALID$3;co.status==="dirty"&&eo.dirty(),lo.add(co.value)}return{status:eo.value,value:lo}}const ao=[...no.data.values()].map((so,lo)=>oo._parse(new ParseInputLazyPath(no,so,no.path,lo)));return no.common.async?Promise.all(ao).then(so=>io(so)):io(ao)}min(ue,eo){return new ZodSet({...this._def,minSize:{value:ue,message:errorUtil.toString(eo)}})}max(ue,eo){return new ZodSet({...this._def,maxSize:{value:ue,message:errorUtil.toString(eo)}})}size(ue,eo){return this.min(ue,eo).max(ue,eo)}nonempty(ue){return this.min(1,ue)}}ZodSet.create=(to,ue)=>new ZodSet({valueType:to,minSize:null,maxSize:null,typeName:ZodFirstPartyTypeKind.ZodSet,...processCreateParams(ue)});class ZodFunction extends ZodType{constructor(){super(...arguments),this.validate=this.implement}_parse(ue){const{ctx:eo}=this._processInputParams(ue);if(eo.parsedType!==ZodParsedType.function)return addIssueToContext(eo,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.function,received:eo.parsedType}),INVALID$3;function no(ao,so){return makeIssue({data:ao,path:eo.path,errorMaps:[eo.common.contextualErrorMap,eo.schemaErrorMap,getErrorMap(),errorMap].filter(lo=>!!lo),issueData:{code:ZodIssueCode.invalid_arguments,argumentsError:so}})}function ro(ao,so){return makeIssue({data:ao,path:eo.path,errorMaps:[eo.common.contextualErrorMap,eo.schemaErrorMap,getErrorMap(),errorMap].filter(lo=>!!lo),issueData:{code:ZodIssueCode.invalid_return_type,returnTypeError:so}})}const oo={errorMap:eo.common.contextualErrorMap},io=eo.data;if(this._def.returns instanceof ZodPromise){const ao=this;return OK(async function(...so){const lo=new ZodError([]),co=await ao._def.args.parseAsync(so,oo).catch(po=>{throw lo.addIssue(no(so,po)),lo}),uo=await Reflect.apply(io,this,co);return await ao._def.returns._def.type.parseAsync(uo,oo).catch(po=>{throw lo.addIssue(ro(uo,po)),lo})})}else{const ao=this;return OK(function(...so){const lo=ao._def.args.safeParse(so,oo);if(!lo.success)throw new ZodError([no(so,lo.error)]);const co=Reflect.apply(io,this,lo.data),uo=ao._def.returns.safeParse(co,oo);if(!uo.success)throw new ZodError([ro(co,uo.error)]);return uo.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...ue){return new ZodFunction({...this._def,args:ZodTuple.create(ue).rest(ZodUnknown.create())})}returns(ue){return new ZodFunction({...this._def,returns:ue})}implement(ue){return this.parse(ue)}strictImplement(ue){return this.parse(ue)}static create(ue,eo,no){return new ZodFunction({args:ue||ZodTuple.create([]).rest(ZodUnknown.create()),returns:eo||ZodUnknown.create(),typeName:ZodFirstPartyTypeKind.ZodFunction,...processCreateParams(no)})}}class ZodLazy extends ZodType{get schema(){return this._def.getter()}_parse(ue){const{ctx:eo}=this._processInputParams(ue);return this._def.getter()._parse({data:eo.data,path:eo.path,parent:eo})}}ZodLazy.create=(to,ue)=>new ZodLazy({getter:to,typeName:ZodFirstPartyTypeKind.ZodLazy,...processCreateParams(ue)});class ZodLiteral extends ZodType{_parse(ue){if(ue.data!==this._def.value){const eo=this._getOrReturnCtx(ue);return addIssueToContext(eo,{received:eo.data,code:ZodIssueCode.invalid_literal,expected:this._def.value}),INVALID$3}return{status:"valid",value:ue.data}}get value(){return this._def.value}}ZodLiteral.create=(to,ue)=>new ZodLiteral({value:to,typeName:ZodFirstPartyTypeKind.ZodLiteral,...processCreateParams(ue)});function createZodEnum(to,ue){return new ZodEnum({values:to,typeName:ZodFirstPartyTypeKind.ZodEnum,...processCreateParams(ue)})}class ZodEnum extends ZodType{constructor(){super(...arguments),_ZodEnum_cache.set(this,void 0)}_parse(ue){if(typeof ue.data!="string"){const eo=this._getOrReturnCtx(ue),no=this._def.values;return addIssueToContext(eo,{expected:util$h.joinValues(no),received:eo.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(ue.data)){const eo=this._getOrReturnCtx(ue),no=this._def.values;return addIssueToContext(eo,{received:eo.data,code:ZodIssueCode.invalid_enum_value,options:no}),INVALID$3}return OK(ue.data)}get options(){return this._def.values}get enum(){const ue={};for(const eo of this._def.values)ue[eo]=eo;return ue}get Values(){const ue={};for(const eo of this._def.values)ue[eo]=eo;return ue}get Enum(){const ue={};for(const eo of this._def.values)ue[eo]=eo;return ue}extract(ue,eo=this._def){return ZodEnum.create(ue,{...this._def,...eo})}exclude(ue,eo=this._def){return ZodEnum.create(this.options.filter(no=>!ue.includes(no)),{...this._def,...eo})}}_ZodEnum_cache=new WeakMap;ZodEnum.create=createZodEnum;class ZodNativeEnum extends ZodType{constructor(){super(...arguments),_ZodNativeEnum_cache.set(this,void 0)}_parse(ue){const eo=util$h.getValidEnumValues(this._def.values),no=this._getOrReturnCtx(ue);if(no.parsedType!==ZodParsedType.string&&no.parsedType!==ZodParsedType.number){const ro=util$h.objectValues(eo);return addIssueToContext(no,{expected:util$h.joinValues(ro),received:no.parsedType,code:ZodIssueCode.invalid_type}),INVALID$3}if(__classPrivateFieldGet(this,_ZodNativeEnum_cache,"f")||__classPrivateFieldSet(this,_ZodNativeEnum_cache,new Set(util$h.getValidEnumValues(this._def.values)),"f"),!__classPrivateFieldGet(this,_ZodNativeEnum_cache,"f").has(ue.data)){const ro=util$h.objectValues(eo);return addIssueToContext(no,{received:no.data,code:ZodIssueCode.invalid_enum_value,options:ro}),INVALID$3}return OK(ue.data)}get enum(){return this._def.values}}_ZodNativeEnum_cache=new WeakMap;ZodNativeEnum.create=(to,ue)=>new ZodNativeEnum({values:to,typeName:ZodFirstPartyTypeKind.ZodNativeEnum,...processCreateParams(ue)});class ZodPromise extends ZodType{unwrap(){return this._def.type}_parse(ue){const{ctx:eo}=this._processInputParams(ue);if(eo.parsedType!==ZodParsedType.promise&&eo.common.async===!1)return addIssueToContext(eo,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.promise,received:eo.parsedType}),INVALID$3;const no=eo.parsedType===ZodParsedType.promise?eo.data:Promise.resolve(eo.data);return OK(no.then(ro=>this._def.type.parseAsync(ro,{path:eo.path,errorMap:eo.common.contextualErrorMap})))}}ZodPromise.create=(to,ue)=>new ZodPromise({type:to,typeName:ZodFirstPartyTypeKind.ZodPromise,...processCreateParams(ue)});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(ue){const{status:eo,ctx:no}=this._processInputParams(ue),ro=this._def.effect||null,oo={addIssue:io=>{addIssueToContext(no,io),io.fatal?eo.abort():eo.dirty()},get path(){return no.path}};if(oo.addIssue=oo.addIssue.bind(oo),ro.type==="preprocess"){const io=ro.transform(no.data,oo);if(no.common.async)return Promise.resolve(io).then(async ao=>{if(eo.value==="aborted")return INVALID$3;const so=await this._def.schema._parseAsync({data:ao,path:no.path,parent:no});return so.status==="aborted"?INVALID$3:so.status==="dirty"||eo.value==="dirty"?DIRTY(so.value):so});{if(eo.value==="aborted")return INVALID$3;const ao=this._def.schema._parseSync({data:io,path:no.path,parent:no});return ao.status==="aborted"?INVALID$3:ao.status==="dirty"||eo.value==="dirty"?DIRTY(ao.value):ao}}if(ro.type==="refinement"){const io=ao=>{const so=ro.refinement(ao,oo);if(no.common.async)return Promise.resolve(so);if(so instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return ao};if(no.common.async===!1){const ao=this._def.schema._parseSync({data:no.data,path:no.path,parent:no});return ao.status==="aborted"?INVALID$3:(ao.status==="dirty"&&eo.dirty(),io(ao.value),{status:eo.value,value:ao.value})}else return this._def.schema._parseAsync({data:no.data,path:no.path,parent:no}).then(ao=>ao.status==="aborted"?INVALID$3:(ao.status==="dirty"&&eo.dirty(),io(ao.value).then(()=>({status:eo.value,value:ao.value}))))}if(ro.type==="transform")if(no.common.async===!1){const io=this._def.schema._parseSync({data:no.data,path:no.path,parent:no});if(!isValid$2(io))return io;const ao=ro.transform(io.value,oo);if(ao instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:eo.value,value:ao}}else return this._def.schema._parseAsync({data:no.data,path:no.path,parent:no}).then(io=>isValid$2(io)?Promise.resolve(ro.transform(io.value,oo)).then(ao=>({status:eo.value,value:ao})):io);util$h.assertNever(ro)}}ZodEffects.create=(to,ue,eo)=>new ZodEffects({schema:to,typeName:ZodFirstPartyTypeKind.ZodEffects,effect:ue,...processCreateParams(eo)});ZodEffects.createWithPreprocess=(to,ue,eo)=>new ZodEffects({schema:ue,effect:{type:"preprocess",transform:to},typeName:ZodFirstPartyTypeKind.ZodEffects,...processCreateParams(eo)});class ZodOptional extends ZodType{_parse(ue){return this._getType(ue)===ZodParsedType.undefined?OK(void 0):this._def.innerType._parse(ue)}unwrap(){return this._def.innerType}}ZodOptional.create=(to,ue)=>new ZodOptional({innerType:to,typeName:ZodFirstPartyTypeKind.ZodOptional,...processCreateParams(ue)});class ZodNullable extends ZodType{_parse(ue){return this._getType(ue)===ZodParsedType.null?OK(null):this._def.innerType._parse(ue)}unwrap(){return this._def.innerType}}ZodNullable.create=(to,ue)=>new ZodNullable({innerType:to,typeName:ZodFirstPartyTypeKind.ZodNullable,...processCreateParams(ue)});class ZodDefault extends ZodType{_parse(ue){const{ctx:eo}=this._processInputParams(ue);let no=eo.data;return eo.parsedType===ZodParsedType.undefined&&(no=this._def.defaultValue()),this._def.innerType._parse({data:no,path:eo.path,parent:eo})}removeDefault(){return this._def.innerType}}ZodDefault.create=(to,ue)=>new ZodDefault({innerType:to,typeName:ZodFirstPartyTypeKind.ZodDefault,defaultValue:typeof ue.default=="function"?ue.default:()=>ue.default,...processCreateParams(ue)});class ZodCatch extends ZodType{_parse(ue){const{ctx:eo}=this._processInputParams(ue),no={...eo,common:{...eo.common,issues:[]}},ro=this._def.innerType._parse({data:no.data,path:no.path,parent:{...no}});return isAsync(ro)?ro.then(oo=>({status:"valid",value:oo.status==="valid"?oo.value:this._def.catchValue({get error(){return new ZodError(no.common.issues)},input:no.data})})):{status:"valid",value:ro.status==="valid"?ro.value:this._def.catchValue({get error(){return new ZodError(no.common.issues)},input:no.data})}}removeCatch(){return this._def.innerType}}ZodCatch.create=(to,ue)=>new ZodCatch({innerType:to,typeName:ZodFirstPartyTypeKind.ZodCatch,catchValue:typeof ue.catch=="function"?ue.catch:()=>ue.catch,...processCreateParams(ue)});class ZodNaN extends ZodType{_parse(ue){if(this._getType(ue)!==ZodParsedType.nan){const no=this._getOrReturnCtx(ue);return addIssueToContext(no,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.nan,received:no.parsedType}),INVALID$3}return{status:"valid",value:ue.data}}}ZodNaN.create=to=>new ZodNaN({typeName:ZodFirstPartyTypeKind.ZodNaN,...processCreateParams(to)});const BRAND=Symbol("zod_brand");class ZodBranded extends ZodType{_parse(ue){const{ctx:eo}=this._processInputParams(ue),no=eo.data;return this._def.type._parse({data:no,path:eo.path,parent:eo})}unwrap(){return this._def.type}}class ZodPipeline extends ZodType{_parse(ue){const{status:eo,ctx:no}=this._processInputParams(ue);if(no.common.async)return(async()=>{const oo=await this._def.in._parseAsync({data:no.data,path:no.path,parent:no});return oo.status==="aborted"?INVALID$3:oo.status==="dirty"?(eo.dirty(),DIRTY(oo.value)):this._def.out._parseAsync({data:oo.value,path:no.path,parent:no})})();{const ro=this._def.in._parseSync({data:no.data,path:no.path,parent:no});return ro.status==="aborted"?INVALID$3:ro.status==="dirty"?(eo.dirty(),{status:"dirty",value:ro.value}):this._def.out._parseSync({data:ro.value,path:no.path,parent:no})}}static create(ue,eo){return new ZodPipeline({in:ue,out:eo,typeName:ZodFirstPartyTypeKind.ZodPipeline})}}class ZodReadonly extends ZodType{_parse(ue){const eo=this._def.innerType._parse(ue),no=ro=>(isValid$2(ro)&&(ro.value=Object.freeze(ro.value)),ro);return isAsync(eo)?eo.then(ro=>no(ro)):no(eo)}unwrap(){return this._def.innerType}}ZodReadonly.create=(to,ue)=>new ZodReadonly({innerType:to,typeName:ZodFirstPartyTypeKind.ZodReadonly,...processCreateParams(ue)});function custom(to,ue={},eo){return to?ZodAny.create().superRefine((no,ro)=>{var oo,io;if(!to(no)){const ao=typeof ue=="function"?ue(no):typeof ue=="string"?{message:ue}:ue,so=(io=(oo=ao.fatal)!==null&&oo!==void 0?oo:eo)!==null&&io!==void 0?io:!0,lo=typeof ao=="string"?{message:ao}:ao;ro.addIssue({code:"custom",...lo,fatal:so})}}):ZodAny.create()}const late={object:ZodObject.lazycreate};var ZodFirstPartyTypeKind;(function(to){to.ZodString="ZodString",to.ZodNumber="ZodNumber",to.ZodNaN="ZodNaN",to.ZodBigInt="ZodBigInt",to.ZodBoolean="ZodBoolean",to.ZodDate="ZodDate",to.ZodSymbol="ZodSymbol",to.ZodUndefined="ZodUndefined",to.ZodNull="ZodNull",to.ZodAny="ZodAny",to.ZodUnknown="ZodUnknown",to.ZodNever="ZodNever",to.ZodVoid="ZodVoid",to.ZodArray="ZodArray",to.ZodObject="ZodObject",to.ZodUnion="ZodUnion",to.ZodDiscriminatedUnion="ZodDiscriminatedUnion",to.ZodIntersection="ZodIntersection",to.ZodTuple="ZodTuple",to.ZodRecord="ZodRecord",to.ZodMap="ZodMap",to.ZodSet="ZodSet",to.ZodFunction="ZodFunction",to.ZodLazy="ZodLazy",to.ZodLiteral="ZodLiteral",to.ZodEnum="ZodEnum",to.ZodEffects="ZodEffects",to.ZodNativeEnum="ZodNativeEnum",to.ZodOptional="ZodOptional",to.ZodNullable="ZodNullable",to.ZodDefault="ZodDefault",to.ZodCatch="ZodCatch",to.ZodPromise="ZodPromise",to.ZodBranded="ZodBranded",to.ZodPipeline="ZodPipeline",to.ZodReadonly="ZodReadonly"})(ZodFirstPartyTypeKind||(ZodFirstPartyTypeKind={}));const instanceOfType=(to,ue={message:`Input not instance of ${to.name}`})=>custom(eo=>eo instanceof to,ue),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$2=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$1={string:to=>ZodString.create({...to,coerce:!0}),number:to=>ZodNumber.create({...to,coerce:!0}),boolean:to=>ZodBoolean.create({...to,coerce:!0}),bigint:to=>ZodBigInt.create({...to,coerce:!0}),date:to=>ZodDate.create({...to,coerce:!0})},NEVER=INVALID$3;var z$1=Object.freeze({__proto__:null,defaultErrorMap:errorMap,setErrorMap,getErrorMap,makeIssue,EMPTY_PATH,addIssueToContext,ParseStatus,INVALID:INVALID$3,DIRTY,OK,isAborted,isDirty,isValid:isValid$2,isAsync,get util(){return util$h},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:coerce$1,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$2,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$1.string().refine(to=>to!==InternalSearchFilterOperator.COMPLEX_ID_OPERATOR,{message:`Key '${InternalSearchFilterOperator.COMPLEX_ID_OPERATOR}' is not allowed`}),stringBasicFilter=z$1.record(fieldKey,z$1.string()),basicFilter=z$1.record(fieldKey,z$1.any()),arrayFilter$2=z$1.record(fieldKey,z$1.union([z$1.any().array(),z$1.string()])),logicFilter=z$1.lazy(()=>z$1.object({conditions:z$1.array(z$1.object(queryFilterValidation))})),stringOrNumber=z$1.union([z$1.string(),z$1.number()]),queryFilterValidation={[BasicOperator.STRING]:stringBasicFilter.optional(),[BasicOperator.FUZZY]:stringBasicFilter.optional(),[RangeOperator.RANGE]:z$1.record(fieldKey,z$1.union([z$1.object({high:stringOrNumber,low:stringOrNumber}),z$1.object({high:stringOrNumber}),z$1.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$1.object({query:z$1.object({allOr:z$1.boolean().optional(),onEmptyFilter:z$1.nativeEnum(EmptyFilterOption).optional(),...queryFilterValidation}).optional(),paginate:z$1.boolean().optional(),bookmark:z$1.union([z$1.string(),z$1.number()]).nullish(),limit:z$1.number().optional(),sort:z$1.string().nullish(),sortOrder:z$1.nativeEnum(SortOrder).optional(),sortType:z$1.nativeEnum(SortType).nullish(),version:z$1.string().optional(),disableEscaping:z$1.boolean().optional(),countRows:z$1.boolean().optional()});var EventPublishType$1=(to=>(to.ENVIRONMENT_VARIABLE_UPGRADE_PANEL_OPENED="environment_variable_upgrade_panel_opened",to))(EventPublishType$1||{}),MaintenanceType=(to=>(to.SQS_MISSING="sqs_missing",to))(MaintenanceType||{}),DropPosition=(to=>(to.ABOVE="above",to.BELOW="below",to.INSIDE="inside",to))(DropPosition||{}),BindingMode=(to=>(to.Text="Text",to.JavaScript="JavaScript",to))(BindingMode||{}),SidePanel=(to=>(to.Bindings="FlashOn",to.Evaluation="Play",to.Snippets="Code",to))(SidePanel||{});const AIOperations={SUMMARISE_TEXT:{label:"Summarise Text",value:"SUMMARISE_TEXT"},CLEAN_DATA:{label:"Clean Data",value:"CLEAN_DATA"},TRANSLATE:{label:"Translate",value:"TRANSLATE"},CATEGORISE_TEXT:{label:"Categorise Text",value:"CATEGORISE_TEXT"},SENTIMENT_ANALYSIS:{label:"Sentiment Analysis",value:"SENTIMENT_ANALYSIS"},PROMPT:{label:"Prompt",value:"PROMPT"},SEARCH_WEB:{label:"Search Web",value:"SEARCH_WEB"}},OperationFieldTypes={MULTI_COLUMN:"columns",COLUMN:"column",BINDABLE_TEXT:"prompt"},OperationFields={[AIOperationEnum.SUMMARISE_TEXT]:{columns:OperationFieldTypeEnum.MULTI_COLUMN},[AIOperationEnum.CLEAN_DATA]:{column:OperationFieldTypeEnum.COLUMN},[AIOperationEnum.TRANSLATE]:{column:OperationFieldTypeEnum.COLUMN,language:OperationFieldTypeEnum.BINDABLE_TEXT},[AIOperationEnum.CATEGORISE_TEXT]:{columns:OperationFieldTypeEnum.MULTI_COLUMN,categories:OperationFieldTypeEnum.BINDABLE_TEXT},[AIOperationEnum.SENTIMENT_ANALYSIS]:{column:OperationFieldTypeEnum.COLUMN},[AIOperationEnum.PROMPT]:{prompt:OperationFieldTypeEnum.BINDABLE_TEXT},[AIOperationEnum.SEARCH_WEB]:{columns:OperationFieldTypeEnum.MULTI_COLUMN}};var Header$1=(to=>(to.API_KEY="x-budibase-api-key",to.LICENSE_KEY="x-budibase-license-key",to.API_VER="x-budibase-api-version",to.APP_ID="x-budibase-app-id",to.SESSION_ID="x-budibase-session-id",to.TYPE="x-budibase-type",to.PREVIEW_ROLE="x-budibase-role",to.TENANT_ID="x-budibase-tenant-id",to.VERIFICATION_CODE="x-budibase-verification-code",to.RETURN_VERIFICATION_CODE="x-budibase-return-verification-code",to.RESET_PASSWORD_CODE="x-budibase-reset-password-code",to.RETURN_RESET_PASSWORD_CODE="x-budibase-return-reset-password-code",to.TOKEN="x-budibase-token",to.CSRF_TOKEN="x-csrf-token",to.CORRELATION_ID="x-budibase-correlation-id",to.AUTHORIZATION="authorization",to.MIGRATING_APP="x-budibase-migrating-app",to.COOKIE="cookie",to))(Header$1||{});const SWITCHABLE_TYPES={[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]},PROTECTED_INTERNAL_COLUMNS=["_id","_rev","type","createdAt","updatedAt","tableId"],PROTECTED_EXTERNAL_COLUMNS=["_id","_rev","tableId"],ThemeClassPrefix="spectrum--",DefaultBuilderTheme=Theme.DARKEST,DefaultAppTheme$1=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=(to=>(to.UserUpdate="UserUpdate",to.UserDisconnect="UserDisconnect",to.Heartbeat="Heartbeat",to))(SocketEvent||{}),GridSocketEvent=(to=>(to.RowChange="RowChange",to.DatasourceChange="DatasourceChange",to.SelectDatasource="SelectDatasource",to.SelectCell="SelectCell",to))(GridSocketEvent||{}),BuilderSocketEvent=(to=>(to.SelectApp="SelectApp",to.TableChange="TableChange",to.DatasourceChange="DatasourceChange",to.LockTransfer="LockTransfer",to.ScreenChange="ScreenChange",to.AppMetadataChange="AppMetadataChange",to.SelectResource="SelectResource",to.AppPublishChange="AppPublishChange",to.AutomationChange="AutomationChange",to.RoleChange="RoleChange",to))(BuilderSocketEvent||{});const SocketSessionTTL=60,ValidQueryNameRegex=/^[^()]*$/,ValidColumnNameRegex=/^[_a-zA-Z0-9\s]*$/g,ValidSnippetNameRegex=/^[a-z_][a-z0-9_]*$/i,REBOOT_CRON="@reboot";var BpmCorrelationKey=(to=>(to.ONBOARDING="budibase:onboarding:correlationkey",to.VERIFY_SSO_LOGIN="budibase:verify_sso_login:correlationkey",to))(BpmCorrelationKey||{});const DEFAULT_BB_DATASOURCE_ID$1="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(to){return to&&to.__esModule&&Object.prototype.hasOwnProperty.call(to,"default")?to.default:to}function getAugmentedNamespace(to){if(to.__esModule)return to;var ue=to.default;if(typeof ue=="function"){var eo=function no(){return this instanceof no?Reflect.construct(ue,arguments,this.constructor):ue.apply(this,arguments)};eo.prototype=ue.prototype}else eo={};return Object.defineProperty(eo,"__esModule",{value:!0}),Object.keys(to).forEach(function(no){var ro=Object.getOwnPropertyDescriptor(to,no);Object.defineProperty(eo,no,ro.get?ro:{enumerable:!0,get:function(){return to[no]}})}),eo}var dayjs_min$1={exports:{}};(function(to,ue){(function(eo,no){to.exports=no()})(commonjsGlobal$1,function(){var eo=1e3,no=6e4,ro=36e5,oo="millisecond",io="second",ao="minute",so="hour",lo="day",co="week",uo="month",fo="quarter",po="year",ho="date",_o="Invalid Date",go=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,bo=/\[([^\]]+)]|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,vo={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(zo){var Po=["th","st","nd","rd"],Bo=zo%100;return"["+zo+(Po[(Bo-20)%10]||Po[Bo]||Po[0])+"]"}},yo=function(zo,Po,Bo){var qo=String(zo);return!qo||qo.length>=Po?zo:""+Array(Po+1-qo.length).join(Bo)+zo},$o={s:yo,z:function(zo){var Po=-zo.utcOffset(),Bo=Math.abs(Po),qo=Math.floor(Bo/60),Fo=Bo%60;return(Po<=0?"+":"-")+yo(qo,2,"0")+":"+yo(Fo,2,"0")},m:function zo(Po,Bo){if(Po.date()<Bo.date())return-zo(Bo,Po);var qo=12*(Bo.year()-Po.year())+(Bo.month()-Po.month()),Fo=Po.clone().add(qo,uo),Wo=Bo-Fo<0,Go=Po.clone().add(qo+(Wo?-1:1),uo);return+(-(qo+(Bo-Fo)/(Wo?Fo-Go:Go-Fo))||0)},a:function(zo){return zo<0?Math.ceil(zo)||0:Math.floor(zo)},p:function(zo){return{M:uo,y:po,w:co,d:lo,D:ho,h:so,m:ao,s:io,ms:oo,Q:fo}[zo]||String(zo||"").toLowerCase().replace(/s$/,"")},u:function(zo){return zo===void 0}},ko="en",So={};So[ko]=vo;var Ao="$isDayjsObject",Mo=function(zo){return zo instanceof No||!(!zo||!zo[Ao])},Eo=function zo(Po,Bo,qo){var Fo;if(!Po)return ko;if(typeof Po=="string"){var Wo=Po.toLowerCase();So[Wo]&&(Fo=Wo),Bo&&(So[Wo]=Bo,Fo=Wo);var Go=Po.split("-");if(!Fo&&Go.length>1)return zo(Go[0])}else{var Yo=Po.name;So[Yo]=Po,Fo=Yo}return!qo&&Fo&&(ko=Fo),Fo||!qo&&ko},To=function(zo,Po){if(Mo(zo))return zo.clone();var Bo=typeof Po=="object"?Po:{};return Bo.date=zo,Bo.args=arguments,new No(Bo)},Io=$o;Io.l=Eo,Io.i=Mo,Io.w=function(zo,Po){return To(zo,{locale:Po.$L,utc:Po.$u,x:Po.$x,$offset:Po.$offset})};var No=function(){function zo(Bo){this.$L=Eo(Bo.locale,null,!0),this.parse(Bo),this.$x=this.$x||Bo.x||{},this[Ao]=!0}var Po=zo.prototype;return Po.parse=function(Bo){this.$d=function(qo){var Fo=qo.date,Wo=qo.utc;if(Fo===null)return new Date(NaN);if(Io.u(Fo))return new Date;if(Fo instanceof Date)return new Date(Fo);if(typeof Fo=="string"&&!/Z$/i.test(Fo)){var Go=Fo.match(go);if(Go){var Yo=Go[2]-1||0,Xo=(Go[7]||"0").substring(0,3);return Wo?new Date(Date.UTC(Go[1],Yo,Go[3]||1,Go[4]||0,Go[5]||0,Go[6]||0,Xo)):new Date(Go[1],Yo,Go[3]||1,Go[4]||0,Go[5]||0,Go[6]||0,Xo)}}return new Date(Fo)}(Bo),this.init()},Po.init=function(){var Bo=this.$d;this.$y=Bo.getFullYear(),this.$M=Bo.getMonth(),this.$D=Bo.getDate(),this.$W=Bo.getDay(),this.$H=Bo.getHours(),this.$m=Bo.getMinutes(),this.$s=Bo.getSeconds(),this.$ms=Bo.getMilliseconds()},Po.$utils=function(){return Io},Po.isValid=function(){return this.$d.toString()!==_o},Po.isSame=function(Bo,qo){var Fo=To(Bo);return this.startOf(qo)<=Fo&&Fo<=this.endOf(qo)},Po.isAfter=function(Bo,qo){return To(Bo)<this.startOf(qo)},Po.isBefore=function(Bo,qo){return this.endOf(qo)<To(Bo)},Po.$g=function(Bo,qo,Fo){return Io.u(Bo)?this[qo]:this.set(Fo,Bo)},Po.unix=function(){return Math.floor(this.valueOf()/1e3)},Po.valueOf=function(){return this.$d.getTime()},Po.startOf=function(Bo,qo){var Fo=this,Wo=!!Io.u(qo)||qo,Go=Io.p(Bo),Yo=function(sa,Aa){var pa=Io.w(Fo.$u?Date.UTC(Fo.$y,Aa,sa):new Date(Fo.$y,Aa,sa),Fo);return Wo?pa:pa.endOf(lo)},Xo=function(sa,Aa){return Io.w(Fo.toDate()[sa].apply(Fo.toDate("s"),(Wo?[0,0,0,0]:[23,59,59,999]).slice(Aa)),Fo)},Qo=this.$W,Jo=this.$M,na=this.$D,Ko="set"+(this.$u?"UTC":"");switch(Go){case po:return Wo?Yo(1,0):Yo(31,11);case uo:return Wo?Yo(1,Jo):Yo(0,Jo+1);case co:var ia=this.$locale().weekStart||0,ea=(Qo<ia?Qo+7:Qo)-ia;return Yo(Wo?na-ea:na+(6-ea),Jo);case lo:case ho:return Xo(Ko+"Hours",0);case so:return Xo(Ko+"Minutes",1);case ao:return Xo(Ko+"Seconds",2);case io:return Xo(Ko+"Milliseconds",3);default:return this.clone()}},Po.endOf=function(Bo){return this.startOf(Bo,!1)},Po.$set=function(Bo,qo){var Fo,Wo=Io.p(Bo),Go="set"+(this.$u?"UTC":""),Yo=(Fo={},Fo[lo]=Go+"Date",Fo[ho]=Go+"Date",Fo[uo]=Go+"Month",Fo[po]=Go+"FullYear",Fo[so]=Go+"Hours",Fo[ao]=Go+"Minutes",Fo[io]=Go+"Seconds",Fo[oo]=Go+"Milliseconds",Fo)[Wo],Xo=Wo===lo?this.$D+(qo-this.$W):qo;if(Wo===uo||Wo===po){var Qo=this.clone().set(ho,1);Qo.$d[Yo](Xo),Qo.init(),this.$d=Qo.set(ho,Math.min(this.$D,Qo.daysInMonth())).$d}else Yo&&this.$d[Yo](Xo);return this.init(),this},Po.set=function(Bo,qo){return this.clone().$set(Bo,qo)},Po.get=function(Bo){return this[Io.p(Bo)]()},Po.add=function(Bo,qo){var Fo,Wo=this;Bo=Number(Bo);var Go=Io.p(qo),Yo=function(Jo){var na=To(Wo);return Io.w(na.date(na.date()+Math.round(Jo*Bo)),Wo)};if(Go===uo)return this.set(uo,this.$M+Bo);if(Go===po)return this.set(po,this.$y+Bo);if(Go===lo)return Yo(1);if(Go===co)return Yo(7);var Xo=(Fo={},Fo[ao]=no,Fo[so]=ro,Fo[io]=eo,Fo)[Go]||1,Qo=this.$d.getTime()+Bo*Xo;return Io.w(Qo,this)},Po.subtract=function(Bo,qo){return this.add(-1*Bo,qo)},Po.format=function(Bo){var qo=this,Fo=this.$locale();if(!this.isValid())return Fo.invalidDate||_o;var Wo=Bo||"YYYY-MM-DDTHH:mm:ssZ",Go=Io.z(this),Yo=this.$H,Xo=this.$m,Qo=this.$M,Jo=Fo.weekdays,na=Fo.months,Ko=Fo.meridiem,ia=function(Aa,pa,va,ha){return Aa&&(Aa[pa]||Aa(qo,Wo))||va[pa].slice(0,ha)},ea=function(Aa){return Io.s(Yo%12||12,Aa,"0")},sa=Ko||function(Aa,pa,va){var ha=Aa<12?"AM":"PM";return va?ha.toLowerCase():ha};return Wo.replace(bo,function(Aa,pa){return pa||function(va){switch(va){case"YY":return String(qo.$y).slice(-2);case"YYYY":return Io.s(qo.$y,4,"0");case"M":return Qo+1;case"MM":return Io.s(Qo+1,2,"0");case"MMM":return ia(Fo.monthsShort,Qo,na,3);case"MMMM":return ia(na,Qo);case"D":return qo.$D;case"DD":return Io.s(qo.$D,2,"0");case"d":return String(qo.$W);case"dd":return ia(Fo.weekdaysMin,qo.$W,Jo,2);case"ddd":return ia(Fo.weekdaysShort,qo.$W,Jo,3);case"dddd":return Jo[qo.$W];case"H":return String(Yo);case"HH":return Io.s(Yo,2,"0");case"h":return ea(1);case"hh":return ea(2);case"a":return sa(Yo,Xo,!0);case"A":return sa(Yo,Xo,!1);case"m":return String(Xo);case"mm":return Io.s(Xo,2,"0");case"s":return String(qo.$s);case"ss":return Io.s(qo.$s,2,"0");case"SSS":return Io.s(qo.$ms,3,"0");case"Z":return Go}return null}(Aa)||Go.replace(":","")})},Po.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},Po.diff=function(Bo,qo,Fo){var Wo,Go=this,Yo=Io.p(qo),Xo=To(Bo),Qo=(Xo.utcOffset()-this.utcOffset())*no,Jo=this-Xo,na=function(){return Io.m(Go,Xo)};switch(Yo){case po:Wo=na()/12;break;case uo:Wo=na();break;case fo:Wo=na()/3;break;case co:Wo=(Jo-Qo)/6048e5;break;case lo:Wo=(Jo-Qo)/864e5;break;case so:Wo=Jo/ro;break;case ao:Wo=Jo/no;break;case io:Wo=Jo/eo;break;default:Wo=Jo}return Fo?Wo:Io.a(Wo)},Po.daysInMonth=function(){return this.endOf(uo).$D},Po.$locale=function(){return So[this.$L]},Po.locale=function(Bo,qo){if(!Bo)return this.$L;var Fo=this.clone(),Wo=Eo(Bo,qo,!0);return Wo&&(Fo.$L=Wo),Fo},Po.clone=function(){return Io.w(this.$d,this)},Po.toDate=function(){return new Date(this.valueOf())},Po.toJSON=function(){return this.isValid()?this.toISOString():null},Po.toISOString=function(){return this.$d.toISOString()},Po.toString=function(){return this.$d.toUTCString()},zo}(),xo=No.prototype;return To.prototype=xo,[["$ms",oo],["$s",io],["$m",ao],["$H",so],["$W",lo],["$M",uo],["$y",po],["$D",ho]].forEach(function(zo){xo[zo[1]]=function(Po){return this.$g(Po,zo[0],zo[1])}}),To.extend=function(zo,Po){return zo.$i||(zo(Po,No,To),zo.$i=!0),To},To.locale=Eo,To.isDayjs=Mo,To.unix=function(zo){return To(1e3*zo)},To.en=So[ko],To.Ls=So,To.p={},To})})(dayjs_min$1);var dayjs_minExports=dayjs_min$1.exports;const dayjs=getDefaultExportFromCjs$1(dayjs_minExports);var lodash$2={exports:{}};/**
|
|
6
|
+
opacity: ${so-co*go}`}}function slide(to,{delay:ue=0,duration:eo=400,easing:no=cubicOut,axis:ro="y"}={}){const oo=getComputedStyle(to),io=+oo.opacity,ao=ro==="y"?"height":"width",so=parseFloat(oo[ao]),lo=ro==="y"?["top","bottom"]:["left","right"],co=lo.map(bo=>`${bo[0].toUpperCase()}${bo.slice(1)}`),uo=parseFloat(oo[`padding${co[0]}`]),fo=parseFloat(oo[`padding${co[1]}`]),po=parseFloat(oo[`margin${co[0]}`]),ho=parseFloat(oo[`margin${co[1]}`]),_o=parseFloat(oo[`border${co[0]}Width`]),go=parseFloat(oo[`border${co[1]}Width`]);return{delay:ue,duration:eo,easing:no,css:bo=>`overflow: hidden;opacity: ${Math.min(bo*20,1)*io};${ao}: ${bo*so}px;padding-${lo[0]}: ${bo*uo}px;padding-${lo[1]}: ${bo*fo}px;margin-${lo[0]}: ${bo*po}px;margin-${lo[1]}: ${bo*ho}px;border-${lo[0]}-width: ${bo*_o}px;border-${lo[1]}-width: ${bo*go}px;`}}const indexVars$D="",AbsTooltip_svelte_svelte_type_style_lang="";function create_if_block$5D(to){let ue,eo;return ue=new Portal$1({props:{target:".spectrum",$$slots:{default:[create_default_slot$76]},$$scope:{ctx:to}}}),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},p(no,ro){const oo={};ro&132815&&(oo.$$scope={dirty:ro,ctx:no}),ue.$set(oo)},i(no){eo||(transition_in(ue.$$.fragment,no),eo=!0)},o(no){transition_out(ue.$$.fragment,no),eo=!1},d(no){destroy_component(ue,no)}}}function create_default_slot$76(to){let ue,eo,no,ro,oo,io,ao,so,lo;return{c(){ue=element("span"),eo=element("span"),no=text(to[2]),ro=space$1(),oo=element("span"),attr(eo,"class","spectrum-Tooltip-label svelte-9a74k9"),attr(oo,"class","spectrum-Tooltip-tip svelte-9a74k9"),attr(oo,"style",to[9]),attr(ue,"class",io="spectrum-Tooltip spectrum-Tooltip--"+to[1]+" spectrum-Tooltip--"+to[0]+" is-open svelte-9a74k9"),attr(ue,"style",ao=`left:${to[6]}px;top:${to[7]}px;${to[10]}`),toggle_class(ue,"noWrap",to[3])},m(co,uo){insert$2(co,ue,uo),append$2(ue,eo),append$2(eo,no),append$2(ue,ro),append$2(ue,oo),lo=!0},p(co,uo){(!lo||uo&4)&&set_data(no,co[2]),(!lo||uo&512)&&attr(oo,"style",co[9]),(!lo||uo&3&&io!==(io="spectrum-Tooltip spectrum-Tooltip--"+co[1]+" spectrum-Tooltip--"+co[0]+" is-open svelte-9a74k9"))&&attr(ue,"class",io),(!lo||uo&1216&&ao!==(ao=`left:${co[6]}px;top:${co[7]}px;${co[10]}`))&&attr(ue,"style",ao),(!lo||uo&11)&&toggle_class(ue,"noWrap",co[3])},i(co){lo||(co&&add_render_callback(()=>{lo&&(so||(so=create_bidirectional_transition(ue,fade,{duration:130},!0)),so.run(1))}),lo=!0)},o(co){co&&(so||(so=create_bidirectional_transition(ue,fade,{duration:130},!1)),so.run(0)),lo=!1},d(co){co&&detach(ue),co&&so&&so.end()}}}function create_fragment$c0(to){let ue,eo,no,ro,oo,io;const ao=to[13].default,so=create_slot(ao,to,to[17],null);let lo=to[8]&&to[2]&&to[6]!=null&&to[7]!=null&&create_if_block$5D(to);return{c(){ue=element("div"),so&&so.c(),eo=space$1(),lo&&lo.c(),no=empty$2(),attr(ue,"class","abs-tooltip svelte-9a74k9")},m(co,uo){insert$2(co,ue,uo),so&&so.m(ue,null),to[14](ue),insert$2(co,eo,uo),lo&&lo.m(co,uo),insert$2(co,no,uo),ro=!0,oo||(io=[listen(ue,"focus",null),listen(ue,"mouseover",to[15]),listen(ue,"mouseleave",to[16])],oo=!0)},p(co,[uo]){so&&so.p&&(!ro||uo&131072)&&update_slot_base(so,ao,co,co[17],ro?get_slot_changes(ao,co[17],uo,null):get_all_dirty_from_scope(co[17]),null),co[8]&&co[2]&&co[6]!=null&&co[7]!=null?lo?(lo.p(co,uo),uo&452&&transition_in(lo,1)):(lo=create_if_block$5D(co),lo.c(),transition_in(lo,1),lo.m(no.parentNode,no)):lo&&(group_outros(),transition_out(lo,1,1,()=>{lo=null}),check_outros())},i(co){ro||(transition_in(so,co),transition_in(lo),ro=!0)},o(co){transition_out(so,co),transition_out(lo),ro=!1},d(co){co&&(detach(ue),detach(eo),detach(no)),so&&so.d(co),to[14](null),lo&&lo.d(co),oo=!1,run_all(io)}}}function instance$bZ(to,ue,eo){let no,ro,{$$slots:oo={},$$scope:io}=ue,{position:ao=TooltipPosition.Top}=ue,{type:so=TooltipType.Default}=ue,{text:lo=""}=ue,{fixed:co=!1}=ue,{color:uo=void 0}=ue,{noWrap:fo=!1}=ue,po,ho=!1,_o,go,bo=!1,vo,yo;const $o=()=>{var No;const To=(No=po==null?void 0:po.children)==null?void 0:No[0];if(!To){eo(6,_o=void 0),eo(7,go=void 0);return}const Io=To.getBoundingClientRect();ao===TooltipPosition.Top?(eo(6,_o=Io.left+Io.width/2),eo(7,go=Io.top)):ao===TooltipPosition.Right?(eo(6,_o=Io.left+Io.width),eo(7,go=Io.top+Io.height/2)):ao===TooltipPosition.Bottom?(eo(6,_o=Io.left+Io.width/2),eo(7,go=Io.top+Io.height)):ao===TooltipPosition.Left&&(eo(6,_o=Io.left),eo(7,go=Io.top+Io.height/2))},ko=()=>{$o(),yo=setInterval($o,100),eo(8,bo=!0)},So=()=>{clearTimeout(vo),clearInterval(yo),eo(8,bo=!1)};onDestroy(So);function Ao(To){binding_callbacks[To?"unshift":"push"](()=>{po=To,eo(5,po)})}const Mo=()=>eo(4,ho=!0),Eo=()=>eo(4,ho=!1);return to.$$set=To=>{"position"in To&&eo(0,ao=To.position),"type"in To&&eo(1,so=To.type),"text"in To&&eo(2,lo=To.text),"fixed"in To&&eo(11,co=To.fixed),"color"in To&&eo(12,uo=To.color),"noWrap"in To&&eo(3,fo=To.noWrap),"$$scope"in To&&eo(17,io=To.$$scope)},to.$$.update=()=>{to.$$.dirty&2064&&(ho||co?vo=setTimeout(ko,200):So()),to.$$.dirty&4096&&eo(10,no=uo?`background:${uo};`:null),to.$$.dirty&4096&&eo(9,ro=uo?`border-top-color:${uo};`:null)},[ao,so,lo,fo,ho,po,_o,go,bo,ro,no,co,uo,oo,Ao,Mo,Eo,io]}class AbsTooltip extends SvelteComponent{constructor(ue){super(),init$3(this,ue,instance$bZ,create_fragment$c0,safe_not_equal,{position:0,type:1,text:2,fixed:11,color:12,noWrap:3})}}const Icon_svelte_svelte_type_style_lang="";function create_default_slot$75(to){let ue,eo,no,ro,oo,io,ao,so;return{c(){ue=element("div"),eo=svg_element("svg"),no=svg_element("use"),set_style(no,"pointer-events","none"),xlink_attr(no,"xlink:href",ro="#spectrum-icon-18-"+to[0]),attr(eo,"class",oo="spectrum-Icon spectrum-Icon--size"+to[1]+" svelte-ksxkvj"),attr(eo,"focusable","false"),attr(eo,"aria-hidden",to[2]),attr(eo,"aria-label",to[0]),attr(eo,"style",io=`${to[5]?`color: ${to[5]};`:""} ${to[6]?`--hover-color: ${to[6]}`:"--hover-color: var(--spectrum-alias-icon-color-selected-hover)"}`),toggle_class(eo,"hoverable",to[3]),toggle_class(eo,"disabled",to[4]),attr(ue,"class","icon svelte-ksxkvj"),toggle_class(ue,"newStyles",to[12])},m(lo,co){insert$2(lo,ue,co),append$2(ue,eo),append$2(eo,no),ao||(so=[listen(eo,"contextmenu",to[13]),listen(eo,"click",to[14])],ao=!0)},p(lo,co){co&1&&ro!==(ro="#spectrum-icon-18-"+lo[0])&&xlink_attr(no,"xlink:href",ro),co&2&&oo!==(oo="spectrum-Icon spectrum-Icon--size"+lo[1]+" svelte-ksxkvj")&&attr(eo,"class",oo),co&4&&attr(eo,"aria-hidden",lo[2]),co&1&&attr(eo,"aria-label",lo[0]),co&96&&io!==(io=`${lo[5]?`color: ${lo[5]};`:""} ${lo[6]?`--hover-color: ${lo[6]}`:"--hover-color: var(--spectrum-alias-icon-color-selected-hover)"}`)&&attr(eo,"style",io),co&10&&toggle_class(eo,"hoverable",lo[3]),co&18&&toggle_class(eo,"disabled",lo[4]),co&4096&&toggle_class(ue,"newStyles",lo[12])},d(lo){lo&&detach(ue),ao=!1,run_all(so)}}}function create_fragment$b$(to){let ue,eo;return ue=new AbsTooltip({props:{text:to[7],type:to[9],position:to[8],color:to[10],noWrap:to[11],$$slots:{default:[create_default_slot$75]},$$scope:{ctx:to}}}),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},p(no,[ro]){const oo={};ro&128&&(oo.text=no[7]),ro&512&&(oo.type=no[9]),ro&256&&(oo.position=no[8]),ro&1024&&(oo.color=no[10]),ro&2048&&(oo.noWrap=no[11]),ro&36991&&(oo.$$scope={dirty:ro,ctx:no}),ue.$set(oo)},i(no){eo||(transition_in(ue.$$.fragment,no),eo=!0)},o(no){transition_out(ue.$$.fragment,no),eo=!1},d(no){destroy_component(ue,no)}}}function instance$bY(to,ue,eo){let{name:no="Add"}=ue,{size:ro="M"}=ue,{hidden:oo=!1}=ue,{hoverable:io=!1}=ue,{disabled:ao=!1}=ue,{color:so=void 0}=ue,{hoverColor:lo=void 0}=ue,{tooltip:co=void 0}=ue,{tooltipPosition:uo=TooltipPosition.Bottom}=ue,{tooltipType:fo=TooltipType.Default}=ue,{tooltipColor:po=void 0}=ue,{tooltipWrap:ho=!0}=ue,{newStyles:_o=!1}=ue;function go(vo){bubble.call(this,to,vo)}function bo(vo){bubble.call(this,to,vo)}return to.$$set=vo=>{"name"in vo&&eo(0,no=vo.name),"size"in vo&&eo(1,ro=vo.size),"hidden"in vo&&eo(2,oo=vo.hidden),"hoverable"in vo&&eo(3,io=vo.hoverable),"disabled"in vo&&eo(4,ao=vo.disabled),"color"in vo&&eo(5,so=vo.color),"hoverColor"in vo&&eo(6,lo=vo.hoverColor),"tooltip"in vo&&eo(7,co=vo.tooltip),"tooltipPosition"in vo&&eo(8,uo=vo.tooltipPosition),"tooltipType"in vo&&eo(9,fo=vo.tooltipType),"tooltipColor"in vo&&eo(10,po=vo.tooltipColor),"tooltipWrap"in vo&&eo(11,ho=vo.tooltipWrap),"newStyles"in vo&&eo(12,_o=vo.newStyles)},[no,ro,oo,io,ao,so,lo,co,uo,fo,po,ho,_o,go,bo]}class Icon extends SvelteComponent{constructor(ue){super(),init$3(this,ue,instance$bY,create_fragment$b$,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$5C(to){let ue,eo,no;return eo=new AbsTooltip({props:{text:to[0],$$slots:{default:[create_default_slot$74]},$$scope:{ctx:to}}}),{c(){ue=element("div"),create_component(eo.$$.fragment),attr(ue,"class","icon-container svelte-19tap7e")},m(ro,oo){insert$2(ro,ue,oo),mount_component(eo,ue,null),no=!0},p(ro,oo){const io={};oo&1&&(io.text=ro[0]),oo&38&&(io.$$scope={dirty:oo,ctx:ro}),eo.$set(io)},i(ro){no||(transition_in(eo.$$.fragment,ro),no=!0)},o(ro){transition_out(eo.$$.fragment,ro),no=!1},d(ro){ro&&detach(ue),destroy_component(eo)}}}function create_default_slot$74(to){let ue,eo,no,ro,oo;return eo=new Icon({props:{name:"InfoOutline",size:"S",disabled:to[2],hoverable:!0}}),{c(){ue=element("div"),create_component(eo.$$.fragment),attr(ue,"class","icon svelte-19tap7e"),toggle_class(ue,"icon-small",to[1]==="M"||to[1]==="S")},m(io,ao){insert$2(io,ue,ao),mount_component(eo,ue,null),no=!0,ro||(oo=listen(ue,"focus",to[4]),ro=!0)},p(io,ao){const so={};ao&4&&(so.disabled=io[2]),eo.$set(so),(!no||ao&2)&&toggle_class(ue,"icon-small",io[1]==="M"||io[1]==="S")},i(io){no||(transition_in(eo.$$.fragment,io),no=!0)},o(io){transition_out(eo.$$.fragment,io),no=!1},d(io){io&&detach(ue),destroy_component(eo),ro=!1,oo()}}}function create_fragment$b_(to){let ue,eo,no;const ro=to[3].default,oo=create_slot(ro,to,to[5],null);let io=to[0]&&create_if_block$5C(to);return{c(){ue=element("div"),oo&&oo.c(),eo=space$1(),io&&io.c(),attr(ue,"class","svelte-19tap7e"),toggle_class(ue,"container",!!to[0])},m(ao,so){insert$2(ao,ue,so),oo&&oo.m(ue,null),append$2(ue,eo),io&&io.m(ue,null),no=!0},p(ao,[so]){oo&&oo.p&&(!no||so&32)&&update_slot_base(oo,ro,ao,ao[5],no?get_slot_changes(ro,ao[5],so,null):get_all_dirty_from_scope(ao[5]),null),ao[0]?io?(io.p(ao,so),so&1&&transition_in(io,1)):(io=create_if_block$5C(ao),io.c(),transition_in(io,1),io.m(ue,null)):io&&(group_outros(),transition_out(io,1,1,()=>{io=null}),check_outros()),(!no||so&1)&&toggle_class(ue,"container",!!ao[0])},i(ao){no||(transition_in(oo,ao),transition_in(io),no=!0)},o(ao){transition_out(oo,ao),transition_out(io),no=!1},d(ao){ao&&detach(ue),oo&&oo.d(ao),io&&io.d()}}}function instance$bX(to,ue,eo){let{$$slots:no={},$$scope:ro}=ue,{tooltip:oo=""}=ue,{size:io="M"}=ue,{disabled:ao=!0}=ue;function so(lo){bubble.call(this,to,lo)}return to.$$set=lo=>{"tooltip"in lo&&eo(0,oo=lo.tooltip),"size"in lo&&eo(1,io=lo.size),"disabled"in lo&&eo(2,ao=lo.disabled),"$$scope"in lo&&eo(5,ro=lo.$$scope)},[oo,io,ao,no,so,ro]}class TooltipWrapper extends SvelteComponent{constructor(ue){super(),init$3(this,ue,instance$bX,create_fragment$b_,safe_not_equal,{tooltip:0,size:1,disabled:2})}}const FieldLabel_svelte_svelte_type_style_lang="";function create_default_slot$73(to){let ue,eo=(to[1]||"")+"",no,ro;return{c(){ue=element("label"),no=text(eo),attr(ue,"for",to[0]),attr(ue,"class",ro=null_to_empty(`spectrum-FieldLabel spectrum-FieldLabel--sizeM spectrum-Form-itemLabel ${to[3]}`)+" svelte-dqoj9e")},m(oo,io){insert$2(oo,ue,io),append$2(ue,no)},p(oo,io){io&2&&eo!==(eo=(oo[1]||"")+"")&&set_data(no,eo),io&1&&attr(ue,"for",oo[0]),io&8&&ro!==(ro=null_to_empty(`spectrum-FieldLabel spectrum-FieldLabel--sizeM spectrum-Form-itemLabel ${oo[3]}`)+" svelte-dqoj9e")&&attr(ue,"class",ro)},d(oo){oo&&detach(ue)}}}function create_fragment$bZ(to){let ue,eo;return ue=new TooltipWrapper({props:{tooltip:to[2],size:"S",$$slots:{default:[create_default_slot$73]},$$scope:{ctx:to}}}),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},p(no,[ro]){const oo={};ro&4&&(oo.tooltip=no[2]),ro&43&&(oo.$$scope={dirty:ro,ctx:no}),ue.$set(oo)},i(no){eo||(transition_in(ue.$$.fragment,no),eo=!0)},o(no){transition_out(ue.$$.fragment,no),eo=!1},d(no){destroy_component(ue,no)}}}function instance$bW(to,ue,eo){let no,{forId:ro}=ue,{label:oo}=ue,{position:io="above"}=ue,{tooltip:ao=""}=ue;return to.$$set=so=>{"forId"in so&&eo(0,ro=so.forId),"label"in so&&eo(1,oo=so.label),"position"in so&&eo(4,io=so.position),"tooltip"in so&&eo(2,ao=so.tooltip)},to.$$.update=()=>{to.$$.dirty&16&&eo(3,no=io==="above"?"":`spectrum-FieldLabel--${io}`)},[ro,oo,ao,no,io]}class FieldLabel extends SvelteComponent{constructor(ue){super(),init$3(this,ue,instance$bW,create_fragment$bZ,safe_not_equal,{forId:0,label:1,position:4,tooltip:2})}}const Field_svelte_svelte_type_style_lang="";function create_if_block_2$1U(to){let ue,eo;return ue=new FieldLabel({props:{forId:to[0],label:to[1],position:to[2],tooltip:to[5]}}),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},p(no,ro){const oo={};ro&1&&(oo.forId=no[0]),ro&2&&(oo.label=no[1]),ro&4&&(oo.position=no[2]),ro&32&&(oo.tooltip=no[5]),ue.$set(oo)},i(no){eo||(transition_in(ue.$$.fragment,no),eo=!0)},o(no){transition_out(ue.$$.fragment,no),eo=!1},d(no){destroy_component(ue,no)}}}function create_if_block_1$34(to){let ue,eo,no,ro,oo,io;return eo=new Icon({props:{name:"HelpOutline"}}),{c(){ue=element("div"),create_component(eo.$$.fragment),no=space$1(),ro=element("span"),oo=text(to[4]),attr(ro,"class","svelte-e52e9j"),attr(ue,"class","helpText svelte-e52e9j")},m(ao,so){insert$2(ao,ue,so),mount_component(eo,ue,null),append$2(ue,no),append$2(ue,ro),append$2(ro,oo),io=!0},p(ao,so){(!io||so&16)&&set_data(oo,ao[4])},i(ao){io||(transition_in(eo.$$.fragment,ao),io=!0)},o(ao){transition_out(eo.$$.fragment,ao),io=!1},d(ao){ao&&detach(ue),destroy_component(eo)}}}function create_if_block$5B(to){let ue,eo;return{c(){ue=element("div"),eo=text(to[3]),attr(ue,"class","error svelte-e52e9j")},m(no,ro){insert$2(no,ue,ro),append$2(ue,eo)},p(no,ro){ro&8&&set_data(eo,no[3])},i:noop$7,o:noop$7,d(no){no&&detach(ue)}}}function create_fragment$bY(to){let ue,eo,no,ro,oo,io,ao,so=to[1]&&create_if_block_2$1U(to);const lo=to[7].default,co=create_slot(lo,to,to[6],null),uo=[create_if_block$5B,create_if_block_1$34],fo=[];function po(ho,_o){return ho[3]?0:ho[4]?1:-1}return~(oo=po(to))&&(io=fo[oo]=uo[oo](to)),{c(){ue=element("div"),so&&so.c(),eo=space$1(),no=element("div"),co&&co.c(),ro=space$1(),io&&io.c(),attr(no,"class","spectrum-Form-itemField svelte-e52e9j"),attr(ue,"class","spectrum-Form-item svelte-e52e9j"),toggle_class(ue,"above",to[2]==="above")},m(ho,_o){insert$2(ho,ue,_o),so&&so.m(ue,null),append$2(ue,eo),append$2(ue,no),co&&co.m(no,null),append$2(no,ro),~oo&&fo[oo].m(no,null),ao=!0},p(ho,[_o]){ho[1]?so?(so.p(ho,_o),_o&2&&transition_in(so,1)):(so=create_if_block_2$1U(ho),so.c(),transition_in(so,1),so.m(ue,eo)):so&&(group_outros(),transition_out(so,1,1,()=>{so=null}),check_outros()),co&&co.p&&(!ao||_o&64)&&update_slot_base(co,lo,ho,ho[6],ao?get_slot_changes(lo,ho[6],_o,null):get_all_dirty_from_scope(ho[6]),null);let go=oo;oo=po(ho),oo===go?~oo&&fo[oo].p(ho,_o):(io&&(group_outros(),transition_out(fo[go],1,1,()=>{fo[go]=null}),check_outros()),~oo?(io=fo[oo],io?io.p(ho,_o):(io=fo[oo]=uo[oo](ho),io.c()),transition_in(io,1),io.m(no,null)):io=null),(!ao||_o&4)&&toggle_class(ue,"above",ho[2]==="above")},i(ho){ao||(transition_in(so),transition_in(co,ho),transition_in(io),ao=!0)},o(ho){transition_out(so),transition_out(co,ho),transition_out(io),ao=!1},d(ho){ho&&detach(ue),so&&so.d(),co&&co.d(ho),~oo&&fo[oo].d()}}}function instance$bV(to,ue,eo){let{$$slots:no={},$$scope:ro}=ue,{id:oo=void 0}=ue,{label:io=void 0}=ue,{labelPosition:ao="above"}=ue,{error:so=void 0}=ue,{helpText:lo=void 0}=ue,{tooltip:co=void 0}=ue;return to.$$set=uo=>{"id"in uo&&eo(0,oo=uo.id),"label"in uo&&eo(1,io=uo.label),"labelPosition"in uo&&eo(2,ao=uo.labelPosition),"error"in uo&&eo(3,so=uo.error),"helpText"in uo&&eo(4,lo=uo.helpText),"tooltip"in uo&&eo(5,co=uo.tooltip),"$$scope"in uo&&eo(6,ro=uo.$$scope)},[oo,io,ao,so,lo,co,ro,no]}class Field extends SvelteComponent{constructor(ue){super(),init$3(this,ue,instance$bV,create_fragment$bY,safe_not_equal,{id:0,label:1,labelPosition:2,error:3,helpText:4,tooltip:5})}}const indexVars$C="",TextField_svelte_svelte_type_style_lang="";function create_fragment$bX(to){let ue,eo,no,ro,oo,io,ao,so;return{c(){ue=element("div"),eo=element("input"),eo.disabled=to[3],eo.readOnly=to[5],attr(eo,"id",to[4]),eo.value=no=to[0]??"",attr(eo,"placeholder",ro=to[1]??""),attr(eo,"type",to[2]),attr(eo,"class","spectrum-Textfield-input svelte-1pznijr"),attr(eo,"style",oo=to[7]?`text-align: ${to[7]};`:""),attr(eo,"inputmode",io=to[15](to[2])),attr(eo,"autocomplete",to[10]),attr(ue,"class","spectrum-Textfield svelte-1pznijr"),toggle_class(ue,"spectrum-Textfield--quiet",to[6]),toggle_class(ue,"is-disabled",to[3]),toggle_class(ue,"is-focused",to[9])},m(lo,co){insert$2(lo,ue,co),append$2(ue,eo),to[24](eo),ao||(so=[listen(eo,"click",to[19]),listen(eo,"blur",to[20]),listen(eo,"focus",to[21]),listen(eo,"input",to[22]),listen(eo,"keyup",to[23]),listen(eo,"blur",to[12]),listen(eo,"focus",to[11]),listen(eo,"input",to[13]),listen(eo,"keyup",to[14])],ao=!0)},p(lo,[co]){co&8&&(eo.disabled=lo[3]),co&32&&(eo.readOnly=lo[5]),co&16&&attr(eo,"id",lo[4]),co&1&&no!==(no=lo[0]??"")&&eo.value!==no&&(eo.value=no),co&2&&ro!==(ro=lo[1]??"")&&attr(eo,"placeholder",ro),co&4&&attr(eo,"type",lo[2]),co&128&&oo!==(oo=lo[7]?`text-align: ${lo[7]};`:"")&&attr(eo,"style",oo),co&4&&io!==(io=lo[15](lo[2]))&&attr(eo,"inputmode",io),co&1024&&attr(eo,"autocomplete",lo[10]),co&64&&toggle_class(ue,"spectrum-Textfield--quiet",lo[6]),co&8&&toggle_class(ue,"is-disabled",lo[3]),co&512&&toggle_class(ue,"is-focused",lo[9])},i:noop$7,o:noop$7,d(lo){lo&&detach(ue),to[24](null),ao=!1,run_all(so)}}}function instance$bU(to,ue,eo){let no,{value:ro=null}=ue,{placeholder:oo=void 0}=ue,{type:io="text"}=ue,{disabled:ao=!1}=ue,{id:so=null}=ue,{readonly:lo=!1}=ue,{updateOnChange:co=!0}=ue,{quiet:uo=!1}=ue,{align:fo=void 0}=ue,{autofocus:po=!1}=ue,{autocomplete:ho}=ue;const _o=createEventDispatcher();let go,bo=!1;const vo=zo=>{if(!(lo||ao)){if(io==="number"){const Po=parseFloat(zo);zo=isNaN(Po)?null:Po}_o("change",zo)}},yo=()=>{lo||ao||eo(9,bo=!0)},$o=zo=>{var Po;lo||ao||(eo(9,bo=!1),vo((Po=zo==null?void 0:zo.target)==null?void 0:Po.value))},ko=zo=>{var Po;lo||!co||ao||vo((Po=zo.target)==null?void 0:Po.value)},So=zo=>{var Po;lo||ao||zo.key==="Enter"&&vo((Po=zo.target)==null?void 0:Po.value)},Ao=zo=>zo==="bigint"?"numeric":zo==="number"?"decimal":"text";onMount(async()=>{ao||(eo(9,bo=po||!1),bo&&(await tick(),go.focus()))});function Mo(zo){bubble.call(this,to,zo)}function Eo(zo){bubble.call(this,to,zo)}function To(zo){bubble.call(this,to,zo)}function Io(zo){bubble.call(this,to,zo)}function No(zo){bubble.call(this,to,zo)}function xo(zo){binding_callbacks[zo?"unshift":"push"](()=>{go=zo,eo(8,go)})}return to.$$set=zo=>{"value"in zo&&eo(0,ro=zo.value),"placeholder"in zo&&eo(1,oo=zo.placeholder),"type"in zo&&eo(2,io=zo.type),"disabled"in zo&&eo(3,ao=zo.disabled),"id"in zo&&eo(4,so=zo.id),"readonly"in zo&&eo(5,lo=zo.readonly),"updateOnChange"in zo&&eo(16,co=zo.updateOnChange),"quiet"in zo&&eo(6,uo=zo.quiet),"align"in zo&&eo(7,fo=zo.align),"autofocus"in zo&&eo(17,po=zo.autofocus),"autocomplete"in zo&&eo(18,ho=zo.autocomplete)},to.$$.update=()=>{to.$$.dirty&262144&&eo(10,no=typeof ho=="boolean"?ho?"on":"off":void 0)},[ro,oo,io,ao,so,lo,uo,fo,go,bo,no,yo,$o,ko,So,Ao,co,po,ho,Mo,Eo,To,Io,No,xo]}class TextField extends SvelteComponent{constructor(ue){super(),init$3(this,ue,instance$bU,create_fragment$bX,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$72(to){let ue,eo;return ue=new TextField({props:{updateOnChange:to[8],disabled:to[5],readonly:to[6],value:to[0],placeholder:to[3],type:to[4],quiet:to[9],autofocus:to[10],autocomplete:to[11]}}),ue.$on("change",to[13]),ue.$on("click",to[14]),ue.$on("input",to[15]),ue.$on("blur",to[16]),ue.$on("focus",to[17]),ue.$on("keyup",to[18]),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},p(no,ro){const oo={};ro&256&&(oo.updateOnChange=no[8]),ro&32&&(oo.disabled=no[5]),ro&64&&(oo.readonly=no[6]),ro&1&&(oo.value=no[0]),ro&8&&(oo.placeholder=no[3]),ro&16&&(oo.type=no[4]),ro&512&&(oo.quiet=no[9]),ro&1024&&(oo.autofocus=no[10]),ro&2048&&(oo.autocomplete=no[11]),ue.$set(oo)},i(no){eo||(transition_in(ue.$$.fragment,no),eo=!0)},o(no){transition_out(ue.$$.fragment,no),eo=!1},d(no){destroy_component(ue,no)}}}function create_fragment$bW(to){let ue,eo;return ue=new Field({props:{helpText:to[12],label:to[1],labelPosition:to[2],error:to[7],$$slots:{default:[create_default_slot$72]},$$scope:{ctx:to}}}),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},p(no,[ro]){const oo={};ro&4096&&(oo.helpText=no[12]),ro&2&&(oo.label=no[1]),ro&4&&(oo.labelPosition=no[2]),ro&128&&(oo.error=no[7]),ro&1052537&&(oo.$$scope={dirty:ro,ctx:no}),ue.$set(oo)},i(no){eo||(transition_in(ue.$$.fragment,no),eo=!0)},o(no){transition_out(ue.$$.fragment,no),eo=!1},d(no){destroy_component(ue,no)}}}function instance$bT(to,ue,eo){let{value:no=void 0}=ue,{label:ro=void 0}=ue,{labelPosition:oo="above"}=ue,{placeholder:io=void 0}=ue,{type:ao="text"}=ue,{disabled:so=!1}=ue,{readonly:lo=!1}=ue,{error:co=void 0}=ue,{updateOnChange:uo=!0}=ue,{quiet:fo=!1}=ue,{autofocus:po=void 0}=ue,{autocomplete:ho=void 0}=ue,{helpText:_o=void 0}=ue;const go=createEventDispatcher(),bo=Ao=>{eo(0,no=Ao.detail),go("change",Ao.detail)};function vo(Ao){bubble.call(this,to,Ao)}function yo(Ao){bubble.call(this,to,Ao)}function $o(Ao){bubble.call(this,to,Ao)}function ko(Ao){bubble.call(this,to,Ao)}function So(Ao){bubble.call(this,to,Ao)}return to.$$set=Ao=>{"value"in Ao&&eo(0,no=Ao.value),"label"in Ao&&eo(1,ro=Ao.label),"labelPosition"in Ao&&eo(2,oo=Ao.labelPosition),"placeholder"in Ao&&eo(3,io=Ao.placeholder),"type"in Ao&&eo(4,ao=Ao.type),"disabled"in Ao&&eo(5,so=Ao.disabled),"readonly"in Ao&&eo(6,lo=Ao.readonly),"error"in Ao&&eo(7,co=Ao.error),"updateOnChange"in Ao&&eo(8,uo=Ao.updateOnChange),"quiet"in Ao&&eo(9,fo=Ao.quiet),"autofocus"in Ao&&eo(10,po=Ao.autofocus),"autocomplete"in Ao&&eo(11,ho=Ao.autocomplete),"helpText"in Ao&&eo(12,_o=Ao.helpText)},[no,ro,oo,io,ao,so,lo,co,uo,fo,po,ho,_o,bo,vo,yo,$o,ko,So]}let Input$5=class extends SvelteComponent{constructor(ue){super(),init$3(this,ue,instance$bT,create_fragment$bW,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$B="",indexVars$A="",Stepper_svelte_svelte_type_style_lang="";function create_fragment$bV(to){let ue,eo,no,ro,oo,io,ao,so,lo,co,uo;return{c(){ue=element("div"),eo=element("div"),no=element("input"),oo=space$1(),io=element("span"),ao=element("button"),ao.innerHTML='<svg class="spectrum-Icon spectrum-UIIcon-ChevronUp75" focusable="false" aria-hidden="true"><use xlink:href="#spectrum-css-icon-Chevron75"></use></svg>',so=space$1(),lo=element("button"),lo.innerHTML='<svg class="spectrum-Icon spectrum-UIIcon-ChevronDown75" focusable="false" aria-hidden="true"><use xlink:href="#spectrum-css-icon-Chevron75"></use></svg>',no.disabled=to[1],no.readOnly=to[3],attr(no,"id",to[2]),attr(no,"placeholder",ro=to[0]||""),attr(no,"type","number"),attr(no,"class","spectrum-Textfield-input spectrum-Stepper-input"),attr(eo,"class","spectrum-Textfield spectrum-Stepper-textfield"),attr(ao,"class","spectrum-ActionButton spectrum-ActionButton--sizeM spectrum-Stepper-stepUp"),attr(ao,"tabindex","-1"),attr(lo,"class","spectrum-ActionButton spectrum-ActionButton--sizeM spectrum-Stepper-stepDown"),attr(lo,"tabindex","-1"),attr(io,"class","spectrum-Stepper-buttons"),attr(ue,"class","spectrum-Stepper svelte-c6q2wy"),toggle_class(ue,"spectrum-Stepper--quiet",to[4]),toggle_class(ue,"is-disabled",to[1]),toggle_class(ue,"is-focused",to[5])},m(fo,po){insert$2(fo,ue,po),append$2(ue,eo),append$2(eo,no),set_input_value(no,to[6]),append$2(ue,oo),append$2(ue,io),append$2(io,ao),append$2(io,so),append$2(io,lo),co||(uo=[listen(no,"input",to[23]),listen(no,"click",to[18]),listen(no,"blur",to[19]),listen(no,"focus",to[20]),listen(no,"input",to[21]),listen(no,"keyup",to[22]),listen(no,"blur",to[8]),listen(no,"focus",to[7]),listen(no,"input",to[9]),listen(no,"keyup",to[10]),listen(ao,"click",to[11]),listen(lo,"click",to[12])],co=!0)},p(fo,[po]){po&2&&(no.disabled=fo[1]),po&8&&(no.readOnly=fo[3]),po&4&&attr(no,"id",fo[2]),po&1&&ro!==(ro=fo[0]||"")&&attr(no,"placeholder",ro),po&64&&to_number(no.value)!==fo[6]&&set_input_value(no,fo[6]),po&16&&toggle_class(ue,"spectrum-Stepper--quiet",fo[4]),po&2&&toggle_class(ue,"is-disabled",fo[1]),po&32&&toggle_class(ue,"is-focused",fo[5])},i:noop$7,o:noop$7,d(fo){fo&&detach(ue),co=!1,run_all(uo)}}}function instance$bS(to,ue,eo){let{value:no=null}=ue,{placeholder:ro=null}=ue,{disabled:oo=!1}=ue,{id:io=null}=ue,{readonly:ao=!1}=ue,{updateOnChange:so=!0}=ue,{quiet:lo=!1}=ue,{min:co}=ue,{max:uo}=ue,{step:fo}=ue;const po=createEventDispatcher();let ho=!1,_o=no;const go=xo=>{if(ao)return;const zo=parseFloat(xo);xo=isNaN(zo)?null:zo,xo!=null&&(co!=null&&xo<co?xo=co:uo!=null&&xo>uo&&(xo=uo)),po("change",xo),eo(6,_o=xo)},bo=()=>{ao||eo(5,ho=!0)},vo=xo=>{ao||(eo(5,ho=!1),go(xo.target.value))},yo=xo=>{ao||!so||go(xo.target.value)},$o=xo=>{ao||xo.key==="Enter"&&go(xo.target.value)},ko=()=>{no==null||isNaN(no)?go(fo):go(no+fo)},So=()=>{no==null||isNaN(no)?go(fo):go(no-fo)};function Ao(xo){bubble.call(this,to,xo)}function Mo(xo){bubble.call(this,to,xo)}function Eo(xo){bubble.call(this,to,xo)}function To(xo){bubble.call(this,to,xo)}function Io(xo){bubble.call(this,to,xo)}function No(){_o=to_number(this.value),eo(6,_o),eo(14,no)}return to.$$set=xo=>{"value"in xo&&eo(14,no=xo.value),"placeholder"in xo&&eo(0,ro=xo.placeholder),"disabled"in xo&&eo(1,oo=xo.disabled),"id"in xo&&eo(2,io=xo.id),"readonly"in xo&&eo(3,ao=xo.readonly),"updateOnChange"in xo&&eo(15,so=xo.updateOnChange),"quiet"in xo&&eo(4,lo=xo.quiet),"min"in xo&&eo(16,co=xo.min),"max"in xo&&eo(17,uo=xo.max),"step"in xo&&eo(13,fo=xo.step)},to.$$.update=()=>{to.$$.dirty&16384&&eo(6,_o=no),to.$$.dirty&8192&&eo(13,fo=fo==null||isNaN(fo)?1:fo)},[ro,oo,io,ao,lo,ho,_o,bo,vo,yo,$o,ko,So,fo,no,so,co,uo,Ao,Mo,Eo,To,Io,No]}class Stepper extends SvelteComponent{constructor(ue){super(),init$3(this,ue,instance$bS,create_fragment$bV,safe_not_equal,{value:14,placeholder:0,disabled:1,id:2,readonly:3,updateOnChange:15,quiet:4,min:16,max:17,step:13})}}function create_default_slot$71(to){let ue,eo;return ue=new Stepper({props:{updateOnChange:to[7],error:to[6],disabled:to[4],readonly:to[5],value:to[0],placeholder:to[3],quiet:to[8],min:to[9],max:to[10],step:to[11]}}),ue.$on("change",to[13]),ue.$on("click",to[14]),ue.$on("input",to[15]),ue.$on("blur",to[16]),ue.$on("focus",to[17]),ue.$on("keyup",to[18]),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},p(no,ro){const oo={};ro&128&&(oo.updateOnChange=no[7]),ro&64&&(oo.error=no[6]),ro&16&&(oo.disabled=no[4]),ro&32&&(oo.readonly=no[5]),ro&1&&(oo.value=no[0]),ro&8&&(oo.placeholder=no[3]),ro&256&&(oo.quiet=no[8]),ro&512&&(oo.min=no[9]),ro&1024&&(oo.max=no[10]),ro&2048&&(oo.step=no[11]),ue.$set(oo)},i(no){eo||(transition_in(ue.$$.fragment,no),eo=!0)},o(no){transition_out(ue.$$.fragment,no),eo=!1},d(no){destroy_component(ue,no)}}}function create_fragment$bU(to){let ue,eo;return ue=new Field({props:{helpText:to[12],label:to[1],labelPosition:to[2],error:to[6],$$slots:{default:[create_default_slot$71]},$$scope:{ctx:to}}}),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},p(no,[ro]){const oo={};ro&4096&&(oo.helpText=no[12]),ro&2&&(oo.label=no[1]),ro&4&&(oo.labelPosition=no[2]),ro&64&&(oo.error=no[6]),ro&1052665&&(oo.$$scope={dirty:ro,ctx:no}),ue.$set(oo)},i(no){eo||(transition_in(ue.$$.fragment,no),eo=!0)},o(no){transition_out(ue.$$.fragment,no),eo=!1},d(no){destroy_component(ue,no)}}}function instance$bR(to,ue,eo){let{value:no=null}=ue,{label:ro=null}=ue,{labelPosition:oo="above"}=ue,{placeholder:io=null}=ue,{disabled:ao=!1}=ue,{readonly:so=!1}=ue,{error:lo=null}=ue,{updateOnChange:co=!0}=ue,{quiet:uo=!1}=ue,{min:fo=null}=ue,{max:po=null}=ue,{step:ho=1}=ue,{helpText:_o=null}=ue;const go=createEventDispatcher(),bo=Ao=>{eo(0,no=Ao.detail),go("change",Ao.detail)};function vo(Ao){bubble.call(this,to,Ao)}function yo(Ao){bubble.call(this,to,Ao)}function $o(Ao){bubble.call(this,to,Ao)}function ko(Ao){bubble.call(this,to,Ao)}function So(Ao){bubble.call(this,to,Ao)}return to.$$set=Ao=>{"value"in Ao&&eo(0,no=Ao.value),"label"in Ao&&eo(1,ro=Ao.label),"labelPosition"in Ao&&eo(2,oo=Ao.labelPosition),"placeholder"in Ao&&eo(3,io=Ao.placeholder),"disabled"in Ao&&eo(4,ao=Ao.disabled),"readonly"in Ao&&eo(5,so=Ao.readonly),"error"in Ao&&eo(6,lo=Ao.error),"updateOnChange"in Ao&&eo(7,co=Ao.updateOnChange),"quiet"in Ao&&eo(8,uo=Ao.quiet),"min"in Ao&&eo(9,fo=Ao.min),"max"in Ao&&eo(10,po=Ao.max),"step"in Ao&&eo(11,ho=Ao.step),"helpText"in Ao&&eo(12,_o=Ao.helpText)},[no,ro,oo,io,ao,so,lo,co,uo,fo,po,ho,_o,bo,vo,yo,$o,ko,So]}class Stepper_1 extends SvelteComponent{constructor(ue){super(),init$3(this,ue,instance$bR,create_fragment$bU,safe_not_equal,{value:0,label:1,labelPosition:2,placeholder:3,disabled:4,readonly:5,error:6,updateOnChange:7,quiet:8,min:9,max:10,step:11,helpText:12})}}const TextArea_svelte_svelte_type_style_lang="";function create_fragment$bT(to){let ue,eo,no,ro,oo,io,ao,so;return{c(){ue=element("div"),eo=element("textarea"),attr(eo,"placeholder",no=to[1]||""),attr(eo,"class","spectrum-Textfield-input svelte-1kmb9uq"),attr(eo,"style",ro=to[5]?`text-align: ${to[5]}`:""),eo.disabled=to[2],eo.readOnly=to[3],attr(eo,"id",to[4]),eo.value=oo=to[0]||"",attr(ue,"style",io=`${to[9]}${to[8]}`),attr(ue,"class","spectrum-Textfield spectrum-Textfield--multiline svelte-1kmb9uq"),toggle_class(ue,"is-disabled",to[2]),toggle_class(ue,"is-focused",to[6])},m(lo,co){insert$2(lo,ue,co),append$2(ue,eo),to[14](eo),ao||(so=[listen(eo,"focus",to[15]),listen(eo,"blur",to[10])],ao=!0)},p(lo,[co]){co&2&&no!==(no=lo[1]||"")&&attr(eo,"placeholder",no),co&32&&ro!==(ro=lo[5]?`text-align: ${lo[5]}`:"")&&attr(eo,"style",ro),co&4&&(eo.disabled=lo[2]),co&8&&(eo.readOnly=lo[3]),co&16&&attr(eo,"id",lo[4]),co&1&&oo!==(oo=lo[0]||"")&&(eo.value=oo),co&768&&io!==(io=`${lo[9]}${lo[8]}`)&&attr(ue,"style",io),co&4&&toggle_class(ue,"is-disabled",lo[2]),co&64&&toggle_class(ue,"is-focused",lo[6])},i:noop$7,o:noop$7,d(lo){lo&&detach(ue),to[14](null),ao=!1,run_all(so)}}}function instance$bQ(to,ue,eo){let no,ro,{value:oo=""}=ue,{placeholder:io=null}=ue,{disabled:ao=!1}=ue,{readonly:so=!1}=ue,{id:lo=null}=ue,{height:co=null}=ue,{minHeight:uo=null}=ue;const fo=()=>({start:_o.selectionStart,end:_o.selectionEnd});let{align:po=null}=ue,ho=!1,_o;const go=createEventDispatcher(),bo=ko=>{go("change",ko.target.value),eo(6,ho=!1)},vo=(ko,So)=>!ko||So==null?"":isNaN(So)?`${ko}:${So};`:`${ko}:${So}px;`;function yo(ko){binding_callbacks[ko?"unshift":"push"](()=>{_o=ko,eo(7,_o)})}const $o=()=>eo(6,ho=!0);return to.$$set=ko=>{"value"in ko&&eo(0,oo=ko.value),"placeholder"in ko&&eo(1,io=ko.placeholder),"disabled"in ko&&eo(2,ao=ko.disabled),"readonly"in ko&&eo(3,so=ko.readonly),"id"in ko&&eo(4,lo=ko.id),"height"in ko&&eo(11,co=ko.height),"minHeight"in ko&&eo(12,uo=ko.minHeight),"align"in ko&&eo(5,po=ko.align)},to.$$.update=()=>{to.$$.dirty&2048&&eo(9,no=vo("height",co)),to.$$.dirty&4096&&eo(8,ro=vo("min-height",uo))},[oo,io,ao,so,lo,po,ho,_o,ro,no,bo,co,uo,fo,yo,$o]}class TextArea extends SvelteComponent{constructor(ue){super(),init$3(this,ue,instance$bQ,create_fragment$bT,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]}}function create_default_slot$70(to){let ue,eo,no;function ro(io){to[11](io)}let oo={error:to[6],disabled:to[5],value:to[0],placeholder:to[4],height:to[7],minHeight:to[8]};return to[1]!==void 0&&(oo.getCaretPosition=to[1]),ue=new TextArea({props:oo}),binding_callbacks.push(()=>bind$2(ue,"getCaretPosition",ro)),ue.$on("change",to[10]),{c(){create_component(ue.$$.fragment)},m(io,ao){mount_component(ue,io,ao),no=!0},p(io,ao){const so={};ao&64&&(so.error=io[6]),ao&32&&(so.disabled=io[5]),ao&1&&(so.value=io[0]),ao&16&&(so.placeholder=io[4]),ao&128&&(so.height=io[7]),ao&256&&(so.minHeight=io[8]),!eo&&ao&2&&(eo=!0,so.getCaretPosition=io[1],add_flush_callback(()=>eo=!1)),ue.$set(so)},i(io){no||(transition_in(ue.$$.fragment,io),no=!0)},o(io){transition_out(ue.$$.fragment,io),no=!1},d(io){destroy_component(ue,io)}}}function create_fragment$bS(to){let ue,eo;return ue=new Field({props:{helpText:to[9],label:to[2],labelPosition:to[3],error:to[6],$$slots:{default:[create_default_slot$70]},$$scope:{ctx:to}}}),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},p(no,[ro]){const oo={};ro&512&&(oo.helpText=no[9]),ro&4&&(oo.label=no[2]),ro&8&&(oo.labelPosition=no[3]),ro&64&&(oo.error=no[6]),ro&8691&&(oo.$$scope={dirty:ro,ctx:no}),ue.$set(oo)},i(no){eo||(transition_in(ue.$$.fragment,no),eo=!0)},o(no){transition_out(ue.$$.fragment,no),eo=!1},d(no){destroy_component(ue,no)}}}function instance$bP(to,ue,eo){let{value:no=null}=ue,{label:ro=null}=ue,{labelPosition:oo="above"}=ue,{placeholder:io=null}=ue,{disabled:ao=!1}=ue,{error:so=null}=ue,{getCaretPosition:lo=null}=ue,{height:co=null}=ue,{minHeight:uo=null}=ue,{helpText:fo=null}=ue;const po=createEventDispatcher(),ho=go=>{eo(0,no=go.detail),po("change",go.detail)};function _o(go){lo=go,eo(1,lo)}return to.$$set=go=>{"value"in go&&eo(0,no=go.value),"label"in go&&eo(2,ro=go.label),"labelPosition"in go&&eo(3,oo=go.labelPosition),"placeholder"in go&&eo(4,io=go.placeholder),"disabled"in go&&eo(5,ao=go.disabled),"error"in go&&eo(6,so=go.error),"getCaretPosition"in go&&eo(1,lo=go.getCaretPosition),"height"in go&&eo(7,co=go.height),"minHeight"in go&&eo(8,uo=go.minHeight),"helpText"in go&&eo(9,fo=go.helpText)},[no,lo,ro,oo,io,ao,so,co,uo,fo,ho,_o]}class TextArea_1 extends SvelteComponent{constructor(ue){super(),init$3(this,ue,instance$bP,create_fragment$bS,safe_not_equal,{value:0,label:2,labelPosition:3,placeholder:4,disabled:5,error:6,getCaretPosition:1,height:7,minHeight:8,helpText:9})}}const indexVars$z="",indexVars$y="",indexVars$x="",ignoredClasses=[".download-js-link",".spectrum-Menu",".date-time-popover"],conditionallyIgnoredClasses=[".spectrum-Underlay",".drawer-wrapper",".spectrum-Popover"];let clickHandlers=[],candidateTarget;const handleClick=to=>{const ue=to.target||to.relatedTarget;if(!ue.closest('[data-ignore-click-outside="true"]')){for(let eo of ignoredClasses)if(ue.closest(eo))return;clickHandlers.forEach(eo=>{var no;if(!eo.element.contains(ue)){for(let ro of conditionallyIgnoredClasses){const oo=eo.anchor.closest(ro)!=null;if(ue.closest(ro)!=null&&!oo)return}(no=eo.callback)==null||no.call(eo,to)}})}},handleMouseUp=to=>{candidateTarget===to.target&&handleClick(to),candidateTarget=void 0},handleMouseDown=to=>{to.button===0&&(candidateTarget=to.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=(to,ue,eo,no)=>{let ro=clickHandlers.find(oo=>oo.id===to);ro?ro.callback=no:clickHandlers.push({id:to,element:ue,anchor:eo,callback:no})},removeHandler=to=>{clickHandlers=clickHandlers.filter(ue=>ue.id!==to)},clickOutside=(to,ue)=>{const eo=Math.random(),no=io=>typeof io=="function",ro=io=>io!=null&&typeof io=="object",oo=io=>{let ao,so=to;no(io)?ao=io:ro(io)&&(ao=io.callback,io.anchor&&(so=io.anchor)),updateHandler(eo,to,so,ao)};return oo(ue),{update:oo,destroy:()=>removeHandler(eo)}},indexVars$w="",Search_svelte_svelte_type_style_lang="";function create_fragment$bR(to){let ue,eo,no,ro,oo,io,ao,so,lo,co,uo,fo;return{c(){ue=element("div"),eo=element("div"),no=svg_element("svg"),ro=svg_element("use"),oo=space$1(),io=element("input"),lo=space$1(),co=element("button"),co.innerHTML='<svg class="spectrum-Icon spectrum-UIIcon-Cross75" focusable="false" aria-hidden="true"><use xlink:href="#spectrum-css-icon-Cross75"></use></svg>',xlink_attr(ro,"xlink:href","#spectrum-icon-18-Magnify"),attr(no,"class","spectrum-Icon spectrum-Icon--sizeM spectrum-Textfield-icon"),attr(no,"focusable","false"),attr(no,"aria-hidden","true"),io.disabled=to[3],attr(io,"id",to[4]),io.value=ao=to[1]||"",attr(io,"placeholder",so=to[2]||""),attr(io,"type","search"),attr(io,"class","spectrum-Textfield-input spectrum-Search-input svelte-d7zw73"),attr(io,"autocomplete","off"),attr(eo,"class","spectrum-Textfield svelte-d7zw73"),toggle_class(eo,"spectrum-Textfield--quiet",to[5]),toggle_class(eo,"is-focused",to[6]),toggle_class(eo,"is-disabled",to[3]),attr(co,"type","reset"),attr(co,"class","spectrum-ClearButton spectrum-Search-clearButton svelte-d7zw73"),attr(ue,"class","spectrum-Search svelte-d7zw73"),toggle_class(ue,"is-disabled",to[3])},m(po,ho){insert$2(po,ue,ho),append$2(ue,eo),append$2(eo,no),append$2(no,ro),append$2(eo,oo),append$2(eo,io),to[17](io),append$2(ue,lo),append$2(ue,co),uo||(fo=[listen(io,"click",to[13]),listen(io,"blur",to[14]),listen(io,"focus",to[15]),listen(io,"input",to[16]),listen(io,"blur",to[9]),listen(io,"focus",to[8]),listen(io,"input",to[10]),listen(io,"keyup",to[11]),listen(co,"click",to[18])],uo=!0)},p(po,[ho]){ho&8&&(io.disabled=po[3]),ho&16&&attr(io,"id",po[4]),ho&2&&ao!==(ao=po[1]||"")&&io.value!==ao&&(io.value=ao),ho&4&&so!==(so=po[2]||"")&&attr(io,"placeholder",so),ho&32&&toggle_class(eo,"spectrum-Textfield--quiet",po[5]),ho&64&&toggle_class(eo,"is-focused",po[6]),ho&8&&toggle_class(eo,"is-disabled",po[3]),ho&8&&toggle_class(ue,"is-disabled",po[3])},i:noop$7,o:noop$7,d(po){po&&detach(ue),to[17](null),uo=!1,run_all(fo)}}}function instance$bO(to,ue,eo){let{value:no=null}=ue,{placeholder:ro=void 0}=ue,{disabled:oo=!1}=ue,{id:io=null}=ue,{updateOnChange:ao=!0}=ue,{quiet:so=!1}=ue,{inputRef:lo=void 0}=ue;const co=createEventDispatcher();let uo=!1;const fo=Ao=>{co("change",Ao)},po=()=>{eo(6,uo=!0)},ho=Ao=>{eo(6,uo=!1),fo(Ao.target.value)},_o=Ao=>{ao&&fo(Ao.target.value)},go=Ao=>{Ao.key==="Enter"&&fo(Ao.target.value)};function bo(Ao){bubble.call(this,to,Ao)}function vo(Ao){bubble.call(this,to,Ao)}function yo(Ao){bubble.call(this,to,Ao)}function $o(Ao){bubble.call(this,to,Ao)}function ko(Ao){binding_callbacks[Ao?"unshift":"push"](()=>{lo=Ao,eo(0,lo)})}const So=()=>fo("");return to.$$set=Ao=>{"value"in Ao&&eo(1,no=Ao.value),"placeholder"in Ao&&eo(2,ro=Ao.placeholder),"disabled"in Ao&&eo(3,oo=Ao.disabled),"id"in Ao&&eo(4,io=Ao.id),"updateOnChange"in Ao&&eo(12,ao=Ao.updateOnChange),"quiet"in Ao&&eo(5,so=Ao.quiet),"inputRef"in Ao&&eo(0,lo=Ao.inputRef)},[lo,no,ro,oo,io,so,uo,fo,po,ho,_o,go,ao,bo,vo,yo,$o,ko,So]}class Search extends SvelteComponent{constructor(ue){super(),init$3(this,ue,instance$bO,create_fragment$bR,safe_not_equal,{value:1,placeholder:2,disabled:3,id:4,updateOnChange:12,quiet:5,inputRef:0})}}const indexVars$v="",StatusLight_svelte_svelte_type_style_lang="";function create_fragment$bQ(to){let ue,eo,no,ro,oo,io;const ao=to[21].default,so=create_slot(ao,to,to[20],null);return{c(){ue=element("div"),so&&so.c(),attr(ue,"class",eo="spectrum-StatusLight spectrum-StatusLight--size"+to[0]+" svelte-1wk2ay6"),attr(ue,"style",no=`--color: ${to[16]??"var(--spectrum-global-color-gray-400)"};`),toggle_class(ue,"custom",!!to[16]),toggle_class(ue,"square",to[17]),toggle_class(ue,"hoverable",to[18]),toggle_class(ue,"spectrum-StatusLight--celery",to[1]),toggle_class(ue,"spectrum-StatusLight--yellow",to[2]),toggle_class(ue,"spectrum-StatusLight--fuchsia",to[3]),toggle_class(ue,"spectrum-StatusLight--indigo",to[4]),toggle_class(ue,"spectrum-StatusLight--seafoam",to[5]),toggle_class(ue,"spectrum-StatusLight--chartreuse",to[6]),toggle_class(ue,"spectrum-StatusLight--magenta",to[7]),toggle_class(ue,"spectrum-StatusLight--purple",to[8]),toggle_class(ue,"spectrum-StatusLight--neutral",to[9]),toggle_class(ue,"spectrum-StatusLight--info",to[10]),toggle_class(ue,"spectrum-StatusLight--positive",to[11]),toggle_class(ue,"spectrum-StatusLight--notice",to[12]),toggle_class(ue,"spectrum-StatusLight--negative",to[13]),toggle_class(ue,"spectrum-StatusLight--disabled",to[14]),toggle_class(ue,"spectrum-StatusLight--active",to[15]),toggle_class(ue,"withText",!!to[19].default)},m(lo,co){insert$2(lo,ue,co),so&&so.m(ue,null),ro=!0,oo||(io=listen(ue,"click",to[22]),oo=!0)},p(lo,[co]){so&&so.p&&(!ro||co&1048576)&&update_slot_base(so,ao,lo,lo[20],ro?get_slot_changes(ao,lo[20],co,null):get_all_dirty_from_scope(lo[20]),null),(!ro||co&1&&eo!==(eo="spectrum-StatusLight spectrum-StatusLight--size"+lo[0]+" svelte-1wk2ay6"))&&attr(ue,"class",eo),(!ro||co&65536&&no!==(no=`--color: ${lo[16]??"var(--spectrum-global-color-gray-400)"};`))&&attr(ue,"style",no),(!ro||co&65537)&&toggle_class(ue,"custom",!!lo[16]),(!ro||co&131073)&&toggle_class(ue,"square",lo[17]),(!ro||co&262145)&&toggle_class(ue,"hoverable",lo[18]),(!ro||co&3)&&toggle_class(ue,"spectrum-StatusLight--celery",lo[1]),(!ro||co&5)&&toggle_class(ue,"spectrum-StatusLight--yellow",lo[2]),(!ro||co&9)&&toggle_class(ue,"spectrum-StatusLight--fuchsia",lo[3]),(!ro||co&17)&&toggle_class(ue,"spectrum-StatusLight--indigo",lo[4]),(!ro||co&33)&&toggle_class(ue,"spectrum-StatusLight--seafoam",lo[5]),(!ro||co&65)&&toggle_class(ue,"spectrum-StatusLight--chartreuse",lo[6]),(!ro||co&129)&&toggle_class(ue,"spectrum-StatusLight--magenta",lo[7]),(!ro||co&257)&&toggle_class(ue,"spectrum-StatusLight--purple",lo[8]),(!ro||co&513)&&toggle_class(ue,"spectrum-StatusLight--neutral",lo[9]),(!ro||co&1025)&&toggle_class(ue,"spectrum-StatusLight--info",lo[10]),(!ro||co&2049)&&toggle_class(ue,"spectrum-StatusLight--positive",lo[11]),(!ro||co&4097)&&toggle_class(ue,"spectrum-StatusLight--notice",lo[12]),(!ro||co&8193)&&toggle_class(ue,"spectrum-StatusLight--negative",lo[13]),(!ro||co&16385)&&toggle_class(ue,"spectrum-StatusLight--disabled",lo[14]),(!ro||co&32769)&&toggle_class(ue,"spectrum-StatusLight--active",lo[15]),(!ro||co&524289)&&toggle_class(ue,"withText",!!lo[19].default)},i(lo){ro||(transition_in(so,lo),ro=!0)},o(lo){transition_out(so,lo),ro=!1},d(lo){lo&&detach(ue),so&&so.d(lo),oo=!1,io()}}}function instance$bN(to,ue,eo){let{$$slots:no={},$$scope:ro}=ue;const oo=compute_slots(no);let{size:io="M"}=ue,{celery:ao=!1}=ue,{yellow:so=!1}=ue,{fuchsia:lo=!1}=ue,{indigo:co=!1}=ue,{seafoam:uo=!1}=ue,{chartreuse:fo=!1}=ue,{magenta:po=!1}=ue,{purple:ho=!1}=ue,{neutral:_o=!1}=ue,{info:go=!1}=ue,{positive:bo=!1}=ue,{notice:vo=!1}=ue,{negative:yo=!1}=ue,{disabled:$o=!1}=ue,{active:ko=!1}=ue,{color:So=void 0}=ue,{square:Ao=!1}=ue,{hoverable:Mo=!1}=ue;function Eo(To){bubble.call(this,to,To)}return to.$$set=To=>{"size"in To&&eo(0,io=To.size),"celery"in To&&eo(1,ao=To.celery),"yellow"in To&&eo(2,so=To.yellow),"fuchsia"in To&&eo(3,lo=To.fuchsia),"indigo"in To&&eo(4,co=To.indigo),"seafoam"in To&&eo(5,uo=To.seafoam),"chartreuse"in To&&eo(6,fo=To.chartreuse),"magenta"in To&&eo(7,po=To.magenta),"purple"in To&&eo(8,ho=To.purple),"neutral"in To&&eo(9,_o=To.neutral),"info"in To&&eo(10,go=To.info),"positive"in To&&eo(11,bo=To.positive),"notice"in To&&eo(12,vo=To.notice),"negative"in To&&eo(13,yo=To.negative),"disabled"in To&&eo(14,$o=To.disabled),"active"in To&&eo(15,ko=To.active),"color"in To&&eo(16,So=To.color),"square"in To&&eo(17,Ao=To.square),"hoverable"in To&&eo(18,Mo=To.hoverable),"$$scope"in To&&eo(20,ro=To.$$scope)},[io,ao,so,lo,co,uo,fo,po,ho,_o,go,bo,vo,yo,$o,ko,So,Ao,Mo,oo,ro,no,Eo]}class StatusLight extends SvelteComponent{constructor(ue){super(),init$3(this,ue,instance$bN,create_fragment$bQ,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(to,ue){let eo,no=ue;const ro=()=>oo(no),oo=ao=>{const{anchor:so,align:lo,maxHeight:co,maxWidth:uo,minWidth:fo,useAnchorWidth:po,offset:ho=5,customUpdate:_o,resizable:go,wrap:bo}=ao;if(!so)return;const vo=so.getBoundingClientRect(),yo=to.getBoundingClientRect(),$o=window.innerWidth,ko=window.innerHeight,So=8;let Ao={maxHeight:co,minWidth:po?vo.width:fo,maxWidth:po?vo.width:uo,left:0,top:0};if(typeof _o=="function")Ao=_o(vo,yo,{...Ao,offset:ao.offset});else{const Mo=()=>Ao.left+yo.width>$o&&vo.left>$o-vo.right,Eo=()=>Ao.top+yo.height>ko&&vo.top>ko-vo.bottom,To=xo=>{!Ao.maxHeight&&go&&(Ao.maxHeight=xo)},Io=xo=>{switch(xo){case"StartToStart":default:Ao.left=vo.left;break;case"EndToEnd":Ao.left=vo.right-yo.width;break;case"StartToEnd":Ao.left=vo.right+ho;break;case"EndToStart":Ao.left=vo.left-yo.width-ho;break;case"MidPoint":Ao.left=vo.left+vo.width/2-yo.width/2;break;case"ScreenEdge":Ao.left=$o-yo.width-So;break}},No=xo=>{switch(xo){case"StartToStart":Ao.top=vo.top,To(ko-vo.top-So);break;case"EndToEnd":Ao.top=vo.bottom-yo.height,To(vo.bottom-So);break;case"StartToEnd":default:Ao.top=vo.bottom+ho,To(ko-vo.bottom-So);break;case"EndToStart":Ao.top=vo.top-yo.height-ho,To(vo.top-So);break;case"MidPoint":Ao.top=vo.top+vo.height/2-yo.height/2;break;case"ScreenEdge":Ao.top=ko-yo.height-So,To(ko-2*So);break}};lo===PopoverAlignment.Right?Io("EndToEnd"):lo===PopoverAlignment.RightOutside||lo===PopoverAlignment.RightContextMenu?Io("StartToEnd"):lo===PopoverAlignment.LeftOutside||lo===PopoverAlignment.LeftContextMenu?Io("EndToStart"):lo===PopoverAlignment.Center?Io("MidPoint"):Io("StartToStart"),lo===PopoverAlignment.RightOutside||lo===PopoverAlignment.LeftOutside?No("MidPoint"):lo===PopoverAlignment.RightContextMenu||lo===PopoverAlignment.LeftContextMenu?(No("StartToStart"),Ao.top&&(Ao.top-=5)):No("StartToEnd"),Mo()&&(lo===PopoverAlignment.Left?Io("EndToEnd"):lo===PopoverAlignment.RightOutside&&Io("EndToStart")),Eo()&&(bo?(No("MidPoint"),Eo()&&No("ScreenEdge"),Io("StartToEnd"),Mo()&&Io("EndToStart")):lo===PopoverAlignment.LeftOutside||lo===PopoverAlignment.RightOutside?No("ScreenEdge"):No("EndToStart"))}for(const[Mo,Eo]of Object.entries(Ao)){const To=Mo;Eo!=null?to.style[To]=`${Eo}px`:to.style[To]=""}},io=ao=>{no=ao,eo&&eo.disconnect();const{anchor:so}=ao;so&&(eo=new ResizeObserver(()=>oo(ao)),eo.observe(so),eo.observe(to),eo.observe(document.body))};return to.style.position="fixed",to.style.zIndex="9999",document.addEventListener("scroll",ro,!0),io(ue),{update:io,destroy(){eo&&eo.disconnect(),document.removeEventListener("scroll",ro,!0)}}}const Context$1={Modal:"bbui-modal",PopoverRoot:"bbui-popover-root"},Popover_svelte_svelte_type_style_lang="";function create_if_block$5A(to){let ue,eo;return ue=new Portal$1({props:{target:to[17],$$slots:{default:[create_default_slot$6$]},$$scope:{ctx:to}}}),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},p(no,ro){const oo={};ro&131072&&(oo.target=no[17]),ro&537001982&&(oo.$$scope={dirty:ro,ctx:no}),ue.$set(oo)},i(no){eo||(transition_in(ue.$$.fragment,no),eo=!0)},o(no){transition_out(ue.$$.fragment,no),eo=!1},d(no){destroy_component(ue,no)}}}function create_default_slot$6$(to){let ue,eo,no,ro,oo,io,ao;const so=to[26].default,lo=create_slot(so,to,to[29],null);return{c(){ue=element("div"),lo&&lo.c(),attr(ue,"tabindex","0"),attr(ue,"class","spectrum-Popover is-open svelte-1kml6bp"),attr(ue,"role","presentation"),set_style(ue,"height",to[9]),set_style(ue,"--customZIndex",to[11]),toggle_class(ue,"customZIndex",to[11]),toggle_class(ue,"hidden",!to[13]),toggle_class(ue,"blockPointerEvents",to[16])},m(co,uo){insert$2(co,ue,uo),lo&&lo.m(ue,null),oo=!0,io||(ao=[action_destroyer(eo=positionDropdown.call(null,ue,{anchor:to[1],align:to[2],maxHeight:to[5],maxWidth:to[4],minWidth:to[3],useAnchorWidth:to[6],offset:to[8],customUpdate:to[12],resizable:to[14],wrap:to[15]})),action_destroyer(no=clickOutside.call(null,ue,{callback:to[7]?to[18]:clickOutside_function,anchor:to[1]})),listen(ue,"keydown",to[19]),listen(ue,"mouseenter",to[27]),listen(ue,"mouseleave",to[28])],io=!0)},p(co,uo){to=co,lo&&lo.p&&(!oo||uo&536870912)&&update_slot_base(lo,so,to,to[29],oo?get_slot_changes(so,to[29],uo,null):get_all_dirty_from_scope(to[29]),null),(!oo||uo&512)&&set_style(ue,"height",to[9]),(!oo||uo&2048)&&set_style(ue,"--customZIndex",to[11]),eo&&is_function(eo.update)&&uo&53630&&eo.update.call(null,{anchor:to[1],align:to[2],maxHeight:to[5],maxWidth:to[4],minWidth:to[3],useAnchorWidth:to[6],offset:to[8],customUpdate:to[12],resizable:to[14],wrap:to[15]}),no&&is_function(no.update)&&uo&130&&no.update.call(null,{callback:to[7]?to[18]:clickOutside_function,anchor:to[1]}),(!oo||uo&2048)&&toggle_class(ue,"customZIndex",to[11]),(!oo||uo&8192)&&toggle_class(ue,"hidden",!to[13]),(!oo||uo&65536)&&toggle_class(ue,"blockPointerEvents",to[16])},i(co){oo||(transition_in(lo,co),co&&add_render_callback(()=>{oo&&(ro||(ro=create_bidirectional_transition(ue,fly,{y:-20,duration:to[10]?animationDuration:0},!0)),ro.run(1))}),oo=!0)},o(co){transition_out(lo,co),co&&(ro||(ro=create_bidirectional_transition(ue,fly,{y:-20,duration:to[10]?animationDuration:0},!1)),ro.run(0)),oo=!1},d(co){co&&detach(ue),lo&&lo.d(co),co&&ro&&ro.end(),io=!1,run_all(ao)}}}function create_fragment$bP(to){let ue,eo,no=to[0]&&create_if_block$5A(to);return{c(){no&&no.c(),ue=empty$2()},m(ro,oo){no&&no.m(ro,oo),insert$2(ro,ue,oo),eo=!0},p(ro,[oo]){ro[0]?no?(no.p(ro,oo),oo&1&&transition_in(no,1)):(no=create_if_block$5A(ro),no.c(),transition_in(no,1),no.m(ue.parentNode,ue)):no&&(group_outros(),transition_out(no,1,1,()=>{no=null}),check_outros())},i(ro){eo||(transition_in(no),eo=!0)},o(ro){transition_out(no),eo=!1},d(ro){ro&&detach(ue),no&&no.d(ro)}}}const animationDuration=260,clickOutside_function=()=>{};function instance$bM(to,ue,eo){let no,{$$slots:ro={},$$scope:oo}=ue,{anchor:io}=ue,{align:ao=PopoverAlignment.Right}=ue,{portalTarget:so=void 0}=ue,{minWidth:lo=void 0}=ue,{maxWidth:co=void 0}=ue,{maxHeight:uo=void 0}=ue,{open:fo=!1}=ue,{useAnchorWidth:po=!1}=ue,{dismissible:ho=!0}=ue,{offset:_o=4}=ue,{customHeight:go=void 0}=ue,{animate:bo=!0}=ue,{customZIndex:vo=void 0}=ue,{handlePositionUpdate:yo=void 0}=ue,{showPopover:$o=!0}=ue,{clickOutsideOverride:ko=!1}=ue,{resizable:So=!0}=ue,{wrap:Ao=!1}=ue;const Mo=createEventDispatcher();let Eo,To=!1;const Io=()=>{Mo("open"),eo(0,fo=!0)},No=()=>{Mo("close"),eo(0,fo=!1)},xo=()=>{fo?No():Io()},zo=Fo=>{if(!ko&&fo){let Wo=Fo.target,Go=!1;for(;!Go&&Wo&&Wo.parentNode;)Go=Wo===io,Wo=Wo.parentNode;Go&&Fo.stopPropagation(),No()}},Po=Fo=>{ko&&fo&&Fo.key==="Escape"&&No()};onDestroy(()=>{clearTimeout(Eo)});function Bo(Fo){bubble.call(this,to,Fo)}function qo(Fo){bubble.call(this,to,Fo)}return to.$$set=Fo=>{"anchor"in Fo&&eo(1,io=Fo.anchor),"align"in Fo&&eo(2,ao=Fo.align),"portalTarget"in Fo&&eo(20,so=Fo.portalTarget),"minWidth"in Fo&&eo(3,lo=Fo.minWidth),"maxWidth"in Fo&&eo(4,co=Fo.maxWidth),"maxHeight"in Fo&&eo(5,uo=Fo.maxHeight),"open"in Fo&&eo(0,fo=Fo.open),"useAnchorWidth"in Fo&&eo(6,po=Fo.useAnchorWidth),"dismissible"in Fo&&eo(7,ho=Fo.dismissible),"offset"in Fo&&eo(8,_o=Fo.offset),"customHeight"in Fo&&eo(9,go=Fo.customHeight),"animate"in Fo&&eo(10,bo=Fo.animate),"customZIndex"in Fo&&eo(11,vo=Fo.customZIndex),"handlePositionUpdate"in Fo&&eo(12,yo=Fo.handlePositionUpdate),"showPopover"in Fo&&eo(13,$o=Fo.showPopover),"clickOutsideOverride"in Fo&&eo(21,ko=Fo.clickOutsideOverride),"resizable"in Fo&&eo(14,So=Fo.resizable),"wrap"in Fo&&eo(15,Ao=Fo.wrap),"$$scope"in Fo&&eo(29,oo=Fo.$$scope)},to.$$.update=()=>{to.$$.dirty&1048576&&eo(17,no=so||getContext$1(Context$1.PopoverRoot)||".spectrum"),to.$$.dirty&33555457&&fo&&bo&&(eo(16,To=!0),clearTimeout(Eo),eo(25,Eo=setTimeout(()=>{eo(16,To=!1)},animationDuration/2)))},[fo,io,ao,lo,co,uo,po,ho,_o,go,bo,vo,yo,$o,So,Ao,To,no,zo,Po,so,ko,Io,No,xo,Eo,ro,Bo,qo,oo]}class Popover extends SvelteComponent{constructor(ue){super(),init$3(this,ue,instance$bM,create_fragment$bP,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$u="",Tags_svelte_svelte_type_style_lang="";function create_fragment$bO(to){let ue,eo;const no=to[1].default,ro=create_slot(no,to,to[0],null);return{c(){ue=element("div"),ro&&ro.c(),attr(ue,"class","spectrum-Tags svelte-17cj8k0"),attr(ue,"role","list"),attr(ue,"aria-label","list")},m(oo,io){insert$2(oo,ue,io),ro&&ro.m(ue,null),eo=!0},p(oo,[io]){ro&&ro.p&&(!eo||io&1)&&update_slot_base(ro,no,oo,oo[0],eo?get_slot_changes(no,oo[0],io,null):get_all_dirty_from_scope(oo[0]),null)},i(oo){eo||(transition_in(ro,oo),eo=!0)},o(oo){transition_out(ro,oo),eo=!1},d(oo){oo&&detach(ue),ro&&ro.d(oo)}}}function instance$bL(to,ue,eo){let{$$slots:no={},$$scope:ro}=ue;return to.$$set=oo=>{"$$scope"in oo&&eo(0,ro=oo.$$scope)},[ro,no]}class Tags extends SvelteComponent{constructor(ue){super(),init$3(this,ue,instance$bL,create_fragment$bO,safe_not_equal,{})}}const indexVars$t="",Avatar_svelte_svelte_type_style_lang="";function create_else_block$21(to){let ue,eo=(to[3]||"")+"",no;return{c(){ue=element("div"),no=text(eo),attr(ue,"class","spectrum-Avatar svelte-xutedg"),attr(ue,"style",to[4]),toggle_class(ue,"is-disabled",to[2])},m(ro,oo){insert$2(ro,ue,oo),append$2(ue,no)},p(ro,oo){oo&8&&eo!==(eo=(ro[3]||"")+"")&&set_data(no,eo),oo&16&&attr(ue,"style",ro[4]),oo&4&&toggle_class(ue,"is-disabled",ro[2])},d(ro){ro&&detach(ue)}}}function create_if_block$5z(to){let ue,eo;return{c(){ue=element("img"),attr(ue,"class","spectrum-Avatar"),src_url_equal(ue.src,eo=to[1])||attr(ue,"src",eo),attr(ue,"alt","Avatar"),set_style(ue,"width","var("+to[5].get(to[0])+")"),set_style(ue,"height","var("+to[5].get(to[0])+")"),toggle_class(ue,"is-disabled",to[2])},m(no,ro){insert$2(no,ue,ro)},p(no,ro){ro&2&&!src_url_equal(ue.src,eo=no[1])&&attr(ue,"src",eo),ro&1&&set_style(ue,"width","var("+no[5].get(no[0])+")"),ro&1&&set_style(ue,"height","var("+no[5].get(no[0])+")"),ro&4&&toggle_class(ue,"is-disabled",no[2])},d(no){no&&detach(ue)}}}function create_fragment$bN(to){let ue;function eo(oo,io){return oo[1]?create_if_block$5z:create_else_block$21}let no=eo(to),ro=no(to);return{c(){ro.c(),ue=empty$2()},m(oo,io){ro.m(oo,io),insert$2(oo,ue,io)},p(oo,[io]){no===(no=eo(oo))&&ro?ro.p(oo,io):(ro.d(1),ro=no(oo),ro&&(ro.c(),ro.m(ue.parentNode,ue)))},i:noop$7,o:noop$7,d(oo){oo&&detach(ue),ro.d(oo)}}}const DefaultColor="#3aab87";function instance$bK(to,ue,eo){let no,ro,oo=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:io="M"}=ue,{url:ao=""}=ue,{disabled:so=!1}=ue,{initials:lo="JD"}=ue,{color:co=null}=ue;const uo=po=>po!=null&&po.length?`hsl(${po[0].toLowerCase().charCodeAt(0)%26/26*360}, 50%, 50%)`:DefaultColor,fo=(po,ho)=>{const _o=`var(${oo.get(po)})`,go=`calc(${_o} / 2)`;return`width:${_o}; height:${_o}; font-size:${go}; background:${ho};`};return to.$$set=po=>{"size"in po&&eo(0,io=po.size),"url"in po&&eo(1,ao=po.url),"disabled"in po&&eo(2,so=po.disabled),"initials"in po&&eo(3,lo=po.initials),"color"in po&&eo(6,co=po.color)},to.$$.update=()=>{to.$$.dirty&72&&eo(7,no=co||uo(lo)),to.$$.dirty&129&&eo(4,ro=fo(io,no))},[io,ao,so,lo,ro,oo,co,no]}class Avatar extends SvelteComponent{constructor(ue){super(),init$3(this,ue,instance$bK,create_fragment$bN,safe_not_equal,{size:0,url:1,disabled:2,initials:3,color:6})}}function create_fragment$bM(to){let ue,eo,no,ro,oo;return{c(){ue=element("button"),eo=svg_element("svg"),no=svg_element("use"),xlink_attr(no,"xlink:href","#spectrum-css-icon-Cross75"),attr(eo,"class","spectrum-Icon spectrum-UIIcon-Cross75"),attr(eo,"focusable","false"),attr(eo,"aria-hidden","true"),attr(ue,"class","spectrum-ClearButton"),ue.disabled=to[1],toggle_class(ue,"spectrum-ClearButton--small",to[0])},m(io,ao){insert$2(io,ue,ao),append$2(ue,eo),append$2(eo,no),ro||(oo=listen(ue,"click",to[2]),ro=!0)},p(io,[ao]){ao&2&&(ue.disabled=io[1]),ao&1&&toggle_class(ue,"spectrum-ClearButton--small",io[0])},i:noop$7,o:noop$7,d(io){io&&detach(ue),ro=!1,oo()}}}function instance$bJ(to,ue,eo){let{small:no=!1}=ue,{disabled:ro}=ue;function oo(io){bubble.call(this,to,io)}return to.$$set=io=>{"small"in io&&eo(0,no=io.small),"disabled"in io&&eo(1,ro=io.disabled)},[no,ro,oo]}class ClearButton extends SvelteComponent{constructor(ue){super(),init$3(this,ue,instance$bJ,create_fragment$bM,safe_not_equal,{small:0,disabled:1})}}const Tag_svelte_svelte_type_style_lang="";function create_if_block_2$1T(to){let ue,eo;return ue=new Avatar({props:{url:to[1]}}),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},p(no,ro){const oo={};ro&2&&(oo.url=no[1]),ue.$set(oo)},i(no){eo||(transition_in(ue.$$.fragment,no),eo=!0)},o(no){transition_out(ue.$$.fragment,no),eo=!1},d(no){destroy_component(ue,no)}}}function create_if_block_1$33(to){let ue,eo,no;return{c(){ue=svg_element("svg"),eo=svg_element("use"),xlink_attr(eo,"xlink:href",no="#spectrum-icon-24-"+to[0]),attr(ue,"class","spectrum-Icon spectrum-Icon--sizeS"),attr(ue,"focusable","false"),attr(ue,"aria-hidden","true"),attr(ue,"aria-label","Tag")},m(ro,oo){insert$2(ro,ue,oo),append$2(ue,eo)},p(ro,oo){oo&1&&no!==(no="#spectrum-icon-24-"+ro[0])&&xlink_attr(eo,"xlink:href",no)},d(ro){ro&&detach(ue)}}}function create_if_block$5y(to){let ue,eo;return ue=new ClearButton({}),ue.$on("click",to[7]),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},i(no){eo||(transition_in(ue.$$.fragment,no),eo=!0)},o(no){transition_out(ue.$$.fragment,no),eo=!1},d(no){destroy_component(ue,no)}}}function create_fragment$bL(to){let ue,eo,no,ro,oo,io,ao=to[1]&&create_if_block_2$1T(to),so=to[0]&&create_if_block_1$33(to);const lo=to[6].default,co=create_slot(lo,to,to[5],null);let uo=to[4]&&create_if_block$5y(to);return{c(){ue=element("div"),ao&&ao.c(),eo=space$1(),so&&so.c(),no=space$1(),ro=element("span"),co&&co.c(),oo=space$1(),uo&&uo.c(),attr(ro,"class","spectrum-Tags-itemLabel"),attr(ue,"class","spectrum-Tags-item svelte-16fqld8"),attr(ue,"role","listitem"),toggle_class(ue,"is-invalid",to[2]),toggle_class(ue,"is-disabled",to[3])},m(fo,po){insert$2(fo,ue,po),ao&&ao.m(ue,null),append$2(ue,eo),so&&so.m(ue,null),append$2(ue,no),append$2(ue,ro),co&&co.m(ro,null),append$2(ue,oo),uo&&uo.m(ue,null),io=!0},p(fo,[po]){fo[1]?ao?(ao.p(fo,po),po&2&&transition_in(ao,1)):(ao=create_if_block_2$1T(fo),ao.c(),transition_in(ao,1),ao.m(ue,eo)):ao&&(group_outros(),transition_out(ao,1,1,()=>{ao=null}),check_outros()),fo[0]?so?so.p(fo,po):(so=create_if_block_1$33(fo),so.c(),so.m(ue,no)):so&&(so.d(1),so=null),co&&co.p&&(!io||po&32)&&update_slot_base(co,lo,fo,fo[5],io?get_slot_changes(lo,fo[5],po,null):get_all_dirty_from_scope(fo[5]),null),fo[4]?uo?po&16&&transition_in(uo,1):(uo=create_if_block$5y(fo),uo.c(),transition_in(uo,1),uo.m(ue,null)):uo&&(group_outros(),transition_out(uo,1,1,()=>{uo=null}),check_outros()),(!io||po&4)&&toggle_class(ue,"is-invalid",fo[2]),(!io||po&8)&&toggle_class(ue,"is-disabled",fo[3])},i(fo){io||(transition_in(ao),transition_in(co,fo),transition_in(uo),io=!0)},o(fo){transition_out(ao),transition_out(co,fo),transition_out(uo),io=!1},d(fo){fo&&detach(ue),ao&&ao.d(),so&&so.d(),co&&co.d(fo),uo&&uo.d()}}}function instance$bI(to,ue,eo){let{$$slots:no={},$$scope:ro}=ue,{icon:oo=""}=ue,{avatar:io=""}=ue,{invalid:ao=!1}=ue,{disabled:so=!1}=ue,{closable:lo=!1}=ue;function co(uo){bubble.call(this,to,uo)}return to.$$set=uo=>{"icon"in uo&&eo(0,oo=uo.icon),"avatar"in uo&&eo(1,io=uo.avatar),"invalid"in uo&&eo(2,ao=uo.invalid),"disabled"in uo&&eo(3,so=uo.disabled),"closable"in uo&&eo(4,lo=uo.closable),"$$scope"in uo&&eo(5,ro=uo.$$scope)},[oo,io,ao,so,lo,ro,no,co]}let Tag$1=class extends SvelteComponent{constructor(ue){super(),init$3(this,ue,instance$bI,create_fragment$bL,safe_not_equal,{icon:0,avatar:1,invalid:2,disabled:3,closable:4})}};const indexVars$s="";function create_fragment$bK(to){let ue,eo,no,ro,oo,io,ao,so,lo,co,uo,fo,po,ho;return{c(){ue=element("div"),eo=element("div"),no=space$1(),ro=element("div"),oo=element("div"),io=element("div"),ao=element("div"),so=space$1(),lo=element("div"),co=element("div"),uo=element("div"),attr(eo,"class","spectrum-ProgressCircle-track"),attr(ao,"class","spectrum-ProgressCircle-fill"),attr(io,"class","spectrum-ProgressCircle-fillSubMask1"),attr(io,"style",to[3]),attr(oo,"class","spectrum-ProgressCircle-fillMask1"),attr(uo,"class","spectrum-ProgressCircle-fill"),attr(co,"class","spectrum-ProgressCircle-fillSubMask2"),attr(co,"style",to[4]),attr(lo,"class","spectrum-ProgressCircle-fillMask2"),attr(ro,"class","spectrum-ProgressCircle-fills"),attr(ue,"class",fo="spectrum-ProgressCircle spectrum-ProgressCircle--"+convertSize(to[0])),toggle_class(ue,"spectrum-ProgressCircle--indeterminate",to[1]==null),toggle_class(ue,"spectrum-ProgressCircle--overBackground",to[2])},m(_o,go){insert$2(_o,ue,go),append$2(ue,eo),append$2(ue,no),append$2(ue,ro),append$2(ro,oo),append$2(oo,io),append$2(io,ao),append$2(ro,so),append$2(ro,lo),append$2(lo,co),append$2(co,uo),po||(ho=listen(ue,"click",to[7]),po=!0)},p(_o,[go]){go&8&&attr(io,"style",_o[3]),go&16&&attr(co,"style",_o[4]),go&1&&fo!==(fo="spectrum-ProgressCircle spectrum-ProgressCircle--"+convertSize(_o[0]))&&attr(ue,"class",fo),go&3&&toggle_class(ue,"spectrum-ProgressCircle--indeterminate",_o[1]==null),go&5&&toggle_class(ue,"spectrum-ProgressCircle--overBackground",_o[2])},i:noop$7,o:noop$7,d(_o){_o&&detach(ue),po=!1,ho()}}}function convertSize(to){switch(to){case"S":return"small";case"L":return"large";default:return}}function instance$bH(to,ue,eo){let{size:no="M"}=ue,{value:ro=null}=ue,{minValue:oo=0}=ue,{maxValue:io=100}=ue,ao,so;function lo(fo){if(fo){let po=(fo-oo)/(io-oo)*100,ho;po>0&&po<=50?(ho=-180+po/50*180,eo(3,ao=`transform: rotate(${ho}deg);`),eo(4,so="transform: rotate(-180deg);")):po>50&&(ho=-180+(po-50)/50*180,eo(3,ao="transform: rotate(0deg);"),eo(4,so=`transform: rotate(${ho}deg);`))}}let{overBackground:co=!1}=ue;function uo(fo){bubble.call(this,to,fo)}return to.$$set=fo=>{"size"in fo&&eo(0,no=fo.size),"value"in fo&&eo(1,ro=fo.value),"minValue"in fo&&eo(5,oo=fo.minValue),"maxValue"in fo&&eo(6,io=fo.maxValue),"overBackground"in fo&&eo(2,co=fo.overBackground)},to.$$.update=()=>{to.$$.dirty&2&&lo(ro)},[no,ro,co,ao,so,oo,io,uo]}class ProgressCircle extends SvelteComponent{constructor(ue){super(),init$3(this,ue,instance$bH,create_fragment$bK,safe_not_equal,{size:0,value:1,minValue:5,maxValue:6,overBackground:2})}}const Picker_svelte_svelte_type_style_lang="";function get_each_context$2h(to,ue,eo){const no=to.slice();return no[49]=ue[eo],no[51]=eo,no}function create_if_block_11$6(to){let ue,eo,no,ro;const oo=[create_if_block_12$4,create_else_block_1$z],io=[];function ao(so,lo){return so[17]?1:0}return ue=ao(to),eo=io[ue]=oo[ue](to),{c(){eo.c(),no=empty$2()},m(so,lo){io[ue].m(so,lo),insert$2(so,no,lo),ro=!0},p(so,lo){let co=ue;ue=ao(so),ue===co?io[ue].p(so,lo):(group_outros(),transition_out(io[co],1,1,()=>{io[co]=null}),check_outros(),eo=io[ue],eo?eo.p(so,lo):(eo=io[ue]=oo[ue](so),eo.c()),transition_in(eo,1),eo.m(no.parentNode,no))},i(so){ro||(transition_in(eo),ro=!0)},o(so){transition_out(eo),ro=!1},d(so){so&&detach(no),io[ue].d(so)}}}function create_else_block_1$z(to){let ue,eo,no;return{c(){ue=element("span"),eo=element("img"),src_url_equal(eo.src,no=to[5])||attr(eo,"src",no),attr(eo,"alt","icon"),attr(eo,"width","15"),attr(eo,"height","15"),attr(ue,"class","option-extra icon field-icon svelte-1jmtv0w")},m(ro,oo){insert$2(ro,ue,oo),append$2(ue,eo)},p(ro,oo){oo[0]&32&&!src_url_equal(eo.src,no=ro[5])&&attr(eo,"src",no)},i:noop$7,o:noop$7,d(ro){ro&&detach(ue)}}}function create_if_block_12$4(to){let ue,eo,no;return eo=new Icon({props:{size:"S",name:to[5]}}),{c(){ue=element("span"),create_component(eo.$$.fragment),attr(ue,"class","option-extra icon svelte-1jmtv0w")},m(ro,oo){insert$2(ro,ue,oo),mount_component(eo,ue,null),no=!0},p(ro,oo){const io={};oo[0]&32&&(io.name=ro[5]),eo.$set(io)},i(ro){no||(transition_in(eo.$$.fragment,ro),no=!0)},o(ro){transition_out(eo.$$.fragment,ro),no=!1},d(ro){ro&&detach(ue),destroy_component(eo)}}}function create_if_block_10$a(to){let ue,eo,no;return eo=new StatusLight({props:{square:!0,color:to[6]}}),{c(){ue=element("span"),create_component(eo.$$.fragment),attr(ue,"class","option-extra svelte-1jmtv0w")},m(ro,oo){insert$2(ro,ue,oo),mount_component(eo,ue,null),no=!0},p(ro,oo){const io={};oo[0]&64&&(io.color=ro[6]),eo.$set(io)},i(ro){no||(transition_in(eo.$$.fragment,ro),no=!0)},o(ro){transition_out(eo.$$.fragment,ro),no=!1},d(ro){ro&&detach(ue),destroy_component(eo)}}}function create_if_block_9$h(to){let ue,eo;return ue=new Search({props:{value:to[0],disabled:to[3],placeholder:"Search"}}),ue.$on("change",to[37]),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},p(no,ro){const oo={};ro[0]&1&&(oo.value=no[0]),ro[0]&8&&(oo.disabled=no[3]),ue.$set(oo)},i(no){eo||(transition_in(ue.$$.fragment,no),eo=!0)},o(no){transition_out(ue.$$.fragment,no),eo=!1},d(no){destroy_component(ue,no)}}}function create_if_block_8$k(to){let ue,eo,no,ro,oo,io,ao,so;return{c(){ue=element("li"),eo=element("span"),no=text(to[8]),ro=space$1(),oo=svg_element("svg"),io=svg_element("use"),attr(eo,"class","spectrum-Menu-itemLabel svelte-1jmtv0w"),xlink_attr(io,"xlink:href","#spectrum-css-icon-Checkmark100"),attr(oo,"class","spectrum-Icon spectrum-UIIcon-Checkmark100 spectrum-Menu-checkmark spectrum-Menu-itemIcon svelte-1jmtv0w"),attr(oo,"focusable","false"),attr(oo,"aria-hidden","true"),attr(ue,"class","spectrum-Menu-item placeholder svelte-1jmtv0w"),attr(ue,"role","option"),attr(ue,"aria-selected","true"),attr(ue,"tabindex","0"),toggle_class(ue,"is-selected",to[7])},m(lo,co){insert$2(lo,ue,co),append$2(ue,eo),append$2(eo,no),append$2(ue,ro),append$2(ue,oo),append$2(oo,io),ao||(so=listen(ue,"click",to[38]),ao=!0)},p(lo,co){co[0]&256&&set_data(no,lo[8]),co[0]&128&&toggle_class(ue,"is-selected",lo[7])},d(lo){lo&&detach(ue),ao=!1,so()}}}function create_if_block_2$1S(to){let ue,eo,no=ensure_array_like(to[30]),ro=[];for(let io=0;io<no.length;io+=1)ro[io]=create_each_block$2h(get_each_context$2h(to,no,io));const oo=io=>transition_out(ro[io],1,1,()=>{ro[io]=null});return{c(){for(let io=0;io<ro.length;io+=1)ro[io].c();ue=empty$2()},m(io,ao){for(let so=0;so<ro.length;so+=1)ro[so]&&ro[so].m(io,ao);insert$2(io,ue,ao),eo=!0},p(io,ao){if(ao[0]&1275330048){no=ensure_array_like(io[30]);let so;for(so=0;so<no.length;so+=1){const lo=get_each_context$2h(io,no,so);ro[so]?(ro[so].p(lo,ao),transition_in(ro[so],1)):(ro[so]=create_each_block$2h(lo),ro[so].c(),transition_in(ro[so],1),ro[so].m(ue.parentNode,ue))}for(group_outros(),so=no.length;so<ro.length;so+=1)oo(so);check_outros()}},i(io){if(!eo){for(let ao=0;ao<no.length;ao+=1)transition_in(ro[ao]);eo=!0}},o(io){ro=ro.filter(Boolean);for(let ao=0;ao<ro.length;ao+=1)transition_out(ro[ao]);eo=!1},d(io){io&&detach(ue),destroy_each(ro,io)}}}function create_if_block_6$w(to){let ue,eo,no,ro;const oo=[create_if_block_7$s,create_else_block$20],io=[];function ao(so,lo){return so[17]?0:1}return eo=ao(to),no=io[eo]=oo[eo](to),{c(){ue=element("span"),no.c(),attr(ue,"class","option-extra icon svelte-1jmtv0w")},m(so,lo){insert$2(so,ue,lo),io[eo].m(ue,null),ro=!0},p(so,lo){let co=eo;eo=ao(so),eo===co?io[eo].p(so,lo):(group_outros(),transition_out(io[co],1,1,()=>{io[co]=null}),check_outros(),no=io[eo],no?no.p(so,lo):(no=io[eo]=oo[eo](so),no.c()),transition_in(no,1),no.m(ue,null))},i(so){ro||(transition_in(no),ro=!0)},o(so){transition_out(no),ro=!1},d(so){so&&detach(ue),io[eo].d()}}}function create_else_block$20(to){let ue,eo;return ue=new Icon({props:{size:"S",name:to[14](to[49],to[51])}}),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},p(no,ro){const oo={};ro[0]&1073758208&&(oo.name=no[14](no[49],no[51])),ue.$set(oo)},i(no){eo||(transition_in(ue.$$.fragment,no),eo=!0)},o(no){transition_out(ue.$$.fragment,no),eo=!1},d(no){destroy_component(ue,no)}}}function create_if_block_7$s(to){let ue,eo;return{c(){ue=element("img"),src_url_equal(ue.src,eo=to[14](to[49],to[51]))||attr(ue,"src",eo),attr(ue,"alt","icon"),attr(ue,"width","15"),attr(ue,"height","15")},m(no,ro){insert$2(no,ue,ro)},p(no,ro){ro[0]&1073758208&&!src_url_equal(ue.src,eo=no[14](no[49],no[51]))&&attr(ue,"src",eo)},i:noop$7,o:noop$7,d(no){no&&detach(ue)}}}function create_if_block_5$H(to){let ue,eo,no;return eo=new StatusLight({props:{square:!0,color:to[15](to[49],to[51])}}),{c(){ue=element("span"),create_component(eo.$$.fragment),attr(ue,"class","option-extra svelte-1jmtv0w")},m(ro,oo){insert$2(ro,ue,oo),mount_component(eo,ue,null),no=!0},p(ro,oo){const io={};oo[0]&1073774592&&(io.color=ro[15](ro[49],ro[51])),eo.$set(io)},i(ro){no||(transition_in(eo.$$.fragment,ro),no=!0)},o(ro){transition_out(eo.$$.fragment,ro),no=!1},d(ro){ro&&detach(ue),destroy_component(eo)}}}function create_if_block_4$V(to){let ue,eo=to[16](to[49],to[51])+"",no;return{c(){ue=element("span"),no=text(eo),attr(ue,"class","subtitle-text svelte-1jmtv0w")},m(ro,oo){insert$2(ro,ue,oo),append$2(ue,no)},p(ro,oo){oo[0]&1073807360&&eo!==(eo=ro[16](ro[49],ro[51])+"")&&set_data(no,eo)},d(ro){ro&&detach(ue)}}}function create_if_block_3$1i(to){let ue,eo,no;return eo=new Tags({props:{$$slots:{default:[create_default_slot_1$4p]},$$scope:{ctx:to}}}),{c(){ue=element("span"),create_component(eo.$$.fragment),attr(ue,"class","option-tag svelte-1jmtv0w")},m(ro,oo){insert$2(ro,ue,oo),mount_component(eo,ue,null),no=!0},p(ro,oo){const io={};oo[0]&1073741824|oo[1]&2097152&&(io.$$scope={dirty:oo,ctx:ro}),eo.$set(io)},i(ro){no||(transition_in(eo.$$.fragment,ro),no=!0)},o(ro){transition_out(eo.$$.fragment,ro),no=!1},d(ro){ro&&detach(ue),destroy_component(eo)}}}function create_default_slot_2$36(to){let ue=to[49].tag+"",eo;return{c(){eo=text(ue)},m(no,ro){insert$2(no,eo,ro)},p(no,ro){ro[0]&1073741824&&ue!==(ue=no[49].tag+"")&&set_data(eo,ue)},d(no){no&&detach(eo)}}}function create_default_slot_1$4p(to){let ue,eo;return ue=new Tag$1({props:{icon:"LockClosed",$$slots:{default:[create_default_slot_2$36]},$$scope:{ctx:to}}}),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},p(no,ro){const oo={};ro[0]&1073741824|ro[1]&2097152&&(oo.$$scope={dirty:ro,ctx:no}),ue.$set(oo)},i(no){eo||(transition_in(ue.$$.fragment,no),eo=!0)},o(no){transition_out(ue.$$.fragment,no),eo=!1},d(no){destroy_component(ue,no)}}}function create_each_block$2h(to){let ue,eo=to[14](to[49],to[51]),no,ro=to[15](to[49],to[51]),oo,io,ao=to[12](to[49],to[51])+"",so,lo,co=to[16](to[49],to[51]),uo,fo,po,ho,_o,go,bo,vo,yo=eo&&create_if_block_6$w(to),$o=ro&&create_if_block_5$H(to),ko=co&&create_if_block_4$V(to),So=to[49].tag&&create_if_block_3$1i(to);function Ao(){return to[39](to[49],to[51])}function Mo(...To){return to[40](to[49],...To)}function Eo(...To){return to[41](to[49],...To)}return{c(){ue=element("li"),yo&&yo.c(),no=space$1(),$o&&$o.c(),oo=space$1(),io=element("span"),so=text(ao),lo=space$1(),ko&&ko.c(),uo=space$1(),So&&So.c(),fo=space$1(),po=svg_element("svg"),ho=svg_element("use"),_o=space$1(),attr(io,"class","spectrum-Menu-itemLabel svelte-1jmtv0w"),xlink_attr(ho,"xlink:href","#spectrum-css-icon-Checkmark100"),attr(po,"class","spectrum-Icon spectrum-UIIcon-Checkmark100 spectrum-Menu-checkmark spectrum-Menu-itemIcon svelte-1jmtv0w"),attr(po,"focusable","false"),attr(po,"aria-hidden","true"),attr(ue,"class","spectrum-Menu-item svelte-1jmtv0w"),attr(ue,"role","option"),attr(ue,"aria-selected","true"),attr(ue,"tabindex","0"),toggle_class(ue,"is-selected",to[9](to[13](to[49],to[51]))),toggle_class(ue,"is-disabled",!to[10](to[49]))},m(To,Io){insert$2(To,ue,Io),yo&&yo.m(ue,null),append$2(ue,no),$o&&$o.m(ue,null),append$2(ue,oo),append$2(ue,io),append$2(io,so),append$2(io,lo),ko&&ko.m(io,null),append$2(ue,uo),So&&So.m(ue,null),append$2(ue,fo),append$2(ue,po),append$2(po,ho),append$2(ue,_o),go=!0,bo||(vo=[listen(ue,"click",Ao),listen(ue,"mouseenter",Mo),listen(ue,"mouseleave",Eo)],bo=!0)},p(To,Io){to=To,Io[0]&1073758208&&(eo=to[14](to[49],to[51])),eo?yo?(yo.p(to,Io),Io[0]&1073758208&&transition_in(yo,1)):(yo=create_if_block_6$w(to),yo.c(),transition_in(yo,1),yo.m(ue,no)):yo&&(group_outros(),transition_out(yo,1,1,()=>{yo=null}),check_outros()),Io[0]&1073774592&&(ro=to[15](to[49],to[51])),ro?$o?($o.p(to,Io),Io[0]&1073774592&&transition_in($o,1)):($o=create_if_block_5$H(to),$o.c(),transition_in($o,1),$o.m(ue,oo)):$o&&(group_outros(),transition_out($o,1,1,()=>{$o=null}),check_outros()),(!go||Io[0]&1073745920)&&ao!==(ao=to[12](to[49],to[51])+"")&&set_data(so,ao),Io[0]&1073807360&&(co=to[16](to[49],to[51])),co?ko?ko.p(to,Io):(ko=create_if_block_4$V(to),ko.c(),ko.m(io,null)):ko&&(ko.d(1),ko=null),to[49].tag?So?(So.p(to,Io),Io[0]&1073741824&&transition_in(So,1)):(So=create_if_block_3$1i(to),So.c(),transition_in(So,1),So.m(ue,fo)):So&&(group_outros(),transition_out(So,1,1,()=>{So=null}),check_outros()),(!go||Io[0]&1073750528)&&toggle_class(ue,"is-selected",to[9](to[13](to[49],to[51]))),(!go||Io[0]&1073742848)&&toggle_class(ue,"is-disabled",!to[10](to[49]))},i(To){go||(transition_in(yo),transition_in($o),transition_in(So),go=!0)},o(To){transition_out(yo),transition_out($o),transition_out(So),go=!1},d(To){To&&detach(ue),yo&&yo.d(),$o&&$o.d(),ko&&ko.d(),So&&So.d(),bo=!1,run_all(vo)}}}function create_if_block_1$32(to){let ue,eo,no;return eo=new ProgressCircle({props:{size:"S"}}),{c(){ue=element("div"),create_component(eo.$$.fragment),attr(ue,"class","loading svelte-1jmtv0w"),toggle_class(ue,"loading--withAutocomplete",to[20])},m(ro,oo){insert$2(ro,ue,oo),mount_component(eo,ue,null),no=!0},p(ro,oo){(!no||oo[0]&1048576)&&toggle_class(ue,"loading--withAutocomplete",ro[20])},i(ro){no||(transition_in(eo.$$.fragment,ro),no=!0)},o(ro){transition_out(eo.$$.fragment,ro),no=!1},d(ro){ro&&detach(ue),destroy_component(eo)}}}function create_if_block$5x(to){let ue,eo;return{c(){ue=element("div"),eo=text(to[23]),attr(ue,"class","footer svelte-1jmtv0w")},m(no,ro){insert$2(no,ue,ro),append$2(ue,eo)},p(no,ro){ro[0]&8388608&&set_data(eo,no[23])},d(no){no&&detach(ue)}}}function create_default_slot$6_(to){let ue,eo,no,ro,oo,io,ao,so,lo,co,uo=to[20]&&create_if_block_9$h(to),fo=to[8]&&create_if_block_8$k(to),po=to[30].length&&create_if_block_2$1S(to),ho=to[25]&&create_if_block_1$32(to),_o=to[23]&&create_if_block$5x(to);return{c(){ue=element("div"),uo&&uo.c(),eo=space$1(),no=element("ul"),fo&&fo.c(),ro=space$1(),po&&po.c(),oo=space$1(),ho&&ho.c(),io=space$1(),_o&&_o.c(),attr(no,"class","spectrum-Menu"),attr(no,"role","listbox"),attr(ue,"class","popover-content svelte-1jmtv0w"),toggle_class(ue,"auto-width",to[19])},m(go,bo){insert$2(go,ue,bo),uo&&uo.m(ue,null),append$2(ue,eo),append$2(ue,no),fo&&fo.m(no,null),append$2(no,ro),po&&po.m(no,null),to[42](no),append$2(ue,oo),ho&&ho.m(ue,null),append$2(ue,io),_o&&_o.m(ue,null),so=!0,lo||(co=action_destroyer(ao=clickOutside.call(null,ue,to[43])),lo=!0)},p(go,bo){go[20]?uo?(uo.p(go,bo),bo[0]&1048576&&transition_in(uo,1)):(uo=create_if_block_9$h(go),uo.c(),transition_in(uo,1),uo.m(ue,eo)):uo&&(group_outros(),transition_out(uo,1,1,()=>{uo=null}),check_outros()),go[8]?fo?fo.p(go,bo):(fo=create_if_block_8$k(go),fo.c(),fo.m(no,ro)):fo&&(fo.d(1),fo=null),go[30].length?po?(po.p(go,bo),bo[0]&1073741824&&transition_in(po,1)):(po=create_if_block_2$1S(go),po.c(),transition_in(po,1),po.m(no,null)):po&&(group_outros(),transition_out(po,1,1,()=>{po=null}),check_outros()),go[25]?ho?(ho.p(go,bo),bo[0]&33554432&&transition_in(ho,1)):(ho=create_if_block_1$32(go),ho.c(),transition_in(ho,1),ho.m(ue,io)):ho&&(group_outros(),transition_out(ho,1,1,()=>{ho=null}),check_outros()),go[23]?_o?_o.p(go,bo):(_o=create_if_block$5x(go),_o.c(),_o.m(ue,null)):_o&&(_o.d(1),_o=null),ao&&is_function(ao.update)&&bo[0]&2&&ao.update.call(null,go[43]),(!so||bo[0]&524288)&&toggle_class(ue,"auto-width",go[19])},i(go){so||(transition_in(uo),transition_in(po),transition_in(ho),so=!0)},o(go){transition_out(uo),transition_out(po),transition_out(ho),so=!1},d(go){go&&detach(ue),uo&&uo.d(),fo&&fo.d(),po&&po.d(),to[42](null),ho&&ho.d(),_o&&_o.d(),lo=!1,co()}}}function create_fragment$bJ(to){let ue,eo,no,ro,oo,io,ao,so,lo,co,uo,fo,po,ho=to[5]&&create_if_block_11$6(to),_o=to[6]&&create_if_block_10$a(to);return co=new Popover({props:{anchor:to[24]?to[24]:to[29],align:to[22]||PopoverAlignment.Left,open:to[1],useAnchorWidth:!to[19],maxWidth:to[19]?400:void 0,customHeight:to[21],maxHeight:360,$$slots:{default:[create_default_slot$6_]},$$scope:{ctx:to}}}),co.$on("close",to[44]),{c(){ue=element("button"),ho&&ho.c(),eo=space$1(),_o&&_o.c(),no=space$1(),ro=element("span"),oo=text(to[4]),io=space$1(),ao=svg_element("svg"),so=svg_element("use"),lo=space$1(),create_component(co.$$.fragment),attr(ro,"class","spectrum-Picker-label svelte-1jmtv0w"),toggle_class(ro,"is-placeholder",to[7]),toggle_class(ro,"auto-width",to[19]),xlink_attr(so,"xlink:href","#spectrum-css-icon-Chevron100"),attr(ao,"class","spectrum-Icon spectrum-UIIcon-ChevronDown100 spectrum-Picker-menuIcon"),attr(ao,"focusable","false"),attr(ao,"aria-hidden","true"),attr(ue,"id",to[2]),attr(ue,"class","spectrum-Picker spectrum-Picker--sizeM svelte-1jmtv0w"),ue.disabled=to[3],attr(ue,"aria-haspopup","listbox"),toggle_class(ue,"spectrum-Picker--quiet",to[18]),toggle_class(ue,"is-open",to[1])},m(go,bo){insert$2(go,ue,bo),ho&&ho.m(ue,null),append$2(ue,eo),_o&&_o.m(ue,null),append$2(ue,no),append$2(ue,ro),append$2(ro,oo),append$2(ue,io),append$2(ue,ao),append$2(ao,so),to[36](ue),insert$2(go,lo,bo),mount_component(co,go,bo),uo=!0,fo||(po=listen(ue,"click",to[31]),fo=!0)},p(go,bo){go[5]?ho?(ho.p(go,bo),bo[0]&32&&transition_in(ho,1)):(ho=create_if_block_11$6(go),ho.c(),transition_in(ho,1),ho.m(ue,eo)):ho&&(group_outros(),transition_out(ho,1,1,()=>{ho=null}),check_outros()),go[6]?_o?(_o.p(go,bo),bo[0]&64&&transition_in(_o,1)):(_o=create_if_block_10$a(go),_o.c(),transition_in(_o,1),_o.m(ue,no)):_o&&(group_outros(),transition_out(_o,1,1,()=>{_o=null}),check_outros()),(!uo||bo[0]&16)&&set_data(oo,go[4]),(!uo||bo[0]&128)&&toggle_class(ro,"is-placeholder",go[7]),(!uo||bo[0]&524288)&&toggle_class(ro,"auto-width",go[19]),(!uo||bo[0]&4)&&attr(ue,"id",go[2]),(!uo||bo[0]&8)&&(ue.disabled=go[3]),(!uo||bo[0]&262144)&&toggle_class(ue,"spectrum-Picker--quiet",go[18]),(!uo||bo[0]&2)&&toggle_class(ue,"is-open",go[1]);const vo={};bo[0]&553648128&&(vo.anchor=go[24]?go[24]:go[29]),bo[0]&4194304&&(vo.align=go[22]||PopoverAlignment.Left),bo[0]&2&&(vo.open=go[1]),bo[0]&524288&&(vo.useAnchorWidth=!go[19]),bo[0]&524288&&(vo.maxWidth=go[19]?400:void 0),bo[0]&2097152&&(vo.customHeight=go[21]),bo[0]&1587281803|bo[1]&2097152&&(vo.$$scope={dirty:bo,ctx:go}),co.$set(vo)},i(go){uo||(transition_in(ho),transition_in(_o),transition_in(co.$$.fragment,go),uo=!0)},o(go){transition_out(ho),transition_out(_o),transition_out(co.$$.fragment,go),uo=!1},d(go){go&&(detach(ue),detach(lo)),ho&&ho.d(),_o&&_o.d(),to[36](null),destroy_component(co,go),fo=!1,po()}}}function instance$bG(to,ue,eo){let no,ro,{id:oo=void 0}=ue,{disabled:io=!1}=ue,{fieldText:ao=""}=ue,{fieldIcon:so=""}=ue,{fieldColour:lo=""}=ue,{isPlaceholder:co=!1}=ue,{placeholderOption:uo=void 0}=ue,{options:fo=[]}=ue,{isOptionSelected:po=Ea=>Ea}=ue,{isOptionEnabled:ho=(Ea,Sa)=>Ea}=ue,{onSelectOption:_o=()=>{}}=ue,{getOptionLabel:go=(Ea,Sa)=>`${Ea}`}=ue,{getOptionValue:bo=(Ea,Sa)=>Ea}=ue,{getOptionIcon:vo=(Ea,Sa)=>(Ea==null?void 0:Ea.icon)??void 0}=ue,{getOptionColour:yo=(Ea,Sa)=>(Ea==null?void 0:Ea.colour)??void 0}=ue,{getOptionSubtitle:$o=(Ea,Sa)=>(Ea==null?void 0:Ea.subtitle)??void 0}=ue,{useOptionIconImage:ko=!1}=ue,{open:So=!1}=ue,{readonly:Ao=!1}=ue,{quiet:Mo=!1}=ue,{autoWidth:Eo=!1}=ue,{autocomplete:To=!1}=ue,{sort:Io=!1}=ue,{searchTerm:No=null}=ue,{customPopoverHeight:xo=void 0}=ue,{align:zo=PopoverAlignment.Left}=ue,{footer:Po=void 0}=ue,{customAnchor:Bo=void 0}=ue,{loading:qo=!1}=ue,{onOptionMouseenter:Fo=()=>{}}=ue,{onOptionMouseleave:Wo=()=>{}}=ue;const Go=createEventDispatcher();let Yo,Xo;const Qo=Ea=>{Ea.preventDefault(),Ea.stopPropagation(),Go("click"),!Ao&&(eo(0,No=null),eo(1,So=!So))},Jo=(Ea,Sa,Ra)=>!(Ea!=null&&Ea.length)||!Array.isArray(Ea)?[]:Ra?Ea.sort(($a,ds)=>{const Ma=Sa($a),ga=Sa(ds);return Ma>ga?1:-1}):Ea,na=(Ea,Sa,Ra)=>{if(To&&Sa){const $a=Sa.toLowerCase();return Ea.filter(ds=>`${Ra(ds)}`.toLowerCase().includes($a))}return Ea},Ko=Ea=>{Ea.target.scrollHeight-Ea.target.clientHeight-Ea.target.scrollTop<100&&Go("loadMore")};onDestroy(()=>{Xo==null||Xo.removeEventListener("scroll",null)});function ia(Ea){binding_callbacks[Ea?"unshift":"push"](()=>{Yo=Ea,eo(29,Yo)})}const ea=Ea=>eo(0,No=Ea.detail),sa=()=>_o(null),Aa=(Ea,Sa)=>_o(bo(Ea,Sa)),pa=(Ea,Sa)=>Fo(Sa,Ea),va=(Ea,Sa)=>Wo(Sa,Ea);function ha(Ea){binding_callbacks[Ea?"unshift":"push"](()=>{Xo=Ea,eo(28,Xo)})}const La=()=>{eo(1,So=!1)},Ba=()=>eo(1,So=!1);return to.$$set=Ea=>{"id"in Ea&&eo(2,oo=Ea.id),"disabled"in Ea&&eo(3,io=Ea.disabled),"fieldText"in Ea&&eo(4,ao=Ea.fieldText),"fieldIcon"in Ea&&eo(5,so=Ea.fieldIcon),"fieldColour"in Ea&&eo(6,lo=Ea.fieldColour),"isPlaceholder"in Ea&&eo(7,co=Ea.isPlaceholder),"placeholderOption"in Ea&&eo(8,uo=Ea.placeholderOption),"options"in Ea&&eo(32,fo=Ea.options),"isOptionSelected"in Ea&&eo(9,po=Ea.isOptionSelected),"isOptionEnabled"in Ea&&eo(10,ho=Ea.isOptionEnabled),"onSelectOption"in Ea&&eo(11,_o=Ea.onSelectOption),"getOptionLabel"in Ea&&eo(12,go=Ea.getOptionLabel),"getOptionValue"in Ea&&eo(13,bo=Ea.getOptionValue),"getOptionIcon"in Ea&&eo(14,vo=Ea.getOptionIcon),"getOptionColour"in Ea&&eo(15,yo=Ea.getOptionColour),"getOptionSubtitle"in Ea&&eo(16,$o=Ea.getOptionSubtitle),"useOptionIconImage"in Ea&&eo(17,ko=Ea.useOptionIconImage),"open"in Ea&&eo(1,So=Ea.open),"readonly"in Ea&&eo(33,Ao=Ea.readonly),"quiet"in Ea&&eo(18,Mo=Ea.quiet),"autoWidth"in Ea&&eo(19,Eo=Ea.autoWidth),"autocomplete"in Ea&&eo(20,To=Ea.autocomplete),"sort"in Ea&&eo(34,Io=Ea.sort),"searchTerm"in Ea&&eo(0,No=Ea.searchTerm),"customPopoverHeight"in Ea&&eo(21,xo=Ea.customPopoverHeight),"align"in Ea&&eo(22,zo=Ea.align),"footer"in Ea&&eo(23,Po=Ea.footer),"customAnchor"in Ea&&eo(24,Bo=Ea.customAnchor),"loading"in Ea&&eo(25,qo=Ea.loading),"onOptionMouseenter"in Ea&&eo(26,Fo=Ea.onOptionMouseenter),"onOptionMouseleave"in Ea&&eo(27,Wo=Ea.onOptionMouseleave)},to.$$.update=()=>{to.$$.dirty[0]&4096|to.$$.dirty[1]&10&&eo(35,no=Jo(fo,go,Io)),to.$$.dirty[0]&4097|to.$$.dirty[1]&16&&eo(30,ro=na(no,No,go)),to.$$.dirty[0]&268435456&&(Xo==null||Xo.addEventListener("scroll",Ko))},[No,So,oo,io,ao,so,lo,co,uo,po,ho,_o,go,bo,vo,yo,$o,ko,Mo,Eo,To,xo,zo,Po,Bo,qo,Fo,Wo,Xo,Yo,ro,Qo,fo,Ao,Io,no,ia,ea,sa,Aa,pa,va,ha,La,Ba]}class Picker extends SvelteComponent{constructor(ue){super(),init$3(this,ue,instance$bG,create_fragment$bJ,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$bI(to){let ue,eo,no,ro;function oo(so){to[32](so)}function io(so){to[33](so)}let ao={quiet:to[15],id:to[3],disabled:to[5],readonly:to[14],fieldText:to[27],fieldIcon:to[26],fieldColour:to[25],options:to[6],autoWidth:to[16],align:to[19],footer:to[20],getOptionLabel:to[7],getOptionValue:to[8],getOptionIcon:to[9],getOptionColour:to[10],getOptionSubtitle:to[11],useOptionIconImage:to[12],isOptionEnabled:to[13],autocomplete:to[17],sort:to[18],onOptionMouseenter:to[22],onOptionMouseleave:to[23],isPlaceholder:to[2]==null||to[2]==="",placeholderOption:to[4]===!1?void 0:to[4]||"Choose an option",isOptionSelected:to[31],onSelectOption:to[29],loading:to[21],customPopoverHeight:to[24]};return to[0]!==void 0&&(ao.open=to[0]),to[1]!==void 0&&(ao.searchTerm=to[1]),ue=new Picker({props:ao}),binding_callbacks.push(()=>bind$2(ue,"open",oo)),binding_callbacks.push(()=>bind$2(ue,"searchTerm",io)),ue.$on("click",to[34]),ue.$on("loadMore",to[35]),{c(){create_component(ue.$$.fragment)},m(so,lo){mount_component(ue,so,lo),ro=!0},p(so,lo){const co={};lo[0]&32768&&(co.quiet=so[15]),lo[0]&8&&(co.id=so[3]),lo[0]&32&&(co.disabled=so[5]),lo[0]&16384&&(co.readonly=so[14]),lo[0]&134217728&&(co.fieldText=so[27]),lo[0]&67108864&&(co.fieldIcon=so[26]),lo[0]&33554432&&(co.fieldColour=so[25]),lo[0]&64&&(co.options=so[6]),lo[0]&65536&&(co.autoWidth=so[16]),lo[0]&524288&&(co.align=so[19]),lo[0]&1048576&&(co.footer=so[20]),lo[0]&128&&(co.getOptionLabel=so[7]),lo[0]&256&&(co.getOptionValue=so[8]),lo[0]&512&&(co.getOptionIcon=so[9]),lo[0]&1024&&(co.getOptionColour=so[10]),lo[0]&2048&&(co.getOptionSubtitle=so[11]),lo[0]&4096&&(co.useOptionIconImage=so[12]),lo[0]&8192&&(co.isOptionEnabled=so[13]),lo[0]&131072&&(co.autocomplete=so[17]),lo[0]&262144&&(co.sort=so[18]),lo[0]&4194304&&(co.onOptionMouseenter=so[22]),lo[0]&8388608&&(co.onOptionMouseleave=so[23]),lo[0]&4&&(co.isPlaceholder=so[2]==null||so[2]===""),lo[0]&16&&(co.placeholderOption=so[4]===!1?void 0:so[4]||"Choose an option"),lo[0]&4&&(co.isOptionSelected=so[31]),lo[0]&2097152&&(co.loading=so[21]),lo[0]&16777216&&(co.customPopoverHeight=so[24]),!eo&&lo[0]&1&&(eo=!0,co.open=so[0],add_flush_callback(()=>eo=!1)),!no&&lo[0]&2&&(no=!0,co.searchTerm=so[1],add_flush_callback(()=>no=!1)),ue.$set(co)},i(so){ro||(transition_in(ue.$$.fragment,so),ro=!0)},o(so){transition_out(ue.$$.fragment,so),ro=!1},d(so){destroy_component(ue,so)}}}function instance$bF(to,ue,eo){let no,ro,oo,{value:io=null}=ue,{id:ao=void 0}=ue,{placeholder:so="Choose an option"}=ue,{disabled:lo=!1}=ue,{options:co=[]}=ue,{getOptionLabel:uo=(Ko,ia)=>`${Ko}`}=ue,{getOptionValue:fo=(Ko,ia)=>Ko}=ue,{getOptionIcon:po=(Ko,ia)=>(Ko==null?void 0:Ko.icon)??void 0}=ue,{getOptionColour:ho=(Ko,ia)=>(Ko==null?void 0:Ko.colour)??void 0}=ue,{getOptionSubtitle:_o=(Ko,ia)=>(Ko==null?void 0:Ko.subtitle)??void 0}=ue,{compare:go=(Ko,ia)=>Ko===ia}=ue,{useOptionIconImage:bo=!1}=ue,{isOptionEnabled:vo=(Ko,ia)=>Ko}=ue,{readonly:yo=!1}=ue,{quiet:$o=!1}=ue,{autoWidth:ko=!1}=ue,{autocomplete:So=!1}=ue,{sort:Ao=!1}=ue,{align:Mo=PopoverAlignment.Left}=ue,{footer:Eo=void 0}=ue,{open:To=!1}=ue,{searchTerm:Io=void 0}=ue,{loading:No=void 0}=ue,{onOptionMouseenter:xo=()=>{}}=ue,{onOptionMouseleave:zo=()=>{}}=ue,{customPopoverHeight:Po=void 0}=ue;const Bo=createEventDispatcher();function qo(Ko,ia){return typeof go=="function"?go(Ko,ia):Ko===ia}const Fo=(Ko,ia,ea)=>{if(!(ea!=null&&ea.length))return"";const sa=ea.findIndex((Aa,pa)=>qo(fo(Aa,pa),ia));return sa!==-1?Ko(ea[sa],sa):null},Wo=(Ko,ia,ea)=>Ko==null||Ko===""?ea===!1?"":ea||"Choose an option":Fo(uo,Ko,ia)||"Choose an option",Go=Ko=>{Bo("change",Ko),eo(0,To=!1)},Yo=Ko=>qo(Ko,io);function Xo(Ko){To=Ko,eo(0,To)}function Qo(Ko){Io=Ko,eo(1,Io)}function Jo(Ko){bubble.call(this,to,Ko)}function na(Ko){bubble.call(this,to,Ko)}return to.$$set=Ko=>{"value"in Ko&&eo(2,io=Ko.value),"id"in Ko&&eo(3,ao=Ko.id),"placeholder"in Ko&&eo(4,so=Ko.placeholder),"disabled"in Ko&&eo(5,lo=Ko.disabled),"options"in Ko&&eo(6,co=Ko.options),"getOptionLabel"in Ko&&eo(7,uo=Ko.getOptionLabel),"getOptionValue"in Ko&&eo(8,fo=Ko.getOptionValue),"getOptionIcon"in Ko&&eo(9,po=Ko.getOptionIcon),"getOptionColour"in Ko&&eo(10,ho=Ko.getOptionColour),"getOptionSubtitle"in Ko&&eo(11,_o=Ko.getOptionSubtitle),"compare"in Ko&&eo(30,go=Ko.compare),"useOptionIconImage"in Ko&&eo(12,bo=Ko.useOptionIconImage),"isOptionEnabled"in Ko&&eo(13,vo=Ko.isOptionEnabled),"readonly"in Ko&&eo(14,yo=Ko.readonly),"quiet"in Ko&&eo(15,$o=Ko.quiet),"autoWidth"in Ko&&eo(16,ko=Ko.autoWidth),"autocomplete"in Ko&&eo(17,So=Ko.autocomplete),"sort"in Ko&&eo(18,Ao=Ko.sort),"align"in Ko&&eo(19,Mo=Ko.align),"footer"in Ko&&eo(20,Eo=Ko.footer),"open"in Ko&&eo(0,To=Ko.open),"searchTerm"in Ko&&eo(1,Io=Ko.searchTerm),"loading"in Ko&&eo(21,No=Ko.loading),"onOptionMouseenter"in Ko&&eo(22,xo=Ko.onOptionMouseenter),"onOptionMouseleave"in Ko&&eo(23,zo=Ko.onOptionMouseleave),"customPopoverHeight"in Ko&&eo(24,Po=Ko.customPopoverHeight)},to.$$.update=()=>{to.$$.dirty[0]&84&&eo(27,no=Wo(io,co,so)),to.$$.dirty[0]&580&&eo(26,ro=Fo(po,io,co)),to.$$.dirty[0]&1092&&eo(25,oo=Fo(ho,io,co))},[To,Io,io,ao,so,lo,co,uo,fo,po,ho,_o,bo,vo,yo,$o,ko,So,Ao,Mo,Eo,No,xo,zo,Po,oo,ro,no,qo,Go,go,Yo,Xo,Qo,Jo,na]}class Select extends SvelteComponent{constructor(ue){super(),init$3(this,ue,instance$bF,create_fragment$bI,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$6Z(to){let ue,eo;return ue=new Select({props:{quiet:to[15],disabled:to[2],readonly:to[3],value:to[0],options:to[7],placeholder:to[6],autoWidth:to[16],sort:to[17],align:to[21],footer:to[22],getOptionLabel:to[8],getOptionValue:to[9],getOptionIcon:to[11],getOptionColour:to[12],getOptionSubtitle:to[10],useOptionIconImage:to[13],isOptionEnabled:to[14],autocomplete:to[19],customPopoverHeight:to[20],compare:to[24],onOptionMouseenter:to[25],onOptionMouseleave:to[26]}}),ue.$on("change",to[27]),ue.$on("click",to[28]),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},p(no,ro){const oo={};ro[0]&32768&&(oo.quiet=no[15]),ro[0]&4&&(oo.disabled=no[2]),ro[0]&8&&(oo.readonly=no[3]),ro[0]&1&&(oo.value=no[0]),ro[0]&128&&(oo.options=no[7]),ro[0]&64&&(oo.placeholder=no[6]),ro[0]&65536&&(oo.autoWidth=no[16]),ro[0]&131072&&(oo.sort=no[17]),ro[0]&2097152&&(oo.align=no[21]),ro[0]&4194304&&(oo.footer=no[22]),ro[0]&256&&(oo.getOptionLabel=no[8]),ro[0]&512&&(oo.getOptionValue=no[9]),ro[0]&2048&&(oo.getOptionIcon=no[11]),ro[0]&4096&&(oo.getOptionColour=no[12]),ro[0]&1024&&(oo.getOptionSubtitle=no[10]),ro[0]&8192&&(oo.useOptionIconImage=no[13]),ro[0]&16384&&(oo.isOptionEnabled=no[14]),ro[0]&524288&&(oo.autocomplete=no[19]),ro[0]&1048576&&(oo.customPopoverHeight=no[20]),ro[0]&16777216&&(oo.compare=no[24]),ro[0]&33554432&&(oo.onOptionMouseenter=no[25]),ro[0]&67108864&&(oo.onOptionMouseleave=no[26]),ue.$set(oo)},i(no){eo||(transition_in(ue.$$.fragment,no),eo=!0)},o(no){transition_out(ue.$$.fragment,no),eo=!1},d(no){destroy_component(ue,no)}}}function create_fragment$bH(to){let ue,eo;return ue=new Field({props:{helpText:to[23],label:to[1],labelPosition:to[4],error:to[5],tooltip:to[18],$$slots:{default:[create_default_slot$6Z]},$$scope:{ctx:to}}}),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},p(no,ro){const oo={};ro[0]&8388608&&(oo.helpText=no[23]),ro[0]&2&&(oo.label=no[1]),ro[0]&16&&(oo.labelPosition=no[4]),ro[0]&32&&(oo.error=no[5]),ro[0]&262144&&(oo.tooltip=no[18]),ro[0]&125566925|ro[1]&1&&(oo.$$scope={dirty:ro,ctx:no}),ue.$set(oo)},i(no){eo||(transition_in(ue.$$.fragment,no),eo=!0)},o(no){transition_out(ue.$$.fragment,no),eo=!1},d(no){destroy_component(ue,no)}}}function instance$bE(to,ue,eo){let{value:no=void 0}=ue,{label:ro=void 0}=ue,{disabled:oo=!1}=ue,{readonly:io=!1}=ue,{labelPosition:ao="above"}=ue,{error:so=void 0}=ue,{placeholder:lo="Choose an option"}=ue,{options:co=[]}=ue,{getOptionLabel:uo=(Fo,Wo)=>Bo(Fo,"label")}=ue,{getOptionValue:fo=(Fo,Wo)=>Bo(Fo,"value")}=ue,{getOptionSubtitle:po=(Fo,Wo)=>Fo==null?void 0:Fo.subtitle}=ue,{getOptionIcon:ho=(Fo,Wo)=>Fo==null?void 0:Fo.icon}=ue,{getOptionColour:_o=(Fo,Wo)=>Fo==null?void 0:Fo.colour}=ue,{useOptionIconImage:go=!1}=ue,{isOptionEnabled:bo=void 0}=ue,{quiet:vo=!1}=ue,{autoWidth:yo=!1}=ue,{sort:$o=!1}=ue,{tooltip:ko=void 0}=ue,{autocomplete:So=!1}=ue,{customPopoverHeight:Ao=void 0}=ue,{align:Mo=PopoverAlignment.Left}=ue,{footer:Eo=void 0}=ue,{helpText:To=void 0}=ue,{compare:Io=void 0}=ue,{onOptionMouseenter:No=()=>{}}=ue,{onOptionMouseleave:xo=()=>{}}=ue;const zo=createEventDispatcher(),Po=Fo=>{eo(0,no=Fo.detail),zo("change",Fo.detail)},Bo=(Fo,Wo)=>Fo&&typeof Fo=="object"?Fo[Wo]:Fo;function qo(Fo){bubble.call(this,to,Fo)}return to.$$set=Fo=>{"value"in Fo&&eo(0,no=Fo.value),"label"in Fo&&eo(1,ro=Fo.label),"disabled"in Fo&&eo(2,oo=Fo.disabled),"readonly"in Fo&&eo(3,io=Fo.readonly),"labelPosition"in Fo&&eo(4,ao=Fo.labelPosition),"error"in Fo&&eo(5,so=Fo.error),"placeholder"in Fo&&eo(6,lo=Fo.placeholder),"options"in Fo&&eo(7,co=Fo.options),"getOptionLabel"in Fo&&eo(8,uo=Fo.getOptionLabel),"getOptionValue"in Fo&&eo(9,fo=Fo.getOptionValue),"getOptionSubtitle"in Fo&&eo(10,po=Fo.getOptionSubtitle),"getOptionIcon"in Fo&&eo(11,ho=Fo.getOptionIcon),"getOptionColour"in Fo&&eo(12,_o=Fo.getOptionColour),"useOptionIconImage"in Fo&&eo(13,go=Fo.useOptionIconImage),"isOptionEnabled"in Fo&&eo(14,bo=Fo.isOptionEnabled),"quiet"in Fo&&eo(15,vo=Fo.quiet),"autoWidth"in Fo&&eo(16,yo=Fo.autoWidth),"sort"in Fo&&eo(17,$o=Fo.sort),"tooltip"in Fo&&eo(18,ko=Fo.tooltip),"autocomplete"in Fo&&eo(19,So=Fo.autocomplete),"customPopoverHeight"in Fo&&eo(20,Ao=Fo.customPopoverHeight),"align"in Fo&&eo(21,Mo=Fo.align),"footer"in Fo&&eo(22,Eo=Fo.footer),"helpText"in Fo&&eo(23,To=Fo.helpText),"compare"in Fo&&eo(24,Io=Fo.compare),"onOptionMouseenter"in Fo&&eo(25,No=Fo.onOptionMouseenter),"onOptionMouseleave"in Fo&&eo(26,xo=Fo.onOptionMouseleave)},[no,ro,oo,io,ao,so,lo,co,uo,fo,po,ho,_o,go,bo,vo,yo,$o,ko,So,Ao,Mo,Eo,To,Io,No,xo,Po,qo]}let Select_1$1=class extends SvelteComponent{constructor(ue){super(),init$3(this,ue,instance$bE,create_fragment$bH,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$r="",Combobox_svelte_svelte_type_style_lang="";function get_each_context$2g(to,ue,eo){const no=to.slice();return no[22]=ue[eo],no}function create_if_block$5w(to){let ue,eo=ensure_array_like(to[5]),no=[];for(let ro=0;ro<eo.length;ro+=1)no[ro]=create_each_block$2g(get_each_context$2g(to,eo,ro));return{c(){for(let ro=0;ro<no.length;ro+=1)no[ro].c();ue=empty$2()},m(ro,oo){for(let io=0;io<no.length;io+=1)no[io]&&no[io].m(ro,oo);insert$2(ro,ue,oo)},p(ro,oo){if(oo&8417){eo=ensure_array_like(ro[5]);let io;for(io=0;io<eo.length;io+=1){const ao=get_each_context$2g(ro,eo,io);no[io]?no[io].p(ao,oo):(no[io]=create_each_block$2g(ao),no[io].c(),no[io].m(ue.parentNode,ue))}for(;io<no.length;io+=1)no[io].d(1);no.length=eo.length}},d(ro){ro&&detach(ue),destroy_each(no,ro)}}}function create_each_block$2g(to){let ue,eo,no=to[6](to[22])+"",ro,oo,io,ao,so,lo,co;function uo(){return to[18](to[22])}return{c(){ue=element("li"),eo=element("span"),ro=text(no),oo=space$1(),io=svg_element("svg"),ao=svg_element("use"),so=space$1(),attr(eo,"class","spectrum-Menu-itemLabel svelte-otlbol"),xlink_attr(ao,"xlink:href","#spectrum-css-icon-Checkmark100"),attr(io,"class","spectrum-Icon spectrum-UIIcon-Checkmark100 spectrum-Menu-checkmark spectrum-Menu-itemIcon"),attr(io,"focusable","false"),attr(io,"aria-hidden","true"),attr(ue,"class","spectrum-Menu-item"),attr(ue,"role","option"),attr(ue,"aria-selected","true"),attr(ue,"tabindex","0"),toggle_class(ue,"is-selected",to[7](to[22])===to[0])},m(fo,po){insert$2(fo,ue,po),append$2(ue,eo),append$2(eo,ro),append$2(ue,oo),append$2(ue,io),append$2(io,ao),append$2(ue,so),lo||(co=listen(ue,"click",uo),lo=!0)},p(fo,po){to=fo,po&96&&no!==(no=to[6](to[22])+"")&&set_data(ro,no),po&161&&toggle_class(ue,"is-selected",to[7](to[22])===to[0])},d(fo){fo&&detach(ue),lo=!1,co()}}}function create_default_slot$6Y(to){let ue,eo,no=to[5]&&Array.isArray(to[5]),ro,oo,io,ao=no&&create_if_block$5w(to);return{c(){ue=element("div"),eo=element("ul"),ao&&ao.c(),attr(eo,"class","spectrum-Menu"),attr(eo,"role","listbox"),attr(ue,"class","popover-content svelte-otlbol")},m(so,lo){insert$2(so,ue,lo),append$2(ue,eo),ao&&ao.m(eo,null),oo||(io=action_destroyer(ro=clickOutside.call(null,ue,to[19])),oo=!0)},p(so,lo){lo&32&&(no=so[5]&&Array.isArray(so[5])),no?ao?ao.p(so,lo):(ao=create_if_block$5w(so),ao.c(),ao.m(eo,null)):ao&&(ao.d(1),ao=null),ro&&is_function(ro.update)&&lo&256&&ro.update.call(null,so[19])},d(so){so&&detach(ue),ao&&ao.d(),oo=!1,io()}}}function create_fragment$bG(to){let ue,eo,no,ro,oo,io,ao,so,lo,co,uo,fo,po,ho;return uo=new Popover({props:{anchor:to[10],open:to[8],align:PopoverAlignment.Left,useAnchorWidth:!0,$$slots:{default:[create_default_slot$6Y]},$$scope:{ctx:to}}}),uo.$on("close",to[20]),{c(){ue=element("div"),eo=element("div"),no=element("input"),io=space$1(),ao=element("button"),so=svg_element("svg"),lo=svg_element("use"),co=space$1(),create_component(uo.$$.fragment),attr(no,"id",to[1]),attr(no,"type","text"),no.value=ro=to[0]||"",attr(no,"placeholder",oo=to[2]||""),no.disabled=to[3],no.readOnly=to[4],attr(no,"class","spectrum-Textfield-input spectrum-InputGroup-input svelte-otlbol"),attr(eo,"class","spectrum-Textfield spectrum-InputGroup-textfield svelte-otlbol"),toggle_class(eo,"is-disabled",to[3]),toggle_class(eo,"is-focused",to[8]||to[9]),xlink_attr(lo,"xlink:href","#spectrum-css-icon-Chevron100"),attr(so,"class","spectrum-Icon spectrum-UIIcon-ChevronDown100 spectrum-Picker-menuIcon spectrum-InputGroup-icon"),attr(so,"focusable","false"),attr(so,"aria-hidden","true"),attr(ao,"class","spectrum-Picker spectrum-Picker--sizeM spectrum-InputGroup-button"),attr(ao,"tabindex","-1"),attr(ao,"aria-haspopup","true"),ao.disabled=to[3],attr(ue,"class","spectrum-InputGroup svelte-otlbol"),toggle_class(ue,"is-focused",to[8]||to[9]),toggle_class(ue,"is-disabled",to[3])},m(_o,go){insert$2(_o,ue,go),append$2(ue,eo),append$2(eo,no),append$2(ue,io),append$2(ue,ao),append$2(ao,so),append$2(so,lo),to[17](ue),insert$2(_o,co,go),mount_component(uo,_o,go),fo=!0,po||(ho=[listen(no,"focus",to[14]),listen(no,"blur",to[15]),listen(no,"change",to[12]),listen(ao,"click",to[16])],po=!0)},p(_o,[go]){(!fo||go&2)&&attr(no,"id",_o[1]),(!fo||go&1&&ro!==(ro=_o[0]||"")&&no.value!==ro)&&(no.value=ro),(!fo||go&4&&oo!==(oo=_o[2]||""))&&attr(no,"placeholder",oo),(!fo||go&8)&&(no.disabled=_o[3]),(!fo||go&16)&&(no.readOnly=_o[4]),(!fo||go&8)&&toggle_class(eo,"is-disabled",_o[3]),(!fo||go&768)&&toggle_class(eo,"is-focused",_o[8]||_o[9]),(!fo||go&8)&&(ao.disabled=_o[3]),(!fo||go&768)&&toggle_class(ue,"is-focused",_o[8]||_o[9]),(!fo||go&8)&&toggle_class(ue,"is-disabled",_o[3]);const bo={};go&1024&&(bo.anchor=_o[10]),go&256&&(bo.open=_o[8]),go&33554913&&(bo.$$scope={dirty:go,ctx:_o}),uo.$set(bo)},i(_o){fo||(transition_in(uo.$$.fragment,_o),fo=!0)},o(_o){transition_out(uo.$$.fragment,_o),fo=!1},d(_o){_o&&(detach(ue),detach(co)),to[17](null),destroy_component(uo,_o),po=!1,run_all(ho)}}}function instance$bD(to,ue,eo){let{value:no=void 0}=ue,{id:ro=void 0}=ue,{placeholder:oo="Choose an option or type"}=ue,{disabled:io=!1}=ue,{readonly:ao=!1}=ue,{options:so=[]}=ue,{getOptionLabel:lo=Eo=>`${Eo}`}=ue,{getOptionValue:co=Eo=>`${Eo}`}=ue;const uo=createEventDispatcher();let fo=!1,po=!1,ho;const _o=Eo=>{uo("change",Eo),eo(8,fo=!1)},go=Eo=>{const To=Eo.currentTarget.value;uo("type",To),_o(To)},bo=Eo=>{uo("pick",Eo),_o(Eo)},vo=()=>eo(9,po=!0),yo=()=>{eo(9,po=!1),uo("blur")},$o=()=>eo(8,fo=!fo);function ko(Eo){binding_callbacks[Eo?"unshift":"push"](()=>{ho=Eo,eo(10,ho)})}const So=Eo=>bo(co(Eo)),Ao=()=>{eo(8,fo=!1)},Mo=()=>eo(8,fo=!1);return to.$$set=Eo=>{"value"in Eo&&eo(0,no=Eo.value),"id"in Eo&&eo(1,ro=Eo.id),"placeholder"in Eo&&eo(2,oo=Eo.placeholder),"disabled"in Eo&&eo(3,io=Eo.disabled),"readonly"in Eo&&eo(4,ao=Eo.readonly),"options"in Eo&&eo(5,so=Eo.options),"getOptionLabel"in Eo&&eo(6,lo=Eo.getOptionLabel),"getOptionValue"in Eo&&eo(7,co=Eo.getOptionValue)},[no,ro,oo,io,ao,so,lo,co,fo,po,ho,uo,go,bo,vo,yo,$o,ko,So,Ao,Mo]}class Combobox extends SvelteComponent{constructor(ue){super(),init$3(this,ue,instance$bD,create_fragment$bG,safe_not_equal,{value:0,id:1,placeholder:2,disabled:3,readonly:4,options:5,getOptionLabel:6,getOptionValue:7})}}function create_default_slot$6X(to){let ue,eo;return ue=new Combobox({props:{error:to[5],disabled:to[2],value:to[0],options:to[7],placeholder:to[6],readonly:to[3],getOptionLabel:to[9],getOptionValue:to[10]}}),ue.$on("change",to[11]),ue.$on("pick",to[12]),ue.$on("type",to[13]),ue.$on("blur",to[14]),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},p(no,ro){const oo={};ro&32&&(oo.error=no[5]),ro&4&&(oo.disabled=no[2]),ro&1&&(oo.value=no[0]),ro&128&&(oo.options=no[7]),ro&64&&(oo.placeholder=no[6]),ro&8&&(oo.readonly=no[3]),ro&512&&(oo.getOptionLabel=no[9]),ro&1024&&(oo.getOptionValue=no[10]),ue.$set(oo)},i(no){eo||(transition_in(ue.$$.fragment,no),eo=!0)},o(no){transition_out(ue.$$.fragment,no),eo=!1},d(no){destroy_component(ue,no)}}}function create_fragment$bF(to){let ue,eo;return ue=new Field({props:{helpText:to[8],label:to[1],labelPosition:to[4],error:to[5],$$slots:{default:[create_default_slot$6X]},$$scope:{ctx:to}}}),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},p(no,[ro]){const oo={};ro&256&&(oo.helpText=no[8]),ro&2&&(oo.label=no[1]),ro&16&&(oo.labelPosition=no[4]),ro&32&&(oo.error=no[5]),ro&132845&&(oo.$$scope={dirty:ro,ctx:no}),ue.$set(oo)},i(no){eo||(transition_in(ue.$$.fragment,no),eo=!0)},o(no){transition_out(ue.$$.fragment,no),eo=!1},d(no){destroy_component(ue,no)}}}function instance$bC(to,ue,eo){let{value:no=null}=ue,{label:ro=void 0}=ue,{disabled:oo=!1}=ue,{readonly:io=!1}=ue,{labelPosition:ao="above"}=ue,{error:so=null}=ue,{placeholder:lo="Choose an option or type"}=ue,{options:co=[]}=ue,{helpText:uo=null}=ue,{getOptionLabel:fo=$o=>go($o,"label")}=ue,{getOptionValue:po=$o=>go($o,"value")}=ue;const ho=createEventDispatcher(),_o=$o=>{eo(0,no=$o.detail),ho("change",$o.detail)},go=($o,ko)=>$o&&typeof $o=="object"?$o[ko]:$o;function bo($o){bubble.call(this,to,$o)}function vo($o){bubble.call(this,to,$o)}function yo($o){bubble.call(this,to,$o)}return to.$$set=$o=>{"value"in $o&&eo(0,no=$o.value),"label"in $o&&eo(1,ro=$o.label),"disabled"in $o&&eo(2,oo=$o.disabled),"readonly"in $o&&eo(3,io=$o.readonly),"labelPosition"in $o&&eo(4,ao=$o.labelPosition),"error"in $o&&eo(5,so=$o.error),"placeholder"in $o&&eo(6,lo=$o.placeholder),"options"in $o&&eo(7,co=$o.options),"helpText"in $o&&eo(8,uo=$o.helpText),"getOptionLabel"in $o&&eo(9,fo=$o.getOptionLabel),"getOptionValue"in $o&&eo(10,po=$o.getOptionValue)},[no,ro,oo,io,ao,so,lo,co,uo,fo,po,_o,bo,vo,yo]}class Combobox_1 extends SvelteComponent{constructor(ue){super(),init$3(this,ue,instance$bC,create_fragment$bF,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$q="",indexVars$p="",indexVars$o="";var AIOperationEnum=(to=>(to.SUMMARISE_TEXT="SUMMARISE_TEXT",to.CLEAN_DATA="CLEAN_DATA",to.TRANSLATE="TRANSLATE",to.CATEGORISE_TEXT="CATEGORISE_TEXT",to.SENTIMENT_ANALYSIS="SENTIMENT_ANALYSIS",to.PROMPT="PROMPT",to.SEARCH_WEB="SEARCH_WEB",to))(AIOperationEnum||{}),OperationFieldTypeEnum=(to=>(to.MULTI_COLUMN="columns",to.COLUMN="column",to.BINDABLE_TEXT="prompt",to))(OperationFieldTypeEnum||{}),Event$1=(to=>(to.USER_CREATED="user:created",to.USER_UPDATED="user:updated",to.USER_DELETED="user:deleted",to.USER_ONBOARDING_COMPLETE="user:onboarding:complete",to.USER_PERMISSION_ADMIN_ASSIGNED="user:admin:assigned",to.USER_PERMISSION_ADMIN_REMOVED="user:admin:removed",to.USER_PERMISSION_BUILDER_ASSIGNED="user:builder:assigned",to.USER_PERMISSION_BUILDER_REMOVED="user:builder:removed",to.USER_INVITED="user:invited",to.USER_INVITED_ACCEPTED="user:invite:accepted",to.USER_PASSWORD_FORCE_RESET="user:password:force:reset",to.USER_PASSWORD_UPDATED="user:password:updated",to.USER_PASSWORD_RESET_REQUESTED="user:password:reset:requested",to.USER_PASSWORD_RESET="user:password:reset",to.USER_DATA_COLLABORATION="user:data:collaboration",to.EMAIL_SMTP_CREATED="email:smtp:created",to.EMAIL_SMTP_UPDATED="email:smtp:updated",to.AI_CONFIG_CREATED="ai:config:created",to.AI_CONFIG_UPDATED="ai:config:updated",to.AUTH_SSO_CREATED="auth:sso:created",to.AUTH_SSO_UPDATED="auth:sso:updated",to.AUTH_SSO_ACTIVATED="auth:sso:activated",to.AUTH_SSO_DEACTIVATED="auth:sso:deactivated",to.AUTH_LOGIN="auth:login",to.AUTH_LOGOUT="auth:logout",to.ORG_NAME_UPDATED="org:info:name:updated",to.ORG_LOGO_UPDATED="org:info:logo:updated",to.ORG_PLATFORM_URL_UPDATED="org:platformurl:updated",to.INSTALLATION_VERSION_CHECKED="installation:version:checked",to.INSTALLATION_VERSION_UPGRADED="installation:version:upgraded",to.INSTALLATION_VERSION_DOWNGRADED="installation:version:downgraded",to.INSTALLATION_FIRST_STARTUP="installation:firstStartup",to.ANALYTICS_OPT_OUT="analytics:opt:out",to.ANALYTICS_OPT_IN="analytics:opt:in",to.APP_CREATED="app:created",to.APP_UPDATED="app:updated",to.APP_DELETED="app:deleted",to.APP_DUPLICATED="app:duplicated",to.APP_PUBLISHED="app:published",to.APP_UNPUBLISHED="app:unpublished",to.APP_TEMPLATE_IMPORTED="app:template:imported",to.APP_FILE_IMPORTED="app:file:imported",to.APP_VERSION_UPDATED="app:version:updated",to.APP_VERSION_REVERTED="app:version:reverted",to.APP_REVERTED="app:reverted",to.APP_EXPORTED="app:exported",to.ROLE_CREATED="role:created",to.ROLE_UPDATED="role:updated",to.ROLE_DELETED="role:deleted",to.ROLE_ASSIGNED="role:assigned",to.ROLE_UNASSIGNED="role:unassigned",to.SERVED_BUILDER="served:builder",to.SERVED_APP="served:app",to.SERVED_APP_PREVIEW="served:app:preview",to.DATASOURCE_CREATED="datasource:created",to.DATASOURCE_UPDATED="datasource:updated",to.DATASOURCE_DELETED="datasource:deleted",to.QUERY_CREATED="query:created",to.QUERY_UPDATED="query:updated",to.QUERY_DELETED="query:deleted",to.QUERY_IMPORT="query:import",to.QUERIES_RUN="queries:run",to.QUERY_PREVIEWED="query:previewed",to.TABLE_CREATED="table:created",to.TABLE_UPDATED="table:updated",to.TABLE_DELETED="table:deleted",to.TABLE_EXPORTED="table:exported",to.TABLE_IMPORTED="table:imported",to.TABLE_DATA_IMPORTED="table:data:imported",to.VIEW_CREATED="view:created",to.VIEW_UPDATED="view:updated",to.VIEW_DELETED="view:deleted",to.VIEW_EXPORTED="view:exported",to.VIEW_FILTER_CREATED="view:filter:created",to.VIEW_FILTER_UPDATED="view:filter:updated",to.VIEW_FILTER_DELETED="view:filter:deleted",to.VIEW_CALCULATION_CREATED="view:calculation:created",to.VIEW_CALCULATION_UPDATED="view:calculation:updated",to.VIEW_CALCULATION_DELETED="view:calculation:deleted",to.VIEW_JOIN_CREATED="view:join:created",to.ROWS_CREATED="rows:created",to.ROWS_IMPORTED="rows:imported",to.COMPONENT_CREATED="component:created",to.COMPONENT_DELETED="component:deleted",to.SCREEN_CREATED="screen:created",to.SCREEN_DELETED="screen:deleted",to.LAYOUT_CREATED="layout:created",to.LAYOUT_DELETED="layout:deleted",to.AUTOMATION_CREATED="automation:created",to.AUTOMATION_DELETED="automation:deleted",to.AUTOMATION_TESTED="automation:tested",to.AUTOMATIONS_RUN="automations:run",to.AUTOMATION_STEP_CREATED="automation:step:created",to.AUTOMATION_STEP_DELETED="automation:step:deleted",to.AUTOMATION_TRIGGER_UPDATED="automation:trigger:updated",to.LICENSE_PLAN_CHANGED="license:plan:changed",to.LICENSE_ACTIVATED="license:activated",to.LICENSE_PAYMENT_FAILED="license:payment:failed",to.LICENSE_PAYMENT_RECOVERED="license:payment:recovered",to.LICENSE_CHECKOUT_OPENED="license:checkout:opened",to.LICENSE_CHECKOUT_SUCCESS="license:checkout:success",to.LICENSE_PORTAL_OPENED="license:portal:opened",to.ACCOUNT_CREATED="account:created",to.ACCOUNT_DELETED="account:deleted",to.ACCOUNT_VERIFIED="account:verified",to.APP_BACKFILL_SUCCEEDED="app:backfill:succeeded",to.APP_BACKFILL_FAILED="app:backfill:failed",to.TENANT_BACKFILL_SUCCEEDED="tenant:backfill:succeeded",to.TENANT_BACKFILL_FAILED="tenant:backfill:failed",to.INSTALLATION_BACKFILL_SUCCEEDED="installation:backfill:succeeded",to.INSTALLATION_BACKFILL_FAILED="installation:backfill:failed",to.USER_GROUP_CREATED="user_group:created",to.USER_GROUP_UPDATED="user_group:updated",to.USER_GROUP_DELETED="user_group:deleted",to.USER_GROUP_USERS_ADDED="user_group:user_added",to.USER_GROUP_USERS_REMOVED="user_group:users_deleted",to.USER_GROUP_PERMISSIONS_EDITED="user_group:permissions_edited",to.USER_GROUP_ONBOARDING="user_group:onboarding_added",to.PLUGIN_INIT="plugin:init",to.PLUGIN_IMPORTED="plugin:imported",to.PLUGIN_DELETED="plugin:deleted",to.APP_BACKUP_RESTORED="app:backup:restored",to.APP_BACKUP_TRIGGERED="app:backup:triggered",to.ENVIRONMENT_VARIABLE_CREATED="environment_variable:created",to.ENVIRONMENT_VARIABLE_DELETED="environment_variable:deleted",to.ENVIRONMENT_VARIABLE_UPGRADE_PANEL_OPENED="environment_variable:upgrade_panel_opened",to.AUDIT_LOGS_FILTERED="audit_log:filtered",to.AUDIT_LOGS_DOWNLOADED="audit_log:downloaded",to.ROW_ACTION_CREATED="row_action:created",to))(Event$1||{}),PlanType$1=(to=>(to.FREE="free",to.PRO="pro",to.TEAM="team",to.PREMIUM="premium",to.PREMIUM_PLUS="premium_plus",to.PREMIUM_PLUS_TRIAL="premium_plus_trial",to.BUSINESS="business",to.ENTERPRISE_BASIC="enterprise_basic",to.ENTERPRISE_BASIC_TRIAL="enterprise_basic_trial",to.ENTERPRISE="enterprise",to))(PlanType$1||{}),PlanModel$1=(to=>(to.PER_USER="perUser",to.PER_CREATOR_PER_USER="per_creator_per_user",to))(PlanModel$1||{}),StaticQuotaName=(to=>(to.ROWS="rows",to.APPS="apps",to.USERS="users",to.CREATORS="creators",to.USER_GROUPS="userGroups",to.PLUGINS="plugins",to.AI_CUSTOM_CONFIGS="aiCustomConfigs",to))(StaticQuotaName||{}),MonthlyQuotaName=(to=>(to.QUERIES="queries",to.AUTOMATIONS="automations",to.BUDIBASE_AI_CREDITS="budibaseAICredits",to))(MonthlyQuotaName||{}),Feature=(to=>(to.USER_GROUPS="userGroups",to.APP_BACKUPS="appBackups",to.ENVIRONMENT_VARIABLES="environmentVariables",to.AUDIT_LOGS="auditLogs",to.ENFORCEABLE_SSO="enforceableSSO",to.BRANDING="branding",to.SCIM="scim",to.SYNC_AUTOMATIONS="syncAutomations",to.TRIGGER_AUTOMATION_RUN="triggerAutomationRun",to.APP_BUILDERS="appBuilders",to.OFFLINE="offline",to.EXPANDED_PUBLIC_API="expandedPublicApi",to.VIEW_PERMISSIONS="viewPermissions",to.VIEW_READONLY_COLUMNS="viewReadonlyColumns",to.BUDIBASE_AI="budibaseAI",to.AI_CUSTOM_CONFIGS="aiCustomConfigs",to))(Feature||{}),SourceName=(to=>(to.POSTGRES="POSTGRES",to.DYNAMODB="DYNAMODB",to.MONGODB="MONGODB",to.ELASTICSEARCH="ELASTICSEARCH",to.COUCHDB="COUCHDB",to.SQL_SERVER="SQL_SERVER",to.S3="S3",to.AIRTABLE="AIRTABLE",to.MYSQL="MYSQL",to.ARANGODB="ARANGODB",to.REST="REST",to.ORACLE="ORACLE",to.GOOGLE_SHEETS="GOOGLE_SHEETS",to.FIRESTORE="FIRESTORE",to.REDIS="REDIS",to.SNOWFLAKE="SNOWFLAKE",to.BUDIBASE="BUDIBASE",to))(SourceName||{}),DatasourceFeature=(to=>(to.CONNECTION_CHECKING="connection",to.FETCH_TABLE_NAMES="fetch_table_names",to.EXPORT_SCHEMA="export_schema",to))(DatasourceFeature||{}),BasicOperator=(to=>(to.EQUAL="equal",to.NOT_EQUAL="notEqual",to.EMPTY="empty",to.NOT_EMPTY="notEmpty",to.FUZZY="fuzzy",to.STRING="string",to))(BasicOperator||{}),ArrayOperator=(to=>(to.CONTAINS="contains",to.NOT_CONTAINS="notContains",to.CONTAINS_ANY="containsAny",to.ONE_OF="oneOf",to))(ArrayOperator||{}),RangeOperator=(to=>(to.RANGE="range",to))(RangeOperator||{}),LogicalOperator=(to=>(to.AND="$and",to.OR="$or",to))(LogicalOperator||{});function isLogicalSearchOperator(to){return Object.values(LogicalOperator).includes(to)}function isBasicSearchOperator(to){return Object.values(BasicOperator).includes(to)}function isArraySearchOperator(to){return Object.values(ArrayOperator).includes(to)}function isRangeSearchOperator(to){return Object.values(RangeOperator).includes(to)}var InternalSearchFilterOperator=(to=>(to.COMPLEX_ID_OPERATOR="_complexIdOperator",to))(InternalSearchFilterOperator||{}),EmptyFilterOption=(to=>(to.RETURN_ALL="all",to.RETURN_NONE="none",to))(EmptyFilterOption||{}),UILogicalOperator=(to=>(to.ALL="all",to.ANY="any",to))(UILogicalOperator||{});const FeatureFlagDefaults={USE_ZOD_VALIDATOR:!1,DIRECT_LOGIN_TO_ACCOUNT_PORTAL:!1};Event$1.PLUGIN_INIT;var PermissionSource=(to=>(to.EXPLICIT="EXPLICIT",to.INHERITED="INHERITED",to.BASE="BASE",to))(PermissionSource||{}),RowExportFormat=(to=>(to.CSV="csv",to.JSON="json",to.JSON_WITH_SCHEMA="jsonWithSchema",to))(RowExportFormat||{}),AutomationIOType=(to=>(to.OBJECT="object",to.STRING="string",to.BOOLEAN="boolean",to.NUMBER="number",to.ARRAY="array",to.JSON="json",to.DATE="date",to.ATTACHMENT="attachment",to))(AutomationIOType||{}),AutomationCustomIOType=(to=>(to.TABLE="table",to.ROW="row",to.ROWS="rows",to.WIDE="wide",to.QUERY="query",to.QUERY_PARAMS="queryParams",to.QUERY_LIMIT="queryLimit",to.LOOP_OPTION="loopOption",to.ITEM="item",to.CODE="code",to.FILTERS="filters",to.COLUMN="column",to.TRIGGER_SCHEMA="triggerSchema",to.CRON="cron",to.WEBHOOK_URL="webhookUrl",to.AUTOMATION="automation",to.AUTOMATION_FIELDS="automationFields",to.MULTI_ATTACHMENTS="multi_attachments",to.TRIGGER_FILTER="trigger_filter",to))(AutomationCustomIOType||{}),AutomationTriggerStepId=(to=>(to.ROW_SAVED="ROW_SAVED",to.ROW_UPDATED="ROW_UPDATED",to.ROW_DELETED="ROW_DELETED",to.WEBHOOK="WEBHOOK",to.APP="APP",to.CRON="CRON",to.ROW_ACTION="ROW_ACTION",to))(AutomationTriggerStepId||{}),AutomationStepType=(to=>(to.LOGIC="LOGIC",to.ACTION="ACTION",to.TRIGGER="TRIGGER",to))(AutomationStepType||{}),AutomationActionStepId=(to=>(to.SEND_EMAIL_SMTP="SEND_EMAIL_SMTP",to.CREATE_ROW="CREATE_ROW",to.UPDATE_ROW="UPDATE_ROW",to.DELETE_ROW="DELETE_ROW",to.EXECUTE_BASH="EXECUTE_BASH",to.OUTGOING_WEBHOOK="OUTGOING_WEBHOOK",to.EXECUTE_SCRIPT="EXECUTE_SCRIPT",to.EXECUTE_QUERY="EXECUTE_QUERY",to.SERVER_LOG="SERVER_LOG",to.DELAY="DELAY",to.FILTER="FILTER",to.QUERY_ROWS="QUERY_ROWS",to.LOOP="LOOP",to.COLLECT="COLLECT",to.OPENAI="OPENAI",to.TRIGGER_AUTOMATION_RUN="TRIGGER_AUTOMATION_RUN",to.BRANCH="BRANCH",to.discord="discord",to.slack="slack",to.zapier="zapier",to.integromat="integromat",to.n8n="n8n",to))(AutomationActionStepId||{});[...Object.values(AutomationActionStepId),...Object.values(AutomationTriggerStepId)];var AutomationFeature=(to=>(to.LOOPING="LOOPING",to))(AutomationFeature||{}),AutomationEventType=(to=>(to.ROW_SAVE="row:save",to.ROW_UPDATE="row:update",to.ROW_DELETE="row:delete",to.APP_TRIGGER="app:trigger",to.CRON_TRIGGER="cron:trigger",to.WEBHOOK_TRIGGER="web:trigger",to.ROW_ACTION="row:action",to))(AutomationEventType||{}),SourceType=(to=>(to.DATASOURCE="datasource",to.QUERY="query",to.TABLE="table",to.VIEW="view",to))(SourceType||{}),HttpMethod=(to=>(to.GET="GET",to.POST="POST",to.PATCH="PATCH",to.PUT="PUT",to.HEAD="HEAD",to.DELETE="DELETE",to))(HttpMethod||{});const INTERNAL_TABLE_SOURCE_ID="bb_internal";var FieldType=(to=>(to.STRING="string",to.LONGFORM="longform",to.OPTIONS="options",to.NUMBER="number",to.BOOLEAN="boolean",to.ARRAY="array",to.DATETIME="datetime",to.ATTACHMENTS="attachment",to.ATTACHMENT_SINGLE="attachment_single",to.LINK="link",to.FORMULA="formula",to.AUTO="auto",to.AI="ai",to.JSON="json",to.INTERNAL="internal",to.BARCODEQR="barcodeqr",to.SIGNATURE_SINGLE="signature_single",to.BIGINT="bigint",to.BB_REFERENCE="bb_reference",to.BB_REFERENCE_SINGLE="bb_reference_single",to))(FieldType||{});const NumericTypes=["number","bigint"];function isNumeric$1(to){return NumericTypes.includes(to)}const GroupByTypes=["string","longform","options","number","boolean","datetime","bigint","ai"];function canGroupBy(to){return GroupByTypes.includes(to)}var RelationshipType=(to=>(to.ONE_TO_MANY="one-to-many",to.MANY_TO_ONE="many-to-one",to.MANY_TO_MANY="many-to-many",to))(RelationshipType||{}),AutoFieldSubType=(to=>(to.CREATED_BY="createdBy",to.CREATED_AT="createdAt",to.UPDATED_BY="updatedBy",to.UPDATED_AT="updatedAt",to.AUTO_ID="autoID",to))(AutoFieldSubType||{}),FormulaType=(to=>(to.STATIC="static",to.DYNAMIC="dynamic",to.AI="ai",to))(FormulaType||{}),BBReferenceFieldSubType=(to=>(to.USER="user",to.USERS="users",to))(BBReferenceFieldSubType||{});function isRelationshipField(to){return to.type===FieldType.LINK}var CalculationType=(to=>(to.SUM="sum",to.AVG="avg",to.COUNT="count",to.MIN="min",to.MAX="max",to))(CalculationType||{}),ViewV2Type=(to=>(to.CALCULATION="calculation",to))(ViewV2Type||{});const SEPARATOR$1="_",prefixed=to=>`${to}${SEPARATOR$1}`;var DocumentType=(to=>(to.USER="us",to.GROUP="gr",to.WORKSPACE="workspace",to.CONFIG="config",to.TEMPLATE="template",to.APP="app",to.DEV="dev",to.APP_DEV="app_dev",to.APP_METADATA="app_metadata",to.ROLE="role",to.MIGRATIONS="migrations",to.DEV_INFO="devinfo",to.AUTOMATION_LOG="log_au",to.ACCOUNT_METADATA="acc_metadata",to.PLUGIN="plg",to.DATASOURCE="datasource",to.DATASOURCE_PLUS="datasource_plus",to.APP_BACKUP="backup",to.TABLE="ta",to.ROW="ro",to.AUTOMATION="au",to.LINK="li",to.WEBHOOK="wh",to.INSTANCE="inst",to.LAYOUT="layout",to.SCREEN="screen",to.QUERY="query",to.DEPLOYMENTS="deployments",to.METADATA="metadata",to.MEM_VIEW="view",to.USER_FLAG="flag",to.AUTOMATION_METADATA="meta_au",to.AUDIT_LOG="al",to.APP_MIGRATION_METADATA="_design/migrations",to.SCIM_LOG="scimlog",to.ROW_ACTIONS="ra",to))(DocumentType||{});Object.values(DocumentType).sort((to,ue)=>ue.length-to.length);var InternalTable=(to=>(to.USER_METADATA="ta_users",to))(InternalTable||{}),VirtualDocumentType=(to=>(to.VIEW="view",to.ROW_ACTION="row_action",to))(VirtualDocumentType||{});Object.values(VirtualDocumentType).sort((to,ue)=>ue.length-to.length);var Theme=(to=>(to.LIGHTEST="lightest",to.LIGHT="light",to.DARK="dark",to.DARKEST="darkest",to.NORD="nord",to.MIDNIGHT="midnight",to))(Theme||{}),DeploymentStatus=(to=>(to.SUCCESS="SUCCESS",to.PENDING="PENDING",to.FAILURE="FAILURE",to))(DeploymentStatus||{});const isConfig=to=>"type"in to&&"config"in to,isSCIMConfig=to=>to.type==="scim";var ConfigType=(to=>(to.SETTINGS="settings",to.ACCOUNT="account",to.SMTP="smtp",to.GOOGLE="google",to.OIDC="oidc",to.OIDC_LOGOS="logos_oidc",to.SCIM="scim",to.AI="ai",to))(ConfigType||{});function isSSOUser(to){return!!to.providerType}var PluginType=(to=>(to.DATASOURCE="datasource",to.COMPONENT="component",to.AUTOMATION="automation",to))(PluginType||{});Object.values(PluginType);StaticQuotaName.ROWS,MonthlyQuotaName.QUERIES,MonthlyQuotaName.AUTOMATIONS;MonthlyQuotaName.QUERIES,MonthlyQuotaName.AUTOMATIONS;var SortOrder=(to=>(to.ASCENDING="ascending",to.DESCENDING="descending",to))(SortOrder||{}),SortType=(to=>(to.STRING="string",to.NUMBER="number",to))(SortType||{}),util$h;(function(to){to.assertEqual=ro=>ro;function ue(ro){}to.assertIs=ue;function eo(ro){throw new Error}to.assertNever=eo,to.arrayToEnum=ro=>{const oo={};for(const io of ro)oo[io]=io;return oo},to.getValidEnumValues=ro=>{const oo=to.objectKeys(ro).filter(ao=>typeof ro[ro[ao]]!="number"),io={};for(const ao of oo)io[ao]=ro[ao];return to.objectValues(io)},to.objectValues=ro=>to.objectKeys(ro).map(function(oo){return ro[oo]}),to.objectKeys=typeof Object.keys=="function"?ro=>Object.keys(ro):ro=>{const oo=[];for(const io in ro)Object.prototype.hasOwnProperty.call(ro,io)&&oo.push(io);return oo},to.find=(ro,oo)=>{for(const io of ro)if(oo(io))return io},to.isInteger=typeof Number.isInteger=="function"?ro=>Number.isInteger(ro):ro=>typeof ro=="number"&&isFinite(ro)&&Math.floor(ro)===ro;function no(ro,oo=" | "){return ro.map(io=>typeof io=="string"?`'${io}'`:io).join(oo)}to.joinValues=no,to.jsonStringifyReplacer=(ro,oo)=>typeof oo=="bigint"?oo.toString():oo})(util$h||(util$h={}));var objectUtil;(function(to){to.mergeShapes=(ue,eo)=>({...ue,...eo})})(objectUtil||(objectUtil={}));const ZodParsedType=util$h.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),getParsedType=to=>{switch(typeof to){case"undefined":return ZodParsedType.undefined;case"string":return ZodParsedType.string;case"number":return isNaN(to)?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(to)?ZodParsedType.array:to===null?ZodParsedType.null:to.then&&typeof to.then=="function"&&to.catch&&typeof to.catch=="function"?ZodParsedType.promise:typeof Map<"u"&&to instanceof Map?ZodParsedType.map:typeof Set<"u"&&to instanceof Set?ZodParsedType.set:typeof Date<"u"&&to instanceof Date?ZodParsedType.date:ZodParsedType.object;default:return ZodParsedType.unknown}},ZodIssueCode=util$h.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=to=>JSON.stringify(to,null,2).replace(/"([^"]+)":/g,"$1:");class ZodError extends Error{constructor(ue){super(),this.issues=[],this.addIssue=no=>{this.issues=[...this.issues,no]},this.addIssues=(no=[])=>{this.issues=[...this.issues,...no]};const eo=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,eo):this.__proto__=eo,this.name="ZodError",this.issues=ue}get errors(){return this.issues}format(ue){const eo=ue||function(oo){return oo.message},no={_errors:[]},ro=oo=>{for(const io of oo.issues)if(io.code==="invalid_union")io.unionErrors.map(ro);else if(io.code==="invalid_return_type")ro(io.returnTypeError);else if(io.code==="invalid_arguments")ro(io.argumentsError);else if(io.path.length===0)no._errors.push(eo(io));else{let ao=no,so=0;for(;so<io.path.length;){const lo=io.path[so];so===io.path.length-1?(ao[lo]=ao[lo]||{_errors:[]},ao[lo]._errors.push(eo(io))):ao[lo]=ao[lo]||{_errors:[]},ao=ao[lo],so++}}};return ro(this),no}static assert(ue){if(!(ue instanceof ZodError))throw new Error(`Not a ZodError: ${ue}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,util$h.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(ue=eo=>eo.message){const eo={},no=[];for(const ro of this.issues)ro.path.length>0?(eo[ro.path[0]]=eo[ro.path[0]]||[],eo[ro.path[0]].push(ue(ro))):no.push(ue(ro));return{formErrors:no,fieldErrors:eo}}get formErrors(){return this.flatten()}}ZodError.create=to=>new ZodError(to);const errorMap=(to,ue)=>{let eo;switch(to.code){case ZodIssueCode.invalid_type:to.received===ZodParsedType.undefined?eo="Required":eo=`Expected ${to.expected}, received ${to.received}`;break;case ZodIssueCode.invalid_literal:eo=`Invalid literal value, expected ${JSON.stringify(to.expected,util$h.jsonStringifyReplacer)}`;break;case ZodIssueCode.unrecognized_keys:eo=`Unrecognized key(s) in object: ${util$h.joinValues(to.keys,", ")}`;break;case ZodIssueCode.invalid_union:eo="Invalid input";break;case ZodIssueCode.invalid_union_discriminator:eo=`Invalid discriminator value. Expected ${util$h.joinValues(to.options)}`;break;case ZodIssueCode.invalid_enum_value:eo=`Invalid enum value. Expected ${util$h.joinValues(to.options)}, received '${to.received}'`;break;case ZodIssueCode.invalid_arguments:eo="Invalid function arguments";break;case ZodIssueCode.invalid_return_type:eo="Invalid function return type";break;case ZodIssueCode.invalid_date:eo="Invalid date";break;case ZodIssueCode.invalid_string:typeof to.validation=="object"?"includes"in to.validation?(eo=`Invalid input: must include "${to.validation.includes}"`,typeof to.validation.position=="number"&&(eo=`${eo} at one or more positions greater than or equal to ${to.validation.position}`)):"startsWith"in to.validation?eo=`Invalid input: must start with "${to.validation.startsWith}"`:"endsWith"in to.validation?eo=`Invalid input: must end with "${to.validation.endsWith}"`:util$h.assertNever(to.validation):to.validation!=="regex"?eo=`Invalid ${to.validation}`:eo="Invalid";break;case ZodIssueCode.too_small:to.type==="array"?eo=`Array must contain ${to.exact?"exactly":to.inclusive?"at least":"more than"} ${to.minimum} element(s)`:to.type==="string"?eo=`String must contain ${to.exact?"exactly":to.inclusive?"at least":"over"} ${to.minimum} character(s)`:to.type==="number"?eo=`Number must be ${to.exact?"exactly equal to ":to.inclusive?"greater than or equal to ":"greater than "}${to.minimum}`:to.type==="date"?eo=`Date must be ${to.exact?"exactly equal to ":to.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(to.minimum))}`:eo="Invalid input";break;case ZodIssueCode.too_big:to.type==="array"?eo=`Array must contain ${to.exact?"exactly":to.inclusive?"at most":"less than"} ${to.maximum} element(s)`:to.type==="string"?eo=`String must contain ${to.exact?"exactly":to.inclusive?"at most":"under"} ${to.maximum} character(s)`:to.type==="number"?eo=`Number must be ${to.exact?"exactly":to.inclusive?"less than or equal to":"less than"} ${to.maximum}`:to.type==="bigint"?eo=`BigInt must be ${to.exact?"exactly":to.inclusive?"less than or equal to":"less than"} ${to.maximum}`:to.type==="date"?eo=`Date must be ${to.exact?"exactly":to.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(to.maximum))}`:eo="Invalid input";break;case ZodIssueCode.custom:eo="Invalid input";break;case ZodIssueCode.invalid_intersection_types:eo="Intersection results could not be merged";break;case ZodIssueCode.not_multiple_of:eo=`Number must be a multiple of ${to.multipleOf}`;break;case ZodIssueCode.not_finite:eo="Number must be finite";break;default:eo=ue.defaultError,util$h.assertNever(to)}return{message:eo}};let overrideErrorMap=errorMap;function setErrorMap(to){overrideErrorMap=to}function getErrorMap(){return overrideErrorMap}const makeIssue=to=>{const{data:ue,path:eo,errorMaps:no,issueData:ro}=to,oo=[...eo,...ro.path||[]],io={...ro,path:oo};if(ro.message!==void 0)return{...ro,path:oo,message:ro.message};let ao="";const so=no.filter(lo=>!!lo).slice().reverse();for(const lo of so)ao=lo(io,{data:ue,defaultError:ao}).message;return{...ro,path:oo,message:ao}},EMPTY_PATH=[];function addIssueToContext(to,ue){const eo=getErrorMap(),no=makeIssue({issueData:ue,data:to.data,path:to.path,errorMaps:[to.common.contextualErrorMap,to.schemaErrorMap,eo,eo===errorMap?void 0:errorMap].filter(ro=>!!ro)});to.common.issues.push(no)}class ParseStatus{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(ue,eo){const no=[];for(const ro of eo){if(ro.status==="aborted")return INVALID$3;ro.status==="dirty"&&ue.dirty(),no.push(ro.value)}return{status:ue.value,value:no}}static async mergeObjectAsync(ue,eo){const no=[];for(const ro of eo){const oo=await ro.key,io=await ro.value;no.push({key:oo,value:io})}return ParseStatus.mergeObjectSync(ue,no)}static mergeObjectSync(ue,eo){const no={};for(const ro of eo){const{key:oo,value:io}=ro;if(oo.status==="aborted"||io.status==="aborted")return INVALID$3;oo.status==="dirty"&&ue.dirty(),io.status==="dirty"&&ue.dirty(),oo.value!=="__proto__"&&(typeof io.value<"u"||ro.alwaysSet)&&(no[oo.value]=io.value)}return{status:ue.value,value:no}}}const INVALID$3=Object.freeze({status:"aborted"}),DIRTY=to=>({status:"dirty",value:to}),OK=to=>({status:"valid",value:to}),isAborted=to=>to.status==="aborted",isDirty=to=>to.status==="dirty",isValid$2=to=>to.status==="valid",isAsync=to=>typeof Promise<"u"&&to instanceof Promise;function __classPrivateFieldGet(to,ue,eo,no){if(eo==="a"&&!no)throw new TypeError("Private accessor was defined without a getter");if(typeof ue=="function"?to!==ue||!no:!ue.has(to))throw new TypeError("Cannot read private member from an object whose class did not declare it");return eo==="m"?no:eo==="a"?no.call(to):no?no.value:ue.get(to)}function __classPrivateFieldSet(to,ue,eo,no,ro){if(no==="m")throw new TypeError("Private method is not writable");if(no==="a"&&!ro)throw new TypeError("Private accessor was defined without a setter");if(typeof ue=="function"?to!==ue||!ro:!ue.has(to))throw new TypeError("Cannot write private member to an object whose class did not declare it");return no==="a"?ro.call(to,eo):ro?ro.value=eo:ue.set(to,eo),eo}typeof SuppressedError=="function"&&SuppressedError;var errorUtil;(function(to){to.errToObj=ue=>typeof ue=="string"?{message:ue}:ue||{},to.toString=ue=>typeof ue=="string"?ue:ue==null?void 0:ue.message})(errorUtil||(errorUtil={}));var _ZodEnum_cache,_ZodNativeEnum_cache;class ParseInputLazyPath{constructor(ue,eo,no,ro){this._cachedPath=[],this.parent=ue,this.data=eo,this._path=no,this._key=ro}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=(to,ue)=>{if(isValid$2(ue))return{success:!0,data:ue.value};if(!to.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const eo=new ZodError(to.common.issues);return this._error=eo,this._error}}};function processCreateParams(to){if(!to)return{};const{errorMap:ue,invalid_type_error:eo,required_error:no,description:ro}=to;if(ue&&(eo||no))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return ue?{errorMap:ue,description:ro}:{errorMap:(io,ao)=>{var so,lo;const{message:co}=to;return io.code==="invalid_enum_value"?{message:co??ao.defaultError}:typeof ao.data>"u"?{message:(so=co??no)!==null&&so!==void 0?so:ao.defaultError}:io.code!=="invalid_type"?{message:ao.defaultError}:{message:(lo=co??eo)!==null&&lo!==void 0?lo:ao.defaultError}},description:ro}}class ZodType{constructor(ue){this.spa=this.safeParseAsync,this._def=ue,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(ue){return getParsedType(ue.data)}_getOrReturnCtx(ue,eo){return eo||{common:ue.parent.common,data:ue.data,parsedType:getParsedType(ue.data),schemaErrorMap:this._def.errorMap,path:ue.path,parent:ue.parent}}_processInputParams(ue){return{status:new ParseStatus,ctx:{common:ue.parent.common,data:ue.data,parsedType:getParsedType(ue.data),schemaErrorMap:this._def.errorMap,path:ue.path,parent:ue.parent}}}_parseSync(ue){const eo=this._parse(ue);if(isAsync(eo))throw new Error("Synchronous parse encountered promise.");return eo}_parseAsync(ue){const eo=this._parse(ue);return Promise.resolve(eo)}parse(ue,eo){const no=this.safeParse(ue,eo);if(no.success)return no.data;throw no.error}safeParse(ue,eo){var no;const ro={common:{issues:[],async:(no=eo==null?void 0:eo.async)!==null&&no!==void 0?no:!1,contextualErrorMap:eo==null?void 0:eo.errorMap},path:(eo==null?void 0:eo.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:ue,parsedType:getParsedType(ue)},oo=this._parseSync({data:ue,path:ro.path,parent:ro});return handleResult(ro,oo)}async parseAsync(ue,eo){const no=await this.safeParseAsync(ue,eo);if(no.success)return no.data;throw no.error}async safeParseAsync(ue,eo){const no={common:{issues:[],contextualErrorMap:eo==null?void 0:eo.errorMap,async:!0},path:(eo==null?void 0:eo.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:ue,parsedType:getParsedType(ue)},ro=this._parse({data:ue,path:no.path,parent:no}),oo=await(isAsync(ro)?ro:Promise.resolve(ro));return handleResult(no,oo)}refine(ue,eo){const no=ro=>typeof eo=="string"||typeof eo>"u"?{message:eo}:typeof eo=="function"?eo(ro):eo;return this._refinement((ro,oo)=>{const io=ue(ro),ao=()=>oo.addIssue({code:ZodIssueCode.custom,...no(ro)});return typeof Promise<"u"&&io instanceof Promise?io.then(so=>so?!0:(ao(),!1)):io?!0:(ao(),!1)})}refinement(ue,eo){return this._refinement((no,ro)=>ue(no)?!0:(ro.addIssue(typeof eo=="function"?eo(no,ro):eo),!1))}_refinement(ue){return new ZodEffects({schema:this,typeName:ZodFirstPartyTypeKind.ZodEffects,effect:{type:"refinement",refinement:ue}})}superRefine(ue){return this._refinement(ue)}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(ue){return ZodUnion.create([this,ue],this._def)}and(ue){return ZodIntersection.create(this,ue,this._def)}transform(ue){return new ZodEffects({...processCreateParams(this._def),schema:this,typeName:ZodFirstPartyTypeKind.ZodEffects,effect:{type:"transform",transform:ue}})}default(ue){const eo=typeof ue=="function"?ue:()=>ue;return new ZodDefault({...processCreateParams(this._def),innerType:this,defaultValue:eo,typeName:ZodFirstPartyTypeKind.ZodDefault})}brand(){return new ZodBranded({typeName:ZodFirstPartyTypeKind.ZodBranded,type:this,...processCreateParams(this._def)})}catch(ue){const eo=typeof ue=="function"?ue:()=>ue;return new ZodCatch({...processCreateParams(this._def),innerType:this,catchValue:eo,typeName:ZodFirstPartyTypeKind.ZodCatch})}describe(ue){const eo=this.constructor;return new eo({...this._def,description:ue})}pipe(ue){return ZodPipeline.create(this,ue)}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(to){let ue="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return to.precision?ue=`${ue}\\.\\d{${to.precision}}`:to.precision==null&&(ue=`${ue}(\\.\\d+)?`),ue}function timeRegex(to){return new RegExp(`^${timeRegexSource(to)}$`)}function datetimeRegex(to){let ue=`${dateRegexSource}T${timeRegexSource(to)}`;const eo=[];return eo.push(to.local?"Z?":"Z"),to.offset&&eo.push("([+-]\\d{2}:?\\d{2})"),ue=`${ue}(${eo.join("|")})`,new RegExp(`^${ue}$`)}function isValidIP(to,ue){return!!((ue==="v4"||!ue)&&ipv4Regex.test(to)||(ue==="v6"||!ue)&&ipv6Regex.test(to))}class ZodString extends ZodType{_parse(ue){if(this._def.coerce&&(ue.data=String(ue.data)),this._getType(ue)!==ZodParsedType.string){const oo=this._getOrReturnCtx(ue);return addIssueToContext(oo,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.string,received:oo.parsedType}),INVALID$3}const no=new ParseStatus;let ro;for(const oo of this._def.checks)if(oo.kind==="min")ue.data.length<oo.value&&(ro=this._getOrReturnCtx(ue,ro),addIssueToContext(ro,{code:ZodIssueCode.too_small,minimum:oo.value,type:"string",inclusive:!0,exact:!1,message:oo.message}),no.dirty());else if(oo.kind==="max")ue.data.length>oo.value&&(ro=this._getOrReturnCtx(ue,ro),addIssueToContext(ro,{code:ZodIssueCode.too_big,maximum:oo.value,type:"string",inclusive:!0,exact:!1,message:oo.message}),no.dirty());else if(oo.kind==="length"){const io=ue.data.length>oo.value,ao=ue.data.length<oo.value;(io||ao)&&(ro=this._getOrReturnCtx(ue,ro),io?addIssueToContext(ro,{code:ZodIssueCode.too_big,maximum:oo.value,type:"string",inclusive:!0,exact:!0,message:oo.message}):ao&&addIssueToContext(ro,{code:ZodIssueCode.too_small,minimum:oo.value,type:"string",inclusive:!0,exact:!0,message:oo.message}),no.dirty())}else if(oo.kind==="email")emailRegex.test(ue.data)||(ro=this._getOrReturnCtx(ue,ro),addIssueToContext(ro,{validation:"email",code:ZodIssueCode.invalid_string,message:oo.message}),no.dirty());else if(oo.kind==="emoji")emojiRegex||(emojiRegex=new RegExp(_emojiRegex,"u")),emojiRegex.test(ue.data)||(ro=this._getOrReturnCtx(ue,ro),addIssueToContext(ro,{validation:"emoji",code:ZodIssueCode.invalid_string,message:oo.message}),no.dirty());else if(oo.kind==="uuid")uuidRegex.test(ue.data)||(ro=this._getOrReturnCtx(ue,ro),addIssueToContext(ro,{validation:"uuid",code:ZodIssueCode.invalid_string,message:oo.message}),no.dirty());else if(oo.kind==="nanoid")nanoidRegex.test(ue.data)||(ro=this._getOrReturnCtx(ue,ro),addIssueToContext(ro,{validation:"nanoid",code:ZodIssueCode.invalid_string,message:oo.message}),no.dirty());else if(oo.kind==="cuid")cuidRegex.test(ue.data)||(ro=this._getOrReturnCtx(ue,ro),addIssueToContext(ro,{validation:"cuid",code:ZodIssueCode.invalid_string,message:oo.message}),no.dirty());else if(oo.kind==="cuid2")cuid2Regex.test(ue.data)||(ro=this._getOrReturnCtx(ue,ro),addIssueToContext(ro,{validation:"cuid2",code:ZodIssueCode.invalid_string,message:oo.message}),no.dirty());else if(oo.kind==="ulid")ulidRegex.test(ue.data)||(ro=this._getOrReturnCtx(ue,ro),addIssueToContext(ro,{validation:"ulid",code:ZodIssueCode.invalid_string,message:oo.message}),no.dirty());else if(oo.kind==="url")try{new URL(ue.data)}catch{ro=this._getOrReturnCtx(ue,ro),addIssueToContext(ro,{validation:"url",code:ZodIssueCode.invalid_string,message:oo.message}),no.dirty()}else oo.kind==="regex"?(oo.regex.lastIndex=0,oo.regex.test(ue.data)||(ro=this._getOrReturnCtx(ue,ro),addIssueToContext(ro,{validation:"regex",code:ZodIssueCode.invalid_string,message:oo.message}),no.dirty())):oo.kind==="trim"?ue.data=ue.data.trim():oo.kind==="includes"?ue.data.includes(oo.value,oo.position)||(ro=this._getOrReturnCtx(ue,ro),addIssueToContext(ro,{code:ZodIssueCode.invalid_string,validation:{includes:oo.value,position:oo.position},message:oo.message}),no.dirty()):oo.kind==="toLowerCase"?ue.data=ue.data.toLowerCase():oo.kind==="toUpperCase"?ue.data=ue.data.toUpperCase():oo.kind==="startsWith"?ue.data.startsWith(oo.value)||(ro=this._getOrReturnCtx(ue,ro),addIssueToContext(ro,{code:ZodIssueCode.invalid_string,validation:{startsWith:oo.value},message:oo.message}),no.dirty()):oo.kind==="endsWith"?ue.data.endsWith(oo.value)||(ro=this._getOrReturnCtx(ue,ro),addIssueToContext(ro,{code:ZodIssueCode.invalid_string,validation:{endsWith:oo.value},message:oo.message}),no.dirty()):oo.kind==="datetime"?datetimeRegex(oo).test(ue.data)||(ro=this._getOrReturnCtx(ue,ro),addIssueToContext(ro,{code:ZodIssueCode.invalid_string,validation:"datetime",message:oo.message}),no.dirty()):oo.kind==="date"?dateRegex.test(ue.data)||(ro=this._getOrReturnCtx(ue,ro),addIssueToContext(ro,{code:ZodIssueCode.invalid_string,validation:"date",message:oo.message}),no.dirty()):oo.kind==="time"?timeRegex(oo).test(ue.data)||(ro=this._getOrReturnCtx(ue,ro),addIssueToContext(ro,{code:ZodIssueCode.invalid_string,validation:"time",message:oo.message}),no.dirty()):oo.kind==="duration"?durationRegex.test(ue.data)||(ro=this._getOrReturnCtx(ue,ro),addIssueToContext(ro,{validation:"duration",code:ZodIssueCode.invalid_string,message:oo.message}),no.dirty()):oo.kind==="ip"?isValidIP(ue.data,oo.version)||(ro=this._getOrReturnCtx(ue,ro),addIssueToContext(ro,{validation:"ip",code:ZodIssueCode.invalid_string,message:oo.message}),no.dirty()):oo.kind==="base64"?base64Regex.test(ue.data)||(ro=this._getOrReturnCtx(ue,ro),addIssueToContext(ro,{validation:"base64",code:ZodIssueCode.invalid_string,message:oo.message}),no.dirty()):util$h.assertNever(oo);return{status:no.value,value:ue.data}}_regex(ue,eo,no){return this.refinement(ro=>ue.test(ro),{validation:eo,code:ZodIssueCode.invalid_string,...errorUtil.errToObj(no)})}_addCheck(ue){return new ZodString({...this._def,checks:[...this._def.checks,ue]})}email(ue){return this._addCheck({kind:"email",...errorUtil.errToObj(ue)})}url(ue){return this._addCheck({kind:"url",...errorUtil.errToObj(ue)})}emoji(ue){return this._addCheck({kind:"emoji",...errorUtil.errToObj(ue)})}uuid(ue){return this._addCheck({kind:"uuid",...errorUtil.errToObj(ue)})}nanoid(ue){return this._addCheck({kind:"nanoid",...errorUtil.errToObj(ue)})}cuid(ue){return this._addCheck({kind:"cuid",...errorUtil.errToObj(ue)})}cuid2(ue){return this._addCheck({kind:"cuid2",...errorUtil.errToObj(ue)})}ulid(ue){return this._addCheck({kind:"ulid",...errorUtil.errToObj(ue)})}base64(ue){return this._addCheck({kind:"base64",...errorUtil.errToObj(ue)})}ip(ue){return this._addCheck({kind:"ip",...errorUtil.errToObj(ue)})}datetime(ue){var eo,no;return typeof ue=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:ue}):this._addCheck({kind:"datetime",precision:typeof(ue==null?void 0:ue.precision)>"u"?null:ue==null?void 0:ue.precision,offset:(eo=ue==null?void 0:ue.offset)!==null&&eo!==void 0?eo:!1,local:(no=ue==null?void 0:ue.local)!==null&&no!==void 0?no:!1,...errorUtil.errToObj(ue==null?void 0:ue.message)})}date(ue){return this._addCheck({kind:"date",message:ue})}time(ue){return typeof ue=="string"?this._addCheck({kind:"time",precision:null,message:ue}):this._addCheck({kind:"time",precision:typeof(ue==null?void 0:ue.precision)>"u"?null:ue==null?void 0:ue.precision,...errorUtil.errToObj(ue==null?void 0:ue.message)})}duration(ue){return this._addCheck({kind:"duration",...errorUtil.errToObj(ue)})}regex(ue,eo){return this._addCheck({kind:"regex",regex:ue,...errorUtil.errToObj(eo)})}includes(ue,eo){return this._addCheck({kind:"includes",value:ue,position:eo==null?void 0:eo.position,...errorUtil.errToObj(eo==null?void 0:eo.message)})}startsWith(ue,eo){return this._addCheck({kind:"startsWith",value:ue,...errorUtil.errToObj(eo)})}endsWith(ue,eo){return this._addCheck({kind:"endsWith",value:ue,...errorUtil.errToObj(eo)})}min(ue,eo){return this._addCheck({kind:"min",value:ue,...errorUtil.errToObj(eo)})}max(ue,eo){return this._addCheck({kind:"max",value:ue,...errorUtil.errToObj(eo)})}length(ue,eo){return this._addCheck({kind:"length",value:ue,...errorUtil.errToObj(eo)})}nonempty(ue){return this.min(1,errorUtil.errToObj(ue))}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(ue=>ue.kind==="datetime")}get isDate(){return!!this._def.checks.find(ue=>ue.kind==="date")}get isTime(){return!!this._def.checks.find(ue=>ue.kind==="time")}get isDuration(){return!!this._def.checks.find(ue=>ue.kind==="duration")}get isEmail(){return!!this._def.checks.find(ue=>ue.kind==="email")}get isURL(){return!!this._def.checks.find(ue=>ue.kind==="url")}get isEmoji(){return!!this._def.checks.find(ue=>ue.kind==="emoji")}get isUUID(){return!!this._def.checks.find(ue=>ue.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(ue=>ue.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(ue=>ue.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(ue=>ue.kind==="cuid2")}get isULID(){return!!this._def.checks.find(ue=>ue.kind==="ulid")}get isIP(){return!!this._def.checks.find(ue=>ue.kind==="ip")}get isBase64(){return!!this._def.checks.find(ue=>ue.kind==="base64")}get minLength(){let ue=null;for(const eo of this._def.checks)eo.kind==="min"&&(ue===null||eo.value>ue)&&(ue=eo.value);return ue}get maxLength(){let ue=null;for(const eo of this._def.checks)eo.kind==="max"&&(ue===null||eo.value<ue)&&(ue=eo.value);return ue}}ZodString.create=to=>{var ue;return new ZodString({checks:[],typeName:ZodFirstPartyTypeKind.ZodString,coerce:(ue=to==null?void 0:to.coerce)!==null&&ue!==void 0?ue:!1,...processCreateParams(to)})};function floatSafeRemainder(to,ue){const eo=(to.toString().split(".")[1]||"").length,no=(ue.toString().split(".")[1]||"").length,ro=eo>no?eo:no,oo=parseInt(to.toFixed(ro).replace(".","")),io=parseInt(ue.toFixed(ro).replace(".",""));return oo%io/Math.pow(10,ro)}class ZodNumber extends ZodType{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(ue){if(this._def.coerce&&(ue.data=Number(ue.data)),this._getType(ue)!==ZodParsedType.number){const oo=this._getOrReturnCtx(ue);return addIssueToContext(oo,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.number,received:oo.parsedType}),INVALID$3}let no;const ro=new ParseStatus;for(const oo of this._def.checks)oo.kind==="int"?util$h.isInteger(ue.data)||(no=this._getOrReturnCtx(ue,no),addIssueToContext(no,{code:ZodIssueCode.invalid_type,expected:"integer",received:"float",message:oo.message}),ro.dirty()):oo.kind==="min"?(oo.inclusive?ue.data<oo.value:ue.data<=oo.value)&&(no=this._getOrReturnCtx(ue,no),addIssueToContext(no,{code:ZodIssueCode.too_small,minimum:oo.value,type:"number",inclusive:oo.inclusive,exact:!1,message:oo.message}),ro.dirty()):oo.kind==="max"?(oo.inclusive?ue.data>oo.value:ue.data>=oo.value)&&(no=this._getOrReturnCtx(ue,no),addIssueToContext(no,{code:ZodIssueCode.too_big,maximum:oo.value,type:"number",inclusive:oo.inclusive,exact:!1,message:oo.message}),ro.dirty()):oo.kind==="multipleOf"?floatSafeRemainder(ue.data,oo.value)!==0&&(no=this._getOrReturnCtx(ue,no),addIssueToContext(no,{code:ZodIssueCode.not_multiple_of,multipleOf:oo.value,message:oo.message}),ro.dirty()):oo.kind==="finite"?Number.isFinite(ue.data)||(no=this._getOrReturnCtx(ue,no),addIssueToContext(no,{code:ZodIssueCode.not_finite,message:oo.message}),ro.dirty()):util$h.assertNever(oo);return{status:ro.value,value:ue.data}}gte(ue,eo){return this.setLimit("min",ue,!0,errorUtil.toString(eo))}gt(ue,eo){return this.setLimit("min",ue,!1,errorUtil.toString(eo))}lte(ue,eo){return this.setLimit("max",ue,!0,errorUtil.toString(eo))}lt(ue,eo){return this.setLimit("max",ue,!1,errorUtil.toString(eo))}setLimit(ue,eo,no,ro){return new ZodNumber({...this._def,checks:[...this._def.checks,{kind:ue,value:eo,inclusive:no,message:errorUtil.toString(ro)}]})}_addCheck(ue){return new ZodNumber({...this._def,checks:[...this._def.checks,ue]})}int(ue){return this._addCheck({kind:"int",message:errorUtil.toString(ue)})}positive(ue){return this._addCheck({kind:"min",value:0,inclusive:!1,message:errorUtil.toString(ue)})}negative(ue){return this._addCheck({kind:"max",value:0,inclusive:!1,message:errorUtil.toString(ue)})}nonpositive(ue){return this._addCheck({kind:"max",value:0,inclusive:!0,message:errorUtil.toString(ue)})}nonnegative(ue){return this._addCheck({kind:"min",value:0,inclusive:!0,message:errorUtil.toString(ue)})}multipleOf(ue,eo){return this._addCheck({kind:"multipleOf",value:ue,message:errorUtil.toString(eo)})}finite(ue){return this._addCheck({kind:"finite",message:errorUtil.toString(ue)})}safe(ue){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:errorUtil.toString(ue)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:errorUtil.toString(ue)})}get minValue(){let ue=null;for(const eo of this._def.checks)eo.kind==="min"&&(ue===null||eo.value>ue)&&(ue=eo.value);return ue}get maxValue(){let ue=null;for(const eo of this._def.checks)eo.kind==="max"&&(ue===null||eo.value<ue)&&(ue=eo.value);return ue}get isInt(){return!!this._def.checks.find(ue=>ue.kind==="int"||ue.kind==="multipleOf"&&util$h.isInteger(ue.value))}get isFinite(){let ue=null,eo=null;for(const no of this._def.checks){if(no.kind==="finite"||no.kind==="int"||no.kind==="multipleOf")return!0;no.kind==="min"?(eo===null||no.value>eo)&&(eo=no.value):no.kind==="max"&&(ue===null||no.value<ue)&&(ue=no.value)}return Number.isFinite(eo)&&Number.isFinite(ue)}}ZodNumber.create=to=>new ZodNumber({checks:[],typeName:ZodFirstPartyTypeKind.ZodNumber,coerce:(to==null?void 0:to.coerce)||!1,...processCreateParams(to)});class ZodBigInt extends ZodType{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(ue){if(this._def.coerce&&(ue.data=BigInt(ue.data)),this._getType(ue)!==ZodParsedType.bigint){const oo=this._getOrReturnCtx(ue);return addIssueToContext(oo,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.bigint,received:oo.parsedType}),INVALID$3}let no;const ro=new ParseStatus;for(const oo of this._def.checks)oo.kind==="min"?(oo.inclusive?ue.data<oo.value:ue.data<=oo.value)&&(no=this._getOrReturnCtx(ue,no),addIssueToContext(no,{code:ZodIssueCode.too_small,type:"bigint",minimum:oo.value,inclusive:oo.inclusive,message:oo.message}),ro.dirty()):oo.kind==="max"?(oo.inclusive?ue.data>oo.value:ue.data>=oo.value)&&(no=this._getOrReturnCtx(ue,no),addIssueToContext(no,{code:ZodIssueCode.too_big,type:"bigint",maximum:oo.value,inclusive:oo.inclusive,message:oo.message}),ro.dirty()):oo.kind==="multipleOf"?ue.data%oo.value!==BigInt(0)&&(no=this._getOrReturnCtx(ue,no),addIssueToContext(no,{code:ZodIssueCode.not_multiple_of,multipleOf:oo.value,message:oo.message}),ro.dirty()):util$h.assertNever(oo);return{status:ro.value,value:ue.data}}gte(ue,eo){return this.setLimit("min",ue,!0,errorUtil.toString(eo))}gt(ue,eo){return this.setLimit("min",ue,!1,errorUtil.toString(eo))}lte(ue,eo){return this.setLimit("max",ue,!0,errorUtil.toString(eo))}lt(ue,eo){return this.setLimit("max",ue,!1,errorUtil.toString(eo))}setLimit(ue,eo,no,ro){return new ZodBigInt({...this._def,checks:[...this._def.checks,{kind:ue,value:eo,inclusive:no,message:errorUtil.toString(ro)}]})}_addCheck(ue){return new ZodBigInt({...this._def,checks:[...this._def.checks,ue]})}positive(ue){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:errorUtil.toString(ue)})}negative(ue){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:errorUtil.toString(ue)})}nonpositive(ue){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:errorUtil.toString(ue)})}nonnegative(ue){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:errorUtil.toString(ue)})}multipleOf(ue,eo){return this._addCheck({kind:"multipleOf",value:ue,message:errorUtil.toString(eo)})}get minValue(){let ue=null;for(const eo of this._def.checks)eo.kind==="min"&&(ue===null||eo.value>ue)&&(ue=eo.value);return ue}get maxValue(){let ue=null;for(const eo of this._def.checks)eo.kind==="max"&&(ue===null||eo.value<ue)&&(ue=eo.value);return ue}}ZodBigInt.create=to=>{var ue;return new ZodBigInt({checks:[],typeName:ZodFirstPartyTypeKind.ZodBigInt,coerce:(ue=to==null?void 0:to.coerce)!==null&&ue!==void 0?ue:!1,...processCreateParams(to)})};class ZodBoolean extends ZodType{_parse(ue){if(this._def.coerce&&(ue.data=!!ue.data),this._getType(ue)!==ZodParsedType.boolean){const no=this._getOrReturnCtx(ue);return addIssueToContext(no,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.boolean,received:no.parsedType}),INVALID$3}return OK(ue.data)}}ZodBoolean.create=to=>new ZodBoolean({typeName:ZodFirstPartyTypeKind.ZodBoolean,coerce:(to==null?void 0:to.coerce)||!1,...processCreateParams(to)});class ZodDate extends ZodType{_parse(ue){if(this._def.coerce&&(ue.data=new Date(ue.data)),this._getType(ue)!==ZodParsedType.date){const oo=this._getOrReturnCtx(ue);return addIssueToContext(oo,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.date,received:oo.parsedType}),INVALID$3}if(isNaN(ue.data.getTime())){const oo=this._getOrReturnCtx(ue);return addIssueToContext(oo,{code:ZodIssueCode.invalid_date}),INVALID$3}const no=new ParseStatus;let ro;for(const oo of this._def.checks)oo.kind==="min"?ue.data.getTime()<oo.value&&(ro=this._getOrReturnCtx(ue,ro),addIssueToContext(ro,{code:ZodIssueCode.too_small,message:oo.message,inclusive:!0,exact:!1,minimum:oo.value,type:"date"}),no.dirty()):oo.kind==="max"?ue.data.getTime()>oo.value&&(ro=this._getOrReturnCtx(ue,ro),addIssueToContext(ro,{code:ZodIssueCode.too_big,message:oo.message,inclusive:!0,exact:!1,maximum:oo.value,type:"date"}),no.dirty()):util$h.assertNever(oo);return{status:no.value,value:new Date(ue.data.getTime())}}_addCheck(ue){return new ZodDate({...this._def,checks:[...this._def.checks,ue]})}min(ue,eo){return this._addCheck({kind:"min",value:ue.getTime(),message:errorUtil.toString(eo)})}max(ue,eo){return this._addCheck({kind:"max",value:ue.getTime(),message:errorUtil.toString(eo)})}get minDate(){let ue=null;for(const eo of this._def.checks)eo.kind==="min"&&(ue===null||eo.value>ue)&&(ue=eo.value);return ue!=null?new Date(ue):null}get maxDate(){let ue=null;for(const eo of this._def.checks)eo.kind==="max"&&(ue===null||eo.value<ue)&&(ue=eo.value);return ue!=null?new Date(ue):null}}ZodDate.create=to=>new ZodDate({checks:[],coerce:(to==null?void 0:to.coerce)||!1,typeName:ZodFirstPartyTypeKind.ZodDate,...processCreateParams(to)});class ZodSymbol extends ZodType{_parse(ue){if(this._getType(ue)!==ZodParsedType.symbol){const no=this._getOrReturnCtx(ue);return addIssueToContext(no,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.symbol,received:no.parsedType}),INVALID$3}return OK(ue.data)}}ZodSymbol.create=to=>new ZodSymbol({typeName:ZodFirstPartyTypeKind.ZodSymbol,...processCreateParams(to)});class ZodUndefined extends ZodType{_parse(ue){if(this._getType(ue)!==ZodParsedType.undefined){const no=this._getOrReturnCtx(ue);return addIssueToContext(no,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.undefined,received:no.parsedType}),INVALID$3}return OK(ue.data)}}ZodUndefined.create=to=>new ZodUndefined({typeName:ZodFirstPartyTypeKind.ZodUndefined,...processCreateParams(to)});class ZodNull extends ZodType{_parse(ue){if(this._getType(ue)!==ZodParsedType.null){const no=this._getOrReturnCtx(ue);return addIssueToContext(no,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.null,received:no.parsedType}),INVALID$3}return OK(ue.data)}}ZodNull.create=to=>new ZodNull({typeName:ZodFirstPartyTypeKind.ZodNull,...processCreateParams(to)});class ZodAny extends ZodType{constructor(){super(...arguments),this._any=!0}_parse(ue){return OK(ue.data)}}ZodAny.create=to=>new ZodAny({typeName:ZodFirstPartyTypeKind.ZodAny,...processCreateParams(to)});class ZodUnknown extends ZodType{constructor(){super(...arguments),this._unknown=!0}_parse(ue){return OK(ue.data)}}ZodUnknown.create=to=>new ZodUnknown({typeName:ZodFirstPartyTypeKind.ZodUnknown,...processCreateParams(to)});class ZodNever extends ZodType{_parse(ue){const eo=this._getOrReturnCtx(ue);return addIssueToContext(eo,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.never,received:eo.parsedType}),INVALID$3}}ZodNever.create=to=>new ZodNever({typeName:ZodFirstPartyTypeKind.ZodNever,...processCreateParams(to)});class ZodVoid extends ZodType{_parse(ue){if(this._getType(ue)!==ZodParsedType.undefined){const no=this._getOrReturnCtx(ue);return addIssueToContext(no,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.void,received:no.parsedType}),INVALID$3}return OK(ue.data)}}ZodVoid.create=to=>new ZodVoid({typeName:ZodFirstPartyTypeKind.ZodVoid,...processCreateParams(to)});class ZodArray extends ZodType{_parse(ue){const{ctx:eo,status:no}=this._processInputParams(ue),ro=this._def;if(eo.parsedType!==ZodParsedType.array)return addIssueToContext(eo,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.array,received:eo.parsedType}),INVALID$3;if(ro.exactLength!==null){const io=eo.data.length>ro.exactLength.value,ao=eo.data.length<ro.exactLength.value;(io||ao)&&(addIssueToContext(eo,{code:io?ZodIssueCode.too_big:ZodIssueCode.too_small,minimum:ao?ro.exactLength.value:void 0,maximum:io?ro.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:ro.exactLength.message}),no.dirty())}if(ro.minLength!==null&&eo.data.length<ro.minLength.value&&(addIssueToContext(eo,{code:ZodIssueCode.too_small,minimum:ro.minLength.value,type:"array",inclusive:!0,exact:!1,message:ro.minLength.message}),no.dirty()),ro.maxLength!==null&&eo.data.length>ro.maxLength.value&&(addIssueToContext(eo,{code:ZodIssueCode.too_big,maximum:ro.maxLength.value,type:"array",inclusive:!0,exact:!1,message:ro.maxLength.message}),no.dirty()),eo.common.async)return Promise.all([...eo.data].map((io,ao)=>ro.type._parseAsync(new ParseInputLazyPath(eo,io,eo.path,ao)))).then(io=>ParseStatus.mergeArray(no,io));const oo=[...eo.data].map((io,ao)=>ro.type._parseSync(new ParseInputLazyPath(eo,io,eo.path,ao)));return ParseStatus.mergeArray(no,oo)}get element(){return this._def.type}min(ue,eo){return new ZodArray({...this._def,minLength:{value:ue,message:errorUtil.toString(eo)}})}max(ue,eo){return new ZodArray({...this._def,maxLength:{value:ue,message:errorUtil.toString(eo)}})}length(ue,eo){return new ZodArray({...this._def,exactLength:{value:ue,message:errorUtil.toString(eo)}})}nonempty(ue){return this.min(1,ue)}}ZodArray.create=(to,ue)=>new ZodArray({type:to,minLength:null,maxLength:null,exactLength:null,typeName:ZodFirstPartyTypeKind.ZodArray,...processCreateParams(ue)});function deepPartialify(to){if(to instanceof ZodObject){const ue={};for(const eo in to.shape){const no=to.shape[eo];ue[eo]=ZodOptional.create(deepPartialify(no))}return new ZodObject({...to._def,shape:()=>ue})}else return to instanceof ZodArray?new ZodArray({...to._def,type:deepPartialify(to.element)}):to instanceof ZodOptional?ZodOptional.create(deepPartialify(to.unwrap())):to instanceof ZodNullable?ZodNullable.create(deepPartialify(to.unwrap())):to instanceof ZodTuple?ZodTuple.create(to.items.map(ue=>deepPartialify(ue))):to}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 ue=this._def.shape(),eo=util$h.objectKeys(ue);return this._cached={shape:ue,keys:eo}}_parse(ue){if(this._getType(ue)!==ZodParsedType.object){const lo=this._getOrReturnCtx(ue);return addIssueToContext(lo,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.object,received:lo.parsedType}),INVALID$3}const{status:no,ctx:ro}=this._processInputParams(ue),{shape:oo,keys:io}=this._getCached(),ao=[];if(!(this._def.catchall instanceof ZodNever&&this._def.unknownKeys==="strip"))for(const lo in ro.data)io.includes(lo)||ao.push(lo);const so=[];for(const lo of io){const co=oo[lo],uo=ro.data[lo];so.push({key:{status:"valid",value:lo},value:co._parse(new ParseInputLazyPath(ro,uo,ro.path,lo)),alwaysSet:lo in ro.data})}if(this._def.catchall instanceof ZodNever){const lo=this._def.unknownKeys;if(lo==="passthrough")for(const co of ao)so.push({key:{status:"valid",value:co},value:{status:"valid",value:ro.data[co]}});else if(lo==="strict")ao.length>0&&(addIssueToContext(ro,{code:ZodIssueCode.unrecognized_keys,keys:ao}),no.dirty());else if(lo!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const lo=this._def.catchall;for(const co of ao){const uo=ro.data[co];so.push({key:{status:"valid",value:co},value:lo._parse(new ParseInputLazyPath(ro,uo,ro.path,co)),alwaysSet:co in ro.data})}}return ro.common.async?Promise.resolve().then(async()=>{const lo=[];for(const co of so){const uo=await co.key,fo=await co.value;lo.push({key:uo,value:fo,alwaysSet:co.alwaysSet})}return lo}).then(lo=>ParseStatus.mergeObjectSync(no,lo)):ParseStatus.mergeObjectSync(no,so)}get shape(){return this._def.shape()}strict(ue){return errorUtil.errToObj,new ZodObject({...this._def,unknownKeys:"strict",...ue!==void 0?{errorMap:(eo,no)=>{var ro,oo,io,ao;const so=(io=(oo=(ro=this._def).errorMap)===null||oo===void 0?void 0:oo.call(ro,eo,no).message)!==null&&io!==void 0?io:no.defaultError;return eo.code==="unrecognized_keys"?{message:(ao=errorUtil.errToObj(ue).message)!==null&&ao!==void 0?ao:so}:{message:so}}}:{}})}strip(){return new ZodObject({...this._def,unknownKeys:"strip"})}passthrough(){return new ZodObject({...this._def,unknownKeys:"passthrough"})}extend(ue){return new ZodObject({...this._def,shape:()=>({...this._def.shape(),...ue})})}merge(ue){return new ZodObject({unknownKeys:ue._def.unknownKeys,catchall:ue._def.catchall,shape:()=>({...this._def.shape(),...ue._def.shape()}),typeName:ZodFirstPartyTypeKind.ZodObject})}setKey(ue,eo){return this.augment({[ue]:eo})}catchall(ue){return new ZodObject({...this._def,catchall:ue})}pick(ue){const eo={};return util$h.objectKeys(ue).forEach(no=>{ue[no]&&this.shape[no]&&(eo[no]=this.shape[no])}),new ZodObject({...this._def,shape:()=>eo})}omit(ue){const eo={};return util$h.objectKeys(this.shape).forEach(no=>{ue[no]||(eo[no]=this.shape[no])}),new ZodObject({...this._def,shape:()=>eo})}deepPartial(){return deepPartialify(this)}partial(ue){const eo={};return util$h.objectKeys(this.shape).forEach(no=>{const ro=this.shape[no];ue&&!ue[no]?eo[no]=ro:eo[no]=ro.optional()}),new ZodObject({...this._def,shape:()=>eo})}required(ue){const eo={};return util$h.objectKeys(this.shape).forEach(no=>{if(ue&&!ue[no])eo[no]=this.shape[no];else{let oo=this.shape[no];for(;oo instanceof ZodOptional;)oo=oo._def.innerType;eo[no]=oo}}),new ZodObject({...this._def,shape:()=>eo})}keyof(){return createZodEnum(util$h.objectKeys(this.shape))}}ZodObject.create=(to,ue)=>new ZodObject({shape:()=>to,unknownKeys:"strip",catchall:ZodNever.create(),typeName:ZodFirstPartyTypeKind.ZodObject,...processCreateParams(ue)});ZodObject.strictCreate=(to,ue)=>new ZodObject({shape:()=>to,unknownKeys:"strict",catchall:ZodNever.create(),typeName:ZodFirstPartyTypeKind.ZodObject,...processCreateParams(ue)});ZodObject.lazycreate=(to,ue)=>new ZodObject({shape:to,unknownKeys:"strip",catchall:ZodNever.create(),typeName:ZodFirstPartyTypeKind.ZodObject,...processCreateParams(ue)});class ZodUnion extends ZodType{_parse(ue){const{ctx:eo}=this._processInputParams(ue),no=this._def.options;function ro(oo){for(const ao of oo)if(ao.result.status==="valid")return ao.result;for(const ao of oo)if(ao.result.status==="dirty")return eo.common.issues.push(...ao.ctx.common.issues),ao.result;const io=oo.map(ao=>new ZodError(ao.ctx.common.issues));return addIssueToContext(eo,{code:ZodIssueCode.invalid_union,unionErrors:io}),INVALID$3}if(eo.common.async)return Promise.all(no.map(async oo=>{const io={...eo,common:{...eo.common,issues:[]},parent:null};return{result:await oo._parseAsync({data:eo.data,path:eo.path,parent:io}),ctx:io}})).then(ro);{let oo;const io=[];for(const so of no){const lo={...eo,common:{...eo.common,issues:[]},parent:null},co=so._parseSync({data:eo.data,path:eo.path,parent:lo});if(co.status==="valid")return co;co.status==="dirty"&&!oo&&(oo={result:co,ctx:lo}),lo.common.issues.length&&io.push(lo.common.issues)}if(oo)return eo.common.issues.push(...oo.ctx.common.issues),oo.result;const ao=io.map(so=>new ZodError(so));return addIssueToContext(eo,{code:ZodIssueCode.invalid_union,unionErrors:ao}),INVALID$3}}get options(){return this._def.options}}ZodUnion.create=(to,ue)=>new ZodUnion({options:to,typeName:ZodFirstPartyTypeKind.ZodUnion,...processCreateParams(ue)});const getDiscriminator=to=>to instanceof ZodLazy?getDiscriminator(to.schema):to instanceof ZodEffects?getDiscriminator(to.innerType()):to instanceof ZodLiteral?[to.value]:to instanceof ZodEnum?to.options:to instanceof ZodNativeEnum?util$h.objectValues(to.enum):to instanceof ZodDefault?getDiscriminator(to._def.innerType):to instanceof ZodUndefined?[void 0]:to instanceof ZodNull?[null]:to instanceof ZodOptional?[void 0,...getDiscriminator(to.unwrap())]:to instanceof ZodNullable?[null,...getDiscriminator(to.unwrap())]:to instanceof ZodBranded||to instanceof ZodReadonly?getDiscriminator(to.unwrap()):to instanceof ZodCatch?getDiscriminator(to._def.innerType):[];class ZodDiscriminatedUnion extends ZodType{_parse(ue){const{ctx:eo}=this._processInputParams(ue);if(eo.parsedType!==ZodParsedType.object)return addIssueToContext(eo,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.object,received:eo.parsedType}),INVALID$3;const no=this.discriminator,ro=eo.data[no],oo=this.optionsMap.get(ro);return oo?eo.common.async?oo._parseAsync({data:eo.data,path:eo.path,parent:eo}):oo._parseSync({data:eo.data,path:eo.path,parent:eo}):(addIssueToContext(eo,{code:ZodIssueCode.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[no]}),INVALID$3)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(ue,eo,no){const ro=new Map;for(const oo of eo){const io=getDiscriminator(oo.shape[ue]);if(!io.length)throw new Error(`A discriminator value for key \`${ue}\` could not be extracted from all schema options`);for(const ao of io){if(ro.has(ao))throw new Error(`Discriminator property ${String(ue)} has duplicate value ${String(ao)}`);ro.set(ao,oo)}}return new ZodDiscriminatedUnion({typeName:ZodFirstPartyTypeKind.ZodDiscriminatedUnion,discriminator:ue,options:eo,optionsMap:ro,...processCreateParams(no)})}}function mergeValues(to,ue){const eo=getParsedType(to),no=getParsedType(ue);if(to===ue)return{valid:!0,data:to};if(eo===ZodParsedType.object&&no===ZodParsedType.object){const ro=util$h.objectKeys(ue),oo=util$h.objectKeys(to).filter(ao=>ro.indexOf(ao)!==-1),io={...to,...ue};for(const ao of oo){const so=mergeValues(to[ao],ue[ao]);if(!so.valid)return{valid:!1};io[ao]=so.data}return{valid:!0,data:io}}else if(eo===ZodParsedType.array&&no===ZodParsedType.array){if(to.length!==ue.length)return{valid:!1};const ro=[];for(let oo=0;oo<to.length;oo++){const io=to[oo],ao=ue[oo],so=mergeValues(io,ao);if(!so.valid)return{valid:!1};ro.push(so.data)}return{valid:!0,data:ro}}else return eo===ZodParsedType.date&&no===ZodParsedType.date&&+to==+ue?{valid:!0,data:to}:{valid:!1}}class ZodIntersection extends ZodType{_parse(ue){const{status:eo,ctx:no}=this._processInputParams(ue),ro=(oo,io)=>{if(isAborted(oo)||isAborted(io))return INVALID$3;const ao=mergeValues(oo.value,io.value);return ao.valid?((isDirty(oo)||isDirty(io))&&eo.dirty(),{status:eo.value,value:ao.data}):(addIssueToContext(no,{code:ZodIssueCode.invalid_intersection_types}),INVALID$3)};return no.common.async?Promise.all([this._def.left._parseAsync({data:no.data,path:no.path,parent:no}),this._def.right._parseAsync({data:no.data,path:no.path,parent:no})]).then(([oo,io])=>ro(oo,io)):ro(this._def.left._parseSync({data:no.data,path:no.path,parent:no}),this._def.right._parseSync({data:no.data,path:no.path,parent:no}))}}ZodIntersection.create=(to,ue,eo)=>new ZodIntersection({left:to,right:ue,typeName:ZodFirstPartyTypeKind.ZodIntersection,...processCreateParams(eo)});class ZodTuple extends ZodType{_parse(ue){const{status:eo,ctx:no}=this._processInputParams(ue);if(no.parsedType!==ZodParsedType.array)return addIssueToContext(no,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.array,received:no.parsedType}),INVALID$3;if(no.data.length<this._def.items.length)return addIssueToContext(no,{code:ZodIssueCode.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),INVALID$3;!this._def.rest&&no.data.length>this._def.items.length&&(addIssueToContext(no,{code:ZodIssueCode.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),eo.dirty());const oo=[...no.data].map((io,ao)=>{const so=this._def.items[ao]||this._def.rest;return so?so._parse(new ParseInputLazyPath(no,io,no.path,ao)):null}).filter(io=>!!io);return no.common.async?Promise.all(oo).then(io=>ParseStatus.mergeArray(eo,io)):ParseStatus.mergeArray(eo,oo)}get items(){return this._def.items}rest(ue){return new ZodTuple({...this._def,rest:ue})}}ZodTuple.create=(to,ue)=>{if(!Array.isArray(to))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new ZodTuple({items:to,typeName:ZodFirstPartyTypeKind.ZodTuple,rest:null,...processCreateParams(ue)})};class ZodRecord extends ZodType{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(ue){const{status:eo,ctx:no}=this._processInputParams(ue);if(no.parsedType!==ZodParsedType.object)return addIssueToContext(no,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.object,received:no.parsedType}),INVALID$3;const ro=[],oo=this._def.keyType,io=this._def.valueType;for(const ao in no.data)ro.push({key:oo._parse(new ParseInputLazyPath(no,ao,no.path,ao)),value:io._parse(new ParseInputLazyPath(no,no.data[ao],no.path,ao)),alwaysSet:ao in no.data});return no.common.async?ParseStatus.mergeObjectAsync(eo,ro):ParseStatus.mergeObjectSync(eo,ro)}get element(){return this._def.valueType}static create(ue,eo,no){return eo instanceof ZodType?new ZodRecord({keyType:ue,valueType:eo,typeName:ZodFirstPartyTypeKind.ZodRecord,...processCreateParams(no)}):new ZodRecord({keyType:ZodString.create(),valueType:ue,typeName:ZodFirstPartyTypeKind.ZodRecord,...processCreateParams(eo)})}}class ZodMap extends ZodType{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(ue){const{status:eo,ctx:no}=this._processInputParams(ue);if(no.parsedType!==ZodParsedType.map)return addIssueToContext(no,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.map,received:no.parsedType}),INVALID$3;const ro=this._def.keyType,oo=this._def.valueType,io=[...no.data.entries()].map(([ao,so],lo)=>({key:ro._parse(new ParseInputLazyPath(no,ao,no.path,[lo,"key"])),value:oo._parse(new ParseInputLazyPath(no,so,no.path,[lo,"value"]))}));if(no.common.async){const ao=new Map;return Promise.resolve().then(async()=>{for(const so of io){const lo=await so.key,co=await so.value;if(lo.status==="aborted"||co.status==="aborted")return INVALID$3;(lo.status==="dirty"||co.status==="dirty")&&eo.dirty(),ao.set(lo.value,co.value)}return{status:eo.value,value:ao}})}else{const ao=new Map;for(const so of io){const lo=so.key,co=so.value;if(lo.status==="aborted"||co.status==="aborted")return INVALID$3;(lo.status==="dirty"||co.status==="dirty")&&eo.dirty(),ao.set(lo.value,co.value)}return{status:eo.value,value:ao}}}}ZodMap.create=(to,ue,eo)=>new ZodMap({valueType:ue,keyType:to,typeName:ZodFirstPartyTypeKind.ZodMap,...processCreateParams(eo)});class ZodSet extends ZodType{_parse(ue){const{status:eo,ctx:no}=this._processInputParams(ue);if(no.parsedType!==ZodParsedType.set)return addIssueToContext(no,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.set,received:no.parsedType}),INVALID$3;const ro=this._def;ro.minSize!==null&&no.data.size<ro.minSize.value&&(addIssueToContext(no,{code:ZodIssueCode.too_small,minimum:ro.minSize.value,type:"set",inclusive:!0,exact:!1,message:ro.minSize.message}),eo.dirty()),ro.maxSize!==null&&no.data.size>ro.maxSize.value&&(addIssueToContext(no,{code:ZodIssueCode.too_big,maximum:ro.maxSize.value,type:"set",inclusive:!0,exact:!1,message:ro.maxSize.message}),eo.dirty());const oo=this._def.valueType;function io(so){const lo=new Set;for(const co of so){if(co.status==="aborted")return INVALID$3;co.status==="dirty"&&eo.dirty(),lo.add(co.value)}return{status:eo.value,value:lo}}const ao=[...no.data.values()].map((so,lo)=>oo._parse(new ParseInputLazyPath(no,so,no.path,lo)));return no.common.async?Promise.all(ao).then(so=>io(so)):io(ao)}min(ue,eo){return new ZodSet({...this._def,minSize:{value:ue,message:errorUtil.toString(eo)}})}max(ue,eo){return new ZodSet({...this._def,maxSize:{value:ue,message:errorUtil.toString(eo)}})}size(ue,eo){return this.min(ue,eo).max(ue,eo)}nonempty(ue){return this.min(1,ue)}}ZodSet.create=(to,ue)=>new ZodSet({valueType:to,minSize:null,maxSize:null,typeName:ZodFirstPartyTypeKind.ZodSet,...processCreateParams(ue)});class ZodFunction extends ZodType{constructor(){super(...arguments),this.validate=this.implement}_parse(ue){const{ctx:eo}=this._processInputParams(ue);if(eo.parsedType!==ZodParsedType.function)return addIssueToContext(eo,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.function,received:eo.parsedType}),INVALID$3;function no(ao,so){return makeIssue({data:ao,path:eo.path,errorMaps:[eo.common.contextualErrorMap,eo.schemaErrorMap,getErrorMap(),errorMap].filter(lo=>!!lo),issueData:{code:ZodIssueCode.invalid_arguments,argumentsError:so}})}function ro(ao,so){return makeIssue({data:ao,path:eo.path,errorMaps:[eo.common.contextualErrorMap,eo.schemaErrorMap,getErrorMap(),errorMap].filter(lo=>!!lo),issueData:{code:ZodIssueCode.invalid_return_type,returnTypeError:so}})}const oo={errorMap:eo.common.contextualErrorMap},io=eo.data;if(this._def.returns instanceof ZodPromise){const ao=this;return OK(async function(...so){const lo=new ZodError([]),co=await ao._def.args.parseAsync(so,oo).catch(po=>{throw lo.addIssue(no(so,po)),lo}),uo=await Reflect.apply(io,this,co);return await ao._def.returns._def.type.parseAsync(uo,oo).catch(po=>{throw lo.addIssue(ro(uo,po)),lo})})}else{const ao=this;return OK(function(...so){const lo=ao._def.args.safeParse(so,oo);if(!lo.success)throw new ZodError([no(so,lo.error)]);const co=Reflect.apply(io,this,lo.data),uo=ao._def.returns.safeParse(co,oo);if(!uo.success)throw new ZodError([ro(co,uo.error)]);return uo.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...ue){return new ZodFunction({...this._def,args:ZodTuple.create(ue).rest(ZodUnknown.create())})}returns(ue){return new ZodFunction({...this._def,returns:ue})}implement(ue){return this.parse(ue)}strictImplement(ue){return this.parse(ue)}static create(ue,eo,no){return new ZodFunction({args:ue||ZodTuple.create([]).rest(ZodUnknown.create()),returns:eo||ZodUnknown.create(),typeName:ZodFirstPartyTypeKind.ZodFunction,...processCreateParams(no)})}}class ZodLazy extends ZodType{get schema(){return this._def.getter()}_parse(ue){const{ctx:eo}=this._processInputParams(ue);return this._def.getter()._parse({data:eo.data,path:eo.path,parent:eo})}}ZodLazy.create=(to,ue)=>new ZodLazy({getter:to,typeName:ZodFirstPartyTypeKind.ZodLazy,...processCreateParams(ue)});class ZodLiteral extends ZodType{_parse(ue){if(ue.data!==this._def.value){const eo=this._getOrReturnCtx(ue);return addIssueToContext(eo,{received:eo.data,code:ZodIssueCode.invalid_literal,expected:this._def.value}),INVALID$3}return{status:"valid",value:ue.data}}get value(){return this._def.value}}ZodLiteral.create=(to,ue)=>new ZodLiteral({value:to,typeName:ZodFirstPartyTypeKind.ZodLiteral,...processCreateParams(ue)});function createZodEnum(to,ue){return new ZodEnum({values:to,typeName:ZodFirstPartyTypeKind.ZodEnum,...processCreateParams(ue)})}class ZodEnum extends ZodType{constructor(){super(...arguments),_ZodEnum_cache.set(this,void 0)}_parse(ue){if(typeof ue.data!="string"){const eo=this._getOrReturnCtx(ue),no=this._def.values;return addIssueToContext(eo,{expected:util$h.joinValues(no),received:eo.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(ue.data)){const eo=this._getOrReturnCtx(ue),no=this._def.values;return addIssueToContext(eo,{received:eo.data,code:ZodIssueCode.invalid_enum_value,options:no}),INVALID$3}return OK(ue.data)}get options(){return this._def.values}get enum(){const ue={};for(const eo of this._def.values)ue[eo]=eo;return ue}get Values(){const ue={};for(const eo of this._def.values)ue[eo]=eo;return ue}get Enum(){const ue={};for(const eo of this._def.values)ue[eo]=eo;return ue}extract(ue,eo=this._def){return ZodEnum.create(ue,{...this._def,...eo})}exclude(ue,eo=this._def){return ZodEnum.create(this.options.filter(no=>!ue.includes(no)),{...this._def,...eo})}}_ZodEnum_cache=new WeakMap;ZodEnum.create=createZodEnum;class ZodNativeEnum extends ZodType{constructor(){super(...arguments),_ZodNativeEnum_cache.set(this,void 0)}_parse(ue){const eo=util$h.getValidEnumValues(this._def.values),no=this._getOrReturnCtx(ue);if(no.parsedType!==ZodParsedType.string&&no.parsedType!==ZodParsedType.number){const ro=util$h.objectValues(eo);return addIssueToContext(no,{expected:util$h.joinValues(ro),received:no.parsedType,code:ZodIssueCode.invalid_type}),INVALID$3}if(__classPrivateFieldGet(this,_ZodNativeEnum_cache,"f")||__classPrivateFieldSet(this,_ZodNativeEnum_cache,new Set(util$h.getValidEnumValues(this._def.values)),"f"),!__classPrivateFieldGet(this,_ZodNativeEnum_cache,"f").has(ue.data)){const ro=util$h.objectValues(eo);return addIssueToContext(no,{received:no.data,code:ZodIssueCode.invalid_enum_value,options:ro}),INVALID$3}return OK(ue.data)}get enum(){return this._def.values}}_ZodNativeEnum_cache=new WeakMap;ZodNativeEnum.create=(to,ue)=>new ZodNativeEnum({values:to,typeName:ZodFirstPartyTypeKind.ZodNativeEnum,...processCreateParams(ue)});class ZodPromise extends ZodType{unwrap(){return this._def.type}_parse(ue){const{ctx:eo}=this._processInputParams(ue);if(eo.parsedType!==ZodParsedType.promise&&eo.common.async===!1)return addIssueToContext(eo,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.promise,received:eo.parsedType}),INVALID$3;const no=eo.parsedType===ZodParsedType.promise?eo.data:Promise.resolve(eo.data);return OK(no.then(ro=>this._def.type.parseAsync(ro,{path:eo.path,errorMap:eo.common.contextualErrorMap})))}}ZodPromise.create=(to,ue)=>new ZodPromise({type:to,typeName:ZodFirstPartyTypeKind.ZodPromise,...processCreateParams(ue)});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(ue){const{status:eo,ctx:no}=this._processInputParams(ue),ro=this._def.effect||null,oo={addIssue:io=>{addIssueToContext(no,io),io.fatal?eo.abort():eo.dirty()},get path(){return no.path}};if(oo.addIssue=oo.addIssue.bind(oo),ro.type==="preprocess"){const io=ro.transform(no.data,oo);if(no.common.async)return Promise.resolve(io).then(async ao=>{if(eo.value==="aborted")return INVALID$3;const so=await this._def.schema._parseAsync({data:ao,path:no.path,parent:no});return so.status==="aborted"?INVALID$3:so.status==="dirty"||eo.value==="dirty"?DIRTY(so.value):so});{if(eo.value==="aborted")return INVALID$3;const ao=this._def.schema._parseSync({data:io,path:no.path,parent:no});return ao.status==="aborted"?INVALID$3:ao.status==="dirty"||eo.value==="dirty"?DIRTY(ao.value):ao}}if(ro.type==="refinement"){const io=ao=>{const so=ro.refinement(ao,oo);if(no.common.async)return Promise.resolve(so);if(so instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return ao};if(no.common.async===!1){const ao=this._def.schema._parseSync({data:no.data,path:no.path,parent:no});return ao.status==="aborted"?INVALID$3:(ao.status==="dirty"&&eo.dirty(),io(ao.value),{status:eo.value,value:ao.value})}else return this._def.schema._parseAsync({data:no.data,path:no.path,parent:no}).then(ao=>ao.status==="aborted"?INVALID$3:(ao.status==="dirty"&&eo.dirty(),io(ao.value).then(()=>({status:eo.value,value:ao.value}))))}if(ro.type==="transform")if(no.common.async===!1){const io=this._def.schema._parseSync({data:no.data,path:no.path,parent:no});if(!isValid$2(io))return io;const ao=ro.transform(io.value,oo);if(ao instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:eo.value,value:ao}}else return this._def.schema._parseAsync({data:no.data,path:no.path,parent:no}).then(io=>isValid$2(io)?Promise.resolve(ro.transform(io.value,oo)).then(ao=>({status:eo.value,value:ao})):io);util$h.assertNever(ro)}}ZodEffects.create=(to,ue,eo)=>new ZodEffects({schema:to,typeName:ZodFirstPartyTypeKind.ZodEffects,effect:ue,...processCreateParams(eo)});ZodEffects.createWithPreprocess=(to,ue,eo)=>new ZodEffects({schema:ue,effect:{type:"preprocess",transform:to},typeName:ZodFirstPartyTypeKind.ZodEffects,...processCreateParams(eo)});class ZodOptional extends ZodType{_parse(ue){return this._getType(ue)===ZodParsedType.undefined?OK(void 0):this._def.innerType._parse(ue)}unwrap(){return this._def.innerType}}ZodOptional.create=(to,ue)=>new ZodOptional({innerType:to,typeName:ZodFirstPartyTypeKind.ZodOptional,...processCreateParams(ue)});class ZodNullable extends ZodType{_parse(ue){return this._getType(ue)===ZodParsedType.null?OK(null):this._def.innerType._parse(ue)}unwrap(){return this._def.innerType}}ZodNullable.create=(to,ue)=>new ZodNullable({innerType:to,typeName:ZodFirstPartyTypeKind.ZodNullable,...processCreateParams(ue)});class ZodDefault extends ZodType{_parse(ue){const{ctx:eo}=this._processInputParams(ue);let no=eo.data;return eo.parsedType===ZodParsedType.undefined&&(no=this._def.defaultValue()),this._def.innerType._parse({data:no,path:eo.path,parent:eo})}removeDefault(){return this._def.innerType}}ZodDefault.create=(to,ue)=>new ZodDefault({innerType:to,typeName:ZodFirstPartyTypeKind.ZodDefault,defaultValue:typeof ue.default=="function"?ue.default:()=>ue.default,...processCreateParams(ue)});class ZodCatch extends ZodType{_parse(ue){const{ctx:eo}=this._processInputParams(ue),no={...eo,common:{...eo.common,issues:[]}},ro=this._def.innerType._parse({data:no.data,path:no.path,parent:{...no}});return isAsync(ro)?ro.then(oo=>({status:"valid",value:oo.status==="valid"?oo.value:this._def.catchValue({get error(){return new ZodError(no.common.issues)},input:no.data})})):{status:"valid",value:ro.status==="valid"?ro.value:this._def.catchValue({get error(){return new ZodError(no.common.issues)},input:no.data})}}removeCatch(){return this._def.innerType}}ZodCatch.create=(to,ue)=>new ZodCatch({innerType:to,typeName:ZodFirstPartyTypeKind.ZodCatch,catchValue:typeof ue.catch=="function"?ue.catch:()=>ue.catch,...processCreateParams(ue)});class ZodNaN extends ZodType{_parse(ue){if(this._getType(ue)!==ZodParsedType.nan){const no=this._getOrReturnCtx(ue);return addIssueToContext(no,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.nan,received:no.parsedType}),INVALID$3}return{status:"valid",value:ue.data}}}ZodNaN.create=to=>new ZodNaN({typeName:ZodFirstPartyTypeKind.ZodNaN,...processCreateParams(to)});const BRAND=Symbol("zod_brand");class ZodBranded extends ZodType{_parse(ue){const{ctx:eo}=this._processInputParams(ue),no=eo.data;return this._def.type._parse({data:no,path:eo.path,parent:eo})}unwrap(){return this._def.type}}class ZodPipeline extends ZodType{_parse(ue){const{status:eo,ctx:no}=this._processInputParams(ue);if(no.common.async)return(async()=>{const oo=await this._def.in._parseAsync({data:no.data,path:no.path,parent:no});return oo.status==="aborted"?INVALID$3:oo.status==="dirty"?(eo.dirty(),DIRTY(oo.value)):this._def.out._parseAsync({data:oo.value,path:no.path,parent:no})})();{const ro=this._def.in._parseSync({data:no.data,path:no.path,parent:no});return ro.status==="aborted"?INVALID$3:ro.status==="dirty"?(eo.dirty(),{status:"dirty",value:ro.value}):this._def.out._parseSync({data:ro.value,path:no.path,parent:no})}}static create(ue,eo){return new ZodPipeline({in:ue,out:eo,typeName:ZodFirstPartyTypeKind.ZodPipeline})}}class ZodReadonly extends ZodType{_parse(ue){const eo=this._def.innerType._parse(ue),no=ro=>(isValid$2(ro)&&(ro.value=Object.freeze(ro.value)),ro);return isAsync(eo)?eo.then(ro=>no(ro)):no(eo)}unwrap(){return this._def.innerType}}ZodReadonly.create=(to,ue)=>new ZodReadonly({innerType:to,typeName:ZodFirstPartyTypeKind.ZodReadonly,...processCreateParams(ue)});function custom(to,ue={},eo){return to?ZodAny.create().superRefine((no,ro)=>{var oo,io;if(!to(no)){const ao=typeof ue=="function"?ue(no):typeof ue=="string"?{message:ue}:ue,so=(io=(oo=ao.fatal)!==null&&oo!==void 0?oo:eo)!==null&&io!==void 0?io:!0,lo=typeof ao=="string"?{message:ao}:ao;ro.addIssue({code:"custom",...lo,fatal:so})}}):ZodAny.create()}const late={object:ZodObject.lazycreate};var ZodFirstPartyTypeKind;(function(to){to.ZodString="ZodString",to.ZodNumber="ZodNumber",to.ZodNaN="ZodNaN",to.ZodBigInt="ZodBigInt",to.ZodBoolean="ZodBoolean",to.ZodDate="ZodDate",to.ZodSymbol="ZodSymbol",to.ZodUndefined="ZodUndefined",to.ZodNull="ZodNull",to.ZodAny="ZodAny",to.ZodUnknown="ZodUnknown",to.ZodNever="ZodNever",to.ZodVoid="ZodVoid",to.ZodArray="ZodArray",to.ZodObject="ZodObject",to.ZodUnion="ZodUnion",to.ZodDiscriminatedUnion="ZodDiscriminatedUnion",to.ZodIntersection="ZodIntersection",to.ZodTuple="ZodTuple",to.ZodRecord="ZodRecord",to.ZodMap="ZodMap",to.ZodSet="ZodSet",to.ZodFunction="ZodFunction",to.ZodLazy="ZodLazy",to.ZodLiteral="ZodLiteral",to.ZodEnum="ZodEnum",to.ZodEffects="ZodEffects",to.ZodNativeEnum="ZodNativeEnum",to.ZodOptional="ZodOptional",to.ZodNullable="ZodNullable",to.ZodDefault="ZodDefault",to.ZodCatch="ZodCatch",to.ZodPromise="ZodPromise",to.ZodBranded="ZodBranded",to.ZodPipeline="ZodPipeline",to.ZodReadonly="ZodReadonly"})(ZodFirstPartyTypeKind||(ZodFirstPartyTypeKind={}));const instanceOfType=(to,ue={message:`Input not instance of ${to.name}`})=>custom(eo=>eo instanceof to,ue),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$2=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$1={string:to=>ZodString.create({...to,coerce:!0}),number:to=>ZodNumber.create({...to,coerce:!0}),boolean:to=>ZodBoolean.create({...to,coerce:!0}),bigint:to=>ZodBigInt.create({...to,coerce:!0}),date:to=>ZodDate.create({...to,coerce:!0})},NEVER=INVALID$3;var z$1=Object.freeze({__proto__:null,defaultErrorMap:errorMap,setErrorMap,getErrorMap,makeIssue,EMPTY_PATH,addIssueToContext,ParseStatus,INVALID:INVALID$3,DIRTY,OK,isAborted,isDirty,isValid:isValid$2,isAsync,get util(){return util$h},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:coerce$1,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$2,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$1.string().refine(to=>to!==InternalSearchFilterOperator.COMPLEX_ID_OPERATOR,{message:`Key '${InternalSearchFilterOperator.COMPLEX_ID_OPERATOR}' is not allowed`}),stringBasicFilter=z$1.record(fieldKey,z$1.string()),basicFilter=z$1.record(fieldKey,z$1.any()),arrayFilter$2=z$1.record(fieldKey,z$1.union([z$1.any().array(),z$1.string()])),logicFilter=z$1.lazy(()=>z$1.object({conditions:z$1.array(z$1.object(queryFilterValidation))})),stringOrNumber=z$1.union([z$1.string(),z$1.number()]),queryFilterValidation={[BasicOperator.STRING]:stringBasicFilter.optional(),[BasicOperator.FUZZY]:stringBasicFilter.optional(),[RangeOperator.RANGE]:z$1.record(fieldKey,z$1.union([z$1.object({high:stringOrNumber,low:stringOrNumber}),z$1.object({high:stringOrNumber}),z$1.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$1.object({query:z$1.object({allOr:z$1.boolean().optional(),onEmptyFilter:z$1.nativeEnum(EmptyFilterOption).optional(),...queryFilterValidation}).optional(),paginate:z$1.boolean().optional(),bookmark:z$1.union([z$1.string(),z$1.number()]).nullish(),limit:z$1.number().optional(),sort:z$1.string().nullish(),sortOrder:z$1.nativeEnum(SortOrder).optional(),sortType:z$1.nativeEnum(SortType).nullish(),version:z$1.string().optional(),disableEscaping:z$1.boolean().optional(),countRows:z$1.boolean().optional()});var EventPublishType$1=(to=>(to.ENVIRONMENT_VARIABLE_UPGRADE_PANEL_OPENED="environment_variable_upgrade_panel_opened",to))(EventPublishType$1||{}),MaintenanceType=(to=>(to.SQS_MISSING="sqs_missing",to))(MaintenanceType||{}),DropPosition=(to=>(to.ABOVE="above",to.BELOW="below",to.INSIDE="inside",to))(DropPosition||{}),BindingMode=(to=>(to.Text="Text",to.JavaScript="JavaScript",to))(BindingMode||{}),SidePanel=(to=>(to.Bindings="FlashOn",to.Evaluation="Play",to.Snippets="Code",to))(SidePanel||{}),ComponentContextScopes=(to=>(to.Local="local",to.Global="global",to))(ComponentContextScopes||{});const AIOperations={SUMMARISE_TEXT:{label:"Summarise Text",value:"SUMMARISE_TEXT"},CLEAN_DATA:{label:"Clean Data",value:"CLEAN_DATA"},TRANSLATE:{label:"Translate",value:"TRANSLATE"},CATEGORISE_TEXT:{label:"Categorise Text",value:"CATEGORISE_TEXT"},SENTIMENT_ANALYSIS:{label:"Sentiment Analysis",value:"SENTIMENT_ANALYSIS"},PROMPT:{label:"Prompt",value:"PROMPT"},SEARCH_WEB:{label:"Search Web",value:"SEARCH_WEB"}},OperationFieldTypes={MULTI_COLUMN:"columns",COLUMN:"column",BINDABLE_TEXT:"prompt"},OperationFields={[AIOperationEnum.SUMMARISE_TEXT]:{columns:OperationFieldTypeEnum.MULTI_COLUMN},[AIOperationEnum.CLEAN_DATA]:{column:OperationFieldTypeEnum.COLUMN},[AIOperationEnum.TRANSLATE]:{column:OperationFieldTypeEnum.COLUMN,language:OperationFieldTypeEnum.BINDABLE_TEXT},[AIOperationEnum.CATEGORISE_TEXT]:{columns:OperationFieldTypeEnum.MULTI_COLUMN,categories:OperationFieldTypeEnum.BINDABLE_TEXT},[AIOperationEnum.SENTIMENT_ANALYSIS]:{column:OperationFieldTypeEnum.COLUMN},[AIOperationEnum.PROMPT]:{prompt:OperationFieldTypeEnum.BINDABLE_TEXT},[AIOperationEnum.SEARCH_WEB]:{columns:OperationFieldTypeEnum.MULTI_COLUMN}};var Header$1=(to=>(to.API_KEY="x-budibase-api-key",to.LICENSE_KEY="x-budibase-license-key",to.API_VER="x-budibase-api-version",to.APP_ID="x-budibase-app-id",to.SESSION_ID="x-budibase-session-id",to.TYPE="x-budibase-type",to.PREVIEW_ROLE="x-budibase-role",to.TENANT_ID="x-budibase-tenant-id",to.VERIFICATION_CODE="x-budibase-verification-code",to.RETURN_VERIFICATION_CODE="x-budibase-return-verification-code",to.RESET_PASSWORD_CODE="x-budibase-reset-password-code",to.RETURN_RESET_PASSWORD_CODE="x-budibase-return-reset-password-code",to.TOKEN="x-budibase-token",to.CSRF_TOKEN="x-csrf-token",to.CORRELATION_ID="x-budibase-correlation-id",to.AUTHORIZATION="authorization",to.MIGRATING_APP="x-budibase-migrating-app",to.COOKIE="cookie",to))(Header$1||{});const SWITCHABLE_TYPES={[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]},PROTECTED_INTERNAL_COLUMNS=["_id","_rev","type","createdAt","updatedAt","tableId"],PROTECTED_EXTERNAL_COLUMNS=["_id","_rev","tableId"],ThemeClassPrefix="spectrum--",DefaultBuilderTheme=Theme.DARKEST,DefaultAppTheme$1=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=(to=>(to.UserUpdate="UserUpdate",to.UserDisconnect="UserDisconnect",to.Heartbeat="Heartbeat",to))(SocketEvent||{}),GridSocketEvent=(to=>(to.RowChange="RowChange",to.DatasourceChange="DatasourceChange",to.SelectDatasource="SelectDatasource",to.SelectCell="SelectCell",to))(GridSocketEvent||{}),BuilderSocketEvent=(to=>(to.SelectApp="SelectApp",to.TableChange="TableChange",to.DatasourceChange="DatasourceChange",to.LockTransfer="LockTransfer",to.ScreenChange="ScreenChange",to.AppMetadataChange="AppMetadataChange",to.SelectResource="SelectResource",to.AppPublishChange="AppPublishChange",to.AutomationChange="AutomationChange",to.RoleChange="RoleChange",to))(BuilderSocketEvent||{});const SocketSessionTTL=60,ValidQueryNameRegex=/^[^()]*$/,ValidColumnNameRegex=/^[_a-zA-Z0-9\s]*$/g,ValidSnippetNameRegex=/^[a-z_][a-z0-9_]*$/i,REBOOT_CRON="@reboot";var BpmCorrelationKey=(to=>(to.ONBOARDING="budibase:onboarding:correlationkey",to.VERIFY_SSO_LOGIN="budibase:verify_sso_login:correlationkey",to))(BpmCorrelationKey||{});const DEFAULT_BB_DATASOURCE_ID$1="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(to){return to&&to.__esModule&&Object.prototype.hasOwnProperty.call(to,"default")?to.default:to}function getAugmentedNamespace(to){if(to.__esModule)return to;var ue=to.default;if(typeof ue=="function"){var eo=function no(){return this instanceof no?Reflect.construct(ue,arguments,this.constructor):ue.apply(this,arguments)};eo.prototype=ue.prototype}else eo={};return Object.defineProperty(eo,"__esModule",{value:!0}),Object.keys(to).forEach(function(no){var ro=Object.getOwnPropertyDescriptor(to,no);Object.defineProperty(eo,no,ro.get?ro:{enumerable:!0,get:function(){return to[no]}})}),eo}var dayjs_min$1={exports:{}};(function(to,ue){(function(eo,no){to.exports=no()})(commonjsGlobal$1,function(){var eo=1e3,no=6e4,ro=36e5,oo="millisecond",io="second",ao="minute",so="hour",lo="day",co="week",uo="month",fo="quarter",po="year",ho="date",_o="Invalid Date",go=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,bo=/\[([^\]]+)]|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,vo={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(zo){var Po=["th","st","nd","rd"],Bo=zo%100;return"["+zo+(Po[(Bo-20)%10]||Po[Bo]||Po[0])+"]"}},yo=function(zo,Po,Bo){var qo=String(zo);return!qo||qo.length>=Po?zo:""+Array(Po+1-qo.length).join(Bo)+zo},$o={s:yo,z:function(zo){var Po=-zo.utcOffset(),Bo=Math.abs(Po),qo=Math.floor(Bo/60),Fo=Bo%60;return(Po<=0?"+":"-")+yo(qo,2,"0")+":"+yo(Fo,2,"0")},m:function zo(Po,Bo){if(Po.date()<Bo.date())return-zo(Bo,Po);var qo=12*(Bo.year()-Po.year())+(Bo.month()-Po.month()),Fo=Po.clone().add(qo,uo),Wo=Bo-Fo<0,Go=Po.clone().add(qo+(Wo?-1:1),uo);return+(-(qo+(Bo-Fo)/(Wo?Fo-Go:Go-Fo))||0)},a:function(zo){return zo<0?Math.ceil(zo)||0:Math.floor(zo)},p:function(zo){return{M:uo,y:po,w:co,d:lo,D:ho,h:so,m:ao,s:io,ms:oo,Q:fo}[zo]||String(zo||"").toLowerCase().replace(/s$/,"")},u:function(zo){return zo===void 0}},ko="en",So={};So[ko]=vo;var Ao="$isDayjsObject",Mo=function(zo){return zo instanceof No||!(!zo||!zo[Ao])},Eo=function zo(Po,Bo,qo){var Fo;if(!Po)return ko;if(typeof Po=="string"){var Wo=Po.toLowerCase();So[Wo]&&(Fo=Wo),Bo&&(So[Wo]=Bo,Fo=Wo);var Go=Po.split("-");if(!Fo&&Go.length>1)return zo(Go[0])}else{var Yo=Po.name;So[Yo]=Po,Fo=Yo}return!qo&&Fo&&(ko=Fo),Fo||!qo&&ko},To=function(zo,Po){if(Mo(zo))return zo.clone();var Bo=typeof Po=="object"?Po:{};return Bo.date=zo,Bo.args=arguments,new No(Bo)},Io=$o;Io.l=Eo,Io.i=Mo,Io.w=function(zo,Po){return To(zo,{locale:Po.$L,utc:Po.$u,x:Po.$x,$offset:Po.$offset})};var No=function(){function zo(Bo){this.$L=Eo(Bo.locale,null,!0),this.parse(Bo),this.$x=this.$x||Bo.x||{},this[Ao]=!0}var Po=zo.prototype;return Po.parse=function(Bo){this.$d=function(qo){var Fo=qo.date,Wo=qo.utc;if(Fo===null)return new Date(NaN);if(Io.u(Fo))return new Date;if(Fo instanceof Date)return new Date(Fo);if(typeof Fo=="string"&&!/Z$/i.test(Fo)){var Go=Fo.match(go);if(Go){var Yo=Go[2]-1||0,Xo=(Go[7]||"0").substring(0,3);return Wo?new Date(Date.UTC(Go[1],Yo,Go[3]||1,Go[4]||0,Go[5]||0,Go[6]||0,Xo)):new Date(Go[1],Yo,Go[3]||1,Go[4]||0,Go[5]||0,Go[6]||0,Xo)}}return new Date(Fo)}(Bo),this.init()},Po.init=function(){var Bo=this.$d;this.$y=Bo.getFullYear(),this.$M=Bo.getMonth(),this.$D=Bo.getDate(),this.$W=Bo.getDay(),this.$H=Bo.getHours(),this.$m=Bo.getMinutes(),this.$s=Bo.getSeconds(),this.$ms=Bo.getMilliseconds()},Po.$utils=function(){return Io},Po.isValid=function(){return this.$d.toString()!==_o},Po.isSame=function(Bo,qo){var Fo=To(Bo);return this.startOf(qo)<=Fo&&Fo<=this.endOf(qo)},Po.isAfter=function(Bo,qo){return To(Bo)<this.startOf(qo)},Po.isBefore=function(Bo,qo){return this.endOf(qo)<To(Bo)},Po.$g=function(Bo,qo,Fo){return Io.u(Bo)?this[qo]:this.set(Fo,Bo)},Po.unix=function(){return Math.floor(this.valueOf()/1e3)},Po.valueOf=function(){return this.$d.getTime()},Po.startOf=function(Bo,qo){var Fo=this,Wo=!!Io.u(qo)||qo,Go=Io.p(Bo),Yo=function(sa,Aa){var pa=Io.w(Fo.$u?Date.UTC(Fo.$y,Aa,sa):new Date(Fo.$y,Aa,sa),Fo);return Wo?pa:pa.endOf(lo)},Xo=function(sa,Aa){return Io.w(Fo.toDate()[sa].apply(Fo.toDate("s"),(Wo?[0,0,0,0]:[23,59,59,999]).slice(Aa)),Fo)},Qo=this.$W,Jo=this.$M,na=this.$D,Ko="set"+(this.$u?"UTC":"");switch(Go){case po:return Wo?Yo(1,0):Yo(31,11);case uo:return Wo?Yo(1,Jo):Yo(0,Jo+1);case co:var ia=this.$locale().weekStart||0,ea=(Qo<ia?Qo+7:Qo)-ia;return Yo(Wo?na-ea:na+(6-ea),Jo);case lo:case ho:return Xo(Ko+"Hours",0);case so:return Xo(Ko+"Minutes",1);case ao:return Xo(Ko+"Seconds",2);case io:return Xo(Ko+"Milliseconds",3);default:return this.clone()}},Po.endOf=function(Bo){return this.startOf(Bo,!1)},Po.$set=function(Bo,qo){var Fo,Wo=Io.p(Bo),Go="set"+(this.$u?"UTC":""),Yo=(Fo={},Fo[lo]=Go+"Date",Fo[ho]=Go+"Date",Fo[uo]=Go+"Month",Fo[po]=Go+"FullYear",Fo[so]=Go+"Hours",Fo[ao]=Go+"Minutes",Fo[io]=Go+"Seconds",Fo[oo]=Go+"Milliseconds",Fo)[Wo],Xo=Wo===lo?this.$D+(qo-this.$W):qo;if(Wo===uo||Wo===po){var Qo=this.clone().set(ho,1);Qo.$d[Yo](Xo),Qo.init(),this.$d=Qo.set(ho,Math.min(this.$D,Qo.daysInMonth())).$d}else Yo&&this.$d[Yo](Xo);return this.init(),this},Po.set=function(Bo,qo){return this.clone().$set(Bo,qo)},Po.get=function(Bo){return this[Io.p(Bo)]()},Po.add=function(Bo,qo){var Fo,Wo=this;Bo=Number(Bo);var Go=Io.p(qo),Yo=function(Jo){var na=To(Wo);return Io.w(na.date(na.date()+Math.round(Jo*Bo)),Wo)};if(Go===uo)return this.set(uo,this.$M+Bo);if(Go===po)return this.set(po,this.$y+Bo);if(Go===lo)return Yo(1);if(Go===co)return Yo(7);var Xo=(Fo={},Fo[ao]=no,Fo[so]=ro,Fo[io]=eo,Fo)[Go]||1,Qo=this.$d.getTime()+Bo*Xo;return Io.w(Qo,this)},Po.subtract=function(Bo,qo){return this.add(-1*Bo,qo)},Po.format=function(Bo){var qo=this,Fo=this.$locale();if(!this.isValid())return Fo.invalidDate||_o;var Wo=Bo||"YYYY-MM-DDTHH:mm:ssZ",Go=Io.z(this),Yo=this.$H,Xo=this.$m,Qo=this.$M,Jo=Fo.weekdays,na=Fo.months,Ko=Fo.meridiem,ia=function(Aa,pa,va,ha){return Aa&&(Aa[pa]||Aa(qo,Wo))||va[pa].slice(0,ha)},ea=function(Aa){return Io.s(Yo%12||12,Aa,"0")},sa=Ko||function(Aa,pa,va){var ha=Aa<12?"AM":"PM";return va?ha.toLowerCase():ha};return Wo.replace(bo,function(Aa,pa){return pa||function(va){switch(va){case"YY":return String(qo.$y).slice(-2);case"YYYY":return Io.s(qo.$y,4,"0");case"M":return Qo+1;case"MM":return Io.s(Qo+1,2,"0");case"MMM":return ia(Fo.monthsShort,Qo,na,3);case"MMMM":return ia(na,Qo);case"D":return qo.$D;case"DD":return Io.s(qo.$D,2,"0");case"d":return String(qo.$W);case"dd":return ia(Fo.weekdaysMin,qo.$W,Jo,2);case"ddd":return ia(Fo.weekdaysShort,qo.$W,Jo,3);case"dddd":return Jo[qo.$W];case"H":return String(Yo);case"HH":return Io.s(Yo,2,"0");case"h":return ea(1);case"hh":return ea(2);case"a":return sa(Yo,Xo,!0);case"A":return sa(Yo,Xo,!1);case"m":return String(Xo);case"mm":return Io.s(Xo,2,"0");case"s":return String(qo.$s);case"ss":return Io.s(qo.$s,2,"0");case"SSS":return Io.s(qo.$ms,3,"0");case"Z":return Go}return null}(Aa)||Go.replace(":","")})},Po.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},Po.diff=function(Bo,qo,Fo){var Wo,Go=this,Yo=Io.p(qo),Xo=To(Bo),Qo=(Xo.utcOffset()-this.utcOffset())*no,Jo=this-Xo,na=function(){return Io.m(Go,Xo)};switch(Yo){case po:Wo=na()/12;break;case uo:Wo=na();break;case fo:Wo=na()/3;break;case co:Wo=(Jo-Qo)/6048e5;break;case lo:Wo=(Jo-Qo)/864e5;break;case so:Wo=Jo/ro;break;case ao:Wo=Jo/no;break;case io:Wo=Jo/eo;break;default:Wo=Jo}return Fo?Wo:Io.a(Wo)},Po.daysInMonth=function(){return this.endOf(uo).$D},Po.$locale=function(){return So[this.$L]},Po.locale=function(Bo,qo){if(!Bo)return this.$L;var Fo=this.clone(),Wo=Eo(Bo,qo,!0);return Wo&&(Fo.$L=Wo),Fo},Po.clone=function(){return Io.w(this.$d,this)},Po.toDate=function(){return new Date(this.valueOf())},Po.toJSON=function(){return this.isValid()?this.toISOString():null},Po.toISOString=function(){return this.$d.toISOString()},Po.toString=function(){return this.$d.toUTCString()},zo}(),xo=No.prototype;return To.prototype=xo,[["$ms",oo],["$s",io],["$m",ao],["$H",so],["$W",lo],["$M",uo],["$y",po],["$D",ho]].forEach(function(zo){xo[zo[1]]=function(Po){return this.$g(Po,zo[0],zo[1])}}),To.extend=function(zo,Po){return zo.$i||(zo(Po,No,To),zo.$i=!0),To},To.locale=Eo,To.isDayjs=Mo,To.unix=function(zo){return To(1e3*zo)},To.en=So[ko],To.Ls=So,To.p={},To})})(dayjs_min$1);var dayjs_minExports=dayjs_min$1.exports;const dayjs=getDefaultExportFromCjs$1(dayjs_minExports);var lodash$2={exports:{}};/**
|
|
7
7
|
* @license
|
|
8
8
|
* Lodash <https://lodash.com/>
|
|
9
9
|
* Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
|
|
@@ -472,7 +472,7 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
472
472
|
${ao[2]?`font-weight:${ao[2]};`:""}
|
|
473
473
|
${ao[3]?`text-align:${ao[3]};`:""}
|
|
474
474
|
${ao[4]?`color:${ao[4]};`:""}
|
|
475
|
-
`))&&attr(ue,"style",eo),(!ro||so&1&&no!==(no="spectrum-Body spectrum-Body--size"+ao[0]+" svelte-10a30y"))&&attr(ue,"class",no),(!ro||so&3)&&toggle_class(ue,"spectrum-Body--serif",ao[1])},i(ao){ro||(transition_in(io,ao),ro=!0)},o(ao){transition_out(io,ao),ro=!1},d(ao){ao&&detach(ue),io&&io.d(ao)}}}function instance$aa(to,ue,eo){let{$$slots:no={},$$scope:ro}=ue,{size:oo="M"}=ue,{serif:io=!1}=ue,{weight:ao=null}=ue,{textAlign:so=null}=ue,{color:lo=null}=ue;return to.$$set=co=>{"size"in co&&eo(0,oo=co.size),"serif"in co&&eo(1,io=co.serif),"weight"in co&&eo(2,ao=co.weight),"textAlign"in co&&eo(3,so=co.textAlign),"color"in co&&eo(4,lo=co.color),"$$scope"in co&&eo(5,ro=co.$$scope)},[oo,io,ao,so,lo,ro,no]}class Body extends SvelteComponent{constructor(ue){super(),init$3(this,ue,instance$aa,create_fragment$ad,safe_not_equal,{size:0,serif:1,weight:2,textAlign:3,color:4})}}const Heading_svelte_svelte_type_style_lang="";function create_fragment$ac(to){let ue,eo,no,ro;const oo=to[5].default,io=create_slot(oo,to,to[4],null);return{c(){ue=element("h1"),io&&io.c(),attr(ue,"data-testid","typography-heading"),attr(ue,"style",eo=to[1]?`text-align:${to[1]}`:""),attr(ue,"class",no="spectrum-Heading spectrum-Heading--size"+to[0]+" spectrum-Heading--"+to[3]+" svelte-3sm8u5"),toggle_class(ue,"noPadding",to[2])},m(ao,so){insert$2(ao,ue,so),io&&io.m(ue,null),ro=!0},p(ao,[so]){io&&io.p&&(!ro||so&16)&&update_slot_base(io,oo,ao,ao[4],ro?get_slot_changes(oo,ao[4],so,null):get_all_dirty_from_scope(ao[4]),null),(!ro||so&2&&eo!==(eo=ao[1]?`text-align:${ao[1]}`:""))&&attr(ue,"style",eo),(!ro||so&9&&no!==(no="spectrum-Heading spectrum-Heading--size"+ao[0]+" spectrum-Heading--"+ao[3]+" svelte-3sm8u5"))&&attr(ue,"class",no),(!ro||so&13)&&toggle_class(ue,"noPadding",ao[2])},i(ao){ro||(transition_in(io,ao),ro=!0)},o(ao){transition_out(io,ao),ro=!1},d(ao){ao&&detach(ue),io&&io.d(ao)}}}function instance$a9(to,ue,eo){let{$$slots:no={},$$scope:ro}=ue,{size:oo="M"}=ue,{textAlign:io=void 0}=ue,{noPadding:ao=!1}=ue,{weight:so="default"}=ue;return to.$$set=lo=>{"size"in lo&&eo(0,oo=lo.size),"textAlign"in lo&&eo(1,io=lo.textAlign),"noPadding"in lo&&eo(2,ao=lo.noPadding),"weight"in lo&&eo(3,so=lo.weight),"$$scope"in lo&&eo(4,ro=lo.$$scope)},[oo,io,ao,so,ro,no]}class Heading extends SvelteComponent{constructor(ue){super(),init$3(this,ue,instance$a9,create_fragment$ac,safe_not_equal,{size:0,textAlign:1,noPadding:2,weight:3})}}var HTTPMethod=(to=>(to.POST="POST",to.PATCH="PATCH",to.GET="GET",to.PUT="PUT",to.DELETE="DELETE",to))(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$1=(to=>(to.USERS="ta_users",to))(TableNames$1||{});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$2={ADMIN:"ADMIN",POWER:"POWER",BASIC:"BASIC",PUBLIC:"PUBLIC",BUILDER:"BUILDER",CREATOR:"CREATOR"},EventPublishType={ENV_VAR_UPGRADE_PANEL_OPENED:"environment_variable_upgrade_panel_opened"},ContextScopes$2={Local:"local",Global:"global"},TypeIconMap$1={[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(to=>`hsla(${(to+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$1={WRITABLE:"writable",READONLY:"readonly",HIDDEN:"hidden"},Constants$1=Object.freeze(Object.defineProperty({__proto__:null,ApiVersion,BannedSearchTypes,BudibaseRoleOptions,BudibaseRoleOptionsOld,BudibaseRoles,ContextScopes:ContextScopes$2,Cookies,DEFAULT_BB_DATASOURCE_ID:DEFAULT_BB_DATASOURCE_ID$1,EventPublishType,ExtendedBudibaseRoleOptions,Features:Feature,FieldPermissions:FieldPermissions$1,FilterOperator,FilterValueType,OnEmptyFilter,OperatorOptions,OptionColours,PlanType,Roles:Roles$2,SqlNumberTypeRangeMap,TableNames:TableNames$1,TypeIconMap:TypeIconMap$1},Symbol.toStringTag,{value:"Module"})),buildAnalyticsEndpoints=to=>({getAnalyticsStatus:async()=>await to.get({url:"/api/bbtel"}),analyticsPing:async ue=>await to.post({url:"/api/bbtel/ping",body:{...ue,timezone:Intl.DateTimeFormat().resolvedOptions().timeZone}})}),buildAIEndpoints=to=>({generateCronExpression:async ue=>await to.post({url:"/api/ai/cron",body:{prompt:ue}})}),buildAppEndpoints=to=>({fetchAppPackage:async ue=>await to.get({url:`/api/applications/${ue}/appPackage`}),saveAppMetadata:async(ue,eo)=>await to.put({url:`/api/applications/${ue}`,body:eo}),publishAppChanges:async ue=>await to.post({url:`/api/applications/${ue}/publish`}),revertAppChanges:async ue=>await to.post({url:`/api/dev/${ue}/revert`}),updateAppClientVersion:async ue=>await to.post({url:`/api/applications/${ue}/client/update`}),revertAppClientVersion:async ue=>await to.post({url:`/api/applications/${ue}/client/revert`}),getAppDeployments:async()=>await to.get({url:"/api/deployments"}),createApp:async ue=>await to.post({url:"/api/applications",body:ue,json:!1}),duplicateApp:async(ue,eo)=>await to.post({url:`/api/applications/${ue}/duplicate`,body:eo,json:!1}),updateAppFromExport:async(ue,eo)=>{const no=getDevAppID(ue);return await to.post({url:`/api/applications/${no}/import`,body:eo,json:!1})},importApps:async ue=>await to.post({url:"/api/cloud/import",body:ue,json:!1}),unpublishApp:async ue=>await to.post({url:`/api/applications/${ue}/unpublish`}),deleteApp:async ue=>await to.delete({url:`/api/applications/${ue}`}),releaseAppLock:async ue=>await to.delete({url:`/api/dev/${ue}/lock`}),fetchSystemDebugInfo:async()=>await to.get({url:"/api/debug/diagnostics"}),syncApp:async ue=>await to.post({url:`/api/applications/${ue}/sync`}),getApps:async()=>await to.get({url:"/api/applications?status=all"}),fetchComponentLibDefinitions:async ue=>await to.get({url:`/api/${ue}/components/definitions`}),addSampleData:async ue=>await to.post({url:`/api/applications/${ue}/sample`}),setRevertableVersion:async(ue,eo)=>await to.post({url:`/api/applications/${ue}/setRevertableVersion`,body:{revertableVersion:eo}})}),buildAttachmentEndpoints=to=>{const ue={getSignedDatasourceURL:async(eo,no,ro)=>await to.post({url:`/api/attachments/${eo}/url`,body:{bucket:no,key:ro}})};return{...ue,uploadAttachment:async(eo,no)=>await to.post({url:`/api/attachments/${eo}/upload`,body:no,json:!1}),uploadBuilderAttachment:async eo=>await to.post({url:"/api/attachments/process",body:eo,json:!1}),externalUpload:async(eo,no,ro,oo)=>{const{signedUrl:io,publicUrl:ao}=await ue.getSignedDatasourceURL(eo,no,ro);return io?(await to.put({url:io,body:oo,json:!1,external:!0,parseResponse:so=>so}),{publicUrl:ao}):{publicUrl:void 0}},downloadAttachment:async(eo,no,ro)=>await to.get({url:`/api/${eo}/rows/${no}/attachment/${ro}`,parseResponse:oo=>oo,suppressErrors:!0})}},buildAuthEndpoints=to=>({logIn:async(ue,eo,no)=>await to.post({url:`/api/global/auth/${ue}/login`,body:{username:eo,password:no}}),logOut:async()=>await to.post({url:"/api/global/auth/logout"}),setInitInfo:async ue=>await to.post({url:"/api/global/auth/init",body:ue}),getInitInfo:async()=>await to.get({url:"/api/global/auth/init"}),requestForgotPassword:async(ue,eo)=>await to.post({url:`/api/global/auth/${ue}/reset`,body:{email:eo}}),resetPassword:async(ue,eo,no)=>await to.post({url:`/api/global/auth/${ue}/reset/update`,body:{password:eo,resetCode:no}})}),buildAutomationEndpoints=to=>({triggerAutomation:async(ue,eo,no)=>await to.post({url:`/api/automations/${ue}/trigger`,body:{fields:eo,timeout:no}}),testAutomation:async(ue,eo)=>await to.post({url:`/api/automations/${ue}/test`,body:eo}),getAutomations:async()=>await to.get({url:"/api/automations"}),getAutomationDefinitions:async()=>await to.get({url:"/api/automations/definitions/list"}),createAutomation:async ue=>await to.post({url:"/api/automations",body:ue}),updateAutomation:async ue=>await to.put({url:"/api/automations",body:ue}),deleteAutomation:async(ue,eo)=>await to.delete({url:`/api/automations/${ue}/${eo}`}),getAutomationLogs:async ue=>await to.post({url:"/api/automations/logs/search",body:ue}),clearAutomationLogErrors:async(ue,eo)=>await to.delete({url:"/api/automations/logs",body:{appId:eo,automationId:ue}})}),buildConfigEndpoints=to=>({saveConfig:async ue=>await to.post({url:"/api/global/configs",body:ue}),getConfig:async ue=>await to.get({url:`/api/global/configs/${ue}`}),deleteConfig:async(ue,eo)=>await to.delete({url:`/api/global/configs/${ue}/${eo}`}),getTenantConfig:async ue=>await to.get({url:`/api/global/configs/public?tenantId=${ue}`}),getOIDCConfigs:async ue=>await to.get({url:`/api/global/configs/public/oidc?tenantId=${ue}`}),getChecklist:async ue=>await to.get({url:`/api/global/configs/checklist?tenantId=${ue}`}),uploadLogo:async ue=>await to.post({url:"/api/global/configs/upload/settings/logoUrl",body:ue,json:!1}),uploadFavicon:async ue=>await to.post({url:"/api/global/configs/upload/settings/faviconUrl",body:ue,json:!1}),uploadOIDCLogo:async(ue,eo)=>await to.post({url:`/api/global/configs/upload/logos_oidc/${ue}`,body:eo,json:!1}),getOIDCLogos:async()=>await to.get({url:"/api/global/configs/logos_oidc"})}),buildDatasourceEndpoints=to=>({getDatasources:async()=>await to.get({url:"/api/datasources"}),buildDatasourceSchema:async(ue,eo)=>await to.post({url:`/api/datasources/${ue}/schema`,body:{tablesFilter:eo}}),createDatasource:async ue=>await to.post({url:"/api/datasources",body:ue}),updateDatasource:async ue=>await to.put({url:`/api/datasources/${ue._id}`,body:ue}),deleteDatasource:async(ue,eo)=>await to.delete({url:`/api/datasources/${ue}/${eo}`}),validateDatasource:async ue=>await to.post({url:"/api/datasources/verify",body:{datasource:ue}}),fetchInfoForDatasource:async ue=>await to.post({url:"/api/datasources/info",body:{datasource:ue}}),fetchExternalSchema:async ue=>await to.get({url:`/api/datasources/${ue}/schema/external`})}),buildFlagEndpoints=to=>({getFlags:async()=>await to.get({url:"/api/users/flags"}),updateFlag:async(ue,eo)=>await to.post({url:"/api/users/flags",body:{flag:ue,value:eo}}),toggleUiFeature:async ue=>await to.post({url:`/api/beta/${ue}`})}),buildLayoutEndpoints=to=>({saveLayout:async ue=>await to.post({url:"/api/layouts",body:ue}),deleteLayout:async(ue,eo)=>await to.delete({url:`/api/layouts/${ue}/${eo}`})}),buildOtherEndpoints=to=>({getEnvironment:async()=>await to.get({url:"/api/system/environment"}),getSystemStatus:async()=>await to.get({url:"/api/system/status"}),getIntegrations:async()=>await to.get({url:"/api/integrations"}),getBudibaseVersion:async()=>(await to.get({url:"/api/dev/version"})).version,getBasePermissions:async()=>await to.get({url:"/api/permission/builtin"})}),buildPermissionsEndpoints=to=>({getPermissionForResource:async ue=>await to.get({url:`/api/permission/${ue}`}),updatePermissionForResource:async(ue,eo,no)=>await to.post({url:`/api/permission/${eo}/${ue}/${no}`}),removePermissionFromResource:async(ue,eo,no)=>await to.delete({url:`/api/permission/${eo}/${ue}/${no}`}),getDependants:async ue=>await to.get({url:`/api/permission/${ue}/dependants`})}),buildQueryEndpoints=to=>({executeQuery:async(ue,{pagination:eo,parameters:no}={})=>await to.post({url:`/api/v2/queries/${ue}`,body:{parameters:no,pagination:eo}}),fetchQueryDefinition:async ue=>await to.get({url:`/api/queries/${ue}`,cache:!0}),getQueries:async()=>await to.get({url:"/api/queries"}),saveQuery:async ue=>await to.post({url:"/api/queries",body:ue}),deleteQuery:async(ue,eo)=>await to.delete({url:`/api/queries/${ue}/${eo}`}),importQueries:async ue=>await to.post({url:"/api/queries/import",body:ue}),previewQuery:async ue=>await to.post({url:"/api/queries/preview",body:ue})}),buildRelationshipEndpoints=to=>({fetchRelationshipData:async(ue,eo,no)=>{const ro=await to.get({url:`/api/${ue}/${eo}/enrich?field=${no}`});return no?ro[no]||[]:[ro]}}),buildRoleEndpoints=to=>({deleteRole:async(ue,eo)=>await to.delete({url:`/api/roles/${ue}/${eo}`}),saveRole:async ue=>await to.post({url:"/api/roles",body:ue}),getRoles:async()=>await to.get({url:"/api/roles"}),getRolesForApp:async ue=>await to.get({url:`/api/global/roles/${ue}`}),getAccessibleRoles:async()=>await to.get({url:"/api/roles/accessible"})}),buildRouteEndpoints=to=>({fetchClientAppRoutes:async()=>await to.get({url:"/api/routing/client"}),fetchAppRoutes:async()=>await to.get({url:"/api/routing"})}),buildRowEndpoints=to=>({fetchRow:async(ue,eo)=>await to.get({url:`/api/${ue}/rows/${eo}`}),saveRow:async(ue,eo=!1)=>{const no=ue._viewId||ue.tableId;return await to.post({url:`/api/${no}/rows`,body:ue,suppressErrors:eo})},patchRow:async(ue,eo=!1)=>{const no=ue._viewId||ue.tableId;return await to.patch({url:`/api/${no}/rows`,body:ue,suppressErrors:eo})},deleteRow:async(ue,eo)=>await to.delete({url:`/api/${ue}/rows`,body:{_id:eo}}),deleteRows:async(ue,eo)=>(eo.forEach(no=>{typeof no=="object"&&(no==null||delete no._viewId)}),await to.delete({url:`/api/${ue}/rows`,body:{rows:eo}})),exportRows:async(ue,eo,no)=>await to.post({url:`/api/${ue}/rows/exportRows?format=${eo}`,body:no,parseResponse:async ro=>await ro.text()})}),buildScreenEndpoints=to=>({saveScreen:async ue=>await to.post({url:"/api/screens",body:ue}),deleteScreen:async(ue,eo)=>await to.delete({url:`/api/screens/${ue}/${eo}`}),usageInScreens:async ue=>await to.post({url:`/api/screens/usage/${ue}`})}),buildTableEndpoints=to=>({fetchTableDefinition:async ue=>await to.get({url:`/api/tables/${ue}`,cache:!0}),fetchTableData:async ue=>await to.get({url:`/api/${ue}/rows`}),searchTable:async(ue,eo)=>await to.post({url:`/api/${ue}/search`,body:eo}),importTableData:async(ue,eo,no)=>await to.post({url:`/api/tables/${ue}/import`,body:{rows:eo,identifierFields:no}}),csvToJson:async ue=>await to.post({url:"/api/convert/csvToJson",body:{csvString:ue}}),getTables:async()=>await to.get({url:"/api/tables"}),getTable:async ue=>await to.get({url:`/api/tables/${ue}`}),saveTable:async ue=>await to.post({url:"/api/tables",body:ue}),deleteTable:async(ue,eo)=>await to.delete({url:`/api/tables/${ue}/${eo}`}),validateNewTableImport:async(ue,eo)=>await to.post({url:"/api/tables/validateNewTableImport",body:{rows:ue,schema:eo}}),validateExistingTableImport:async(ue,eo)=>await to.post({url:"/api/tables/validateExistingTableImport",body:{rows:ue,tableId:eo}}),migrateColumn:async(ue,eo,no)=>await to.post({url:`/api/tables/${ue}/migrate`,body:{oldColumn:eo,newColumn:no}})}),buildTemplateEndpoints=to=>({getEmailTemplateDefinitions:async()=>await to.get({url:"/api/global/template/definitions"}),getEmailTemplates:async()=>await to.get({url:"/api/global/template/email"}),saveEmailTemplate:async ue=>await to.post({url:"/api/global/template",body:ue}),getAppTemplates:async()=>await to.get({url:"/api/templates"})}),buildUserEndpoints=to=>({getUsers:async()=>await to.get({url:"/api/global/users"}),searchUsers:async ue=>await to.post({url:"/api/global/users/search",body:ue}),getUser:async ue=>await to.get({url:`/api/global/users/${ue}`}),updateOwnMetadata:async ue=>await to.post({url:"/api/users/metadata/self",body:ue}),createAdminUser:async ue=>await to.post({url:"/api/global/users/init",body:ue}),saveUser:async ue=>await to.post({url:"/api/global/users",body:ue}),createUsers:async(ue,eo)=>(await to.post({url:"/api/global/users/bulk",body:{create:{users:ue,groups:eo}}})).created,deleteUser:async ue=>await to.delete({url:`/api/global/users/${ue}`}),deleteUsers:async ue=>(await to.post({url:"/api/global/users/bulk",body:{delete:{users:ue}}})).deleted,onboardUsers:async ue=>await to.post({url:"/api/global/users/onboard",body:ue}),updateUserInvite:async(ue,eo)=>await to.post({url:`/api/global/users/invite/update/${ue}`,body:eo}),getUserInvite:async ue=>await to.get({url:`/api/global/users/invite/${ue}`}),getUserInvites:async()=>await to.get({url:"/api/global/users/invites"}),inviteUsers:async ue=>await to.post({url:"/api/global/users/multi/invite",body:ue}),removeUserInvites:async ue=>await to.post({url:"/api/global/users/multi/invite/delete",body:ue}),acceptInvite:async ue=>await to.post({url:"/api/global/users/invite/accept",body:ue}),getUserCountByApp:async ue=>(await to.get({url:`/api/global/users/count/${ue}`})).userCount,addAppBuilder:async(ue,eo)=>await to.post({url:`/api/global/users/${ue}/app/${eo}/builder`}),removeAppBuilder:async(ue,eo)=>await to.delete({url:`/api/global/users/${ue}/app/${eo}/builder`}),getAccountHolder:async()=>await to.get({url:"/api/global/users/accountholder"})}),buildSelfEndpoints=to=>({generateAPIKey:async()=>{const ue=await to.post({url:"/api/global/self/api_key"});return ue==null?void 0:ue.apiKey},fetchDeveloperInfo:async()=>to.get({url:"/api/global/self/api_key"}),fetchSelf:async()=>await to.get({url:"/api/self"}),fetchBuilderSelf:async()=>await to.get({url:"/api/global/self"}),updateSelf:async ue=>await to.post({url:"/api/global/self",body:ue})}),buildViewEndpoints=to=>({fetchViewData:async(ue,{field:eo,groupBy:no,calculation:ro})=>{const oo=new URLSearchParams;ro&&(eo&&oo.set("field",eo),oo.set("calculation",ro)),no&&oo.set("group",no);const io=eo?`/api/views/${encodeURIComponent(ue)}?${oo}`:`/api/views/${encodeURIComponent(ue)}`;return await to.get({url:io})},exportView:async(ue,eo)=>{const no=encodeURIComponent(ue);return await to.get({url:`/api/views/export?view=${no}&format=${eo}`,parseResponse:async ro=>await ro.text()})},saveView:async ue=>await to.post({url:"/api/views",body:ue}),deleteView:async ue=>await to.delete({url:`/api/views/${encodeURIComponent(ue)}`})}),buildViewV2Endpoints=to=>({fetchDefinition:async ue=>await to.get({url:`/api/v2/views/${encodeURIComponent(ue)}`,cache:!0}),create:async ue=>await to.post({url:"/api/v2/views",body:ue}),update:async ue=>await to.put({url:`/api/v2/views/${encodeURIComponent(ue.id)}`,body:ue}),fetch:async(ue,eo)=>await to.post({url:`/api/v2/views/${encodeURIComponent(ue)}/search`,body:eo}),delete:async ue=>await to.delete({url:`/api/v2/views/${encodeURIComponent(ue)}`})}),buildLicensingEndpoints=to=>({activateLicenseKey:async ue=>to.post({url:"/api/global/license/key",body:{licenseKey:ue}}),deleteLicenseKey:async()=>to.delete({url:"/api/global/license/key"}),getLicenseKey:async()=>{try{return await to.get({url:"/api/global/license/key"})}catch(ue){if(ue.status!==404)throw ue}},activateOfflineLicense:async ue=>to.post({url:"/api/global/license/offline",body:{offlineLicenseToken:ue}}),deleteOfflineLicense:async()=>to.delete({url:"/api/global/license/offline"}),getOfflineLicense:async()=>{try{return await to.get({url:"/api/global/license/offline"})}catch(ue){if(ue.status!==404)throw ue}},getOfflineLicenseIdentifier:async()=>await to.get({url:"/api/global/license/offline/identifier"}),refreshLicense:async()=>to.post({url:"/api/global/license/refresh"}),getQuotaUsage:async()=>to.get({url:"/api/global/license/usage"})}),buildGroupsEndpoints=to=>{async function ue(eo,no,ro,oo){return await to.post({url:`/api/global/groups/${eo}/${no}`,body:{[ro]:oo}})}return{saveGroup:async eo=>await to.post({url:"/api/global/groups",body:eo}),getGroups:async()=>(await to.get({url:"/api/global/groups"})).data,getGroup:async eo=>await to.get({url:`/api/global/groups/${eo}`}),deleteGroup:async(eo,no)=>await to.delete({url:`/api/global/groups/${eo}/${no}`}),getGroupUsers:async({id:eo,bookmark:no,emailSearch:ro})=>{let oo=`/api/global/groups/${eo}/users?`;return no&&(oo+=`bookmark=${no}&`),ro&&(oo+=`emailSearch=${ro}`),await to.get({url:oo})},addUsersToGroup:async(eo,no)=>ue(eo,"users","add",no),removeUsersFromGroup:async(eo,no)=>ue(eo,"users","remove",no),addAppsToGroup:async(eo,no)=>ue(eo,"apps","add",no),removeAppsFromGroup:async(eo,no)=>ue(eo,"apps","remove",no),addGroupAppBuilder:async(eo,no)=>await to.post({url:`/api/global/groups/${eo}/app/${no}/builder`}),removeGroupAppBuilder:async(eo,no)=>await to.delete({url:`/api/global/groups/${eo}/app/${no}/builder`})}},buildPluginEndpoints=to=>({uploadPlugin:async ue=>await to.post({url:"/api/plugin/upload",body:ue,json:!1}),createPlugin:async ue=>await to.post({url:"/api/plugin",body:ue}),getPlugins:async()=>await to.get({url:"/api/plugin"}),deletePlugin:async ue=>await to.delete({url:`/api/plugin/${ue}`})}),buildBackupEndpoints=to=>({createManualBackup:async ue=>await to.post({url:`/api/apps/${ue}/backups`}),searchBackups:async(ue,eo)=>await to.post({url:`/api/apps/${ue}/backups/search`,body:eo}),deleteBackup:async(ue,eo)=>await to.delete({url:`/api/apps/${ue}/backups/${eo}`}),restoreBackup:async(ue,eo,no)=>await to.post({url:`/api/apps/${ue}/backups/${eo}/import`,body:{name:no}})}),buildEnvironmentVariableEndpoints=to=>({checkEnvironmentVariableStatus:async()=>await to.get({url:"/api/env/variables/status"}),fetchEnvironmentVariables:async()=>await to.get({url:"/api/env/variables",json:!1}),createEnvironmentVariable:async ue=>await to.post({url:"/api/env/variables",body:ue}),deleteEnvironmentVariable:async ue=>await to.delete({url:`/api/env/variables/${ue}`}),updateEnvironmentVariable:async(ue,eo)=>await to.patch({url:`/api/env/variables/${ue}`,body:eo})}),buildEventEndpoints=to=>({publishEvent:async ue=>await to.post({url:"/api/global/event/publish",body:{type:ue}})}),buildAuditLogEndpoints=to=>({searchAuditLogs:async ue=>await to.post({url:"/api/global/auditlogs/search",body:ue}),getEventDefinitions:async()=>await to.get({url:"/api/global/auditlogs/definitions"}),getDownloadUrl:ue=>`/api/global/auditlogs/download?query=${encodeURIComponent(JSON.stringify(ue))}`}),buildLogsEndpoints=to=>({getSystemLogs:async()=>await to.get({url:"/api/system/logs",json:!1,parseResponse:async ue=>ue})}),buildMigrationEndpoints=to=>({getMigrationStatus:async()=>await to.get({url:"/api/migrations/status"})}),buildRowActionEndpoints=to=>({fetch:async ue=>(await to.get({url:`/api/tables/${ue}/actions`})).actions,create:async(ue,eo)=>await to.post({url:`/api/tables/${ue}/actions`,body:{name:eo}}),delete:async(ue,eo)=>await to.delete({url:`/api/tables/${ue}/actions/${eo}`}),enableView:async(ue,eo,no)=>await to.post({url:`/api/tables/${ue}/actions/${eo}/permissions/${no}`}),disableView:async(ue,eo,no)=>await to.delete({url:`/api/tables/${ue}/actions/${eo}/permissions/${no}`}),trigger:async(ue,eo,no)=>await to.post({url:`/api/tables/${ue}/actions/${eo}/trigger`,body:{rowId:no}})}),APISessionID=uuid$2(),createAPIClient=(to={})=>{let ue={};const eo=async(lo,co,uo=!1)=>{let fo=lo.statusText,po=null;try{po=await lo.json(),po!=null&&po.message?fo=po.message:po!=null&&po.error&&(fo=JSON.stringify(po.error))}catch{}return{message:fo,json:po,status:lo.status,url:lo.url,method:co,handled:!0,suppressErrors:uo}},no=(lo,co,uo)=>({message:lo,json:null,status:400,url:co,method:uo,handled:!0,suppressErrors:!1}),ro=async lo=>{let{json:co,method:uo,external:fo,body:po,url:ho,parseResponse:_o,suppressErrors:go}=lo;co=co&&uo!==HTTPMethod.GET;let bo={Accept:"application/json"};bo[Header$1.SESSION_ID]=APISessionID,fo||(bo[Header$1.API_VER]=ApiVersion),co&&(bo["Content-Type"]="application/json"),to!=null&&to.attachHeaders&&to.attachHeaders(bo);let vo=po;if(co)try{vo=JSON.stringify(po)}catch{throw no("Invalid JSON body",ho,uo)}let yo;try{yo=await fetch(ho,{method:uo,headers:bo,body:vo,credentials:"same-origin"})}catch{throw delete ue[ho],no("Failed to send request",ho,uo)}if(yo.status>=200&&yo.status<400){oo(yo);try{return yo.status===204?void 0:_o?await _o(yo):await yo.json()}catch($o){throw delete ue[ho],`Failed to parse response: ${$o}`}}else throw delete ue[ho],await eo(yo,uo,go)},oo=lo=>{if(!to.onMigrationDetected)return;const co=lo.headers.get(Header$1.MIGRATING_APP);co&&to.onMigrationDetected(co)},io=async lo=>{const co=lo.url;return ue[co]||(ue[co]=ro(lo),ue[co]=await ue[co]),await ue[co]},ao=lo=>async co=>{try{let uo={json:!0,external:!1,suppressErrors:!1,cache:!1,method:lo,...co},{url:fo,cache:po,external:ho}=uo;return ho||(uo.url=`/${fo}`.replace("//","/")),await(po&&(to==null?void 0:to.enableCaching)?io:ro)(uo)}catch(uo){throw to!=null&&to.onError&&to.onError(uo),uo}};let so={post:ao(HTTPMethod.POST),get:ao(HTTPMethod.GET),patch:ao(HTTPMethod.PATCH),delete:ao(HTTPMethod.DELETE),put:ao(HTTPMethod.PUT),invalidateCache:()=>{ue={}},getAppID:()=>{var co;let lo={};return(co=to==null?void 0:to.attachHeaders)==null||co.call(to,lo),lo==null?void 0:lo[Header$1.APP_ID]}};return{...so,...buildAIEndpoints(so),...buildAnalyticsEndpoints(so),...buildAppEndpoints(so),...buildAttachmentEndpoints(so),...buildAuthEndpoints(so),...buildAutomationEndpoints(so),...buildConfigEndpoints(so),...buildDatasourceEndpoints(so),...buildFlagEndpoints(so),...buildLayoutEndpoints(so),...buildOtherEndpoints(so),...buildPermissionsEndpoints(so),...buildQueryEndpoints(so),...buildRelationshipEndpoints(so),...buildRoleEndpoints(so),...buildRouteEndpoints(so),...buildRowEndpoints(so),...buildScreenEndpoints(so),...buildTableEndpoints(so),...buildTemplateEndpoints(so),...buildUserEndpoints(so),...buildViewEndpoints(so),...buildSelfEndpoints(so),...buildLicensingEndpoints(so),...buildGroupsEndpoints(so),...buildPluginEndpoints(so),...buildBackupEndpoints(so),...buildEnvironmentVariableEndpoints(so),...buildEventEndpoints(so),...buildAuditLogEndpoints(so),...buildLogsEndpoints(so),...buildMigrationEndpoints(so),viewV2:buildViewV2Endpoints(so),rowActions:buildRowActionEndpoints(so)}},getJSONArrayDatasourceSchema=(to,ue)=>{let eo=to,no=[];ue.prefixKeys&&(no=ue.prefixKeys.concat(["schema"])),no=no.concat(ue.label.split(".").slice(2));for(let ro=0;ro<no.length;ro++)eo=eo==null?void 0:eo[no[ro]],eo!=null&&eo.schema&&(eo=eo.schema);return convertJSONSchemaToTableSchema(eo,{squashObjects:!0,prefixKeys:no})},convertJSONSchemaToTableSchema=(to,ue)=>{if(!to)return null;ue={squashObjects:!1,prefixKeys:null,...ue},to.schema?to=to.schema:to={value:to};const eo=extractJSONSchemaKeys(to,ue.squashObjects);let no={};return eo.forEach(({key:ro,type:oo})=>{no[ro]={type:oo,name:ro,prefixKeys:ue.prefixKeys}}),no},extractJSONSchemaKeys=(to,ue=!1)=>{if(!to||!Object.keys(to).length)return[];let eo=[];return Object.keys(to).forEach(no=>{const ro=to[no].type;if(ro==="json"&&ue){const oo=extractJSONSchemaKeys(to[no].schema,ue);eo=eo.concat(oo.map(io=>({key:`${no}.${io.key}`,type:io.type})))}else eo.push({key:no,type:ro==="array"?"jsonarray":ro})}),eo},generateQueryArraySchemas=(to,ue)=>{var eo,no;for(let ro in to)((eo=to[ro])==null?void 0:eo.type)==="json"&&((no=to[ro])==null?void 0:no.subtype)==="array"&&hasSchema(ue[ro])&&(to[ro]={schema:{schema:Object.entries(ue[ro]||{}).reduce((oo,[io,ao])=>(oo[io]={name:io,type:ao.type,subtype:ao.subtype},oo),{}),type:"json"},type:"json",subtype:"array"});return to};function setCookie(to,ue,eo){getCookie(to)&&removeCookie(to);let no=`${to}=${ue}; Path=/;`;eo&&(no+=` Domain=${eo};`),window.document.cookie=no}function getCookie(to){const eo=`; ${document.cookie}`.split(`; ${to}=`);if(eo.length===2)return eo[1].split(";").shift()}function removeCookie(to){getCookie(to)&&(document.cookie=`${to}=; Max-Age=-99999999; Path=/;`)}const RolePriorities={[Roles$2.ADMIN]:5,[Roles$2.CREATOR]:4,[Roles$2.POWER]:3,[Roles$2.BASIC]:2,[Roles$2.PUBLIC]:1},getRolePriority=to=>RolePriorities[to]??0,sleep$2=to=>new Promise(ue=>setTimeout(ue,to)),sequential=to=>{let ue=[];return(...no)=>new Promise((ro,oo)=>{ue.push(async()=>{let io,ao;try{io=await to(...no)}catch(so){ao=so}ue.shift(),ue.length&&ue[0](),ao?oo(ao):ro(io)}),ue.length===1&&ue[0]()})},debounce=(to,ue=1e3)=>{let eo;return async(...no)=>new Promise(ro=>{eo&&clearTimeout(eo),eo=setTimeout(async()=>{ro(await to(...no))},ue)})},domDebounce=to=>{let ue=!1,eo;return(...no)=>{eo=no,ue||(ue=!0,requestAnimationFrame(()=>{to(...eo),ue=!1}))}},buildFormBlockButtonConfig=to=>{const{_id:ue,actionType:eo,dataSource:no,notificationOverride:ro,actionUrl:oo,showDeleteButton:io,deleteButtonLabel:ao,showSaveButton:so,saveButtonLabel:lo}=to||{};if(!ue)return;const co=`${ue}-form`,uo=`${ue}-repeater`,fo=no==null?void 0:no.resourceId,po=io===!1?"":ao==null?void 0:ao.trim(),ho=so===!1?"":lo==null?void 0:lo.trim(),_o=[{"##eventHandlerType":"Validate Form",parameters:{componentId:co}},{"##eventHandlerType":"Save Row",parameters:{providerId:co,tableId:fo,notificationOverride:ro,confirm:null}},{"##eventHandlerType":"Close Screen Modal"},{"##eventHandlerType":"Close Side Panel"},{"##eventHandlerType":"Close Modal"},...eo!=="Create"?[]:[{"##eventHandlerType":"Clear Form",parameters:{componentId:co}}],...oo?[{"##eventHandlerType":"Navigate To",parameters:{url:oo}}]:[]],go=[{"##eventHandlerType":"Delete Row",parameters:{confirm:!0,tableId:fo,rowId:`{{ ${makePropSafe(uo)}.${makePropSafe("_id")} }}`,revId:`{{ ${makePropSafe(uo)}.${makePropSafe("_rev")} }}`,notificationOverride:ro}},{"##eventHandlerType":"Close Screen Modal"},{"##eventHandlerType":"Close Side Panel"},{"##eventHandlerType":"Close Modal"},...oo?[{"##eventHandlerType":"Navigate To",parameters:{url:oo}}]:[]],bo=[];return eo&&["Update","Create"].includes(eo)&&so!==!1&&bo.push({text:ho||"Save",_id:uuid$2(),_component:"@budibase/standard-components/button",onClick:_o,type:"cta"}),eo==="Update"&&io!==!1&&bo.push({text:po||"Delete",_id:uuid$2(),_component:"@budibase/standard-components/button",onClick:go,quiet:!0,type:"warning"}),bo},buildMultiStepFormBlockDefaultProps=to=>{const{_id:ue,stepCount:eo,currentStep:no,actionType:ro,dataSource:oo}=to||{};if(!ue||!eo)return;const io=`Step {{ [${ue}-form].[__currentStep] }}`,ao=oo==null?void 0:oo.resourceId,so=`${ue}-form`;let lo=[];return no!==0&&lo.push({_id:uuid$2(),_component:"@budibase/standard-components/button",_instanceName:uuid$2(),text:"Back",type:"secondary",size:"M",onClick:[{parameters:{type:"prev",componentId:so},"##eventHandlerType":"Change Form Step"}]}),no!==eo-1&&lo.push({_id:uuid$2(),_component:"@budibase/standard-components/button",_instanceName:uuid$2(),text:"Next",type:"cta",size:"M",onClick:[{"##eventHandlerType":"Validate Form",parameters:{componentId:so}},{parameters:{type:"next",componentId:so},"##eventHandlerType":"Change Form Step"}]}),ro!=="View"&&no===eo-1&&lo.push({_id:uuid$2(),_component:"@budibase/standard-components/button",_instanceName:uuid$2(),text:"Save",type:"cta",size:"M",onClick:[{"##eventHandlerType":"Validate Form",parameters:{componentId:so}},{"##eventHandlerType":"Save Row",parameters:{tableId:ao,providerId:so}},...ro!=="Create"?[]:[{"##eventHandlerType":"Clear Form",parameters:{componentId:so}}]]}),{buttons:lo,title:io}};function parseFilter(to){var eo;if(!(to!=null&&to.groups))return to;const ue=lodashExports.cloneDeep(to);return ue.groups=(eo=ue.groups)==null?void 0:eo.map(no=>{var ro,oo;return no.filters=(ro=no.filters)==null?void 0:ro.filter(io=>io.field&&io.operator),(oo=no.filters)!=null&&oo.length?no:null}).filter(no=>!!no),ue}const isBetterSample=(to,ue)=>{if(ue==null&&to!=null)return!0;if(ue!=null&&to==null)return!1;const eo=typeof ue,no=typeof to;return eo!==no?!1:no==="string"&&to.length>ue.length||no==="object"&&Object.keys(to).length>Object.keys(ue).length},generateGoldenSample=to=>{let ue={};return to==null||to.slice(0,100).forEach(eo=>{Object.keys(eo).forEach(no=>{isBetterSample(eo[no],ue[no])&&(ue[no]=eo[no])})}),ue};function getTableFields(to,ue){const eo=to.find(ro=>ro._id===ue.tableId);return!eo||!eo.sql?[]:getFields(to,Object.values(eo.schema),{allowLinks:!1}).map(ro=>({...ro,name:`${ue.name}.${ro.name}`}))}function getFields(to,ue,{allowLinks:eo}={allowLinks:!0}){let no=ue.filter(oo=>!BannedSearchTypes.includes(oo.type));if(eo){const oo=ue.filter(io=>io.type==="link");for(let io of oo)no=no.concat(getTableFields(to,io))}const ro=ue.filter(oo=>oo.type==="formula"&&oo.formulaType==="static");return no.concat(ro)}const getColumnIcon=to=>{if(to.schema.icon)return to.schema.icon;if(to.calculationType)return"Calculator";if(to.schema.autocolumn)return"MagicWand";if(isDeprecatedSingleUserColumn(to.schema))return"User";const{type:ue,subtype:eo}=to.schema;return(typeof TypeIconMap$1[ue]=="object"&&eo?TypeIconMap$1[ue][eo]:TypeIconMap$1[ue])||"Text"},memo=to=>{const ue=writable(to);let eo=JSON.stringify(to);const no=ro=>{const oo=JSON.stringify(ro);oo!==eo&&(ue.set(ro),eo=oo)};return{subscribe:ue.subscribe,set:no,update:ro=>{let oo=JSON.parse(eo);const io=ro(oo);no(io)}}},derivedMemo=(to,ue)=>{const eo=derived(to,ue),no=memo(get_store_value(eo));return eo.subscribe(no.set),no},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(to=>{PACKET_TYPES_REVERSE[PACKET_TYPES[to]]=to});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=to=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(to):to&&to.buffer instanceof ArrayBuffer,encodePacket=({type:to,data:ue},eo,no)=>withNativeBlob$1&&ue instanceof Blob?eo?no(ue):encodeBlobAsBase64(ue,no):withNativeArrayBuffer$2&&(ue instanceof ArrayBuffer||isView$1(ue))?eo?no(ue):encodeBlobAsBase64(new Blob([ue]),no):no(PACKET_TYPES[to]+(ue||"")),encodeBlobAsBase64=(to,ue)=>{const eo=new FileReader;return eo.onload=function(){const no=eo.result.split(",")[1];ue("b"+(no||""))},eo.readAsDataURL(to)};function toArray$2(to){return to instanceof Uint8Array?to:to instanceof ArrayBuffer?new Uint8Array(to):new Uint8Array(to.buffer,to.byteOffset,to.byteLength)}let TEXT_ENCODER;function encodePacketToBinary(to,ue){if(withNativeBlob$1&&to.data instanceof Blob)return to.data.arrayBuffer().then(toArray$2).then(ue);if(withNativeArrayBuffer$2&&(to.data instanceof ArrayBuffer||isView$1(to.data)))return ue(toArray$2(to.data));encodePacket(to,!1,eo=>{TEXT_ENCODER||(TEXT_ENCODER=new TextEncoder),ue(TEXT_ENCODER.encode(eo))})}const chars="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",lookup$2=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let to=0;to<chars.length;to++)lookup$2[chars.charCodeAt(to)]=to;const decode$3=to=>{let ue=to.length*.75,eo=to.length,no,ro=0,oo,io,ao,so;to[to.length-1]==="="&&(ue--,to[to.length-2]==="="&&ue--);const lo=new ArrayBuffer(ue),co=new Uint8Array(lo);for(no=0;no<eo;no+=4)oo=lookup$2[to.charCodeAt(no)],io=lookup$2[to.charCodeAt(no+1)],ao=lookup$2[to.charCodeAt(no+2)],so=lookup$2[to.charCodeAt(no+3)],co[ro++]=oo<<2|io>>4,co[ro++]=(io&15)<<4|ao>>2,co[ro++]=(ao&3)<<6|so&63;return lo},withNativeArrayBuffer$1=typeof ArrayBuffer=="function",decodePacket=(to,ue)=>{if(typeof to!="string")return{type:"message",data:mapBinary(to,ue)};const eo=to.charAt(0);return eo==="b"?{type:"message",data:decodeBase64Packet(to.substring(1),ue)}:PACKET_TYPES_REVERSE[eo]?to.length>1?{type:PACKET_TYPES_REVERSE[eo],data:to.substring(1)}:{type:PACKET_TYPES_REVERSE[eo]}:ERROR_PACKET},decodeBase64Packet=(to,ue)=>{if(withNativeArrayBuffer$1){const eo=decode$3(to);return mapBinary(eo,ue)}else return{base64:!0,data:to}},mapBinary=(to,ue)=>{switch(ue){case"blob":return to instanceof Blob?to:new Blob([to]);case"arraybuffer":default:return to instanceof ArrayBuffer?to:to.buffer}},SEPARATOR=String.fromCharCode(30),encodePayload=(to,ue)=>{const eo=to.length,no=new Array(eo);let ro=0;to.forEach((oo,io)=>{encodePacket(oo,!1,ao=>{no[io]=ao,++ro===eo&&ue(no.join(SEPARATOR))})})},decodePayload=(to,ue)=>{const eo=to.split(SEPARATOR),no=[];for(let ro=0;ro<eo.length;ro++){const oo=decodePacket(eo[ro],ue);if(no.push(oo),oo.type==="error")break}return no};function createPacketEncoderStream(){return new TransformStream({transform(to,ue){encodePacketToBinary(to,eo=>{const no=eo.length;let ro;if(no<126)ro=new Uint8Array(1),new DataView(ro.buffer).setUint8(0,no);else if(no<65536){ro=new Uint8Array(3);const oo=new DataView(ro.buffer);oo.setUint8(0,126),oo.setUint16(1,no)}else{ro=new Uint8Array(9);const oo=new DataView(ro.buffer);oo.setUint8(0,127),oo.setBigUint64(1,BigInt(no))}to.data&&typeof to.data!="string"&&(ro[0]|=128),ue.enqueue(ro),ue.enqueue(eo)})}})}let TEXT_DECODER;function totalLength(to){return to.reduce((ue,eo)=>ue+eo.length,0)}function concatChunks(to,ue){if(to[0].length===ue)return to.shift();const eo=new Uint8Array(ue);let no=0;for(let ro=0;ro<ue;ro++)eo[ro]=to[0][no++],no===to[0].length&&(to.shift(),no=0);return to.length&&no<to[0].length&&(to[0]=to[0].slice(no)),eo}function createPacketDecoderStream(to,ue){TEXT_DECODER||(TEXT_DECODER=new TextDecoder);const eo=[];let no=0,ro=-1,oo=!1;return new TransformStream({transform(io,ao){for(eo.push(io);;){if(no===0){if(totalLength(eo)<1)break;const so=concatChunks(eo,1);oo=(so[0]&128)===128,ro=so[0]&127,ro<126?no=3:ro===126?no=1:no=2}else if(no===1){if(totalLength(eo)<2)break;const so=concatChunks(eo,2);ro=new DataView(so.buffer,so.byteOffset,so.length).getUint16(0),no=3}else if(no===2){if(totalLength(eo)<8)break;const so=concatChunks(eo,8),lo=new DataView(so.buffer,so.byteOffset,so.length),co=lo.getUint32(0);if(co>Math.pow(2,53-32)-1){ao.enqueue(ERROR_PACKET);break}ro=co*Math.pow(2,32)+lo.getUint32(4),no=3}else{if(totalLength(eo)<ro)break;const so=concatChunks(eo,ro);ao.enqueue(decodePacket(oo?so:TEXT_DECODER.decode(so),ue)),no=0}if(ro===0||ro>to){ao.enqueue(ERROR_PACKET);break}}}})}const protocol$1=4;function Emitter(to){if(to)return mixin(to)}function mixin(to){for(var ue in Emitter.prototype)to[ue]=Emitter.prototype[ue];return to}Emitter.prototype.on=Emitter.prototype.addEventListener=function(to,ue){return this._callbacks=this._callbacks||{},(this._callbacks["$"+to]=this._callbacks["$"+to]||[]).push(ue),this};Emitter.prototype.once=function(to,ue){function eo(){this.off(to,eo),ue.apply(this,arguments)}return eo.fn=ue,this.on(to,eo),this};Emitter.prototype.off=Emitter.prototype.removeListener=Emitter.prototype.removeAllListeners=Emitter.prototype.removeEventListener=function(to,ue){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var eo=this._callbacks["$"+to];if(!eo)return this;if(arguments.length==1)return delete this._callbacks["$"+to],this;for(var no,ro=0;ro<eo.length;ro++)if(no=eo[ro],no===ue||no.fn===ue){eo.splice(ro,1);break}return eo.length===0&&delete this._callbacks["$"+to],this};Emitter.prototype.emit=function(to){this._callbacks=this._callbacks||{};for(var ue=new Array(arguments.length-1),eo=this._callbacks["$"+to],no=1;no<arguments.length;no++)ue[no-1]=arguments[no];if(eo){eo=eo.slice(0);for(var no=0,ro=eo.length;no<ro;++no)eo[no].apply(this,ue)}return this};Emitter.prototype.emitReserved=Emitter.prototype.emit;Emitter.prototype.listeners=function(to){return this._callbacks=this._callbacks||{},this._callbacks["$"+to]||[]};Emitter.prototype.hasListeners=function(to){return!!this.listeners(to).length};const globalThisShim=(()=>typeof self<"u"?self:typeof window<"u"?window:Function("return this")())();function pick$1(to,...ue){return ue.reduce((eo,no)=>(to.hasOwnProperty(no)&&(eo[no]=to[no]),eo),{})}const NATIVE_SET_TIMEOUT=globalThisShim.setTimeout,NATIVE_CLEAR_TIMEOUT=globalThisShim.clearTimeout;function installTimerFunctions(to,ue){ue.useNativeTimers?(to.setTimeoutFn=NATIVE_SET_TIMEOUT.bind(globalThisShim),to.clearTimeoutFn=NATIVE_CLEAR_TIMEOUT.bind(globalThisShim)):(to.setTimeoutFn=globalThisShim.setTimeout.bind(globalThisShim),to.clearTimeoutFn=globalThisShim.clearTimeout.bind(globalThisShim))}const BASE64_OVERHEAD=1.33;function byteLength(to){return typeof to=="string"?utf8Length(to):Math.ceil((to.byteLength||to.size)*BASE64_OVERHEAD)}function utf8Length(to){let ue=0,eo=0;for(let no=0,ro=to.length;no<ro;no++)ue=to.charCodeAt(no),ue<128?eo+=1:ue<2048?eo+=2:ue<55296||ue>=57344?eo+=3:(no++,eo+=4);return eo}function encode$3(to){let ue="";for(let eo in to)to.hasOwnProperty(eo)&&(ue.length&&(ue+="&"),ue+=encodeURIComponent(eo)+"="+encodeURIComponent(to[eo]));return ue}function decode$2(to){let ue={},eo=to.split("&");for(let no=0,ro=eo.length;no<ro;no++){let oo=eo[no].split("=");ue[decodeURIComponent(oo[0])]=decodeURIComponent(oo[1])}return ue}class TransportError extends Error{constructor(ue,eo,no){super(ue),this.description=eo,this.context=no,this.type="TransportError"}}class Transport extends Emitter{constructor(ue){super(),this.writable=!1,installTimerFunctions(this,ue),this.opts=ue,this.query=ue.query,this.socket=ue.socket}onError(ue,eo,no){return super.emitReserved("error",new TransportError(ue,eo,no)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(ue){this.readyState==="open"&&this.write(ue)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(ue){const eo=decodePacket(ue,this.socket.binaryType);this.onPacket(eo)}onPacket(ue){super.emitReserved("packet",ue)}onClose(ue){this.readyState="closed",super.emitReserved("close",ue)}pause(ue){}createUri(ue,eo={}){return ue+"://"+this._hostname()+this._port()+this.opts.path+this._query(eo)}_hostname(){const ue=this.opts.hostname;return ue.indexOf(":")===-1?ue:"["+ue+"]"}_port(){return this.opts.port&&(this.opts.secure&&+(this.opts.port!==443)||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(ue){const eo=encode$3(ue);return eo.length?"?"+eo:""}}const alphabet="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_".split(""),length=64,map={};let seed=0,i$2=0,prev;function encode$2(to){let ue="";do ue=alphabet[to%length]+ue,to=Math.floor(to/length);while(to>0);return ue}function yeast(){const to=encode$2(+new Date);return to!==prev?(seed=0,prev=to):to+"."+encode$2(seed++)}for(;i$2<length;i$2++)map[alphabet[i$2]]=i$2;let value$1=!1;try{value$1=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch(to){}const hasCORS=value$1;function XHR(to){const ue=to.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!ue||hasCORS))return new XMLHttpRequest}catch{}if(!ue)try{return new globalThisShim[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}function createCookieJar(){}function empty$1(){}const hasXHR2=function(){return new XHR({xdomain:!1}).responseType!=null}();class Polling extends Transport{constructor(ue){if(super(ue),this.polling=!1,typeof location<"u"){const no=location.protocol==="https:";let ro=location.port;ro||(ro=no?"443":"80"),this.xd=typeof location<"u"&&ue.hostname!==location.hostname||ro!==ue.port}const eo=ue&&ue.forceBase64;this.supportsBinary=hasXHR2&&!eo,this.opts.withCredentials&&(this.cookieJar=void 0)}get name(){return"polling"}doOpen(){this.poll()}pause(ue){this.readyState="pausing";const eo=()=>{this.readyState="paused",ue()};if(this.polling||!this.writable){let no=0;this.polling&&(no++,this.once("pollComplete",function(){--no||eo()})),this.writable||(no++,this.once("drain",function(){--no||eo()}))}else eo()}poll(){this.polling=!0,this.doPoll(),this.emitReserved("poll")}onData(ue){const eo=no=>{if(this.readyState==="opening"&&no.type==="open"&&this.onOpen(),no.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(no)};decodePayload(ue,this.socket.binaryType).forEach(eo),this.readyState!=="closed"&&(this.polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this.poll())}doClose(){const ue=()=>{this.write([{type:"close"}])};this.readyState==="open"?ue():this.once("open",ue)}write(ue){this.writable=!1,encodePayload(ue,eo=>{this.doWrite(eo,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const ue=this.opts.secure?"https":"http",eo=this.query||{};return this.opts.timestampRequests!==!1&&(eo[this.opts.timestampParam]=yeast()),!this.supportsBinary&&!eo.sid&&(eo.b64=1),this.createUri(ue,eo)}request(ue={}){return Object.assign(ue,{xd:this.xd,cookieJar:this.cookieJar},this.opts),new Request(this.uri(),ue)}doWrite(ue,eo){const no=this.request({method:"POST",data:ue});no.on("success",eo),no.on("error",(ro,oo)=>{this.onError("xhr post error",ro,oo)})}doPoll(){const ue=this.request();ue.on("data",this.onData.bind(this)),ue.on("error",(eo,no)=>{this.onError("xhr poll error",eo,no)}),this.pollXhr=ue}}class Request extends Emitter{constructor(ue,eo){super(),installTimerFunctions(this,eo),this.opts=eo,this.method=eo.method||"GET",this.uri=ue,this.data=eo.data!==void 0?eo.data:null,this.create()}create(){var ue;const eo=pick$1(this.opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");eo.xdomain=!!this.opts.xd;const no=this.xhr=new XHR(eo);try{no.open(this.method,this.uri,!0);try{if(this.opts.extraHeaders){no.setDisableHeaderCheck&&no.setDisableHeaderCheck(!0);for(let ro in this.opts.extraHeaders)this.opts.extraHeaders.hasOwnProperty(ro)&&no.setRequestHeader(ro,this.opts.extraHeaders[ro])}}catch{}if(this.method==="POST")try{no.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{no.setRequestHeader("Accept","*/*")}catch{}(ue=this.opts.cookieJar)===null||ue===void 0||ue.addCookies(no),"withCredentials"in no&&(no.withCredentials=this.opts.withCredentials),this.opts.requestTimeout&&(no.timeout=this.opts.requestTimeout),no.onreadystatechange=()=>{var ro;no.readyState===3&&((ro=this.opts.cookieJar)===null||ro===void 0||ro.parseCookies(no)),no.readyState===4&&(no.status===200||no.status===1223?this.onLoad():this.setTimeoutFn(()=>{this.onError(typeof no.status=="number"?no.status:0)},0))},no.send(this.data)}catch(ro){this.setTimeoutFn(()=>{this.onError(ro)},0);return}typeof document<"u"&&(this.index=Request.requestsCount++,Request.requests[this.index]=this)}onError(ue){this.emitReserved("error",ue,this.xhr),this.cleanup(!0)}cleanup(ue){if(!(typeof this.xhr>"u"||this.xhr===null)){if(this.xhr.onreadystatechange=empty$1,ue)try{this.xhr.abort()}catch{}typeof document<"u"&&delete Request.requests[this.index],this.xhr=null}}onLoad(){const ue=this.xhr.responseText;ue!==null&&(this.emitReserved("data",ue),this.emitReserved("success"),this.cleanup())}abort(){this.cleanup()}}Request.requestsCount=0;Request.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",unloadHandler);else if(typeof addEventListener=="function"){const to="onpagehide"in globalThisShim?"pagehide":"unload";addEventListener(to,unloadHandler,!1)}}function unloadHandler(){for(let to in Request.requests)Request.requests.hasOwnProperty(to)&&Request.requests[to].abort()}const nextTick=(()=>typeof Promise=="function"&&typeof Promise.resolve=="function"?ue=>Promise.resolve().then(ue):(ue,eo)=>eo(ue,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(ue){super(ue),this.supportsBinary=!ue.forceBase64}get name(){return"websocket"}doOpen(){if(!this.check())return;const ue=this.uri(),eo=this.opts.protocols,no=isReactNative?{}:pick$1(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(no.headers=this.opts.extraHeaders);try{this.ws=usingBrowserWebSocket&&!isReactNative?eo?new WebSocket(ue,eo):new WebSocket(ue):new WebSocket(ue,eo,no)}catch(ro){return this.emitReserved("error",ro)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=ue=>this.onClose({description:"websocket connection closed",context:ue}),this.ws.onmessage=ue=>this.onData(ue.data),this.ws.onerror=ue=>this.onError("websocket error",ue)}write(ue){this.writable=!1;for(let eo=0;eo<ue.length;eo++){const no=ue[eo],ro=eo===ue.length-1;encodePacket(no,this.supportsBinary,oo=>{const io={};try{usingBrowserWebSocket&&this.ws.send(oo)}catch{}ro&&nextTick(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.close(),this.ws=null)}uri(){const ue=this.opts.secure?"wss":"ws",eo=this.query||{};return this.opts.timestampRequests&&(eo[this.opts.timestampParam]=yeast()),this.supportsBinary||(eo.b64=1),this.createUri(ue,eo)}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(ue=>{this.onError("webtransport error",ue)}),this.transport.ready.then(()=>{this.transport.createBidirectionalStream().then(ue=>{const eo=createPacketDecoderStream(Number.MAX_SAFE_INTEGER,this.socket.binaryType),no=ue.readable.pipeThrough(eo).getReader(),ro=createPacketEncoderStream();ro.readable.pipeTo(ue.writable),this.writer=ro.writable.getWriter();const oo=()=>{no.read().then(({done:ao,value:so})=>{ao||(this.onPacket(so),oo())}).catch(ao=>{})};oo();const io={type:"open"};this.query.sid&&(io.data=`{"sid":"${this.query.sid}"}`),this.writer.write(io).then(()=>this.onOpen())})}))}write(ue){this.writable=!1;for(let eo=0;eo<ue.length;eo++){const no=ue[eo],ro=eo===ue.length-1;this.writer.write(no).then(()=>{ro&&nextTick(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var ue;(ue=this.transport)===null||ue===void 0||ue.close()}}const transports={websocket:WS,webtransport:WT,polling:Polling},re$1=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(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$9(to){if(to.length>2e3)throw"URI too long";const ue=to,eo=to.indexOf("["),no=to.indexOf("]");eo!=-1&&no!=-1&&(to=to.substring(0,eo)+to.substring(eo,no).replace(/:/g,";")+to.substring(no,to.length));let ro=re$1.exec(to||""),oo={},io=14;for(;io--;)oo[parts[io]]=ro[io]||"";return eo!=-1&&no!=-1&&(oo.source=ue,oo.host=oo.host.substring(1,oo.host.length-1).replace(/;/g,":"),oo.authority=oo.authority.replace("[","").replace("]","").replace(/;/g,":"),oo.ipv6uri=!0),oo.pathNames=pathNames(oo,oo.path),oo.queryKey=queryKey(oo,oo.query),oo}function pathNames(to,ue){const eo=/\/{2,9}/g,no=ue.replace(eo,"/").split("/");return(ue.slice(0,1)=="/"||ue.length===0)&&no.splice(0,1),ue.slice(-1)=="/"&&no.splice(no.length-1,1),no}function queryKey(to,ue){const eo={};return ue.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(no,ro,oo){ro&&(eo[ro]=oo)}),eo}let Socket$1=class vh extends Emitter{constructor(ue,eo={}){super(),this.binaryType=defaultBinaryType,this.writeBuffer=[],ue&&typeof ue=="object"&&(eo=ue,ue=null),ue?(ue=parse$9(ue),eo.hostname=ue.host,eo.secure=ue.protocol==="https"||ue.protocol==="wss",eo.port=ue.port,ue.query&&(eo.query=ue.query)):eo.host&&(eo.hostname=parse$9(eo.host).host),installTimerFunctions(this,eo),this.secure=eo.secure!=null?eo.secure:typeof location<"u"&&location.protocol==="https:",eo.hostname&&!eo.port&&(eo.port=this.secure?"443":"80"),this.hostname=eo.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=eo.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=eo.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},eo),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=decode$2(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(ue){const eo=Object.assign({},this.opts.query);eo.EIO=protocol$1,eo.transport=ue,this.id&&(eo.sid=this.id);const no=Object.assign({},this.opts,{query:eo,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[ue]);return new transports[ue](no)}open(){let ue;if(this.opts.rememberUpgrade&&vh.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1)ue="websocket";else if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}else ue=this.transports[0];this.readyState="opening";try{ue=this.createTransport(ue)}catch{this.transports.shift(),this.open();return}ue.open(),this.setTransport(ue)}setTransport(ue){this.transport&&this.transport.removeAllListeners(),this.transport=ue,ue.on("drain",this.onDrain.bind(this)).on("packet",this.onPacket.bind(this)).on("error",this.onError.bind(this)).on("close",eo=>this.onClose("transport close",eo))}probe(ue){let eo=this.createTransport(ue),no=!1;vh.priorWebsocketSuccess=!1;const ro=()=>{no||(eo.send([{type:"ping",data:"probe"}]),eo.once("packet",uo=>{if(!no)if(uo.type==="pong"&&uo.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",eo),!eo)return;vh.priorWebsocketSuccess=eo.name==="websocket",this.transport.pause(()=>{no||this.readyState!=="closed"&&(co(),this.setTransport(eo),eo.send([{type:"upgrade"}]),this.emitReserved("upgrade",eo),eo=null,this.upgrading=!1,this.flush())})}else{const fo=new Error("probe error");fo.transport=eo.name,this.emitReserved("upgradeError",fo)}}))};function oo(){no||(no=!0,co(),eo.close(),eo=null)}const io=uo=>{const fo=new Error("probe error: "+uo);fo.transport=eo.name,oo(),this.emitReserved("upgradeError",fo)};function ao(){io("transport closed")}function so(){io("socket closed")}function lo(uo){eo&&uo.name!==eo.name&&oo()}const co=()=>{eo.removeListener("open",ro),eo.removeListener("error",io),eo.removeListener("close",ao),this.off("close",so),this.off("upgrading",lo)};eo.once("open",ro),eo.once("error",io),eo.once("close",ao),this.once("close",so),this.once("upgrading",lo),this.upgrades.indexOf("webtransport")!==-1&&ue!=="webtransport"?this.setTimeoutFn(()=>{no||eo.open()},200):eo.open()}onOpen(){if(this.readyState="open",vh.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush(),this.readyState==="open"&&this.opts.upgrade){let ue=0;const eo=this.upgrades.length;for(;ue<eo;ue++)this.probe(this.upgrades[ue])}}onPacket(ue){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",ue),this.emitReserved("heartbeat"),this.resetPingTimeout(),ue.type){case"open":this.onHandshake(JSON.parse(ue.data));break;case"ping":this.sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong");break;case"error":const eo=new Error("server error");eo.code=ue.data,this.onError(eo);break;case"message":this.emitReserved("data",ue.data),this.emitReserved("message",ue.data);break}}onHandshake(ue){this.emitReserved("handshake",ue),this.id=ue.sid,this.transport.query.sid=ue.sid,this.upgrades=this.filterUpgrades(ue.upgrades),this.pingInterval=ue.pingInterval,this.pingTimeout=ue.pingTimeout,this.maxPayload=ue.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 ue=this.getWritablePackets();this.transport.send(ue),this.prevBufferLen=ue.length,this.emitReserved("flush")}}getWritablePackets(){if(!(this.maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let eo=1;for(let no=0;no<this.writeBuffer.length;no++){const ro=this.writeBuffer[no].data;if(ro&&(eo+=byteLength(ro)),no>0&&eo>this.maxPayload)return this.writeBuffer.slice(0,no);eo+=2}return this.writeBuffer}write(ue,eo,no){return this.sendPacket("message",ue,eo,no),this}send(ue,eo,no){return this.sendPacket("message",ue,eo,no),this}sendPacket(ue,eo,no,ro){if(typeof eo=="function"&&(ro=eo,eo=void 0),typeof no=="function"&&(ro=no,no=null),this.readyState==="closing"||this.readyState==="closed")return;no=no||{},no.compress=no.compress!==!1;const oo={type:ue,data:eo,options:no};this.emitReserved("packetCreate",oo),this.writeBuffer.push(oo),ro&&this.once("flush",ro),this.flush()}close(){const ue=()=>{this.onClose("forced close"),this.transport.close()},eo=()=>{this.off("upgrade",eo),this.off("upgradeError",eo),ue()},no=()=>{this.once("upgrade",eo),this.once("upgradeError",eo)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?no():ue()}):this.upgrading?no():ue()),this}onError(ue){vh.priorWebsocketSuccess=!1,this.emitReserved("error",ue),this.onClose("transport error",ue)}onClose(ue,eo){(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",ue,eo),this.writeBuffer=[],this.prevBufferLen=0)}filterUpgrades(ue){const eo=[];let no=0;const ro=ue.length;for(;no<ro;no++)~this.transports.indexOf(ue[no])&&eo.push(ue[no]);return eo}};Socket$1.protocol=protocol$1;function url$1(to,ue="",eo){let no=to;eo=eo||typeof location<"u"&&location,to==null&&(to=eo.protocol+"//"+eo.host),typeof to=="string"&&(to.charAt(0)==="/"&&(to.charAt(1)==="/"?to=eo.protocol+to:to=eo.host+to),/^(https?|wss?):\/\//.test(to)||(typeof eo<"u"?to=eo.protocol+"//"+to:to="https://"+to),no=parse$9(to)),no.port||(/^(http|ws)$/.test(no.protocol)?no.port="80":/^(http|ws)s$/.test(no.protocol)&&(no.port="443")),no.path=no.path||"/";const oo=no.host.indexOf(":")!==-1?"["+no.host+"]":no.host;return no.id=no.protocol+"://"+oo+":"+no.port+ue,no.href=no.protocol+"://"+oo+(eo&&eo.port===no.port?"":":"+no.port),no}const withNativeArrayBuffer=typeof ArrayBuffer=="function",isView=to=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(to):to.buffer instanceof ArrayBuffer,toString$5=Object.prototype.toString,withNativeBlob=typeof Blob=="function"||typeof Blob<"u"&&toString$5.call(Blob)==="[object BlobConstructor]",withNativeFile=typeof File=="function"||typeof File<"u"&&toString$5.call(File)==="[object FileConstructor]";function isBinary(to){return withNativeArrayBuffer&&(to instanceof ArrayBuffer||isView(to))||withNativeBlob&&to instanceof Blob||withNativeFile&&to instanceof File}function hasBinary(to,ue){if(!to||typeof to!="object")return!1;if(Array.isArray(to)){for(let eo=0,no=to.length;eo<no;eo++)if(hasBinary(to[eo]))return!0;return!1}if(isBinary(to))return!0;if(to.toJSON&&typeof to.toJSON=="function"&&arguments.length===1)return hasBinary(to.toJSON(),!0);for(const eo in to)if(Object.prototype.hasOwnProperty.call(to,eo)&&hasBinary(to[eo]))return!0;return!1}function deconstructPacket(to){const ue=[],eo=to.data,no=to;return no.data=_deconstructPacket(eo,ue),no.attachments=ue.length,{packet:no,buffers:ue}}function _deconstructPacket(to,ue){if(!to)return to;if(isBinary(to)){const eo={_placeholder:!0,num:ue.length};return ue.push(to),eo}else if(Array.isArray(to)){const eo=new Array(to.length);for(let no=0;no<to.length;no++)eo[no]=_deconstructPacket(to[no],ue);return eo}else if(typeof to=="object"&&!(to instanceof Date)){const eo={};for(const no in to)Object.prototype.hasOwnProperty.call(to,no)&&(eo[no]=_deconstructPacket(to[no],ue));return eo}return to}function reconstructPacket(to,ue){return to.data=_reconstructPacket(to.data,ue),delete to.attachments,to}function _reconstructPacket(to,ue){if(!to)return to;if(to&&to._placeholder===!0){if(typeof to.num=="number"&&to.num>=0&&to.num<ue.length)return ue[to.num];throw new Error("illegal attachments")}else if(Array.isArray(to))for(let eo=0;eo<to.length;eo++)to[eo]=_reconstructPacket(to[eo],ue);else if(typeof to=="object")for(const eo in to)Object.prototype.hasOwnProperty.call(to,eo)&&(to[eo]=_reconstructPacket(to[eo],ue));return to}const RESERVED_EVENTS$1=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"],protocol=5;var PacketType;(function(to){to[to.CONNECT=0]="CONNECT",to[to.DISCONNECT=1]="DISCONNECT",to[to.EVENT=2]="EVENT",to[to.ACK=3]="ACK",to[to.CONNECT_ERROR=4]="CONNECT_ERROR",to[to.BINARY_EVENT=5]="BINARY_EVENT",to[to.BINARY_ACK=6]="BINARY_ACK"})(PacketType||(PacketType={}));class Encoder{constructor(ue){this.replacer=ue}encode(ue){return(ue.type===PacketType.EVENT||ue.type===PacketType.ACK)&&hasBinary(ue)?this.encodeAsBinary({type:ue.type===PacketType.EVENT?PacketType.BINARY_EVENT:PacketType.BINARY_ACK,nsp:ue.nsp,data:ue.data,id:ue.id}):[this.encodeAsString(ue)]}encodeAsString(ue){let eo=""+ue.type;return(ue.type===PacketType.BINARY_EVENT||ue.type===PacketType.BINARY_ACK)&&(eo+=ue.attachments+"-"),ue.nsp&&ue.nsp!=="/"&&(eo+=ue.nsp+","),ue.id!=null&&(eo+=ue.id),ue.data!=null&&(eo+=JSON.stringify(ue.data,this.replacer)),eo}encodeAsBinary(ue){const eo=deconstructPacket(ue),no=this.encodeAsString(eo.packet),ro=eo.buffers;return ro.unshift(no),ro}}function isObject$7(to){return Object.prototype.toString.call(to)==="[object Object]"}class Decoder extends Emitter{constructor(ue){super(),this.reviver=ue}add(ue){let eo;if(typeof ue=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");eo=this.decodeString(ue);const no=eo.type===PacketType.BINARY_EVENT;no||eo.type===PacketType.BINARY_ACK?(eo.type=no?PacketType.EVENT:PacketType.ACK,this.reconstructor=new BinaryReconstructor(eo),eo.attachments===0&&super.emitReserved("decoded",eo)):super.emitReserved("decoded",eo)}else if(isBinary(ue)||ue.base64)if(this.reconstructor)eo=this.reconstructor.takeBinaryData(ue),eo&&(this.reconstructor=null,super.emitReserved("decoded",eo));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+ue)}decodeString(ue){let eo=0;const no={type:Number(ue.charAt(0))};if(PacketType[no.type]===void 0)throw new Error("unknown packet type "+no.type);if(no.type===PacketType.BINARY_EVENT||no.type===PacketType.BINARY_ACK){const oo=eo+1;for(;ue.charAt(++eo)!=="-"&&eo!=ue.length;);const io=ue.substring(oo,eo);if(io!=Number(io)||ue.charAt(eo)!=="-")throw new Error("Illegal attachments");no.attachments=Number(io)}if(ue.charAt(eo+1)==="/"){const oo=eo+1;for(;++eo&&!(ue.charAt(eo)===","||eo===ue.length););no.nsp=ue.substring(oo,eo)}else no.nsp="/";const ro=ue.charAt(eo+1);if(ro!==""&&Number(ro)==ro){const oo=eo+1;for(;++eo;){const io=ue.charAt(eo);if(io==null||Number(io)!=io){--eo;break}if(eo===ue.length)break}no.id=Number(ue.substring(oo,eo+1))}if(ue.charAt(++eo)){const oo=this.tryParse(ue.substr(eo));if(Decoder.isPayloadValid(no.type,oo))no.data=oo;else throw new Error("invalid payload")}return no}tryParse(ue){try{return JSON.parse(ue,this.reviver)}catch{return!1}}static isPayloadValid(ue,eo){switch(ue){case PacketType.CONNECT:return isObject$7(eo);case PacketType.DISCONNECT:return eo===void 0;case PacketType.CONNECT_ERROR:return typeof eo=="string"||isObject$7(eo);case PacketType.EVENT:case PacketType.BINARY_EVENT:return Array.isArray(eo)&&(typeof eo[0]=="number"||typeof eo[0]=="string"&&RESERVED_EVENTS$1.indexOf(eo[0])===-1);case PacketType.ACK:case PacketType.BINARY_ACK:return Array.isArray(eo)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class BinaryReconstructor{constructor(ue){this.packet=ue,this.buffers=[],this.reconPack=ue}takeBinaryData(ue){if(this.buffers.push(ue),this.buffers.length===this.reconPack.attachments){const eo=reconstructPacket(this.reconPack,this.buffers);return this.finishedReconstruction(),eo}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}const parser$3=Object.freeze(Object.defineProperty({__proto__:null,Decoder,Encoder,get PacketType(){return PacketType},protocol},Symbol.toStringTag,{value:"Module"}));function on$1(to,ue,eo){return to.on(ue,eo),function(){to.off(ue,eo)}}const RESERVED_EVENTS=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class Socket extends Emitter{constructor(ue,eo,no){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=ue,this.nsp=eo,no&&no.auth&&(this.auth=no.auth),this._opts=Object.assign({},no),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const ue=this.io;this.subs=[on$1(ue,"open",this.onopen.bind(this)),on$1(ue,"packet",this.onpacket.bind(this)),on$1(ue,"error",this.onerror.bind(this)),on$1(ue,"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(...ue){return ue.unshift("message"),this.emit.apply(this,ue),this}emit(ue,...eo){if(RESERVED_EVENTS.hasOwnProperty(ue))throw new Error('"'+ue.toString()+'" is a reserved event name');if(eo.unshift(ue),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(eo),this;const no={type:PacketType.EVENT,data:eo};if(no.options={},no.options.compress=this.flags.compress!==!1,typeof eo[eo.length-1]=="function"){const io=this.ids++,ao=eo.pop();this._registerAckCallback(io,ao),no.id=io}const ro=this.io.engine&&this.io.engine.transport&&this.io.engine.transport.writable;return this.flags.volatile&&(!ro||!this.connected)||(this.connected?(this.notifyOutgoingListeners(no),this.packet(no)):this.sendBuffer.push(no)),this.flags={},this}_registerAckCallback(ue,eo){var no;const ro=(no=this.flags.timeout)!==null&&no!==void 0?no:this._opts.ackTimeout;if(ro===void 0){this.acks[ue]=eo;return}const oo=this.io.setTimeoutFn(()=>{delete this.acks[ue];for(let ao=0;ao<this.sendBuffer.length;ao++)this.sendBuffer[ao].id===ue&&this.sendBuffer.splice(ao,1);eo.call(this,new Error("operation has timed out"))},ro),io=(...ao)=>{this.io.clearTimeoutFn(oo),eo.apply(this,ao)};io.withError=!0,this.acks[ue]=io}emitWithAck(ue,...eo){return new Promise((no,ro)=>{const oo=(io,ao)=>io?ro(io):no(ao);oo.withError=!0,eo.push(oo),this.emit(ue,...eo)})}_addToQueue(ue){let eo;typeof ue[ue.length-1]=="function"&&(eo=ue.pop());const no={id:this._queueSeq++,tryCount:0,pending:!1,args:ue,flags:Object.assign({fromQueue:!0},this.flags)};ue.push((ro,...oo)=>no!==this._queue[0]?void 0:(ro!==null?no.tryCount>this._opts.retries&&(this._queue.shift(),eo&&eo(ro)):(this._queue.shift(),eo&&eo(null,...oo)),no.pending=!1,this._drainQueue())),this._queue.push(no),this._drainQueue()}_drainQueue(ue=!1){if(!this.connected||this._queue.length===0)return;const eo=this._queue[0];eo.pending&&!ue||(eo.pending=!0,eo.tryCount++,this.flags=eo.flags,this.emit.apply(this,eo.args))}packet(ue){ue.nsp=this.nsp,this.io._packet(ue)}onopen(){typeof this.auth=="function"?this.auth(ue=>{this._sendConnectPacket(ue)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(ue){this.packet({type:PacketType.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},ue):ue})}onerror(ue){this.connected||this.emitReserved("connect_error",ue)}onclose(ue,eo){this.connected=!1,delete this.id,this.emitReserved("disconnect",ue,eo),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(ue=>{if(!this.sendBuffer.some(no=>String(no.id)===ue)){const no=this.acks[ue];delete this.acks[ue],no.withError&&no.call(this,new Error("socket has been disconnected"))}})}onpacket(ue){if(ue.nsp===this.nsp)switch(ue.type){case PacketType.CONNECT:ue.data&&ue.data.sid?this.onconnect(ue.data.sid,ue.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(ue);break;case PacketType.ACK:case PacketType.BINARY_ACK:this.onack(ue);break;case PacketType.DISCONNECT:this.ondisconnect();break;case PacketType.CONNECT_ERROR:this.destroy();const no=new Error(ue.data.message);no.data=ue.data.data,this.emitReserved("connect_error",no);break}}onevent(ue){const eo=ue.data||[];ue.id!=null&&eo.push(this.ack(ue.id)),this.connected?this.emitEvent(eo):this.receiveBuffer.push(Object.freeze(eo))}emitEvent(ue){if(this._anyListeners&&this._anyListeners.length){const eo=this._anyListeners.slice();for(const no of eo)no.apply(this,ue)}super.emit.apply(this,ue),this._pid&&ue.length&&typeof ue[ue.length-1]=="string"&&(this._lastOffset=ue[ue.length-1])}ack(ue){const eo=this;let no=!1;return function(...ro){no||(no=!0,eo.packet({type:PacketType.ACK,id:ue,data:ro}))}}onack(ue){const eo=this.acks[ue.id];typeof eo=="function"&&(delete this.acks[ue.id],eo.withError&&ue.data.unshift(null),eo.apply(this,ue.data))}onconnect(ue,eo){this.id=ue,this.recovered=eo&&this._pid===eo,this._pid=eo,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach(ue=>this.emitEvent(ue)),this.receiveBuffer=[],this.sendBuffer.forEach(ue=>{this.notifyOutgoingListeners(ue),this.packet(ue)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(ue=>ue()),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(ue){return this.flags.compress=ue,this}get volatile(){return this.flags.volatile=!0,this}timeout(ue){return this.flags.timeout=ue,this}onAny(ue){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(ue),this}prependAny(ue){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(ue),this}offAny(ue){if(!this._anyListeners)return this;if(ue){const eo=this._anyListeners;for(let no=0;no<eo.length;no++)if(ue===eo[no])return eo.splice(no,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(ue){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(ue),this}prependAnyOutgoing(ue){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(ue),this}offAnyOutgoing(ue){if(!this._anyOutgoingListeners)return this;if(ue){const eo=this._anyOutgoingListeners;for(let no=0;no<eo.length;no++)if(ue===eo[no])return eo.splice(no,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(ue){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const eo=this._anyOutgoingListeners.slice();for(const no of eo)no.apply(this,ue.data)}}}function Backoff(to){to=to||{},this.ms=to.min||100,this.max=to.max||1e4,this.factor=to.factor||2,this.jitter=to.jitter>0&&to.jitter<=1?to.jitter:0,this.attempts=0}Backoff.prototype.duration=function(){var to=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var ue=Math.random(),eo=Math.floor(ue*this.jitter*to);to=Math.floor(ue*10)&1?to+eo:to-eo}return Math.min(to,this.max)|0};Backoff.prototype.reset=function(){this.attempts=0};Backoff.prototype.setMin=function(to){this.ms=to};Backoff.prototype.setMax=function(to){this.max=to};Backoff.prototype.setJitter=function(to){this.jitter=to};class Manager extends Emitter{constructor(ue,eo){var no;super(),this.nsps={},this.subs=[],ue&&typeof ue=="object"&&(eo=ue,ue=void 0),eo=eo||{},eo.path=eo.path||"/socket.io",this.opts=eo,installTimerFunctions(this,eo),this.reconnection(eo.reconnection!==!1),this.reconnectionAttempts(eo.reconnectionAttempts||1/0),this.reconnectionDelay(eo.reconnectionDelay||1e3),this.reconnectionDelayMax(eo.reconnectionDelayMax||5e3),this.randomizationFactor((no=eo.randomizationFactor)!==null&&no!==void 0?no:.5),this.backoff=new Backoff({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(eo.timeout==null?2e4:eo.timeout),this._readyState="closed",this.uri=ue;const ro=eo.parser||parser$3;this.encoder=new ro.Encoder,this.decoder=new ro.Decoder,this._autoConnect=eo.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(ue){return arguments.length?(this._reconnection=!!ue,this):this._reconnection}reconnectionAttempts(ue){return ue===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=ue,this)}reconnectionDelay(ue){var eo;return ue===void 0?this._reconnectionDelay:(this._reconnectionDelay=ue,(eo=this.backoff)===null||eo===void 0||eo.setMin(ue),this)}randomizationFactor(ue){var eo;return ue===void 0?this._randomizationFactor:(this._randomizationFactor=ue,(eo=this.backoff)===null||eo===void 0||eo.setJitter(ue),this)}reconnectionDelayMax(ue){var eo;return ue===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=ue,(eo=this.backoff)===null||eo===void 0||eo.setMax(ue),this)}timeout(ue){return arguments.length?(this._timeout=ue,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(ue){if(~this._readyState.indexOf("open"))return this;this.engine=new Socket$1(this.uri,this.opts);const eo=this.engine,no=this;this._readyState="opening",this.skipReconnect=!1;const ro=on$1(eo,"open",function(){no.onopen(),ue&&ue()}),oo=ao=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",ao),ue?ue(ao):this.maybeReconnectOnOpen()},io=on$1(eo,"error",oo);if(this._timeout!==!1){const ao=this._timeout,so=this.setTimeoutFn(()=>{ro(),oo(new Error("timeout")),eo.close()},ao);this.opts.autoUnref&&so.unref(),this.subs.push(()=>{this.clearTimeoutFn(so)})}return this.subs.push(ro),this.subs.push(io),this}connect(ue){return this.open(ue)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const ue=this.engine;this.subs.push(on$1(ue,"ping",this.onping.bind(this)),on$1(ue,"data",this.ondata.bind(this)),on$1(ue,"error",this.onerror.bind(this)),on$1(ue,"close",this.onclose.bind(this)),on$1(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(ue){try{this.decoder.add(ue)}catch(eo){this.onclose("parse error",eo)}}ondecoded(ue){nextTick(()=>{this.emitReserved("packet",ue)},this.setTimeoutFn)}onerror(ue){this.emitReserved("error",ue)}socket(ue,eo){let no=this.nsps[ue];return no?this._autoConnect&&!no.active&&no.connect():(no=new Socket(this,ue,eo),this.nsps[ue]=no),no}_destroy(ue){const eo=Object.keys(this.nsps);for(const no of eo)if(this.nsps[no].active)return;this._close()}_packet(ue){const eo=this.encoder.encode(ue);for(let no=0;no<eo.length;no++)this.engine.write(eo[no],ue.options)}cleanup(){this.subs.forEach(ue=>ue()),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(ue,eo){this.cleanup(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",ue,eo),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const ue=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const eo=this.backoff.duration();this._reconnecting=!0;const no=this.setTimeoutFn(()=>{ue.skipReconnect||(this.emitReserved("reconnect_attempt",ue.backoff.attempts),!ue.skipReconnect&&ue.open(ro=>{ro?(ue._reconnecting=!1,ue.reconnect(),this.emitReserved("reconnect_error",ro)):ue.onreconnect()}))},eo);this.opts.autoUnref&&no.unref(),this.subs.push(()=>{this.clearTimeoutFn(no)})}}onreconnect(){const ue=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",ue)}}const cache$1={};function lookup$1(to,ue){typeof to=="object"&&(ue=to,to=void 0),ue=ue||{};const eo=url$1(to,ue.path||"/socket.io"),no=eo.source,ro=eo.id,oo=eo.path,io=cache$1[ro]&&oo in cache$1[ro].nsps,ao=ue.forceNew||ue["force new connection"]||ue.multiplex===!1||io;let so;return ao?so=new Manager(no,ue):(cache$1[ro]||(cache$1[ro]=new Manager(no,ue)),so=cache$1[ro]),eo.query&&!ue.query&&(ue.query=eo.queryKey),so.socket(eo.path,ue)}Object.assign(lookup$1,{Manager,Socket,io:lookup$1,connect:lookup$1});const DefaultOptions={heartbeat:!0},createWebsocket=(to,ue=DefaultOptions)=>{if(!to)throw"A websocket path must be provided";const{heartbeat:eo}={...DefaultOptions,...ue},no=location.protocol==="https:",ro=no?"wss:":"ws:",oo=location.hostname,io=location.port||(no?443:80);let ao=lookup$1(`${ro}//${oo}:${io}`,{path:to,reconnectionAttempts:3,reconnectionDelay:5e3,reconnectionDelayMax:5e3,timeout:4e3,transports:["websocket"]}),so;return eo&&(so=setInterval(()=>{ao.emit(SocketEvent.Heartbeat)},SocketSessionTTL*500)),ao.on("disconnect",()=>{clearInterval(so)}),ao.onOther=(lo,co)=>{ao.on(lo,uo=>{(uo==null?void 0:uo.apiSessionId)!==APISessionID&&co(uo)})},ao},defaultColors={keyColor:"dimgray",numberColor:"lightskyblue",stringColor:"lightcoral",trueColor:"lightseagreen",falseColor:"#f66578",nullColor:"cornflowerblue"},entityMap={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`","=":"="};function escapeHtml(to){return String(to).replace(/[&<>"'`=]/g,function(ue){return entityMap[ue]})}function format$1(to,ue={}){const eo=typeof to;let no=typeof to=="string"?to:JSON.stringify(to,null,2)||eo,ro=Object.assign({},defaultColors,ue);return no=no.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">"),no.replace(/("(\\u[a-zA-Z0-9]{4}|\\[^u]|[^\\"])*"(\s*:)?|\b(true|false|null)\b|-?\d+(?:\.\d*)?(?:[eE][+]?\d+)?)/g,oo=>{let io=ro.numberColor,ao="";return/^"/.test(oo)?/:$/.test(oo)?io=ro.keyColor:(io=ro.stringColor,oo='"'+escapeHtml(oo.substr(1,oo.length-2))+'"',ao="word-wrap:break-word;white-space:pre-wrap;"):io=/true/.test(oo)?ro.trueColor:/false/.test(oo)?ro.falseColor:/null/.test(oo)?ro.nullColor:io,`<span style="${ao}color:${io}">${oo}</span>`})}const extractFileNameRegex=/filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/;function downloadText(to,ue){typeof ue=="object"&&(ue=JSON.stringify(ue));const eo=new Blob([ue],{type:"plain/text"}),no=URL.createObjectURL(eo),ro=document.createElement("a");ro.href=no,ro.download=to,ro.click(),URL.revokeObjectURL(no)}async function downloadStream(to){const ue=await to.blob(),eo=to.headers.get("Content-Disposition"),ro=extractFileNameRegex.exec(eo)[1].replace(/['"]/g,""),oo=new Blob([ue]),io=URL.createObjectURL(oo),ao=document.createElement("a");ao.href=io,ao.download=ro,ao.click(),URL.revokeObjectURL(io)}async function downloadFile(to,ue){const eo=await fetch(to,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(ue)});if(eo.ok){const no=eo.headers.get("Content-Disposition"),oo=extractFileNameRegex.exec(no)[1].replace(/['"]/g,""),io=URL.createObjectURL(await eo.blob()),ao=document.createElement("a");return ao.href=io,ao.download=oo,ao.click(),URL.revokeObjectURL(io),!0}else return!1}const shouldDisplaySetting=(to,ue)=>{let eo=ue.dependsOn;return eo&&!Array.isArray(eo)&&(eo=[eo]),eo!=null&&eo.length?eo.every(no=>{let ro=no,oo=null,io=!!no.invert;if(typeof no=="object"&&(ro=no.setting,oo=no.value),!ro)return!1;Array.isArray(oo)||(oo=[oo]);const ao=deepGet$1(to,ro);return oo.some(lo=>lo==null?ao!=null&&ao!==!1&&ao!=="":lo===ao)!==io}):!0},columnTypeManyTypeOverrides={[FieldType.DATETIME]:FieldType.STRING,[FieldType.BOOLEAN]:FieldType.STRING,[FieldType.SIGNATURE_SINGLE]:FieldType.ATTACHMENTS},columnTypeManyParser={[FieldType.DATETIME]:(to,ue)=>{function eo(no){const{timeOnly:ro,dateOnly:oo}=ue||{},io=!oo,ao=parseDate(no,{enableTime:io});return getDateDisplayValue(ao,{enableTime:io,timeOnly:ro})}return to.map(no=>eo(no))},[FieldType.BOOLEAN]:to=>to.map(ue=>!!ue),[FieldType.BB_REFERENCE_SINGLE]:to=>[...new Map(to.map(ue=>[ue._id,ue])).values()],[FieldType.BB_REFERENCE]:to=>[...new Map(to.map(ue=>[ue._id,ue])).values()],[FieldType.ARRAY]:to=>Array.from(new Set(to))};function enrichSchemaWithRelColumns(to){return Object.keys(to).reduce((eo,no)=>{const ro=to[no];if(eo[no]=ro,ro.visible!==!1&&isRelationshipField(ro)&&ro.columns){const oo=(ro==null?void 0:ro.relationshipType)===RelationshipType.ONE_TO_MANY;for(const io of Object.keys(ro.columns)){const ao=ro.columns[io];if(!ao.visible)continue;const so=`${ro.name}.${io}`;eo[so]={...ao,type:ao.type,name:so,related:{field:no,subField:io},cellRenderType:!oo&&columnTypeManyTypeOverrides[ao.type]||ao.type}}}return eo},{})}function getRelatedTableValues(to,ue,eo){var oo,io,ao,so;const no=isRelationshipField(eo)&&(eo==null?void 0:eo.relationshipType)===RelationshipType.ONE_TO_MANY;let ro="";if(no)ro=(io=(oo=to[ue.related.field])==null?void 0:oo[0])==null?void 0:io[ue.related.subField];else{const lo=columnTypeManyParser[ue.type]||(fo=>fo),co=(so=(ao=to[ue.related.field])==null?void 0:ao.flatMap(fo=>fo[ue.related.subField]))==null?void 0:so.filter(fo=>fo!=null),uo=lo(co||[],ue);ro=uo,[FieldType.STRING,FieldType.NUMBER,FieldType.BIGINT,FieldType.BOOLEAN,FieldType.DATETIME,FieldType.LONGFORM,FieldType.BARCODEQR].includes(ue.type)&&(ro=uo==null?void 0:uo.join(", "))}return ro}function canBeDisplayColumn(to){return!(!canBeDisplayColumn$1(to.type)||to.related)}function canBeSortColumn(to){return to.calculationType?!0:!(!canBeSortColumn$1(to.type)||to.related)}const getSettingsDefinition=to=>{var eo;if(!to)return[];let ue=[];return(eo=to.settings)==null||eo.forEach(no=>{var ro;no.section?ue=ue.concat((ro=no.settings||[])==null?void 0:ro.map(oo=>({...oo,sectionDependsOn:no.dependsOn}))):ue.push(no)}),ue},{buildQuery,limit:queryLimit,runQuery,sort:sort$2}=QueryUtils;class BaseDataFetch{constructor(ue){pc(this,"API");pc(this,"features");pc(this,"options");pc(this,"store");pc(this,"derivedStore");if(this.features={supportsSearch:!1,supportsSort:!1,supportsPagination:!1},this.options={datasource:ue.datasource,limit:10,filter:null,query:ue.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:ue.query,pageNumber:0,cursor:null,cursors:[],resetKey:Math.random().toString(),error:null}),this.API=ue==null?void 0:ue.API,this.options={...this.options,...ue},!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,eo=>({...eo,...this.features,hasNextPage:this.hasNextPage(eo),hasPrevPage:this.hasPrevPage(eo)})),!this.options.datasource){this.store.update(eo=>({...eo,loaded:!0}));return}}get subscribe(){return this.derivedStore.subscribe}getDefaultSortColumn(ue,eo){return ue!=null&&ue.primaryDisplay&&eo[ue.primaryDisplay]?ue.primaryDisplay:Object.keys(eo)[0]}async getInitialData(){const{filter:ue,paginate:eo}=this.options,no=await this.getDefinition(),ro=await this.determineFeatureFlags();this.features={supportsSearch:!!(ro!=null&&ro.supportsSearch),supportsSort:!!(ro!=null&&ro.supportsSort),supportsPagination:eo&&!!(ro!=null&&ro.supportsPagination)};let oo=this.getSchema(no);if(!oo)return;if(oo=this.enrichSchema(oo),this.options.sortColumn&&!oo[this.options.sortColumn]&&(this.options.sortColumn=null),this.options.sortColumn||(this.options.sortColumn=this.getDefaultSortColumn(no,oo)),!this.options.sortColumn)this.options.sortOrder=SortOrder.ASCENDING,this.options.sortType=null;else{this.options.sortType=SortType.STRING;const so=oo==null?void 0:oo[this.options.sortColumn];((so==null?void 0:so.type)===FieldType.NUMBER||(so==null?void 0:so.type)===FieldType.BIGINT||"calculationType"in so&&(so!=null&&so.calculationType))&&(this.options.sortType=SortType.NUMBER),this.options.sortOrder?this.options.sortOrder=this.options.sortOrder.toLowerCase():this.options.sortOrder=SortOrder.ASCENDING}let io=this.options.query;io||(io=buildQuery(ue??void 0)),this.store.update(so=>({...so,definition:no,schema:oo,query:io,loading:!0,cursors:[],cursor:null}));const ao=await this.getPage();this.store.update(so=>({...so,loading:!1,loaded:!0,pageNumber:0,rows:ao.rows,info:ao.info,cursors:eo&&ao.hasNextPage?[null,ao.cursor]:[null],error:ao.error,resetKey:Math.random().toString()}))}async getPage(){const{sortColumn:ue,sortOrder:eo,sortType:no,limit:ro,clientSideSearching:oo,clientSideSorting:io,clientSideLimiting:ao}=this.options,{query:so}=get_store_value(this.store);let{rows:lo,info:co,hasNextPage:uo,cursor:fo,error:po}=await this.getData();return!this.features.supportsSearch&&oo&&(lo=runQuery(lo,so)),!this.features.supportsSort&&io&&no&&(lo=sort$2(lo,ue,eo,no)),!this.features.supportsPagination&&ao&&(lo=queryLimit(lo,ro)),{rows:lo,info:co,hasNextPage:uo,cursor:fo,error:po}}getSchema(ue){return(ue==null?void 0:ue.schema)??void 0}enrichSchema(ue){let eo={};for(const ro of Object.keys(ue)){const oo=ue[ro];if(oo.type===FieldType.JSON){const io=convertJSONSchemaToTableSchema(oo,{squashObjects:!0});if(io)for(const ao of Object.keys(io))eo[`${ro}.${ao}`]={type:io[ao].type,nestedJSON:!0}}}let no={};return Object.entries({...ue,...eo}).forEach(([ro,oo])=>{typeof oo=="string"?no[ro]={type:oo,name:ro}:no[ro]={...oo,type:oo.type,name:ro}}),no}async determineFeatureFlags(){return{supportsSearch:!1,supportsSort:!1,supportsPagination:!1}}async update(ue){let eo=!1;for(const[no,ro]of Object.entries(ue||{})){const oo=this.options[no]??null;if(JSON.stringify(ro??null)!==JSON.stringify(oo)){eo=!0;break}}eo&&(this.options={...this.options,...fp$1.cloneDeep(ue)},await this.getInitialData())}async refresh(){if(get_store_value(this.store).loading)return;this.store.update(so=>({...so,loading:!0}));const{rows:ue,info:eo,error:no,cursor:ro}=await this.getPage();let{cursors:oo}=get_store_value(this.store);const{pageNumber:io}=get_store_value(this.store);if(!ue.length&&io>0)return this.store.update(so=>({...so,loading:!1,cursors:oo.slice(0,io)})),await this.prevPage();oo[io+1]!=ro&&(oo=oo.slice(0,io+1),oo[io+1]=ro),this.store.update(so=>({...so,rows:ue,info:eo,loading:!1,error:no,cursors:oo}))}hasNextPage(ue){return ue.cursors[ue.pageNumber+1]!=null}hasPrevPage(ue){return ue.pageNumber>0}async nextPage(){const ue=get_store_value(this.derivedStore);if(ue.loading||!this.options.paginate||!ue.hasNextPage)return;const eo=ue.cursors[ue.pageNumber+1];this.store.update(so=>({...so,loading:!0,cursor:eo,pageNumber:so.pageNumber+1}));const{rows:no,info:ro,hasNextPage:oo,cursor:io,error:ao}=await this.getPage();this.store.update(so=>{let{cursors:lo,pageNumber:co}=so;return oo&&(lo[co+1]=io),{...so,rows:no,info:ro,cursors:lo,loading:!1,error:ao}})}async prevPage(){const ue=get_store_value(this.derivedStore);if(ue.loading||!this.options.paginate||!ue.hasPrevPage)return;const eo=ue.cursors[ue.pageNumber-1];this.store.update(io=>({...io,loading:!0,cursor:eo,pageNumber:io.pageNumber-1}));const{rows:no,info:ro,error:oo}=await this.getPage();this.store.update(io=>({...io,rows:no,info:ro,loading:!1,error:oo}))}}class TableFetch extends BaseDataFetch{async determineFeatureFlags(){return{supportsSearch:!0,supportsSort:!0,supportsPagination:!0}}async getDefinition(){const{datasource:ue}=this.options;if(!(ue!=null&&ue.tableId))return null;try{return await this.API.fetchTableDefinition(ue.tableId)}catch(eo){return this.store.update(no=>({...no,error:eo})),null}}async getData(){const{datasource:ue,limit:eo,sortColumn:no,sortOrder:ro,sortType:oo,paginate:io}=this.options,{tableId:ao}=ue,{cursor:so,query:lo}=get_store_value(this.store);try{const co=await this.API.searchTable(ao,{query:lo,limit:eo,sort:no,sortOrder:ro??SortOrder.ASCENDING,sortType:oo,paginate:io,bookmark:so});return{rows:(co==null?void 0:co.rows)||[],hasNextPage:(co==null?void 0:co.hasNextPage)||!1,cursor:(co==null?void 0:co.bookmark)||null}}catch(co){return{rows:[],hasNextPage:!1,error:co}}}}class ViewFetch extends BaseDataFetch{async getDefinition(){const{datasource:ue}=this.options;if(!(ue!=null&&ue.tableId))return null;try{return await this.API.fetchTableDefinition(ue.tableId)}catch(eo){return this.store.update(no=>({...no,error:eo})),null}}getSchema(ue){var no,ro;const{datasource:eo}=this.options;return(ro=(no=ue==null?void 0:ue.views)==null?void 0:no[eo==null?void 0:eo.name])==null?void 0:ro.schema}async getData(){const{datasource:ue}=this.options;try{return{rows:await this.API.fetchViewData(ue.name,{calculation:ue.calculation,field:ue.field,groupBy:ue.groupBy,tableId:ue.tableId})||[]}}catch(eo){return console.error(eo,{datasource:ue}),{rows:[]}}}}class ViewV2Fetch extends BaseDataFetch{async determineFeatureFlags(){return{supportsSearch:!0,supportsSort:!0,supportsPagination:!0}}async getDefinition(){const{datasource:ue}=this.options;try{const eo=await this.API.viewV2.fetchDefinition(ue.id);return eo==null?void 0:eo.data}catch(eo){return this.store.update(no=>({...no,error:eo})),null}}getDefaultSortColumn(){return null}async getData(){var co;const{datasource:ue,limit:eo,sortColumn:no,sortOrder:ro,sortType:oo,paginate:io}=this.options,{cursor:ao,query:so,definition:lo}=get_store_value(this.store);if((lo==null?void 0:lo.type)===ViewV2Type.CALCULATION&&!Object.values(lo.schema||{}).some(isCalculationField))return{rows:[],hasNextPage:!1,cursor:null,error:null};!no&&((co=lo==null?void 0:lo.sort)!=null&&co.field)&&(this.options.sortColumn=lo.sort.field,this.options.sortOrder=lo.sort.order||SortOrder.ASCENDING);try{const uo={query:so,paginate:io,limit:eo,bookmark:ao,sort:no,sortOrder:ro,sortType:oo};if(io){const fo=await this.API.viewV2.fetch(ue.id,{...uo,paginate:io});return{rows:(fo==null?void 0:fo.rows)||[],hasNextPage:(fo==null?void 0:fo.hasNextPage)||!1,cursor:(fo==null?void 0:fo.bookmark)||null}}else{const fo=await this.API.viewV2.fetch(ue.id,{...uo,paginate:io});return{rows:(fo==null?void 0:fo.rows)||[],hasNextPage:!1,cursor:null}}}catch(uo){return{rows:[],hasNextPage:!1,cursor:null,error:uo}}}}class QueryFetch extends BaseDataFetch{async determineFeatureFlags(){var no,ro,oo,io,ao,so;const ue=await this.getDefinition();return{supportsPagination:!!((ro=(no=ue==null?void 0:ue.fields)==null?void 0:no.pagination)!=null&&ro.type)&&!!((io=(oo=ue==null?void 0:ue.fields)==null?void 0:oo.pagination)!=null&&io.location)&&!!((so=(ao=ue==null?void 0:ue.fields)==null?void 0:ao.pagination)!=null&&so.pageParam)}}async getDefinition(){const{datasource:ue}=this.options;if(!(ue!=null&&ue._id))return null;try{const eo=await this.API.fetchQueryDefinition(ue._id);return eo.fields||(eo.fields=ue.fields),eo}catch{return null}}getDefaultSortColumn(){return null}async getData(){var co,uo;const{datasource:ue,limit:eo,paginate:no}=this.options,{supportsPagination:ro}=this.features,{cursor:oo,definition:io}=get_store_value(this.store),ao=(uo=(co=io==null?void 0:io.fields)==null?void 0:co.pagination)==null?void 0:uo.type,so=cloneDeep(ue.queryParams||{});for(const fo of(ue==null?void 0:ue.parameters)||[])so[fo.name]||(so[fo.name]=fo.default);const lo={parameters:so};if(no&&ro){const fo=ao==="page"?parseInt(oo||"1"):oo;lo.pagination={page:fo,limit:eo}}try{const fo=await this.API.executeQuery(ue==null?void 0:ue._id,lo),{data:po,pagination:ho,..._o}=fo;let go=null,bo=!1;return no&&ro&&(ao==="page"?(go=lo.pagination.page+1,bo=(po==null?void 0:po.length)===eo&&eo>0):(go=ho==null?void 0:ho.cursor,bo=go!=null)),{rows:po||[],info:_o,cursor:go,hasNextPage:bo}}catch{return{rows:[],hasNextPage:!1}}}}class RelationshipFetch extends BaseDataFetch{async getDefinition(){const{datasource:ue}=this.options;if(!(ue!=null&&ue.tableId))return null;try{return await this.API.fetchTableDefinition(ue.tableId)}catch(eo){return this.store.update(no=>({...no,error:eo})),null}}async getData(){const{datasource:ue}=this.options;if(!(ue!=null&&ue.rowId)||!(ue!=null&&ue.rowTableId))return{rows:[]};try{return{rows:await this.API.fetchRelationshipData(ue.rowTableId,ue.rowId,ue.fieldName)}}catch{return{rows:[]}}}}class NestedProviderFetch extends BaseDataFetch{async getDefinition(){var eo,no;const{datasource:ue}=this.options;return{schema:(eo=ue==null?void 0:ue.value)==null?void 0:eo.schema,primaryDisplay:(no=ue==null?void 0:ue.value)==null?void 0:no.primaryDisplay}}async getData(){var eo;const{datasource:ue}=this.options;return{rows:((eo=ue==null?void 0:ue.value)==null?void 0:eo.rows)||[],hasNextPage:!1,cursor:null}}}function isArrayOfStrings(to){return Array.isArray(to)&&!!to[0]&&typeof to[0]!="object"}class FieldFetch extends BaseDataFetch{async getDefinition(){const{datasource:ue}=this.options;let eo;return ue.fieldType==="attachment"?eo={url:{type:"string"},name:{type:"string"}}:ue.fieldType==="array"&&(eo={value:{type:"string"}}),{schema:eo}}async getData(){const{datasource:ue}=this.options,eo=(ue==null?void 0:ue.value)||[];let no;return isArrayOfStrings(eo)?no=eo.map(ro=>({value:ro})):no=eo,{rows:no||[],hasNextPage:!1,cursor:null}}}class JSONArrayFetch extends FieldFetch{async getDefinition(){const{datasource:ue}=this.options;try{const eo=await this.API.fetchTableDefinition(ue.tableId);return{schema:getJSONArrayDatasourceSchema(eo==null?void 0:eo.schema,ue)}}catch{return null}}}class UserFetch extends BaseDataFetch{constructor(ue){super({...ue,datasource:{type:"user",tableId:InternalTable.USER_METADATA}})}async determineFeatureFlags(){return{supportsSearch:!0,supportsSort:!1,supportsPagination:!0}}async getDefinition(){return{schema:{}}}async getData(){const{limit:ue,paginate:eo}=this.options,{cursor:no,query:ro}=get_store_value(this.store),{appId:oo,paginated:io,...ao}=ro,so=isSupportedUserSearch(ao)?ao:{};try{const lo={bookmark:no??void 0,query:so??void 0,appId:oo,paginate:io||eo,limit:ue},co=await this.API.searchUsers(lo);return{rows:(co==null?void 0:co.data)||[],hasNextPage:(co==null?void 0:co.hasNextPage)||!1,cursor:(co==null?void 0:co.nextPage)||null}}catch(lo){return{rows:[],hasNextPage:!1,error:lo}}}}class GroupUserFetch extends BaseDataFetch{constructor(ue){super({...ue,datasource:{type:"groupUser",tableId:InternalTable.USER_METADATA}})}async determineFeatureFlags(){return{supportsSearch:!0,supportsSort:!1,supportsPagination:!0}}async getDefinition(){return{schema:{}}}async getData(){const{query:ue,cursor:eo}=get_store_value(this.store);try{const no=await this.API.getGroupUsers({id:ue.groupId,emailSearch:ue.emailSearch,bookmark:eo??void 0});return{rows:(no==null?void 0:no.users)||[],hasNextPage:(no==null?void 0:no.hasNextPage)||!1,cursor:(no==null?void 0:no.bookmark)||null}}catch(no){return{rows:[],hasNextPage:!1,error:no}}}}class CustomFetch extends BaseDataFetch{getType(ue){return ue==null?"string":typeof ue==="object"?Array.isArray(ue)?"array":"json":isNaN(ue)?"string":"number"}parseCustomData(ue){if(!ue)return[];if(Array.isArray(ue))return ue;if(typeof ue=="string"){try{const eo=JSON.parse(ue);return Array.isArray(eo)?eo:[eo]}catch{}return ue.includes(`
|
|
475
|
+
`))&&attr(ue,"style",eo),(!ro||so&1&&no!==(no="spectrum-Body spectrum-Body--size"+ao[0]+" svelte-10a30y"))&&attr(ue,"class",no),(!ro||so&3)&&toggle_class(ue,"spectrum-Body--serif",ao[1])},i(ao){ro||(transition_in(io,ao),ro=!0)},o(ao){transition_out(io,ao),ro=!1},d(ao){ao&&detach(ue),io&&io.d(ao)}}}function instance$aa(to,ue,eo){let{$$slots:no={},$$scope:ro}=ue,{size:oo="M"}=ue,{serif:io=!1}=ue,{weight:ao=null}=ue,{textAlign:so=null}=ue,{color:lo=null}=ue;return to.$$set=co=>{"size"in co&&eo(0,oo=co.size),"serif"in co&&eo(1,io=co.serif),"weight"in co&&eo(2,ao=co.weight),"textAlign"in co&&eo(3,so=co.textAlign),"color"in co&&eo(4,lo=co.color),"$$scope"in co&&eo(5,ro=co.$$scope)},[oo,io,ao,so,lo,ro,no]}class Body extends SvelteComponent{constructor(ue){super(),init$3(this,ue,instance$aa,create_fragment$ad,safe_not_equal,{size:0,serif:1,weight:2,textAlign:3,color:4})}}const Heading_svelte_svelte_type_style_lang="";function create_fragment$ac(to){let ue,eo,no,ro;const oo=to[5].default,io=create_slot(oo,to,to[4],null);return{c(){ue=element("h1"),io&&io.c(),attr(ue,"data-testid","typography-heading"),attr(ue,"style",eo=to[1]?`text-align:${to[1]}`:""),attr(ue,"class",no="spectrum-Heading spectrum-Heading--size"+to[0]+" spectrum-Heading--"+to[3]+" svelte-3sm8u5"),toggle_class(ue,"noPadding",to[2])},m(ao,so){insert$2(ao,ue,so),io&&io.m(ue,null),ro=!0},p(ao,[so]){io&&io.p&&(!ro||so&16)&&update_slot_base(io,oo,ao,ao[4],ro?get_slot_changes(oo,ao[4],so,null):get_all_dirty_from_scope(ao[4]),null),(!ro||so&2&&eo!==(eo=ao[1]?`text-align:${ao[1]}`:""))&&attr(ue,"style",eo),(!ro||so&9&&no!==(no="spectrum-Heading spectrum-Heading--size"+ao[0]+" spectrum-Heading--"+ao[3]+" svelte-3sm8u5"))&&attr(ue,"class",no),(!ro||so&13)&&toggle_class(ue,"noPadding",ao[2])},i(ao){ro||(transition_in(io,ao),ro=!0)},o(ao){transition_out(io,ao),ro=!1},d(ao){ao&&detach(ue),io&&io.d(ao)}}}function instance$a9(to,ue,eo){let{$$slots:no={},$$scope:ro}=ue,{size:oo="M"}=ue,{textAlign:io=void 0}=ue,{noPadding:ao=!1}=ue,{weight:so="default"}=ue;return to.$$set=lo=>{"size"in lo&&eo(0,oo=lo.size),"textAlign"in lo&&eo(1,io=lo.textAlign),"noPadding"in lo&&eo(2,ao=lo.noPadding),"weight"in lo&&eo(3,so=lo.weight),"$$scope"in lo&&eo(4,ro=lo.$$scope)},[oo,io,ao,so,ro,no]}class Heading extends SvelteComponent{constructor(ue){super(),init$3(this,ue,instance$a9,create_fragment$ac,safe_not_equal,{size:0,textAlign:1,noPadding:2,weight:3})}}var HTTPMethod=(to=>(to.POST="POST",to.PATCH="PATCH",to.GET="GET",to.PUT="PUT",to.DELETE="DELETE",to))(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$1=(to=>(to.USERS="ta_users",to))(TableNames$1||{});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$2={ADMIN:"ADMIN",POWER:"POWER",BASIC:"BASIC",PUBLIC:"PUBLIC",BUILDER:"BUILDER",CREATOR:"CREATOR"},EventPublishType={ENV_VAR_UPGRADE_PANEL_OPENED:"environment_variable_upgrade_panel_opened"},TypeIconMap$1={[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(to=>`hsla(${(to+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$1={WRITABLE:"writable",READONLY:"readonly",HIDDEN:"hidden"},Constants$1=Object.freeze(Object.defineProperty({__proto__:null,ApiVersion,BannedSearchTypes,BudibaseRoleOptions,BudibaseRoleOptionsOld,BudibaseRoles,ContextScopes:ComponentContextScopes,Cookies,DEFAULT_BB_DATASOURCE_ID:DEFAULT_BB_DATASOURCE_ID$1,EventPublishType,ExtendedBudibaseRoleOptions,Features:Feature,FieldPermissions:FieldPermissions$1,FilterOperator,FilterValueType,OnEmptyFilter,OperatorOptions,OptionColours,PlanType,Roles:Roles$2,SqlNumberTypeRangeMap,TableNames:TableNames$1,TypeIconMap:TypeIconMap$1},Symbol.toStringTag,{value:"Module"})),buildAnalyticsEndpoints=to=>({getAnalyticsStatus:async()=>await to.get({url:"/api/bbtel"}),analyticsPing:async ue=>await to.post({url:"/api/bbtel/ping",body:{...ue,timezone:Intl.DateTimeFormat().resolvedOptions().timeZone}})}),buildAIEndpoints=to=>({generateCronExpression:async ue=>await to.post({url:"/api/ai/cron",body:{prompt:ue}})}),buildAppEndpoints=to=>({fetchAppPackage:async ue=>await to.get({url:`/api/applications/${ue}/appPackage`}),saveAppMetadata:async(ue,eo)=>await to.put({url:`/api/applications/${ue}`,body:eo}),publishAppChanges:async ue=>await to.post({url:`/api/applications/${ue}/publish`}),revertAppChanges:async ue=>await to.post({url:`/api/dev/${ue}/revert`}),updateAppClientVersion:async ue=>await to.post({url:`/api/applications/${ue}/client/update`}),revertAppClientVersion:async ue=>await to.post({url:`/api/applications/${ue}/client/revert`}),getAppDeployments:async()=>await to.get({url:"/api/deployments"}),createApp:async ue=>await to.post({url:"/api/applications",body:ue,json:!1}),duplicateApp:async(ue,eo)=>await to.post({url:`/api/applications/${ue}/duplicate`,body:eo,json:!1}),updateAppFromExport:async(ue,eo)=>{const no=getDevAppID(ue);return await to.post({url:`/api/applications/${no}/import`,body:eo,json:!1})},importApps:async ue=>await to.post({url:"/api/cloud/import",body:ue,json:!1}),unpublishApp:async ue=>await to.post({url:`/api/applications/${ue}/unpublish`}),deleteApp:async ue=>await to.delete({url:`/api/applications/${ue}`}),releaseAppLock:async ue=>await to.delete({url:`/api/dev/${ue}/lock`}),fetchSystemDebugInfo:async()=>await to.get({url:"/api/debug/diagnostics"}),syncApp:async ue=>await to.post({url:`/api/applications/${ue}/sync`}),getApps:async()=>await to.get({url:"/api/applications?status=all"}),fetchComponentLibDefinitions:async ue=>await to.get({url:`/api/${ue}/components/definitions`}),addSampleData:async ue=>await to.post({url:`/api/applications/${ue}/sample`}),setRevertableVersion:async(ue,eo)=>await to.post({url:`/api/applications/${ue}/setRevertableVersion`,body:{revertableVersion:eo}})}),buildAttachmentEndpoints=to=>{const ue={getSignedDatasourceURL:async(eo,no,ro)=>await to.post({url:`/api/attachments/${eo}/url`,body:{bucket:no,key:ro}})};return{...ue,uploadAttachment:async(eo,no)=>await to.post({url:`/api/attachments/${eo}/upload`,body:no,json:!1}),uploadBuilderAttachment:async eo=>await to.post({url:"/api/attachments/process",body:eo,json:!1}),externalUpload:async(eo,no,ro,oo)=>{const{signedUrl:io,publicUrl:ao}=await ue.getSignedDatasourceURL(eo,no,ro);return io?(await to.put({url:io,body:oo,json:!1,external:!0,parseResponse:so=>so}),{publicUrl:ao}):{publicUrl:void 0}},downloadAttachment:async(eo,no,ro)=>await to.get({url:`/api/${eo}/rows/${no}/attachment/${ro}`,parseResponse:oo=>oo,suppressErrors:!0})}},buildAuthEndpoints=to=>({logIn:async(ue,eo,no)=>await to.post({url:`/api/global/auth/${ue}/login`,body:{username:eo,password:no}}),logOut:async()=>await to.post({url:"/api/global/auth/logout"}),setInitInfo:async ue=>await to.post({url:"/api/global/auth/init",body:ue}),getInitInfo:async()=>await to.get({url:"/api/global/auth/init"}),requestForgotPassword:async(ue,eo)=>await to.post({url:`/api/global/auth/${ue}/reset`,body:{email:eo}}),resetPassword:async(ue,eo,no)=>await to.post({url:`/api/global/auth/${ue}/reset/update`,body:{password:eo,resetCode:no}})}),buildAutomationEndpoints=to=>({triggerAutomation:async(ue,eo,no)=>await to.post({url:`/api/automations/${ue}/trigger`,body:{fields:eo,timeout:no}}),testAutomation:async(ue,eo)=>await to.post({url:`/api/automations/${ue}/test`,body:eo}),getAutomations:async()=>await to.get({url:"/api/automations"}),getAutomationDefinitions:async()=>await to.get({url:"/api/automations/definitions/list"}),createAutomation:async ue=>await to.post({url:"/api/automations",body:ue}),updateAutomation:async ue=>await to.put({url:"/api/automations",body:ue}),deleteAutomation:async(ue,eo)=>await to.delete({url:`/api/automations/${ue}/${eo}`}),getAutomationLogs:async ue=>await to.post({url:"/api/automations/logs/search",body:ue}),clearAutomationLogErrors:async(ue,eo)=>await to.delete({url:"/api/automations/logs",body:{appId:eo,automationId:ue}})}),buildConfigEndpoints=to=>({saveConfig:async ue=>await to.post({url:"/api/global/configs",body:ue}),getConfig:async ue=>await to.get({url:`/api/global/configs/${ue}`}),deleteConfig:async(ue,eo)=>await to.delete({url:`/api/global/configs/${ue}/${eo}`}),getTenantConfig:async ue=>await to.get({url:`/api/global/configs/public?tenantId=${ue}`}),getOIDCConfigs:async ue=>await to.get({url:`/api/global/configs/public/oidc?tenantId=${ue}`}),getChecklist:async ue=>await to.get({url:`/api/global/configs/checklist?tenantId=${ue}`}),uploadLogo:async ue=>await to.post({url:"/api/global/configs/upload/settings/logoUrl",body:ue,json:!1}),uploadFavicon:async ue=>await to.post({url:"/api/global/configs/upload/settings/faviconUrl",body:ue,json:!1}),uploadOIDCLogo:async(ue,eo)=>await to.post({url:`/api/global/configs/upload/logos_oidc/${ue}`,body:eo,json:!1}),getOIDCLogos:async()=>await to.get({url:"/api/global/configs/logos_oidc"})}),buildDatasourceEndpoints=to=>({getDatasources:async()=>await to.get({url:"/api/datasources"}),buildDatasourceSchema:async(ue,eo)=>await to.post({url:`/api/datasources/${ue}/schema`,body:{tablesFilter:eo}}),createDatasource:async ue=>await to.post({url:"/api/datasources",body:ue}),updateDatasource:async ue=>await to.put({url:`/api/datasources/${ue._id}`,body:ue}),deleteDatasource:async(ue,eo)=>await to.delete({url:`/api/datasources/${ue}/${eo}`}),validateDatasource:async ue=>await to.post({url:"/api/datasources/verify",body:{datasource:ue}}),fetchInfoForDatasource:async ue=>await to.post({url:"/api/datasources/info",body:{datasource:ue}}),fetchExternalSchema:async ue=>await to.get({url:`/api/datasources/${ue}/schema/external`})}),buildFlagEndpoints=to=>({getFlags:async()=>await to.get({url:"/api/users/flags"}),updateFlag:async(ue,eo)=>await to.post({url:"/api/users/flags",body:{flag:ue,value:eo}}),toggleUiFeature:async ue=>await to.post({url:`/api/beta/${ue}`})}),buildLayoutEndpoints=to=>({saveLayout:async ue=>await to.post({url:"/api/layouts",body:ue}),deleteLayout:async(ue,eo)=>await to.delete({url:`/api/layouts/${ue}/${eo}`})}),buildOtherEndpoints=to=>({getEnvironment:async()=>await to.get({url:"/api/system/environment"}),getSystemStatus:async()=>await to.get({url:"/api/system/status"}),getIntegrations:async()=>await to.get({url:"/api/integrations"}),getBudibaseVersion:async()=>(await to.get({url:"/api/dev/version"})).version,getBasePermissions:async()=>await to.get({url:"/api/permission/builtin"})}),buildPermissionsEndpoints=to=>({getPermissionForResource:async ue=>await to.get({url:`/api/permission/${ue}`}),updatePermissionForResource:async(ue,eo,no)=>await to.post({url:`/api/permission/${eo}/${ue}/${no}`}),removePermissionFromResource:async(ue,eo,no)=>await to.delete({url:`/api/permission/${eo}/${ue}/${no}`}),getDependants:async ue=>await to.get({url:`/api/permission/${ue}/dependants`})}),buildQueryEndpoints=to=>({executeQuery:async(ue,{pagination:eo,parameters:no}={})=>await to.post({url:`/api/v2/queries/${ue}`,body:{parameters:no,pagination:eo}}),fetchQueryDefinition:async ue=>await to.get({url:`/api/queries/${ue}`,cache:!0}),getQueries:async()=>await to.get({url:"/api/queries"}),saveQuery:async ue=>await to.post({url:"/api/queries",body:ue}),deleteQuery:async(ue,eo)=>await to.delete({url:`/api/queries/${ue}/${eo}`}),importQueries:async ue=>await to.post({url:"/api/queries/import",body:ue}),previewQuery:async ue=>await to.post({url:"/api/queries/preview",body:ue})}),buildRelationshipEndpoints=to=>({fetchRelationshipData:async(ue,eo,no)=>{const ro=await to.get({url:`/api/${ue}/${eo}/enrich?field=${no}`});return no?ro[no]||[]:[ro]}}),buildRoleEndpoints=to=>({deleteRole:async(ue,eo)=>await to.delete({url:`/api/roles/${ue}/${eo}`}),saveRole:async ue=>await to.post({url:"/api/roles",body:ue}),getRoles:async()=>await to.get({url:"/api/roles"}),getRolesForApp:async ue=>await to.get({url:`/api/global/roles/${ue}`}),getAccessibleRoles:async()=>await to.get({url:"/api/roles/accessible"})}),buildRouteEndpoints=to=>({fetchClientAppRoutes:async()=>await to.get({url:"/api/routing/client"}),fetchAppRoutes:async()=>await to.get({url:"/api/routing"})}),buildRowEndpoints=to=>({fetchRow:async(ue,eo)=>await to.get({url:`/api/${ue}/rows/${eo}`}),saveRow:async(ue,eo=!1)=>{const no=ue._viewId||ue.tableId;return await to.post({url:`/api/${no}/rows`,body:ue,suppressErrors:eo})},patchRow:async(ue,eo=!1)=>{const no=ue._viewId||ue.tableId;return await to.patch({url:`/api/${no}/rows`,body:ue,suppressErrors:eo})},deleteRow:async(ue,eo)=>await to.delete({url:`/api/${ue}/rows`,body:{_id:eo}}),deleteRows:async(ue,eo)=>(eo.forEach(no=>{typeof no=="object"&&(no==null||delete no._viewId)}),await to.delete({url:`/api/${ue}/rows`,body:{rows:eo}})),exportRows:async(ue,eo,no)=>await to.post({url:`/api/${ue}/rows/exportRows?format=${eo}`,body:no,parseResponse:async ro=>await ro.text()})}),buildScreenEndpoints=to=>({saveScreen:async ue=>await to.post({url:"/api/screens",body:ue}),deleteScreen:async(ue,eo)=>await to.delete({url:`/api/screens/${ue}/${eo}`}),usageInScreens:async ue=>await to.post({url:`/api/screens/usage/${ue}`})}),buildTableEndpoints=to=>({fetchTableDefinition:async ue=>await to.get({url:`/api/tables/${ue}`,cache:!0}),fetchTableData:async ue=>await to.get({url:`/api/${ue}/rows`}),searchTable:async(ue,eo)=>await to.post({url:`/api/${ue}/search`,body:eo}),importTableData:async(ue,eo,no)=>await to.post({url:`/api/tables/${ue}/import`,body:{rows:eo,identifierFields:no}}),csvToJson:async ue=>await to.post({url:"/api/convert/csvToJson",body:{csvString:ue}}),getTables:async()=>await to.get({url:"/api/tables"}),getTable:async ue=>await to.get({url:`/api/tables/${ue}`}),saveTable:async ue=>await to.post({url:"/api/tables",body:ue}),deleteTable:async(ue,eo)=>await to.delete({url:`/api/tables/${ue}/${eo}`}),validateNewTableImport:async(ue,eo)=>await to.post({url:"/api/tables/validateNewTableImport",body:{rows:ue,schema:eo}}),validateExistingTableImport:async(ue,eo)=>await to.post({url:"/api/tables/validateExistingTableImport",body:{rows:ue,tableId:eo}}),migrateColumn:async(ue,eo,no)=>await to.post({url:`/api/tables/${ue}/migrate`,body:{oldColumn:eo,newColumn:no}})}),buildTemplateEndpoints=to=>({getEmailTemplateDefinitions:async()=>await to.get({url:"/api/global/template/definitions"}),getEmailTemplates:async()=>await to.get({url:"/api/global/template/email"}),saveEmailTemplate:async ue=>await to.post({url:"/api/global/template",body:ue}),getAppTemplates:async()=>await to.get({url:"/api/templates"})}),buildUserEndpoints=to=>({getUsers:async()=>await to.get({url:"/api/global/users"}),searchUsers:async ue=>await to.post({url:"/api/global/users/search",body:ue}),getUser:async ue=>await to.get({url:`/api/global/users/${ue}`}),updateOwnMetadata:async ue=>await to.post({url:"/api/users/metadata/self",body:ue}),createAdminUser:async ue=>await to.post({url:"/api/global/users/init",body:ue}),saveUser:async ue=>await to.post({url:"/api/global/users",body:ue}),createUsers:async(ue,eo)=>(await to.post({url:"/api/global/users/bulk",body:{create:{users:ue,groups:eo}}})).created,deleteUser:async ue=>await to.delete({url:`/api/global/users/${ue}`}),deleteUsers:async ue=>(await to.post({url:"/api/global/users/bulk",body:{delete:{users:ue}}})).deleted,onboardUsers:async ue=>await to.post({url:"/api/global/users/onboard",body:ue}),updateUserInvite:async(ue,eo)=>await to.post({url:`/api/global/users/invite/update/${ue}`,body:eo}),getUserInvite:async ue=>await to.get({url:`/api/global/users/invite/${ue}`}),getUserInvites:async()=>await to.get({url:"/api/global/users/invites"}),inviteUsers:async ue=>await to.post({url:"/api/global/users/multi/invite",body:ue}),removeUserInvites:async ue=>await to.post({url:"/api/global/users/multi/invite/delete",body:ue}),acceptInvite:async ue=>await to.post({url:"/api/global/users/invite/accept",body:ue}),getUserCountByApp:async ue=>(await to.get({url:`/api/global/users/count/${ue}`})).userCount,addAppBuilder:async(ue,eo)=>await to.post({url:`/api/global/users/${ue}/app/${eo}/builder`}),removeAppBuilder:async(ue,eo)=>await to.delete({url:`/api/global/users/${ue}/app/${eo}/builder`}),getAccountHolder:async()=>await to.get({url:"/api/global/users/accountholder"})}),buildSelfEndpoints=to=>({generateAPIKey:async()=>{const ue=await to.post({url:"/api/global/self/api_key"});return ue==null?void 0:ue.apiKey},fetchDeveloperInfo:async()=>to.get({url:"/api/global/self/api_key"}),fetchSelf:async()=>await to.get({url:"/api/self"}),fetchBuilderSelf:async()=>await to.get({url:"/api/global/self"}),updateSelf:async ue=>await to.post({url:"/api/global/self",body:ue})}),buildViewEndpoints=to=>({fetchViewData:async(ue,{field:eo,groupBy:no,calculation:ro})=>{const oo=new URLSearchParams;ro&&(eo&&oo.set("field",eo),oo.set("calculation",ro)),no&&oo.set("group",no);const io=eo?`/api/views/${encodeURIComponent(ue)}?${oo}`:`/api/views/${encodeURIComponent(ue)}`;return await to.get({url:io})},exportView:async(ue,eo)=>{const no=encodeURIComponent(ue);return await to.get({url:`/api/views/export?view=${no}&format=${eo}`,parseResponse:async ro=>await ro.text()})},saveView:async ue=>await to.post({url:"/api/views",body:ue}),deleteView:async ue=>await to.delete({url:`/api/views/${encodeURIComponent(ue)}`})}),buildViewV2Endpoints=to=>({fetchDefinition:async ue=>await to.get({url:`/api/v2/views/${encodeURIComponent(ue)}`,cache:!0}),create:async ue=>await to.post({url:"/api/v2/views",body:ue}),update:async ue=>await to.put({url:`/api/v2/views/${encodeURIComponent(ue.id)}`,body:ue}),fetch:async(ue,eo)=>await to.post({url:`/api/v2/views/${encodeURIComponent(ue)}/search`,body:eo}),delete:async ue=>await to.delete({url:`/api/v2/views/${encodeURIComponent(ue)}`})}),buildLicensingEndpoints=to=>({activateLicenseKey:async ue=>to.post({url:"/api/global/license/key",body:{licenseKey:ue}}),deleteLicenseKey:async()=>to.delete({url:"/api/global/license/key"}),getLicenseKey:async()=>{try{return await to.get({url:"/api/global/license/key"})}catch(ue){if(ue.status!==404)throw ue}},activateOfflineLicense:async ue=>to.post({url:"/api/global/license/offline",body:{offlineLicenseToken:ue}}),deleteOfflineLicense:async()=>to.delete({url:"/api/global/license/offline"}),getOfflineLicense:async()=>{try{return await to.get({url:"/api/global/license/offline"})}catch(ue){if(ue.status!==404)throw ue}},getOfflineLicenseIdentifier:async()=>await to.get({url:"/api/global/license/offline/identifier"}),refreshLicense:async()=>to.post({url:"/api/global/license/refresh"}),getQuotaUsage:async()=>to.get({url:"/api/global/license/usage"})}),buildGroupsEndpoints=to=>{async function ue(eo,no,ro,oo){return await to.post({url:`/api/global/groups/${eo}/${no}`,body:{[ro]:oo}})}return{saveGroup:async eo=>await to.post({url:"/api/global/groups",body:eo}),getGroups:async()=>(await to.get({url:"/api/global/groups"})).data,getGroup:async eo=>await to.get({url:`/api/global/groups/${eo}`}),deleteGroup:async(eo,no)=>await to.delete({url:`/api/global/groups/${eo}/${no}`}),getGroupUsers:async({id:eo,bookmark:no,emailSearch:ro})=>{let oo=`/api/global/groups/${eo}/users?`;return no&&(oo+=`bookmark=${no}&`),ro&&(oo+=`emailSearch=${ro}`),await to.get({url:oo})},addUsersToGroup:async(eo,no)=>ue(eo,"users","add",no),removeUsersFromGroup:async(eo,no)=>ue(eo,"users","remove",no),addAppsToGroup:async(eo,no)=>ue(eo,"apps","add",no),removeAppsFromGroup:async(eo,no)=>ue(eo,"apps","remove",no),addGroupAppBuilder:async(eo,no)=>await to.post({url:`/api/global/groups/${eo}/app/${no}/builder`}),removeGroupAppBuilder:async(eo,no)=>await to.delete({url:`/api/global/groups/${eo}/app/${no}/builder`})}},buildPluginEndpoints=to=>({uploadPlugin:async ue=>await to.post({url:"/api/plugin/upload",body:ue,json:!1}),createPlugin:async ue=>await to.post({url:"/api/plugin",body:ue}),getPlugins:async()=>await to.get({url:"/api/plugin"}),deletePlugin:async ue=>await to.delete({url:`/api/plugin/${ue}`})}),buildBackupEndpoints=to=>({createManualBackup:async ue=>await to.post({url:`/api/apps/${ue}/backups`}),searchBackups:async(ue,eo)=>await to.post({url:`/api/apps/${ue}/backups/search`,body:eo}),deleteBackup:async(ue,eo)=>await to.delete({url:`/api/apps/${ue}/backups/${eo}`}),restoreBackup:async(ue,eo,no)=>await to.post({url:`/api/apps/${ue}/backups/${eo}/import`,body:{name:no}})}),buildEnvironmentVariableEndpoints=to=>({checkEnvironmentVariableStatus:async()=>await to.get({url:"/api/env/variables/status"}),fetchEnvironmentVariables:async()=>await to.get({url:"/api/env/variables",json:!1}),createEnvironmentVariable:async ue=>await to.post({url:"/api/env/variables",body:ue}),deleteEnvironmentVariable:async ue=>await to.delete({url:`/api/env/variables/${ue}`}),updateEnvironmentVariable:async(ue,eo)=>await to.patch({url:`/api/env/variables/${ue}`,body:eo})}),buildEventEndpoints=to=>({publishEvent:async ue=>await to.post({url:"/api/global/event/publish",body:{type:ue}})}),buildAuditLogEndpoints=to=>({searchAuditLogs:async ue=>await to.post({url:"/api/global/auditlogs/search",body:ue}),getEventDefinitions:async()=>await to.get({url:"/api/global/auditlogs/definitions"}),getDownloadUrl:ue=>`/api/global/auditlogs/download?query=${encodeURIComponent(JSON.stringify(ue))}`}),buildLogsEndpoints=to=>({getSystemLogs:async()=>await to.get({url:"/api/system/logs",json:!1,parseResponse:async ue=>ue})}),buildMigrationEndpoints=to=>({getMigrationStatus:async()=>await to.get({url:"/api/migrations/status"})}),buildRowActionEndpoints=to=>({fetch:async ue=>(await to.get({url:`/api/tables/${ue}/actions`})).actions,create:async(ue,eo)=>await to.post({url:`/api/tables/${ue}/actions`,body:{name:eo}}),delete:async(ue,eo)=>await to.delete({url:`/api/tables/${ue}/actions/${eo}`}),enableView:async(ue,eo,no)=>await to.post({url:`/api/tables/${ue}/actions/${eo}/permissions/${no}`}),disableView:async(ue,eo,no)=>await to.delete({url:`/api/tables/${ue}/actions/${eo}/permissions/${no}`}),trigger:async(ue,eo,no)=>await to.post({url:`/api/tables/${ue}/actions/${eo}/trigger`,body:{rowId:no}})}),APISessionID=uuid$2(),createAPIClient=(to={})=>{let ue={};const eo=async(lo,co,uo=!1)=>{let fo=lo.statusText,po=null;try{po=await lo.json(),po!=null&&po.message?fo=po.message:po!=null&&po.error&&(fo=JSON.stringify(po.error))}catch{}return{message:fo,json:po,status:lo.status,url:lo.url,method:co,handled:!0,suppressErrors:uo}},no=(lo,co,uo)=>({message:lo,json:null,status:400,url:co,method:uo,handled:!0,suppressErrors:!1}),ro=async lo=>{let{json:co,method:uo,external:fo,body:po,url:ho,parseResponse:_o,suppressErrors:go}=lo;co=co&&uo!==HTTPMethod.GET;let bo={Accept:"application/json"};bo[Header$1.SESSION_ID]=APISessionID,fo||(bo[Header$1.API_VER]=ApiVersion),co&&(bo["Content-Type"]="application/json"),to!=null&&to.attachHeaders&&to.attachHeaders(bo);let vo=po;if(co)try{vo=JSON.stringify(po)}catch{throw no("Invalid JSON body",ho,uo)}let yo;try{yo=await fetch(ho,{method:uo,headers:bo,body:vo,credentials:"same-origin"})}catch{throw delete ue[ho],no("Failed to send request",ho,uo)}if(yo.status>=200&&yo.status<400){oo(yo);try{return yo.status===204?void 0:_o?await _o(yo):await yo.json()}catch($o){throw delete ue[ho],`Failed to parse response: ${$o}`}}else throw delete ue[ho],await eo(yo,uo,go)},oo=lo=>{if(!to.onMigrationDetected)return;const co=lo.headers.get(Header$1.MIGRATING_APP);co&&to.onMigrationDetected(co)},io=async lo=>{const co=lo.url;return ue[co]||(ue[co]=ro(lo),ue[co]=await ue[co]),await ue[co]},ao=lo=>async co=>{try{let uo={json:!0,external:!1,suppressErrors:!1,cache:!1,method:lo,...co},{url:fo,cache:po,external:ho}=uo;return ho||(uo.url=`/${fo}`.replace("//","/")),await(po&&(to==null?void 0:to.enableCaching)?io:ro)(uo)}catch(uo){throw to!=null&&to.onError&&to.onError(uo),uo}};let so={post:ao(HTTPMethod.POST),get:ao(HTTPMethod.GET),patch:ao(HTTPMethod.PATCH),delete:ao(HTTPMethod.DELETE),put:ao(HTTPMethod.PUT),invalidateCache:()=>{ue={}},getAppID:()=>{var co;let lo={};return(co=to==null?void 0:to.attachHeaders)==null||co.call(to,lo),lo==null?void 0:lo[Header$1.APP_ID]}};return{...so,...buildAIEndpoints(so),...buildAnalyticsEndpoints(so),...buildAppEndpoints(so),...buildAttachmentEndpoints(so),...buildAuthEndpoints(so),...buildAutomationEndpoints(so),...buildConfigEndpoints(so),...buildDatasourceEndpoints(so),...buildFlagEndpoints(so),...buildLayoutEndpoints(so),...buildOtherEndpoints(so),...buildPermissionsEndpoints(so),...buildQueryEndpoints(so),...buildRelationshipEndpoints(so),...buildRoleEndpoints(so),...buildRouteEndpoints(so),...buildRowEndpoints(so),...buildScreenEndpoints(so),...buildTableEndpoints(so),...buildTemplateEndpoints(so),...buildUserEndpoints(so),...buildViewEndpoints(so),...buildSelfEndpoints(so),...buildLicensingEndpoints(so),...buildGroupsEndpoints(so),...buildPluginEndpoints(so),...buildBackupEndpoints(so),...buildEnvironmentVariableEndpoints(so),...buildEventEndpoints(so),...buildAuditLogEndpoints(so),...buildLogsEndpoints(so),...buildMigrationEndpoints(so),viewV2:buildViewV2Endpoints(so),rowActions:buildRowActionEndpoints(so)}},getJSONArrayDatasourceSchema=(to,ue)=>{let eo=to,no=[];ue.prefixKeys&&(no=ue.prefixKeys.concat(["schema"])),no=no.concat(ue.label.split(".").slice(2));for(let ro=0;ro<no.length;ro++)eo=eo==null?void 0:eo[no[ro]],eo!=null&&eo.schema&&(eo=eo.schema);return convertJSONSchemaToTableSchema(eo,{squashObjects:!0,prefixKeys:no})},convertJSONSchemaToTableSchema=(to,ue)=>{if(!to)return null;ue={squashObjects:!1,prefixKeys:null,...ue},to.schema?to=to.schema:to={value:to};const eo=extractJSONSchemaKeys(to,ue.squashObjects);let no={};return eo.forEach(({key:ro,type:oo})=>{no[ro]={type:oo,name:ro,prefixKeys:ue.prefixKeys}}),no},extractJSONSchemaKeys=(to,ue=!1)=>{if(!to||!Object.keys(to).length)return[];let eo=[];return Object.keys(to).forEach(no=>{const ro=to[no].type;if(ro==="json"&&ue){const oo=extractJSONSchemaKeys(to[no].schema,ue);eo=eo.concat(oo.map(io=>({key:`${no}.${io.key}`,type:io.type})))}else eo.push({key:no,type:ro==="array"?"jsonarray":ro})}),eo},generateQueryArraySchemas=(to,ue)=>{var eo,no;for(let ro in to)((eo=to[ro])==null?void 0:eo.type)==="json"&&((no=to[ro])==null?void 0:no.subtype)==="array"&&hasSchema(ue[ro])&&(to[ro]={schema:{schema:Object.entries(ue[ro]||{}).reduce((oo,[io,ao])=>(oo[io]={name:io,type:ao.type,subtype:ao.subtype},oo),{}),type:"json"},type:"json",subtype:"array"});return to};function setCookie(to,ue,eo){getCookie(to)&&removeCookie(to);let no=`${to}=${ue}; Path=/;`;eo&&(no+=` Domain=${eo};`),window.document.cookie=no}function getCookie(to){const eo=`; ${document.cookie}`.split(`; ${to}=`);if(eo.length===2)return eo[1].split(";").shift()}function removeCookie(to){getCookie(to)&&(document.cookie=`${to}=; Max-Age=-99999999; Path=/;`)}const RolePriorities={[Roles$2.ADMIN]:5,[Roles$2.CREATOR]:4,[Roles$2.POWER]:3,[Roles$2.BASIC]:2,[Roles$2.PUBLIC]:1},getRolePriority=to=>RolePriorities[to]??0,sleep$2=to=>new Promise(ue=>setTimeout(ue,to)),sequential=to=>{let ue=[];return(...no)=>new Promise((ro,oo)=>{ue.push(async()=>{let io,ao;try{io=await to(...no)}catch(so){ao=so}ue.shift(),ue.length&&ue[0](),ao?oo(ao):ro(io)}),ue.length===1&&ue[0]()})},debounce=(to,ue=1e3)=>{let eo;return async(...no)=>new Promise(ro=>{eo&&clearTimeout(eo),eo=setTimeout(async()=>{ro(await to(...no))},ue)})},domDebounce=to=>{let ue=!1,eo;return(...no)=>{eo=no,ue||(ue=!0,requestAnimationFrame(()=>{to(...eo),ue=!1}))}},buildFormBlockButtonConfig=to=>{const{_id:ue,actionType:eo,dataSource:no,notificationOverride:ro,actionUrl:oo,showDeleteButton:io,deleteButtonLabel:ao,showSaveButton:so,saveButtonLabel:lo}=to||{};if(!ue)return;const co=`${ue}-form`,uo=`${ue}-repeater`,fo=no==null?void 0:no.resourceId,po=io===!1?"":ao==null?void 0:ao.trim(),ho=so===!1?"":lo==null?void 0:lo.trim(),_o=[{"##eventHandlerType":"Validate Form",parameters:{componentId:co}},{"##eventHandlerType":"Save Row",parameters:{providerId:co,tableId:fo,notificationOverride:ro,confirm:null}},{"##eventHandlerType":"Close Screen Modal"},{"##eventHandlerType":"Close Side Panel"},{"##eventHandlerType":"Close Modal"},...eo!=="Create"?[]:[{"##eventHandlerType":"Clear Form",parameters:{componentId:co}}],...oo?[{"##eventHandlerType":"Navigate To",parameters:{url:oo}}]:[]],go=[{"##eventHandlerType":"Delete Row",parameters:{confirm:!0,tableId:fo,rowId:`{{ ${makePropSafe(uo)}.${makePropSafe("_id")} }}`,revId:`{{ ${makePropSafe(uo)}.${makePropSafe("_rev")} }}`,notificationOverride:ro}},{"##eventHandlerType":"Close Screen Modal"},{"##eventHandlerType":"Close Side Panel"},{"##eventHandlerType":"Close Modal"},...oo?[{"##eventHandlerType":"Navigate To",parameters:{url:oo}}]:[]],bo=[];return eo&&["Update","Create"].includes(eo)&&so!==!1&&bo.push({text:ho||"Save",_id:uuid$2(),_component:"@budibase/standard-components/button",onClick:_o,type:"cta"}),eo==="Update"&&io!==!1&&bo.push({text:po||"Delete",_id:uuid$2(),_component:"@budibase/standard-components/button",onClick:go,quiet:!0,type:"warning"}),bo},buildMultiStepFormBlockDefaultProps=to=>{const{_id:ue,stepCount:eo,currentStep:no,actionType:ro,dataSource:oo}=to||{};if(!ue||!eo)return;const io=`Step {{ [${ue}-form].[__currentStep] }}`,ao=oo==null?void 0:oo.resourceId,so=`${ue}-form`;let lo=[];return no!==0&&lo.push({_id:uuid$2(),_component:"@budibase/standard-components/button",_instanceName:uuid$2(),text:"Back",type:"secondary",size:"M",onClick:[{parameters:{type:"prev",componentId:so},"##eventHandlerType":"Change Form Step"}]}),no!==eo-1&&lo.push({_id:uuid$2(),_component:"@budibase/standard-components/button",_instanceName:uuid$2(),text:"Next",type:"cta",size:"M",onClick:[{"##eventHandlerType":"Validate Form",parameters:{componentId:so}},{parameters:{type:"next",componentId:so},"##eventHandlerType":"Change Form Step"}]}),ro!=="View"&&no===eo-1&&lo.push({_id:uuid$2(),_component:"@budibase/standard-components/button",_instanceName:uuid$2(),text:"Save",type:"cta",size:"M",onClick:[{"##eventHandlerType":"Validate Form",parameters:{componentId:so}},{"##eventHandlerType":"Save Row",parameters:{tableId:ao,providerId:so}},...ro!=="Create"?[]:[{"##eventHandlerType":"Clear Form",parameters:{componentId:so}}]]}),{buttons:lo,title:io}};function parseFilter(to){var eo;if(!(to!=null&&to.groups))return to;const ue=lodashExports.cloneDeep(to);return ue.groups=(eo=ue.groups)==null?void 0:eo.map(no=>{var ro,oo;return no.filters=(ro=no.filters)==null?void 0:ro.filter(io=>io.field&&io.operator),(oo=no.filters)!=null&&oo.length?no:null}).filter(no=>!!no),ue}const isBetterSample=(to,ue)=>{if(ue==null&&to!=null)return!0;if(ue!=null&&to==null)return!1;const eo=typeof ue,no=typeof to;return eo!==no?!1:no==="string"&&to.length>ue.length||no==="object"&&Object.keys(to).length>Object.keys(ue).length},generateGoldenSample=to=>{let ue={};return to==null||to.slice(0,100).forEach(eo=>{Object.keys(eo).forEach(no=>{isBetterSample(eo[no],ue[no])&&(ue[no]=eo[no])})}),ue};function getTableFields(to,ue){const eo=to.find(ro=>ro._id===ue.tableId);return!eo||!eo.sql?[]:getFields(to,Object.values(eo.schema),{allowLinks:!1}).map(ro=>({...ro,name:`${ue.name}.${ro.name}`}))}function getFields(to,ue,{allowLinks:eo}={allowLinks:!0}){let no=ue.filter(oo=>!BannedSearchTypes.includes(oo.type));if(eo){const oo=ue.filter(io=>io.type==="link");for(let io of oo)no=no.concat(getTableFields(to,io))}const ro=ue.filter(oo=>oo.type==="formula"&&oo.formulaType==="static");return no.concat(ro)}const getColumnIcon=to=>{if(to.schema.icon)return to.schema.icon;if(to.calculationType)return"Calculator";if(to.schema.autocolumn)return"MagicWand";if(isDeprecatedSingleUserColumn(to.schema))return"User";const{type:ue,subtype:eo}=to.schema;return(typeof TypeIconMap$1[ue]=="object"&&eo?TypeIconMap$1[ue][eo]:TypeIconMap$1[ue])||"Text"},memo=to=>{const ue=writable(to);let eo=JSON.stringify(to);const no=ro=>{const oo=JSON.stringify(ro);oo!==eo&&(ue.set(ro),eo=oo)};return{subscribe:ue.subscribe,set:no,update:ro=>{let oo=JSON.parse(eo);const io=ro(oo);no(io)}}},derivedMemo=(to,ue)=>{const eo=derived(to,ue),no=memo(get_store_value(eo));return eo.subscribe(no.set),no},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(to=>{PACKET_TYPES_REVERSE[PACKET_TYPES[to]]=to});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=to=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(to):to&&to.buffer instanceof ArrayBuffer,encodePacket=({type:to,data:ue},eo,no)=>withNativeBlob$1&&ue instanceof Blob?eo?no(ue):encodeBlobAsBase64(ue,no):withNativeArrayBuffer$2&&(ue instanceof ArrayBuffer||isView$1(ue))?eo?no(ue):encodeBlobAsBase64(new Blob([ue]),no):no(PACKET_TYPES[to]+(ue||"")),encodeBlobAsBase64=(to,ue)=>{const eo=new FileReader;return eo.onload=function(){const no=eo.result.split(",")[1];ue("b"+(no||""))},eo.readAsDataURL(to)};function toArray$2(to){return to instanceof Uint8Array?to:to instanceof ArrayBuffer?new Uint8Array(to):new Uint8Array(to.buffer,to.byteOffset,to.byteLength)}let TEXT_ENCODER;function encodePacketToBinary(to,ue){if(withNativeBlob$1&&to.data instanceof Blob)return to.data.arrayBuffer().then(toArray$2).then(ue);if(withNativeArrayBuffer$2&&(to.data instanceof ArrayBuffer||isView$1(to.data)))return ue(toArray$2(to.data));encodePacket(to,!1,eo=>{TEXT_ENCODER||(TEXT_ENCODER=new TextEncoder),ue(TEXT_ENCODER.encode(eo))})}const chars="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",lookup$2=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let to=0;to<chars.length;to++)lookup$2[chars.charCodeAt(to)]=to;const decode$3=to=>{let ue=to.length*.75,eo=to.length,no,ro=0,oo,io,ao,so;to[to.length-1]==="="&&(ue--,to[to.length-2]==="="&&ue--);const lo=new ArrayBuffer(ue),co=new Uint8Array(lo);for(no=0;no<eo;no+=4)oo=lookup$2[to.charCodeAt(no)],io=lookup$2[to.charCodeAt(no+1)],ao=lookup$2[to.charCodeAt(no+2)],so=lookup$2[to.charCodeAt(no+3)],co[ro++]=oo<<2|io>>4,co[ro++]=(io&15)<<4|ao>>2,co[ro++]=(ao&3)<<6|so&63;return lo},withNativeArrayBuffer$1=typeof ArrayBuffer=="function",decodePacket=(to,ue)=>{if(typeof to!="string")return{type:"message",data:mapBinary(to,ue)};const eo=to.charAt(0);return eo==="b"?{type:"message",data:decodeBase64Packet(to.substring(1),ue)}:PACKET_TYPES_REVERSE[eo]?to.length>1?{type:PACKET_TYPES_REVERSE[eo],data:to.substring(1)}:{type:PACKET_TYPES_REVERSE[eo]}:ERROR_PACKET},decodeBase64Packet=(to,ue)=>{if(withNativeArrayBuffer$1){const eo=decode$3(to);return mapBinary(eo,ue)}else return{base64:!0,data:to}},mapBinary=(to,ue)=>{switch(ue){case"blob":return to instanceof Blob?to:new Blob([to]);case"arraybuffer":default:return to instanceof ArrayBuffer?to:to.buffer}},SEPARATOR=String.fromCharCode(30),encodePayload=(to,ue)=>{const eo=to.length,no=new Array(eo);let ro=0;to.forEach((oo,io)=>{encodePacket(oo,!1,ao=>{no[io]=ao,++ro===eo&&ue(no.join(SEPARATOR))})})},decodePayload=(to,ue)=>{const eo=to.split(SEPARATOR),no=[];for(let ro=0;ro<eo.length;ro++){const oo=decodePacket(eo[ro],ue);if(no.push(oo),oo.type==="error")break}return no};function createPacketEncoderStream(){return new TransformStream({transform(to,ue){encodePacketToBinary(to,eo=>{const no=eo.length;let ro;if(no<126)ro=new Uint8Array(1),new DataView(ro.buffer).setUint8(0,no);else if(no<65536){ro=new Uint8Array(3);const oo=new DataView(ro.buffer);oo.setUint8(0,126),oo.setUint16(1,no)}else{ro=new Uint8Array(9);const oo=new DataView(ro.buffer);oo.setUint8(0,127),oo.setBigUint64(1,BigInt(no))}to.data&&typeof to.data!="string"&&(ro[0]|=128),ue.enqueue(ro),ue.enqueue(eo)})}})}let TEXT_DECODER;function totalLength(to){return to.reduce((ue,eo)=>ue+eo.length,0)}function concatChunks(to,ue){if(to[0].length===ue)return to.shift();const eo=new Uint8Array(ue);let no=0;for(let ro=0;ro<ue;ro++)eo[ro]=to[0][no++],no===to[0].length&&(to.shift(),no=0);return to.length&&no<to[0].length&&(to[0]=to[0].slice(no)),eo}function createPacketDecoderStream(to,ue){TEXT_DECODER||(TEXT_DECODER=new TextDecoder);const eo=[];let no=0,ro=-1,oo=!1;return new TransformStream({transform(io,ao){for(eo.push(io);;){if(no===0){if(totalLength(eo)<1)break;const so=concatChunks(eo,1);oo=(so[0]&128)===128,ro=so[0]&127,ro<126?no=3:ro===126?no=1:no=2}else if(no===1){if(totalLength(eo)<2)break;const so=concatChunks(eo,2);ro=new DataView(so.buffer,so.byteOffset,so.length).getUint16(0),no=3}else if(no===2){if(totalLength(eo)<8)break;const so=concatChunks(eo,8),lo=new DataView(so.buffer,so.byteOffset,so.length),co=lo.getUint32(0);if(co>Math.pow(2,53-32)-1){ao.enqueue(ERROR_PACKET);break}ro=co*Math.pow(2,32)+lo.getUint32(4),no=3}else{if(totalLength(eo)<ro)break;const so=concatChunks(eo,ro);ao.enqueue(decodePacket(oo?so:TEXT_DECODER.decode(so),ue)),no=0}if(ro===0||ro>to){ao.enqueue(ERROR_PACKET);break}}}})}const protocol$1=4;function Emitter(to){if(to)return mixin(to)}function mixin(to){for(var ue in Emitter.prototype)to[ue]=Emitter.prototype[ue];return to}Emitter.prototype.on=Emitter.prototype.addEventListener=function(to,ue){return this._callbacks=this._callbacks||{},(this._callbacks["$"+to]=this._callbacks["$"+to]||[]).push(ue),this};Emitter.prototype.once=function(to,ue){function eo(){this.off(to,eo),ue.apply(this,arguments)}return eo.fn=ue,this.on(to,eo),this};Emitter.prototype.off=Emitter.prototype.removeListener=Emitter.prototype.removeAllListeners=Emitter.prototype.removeEventListener=function(to,ue){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var eo=this._callbacks["$"+to];if(!eo)return this;if(arguments.length==1)return delete this._callbacks["$"+to],this;for(var no,ro=0;ro<eo.length;ro++)if(no=eo[ro],no===ue||no.fn===ue){eo.splice(ro,1);break}return eo.length===0&&delete this._callbacks["$"+to],this};Emitter.prototype.emit=function(to){this._callbacks=this._callbacks||{};for(var ue=new Array(arguments.length-1),eo=this._callbacks["$"+to],no=1;no<arguments.length;no++)ue[no-1]=arguments[no];if(eo){eo=eo.slice(0);for(var no=0,ro=eo.length;no<ro;++no)eo[no].apply(this,ue)}return this};Emitter.prototype.emitReserved=Emitter.prototype.emit;Emitter.prototype.listeners=function(to){return this._callbacks=this._callbacks||{},this._callbacks["$"+to]||[]};Emitter.prototype.hasListeners=function(to){return!!this.listeners(to).length};const globalThisShim=(()=>typeof self<"u"?self:typeof window<"u"?window:Function("return this")())();function pick$1(to,...ue){return ue.reduce((eo,no)=>(to.hasOwnProperty(no)&&(eo[no]=to[no]),eo),{})}const NATIVE_SET_TIMEOUT=globalThisShim.setTimeout,NATIVE_CLEAR_TIMEOUT=globalThisShim.clearTimeout;function installTimerFunctions(to,ue){ue.useNativeTimers?(to.setTimeoutFn=NATIVE_SET_TIMEOUT.bind(globalThisShim),to.clearTimeoutFn=NATIVE_CLEAR_TIMEOUT.bind(globalThisShim)):(to.setTimeoutFn=globalThisShim.setTimeout.bind(globalThisShim),to.clearTimeoutFn=globalThisShim.clearTimeout.bind(globalThisShim))}const BASE64_OVERHEAD=1.33;function byteLength(to){return typeof to=="string"?utf8Length(to):Math.ceil((to.byteLength||to.size)*BASE64_OVERHEAD)}function utf8Length(to){let ue=0,eo=0;for(let no=0,ro=to.length;no<ro;no++)ue=to.charCodeAt(no),ue<128?eo+=1:ue<2048?eo+=2:ue<55296||ue>=57344?eo+=3:(no++,eo+=4);return eo}function encode$3(to){let ue="";for(let eo in to)to.hasOwnProperty(eo)&&(ue.length&&(ue+="&"),ue+=encodeURIComponent(eo)+"="+encodeURIComponent(to[eo]));return ue}function decode$2(to){let ue={},eo=to.split("&");for(let no=0,ro=eo.length;no<ro;no++){let oo=eo[no].split("=");ue[decodeURIComponent(oo[0])]=decodeURIComponent(oo[1])}return ue}class TransportError extends Error{constructor(ue,eo,no){super(ue),this.description=eo,this.context=no,this.type="TransportError"}}class Transport extends Emitter{constructor(ue){super(),this.writable=!1,installTimerFunctions(this,ue),this.opts=ue,this.query=ue.query,this.socket=ue.socket}onError(ue,eo,no){return super.emitReserved("error",new TransportError(ue,eo,no)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(ue){this.readyState==="open"&&this.write(ue)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(ue){const eo=decodePacket(ue,this.socket.binaryType);this.onPacket(eo)}onPacket(ue){super.emitReserved("packet",ue)}onClose(ue){this.readyState="closed",super.emitReserved("close",ue)}pause(ue){}createUri(ue,eo={}){return ue+"://"+this._hostname()+this._port()+this.opts.path+this._query(eo)}_hostname(){const ue=this.opts.hostname;return ue.indexOf(":")===-1?ue:"["+ue+"]"}_port(){return this.opts.port&&(this.opts.secure&&+(this.opts.port!==443)||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(ue){const eo=encode$3(ue);return eo.length?"?"+eo:""}}const alphabet="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_".split(""),length=64,map={};let seed=0,i$2=0,prev;function encode$2(to){let ue="";do ue=alphabet[to%length]+ue,to=Math.floor(to/length);while(to>0);return ue}function yeast(){const to=encode$2(+new Date);return to!==prev?(seed=0,prev=to):to+"."+encode$2(seed++)}for(;i$2<length;i$2++)map[alphabet[i$2]]=i$2;let value$1=!1;try{value$1=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch(to){}const hasCORS=value$1;function XHR(to){const ue=to.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!ue||hasCORS))return new XMLHttpRequest}catch{}if(!ue)try{return new globalThisShim[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}function createCookieJar(){}function empty$1(){}const hasXHR2=function(){return new XHR({xdomain:!1}).responseType!=null}();class Polling extends Transport{constructor(ue){if(super(ue),this.polling=!1,typeof location<"u"){const no=location.protocol==="https:";let ro=location.port;ro||(ro=no?"443":"80"),this.xd=typeof location<"u"&&ue.hostname!==location.hostname||ro!==ue.port}const eo=ue&&ue.forceBase64;this.supportsBinary=hasXHR2&&!eo,this.opts.withCredentials&&(this.cookieJar=void 0)}get name(){return"polling"}doOpen(){this.poll()}pause(ue){this.readyState="pausing";const eo=()=>{this.readyState="paused",ue()};if(this.polling||!this.writable){let no=0;this.polling&&(no++,this.once("pollComplete",function(){--no||eo()})),this.writable||(no++,this.once("drain",function(){--no||eo()}))}else eo()}poll(){this.polling=!0,this.doPoll(),this.emitReserved("poll")}onData(ue){const eo=no=>{if(this.readyState==="opening"&&no.type==="open"&&this.onOpen(),no.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(no)};decodePayload(ue,this.socket.binaryType).forEach(eo),this.readyState!=="closed"&&(this.polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this.poll())}doClose(){const ue=()=>{this.write([{type:"close"}])};this.readyState==="open"?ue():this.once("open",ue)}write(ue){this.writable=!1,encodePayload(ue,eo=>{this.doWrite(eo,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const ue=this.opts.secure?"https":"http",eo=this.query||{};return this.opts.timestampRequests!==!1&&(eo[this.opts.timestampParam]=yeast()),!this.supportsBinary&&!eo.sid&&(eo.b64=1),this.createUri(ue,eo)}request(ue={}){return Object.assign(ue,{xd:this.xd,cookieJar:this.cookieJar},this.opts),new Request(this.uri(),ue)}doWrite(ue,eo){const no=this.request({method:"POST",data:ue});no.on("success",eo),no.on("error",(ro,oo)=>{this.onError("xhr post error",ro,oo)})}doPoll(){const ue=this.request();ue.on("data",this.onData.bind(this)),ue.on("error",(eo,no)=>{this.onError("xhr poll error",eo,no)}),this.pollXhr=ue}}class Request extends Emitter{constructor(ue,eo){super(),installTimerFunctions(this,eo),this.opts=eo,this.method=eo.method||"GET",this.uri=ue,this.data=eo.data!==void 0?eo.data:null,this.create()}create(){var ue;const eo=pick$1(this.opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");eo.xdomain=!!this.opts.xd;const no=this.xhr=new XHR(eo);try{no.open(this.method,this.uri,!0);try{if(this.opts.extraHeaders){no.setDisableHeaderCheck&&no.setDisableHeaderCheck(!0);for(let ro in this.opts.extraHeaders)this.opts.extraHeaders.hasOwnProperty(ro)&&no.setRequestHeader(ro,this.opts.extraHeaders[ro])}}catch{}if(this.method==="POST")try{no.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{no.setRequestHeader("Accept","*/*")}catch{}(ue=this.opts.cookieJar)===null||ue===void 0||ue.addCookies(no),"withCredentials"in no&&(no.withCredentials=this.opts.withCredentials),this.opts.requestTimeout&&(no.timeout=this.opts.requestTimeout),no.onreadystatechange=()=>{var ro;no.readyState===3&&((ro=this.opts.cookieJar)===null||ro===void 0||ro.parseCookies(no)),no.readyState===4&&(no.status===200||no.status===1223?this.onLoad():this.setTimeoutFn(()=>{this.onError(typeof no.status=="number"?no.status:0)},0))},no.send(this.data)}catch(ro){this.setTimeoutFn(()=>{this.onError(ro)},0);return}typeof document<"u"&&(this.index=Request.requestsCount++,Request.requests[this.index]=this)}onError(ue){this.emitReserved("error",ue,this.xhr),this.cleanup(!0)}cleanup(ue){if(!(typeof this.xhr>"u"||this.xhr===null)){if(this.xhr.onreadystatechange=empty$1,ue)try{this.xhr.abort()}catch{}typeof document<"u"&&delete Request.requests[this.index],this.xhr=null}}onLoad(){const ue=this.xhr.responseText;ue!==null&&(this.emitReserved("data",ue),this.emitReserved("success"),this.cleanup())}abort(){this.cleanup()}}Request.requestsCount=0;Request.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",unloadHandler);else if(typeof addEventListener=="function"){const to="onpagehide"in globalThisShim?"pagehide":"unload";addEventListener(to,unloadHandler,!1)}}function unloadHandler(){for(let to in Request.requests)Request.requests.hasOwnProperty(to)&&Request.requests[to].abort()}const nextTick=(()=>typeof Promise=="function"&&typeof Promise.resolve=="function"?ue=>Promise.resolve().then(ue):(ue,eo)=>eo(ue,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(ue){super(ue),this.supportsBinary=!ue.forceBase64}get name(){return"websocket"}doOpen(){if(!this.check())return;const ue=this.uri(),eo=this.opts.protocols,no=isReactNative?{}:pick$1(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(no.headers=this.opts.extraHeaders);try{this.ws=usingBrowserWebSocket&&!isReactNative?eo?new WebSocket(ue,eo):new WebSocket(ue):new WebSocket(ue,eo,no)}catch(ro){return this.emitReserved("error",ro)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=ue=>this.onClose({description:"websocket connection closed",context:ue}),this.ws.onmessage=ue=>this.onData(ue.data),this.ws.onerror=ue=>this.onError("websocket error",ue)}write(ue){this.writable=!1;for(let eo=0;eo<ue.length;eo++){const no=ue[eo],ro=eo===ue.length-1;encodePacket(no,this.supportsBinary,oo=>{const io={};try{usingBrowserWebSocket&&this.ws.send(oo)}catch{}ro&&nextTick(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.close(),this.ws=null)}uri(){const ue=this.opts.secure?"wss":"ws",eo=this.query||{};return this.opts.timestampRequests&&(eo[this.opts.timestampParam]=yeast()),this.supportsBinary||(eo.b64=1),this.createUri(ue,eo)}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(ue=>{this.onError("webtransport error",ue)}),this.transport.ready.then(()=>{this.transport.createBidirectionalStream().then(ue=>{const eo=createPacketDecoderStream(Number.MAX_SAFE_INTEGER,this.socket.binaryType),no=ue.readable.pipeThrough(eo).getReader(),ro=createPacketEncoderStream();ro.readable.pipeTo(ue.writable),this.writer=ro.writable.getWriter();const oo=()=>{no.read().then(({done:ao,value:so})=>{ao||(this.onPacket(so),oo())}).catch(ao=>{})};oo();const io={type:"open"};this.query.sid&&(io.data=`{"sid":"${this.query.sid}"}`),this.writer.write(io).then(()=>this.onOpen())})}))}write(ue){this.writable=!1;for(let eo=0;eo<ue.length;eo++){const no=ue[eo],ro=eo===ue.length-1;this.writer.write(no).then(()=>{ro&&nextTick(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var ue;(ue=this.transport)===null||ue===void 0||ue.close()}}const transports={websocket:WS,webtransport:WT,polling:Polling},re$1=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(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$9(to){if(to.length>2e3)throw"URI too long";const ue=to,eo=to.indexOf("["),no=to.indexOf("]");eo!=-1&&no!=-1&&(to=to.substring(0,eo)+to.substring(eo,no).replace(/:/g,";")+to.substring(no,to.length));let ro=re$1.exec(to||""),oo={},io=14;for(;io--;)oo[parts[io]]=ro[io]||"";return eo!=-1&&no!=-1&&(oo.source=ue,oo.host=oo.host.substring(1,oo.host.length-1).replace(/;/g,":"),oo.authority=oo.authority.replace("[","").replace("]","").replace(/;/g,":"),oo.ipv6uri=!0),oo.pathNames=pathNames(oo,oo.path),oo.queryKey=queryKey(oo,oo.query),oo}function pathNames(to,ue){const eo=/\/{2,9}/g,no=ue.replace(eo,"/").split("/");return(ue.slice(0,1)=="/"||ue.length===0)&&no.splice(0,1),ue.slice(-1)=="/"&&no.splice(no.length-1,1),no}function queryKey(to,ue){const eo={};return ue.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(no,ro,oo){ro&&(eo[ro]=oo)}),eo}let Socket$1=class vh extends Emitter{constructor(ue,eo={}){super(),this.binaryType=defaultBinaryType,this.writeBuffer=[],ue&&typeof ue=="object"&&(eo=ue,ue=null),ue?(ue=parse$9(ue),eo.hostname=ue.host,eo.secure=ue.protocol==="https"||ue.protocol==="wss",eo.port=ue.port,ue.query&&(eo.query=ue.query)):eo.host&&(eo.hostname=parse$9(eo.host).host),installTimerFunctions(this,eo),this.secure=eo.secure!=null?eo.secure:typeof location<"u"&&location.protocol==="https:",eo.hostname&&!eo.port&&(eo.port=this.secure?"443":"80"),this.hostname=eo.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=eo.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=eo.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},eo),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=decode$2(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(ue){const eo=Object.assign({},this.opts.query);eo.EIO=protocol$1,eo.transport=ue,this.id&&(eo.sid=this.id);const no=Object.assign({},this.opts,{query:eo,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[ue]);return new transports[ue](no)}open(){let ue;if(this.opts.rememberUpgrade&&vh.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1)ue="websocket";else if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}else ue=this.transports[0];this.readyState="opening";try{ue=this.createTransport(ue)}catch{this.transports.shift(),this.open();return}ue.open(),this.setTransport(ue)}setTransport(ue){this.transport&&this.transport.removeAllListeners(),this.transport=ue,ue.on("drain",this.onDrain.bind(this)).on("packet",this.onPacket.bind(this)).on("error",this.onError.bind(this)).on("close",eo=>this.onClose("transport close",eo))}probe(ue){let eo=this.createTransport(ue),no=!1;vh.priorWebsocketSuccess=!1;const ro=()=>{no||(eo.send([{type:"ping",data:"probe"}]),eo.once("packet",uo=>{if(!no)if(uo.type==="pong"&&uo.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",eo),!eo)return;vh.priorWebsocketSuccess=eo.name==="websocket",this.transport.pause(()=>{no||this.readyState!=="closed"&&(co(),this.setTransport(eo),eo.send([{type:"upgrade"}]),this.emitReserved("upgrade",eo),eo=null,this.upgrading=!1,this.flush())})}else{const fo=new Error("probe error");fo.transport=eo.name,this.emitReserved("upgradeError",fo)}}))};function oo(){no||(no=!0,co(),eo.close(),eo=null)}const io=uo=>{const fo=new Error("probe error: "+uo);fo.transport=eo.name,oo(),this.emitReserved("upgradeError",fo)};function ao(){io("transport closed")}function so(){io("socket closed")}function lo(uo){eo&&uo.name!==eo.name&&oo()}const co=()=>{eo.removeListener("open",ro),eo.removeListener("error",io),eo.removeListener("close",ao),this.off("close",so),this.off("upgrading",lo)};eo.once("open",ro),eo.once("error",io),eo.once("close",ao),this.once("close",so),this.once("upgrading",lo),this.upgrades.indexOf("webtransport")!==-1&&ue!=="webtransport"?this.setTimeoutFn(()=>{no||eo.open()},200):eo.open()}onOpen(){if(this.readyState="open",vh.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush(),this.readyState==="open"&&this.opts.upgrade){let ue=0;const eo=this.upgrades.length;for(;ue<eo;ue++)this.probe(this.upgrades[ue])}}onPacket(ue){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",ue),this.emitReserved("heartbeat"),this.resetPingTimeout(),ue.type){case"open":this.onHandshake(JSON.parse(ue.data));break;case"ping":this.sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong");break;case"error":const eo=new Error("server error");eo.code=ue.data,this.onError(eo);break;case"message":this.emitReserved("data",ue.data),this.emitReserved("message",ue.data);break}}onHandshake(ue){this.emitReserved("handshake",ue),this.id=ue.sid,this.transport.query.sid=ue.sid,this.upgrades=this.filterUpgrades(ue.upgrades),this.pingInterval=ue.pingInterval,this.pingTimeout=ue.pingTimeout,this.maxPayload=ue.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 ue=this.getWritablePackets();this.transport.send(ue),this.prevBufferLen=ue.length,this.emitReserved("flush")}}getWritablePackets(){if(!(this.maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let eo=1;for(let no=0;no<this.writeBuffer.length;no++){const ro=this.writeBuffer[no].data;if(ro&&(eo+=byteLength(ro)),no>0&&eo>this.maxPayload)return this.writeBuffer.slice(0,no);eo+=2}return this.writeBuffer}write(ue,eo,no){return this.sendPacket("message",ue,eo,no),this}send(ue,eo,no){return this.sendPacket("message",ue,eo,no),this}sendPacket(ue,eo,no,ro){if(typeof eo=="function"&&(ro=eo,eo=void 0),typeof no=="function"&&(ro=no,no=null),this.readyState==="closing"||this.readyState==="closed")return;no=no||{},no.compress=no.compress!==!1;const oo={type:ue,data:eo,options:no};this.emitReserved("packetCreate",oo),this.writeBuffer.push(oo),ro&&this.once("flush",ro),this.flush()}close(){const ue=()=>{this.onClose("forced close"),this.transport.close()},eo=()=>{this.off("upgrade",eo),this.off("upgradeError",eo),ue()},no=()=>{this.once("upgrade",eo),this.once("upgradeError",eo)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?no():ue()}):this.upgrading?no():ue()),this}onError(ue){vh.priorWebsocketSuccess=!1,this.emitReserved("error",ue),this.onClose("transport error",ue)}onClose(ue,eo){(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",ue,eo),this.writeBuffer=[],this.prevBufferLen=0)}filterUpgrades(ue){const eo=[];let no=0;const ro=ue.length;for(;no<ro;no++)~this.transports.indexOf(ue[no])&&eo.push(ue[no]);return eo}};Socket$1.protocol=protocol$1;function url$1(to,ue="",eo){let no=to;eo=eo||typeof location<"u"&&location,to==null&&(to=eo.protocol+"//"+eo.host),typeof to=="string"&&(to.charAt(0)==="/"&&(to.charAt(1)==="/"?to=eo.protocol+to:to=eo.host+to),/^(https?|wss?):\/\//.test(to)||(typeof eo<"u"?to=eo.protocol+"//"+to:to="https://"+to),no=parse$9(to)),no.port||(/^(http|ws)$/.test(no.protocol)?no.port="80":/^(http|ws)s$/.test(no.protocol)&&(no.port="443")),no.path=no.path||"/";const oo=no.host.indexOf(":")!==-1?"["+no.host+"]":no.host;return no.id=no.protocol+"://"+oo+":"+no.port+ue,no.href=no.protocol+"://"+oo+(eo&&eo.port===no.port?"":":"+no.port),no}const withNativeArrayBuffer=typeof ArrayBuffer=="function",isView=to=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(to):to.buffer instanceof ArrayBuffer,toString$5=Object.prototype.toString,withNativeBlob=typeof Blob=="function"||typeof Blob<"u"&&toString$5.call(Blob)==="[object BlobConstructor]",withNativeFile=typeof File=="function"||typeof File<"u"&&toString$5.call(File)==="[object FileConstructor]";function isBinary(to){return withNativeArrayBuffer&&(to instanceof ArrayBuffer||isView(to))||withNativeBlob&&to instanceof Blob||withNativeFile&&to instanceof File}function hasBinary(to,ue){if(!to||typeof to!="object")return!1;if(Array.isArray(to)){for(let eo=0,no=to.length;eo<no;eo++)if(hasBinary(to[eo]))return!0;return!1}if(isBinary(to))return!0;if(to.toJSON&&typeof to.toJSON=="function"&&arguments.length===1)return hasBinary(to.toJSON(),!0);for(const eo in to)if(Object.prototype.hasOwnProperty.call(to,eo)&&hasBinary(to[eo]))return!0;return!1}function deconstructPacket(to){const ue=[],eo=to.data,no=to;return no.data=_deconstructPacket(eo,ue),no.attachments=ue.length,{packet:no,buffers:ue}}function _deconstructPacket(to,ue){if(!to)return to;if(isBinary(to)){const eo={_placeholder:!0,num:ue.length};return ue.push(to),eo}else if(Array.isArray(to)){const eo=new Array(to.length);for(let no=0;no<to.length;no++)eo[no]=_deconstructPacket(to[no],ue);return eo}else if(typeof to=="object"&&!(to instanceof Date)){const eo={};for(const no in to)Object.prototype.hasOwnProperty.call(to,no)&&(eo[no]=_deconstructPacket(to[no],ue));return eo}return to}function reconstructPacket(to,ue){return to.data=_reconstructPacket(to.data,ue),delete to.attachments,to}function _reconstructPacket(to,ue){if(!to)return to;if(to&&to._placeholder===!0){if(typeof to.num=="number"&&to.num>=0&&to.num<ue.length)return ue[to.num];throw new Error("illegal attachments")}else if(Array.isArray(to))for(let eo=0;eo<to.length;eo++)to[eo]=_reconstructPacket(to[eo],ue);else if(typeof to=="object")for(const eo in to)Object.prototype.hasOwnProperty.call(to,eo)&&(to[eo]=_reconstructPacket(to[eo],ue));return to}const RESERVED_EVENTS$1=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"],protocol=5;var PacketType;(function(to){to[to.CONNECT=0]="CONNECT",to[to.DISCONNECT=1]="DISCONNECT",to[to.EVENT=2]="EVENT",to[to.ACK=3]="ACK",to[to.CONNECT_ERROR=4]="CONNECT_ERROR",to[to.BINARY_EVENT=5]="BINARY_EVENT",to[to.BINARY_ACK=6]="BINARY_ACK"})(PacketType||(PacketType={}));class Encoder{constructor(ue){this.replacer=ue}encode(ue){return(ue.type===PacketType.EVENT||ue.type===PacketType.ACK)&&hasBinary(ue)?this.encodeAsBinary({type:ue.type===PacketType.EVENT?PacketType.BINARY_EVENT:PacketType.BINARY_ACK,nsp:ue.nsp,data:ue.data,id:ue.id}):[this.encodeAsString(ue)]}encodeAsString(ue){let eo=""+ue.type;return(ue.type===PacketType.BINARY_EVENT||ue.type===PacketType.BINARY_ACK)&&(eo+=ue.attachments+"-"),ue.nsp&&ue.nsp!=="/"&&(eo+=ue.nsp+","),ue.id!=null&&(eo+=ue.id),ue.data!=null&&(eo+=JSON.stringify(ue.data,this.replacer)),eo}encodeAsBinary(ue){const eo=deconstructPacket(ue),no=this.encodeAsString(eo.packet),ro=eo.buffers;return ro.unshift(no),ro}}function isObject$7(to){return Object.prototype.toString.call(to)==="[object Object]"}class Decoder extends Emitter{constructor(ue){super(),this.reviver=ue}add(ue){let eo;if(typeof ue=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");eo=this.decodeString(ue);const no=eo.type===PacketType.BINARY_EVENT;no||eo.type===PacketType.BINARY_ACK?(eo.type=no?PacketType.EVENT:PacketType.ACK,this.reconstructor=new BinaryReconstructor(eo),eo.attachments===0&&super.emitReserved("decoded",eo)):super.emitReserved("decoded",eo)}else if(isBinary(ue)||ue.base64)if(this.reconstructor)eo=this.reconstructor.takeBinaryData(ue),eo&&(this.reconstructor=null,super.emitReserved("decoded",eo));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+ue)}decodeString(ue){let eo=0;const no={type:Number(ue.charAt(0))};if(PacketType[no.type]===void 0)throw new Error("unknown packet type "+no.type);if(no.type===PacketType.BINARY_EVENT||no.type===PacketType.BINARY_ACK){const oo=eo+1;for(;ue.charAt(++eo)!=="-"&&eo!=ue.length;);const io=ue.substring(oo,eo);if(io!=Number(io)||ue.charAt(eo)!=="-")throw new Error("Illegal attachments");no.attachments=Number(io)}if(ue.charAt(eo+1)==="/"){const oo=eo+1;for(;++eo&&!(ue.charAt(eo)===","||eo===ue.length););no.nsp=ue.substring(oo,eo)}else no.nsp="/";const ro=ue.charAt(eo+1);if(ro!==""&&Number(ro)==ro){const oo=eo+1;for(;++eo;){const io=ue.charAt(eo);if(io==null||Number(io)!=io){--eo;break}if(eo===ue.length)break}no.id=Number(ue.substring(oo,eo+1))}if(ue.charAt(++eo)){const oo=this.tryParse(ue.substr(eo));if(Decoder.isPayloadValid(no.type,oo))no.data=oo;else throw new Error("invalid payload")}return no}tryParse(ue){try{return JSON.parse(ue,this.reviver)}catch{return!1}}static isPayloadValid(ue,eo){switch(ue){case PacketType.CONNECT:return isObject$7(eo);case PacketType.DISCONNECT:return eo===void 0;case PacketType.CONNECT_ERROR:return typeof eo=="string"||isObject$7(eo);case PacketType.EVENT:case PacketType.BINARY_EVENT:return Array.isArray(eo)&&(typeof eo[0]=="number"||typeof eo[0]=="string"&&RESERVED_EVENTS$1.indexOf(eo[0])===-1);case PacketType.ACK:case PacketType.BINARY_ACK:return Array.isArray(eo)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class BinaryReconstructor{constructor(ue){this.packet=ue,this.buffers=[],this.reconPack=ue}takeBinaryData(ue){if(this.buffers.push(ue),this.buffers.length===this.reconPack.attachments){const eo=reconstructPacket(this.reconPack,this.buffers);return this.finishedReconstruction(),eo}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}const parser$3=Object.freeze(Object.defineProperty({__proto__:null,Decoder,Encoder,get PacketType(){return PacketType},protocol},Symbol.toStringTag,{value:"Module"}));function on$1(to,ue,eo){return to.on(ue,eo),function(){to.off(ue,eo)}}const RESERVED_EVENTS=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class Socket extends Emitter{constructor(ue,eo,no){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=ue,this.nsp=eo,no&&no.auth&&(this.auth=no.auth),this._opts=Object.assign({},no),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const ue=this.io;this.subs=[on$1(ue,"open",this.onopen.bind(this)),on$1(ue,"packet",this.onpacket.bind(this)),on$1(ue,"error",this.onerror.bind(this)),on$1(ue,"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(...ue){return ue.unshift("message"),this.emit.apply(this,ue),this}emit(ue,...eo){if(RESERVED_EVENTS.hasOwnProperty(ue))throw new Error('"'+ue.toString()+'" is a reserved event name');if(eo.unshift(ue),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(eo),this;const no={type:PacketType.EVENT,data:eo};if(no.options={},no.options.compress=this.flags.compress!==!1,typeof eo[eo.length-1]=="function"){const io=this.ids++,ao=eo.pop();this._registerAckCallback(io,ao),no.id=io}const ro=this.io.engine&&this.io.engine.transport&&this.io.engine.transport.writable;return this.flags.volatile&&(!ro||!this.connected)||(this.connected?(this.notifyOutgoingListeners(no),this.packet(no)):this.sendBuffer.push(no)),this.flags={},this}_registerAckCallback(ue,eo){var no;const ro=(no=this.flags.timeout)!==null&&no!==void 0?no:this._opts.ackTimeout;if(ro===void 0){this.acks[ue]=eo;return}const oo=this.io.setTimeoutFn(()=>{delete this.acks[ue];for(let ao=0;ao<this.sendBuffer.length;ao++)this.sendBuffer[ao].id===ue&&this.sendBuffer.splice(ao,1);eo.call(this,new Error("operation has timed out"))},ro),io=(...ao)=>{this.io.clearTimeoutFn(oo),eo.apply(this,ao)};io.withError=!0,this.acks[ue]=io}emitWithAck(ue,...eo){return new Promise((no,ro)=>{const oo=(io,ao)=>io?ro(io):no(ao);oo.withError=!0,eo.push(oo),this.emit(ue,...eo)})}_addToQueue(ue){let eo;typeof ue[ue.length-1]=="function"&&(eo=ue.pop());const no={id:this._queueSeq++,tryCount:0,pending:!1,args:ue,flags:Object.assign({fromQueue:!0},this.flags)};ue.push((ro,...oo)=>no!==this._queue[0]?void 0:(ro!==null?no.tryCount>this._opts.retries&&(this._queue.shift(),eo&&eo(ro)):(this._queue.shift(),eo&&eo(null,...oo)),no.pending=!1,this._drainQueue())),this._queue.push(no),this._drainQueue()}_drainQueue(ue=!1){if(!this.connected||this._queue.length===0)return;const eo=this._queue[0];eo.pending&&!ue||(eo.pending=!0,eo.tryCount++,this.flags=eo.flags,this.emit.apply(this,eo.args))}packet(ue){ue.nsp=this.nsp,this.io._packet(ue)}onopen(){typeof this.auth=="function"?this.auth(ue=>{this._sendConnectPacket(ue)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(ue){this.packet({type:PacketType.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},ue):ue})}onerror(ue){this.connected||this.emitReserved("connect_error",ue)}onclose(ue,eo){this.connected=!1,delete this.id,this.emitReserved("disconnect",ue,eo),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(ue=>{if(!this.sendBuffer.some(no=>String(no.id)===ue)){const no=this.acks[ue];delete this.acks[ue],no.withError&&no.call(this,new Error("socket has been disconnected"))}})}onpacket(ue){if(ue.nsp===this.nsp)switch(ue.type){case PacketType.CONNECT:ue.data&&ue.data.sid?this.onconnect(ue.data.sid,ue.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(ue);break;case PacketType.ACK:case PacketType.BINARY_ACK:this.onack(ue);break;case PacketType.DISCONNECT:this.ondisconnect();break;case PacketType.CONNECT_ERROR:this.destroy();const no=new Error(ue.data.message);no.data=ue.data.data,this.emitReserved("connect_error",no);break}}onevent(ue){const eo=ue.data||[];ue.id!=null&&eo.push(this.ack(ue.id)),this.connected?this.emitEvent(eo):this.receiveBuffer.push(Object.freeze(eo))}emitEvent(ue){if(this._anyListeners&&this._anyListeners.length){const eo=this._anyListeners.slice();for(const no of eo)no.apply(this,ue)}super.emit.apply(this,ue),this._pid&&ue.length&&typeof ue[ue.length-1]=="string"&&(this._lastOffset=ue[ue.length-1])}ack(ue){const eo=this;let no=!1;return function(...ro){no||(no=!0,eo.packet({type:PacketType.ACK,id:ue,data:ro}))}}onack(ue){const eo=this.acks[ue.id];typeof eo=="function"&&(delete this.acks[ue.id],eo.withError&&ue.data.unshift(null),eo.apply(this,ue.data))}onconnect(ue,eo){this.id=ue,this.recovered=eo&&this._pid===eo,this._pid=eo,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach(ue=>this.emitEvent(ue)),this.receiveBuffer=[],this.sendBuffer.forEach(ue=>{this.notifyOutgoingListeners(ue),this.packet(ue)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(ue=>ue()),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(ue){return this.flags.compress=ue,this}get volatile(){return this.flags.volatile=!0,this}timeout(ue){return this.flags.timeout=ue,this}onAny(ue){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(ue),this}prependAny(ue){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(ue),this}offAny(ue){if(!this._anyListeners)return this;if(ue){const eo=this._anyListeners;for(let no=0;no<eo.length;no++)if(ue===eo[no])return eo.splice(no,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(ue){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(ue),this}prependAnyOutgoing(ue){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(ue),this}offAnyOutgoing(ue){if(!this._anyOutgoingListeners)return this;if(ue){const eo=this._anyOutgoingListeners;for(let no=0;no<eo.length;no++)if(ue===eo[no])return eo.splice(no,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(ue){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const eo=this._anyOutgoingListeners.slice();for(const no of eo)no.apply(this,ue.data)}}}function Backoff(to){to=to||{},this.ms=to.min||100,this.max=to.max||1e4,this.factor=to.factor||2,this.jitter=to.jitter>0&&to.jitter<=1?to.jitter:0,this.attempts=0}Backoff.prototype.duration=function(){var to=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var ue=Math.random(),eo=Math.floor(ue*this.jitter*to);to=Math.floor(ue*10)&1?to+eo:to-eo}return Math.min(to,this.max)|0};Backoff.prototype.reset=function(){this.attempts=0};Backoff.prototype.setMin=function(to){this.ms=to};Backoff.prototype.setMax=function(to){this.max=to};Backoff.prototype.setJitter=function(to){this.jitter=to};class Manager extends Emitter{constructor(ue,eo){var no;super(),this.nsps={},this.subs=[],ue&&typeof ue=="object"&&(eo=ue,ue=void 0),eo=eo||{},eo.path=eo.path||"/socket.io",this.opts=eo,installTimerFunctions(this,eo),this.reconnection(eo.reconnection!==!1),this.reconnectionAttempts(eo.reconnectionAttempts||1/0),this.reconnectionDelay(eo.reconnectionDelay||1e3),this.reconnectionDelayMax(eo.reconnectionDelayMax||5e3),this.randomizationFactor((no=eo.randomizationFactor)!==null&&no!==void 0?no:.5),this.backoff=new Backoff({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(eo.timeout==null?2e4:eo.timeout),this._readyState="closed",this.uri=ue;const ro=eo.parser||parser$3;this.encoder=new ro.Encoder,this.decoder=new ro.Decoder,this._autoConnect=eo.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(ue){return arguments.length?(this._reconnection=!!ue,this):this._reconnection}reconnectionAttempts(ue){return ue===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=ue,this)}reconnectionDelay(ue){var eo;return ue===void 0?this._reconnectionDelay:(this._reconnectionDelay=ue,(eo=this.backoff)===null||eo===void 0||eo.setMin(ue),this)}randomizationFactor(ue){var eo;return ue===void 0?this._randomizationFactor:(this._randomizationFactor=ue,(eo=this.backoff)===null||eo===void 0||eo.setJitter(ue),this)}reconnectionDelayMax(ue){var eo;return ue===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=ue,(eo=this.backoff)===null||eo===void 0||eo.setMax(ue),this)}timeout(ue){return arguments.length?(this._timeout=ue,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(ue){if(~this._readyState.indexOf("open"))return this;this.engine=new Socket$1(this.uri,this.opts);const eo=this.engine,no=this;this._readyState="opening",this.skipReconnect=!1;const ro=on$1(eo,"open",function(){no.onopen(),ue&&ue()}),oo=ao=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",ao),ue?ue(ao):this.maybeReconnectOnOpen()},io=on$1(eo,"error",oo);if(this._timeout!==!1){const ao=this._timeout,so=this.setTimeoutFn(()=>{ro(),oo(new Error("timeout")),eo.close()},ao);this.opts.autoUnref&&so.unref(),this.subs.push(()=>{this.clearTimeoutFn(so)})}return this.subs.push(ro),this.subs.push(io),this}connect(ue){return this.open(ue)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const ue=this.engine;this.subs.push(on$1(ue,"ping",this.onping.bind(this)),on$1(ue,"data",this.ondata.bind(this)),on$1(ue,"error",this.onerror.bind(this)),on$1(ue,"close",this.onclose.bind(this)),on$1(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(ue){try{this.decoder.add(ue)}catch(eo){this.onclose("parse error",eo)}}ondecoded(ue){nextTick(()=>{this.emitReserved("packet",ue)},this.setTimeoutFn)}onerror(ue){this.emitReserved("error",ue)}socket(ue,eo){let no=this.nsps[ue];return no?this._autoConnect&&!no.active&&no.connect():(no=new Socket(this,ue,eo),this.nsps[ue]=no),no}_destroy(ue){const eo=Object.keys(this.nsps);for(const no of eo)if(this.nsps[no].active)return;this._close()}_packet(ue){const eo=this.encoder.encode(ue);for(let no=0;no<eo.length;no++)this.engine.write(eo[no],ue.options)}cleanup(){this.subs.forEach(ue=>ue()),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(ue,eo){this.cleanup(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",ue,eo),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const ue=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const eo=this.backoff.duration();this._reconnecting=!0;const no=this.setTimeoutFn(()=>{ue.skipReconnect||(this.emitReserved("reconnect_attempt",ue.backoff.attempts),!ue.skipReconnect&&ue.open(ro=>{ro?(ue._reconnecting=!1,ue.reconnect(),this.emitReserved("reconnect_error",ro)):ue.onreconnect()}))},eo);this.opts.autoUnref&&no.unref(),this.subs.push(()=>{this.clearTimeoutFn(no)})}}onreconnect(){const ue=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",ue)}}const cache$1={};function lookup$1(to,ue){typeof to=="object"&&(ue=to,to=void 0),ue=ue||{};const eo=url$1(to,ue.path||"/socket.io"),no=eo.source,ro=eo.id,oo=eo.path,io=cache$1[ro]&&oo in cache$1[ro].nsps,ao=ue.forceNew||ue["force new connection"]||ue.multiplex===!1||io;let so;return ao?so=new Manager(no,ue):(cache$1[ro]||(cache$1[ro]=new Manager(no,ue)),so=cache$1[ro]),eo.query&&!ue.query&&(ue.query=eo.queryKey),so.socket(eo.path,ue)}Object.assign(lookup$1,{Manager,Socket,io:lookup$1,connect:lookup$1});const DefaultOptions={heartbeat:!0},createWebsocket=(to,ue=DefaultOptions)=>{if(!to)throw"A websocket path must be provided";const{heartbeat:eo}={...DefaultOptions,...ue},no=location.protocol==="https:",ro=no?"wss:":"ws:",oo=location.hostname,io=location.port||(no?443:80);let ao=lookup$1(`${ro}//${oo}:${io}`,{path:to,reconnectionAttempts:3,reconnectionDelay:5e3,reconnectionDelayMax:5e3,timeout:4e3,transports:["websocket"]}),so;return eo&&(so=setInterval(()=>{ao.emit(SocketEvent.Heartbeat)},SocketSessionTTL*500)),ao.on("disconnect",()=>{clearInterval(so)}),ao.onOther=(lo,co)=>{ao.on(lo,uo=>{(uo==null?void 0:uo.apiSessionId)!==APISessionID&&co(uo)})},ao},defaultColors={keyColor:"dimgray",numberColor:"lightskyblue",stringColor:"lightcoral",trueColor:"lightseagreen",falseColor:"#f66578",nullColor:"cornflowerblue"},entityMap={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`","=":"="};function escapeHtml(to){return String(to).replace(/[&<>"'`=]/g,function(ue){return entityMap[ue]})}function format$1(to,ue={}){const eo=typeof to;let no=typeof to=="string"?to:JSON.stringify(to,null,2)||eo,ro=Object.assign({},defaultColors,ue);return no=no.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">"),no.replace(/("(\\u[a-zA-Z0-9]{4}|\\[^u]|[^\\"])*"(\s*:)?|\b(true|false|null)\b|-?\d+(?:\.\d*)?(?:[eE][+]?\d+)?)/g,oo=>{let io=ro.numberColor,ao="";return/^"/.test(oo)?/:$/.test(oo)?io=ro.keyColor:(io=ro.stringColor,oo='"'+escapeHtml(oo.substr(1,oo.length-2))+'"',ao="word-wrap:break-word;white-space:pre-wrap;"):io=/true/.test(oo)?ro.trueColor:/false/.test(oo)?ro.falseColor:/null/.test(oo)?ro.nullColor:io,`<span style="${ao}color:${io}">${oo}</span>`})}const extractFileNameRegex=/filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/;function downloadText(to,ue){typeof ue=="object"&&(ue=JSON.stringify(ue));const eo=new Blob([ue],{type:"plain/text"}),no=URL.createObjectURL(eo),ro=document.createElement("a");ro.href=no,ro.download=to,ro.click(),URL.revokeObjectURL(no)}async function downloadStream(to){const ue=await to.blob(),eo=to.headers.get("Content-Disposition"),ro=extractFileNameRegex.exec(eo)[1].replace(/['"]/g,""),oo=new Blob([ue]),io=URL.createObjectURL(oo),ao=document.createElement("a");ao.href=io,ao.download=ro,ao.click(),URL.revokeObjectURL(io)}async function downloadFile(to,ue){const eo=await fetch(to,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(ue)});if(eo.ok){const no=eo.headers.get("Content-Disposition"),oo=extractFileNameRegex.exec(no)[1].replace(/['"]/g,""),io=URL.createObjectURL(await eo.blob()),ao=document.createElement("a");return ao.href=io,ao.download=oo,ao.click(),URL.revokeObjectURL(io),!0}else return!1}const shouldDisplaySetting=(to,ue)=>{let eo=ue.dependsOn;return eo&&!Array.isArray(eo)&&(eo=[eo]),eo!=null&&eo.length?eo.every(no=>{let ro=no,oo=null,io=!!no.invert;if(typeof no=="object"&&(ro=no.setting,oo=no.value),!ro)return!1;Array.isArray(oo)||(oo=[oo]);const ao=deepGet$1(to,ro);return oo.some(lo=>lo==null?ao!=null&&ao!==!1&&ao!=="":lo===ao)!==io}):!0},columnTypeManyTypeOverrides={[FieldType.DATETIME]:FieldType.STRING,[FieldType.BOOLEAN]:FieldType.STRING,[FieldType.SIGNATURE_SINGLE]:FieldType.ATTACHMENTS},columnTypeManyParser={[FieldType.DATETIME]:(to,ue)=>{function eo(no){const{timeOnly:ro,dateOnly:oo}=ue||{},io=!oo,ao=parseDate(no,{enableTime:io});return getDateDisplayValue(ao,{enableTime:io,timeOnly:ro})}return to.map(no=>eo(no))},[FieldType.BOOLEAN]:to=>to.map(ue=>!!ue),[FieldType.BB_REFERENCE_SINGLE]:to=>[...new Map(to.map(ue=>[ue._id,ue])).values()],[FieldType.BB_REFERENCE]:to=>[...new Map(to.map(ue=>[ue._id,ue])).values()],[FieldType.ARRAY]:to=>Array.from(new Set(to))};function enrichSchemaWithRelColumns(to){return Object.keys(to).reduce((eo,no)=>{const ro=to[no];if(eo[no]=ro,ro.visible!==!1&&isRelationshipField(ro)&&ro.columns){const oo=(ro==null?void 0:ro.relationshipType)===RelationshipType.ONE_TO_MANY;for(const io of Object.keys(ro.columns)){const ao=ro.columns[io];if(!ao.visible)continue;const so=`${ro.name}.${io}`;eo[so]={...ao,type:ao.type,name:so,related:{field:no,subField:io},cellRenderType:!oo&&columnTypeManyTypeOverrides[ao.type]||ao.type}}}return eo},{})}function getRelatedTableValues(to,ue,eo){var oo,io,ao,so;const no=isRelationshipField(eo)&&(eo==null?void 0:eo.relationshipType)===RelationshipType.ONE_TO_MANY;let ro="";if(no)ro=(io=(oo=to[ue.related.field])==null?void 0:oo[0])==null?void 0:io[ue.related.subField];else{const lo=columnTypeManyParser[ue.type]||(fo=>fo),co=(so=(ao=to[ue.related.field])==null?void 0:ao.flatMap(fo=>fo[ue.related.subField]))==null?void 0:so.filter(fo=>fo!=null),uo=lo(co||[],ue);ro=uo,[FieldType.STRING,FieldType.NUMBER,FieldType.BIGINT,FieldType.BOOLEAN,FieldType.DATETIME,FieldType.LONGFORM,FieldType.BARCODEQR].includes(ue.type)&&(ro=uo==null?void 0:uo.join(", "))}return ro}function canBeDisplayColumn(to){return!(!canBeDisplayColumn$1(to.type)||to.related)}function canBeSortColumn(to){return to.calculationType?!0:!(!canBeSortColumn$1(to.type)||to.related)}const getSettingsDefinition=to=>{var eo;if(!to)return[];let ue=[];return(eo=to.settings)==null||eo.forEach(no=>{var ro;no.section?ue=ue.concat((ro=no.settings||[])==null?void 0:ro.map(oo=>({...oo,sectionDependsOn:no.dependsOn}))):ue.push(no)}),ue},{buildQuery,limit:queryLimit,runQuery,sort:sort$2}=QueryUtils;class BaseDataFetch{constructor(ue){pc(this,"API");pc(this,"features");pc(this,"options");pc(this,"store");pc(this,"derivedStore");if(this.features={supportsSearch:!1,supportsSort:!1,supportsPagination:!1},this.options={datasource:ue.datasource,limit:10,filter:null,query:ue.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:ue.query,pageNumber:0,cursor:null,cursors:[],resetKey:Math.random().toString(),error:null}),this.API=ue==null?void 0:ue.API,this.options={...this.options,...ue},!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,eo=>({...eo,...this.features,hasNextPage:this.hasNextPage(eo),hasPrevPage:this.hasPrevPage(eo)})),!this.options.datasource){this.store.update(eo=>({...eo,loaded:!0}));return}}get subscribe(){return this.derivedStore.subscribe}getDefaultSortColumn(ue,eo){return ue!=null&&ue.primaryDisplay&&eo[ue.primaryDisplay]?ue.primaryDisplay:Object.keys(eo)[0]}async getInitialData(){const{filter:ue,paginate:eo}=this.options,no=await this.getDefinition(),ro=await this.determineFeatureFlags();this.features={supportsSearch:!!(ro!=null&&ro.supportsSearch),supportsSort:!!(ro!=null&&ro.supportsSort),supportsPagination:eo&&!!(ro!=null&&ro.supportsPagination)};let oo=this.getSchema(no);if(!oo)return;if(oo=this.enrichSchema(oo),this.options.sortColumn&&!oo[this.options.sortColumn]&&(this.options.sortColumn=null),this.options.sortColumn||(this.options.sortColumn=this.getDefaultSortColumn(no,oo)),!this.options.sortColumn)this.options.sortOrder=SortOrder.ASCENDING,this.options.sortType=null;else{this.options.sortType=SortType.STRING;const so=oo==null?void 0:oo[this.options.sortColumn];((so==null?void 0:so.type)===FieldType.NUMBER||(so==null?void 0:so.type)===FieldType.BIGINT||"calculationType"in so&&(so!=null&&so.calculationType))&&(this.options.sortType=SortType.NUMBER),this.options.sortOrder?this.options.sortOrder=this.options.sortOrder.toLowerCase():this.options.sortOrder=SortOrder.ASCENDING}let io=this.options.query;io||(io=buildQuery(ue??void 0)),this.store.update(so=>({...so,definition:no,schema:oo,query:io,loading:!0,cursors:[],cursor:null}));const ao=await this.getPage();this.store.update(so=>({...so,loading:!1,loaded:!0,pageNumber:0,rows:ao.rows,info:ao.info,cursors:eo&&ao.hasNextPage?[null,ao.cursor]:[null],error:ao.error,resetKey:Math.random().toString()}))}async getPage(){const{sortColumn:ue,sortOrder:eo,sortType:no,limit:ro,clientSideSearching:oo,clientSideSorting:io,clientSideLimiting:ao}=this.options,{query:so}=get_store_value(this.store);let{rows:lo,info:co,hasNextPage:uo,cursor:fo,error:po}=await this.getData();return!this.features.supportsSearch&&oo&&(lo=runQuery(lo,so)),!this.features.supportsSort&&io&&no&&(lo=sort$2(lo,ue,eo,no)),!this.features.supportsPagination&&ao&&(lo=queryLimit(lo,ro)),{rows:lo,info:co,hasNextPage:uo,cursor:fo,error:po}}getSchema(ue){return(ue==null?void 0:ue.schema)??void 0}enrichSchema(ue){let eo={};for(const ro of Object.keys(ue)){const oo=ue[ro];if(oo.type===FieldType.JSON){const io=convertJSONSchemaToTableSchema(oo,{squashObjects:!0});if(io)for(const ao of Object.keys(io))eo[`${ro}.${ao}`]={type:io[ao].type,nestedJSON:!0}}}let no={};return Object.entries({...ue,...eo}).forEach(([ro,oo])=>{typeof oo=="string"?no[ro]={type:oo,name:ro}:no[ro]={...oo,type:oo.type,name:ro}}),no}async determineFeatureFlags(){return{supportsSearch:!1,supportsSort:!1,supportsPagination:!1}}async update(ue){let eo=!1;for(const[no,ro]of Object.entries(ue||{})){const oo=this.options[no]??null;if(JSON.stringify(ro??null)!==JSON.stringify(oo)){eo=!0;break}}eo&&(this.options={...this.options,...fp$1.cloneDeep(ue)},await this.getInitialData())}async refresh(){if(get_store_value(this.store).loading)return;this.store.update(so=>({...so,loading:!0}));const{rows:ue,info:eo,error:no,cursor:ro}=await this.getPage();let{cursors:oo}=get_store_value(this.store);const{pageNumber:io}=get_store_value(this.store);if(!ue.length&&io>0)return this.store.update(so=>({...so,loading:!1,cursors:oo.slice(0,io)})),await this.prevPage();oo[io+1]!=ro&&(oo=oo.slice(0,io+1),oo[io+1]=ro),this.store.update(so=>({...so,rows:ue,info:eo,loading:!1,error:no,cursors:oo}))}hasNextPage(ue){return ue.cursors[ue.pageNumber+1]!=null}hasPrevPage(ue){return ue.pageNumber>0}async nextPage(){const ue=get_store_value(this.derivedStore);if(ue.loading||!this.options.paginate||!ue.hasNextPage)return;const eo=ue.cursors[ue.pageNumber+1];this.store.update(so=>({...so,loading:!0,cursor:eo,pageNumber:so.pageNumber+1}));const{rows:no,info:ro,hasNextPage:oo,cursor:io,error:ao}=await this.getPage();this.store.update(so=>{let{cursors:lo,pageNumber:co}=so;return oo&&(lo[co+1]=io),{...so,rows:no,info:ro,cursors:lo,loading:!1,error:ao}})}async prevPage(){const ue=get_store_value(this.derivedStore);if(ue.loading||!this.options.paginate||!ue.hasPrevPage)return;const eo=ue.cursors[ue.pageNumber-1];this.store.update(io=>({...io,loading:!0,cursor:eo,pageNumber:io.pageNumber-1}));const{rows:no,info:ro,error:oo}=await this.getPage();this.store.update(io=>({...io,rows:no,info:ro,loading:!1,error:oo}))}}class TableFetch extends BaseDataFetch{async determineFeatureFlags(){return{supportsSearch:!0,supportsSort:!0,supportsPagination:!0}}async getDefinition(){const{datasource:ue}=this.options;if(!(ue!=null&&ue.tableId))return null;try{return await this.API.fetchTableDefinition(ue.tableId)}catch(eo){return this.store.update(no=>({...no,error:eo})),null}}async getData(){const{datasource:ue,limit:eo,sortColumn:no,sortOrder:ro,sortType:oo,paginate:io}=this.options,{tableId:ao}=ue,{cursor:so,query:lo}=get_store_value(this.store);try{const co=await this.API.searchTable(ao,{query:lo,limit:eo,sort:no,sortOrder:ro??SortOrder.ASCENDING,sortType:oo,paginate:io,bookmark:so});return{rows:(co==null?void 0:co.rows)||[],hasNextPage:(co==null?void 0:co.hasNextPage)||!1,cursor:(co==null?void 0:co.bookmark)||null}}catch(co){return{rows:[],hasNextPage:!1,error:co}}}}class ViewFetch extends BaseDataFetch{async getDefinition(){const{datasource:ue}=this.options;if(!(ue!=null&&ue.tableId))return null;try{return await this.API.fetchTableDefinition(ue.tableId)}catch(eo){return this.store.update(no=>({...no,error:eo})),null}}getSchema(ue){var no,ro;const{datasource:eo}=this.options;return(ro=(no=ue==null?void 0:ue.views)==null?void 0:no[eo==null?void 0:eo.name])==null?void 0:ro.schema}async getData(){const{datasource:ue}=this.options;try{return{rows:await this.API.fetchViewData(ue.name,{calculation:ue.calculation,field:ue.field,groupBy:ue.groupBy,tableId:ue.tableId})||[]}}catch(eo){return console.error(eo,{datasource:ue}),{rows:[]}}}}class ViewV2Fetch extends BaseDataFetch{async determineFeatureFlags(){return{supportsSearch:!0,supportsSort:!0,supportsPagination:!0}}async getDefinition(){const{datasource:ue}=this.options;try{const eo=await this.API.viewV2.fetchDefinition(ue.id);return eo==null?void 0:eo.data}catch(eo){return this.store.update(no=>({...no,error:eo})),null}}getDefaultSortColumn(){return null}async getData(){var co;const{datasource:ue,limit:eo,sortColumn:no,sortOrder:ro,sortType:oo,paginate:io}=this.options,{cursor:ao,query:so,definition:lo}=get_store_value(this.store);if((lo==null?void 0:lo.type)===ViewV2Type.CALCULATION&&!Object.values(lo.schema||{}).some(isCalculationField))return{rows:[],hasNextPage:!1,cursor:null,error:null};!no&&((co=lo==null?void 0:lo.sort)!=null&&co.field)&&(this.options.sortColumn=lo.sort.field,this.options.sortOrder=lo.sort.order||SortOrder.ASCENDING);try{const uo={query:so,paginate:io,limit:eo,bookmark:ao,sort:no,sortOrder:ro,sortType:oo};if(io){const fo=await this.API.viewV2.fetch(ue.id,{...uo,paginate:io});return{rows:(fo==null?void 0:fo.rows)||[],hasNextPage:(fo==null?void 0:fo.hasNextPage)||!1,cursor:(fo==null?void 0:fo.bookmark)||null}}else{const fo=await this.API.viewV2.fetch(ue.id,{...uo,paginate:io});return{rows:(fo==null?void 0:fo.rows)||[],hasNextPage:!1,cursor:null}}}catch(uo){return{rows:[],hasNextPage:!1,cursor:null,error:uo}}}}class QueryFetch extends BaseDataFetch{async determineFeatureFlags(){var no,ro,oo,io,ao,so;const ue=await this.getDefinition();return{supportsPagination:!!((ro=(no=ue==null?void 0:ue.fields)==null?void 0:no.pagination)!=null&&ro.type)&&!!((io=(oo=ue==null?void 0:ue.fields)==null?void 0:oo.pagination)!=null&&io.location)&&!!((so=(ao=ue==null?void 0:ue.fields)==null?void 0:ao.pagination)!=null&&so.pageParam)}}async getDefinition(){const{datasource:ue}=this.options;if(!(ue!=null&&ue._id))return null;try{const eo=await this.API.fetchQueryDefinition(ue._id);return eo.fields||(eo.fields=ue.fields),eo}catch{return null}}getDefaultSortColumn(){return null}async getData(){var co,uo;const{datasource:ue,limit:eo,paginate:no}=this.options,{supportsPagination:ro}=this.features,{cursor:oo,definition:io}=get_store_value(this.store),ao=(uo=(co=io==null?void 0:io.fields)==null?void 0:co.pagination)==null?void 0:uo.type,so=cloneDeep(ue.queryParams||{});for(const fo of(ue==null?void 0:ue.parameters)||[])so[fo.name]||(so[fo.name]=fo.default);const lo={parameters:so};if(no&&ro){const fo=ao==="page"?parseInt(oo||"1"):oo;lo.pagination={page:fo,limit:eo}}try{const fo=await this.API.executeQuery(ue==null?void 0:ue._id,lo),{data:po,pagination:ho,..._o}=fo;let go=null,bo=!1;return no&&ro&&(ao==="page"?(go=lo.pagination.page+1,bo=(po==null?void 0:po.length)===eo&&eo>0):(go=ho==null?void 0:ho.cursor,bo=go!=null)),{rows:po||[],info:_o,cursor:go,hasNextPage:bo}}catch{return{rows:[],hasNextPage:!1}}}}class RelationshipFetch extends BaseDataFetch{async getDefinition(){const{datasource:ue}=this.options;if(!(ue!=null&&ue.tableId))return null;try{return await this.API.fetchTableDefinition(ue.tableId)}catch(eo){return this.store.update(no=>({...no,error:eo})),null}}async getData(){const{datasource:ue}=this.options;if(!(ue!=null&&ue.rowId)||!(ue!=null&&ue.rowTableId))return{rows:[]};try{return{rows:await this.API.fetchRelationshipData(ue.rowTableId,ue.rowId,ue.fieldName)}}catch{return{rows:[]}}}}class NestedProviderFetch extends BaseDataFetch{async getDefinition(){var eo,no;const{datasource:ue}=this.options;return{schema:(eo=ue==null?void 0:ue.value)==null?void 0:eo.schema,primaryDisplay:(no=ue==null?void 0:ue.value)==null?void 0:no.primaryDisplay}}async getData(){var eo;const{datasource:ue}=this.options;return{rows:((eo=ue==null?void 0:ue.value)==null?void 0:eo.rows)||[],hasNextPage:!1,cursor:null}}}function isArrayOfStrings(to){return Array.isArray(to)&&!!to[0]&&typeof to[0]!="object"}class FieldFetch extends BaseDataFetch{async getDefinition(){const{datasource:ue}=this.options;let eo;return ue.fieldType==="attachment"?eo={url:{type:"string"},name:{type:"string"}}:ue.fieldType==="array"&&(eo={value:{type:"string"}}),{schema:eo}}async getData(){const{datasource:ue}=this.options,eo=(ue==null?void 0:ue.value)||[];let no;return isArrayOfStrings(eo)?no=eo.map(ro=>({value:ro})):no=eo,{rows:no||[],hasNextPage:!1,cursor:null}}}class JSONArrayFetch extends FieldFetch{async getDefinition(){const{datasource:ue}=this.options;try{const eo=await this.API.fetchTableDefinition(ue.tableId);return{schema:getJSONArrayDatasourceSchema(eo==null?void 0:eo.schema,ue)}}catch{return null}}}class UserFetch extends BaseDataFetch{constructor(ue){super({...ue,datasource:{type:"user",tableId:InternalTable.USER_METADATA}})}async determineFeatureFlags(){return{supportsSearch:!0,supportsSort:!1,supportsPagination:!0}}async getDefinition(){return{schema:{}}}async getData(){const{limit:ue,paginate:eo}=this.options,{cursor:no,query:ro}=get_store_value(this.store),{appId:oo,paginated:io,...ao}=ro,so=isSupportedUserSearch(ao)?ao:{};try{const lo={bookmark:no??void 0,query:so??void 0,appId:oo,paginate:io||eo,limit:ue},co=await this.API.searchUsers(lo);return{rows:(co==null?void 0:co.data)||[],hasNextPage:(co==null?void 0:co.hasNextPage)||!1,cursor:(co==null?void 0:co.nextPage)||null}}catch(lo){return{rows:[],hasNextPage:!1,error:lo}}}}class GroupUserFetch extends BaseDataFetch{constructor(ue){super({...ue,datasource:{type:"groupUser",tableId:InternalTable.USER_METADATA}})}async determineFeatureFlags(){return{supportsSearch:!0,supportsSort:!1,supportsPagination:!0}}async getDefinition(){return{schema:{}}}async getData(){const{query:ue,cursor:eo}=get_store_value(this.store);try{const no=await this.API.getGroupUsers({id:ue.groupId,emailSearch:ue.emailSearch,bookmark:eo??void 0});return{rows:(no==null?void 0:no.users)||[],hasNextPage:(no==null?void 0:no.hasNextPage)||!1,cursor:(no==null?void 0:no.bookmark)||null}}catch(no){return{rows:[],hasNextPage:!1,error:no}}}}class CustomFetch extends BaseDataFetch{getType(ue){return ue==null?"string":typeof ue==="object"?Array.isArray(ue)?"array":"json":isNaN(ue)?"string":"number"}parseCustomData(ue){if(!ue)return[];if(Array.isArray(ue))return ue;if(typeof ue=="string"){try{const eo=JSON.parse(ue);return Array.isArray(eo)?eo:[eo]}catch{}return ue.includes(`
|
|
476
476
|
`)?ue.split(`
|
|
477
477
|
`).map(eo=>eo.trim()):ue.split(",").map(eo=>eo.trim())}return[ue]}enrichCustomData(ue){return ue!=null&&ue.length?(ue=ue.filter(eo=>eo!=null&&eo!==""&&!Array.isArray(eo)),ue.map(eo=>{if(typeof eo=="object")return eo;if(typeof eo=="string"){const no=eo.split(",").map(oo=>oo.trim()),ro={};for(let oo=0;oo<no.length;oo++){const ao=`Value${oo===0?"":` ${oo+1}`}`;ro[ao]=no[oo]}return ro}return{Value:eo}})):[]}getCustomData(ue){return this.enrichCustomData(this.parseCustomData(ue==null?void 0:ue.data))}async getDefinition(){const{datasource:ue}=this.options,eo={},no=this.getCustomData(ue);if(!(no!=null&&no.length))return{schema:eo};for(const ro of no)for(const oo of Object.keys(ro))if(oo!=="_id"&&!eo[oo]){let io=this.getType(ro[oo]);const ao={};if(io==="string"){const so=[...new Set(no.map(co=>co[oo]))];so.length/no.length<=.8&&so.length>1&&(io="options",ao.inclusion=so)}else io==="array"&&(ao.inclusion=[...new Set(no.map(so=>so[oo]).flat())]);eo[oo]={type:io,constraints:ao}}return{schema:eo}}async getData(){const{datasource:ue}=this.options;return{rows:this.getCustomData(ue),hasNextPage:!1,cursor:null}}}class QueryArrayFetch extends FieldFetch{async getDefinition(){const{datasource:ue}=this.options;if(!(ue!=null&&ue.tableId))return null;try{const eo=await this.API.fetchQueryDefinition(ue.tableId),no=generateQueryArraySchemas(eo.schema,eo.nestedSchemaFields);return{schema:getJSONArrayDatasourceSchema(no,ue)}}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:to,datasource:ue,options:eo})=>{const no=DataFetchMap[ue==null?void 0:ue.type]||TableFetch,ro=new no({API:to,datasource:ue,...eo});return ro.getInitialData(),ro},createEmptyFetchInstance=({API:to,datasource:ue})=>{const eo=DataFetchMap[ue==null?void 0:ue.type];return eo?new eo({API:to,datasource:ue,query:null}):null},getDatasourceDefinition=async({API:to,datasource:ue})=>{const eo=createEmptyFetchInstance({API:to,datasource:ue});return await(eo==null?void 0:eo.getDefinition())},getDatasourceSchema=({API:to,datasource:ue,definition:eo})=>{const no=createEmptyFetchInstance({API:to,datasource:ue});return no==null?void 0:no.getSchema(eo)},createLocalStorageStore=(to,ue)=>{const eo=writable(ue,()=>{oo();const io=({key:ao})=>ao===to&&oo();return window.addEventListener("storage",io),()=>window.removeEventListener("storage",io)}),no=io=>{eo.set(io),localStorage.setItem(to,JSON.stringify(io))},ro=io=>no(io(get_store_value(eo))),oo=()=>{const io=localStorage.getItem(to);if(io==null)no(ue);else try{eo.set(JSON.parse(io))}catch{no(ue)}};return{...eo,set:no,update:ro}},createSessionStorageStore=(to,ue)=>{const eo=writable(ue,()=>{oo();const io=({key:ao})=>ao===to&&oo();return window.addEventListener("storage",io),()=>window.removeEventListener("storage",io)}),no=io=>{eo.set(io),sessionStorage.setItem(to,JSON.stringify(io))},ro=io=>no(io(get_store_value(eo))),oo=()=>{const io=sessionStorage.getItem(to);if(io==null)no(ue);else try{eo.set(JSON.parse(io))}catch{no(ue)}};return{...eo,set:no,update:ro}},BG="/builder/assets/bg-29e85dd5.png",SplitPage_svelte_svelte_type_style_lang="",get_right_slot_changes$1=to=>({}),get_right_slot_context$1=to=>({});function create_fragment$ab(to){let ue,eo,no,ro,oo,io,ao,so,lo;const co=to[1].default,uo=create_slot(co,to,to[0],null),fo=to[1].right,po=create_slot(fo,to,to[0],get_right_slot_context$1);return{c(){ue=element("div"),eo=element("div"),no=element("div"),uo&&uo.c(),ro=space$1(),oo=element("div"),io=element("img"),so=space$1(),po&&po.c(),attr(no,"class","content svelte-63esek"),attr(eo,"class","left svelte-63esek"),src_url_equal(io.src,ao=BG)||attr(io,"src",ao),attr(io,"alt"," "),attr(io,"class","svelte-63esek"),attr(oo,"class","right spectrum spectrum--darkest svelte-63esek"),attr(ue,"class","split-page svelte-63esek")},m(ho,_o){insert$2(ho,ue,_o),append$2(ue,eo),append$2(eo,no),uo&&uo.m(no,null),append$2(ue,ro),append$2(ue,oo),append$2(oo,io),append$2(oo,so),po&&po.m(oo,null),lo=!0},p(ho,[_o]){uo&&uo.p&&(!lo||_o&1)&&update_slot_base(uo,co,ho,ho[0],lo?get_slot_changes(co,ho[0],_o,null):get_all_dirty_from_scope(ho[0]),null),po&&po.p&&(!lo||_o&1)&&update_slot_base(po,fo,ho,ho[0],lo?get_slot_changes(fo,ho[0],_o,get_right_slot_changes$1):get_all_dirty_from_scope(ho[0]),get_right_slot_context$1)},i(ho){lo||(transition_in(uo,ho),transition_in(po,ho),lo=!0)},o(ho){transition_out(uo,ho),transition_out(po,ho),lo=!1},d(ho){ho&&detach(ue),uo&&uo.d(ho),po&&po.d(ho)}}}function instance$a8(to,ue,eo){let{$$slots:no={},$$scope:ro}=ue;return to.$$set=oo=>{"$$scope"in oo&&eo(0,ro=oo.$$scope)},[ro,no]}class SplitPage extends SvelteComponent{constructor(ue){super(),init$3(this,ue,instance$a8,create_fragment$ab,safe_not_equal,{})}}const Bulgaria="/builder/assets/bulgaria-bd68393d.png",Reworld="/builder/assets/reworld-2fa9ed4b.png",Schnellecke="/builder/assets/schnellecke-cf1837a8.png",Testimonial_svelte_svelte_type_style_lang="";function create_default_slot$6f(to){let ue,eo,no,ro,oo,io,ao,so,lo;return{c(){ue=element("img"),no=space$1(),ro=element("div"),ro.textContent=`"${to[0].text}"`,oo=space$1(),io=element("div"),ao=element("div"),ao.textContent=`${to[0].name}`,so=space$1(),lo=element("div"),lo.textContent=`${to[0].role}`,attr(ue,"width",to[0].imageSize),attr(ue,"alt","a-happy-budibase-user"),src_url_equal(ue.src,eo=to[0].image)||attr(ue,"src",eo),attr(ro,"class","text svelte-1rdu21t"),attr(ao,"class","name svelte-1rdu21t"),attr(lo,"class","company svelte-1rdu21t"),attr(io,"class","author")},m(co,uo){insert$2(co,ue,uo),insert$2(co,no,uo),insert$2(co,ro,uo),insert$2(co,oo,uo),insert$2(co,io,uo),append$2(io,ao),append$2(io,so),append$2(io,lo)},p:noop$7,d(co){co&&(detach(ue),detach(no),detach(ro),detach(oo),detach(io))}}}function create_fragment$aa(to){let ue,eo,no;return eo=new Layout$n({props:{noPadding:!0,gap:"S",$$slots:{default:[create_default_slot$6f]},$$scope:{ctx:to}}}),{c(){ue=element("div"),create_component(eo.$$.fragment),attr(ue,"class","testimonial svelte-1rdu21t")},m(ro,oo){insert$2(ro,ue,oo),mount_component(eo,ue,null),no=!0},p(ro,[oo]){const io={};oo&4&&(io.$$scope={dirty:oo,ctx:ro}),eo.$set(io)},i(ro){no||(transition_in(eo.$$.fragment,ro),no=!0)},o(ro){transition_out(eo.$$.fragment,ro),no=!1},d(ro){ro&&detach(ue),destroy_component(eo)}}}function instance$a7(to){return[[{text:"Budibase was the only solution that checked all the boxes for Reworld. Reworld expects to realize $3.2MM in savings due to the elimination of redundant data entry.",name:"Charles Link",role:"Senior Director, Data and Analytics",image:Reworld,imageSize:105},{text:"Budibase was mission-critical for us and went a long way in preventing what could have become a humanitarian crisis here in Bulgaria.",name:"Bozhidar Bozhanov",role:"Government of Bulgaria",image:Bulgaria,imageSize:49},{text:"Centralization of authentication, quick turnaround time for requests, integration with different database systems has given it the edge and it’s now used daily for internal development for those apps that you know you need but don’t feel value in losing days of development to reinvent the wheel.",name:"Davide Lenzarini",role:"IT manager",image:Schnellecke,imageSize:141}][Math.floor(Math.random()*3)]]}class Testimonial extends SvelteComponent{constructor(ue){super(),init$3(this,ue,instance$a7,create_fragment$aa,safe_not_equal,{})}}const TestimonialPage_svelte_svelte_type_style_lang="";function create_default_slot$6e(to){let ue;const eo=to[1].default,no=create_slot(eo,to,to[2],null);return{c(){no&&no.c()},m(ro,oo){no&&no.m(ro,oo),ue=!0},p(ro,oo){no&&no.p&&(!ue||oo&4)&&update_slot_base(no,eo,ro,ro[2],ue?get_slot_changes(eo,ro[2],oo,null):get_all_dirty_from_scope(ro[2]),null)},i(ro){ue||(transition_in(no,ro),ue=!0)},o(ro){transition_out(no,ro),ue=!1},d(ro){no&&no.d(ro)}}}function create_if_block$4P(to){let ue,eo;return ue=new Testimonial({}),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},i(no){eo||(transition_in(ue.$$.fragment,no),eo=!0)},o(no){transition_out(ue.$$.fragment,no),eo=!1},d(no){destroy_component(ue,no)}}}function create_right_slot$3(to){let ue,eo,no=to[0]&&create_if_block$4P();return{c(){ue=element("div"),no&&no.c(),attr(ue,"slot","right"),attr(ue,"class","svelte-1ow1lgm"),toggle_class(ue,"wrapper",to[0])},m(ro,oo){insert$2(ro,ue,oo),no&&no.m(ue,null),eo=!0},p(ro,oo){ro[0]?no?oo&1&&transition_in(no,1):(no=create_if_block$4P(),no.c(),transition_in(no,1),no.m(ue,null)):no&&(group_outros(),transition_out(no,1,1,()=>{no=null}),check_outros()),(!eo||oo&1)&&toggle_class(ue,"wrapper",ro[0])},i(ro){eo||(transition_in(no),eo=!0)},o(ro){transition_out(no),eo=!1},d(ro){ro&&detach(ue),no&&no.d()}}}function create_fragment$a9(to){let ue,eo;return ue=new SplitPage({props:{$$slots:{right:[create_right_slot$3],default:[create_default_slot$6e]},$$scope:{ctx:to}}}),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},p(no,[ro]){const oo={};ro&5&&(oo.$$scope={dirty:ro,ctx:no}),ue.$set(oo)},i(no){eo||(transition_in(ue.$$.fragment,no),eo=!0)},o(no){transition_out(ue.$$.fragment,no),eo=!1},d(no){destroy_component(ue,no)}}}function instance$a6(to,ue,eo){let{$$slots:no={},$$scope:ro}=ue,{enabled:oo=!0}=ue;return to.$$set=io=>{"enabled"in io&&eo(0,oo=io.enabled),"$$scope"in io&&eo(2,ro=io.$$scope)},[oo,no,ro]}class TestimonialPage extends SvelteComponent{constructor(ue){super(),init$3(this,ue,instance$a6,create_fragment$a9,safe_not_equal,{enabled:0})}}const SignatureModal_svelte_svelte_type_style_lang="";function create_default_slot_2$30(to){let ue,eo,no,ro={darkMode:to[3],value:to[1],saveIcon:!1};return eo=new Signature({props:ro}),to[8](eo),eo.$on("update",to[9]),{c(){ue=element("div"),create_component(eo.$$.fragment),attr(ue,"class","signature-wrap modal svelte-1jbgrys")},m(oo,io){insert$2(oo,ue,io),mount_component(eo,ue,null),no=!0},p(oo,io){const ao={};io&8&&(ao.darkMode=oo[3]),io&2&&(ao.value=oo[1]),eo.$set(ao)},i(oo){no||(transition_in(eo.$$.fragment,oo),no=!0)},o(oo){transition_out(eo.$$.fragment,oo),no=!1},d(oo){oo&&detach(ue),to[8](null),destroy_component(eo)}}}function create_default_slot_1$4d(to){let ue;return{c(){ue=text(to[2])},m(eo,no){insert$2(eo,ue,no)},p(eo,no){no&4&&set_data(ue,eo[2])},d(eo){eo&&detach(ue)}}}function create_header_slot$4(to){let ue,eo,no;return eo=new Body({props:{$$slots:{default:[create_default_slot_1$4d]},$$scope:{ctx:to}}}),{c(){ue=element("div"),create_component(eo.$$.fragment),attr(ue,"slot","header")},m(ro,oo){insert$2(ro,ue,oo),mount_component(eo,ue,null),no=!0},p(ro,oo){const io={};oo&4100&&(io.$$scope={dirty:oo,ctx:ro}),eo.$set(io)},i(ro){no||(transition_in(eo.$$.fragment,ro),no=!0)},o(ro){transition_out(eo.$$.fragment,ro),no=!1},d(ro){ro&&detach(ue),destroy_component(eo)}}}function create_default_slot$6d(to){let ue,eo;return ue=new ModalContent({props:{showConfirmButton:!0,showCancelButton:!1,showCloseIcon:!1,custom:!0,disabled:!to[6],showDivider:!1,onConfirm:to[10],$$slots:{header:[create_header_slot$4],default:[create_default_slot_2$30]},$$scope:{ctx:to}}}),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},p(no,ro){const oo={};ro&64&&(oo.disabled=!no[6]),ro&33&&(oo.onConfirm=no[10]),ro&4206&&(oo.$$scope={dirty:ro,ctx:no}),ue.$set(oo)},i(no){eo||(transition_in(ue.$$.fragment,no),eo=!0)},o(no){transition_out(ue.$$.fragment,no),eo=!1},d(no){destroy_component(ue,no)}}}function create_fragment$a8(to){let ue,eo,no={$$slots:{default:[create_default_slot$6d]},$$scope:{ctx:to}};return ue=new Modal({props:no}),to[11](ue),{c(){create_component(ue.$$.fragment)},m(ro,oo){mount_component(ue,ro,oo),eo=!0},p(ro,[oo]){const io={};oo&4207&&(io.$$scope={dirty:oo,ctx:ro}),ue.$set(io)},i(ro){eo||(transition_in(ue.$$.fragment,ro),eo=!0)},o(ro){transition_out(ue.$$.fragment,ro),eo=!1},d(ro){to[11](null),destroy_component(ue,ro)}}}function instance$a5(to,ue,eo){let{onConfirm:no=()=>{}}=ue,{value:ro}=ue,{title:oo}=ue,{darkMode:io}=ue;const ao=()=>{eo(6,co=!1),so.show()};let so,lo,co=!1;function uo(_o){binding_callbacks[_o?"unshift":"push"](()=>{lo=_o,eo(5,lo)})}const fo=()=>{eo(6,co=!0)},po=()=>{no(lo)};function ho(_o){binding_callbacks[_o?"unshift":"push"](()=>{so=_o,eo(4,so)})}return to.$$set=_o=>{"onConfirm"in _o&&eo(0,no=_o.onConfirm),"value"in _o&&eo(1,ro=_o.value),"title"in _o&&eo(2,oo=_o.title),"darkMode"in _o&&eo(3,io=_o.darkMode)},[no,ro,oo,io,so,lo,co,ao,uo,fo,po,ho]}class SignatureModal extends SvelteComponent{constructor(ue){super(),init$3(this,ue,instance$a5,create_fragment$a8,safe_not_equal,{onConfirm:0,value:1,title:2,darkMode:3,show:7})}get show(){return this.$$.ctx[7]}}function create_if_block$4O(to){let ue,eo;return ue=new AbsTooltip({props:{text:to[3]?getUserLabel(to[0]):null,position:to[2],color:getUserColor(to[0]),$$slots:{default:[create_default_slot$6c]},$$scope:{ctx:to}}}),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},p(no,ro){const oo={};ro&9&&(oo.text=no[3]?getUserLabel(no[0]):null),ro&4&&(oo.position=no[2]),ro&1&&(oo.color=getUserColor(no[0])),ro&19&&(oo.$$scope={dirty:ro,ctx:no}),ue.$set(oo)},i(no){eo||(transition_in(ue.$$.fragment,no),eo=!0)},o(no){transition_out(ue.$$.fragment,no),eo=!1},d(no){destroy_component(ue,no)}}}function create_default_slot$6c(to){let ue,eo;return ue=new Avatar({props:{size:to[1],initials:getUserInitials(to[0]),color:getUserColor(to[0])}}),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},p(no,ro){const oo={};ro&2&&(oo.size=no[1]),ro&1&&(oo.initials=getUserInitials(no[0])),ro&1&&(oo.color=getUserColor(no[0])),ue.$set(oo)},i(no){eo||(transition_in(ue.$$.fragment,no),eo=!0)},o(no){transition_out(ue.$$.fragment,no),eo=!1},d(no){destroy_component(ue,no)}}}function create_fragment$a7(to){let ue,eo,no=to[0]&&create_if_block$4O(to);return{c(){no&&no.c(),ue=empty$2()},m(ro,oo){no&&no.m(ro,oo),insert$2(ro,ue,oo),eo=!0},p(ro,[oo]){ro[0]?no?(no.p(ro,oo),oo&1&&transition_in(no,1)):(no=create_if_block$4O(ro),no.c(),transition_in(no,1),no.m(ue.parentNode,ue)):no&&(group_outros(),transition_out(no,1,1,()=>{no=null}),check_outros())},i(ro){eo||(transition_in(no),eo=!0)},o(ro){transition_out(no),eo=!1},d(ro){ro&&detach(ue),no&&no.d(ro)}}}function instance$a4(to,ue,eo){let{user:no}=ue,{size:ro="S"}=ue,{tooltipPosition:oo=TooltipPosition.Top}=ue,{showTooltip:io=!0}=ue;return to.$$set=ao=>{"user"in ao&&eo(0,no=ao.user),"size"in ao&&eo(1,ro=ao.size),"tooltipPosition"in ao&&eo(2,oo=ao.tooltipPosition),"showTooltip"in ao&&eo(3,io=ao.showTooltip)},[no,ro,oo,io]}class UserAvatar extends SvelteComponent{constructor(ue){super(),init$3(this,ue,instance$a4,create_fragment$a7,safe_not_equal,{user:0,size:1,tooltipPosition:2,showTooltip:3})}}const UserAvatars_svelte_svelte_type_style_lang$1="";function get_each_context$1_(to,ue,eo){const no=to.slice();return no[8]=ue[eo],no}function create_else_block$1P(to){let ue,eo;return ue=new UserAvatar({props:{size:to[0],user:to[8],tooltipPosition:to[1]}}),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},p(no,ro){const oo={};ro&1&&(oo.size=no[0]),ro&4&&(oo.user=no[8]),ro&2&&(oo.tooltipPosition=no[1]),ue.$set(oo)},i(no){eo||(transition_in(ue.$$.fragment,no),eo=!0)},o(no){transition_out(ue.$$.fragment,no),eo=!1},d(no){destroy_component(ue,no)}}}function create_if_block$4N(to){let ue,eo;return ue=new Avatar({props:{size:to[0],initials:to[8].label,color:"var(--spectrum-global-color-gray-500)"}}),{c(){create_component(ue.$$.fragment)},m(no,ro){mount_component(ue,no,ro),eo=!0},p(no,ro){const oo={};ro&1&&(oo.size=no[0]),ro&4&&(oo.initials=no[8].label),ue.$set(oo)},i(no){eo||(transition_in(ue.$$.fragment,no),eo=!0)},o(no){transition_out(ue.$$.fragment,no),eo=!1},d(no){destroy_component(ue,no)}}}function create_each_block$1_(to){let ue,eo,no,ro,oo;const io=[create_if_block$4N,create_else_block$1P],ao=[];function so(lo,co){return lo[8]._id==="overflow"?0:1}return eo=so(to),no=ao[eo]=io[eo](to),{c(){ue=element("span"),no.c(),ro=space$1(),set_style(ue,"z-index",to[8].zIndex),attr(ue,"class","svelte-1wnz660")},m(lo,co){insert$2(lo,ue,co),ao[eo].m(ue,null),append$2(ue,ro),oo=!0},p(lo,co){let uo=eo;eo=so(lo),eo===uo?ao[eo].p(lo,co):(group_outros(),transition_out(ao[uo],1,1,()=>{ao[uo]=null}),check_outros(),no=ao[eo],no?no.p(lo,co):(no=ao[eo]=io[eo](lo),no.c()),transition_in(no,1),no.m(ue,ro)),(!oo||co&4)&&set_style(ue,"z-index",lo[8].zIndex)},i(lo){oo||(transition_in(no),oo=!0)},o(lo){transition_out(no),oo=!1},d(lo){lo&&detach(ue),ao[eo].d()}}}function create_fragment$a6(to){let ue,eo,no=ensure_array_like(to[2]),ro=[];for(let io=0;io<no.length;io+=1)ro[io]=create_each_block$1_(get_each_context$1_(to,no,io));const oo=io=>transition_out(ro[io],1,1,()=>{ro[io]=null});return{c(){ue=element("div");for(let io=0;io<ro.length;io+=1)ro[io].c();attr(ue,"class","avatars svelte-1wnz660")},m(io,ao){insert$2(io,ue,ao);for(let so=0;so<ro.length;so+=1)ro[so]&&ro[so].m(ue,null);eo=!0},p(io,[ao]){if(ao&7){no=ensure_array_like(io[2]);let so;for(so=0;so<no.length;so+=1){const lo=get_each_context$1_(io,no,so);ro[so]?(ro[so].p(lo,ao),transition_in(ro[so],1)):(ro[so]=create_each_block$1_(lo),ro[so].c(),transition_in(ro[so],1),ro[so].m(ue,null))}for(group_outros(),so=no.length;so<ro.length;so+=1)oo(so);check_outros()}},i(io){if(!eo){for(let ao=0;ao<no.length;ao+=1)transition_in(ro[ao]);eo=!0}},o(io){ro=ro.filter(Boolean);for(let ao=0;ao<ro.length;ao+=1)transition_out(ro[ao]);eo=!1},d(io){io&&detach(ue),destroy_each(ro,io)}}}function instance$a3(to,ue,eo){let no,ro,{users:oo=[]}=ue,{order:io="ltr"}=ue,{size:ao="S"}=ue,{tooltipPosition:so=TooltipPosition.Top}=ue;const lo=uo=>{let fo={};return uo==null||uo.forEach(po=>{fo[po.email]=po}),Object.values(fo)},co=(uo,fo)=>{const po=uo.slice(0,3);if(uo.length>3){const ho={_id:"overflow",label:`+${uo.length-3}`};fo==="ltr"?po.push(ho):po.unshift(ho)}return po.map((ho,_o)=>({...ho,zIndex:fo==="ltr"?_o:no.length-_o}))};return to.$$set=uo=>{"users"in uo&&eo(3,oo=uo.users),"order"in uo&&eo(4,io=uo.order),"size"in uo&&eo(0,ao=uo.size),"tooltipPosition"in uo&&eo(1,so=uo.tooltipPosition)},to.$$.update=()=>{to.$$.dirty&24&&eo(5,no=lo(oo)),to.$$.dirty&48&&eo(2,ro=co(no,io))},[ao,so,ro,oo,io,no]}let UserAvatars$1=class extends SvelteComponent{constructor(ue){super(),init$3(this,ue,instance$a3,create_fragment$a6,safe_not_equal,{users:3,order:4,size:0,tooltipPosition:1})}};const Updating_svelte_svelte_type_style_lang="";function create_else_block_1$u(to){let ue;return{c(){ue=text("Something went wrong!")},m(eo,no){insert$2(eo,ue,no)},d(eo){eo&&detach(ue)}}}function create_if_block_1$2B(to){let ue;return{c(){ue=text("System update")},m(eo,no){insert$2(eo,ue,no)},d(eo){eo&&detach(ue)}}}function create_else_block$1O(to){let ue,eo,no,ro,oo;return{c(){ue=text(`An error occurred, please try again later.
|
|
478
478
|
`),eo=element("br"),no=text(`
|
|
@@ -496,7 +496,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
496
496
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}()}function c(to,ue){if(to){if(typeof to=="string")return d$1(to,ue);var eo=Object.prototype.toString.call(to).slice(8,-1);return eo==="Object"&&to.constructor&&(eo=to.constructor.name),eo==="Map"||eo==="Set"?Array.from(to):eo==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(eo)?d$1(to,ue):void 0}}function d$1(to,ue){(ue==null||ue>to.length)&&(ue=to.length);for(var eo=0,no=new Array(ue);eo<ue;eo++)no[eo]=to[eo];return no}function h(to,ue){var eo=typeof Symbol<"u"&&to[Symbol.iterator]||to["@@iterator"];if(!eo){if(Array.isArray(to)||(eo=c(to))||ue&&to&&typeof to.length=="number"){eo&&(to=eo);var no=0,ro=function(){};return{s:ro,n:function(){return no>=to.length?{done:!0}:{done:!1,value:to[no++]}},e:function(so){throw so},f:ro}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
497
497
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var oo,io=!0,ao=!1;return{s:function(){eo=eo.call(to)},n:function(){var so=eo.next();return io=so.done,so},e:function(so){ao=!0,oo=so},f:function(){try{io||eo.return==null||eo.return()}finally{if(ao)throw oo}}}}var f={DEBUG:!1,LIB_VERSION:"1.160.0"},v=Array.isArray,p$1=Object.prototype,g=p$1.hasOwnProperty,_=p$1.toString,m=v||function(to){return _.call(to)==="[object Array]"},y=function(to){return typeof to=="function"},b=function(to){return to===Object(to)&&!m(to)},k=function(to){if(b(to)){for(var ue in to)if(g.call(to,ue))return!1;return!0}return!1},w$1=function(to){return to===void 0},S=function(to){return _.call(to)=="[object String]"},E=function(to){return S(to)&&to.trim().length===0},I=function(to){return to===null},R=function(to){return w$1(to)||I(to)},F=function(to){return _.call(to)=="[object Number]"},x$1=function(to){return _.call(to)==="[object Boolean]"},P=function(to){return to instanceof FormData},T=typeof window<"u"?window:void 0,C$2=typeof globalThis<"u"?globalThis:T,$=Array.prototype,O=$.forEach,M=$.indexOf,A=C$2==null?void 0:C$2.navigator,L=C$2==null?void 0:C$2.document,D=C$2==null?void 0:C$2.location,q=C$2==null?void 0:C$2.fetch,N=C$2!=null&&C$2.XMLHttpRequest&&"withCredentials"in new C$2.XMLHttpRequest?C$2.XMLHttpRequest:void 0,B=C$2==null?void 0:C$2.AbortController,H=A==null?void 0:A.userAgent,U=T??{},j="[PostHog.js]",G={_log:function(to){if(T&&(f.DEBUG||U.POSTHOG_DEBUG)&&!w$1(T.console)&&T.console){for(var ue=("__rrweb_original__"in T.console[to])?T.console[to].__rrweb_original__:T.console[to],eo=arguments.length,no=new Array(eo>1?eo-1:0),ro=1;ro<eo;ro++)no[ro-1]=arguments[ro];ue.apply(void 0,[j].concat(no))}},info:function(){for(var to=arguments.length,ue=new Array(to),eo=0;eo<to;eo++)ue[eo]=arguments[eo];G._log.apply(G,["log"].concat(ue))},warn:function(){for(var to=arguments.length,ue=new Array(to),eo=0;eo<to;eo++)ue[eo]=arguments[eo];G._log.apply(G,["warn"].concat(ue))},error:function(){for(var to=arguments.length,ue=new Array(to),eo=0;eo<to;eo++)ue[eo]=arguments[eo];G._log.apply(G,["error"].concat(ue))},critical:function(){for(var to,ue=arguments.length,eo=new Array(ue),no=0;no<ue;no++)eo[no]=arguments[no];(to=console).error.apply(to,[j].concat(eo))},uninitializedWarning:function(to){G.error("You must initialize PostHog before calling ".concat(to))}},W={},V=function(to){return to.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")};function z(to,ue,eo){if(m(to)){if(O&&to.forEach===O)to.forEach(ue,eo);else if("length"in to&&to.length===+to.length){for(var no=0,ro=to.length;no<ro;no++)if(no in to&&ue.call(eo,to[no],no)===W)return}}}function Q(to,ue,eo){if(!R(to)){if(m(to))return z(to,ue,eo);if(P(to)){var no,ro=h(to.entries());try{for(ro.s();!(no=ro.n()).done;){var oo=no.value;if(ue.call(eo,oo[1],oo[0])===W)return}}catch(ao){ro.e(ao)}finally{ro.f()}}else for(var io in to)if(g.call(to,io)&&ue.call(eo,to[io],io)===W)return}}var J=function(to){for(var ue=arguments.length,eo=new Array(ue>1?ue-1:0),no=1;no<ue;no++)eo[no-1]=arguments[no];return z(eo,function(ro){for(var oo in ro)ro[oo]!==void 0&&(to[oo]=ro[oo])}),to};function Y(to,ue){return to.indexOf(ue)!==-1}function X(to){for(var ue=Object.keys(to),eo=ue.length,no=new Array(eo);eo--;)no[eo]=[ue[eo],to[ue[eo]]];return no}var K=function(){return Date.now=Date.now||function(){return+new Date},Date.now()},Z=function(to){try{return to()}catch{return}},ee=function(to){return function(){try{for(var ue=arguments.length,eo=new Array(ue),no=0;no<ue;no++)eo[no]=arguments[no];return to.apply(this,eo)}catch(ro){G.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),G.critical(ro)}}},te=function(to){var ue={};return Q(to,function(eo,no){S(eo)&&eo.length>0&&(ue[no]=eo)}),ue},ne=function(to){return to.replace(/^\$/,"")};function ie$3(to,ue){return eo=to,no=function(oo){return S(oo)&&!I(ue)?oo.slice(0,ue):oo},ro=new Set,function oo(io,ao){return io!==Object(io)?no?no(io,ao):io:ro.has(io)?void 0:(ro.add(io),m(io)?(so=[],z(io,function(lo){so.push(oo(lo))})):(so={},Q(io,function(lo,co){ro.has(lo)||(so[co]=oo(lo,co))})),so);var so}(eo);var eo,no,ro}var re,se=function(to){var ue,eo,no,ro,oo="";for(ue=eo=0,no=(to=(to+"").replace(/\r\n/g,`
|
|
498
498
|
`).replace(/\r/g,`
|
|
499
|
-
`)).length,ro=0;ro<no;ro++){var io=to.charCodeAt(ro),ao=null;io<128?eo++:ao=io>127&&io<2048?String.fromCharCode(io>>6|192,63&io|128):String.fromCharCode(io>>12|224,io>>6&63|128,63&io|128),I(ao)||(eo>ue&&(oo+=to.substring(ue,eo)),oo+=ao,ue=eo=ro+1)}return eo>ue&&(oo+=to.substring(ue,to.length)),oo},oe=function(){function to(ue){return ue&&(ue.preventDefault=to.preventDefault,ue.stopPropagation=to.stopPropagation),ue}return to.preventDefault=function(){this.returnValue=!1},to.stopPropagation=function(){this.cancelBubble=!0},function(ue,eo,no,ro,oo){if(ue)if(ue.addEventListener&&!ro)ue.addEventListener(eo,no,!!oo);else{var io="on"+eo,ao=ue[io];ue[io]=function(so,lo,co){return function(uo){if(uo=uo||to(T==null?void 0:T.event)){var fo,po=!0;y(co)&&(fo=co(uo));var ho=lo.call(so,uo);return fo!==!1&&ho!==!1||(po=!1),po}}}(ue,no,ao)}else G.error("No valid element provided to register_event")}}();function ae(to,ue){for(var eo=0;eo<to.length;eo++)if(ue(to[eo]))return to[eo]}(function(to){to.GZipJS="gzip-js",to.Base64="base64"})(re||(re={}));var le="$people_distinct_id",ce="__alias",de="__timers",he="$autocapture_disabled_server_side",fe="$heatmaps_enabled_server_side",ve="$exception_capture_enabled_server_side",pe="$exception_capture_endpoint_suffix",ge="$web_vitals_enabled_server_side",_e="$session_recording_enabled_server_side",me="$console_log_recording_enabled_server_side",ye="$session_recording_network_payload_capture",be="$session_recording_canvas_recording",ke="$replay_sample_rate",we="$replay_minimum_duration",Se="$sesid",Ee="$session_is_sampled",Ie="$enabled_feature_flags",Re="$early_access_features",Fe="$stored_person_properties",xe="$stored_group_properties",Pe="$surveys",Te="$surveys_activated",Ce="$flag_call_reported",$e="$user_state",Oe="$client_session_props",Me="$capture_rate_limit",Ae="$initial_campaign_params",Le="$initial_referrer_info",De="$initial_person_info",qe="$epp",Ne="__POSTHOG_TOOLBAR__",Be=[le,ce,"__cmpns",de,_e,fe,Se,Ie,$e,Re,xe,Fe,Pe,Ce,Oe,Me,Ae,Le,qe],He="$active_feature_flags",Ue="$override_feature_flags",je="$feature_flag_payloads",Ge=function(to){var ue,eo={},no=h(X(to||{}));try{for(no.s();!(ue=no.n()).done;){var ro=u(ue.value,2),oo=ro[0],io=ro[1];io&&(eo[oo]=io)}}catch(ao){no.e(ao)}finally{no.f()}return eo},We=function(){function to(ue){i$1(this,to),this.instance=ue,this._override_warning=!1,this.featureFlagEventHandlers=[],this.reloadFeatureFlagsQueued=!1,this.reloadFeatureFlagsInAction=!1}return s(to,[{key:"getFlags",value:function(){return Object.keys(this.getFlagVariants())}},{key:"getFlagVariants",value:function(){var ue=this.instance.get_property(Ie),eo=this.instance.get_property(Ue);if(!eo)return ue||{};for(var no=J({},ue),ro=Object.keys(eo),oo=0;oo<ro.length;oo++)no[ro[oo]]=eo[ro[oo]];return this._override_warning||(G.warn(" Overriding feature flags!",{enabledFlags:ue,overriddenFlags:eo,finalFlags:no}),this._override_warning=!0),no}},{key:"getFlagPayloads",value:function(){return this.instance.get_property(je)||{}}},{key:"reloadFeatureFlags",value:function(){this.reloadFeatureFlagsQueued||(this.reloadFeatureFlagsQueued=!0,this._startReloadTimer())}},{key:"setAnonymousDistinctId",value:function(ue){this.$anon_distinct_id=ue}},{key:"setReloadingPaused",value:function(ue){this.reloadFeatureFlagsInAction=ue}},{key:"resetRequestQueue",value:function(){this.reloadFeatureFlagsQueued=!1}},{key:"_startReloadTimer",value:function(){var ue=this;this.reloadFeatureFlagsQueued&&!this.reloadFeatureFlagsInAction&&setTimeout(function(){!ue.reloadFeatureFlagsInAction&&ue.reloadFeatureFlagsQueued&&(ue.reloadFeatureFlagsQueued=!1,ue._reloadFeatureFlagsRequest())},5)}},{key:"_reloadFeatureFlagsRequest",value:function(){var ue=this;if(!this.instance.config.advanced_disable_feature_flags){this.setReloadingPaused(!0);var eo=this.instance.config.token,no=this.instance.get_property(Fe),ro=this.instance.get_property(xe),oo={token:eo,distinct_id:this.instance.get_distinct_id(),groups:this.instance.getGroups(),$anon_distinct_id:this.$anon_distinct_id,person_properties:no,group_properties:ro,disable_flags:this.instance.config.advanced_disable_feature_flags||void 0};this.instance._send_request({method:"POST",url:this.instance.requestRouter.endpointFor("api","/decide/?v=3"),data:oo,compression:this.instance.config.disable_compression?void 0:re.Base64,timeout:this.instance.config.feature_flag_request_timeout_ms,callback:function(io){var ao;ue.setReloadingPaused(!1);var so=!0;io.statusCode===200&&(ue.$anon_distinct_id=void 0,so=!1),ue.receivedFeatureFlags((ao=io.json)!==null&&ao!==void 0?ao:{},so),ue._startReloadTimer()}})}}},{key:"getFeatureFlag",value:function(ue){var eo=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(this.instance.decideEndpointWasHit||this.getFlags()&&this.getFlags().length>0){var no,ro=this.getFlagVariants()[ue],oo="".concat(ro),io=this.instance.get_property(Ce)||{};return(eo.send_event||!("send_event"in eo))&&(!(ue in io)||!io[ue].includes(oo))&&(m(io[ue])?io[ue].push(oo):io[ue]=[oo],(no=this.instance.persistence)===null||no===void 0||no.register(o({},Ce,io)),this.instance.capture("$feature_flag_called",{$feature_flag:ue,$feature_flag_response:ro})),ro}G.warn('getFeatureFlag for key "'+ue+`" failed. Feature flags didn't load in time.`)}},{key:"getFeatureFlagPayload",value:function(ue){return this.getFlagPayloads()[ue]}},{key:"isFeatureEnabled",value:function(ue){var eo=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(this.instance.decideEndpointWasHit||this.getFlags()&&this.getFlags().length>0)return!!this.getFeatureFlag(ue,eo);G.warn('isFeatureEnabled for key "'+ue+`" failed. Feature flags didn't load in time.`)}},{key:"addFeatureFlagsHandler",value:function(ue){this.featureFlagEventHandlers.push(ue)}},{key:"removeFeatureFlagsHandler",value:function(ue){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter(function(eo){return eo!==ue})}},{key:"receivedFeatureFlags",value:function(ue,eo){if(this.instance.persistence){this.instance.decideEndpointWasHit=!0;var no=this.getFlagVariants(),ro=this.getFlagPayloads();(function(oo,io){var ao,so=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},lo=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},co=oo.featureFlags,uo=oo.featureFlagPayloads;if(co)if(m(co)){var fo,po={};if(co)for(var ho=0;ho<co.length;ho++)po[co[ho]]=!0;io&&io.register((o(fo={},He,co),o(fo,Ie,po),fo))}else{var _o=co,go=uo;oo.errorsWhileComputingFlags&&(_o=t$1(t$1({},so),_o),go=t$1(t$1({},lo),go)),io&&io.register((o(ao={},He,Object.keys(Ge(_o))),o(ao,Ie,_o||{}),o(ao,je,go||{}),ao))}})(ue,this.instance.persistence,no,ro),this._fireFeatureFlagsCallbacks(eo)}}},{key:"override",value:function(ue){var eo=arguments.length>1&&arguments[1]!==void 0&&arguments[1];if(!this.instance.__loaded||!this.instance.persistence)return G.uninitializedWarning("posthog.feature_flags.override");if(this._override_warning=eo,ue===!1)this.instance.persistence.unregister(Ue);else if(m(ue)){for(var no={},ro=0;ro<ue.length;ro++)no[ue[ro]]=!0;this.instance.persistence.register(o({},Ue,no))}else this.instance.persistence.register(o({},Ue,ue))}},{key:"onFeatureFlags",value:function(ue){var eo=this;if(this.addFeatureFlagsHandler(ue),this.instance.decideEndpointWasHit){var no=this._prepareFeatureFlagsForCallbacks(),ro=no.flags,oo=no.flagVariants;ue(ro,oo)}return function(){return eo.removeFeatureFlagsHandler(ue)}}},{key:"updateEarlyAccessFeatureEnrollment",value:function(ue,eo){var no,ro,oo=o({},"$feature_enrollment/".concat(ue),eo);this.instance.capture("$feature_enrollment_update",{$feature_flag:ue,$feature_enrollment:eo,$set:oo}),this.setPersonPropertiesForFlags(oo,!1);var io=t$1(t$1({},this.getFlagVariants()),{},o({},ue,eo));(no=this.instance.persistence)===null||no===void 0||no.register((o(ro={},He,Object.keys(Ge(io))),o(ro,Ie,io),ro)),this._fireFeatureFlagsCallbacks()}},{key:"getEarlyAccessFeatures",value:function(ue){var eo=this,no=arguments.length>1&&arguments[1]!==void 0&&arguments[1],ro=this.instance.get_property(Re);if(ro&&!no)return ue(ro);this.instance._send_request({transport:"XHR",url:this.instance.requestRouter.endpointFor("api","/api/early_access_features/?token=".concat(this.instance.config.token)),method:"GET",callback:function(oo){var io;if(oo.json){var ao=oo.json.earlyAccessFeatures;return(io=eo.instance.persistence)===null||io===void 0||io.register(o({},Re,ao)),ue(ao)}}})}},{key:"_prepareFeatureFlagsForCallbacks",value:function(){var ue=this.getFlags(),eo=this.getFlagVariants();return{flags:ue.filter(function(no){return eo[no]}),flagVariants:Object.keys(eo).filter(function(no){return eo[no]}).reduce(function(no,ro){return no[ro]=eo[ro],no},{})}}},{key:"_fireFeatureFlagsCallbacks",value:function(ue){var eo=this._prepareFeatureFlagsForCallbacks(),no=eo.flags,ro=eo.flagVariants;this.featureFlagEventHandlers.forEach(function(oo){return oo(no,ro,{errorsLoading:ue})})}},{key:"setPersonPropertiesForFlags",value:function(ue){var eo=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1],no=this.instance.get_property(Fe)||{};this.instance.register(o({},Fe,t$1(t$1({},no),ue))),eo&&this.instance.reloadFeatureFlags()}},{key:"resetPersonPropertiesForFlags",value:function(){this.instance.unregister(Fe)}},{key:"setGroupPropertiesForFlags",value:function(ue){var eo=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1],no=this.instance.get_property(xe)||{};Object.keys(no).length!==0&&Object.keys(no).forEach(function(ro){no[ro]=t$1(t$1({},no[ro]),ue[ro]),delete ue[ro]}),this.instance.register(o({},xe,t$1(t$1({},no),ue))),eo&&this.instance.reloadFeatureFlags()}},{key:"resetGroupPropertiesForFlags",value:function(ue){if(ue){var eo=this.instance.get_property(xe)||{};this.instance.register(o({},xe,t$1(t$1({},eo),{},o({},ue,{}))))}else this.instance.unregister(xe)}}]),to}();Math.trunc||(Math.trunc=function(to){return to<0?Math.ceil(to):Math.floor(to)}),Number.isInteger||(Number.isInteger=function(to){return F(to)&&isFinite(to)&&Math.floor(to)===to});var Ve="0123456789abcdef",ze=function(){function to(ue){if(i$1(this,to),this.bytes=ue,ue.length!==16)throw new TypeError("not 128-bit length")}return s(to,[{key:"toString",value:function(){for(var ue="",eo=0;eo<this.bytes.length;eo++)ue=ue+Ve.charAt(this.bytes[eo]>>>4)+Ve.charAt(15&this.bytes[eo]),eo!==3&&eo!==5&&eo!==7&&eo!==9||(ue+="-");if(ue.length!==36)throw new Error("Invalid UUIDv7 was generated");return ue}},{key:"clone",value:function(){return new to(this.bytes.slice(0))}},{key:"equals",value:function(ue){return this.compareTo(ue)===0}},{key:"compareTo",value:function(ue){for(var eo=0;eo<16;eo++){var no=this.bytes[eo]-ue.bytes[eo];if(no!==0)return Math.sign(no)}return 0}}],[{key:"fromFieldsV7",value:function(ue,eo,no,ro){if(!Number.isInteger(ue)||!Number.isInteger(eo)||!Number.isInteger(no)||!Number.isInteger(ro)||ue<0||eo<0||no<0||ro<0||ue>0xffffffffffff||eo>4095||no>1073741823||ro>4294967295)throw new RangeError("invalid field value");var oo=new Uint8Array(16);return oo[0]=ue/Math.pow(2,40),oo[1]=ue/Math.pow(2,32),oo[2]=ue/Math.pow(2,24),oo[3]=ue/Math.pow(2,16),oo[4]=ue/Math.pow(2,8),oo[5]=ue,oo[6]=112|eo>>>8,oo[7]=eo,oo[8]=128|no>>>24,oo[9]=no>>>16,oo[10]=no>>>8,oo[11]=no,oo[12]=ro>>>24,oo[13]=ro>>>16,oo[14]=ro>>>8,oo[15]=ro,new to(oo)}}]),to}(),Qe=function(){function to(){i$1(this,to),o(this,"timestamp",0),o(this,"counter",0),o(this,"random",new Xe)}return s(to,[{key:"generate",value:function(){var ue=this.generateOrAbort();if(w$1(ue)){this.timestamp=0;var eo=this.generateOrAbort();if(w$1(eo))throw new Error("Could not generate UUID after timestamp reset");return eo}return ue}},{key:"generateOrAbort",value:function(){var ue=Date.now();if(ue>this.timestamp)this.timestamp=ue,this.resetCounter();else{if(!(ue+1e4>this.timestamp))return;this.counter++,this.counter>4398046511103&&(this.timestamp++,this.resetCounter())}return ze.fromFieldsV7(this.timestamp,Math.trunc(this.counter/Math.pow(2,30)),this.counter&Math.pow(2,30)-1,this.random.nextUint32())}},{key:"resetCounter",value:function(){this.counter=1024*this.random.nextUint32()+(1023&this.random.nextUint32())}}]),to}(),Je=function(to){if(typeof UUIDV7_DENY_WEAK_RNG<"u"&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var ue=0;ue<to.length;ue++)to[ue]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return to};T&&!w$1(T.crypto)&&crypto.getRandomValues&&(Je=function(to){return crypto.getRandomValues(to)});var Ye,Xe=function(){function to(){i$1(this,to),o(this,"buffer",new Uint32Array(8)),o(this,"cursor",1/0)}return s(to,[{key:"nextUint32",value:function(){return this.cursor>=this.buffer.length&&(Je(this.buffer),this.cursor=0),this.buffer[this.cursor++]}}]),to}(),Ke=function(){return Ze().toString()},Ze=function(){return(Ye||(Ye=new Qe)).generate()},et="Thu, 01 Jan 1970 00:00:00 GMT",tt="",nt=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;function it(to,ue){if(ue){var eo=function(ro){var oo=arguments.length>1&&arguments[1]!==void 0?arguments[1]:L;if(tt)return tt;if(!oo||["localhost","127.0.0.1"].includes(ro))return"";for(var io=ro.split("."),ao=Math.min(io.length,8),so="dmn_chk_"+Ke(),lo=new RegExp("(^|;)\\s*"+so+"=1");!tt&&ao--;){var co=io.slice(ao).join("."),uo=so+"=1;domain=."+co;oo.cookie=uo,lo.test(oo.cookie)&&(oo.cookie=uo+";expires="+et,tt=co)}return tt}(to);if(!eo){var no=function(ro){var oo=ro.match(nt);return oo?oo[0]:""}(to);no!==eo&&G.info("Warning: cookie subdomain discovery mismatch",no,eo),eo=no}return eo?"; domain=."+eo:""}return""}var rt,st={is_supported:function(){return!!L},error:function(to){G.error("cookieStore error: "+to)},get:function(to){if(L){try{for(var ue=to+"=",eo=L.cookie.split(";").filter(function(oo){return oo.length}),no=0;no<eo.length;no++){for(var ro=eo[no];ro.charAt(0)==" ";)ro=ro.substring(1,ro.length);if(ro.indexOf(ue)===0)return decodeURIComponent(ro.substring(ue.length,ro.length))}}catch{}return null}},parse:function(to){var ue;try{ue=JSON.parse(st.get(to))||{}}catch{}return ue},set:function(to,ue,eo,no,ro){if(L)try{var oo="",io="",ao=it(L.location.hostname,no);if(eo){var so=new Date;so.setTime(so.getTime()+24*eo*60*60*1e3),oo="; expires="+so.toUTCString()}ro&&(io="; secure");var lo=to+"="+encodeURIComponent(JSON.stringify(ue))+oo+"; SameSite=Lax; path=/"+ao+io;return lo.length>3686.4&&G.warn("cookieStore warning: large cookie, len="+lo.length),L.cookie=lo,lo}catch{return}},remove:function(to,ue){try{st.set(to,"",-1,ue)}catch{return}}},ot=null,at={is_supported:function(){if(!I(ot))return ot;var to=!0;if(w$1(T))to=!1;else try{var ue="__mplssupport__";at.set(ue,"xyz"),at.get(ue)!=='"xyz"'&&(to=!1),at.remove(ue)}catch{to=!1}return to||G.error("localStorage unsupported; falling back to cookie store"),ot=to,to},error:function(to){G.error("localStorage error: "+to)},get:function(to){try{return T==null?void 0:T.localStorage.getItem(to)}catch(ue){at.error(ue)}return null},parse:function(to){try{return JSON.parse(at.get(to))||{}}catch{}return null},set:function(to,ue){try{T==null||T.localStorage.setItem(to,JSON.stringify(ue))}catch(eo){at.error(eo)}},remove:function(to){try{T==null||T.localStorage.removeItem(to)}catch(ue){at.error(ue)}}},ut=["distinct_id",Se,Ee,qe],lt=t$1(t$1({},at),{},{parse:function(to){try{var ue={};try{ue=st.parse(to)||{}}catch{}var eo=J(ue,JSON.parse(at.get(to)||"{}"));return at.set(to,eo),eo}catch{}return null},set:function(to,ue,eo,no,ro,oo){try{at.set(to,ue,void 0,void 0,oo);var io={};ut.forEach(function(ao){ue[ao]&&(io[ao]=ue[ao])}),Object.keys(io).length&&st.set(to,io,eo,no,ro,oo)}catch(ao){at.error(ao)}},remove:function(to,ue){try{T==null||T.localStorage.removeItem(to),st.remove(to,ue)}catch(eo){at.error(eo)}}}),ct={},dt={is_supported:function(){return!0},error:function(to){G.error("memoryStorage error: "+to)},get:function(to){return ct[to]||null},parse:function(to){return ct[to]||null},set:function(to,ue){ct[to]=ue},remove:function(to){delete ct[to]}},ht=null,ft={is_supported:function(){if(!I(ht))return ht;if(ht=!0,w$1(T))ht=!1;else try{var to="__support__";ft.set(to,"xyz"),ft.get(to)!=='"xyz"'&&(ht=!1),ft.remove(to)}catch{ht=!1}return ht},error:function(to){G.error("sessionStorage error: ",to)},get:function(to){try{return T==null?void 0:T.sessionStorage.getItem(to)}catch(ue){ft.error(ue)}return null},parse:function(to){try{return JSON.parse(ft.get(to))||null}catch{}return null},set:function(to,ue){try{T==null||T.sessionStorage.setItem(to,JSON.stringify(ue))}catch(eo){ft.error(eo)}},remove:function(to){try{T==null||T.sessionStorage.removeItem(to)}catch(ue){ft.error(ue)}}},vt=["localhost","127.0.0.1"],pt=function(to){var ue=L==null?void 0:L.createElement("a");return w$1(ue)?null:(ue.href=to,ue)},gt=function(to,ue){return!!function(eo){try{new RegExp(eo)}catch{return!1}return!0}(ue)&&new RegExp(ue).test(to)},_t=function(to){var ue,eo,no=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"&",ro=[];return Q(to,function(oo,io){w$1(oo)||w$1(io)||io==="undefined"||(ue=encodeURIComponent(function(ao){return ao instanceof File}(oo)?oo.name:oo.toString()),eo=encodeURIComponent(io),ro[ro.length]=eo+"="+ue)}),ro.join(no)},mt=function(to,ue){for(var eo,no=((to.split("#")[0]||"").split("?")[1]||"").split("&"),ro=0;ro<no.length;ro++){var oo=no[ro].split("=");if(oo[0]===ue){eo=oo;break}}if(!m(eo)||eo.length<2)return"";var io=eo[1];try{io=decodeURIComponent(io)}catch{G.error("Skipping decoding for malformed query param: "+io)}return io.replace(/\+/g," ")},yt=function(to,ue){var eo=to.match(new RegExp(ue+"=([^&]*)"));return eo?eo[1]:null},bt="Mobile",kt="iOS",wt="Android",St="Tablet",Et=wt+" "+St,It="iPad",Rt="Apple",Ft=Rt+" Watch",xt="Safari",Pt="BlackBerry",Tt="Samsung",Ct=Tt+"Browser",$t=Tt+" Internet",Ot="Chrome",Mt=Ot+" OS",At=Ot+" "+kt,Lt="Internet Explorer",Dt=Lt+" "+bt,qt="Opera",Nt=qt+" Mini",Bt="Edge",Ht="Microsoft "+Bt,Ut="Firefox",jt=Ut+" "+kt,Gt="Nintendo",Wt="PlayStation",Vt="Xbox",zt=wt+" "+bt,Qt=bt+" "+xt,Jt="Windows",Yt=Jt+" Phone",Xt="Nokia",Kt="Ouya",Zt="Generic",en=Zt+" "+bt.toLowerCase(),tn=Zt+" "+St.toLowerCase(),nn="Konqueror",rn="(\\d+(\\.\\d+)?)",sn=new RegExp("Version/"+rn),on=new RegExp(Vt,"i"),an=new RegExp(Wt+" \\w+","i"),un=new RegExp(Gt+" \\w+","i"),ln=new RegExp(Pt+"|PlayBook|BB10","i"),cn={"NT3.51":"NT 3.11","NT4.0":"NT 4.0","5.0":"2000",5.1:"XP",5.2:"XP","6.0":"Vista",6.1:"7",6.2:"8",6.3:"8.1",6.4:"10","10.0":"10"},dn=function(to,ue){return ue&&Y(ue,Rt)||function(eo){return Y(eo,xt)&&!Y(eo,Ot)&&!Y(eo,wt)}(to)},hn=function(to,ue){return ue=ue||"",Y(to," OPR/")&&Y(to,"Mini")?Nt:Y(to," OPR/")?qt:ln.test(to)?Pt:Y(to,"IE"+bt)||Y(to,"WPDesktop")?Dt:Y(to,Ct)?$t:Y(to,Bt)||Y(to,"Edg/")?Ht:Y(to,"FBIOS")?"Facebook "+bt:Y(to,"UCWEB")||Y(to,"UCBrowser")?"UC Browser":Y(to,"CriOS")?At:Y(to,"CrMo")?Ot:Y(to,wt)&&Y(to,xt)?zt:Y(to,Ot)?Ot:Y(to,"FxiOS")?jt:Y(to.toLowerCase(),nn.toLowerCase())?nn:dn(to,ue)?Y(to,bt)?Qt:xt:Y(to,Ut)?Ut:Y(to,"MSIE")||Y(to,"Trident/")?Lt:Y(to,"Gecko")?Ut:""},fn=(o(rt={},Dt,[new RegExp("rv:"+rn)]),o(rt,Ht,[new RegExp(Bt+"?\\/"+rn)]),o(rt,Ot,[new RegExp("("+Ot+"|CrMo)\\/"+rn)]),o(rt,At,[new RegExp("CriOS\\/"+rn)]),o(rt,"UC Browser",[new RegExp("(UCBrowser|UCWEB)\\/"+rn)]),o(rt,xt,[sn]),o(rt,Qt,[sn]),o(rt,qt,[new RegExp("(Opera|OPR)\\/"+rn)]),o(rt,Ut,[new RegExp(Ut+"\\/"+rn)]),o(rt,jt,[new RegExp("FxiOS\\/"+rn)]),o(rt,nn,[new RegExp("Konqueror[:/]?"+rn,"i")]),o(rt,Pt,[new RegExp(Pt+" "+rn),sn]),o(rt,zt,[new RegExp("android\\s"+rn,"i")]),o(rt,$t,[new RegExp(Ct+"\\/"+rn)]),o(rt,Lt,[new RegExp("(rv:|MSIE )"+rn)]),o(rt,"Mozilla",[new RegExp("rv:"+rn)]),rt),vn=[[new RegExp(Vt+"; "+Vt+" (.*?)[);]","i"),function(to){return[Vt,to&&to[1]||""]}],[new RegExp(Gt,"i"),[Gt,""]],[new RegExp(Wt,"i"),[Wt,""]],[ln,[Pt,""]],[new RegExp(Jt,"i"),function(to,ue){if(/Phone/.test(ue)||/WPDesktop/.test(ue))return[Yt,""];if(new RegExp(bt).test(ue)&&!/IEMobile\b/.test(ue))return[Jt+" "+bt,""];var eo=/Windows NT ([0-9.]+)/i.exec(ue);if(eo&&eo[1]){var no=eo[1],ro=cn[no]||"";return/arm/i.test(ue)&&(ro="RT"),[Jt,ro]}return[Jt,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,function(to){if(to&&to[3]){var ue=[to[3],to[4],to[5]||"0"];return[kt,ue.join(".")]}return[kt,""]}],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,function(to){var ue="";return to&&to.length>=3&&(ue=w$1(to[2])?to[3]:to[2]),["watchOS",ue]}],[new RegExp("("+wt+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+wt+")","i"),function(to){if(to&&to[2]){var ue=[to[2],to[3],to[4]||"0"];return[wt,ue.join(".")]}return[wt,""]}],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,function(to){var ue=["Mac OS X",""];if(to&&to[1]){var eo=[to[1],to[2],to[3]||"0"];ue[1]=eo.join(".")}return ue}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[Mt,""]],[/Linux|debian/i,["Linux",""]]],pn=function(to){return un.test(to)?Gt:an.test(to)?Wt:on.test(to)?Vt:new RegExp(Kt,"i").test(to)?Kt:new RegExp("("+Yt+"|WPDesktop)","i").test(to)?Yt:/iPad/.test(to)?It:/iPod/.test(to)?"iPod Touch":/iPhone/.test(to)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(to)?Ft:ln.test(to)?Pt:/(kobo)\s(ereader|touch)/i.test(to)?"Kobo":new RegExp(Xt,"i").test(to)?Xt:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(to)||/(kf[a-z]+)( bui|\)).+silk\//i.test(to)?"Kindle Fire":/(Android|ZTE)/i.test(to)?!new RegExp(bt).test(to)||/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(to)?/pixel[\daxl ]{1,6}/i.test(to)&&!/pixel c/i.test(to)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(to)||/lmy47v/i.test(to)&&!/QTAQZ3/i.test(to)?wt:Et:wt:new RegExp("(pda|"+bt+")","i").test(to)?en:new RegExp(St,"i").test(to)&&!new RegExp(St+" pc","i").test(to)?tn:""},gn="https?://(.*)",_n=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gclid","gad_source","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","mc_cid","igshid","ttclid","rdt_cid"],mn={campaignParams:function(to){return L?this._campaignParamsFromUrl(L.URL,to):{}},_campaignParamsFromUrl:function(to,ue){var eo=_n.concat(ue||[]),no={};return Q(eo,function(ro){var oo=mt(to,ro);oo&&(no[ro]=oo)}),no},_searchEngine:function(to){return to?to.search(gn+"google.([^/?]*)")===0?"google":to.search(gn+"bing.com")===0?"bing":to.search(gn+"yahoo.com")===0?"yahoo":to.search(gn+"duckduckgo.com")===0?"duckduckgo":null:null},_searchInfoFromReferrer:function(to){var ue=mn._searchEngine(to),eo=ue!="yahoo"?"q":"p",no={};if(!I(ue)){no.$search_engine=ue;var ro=L?mt(L.referrer,eo):"";ro.length&&(no.ph_keyword=ro)}return no},searchInfo:function(){var to=L==null?void 0:L.referrer;return to?this._searchInfoFromReferrer(to):{}},browser:hn,browserVersion:function(to,ue){var eo=hn(to,ue),no=fn[eo];if(w$1(no))return null;for(var ro=0;ro<no.length;ro++){var oo=no[ro],io=to.match(oo);if(io)return parseFloat(io[io.length-2])}return null},browserLanguage:function(){return navigator.language||navigator.userLanguage},os:function(to){for(var ue=0;ue<vn.length;ue++){var eo=u(vn[ue],2),no=eo[0],ro=eo[1],oo=no.exec(to),io=oo&&(y(ro)?ro(oo,to):ro);if(io)return io}return["",""]},device:pn,deviceType:function(to){var ue=pn(to);return ue===It||ue===Et||ue==="Kobo"||ue==="Kindle Fire"||ue===tn?St:ue===Gt||ue===Vt||ue===Wt||ue===Kt?"Console":ue===Ft?"Wearable":ue?bt:"Desktop"},referrer:function(){return(L==null?void 0:L.referrer)||"$direct"},referringDomain:function(){var to;return L!=null&&L.referrer&&((to=pt(L.referrer))===null||to===void 0?void 0:to.host)||"$direct"},referrerInfo:function(){return{$referrer:this.referrer(),$referring_domain:this.referringDomain()}},initialPersonInfo:function(){return{r:this.referrer(),u:D==null?void 0:D.href}},initialPersonPropsFromInfo:function(to){var ue,eo=to.r,no=to.u,ro={$initial_referrer:eo,$initial_referring_domain:eo==null?void 0:eo=="$direct"?"$direct":(ue=pt(eo))===null||ue===void 0?void 0:ue.host};if(no){ro.$initial_current_url=no;var oo=pt(no);ro.$initial_host=oo==null?void 0:oo.host,ro.$initial_pathname=oo==null?void 0:oo.pathname,Q(this._campaignParamsFromUrl(no),function(io,ao){ro["$initial_"+ne(ao)]=io})}return eo&&Q(this._searchInfoFromReferrer(eo),function(io,ao){ro["$initial_"+ne(ao)]=io}),ro},properties:function(){if(!H)return{};var to=u(mn.os(H),2),ue=to[0],eo=to[1];return J(te({$os:ue,$os_version:eo,$browser:mn.browser(H,navigator.vendor),$device:mn.device(H),$device_type:mn.deviceType(H)}),{$current_url:D==null?void 0:D.href,$host:D==null?void 0:D.host,$pathname:D==null?void 0:D.pathname,$raw_user_agent:H.length>1e3?H.substring(0,997)+"...":H,$browser_version:mn.browserVersion(H,navigator.vendor),$browser_language:mn.browserLanguage(),$screen_height:T==null?void 0:T.screen.height,$screen_width:T==null?void 0:T.screen.width,$viewport_height:T==null?void 0:T.innerHeight,$viewport_width:T==null?void 0:T.innerWidth,$lib:"web",$lib_version:f.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:K()/1e3})},people_properties:function(){if(!H)return{};var to=u(mn.os(H),2),ue=to[0],eo=to[1];return J(te({$os:ue,$os_version:eo,$browser:mn.browser(H,navigator.vendor)}),{$browser_version:mn.browserVersion(H,navigator.vendor)})}},yn=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],bn=function(){function to(ue){i$1(this,to),this.config=ue,this.props={},this.campaign_params_saved=!1,this.name=function(eo){var no="";return eo.token&&(no=eo.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),eo.persistence_name?"ph_"+eo.persistence_name:"ph_"+no+"_posthog"}(ue),this.storage=this.buildStorage(ue),this.load(),ue.debug&&G.info("Persistence loaded",ue.persistence,t$1({},this.props)),this.update_config(ue,ue),this.save()}return s(to,[{key:"buildStorage",value:function(ue){yn.indexOf(ue.persistence.toLowerCase())===-1&&(G.critical("Unknown persistence type "+ue.persistence+"; falling back to localStorage+cookie"),ue.persistence="localStorage+cookie");var eo=ue.persistence.toLowerCase();return eo==="localstorage"&&at.is_supported()?at:eo==="localstorage+cookie"&<.is_supported()?lt:eo==="sessionstorage"&&ft.is_supported()?ft:eo==="memory"?dt:eo==="cookie"?st:lt.is_supported()?lt:st}},{key:"properties",value:function(){var ue={};return Q(this.props,function(eo,no){if(no===Ie&&b(eo))for(var ro=Object.keys(eo),oo=0;oo<ro.length;oo++)ue["$feature/".concat(ro[oo])]=eo[ro[oo]];else ao=no,so=!1,(I(io=Be)?so:M&&io.indexOf===M?io.indexOf(ao)!=-1:(Q(io,function(lo){if(so||(so=lo===ao))return W}),so))||(ue[no]=eo);var io,ao,so}),ue}},{key:"load",value:function(){if(!this.disabled){var ue=this.storage.parse(this.name);ue&&(this.props=J({},ue))}}},{key:"save",value:function(){this.disabled||this.storage.set(this.name,this.props,this.expire_days,this.cross_subdomain,this.secure,this.config.debug)}},{key:"remove",value:function(){this.storage.remove(this.name,!1),this.storage.remove(this.name,!0)}},{key:"clear",value:function(){this.remove(),this.props={}}},{key:"register_once",value:function(ue,eo,no){var ro=this;if(b(ue)){w$1(eo)&&(eo="None"),this.expire_days=w$1(no)?this.default_expiry:no;var oo=!1;if(Q(ue,function(io,ao){ro.props.hasOwnProperty(ao)&&ro.props[ao]!==eo||(ro.props[ao]=io,oo=!0)}),oo)return this.save(),!0}return!1}},{key:"register",value:function(ue,eo){var no=this;if(b(ue)){this.expire_days=w$1(eo)?this.default_expiry:eo;var ro=!1;if(Q(ue,function(oo,io){ue.hasOwnProperty(io)&&no.props[io]!==oo&&(no.props[io]=oo,ro=!0)}),ro)return this.save(),!0}return!1}},{key:"unregister",value:function(ue){ue in this.props&&(delete this.props[ue],this.save())}},{key:"update_campaign_params",value:function(){this.campaign_params_saved||(this.register(mn.campaignParams(this.config.custom_campaign_params)),this.campaign_params_saved=!0)}},{key:"update_search_keyword",value:function(){this.register(mn.searchInfo())}},{key:"update_referrer_info",value:function(){this.register_once(mn.referrerInfo(),void 0)}},{key:"set_initial_person_info",value:function(){this.props[Ae]||this.props[Le]||this.register_once(o({},De,mn.initialPersonInfo()),void 0)}},{key:"get_referrer_info",value:function(){return te({$referrer:this.props.$referrer,$referring_domain:this.props.$referring_domain})}},{key:"get_initial_props",value:function(){var ue=this,eo={};Q([Le,Ae],function(oo){var io=ue.props[oo];io&&Q(io,function(ao,so){eo["$initial_"+ne(so)]=ao})});var no=this.props[De];if(no){var ro=mn.initialPersonPropsFromInfo(no);J(eo,ro)}return eo}},{key:"safe_merge",value:function(ue){return Q(this.props,function(eo,no){no in ue||(ue[no]=eo)}),ue}},{key:"update_config",value:function(ue,eo){if(this.default_expiry=this.expire_days=ue.cookie_expiration,this.set_disabled(ue.disable_persistence),this.set_cross_subdomain(ue.cross_subdomain_cookie),this.set_secure(ue.secure_cookie),ue.persistence!==eo.persistence){var no=this.buildStorage(ue),ro=this.props;this.clear(),this.storage=no,this.props=ro,this.save()}}},{key:"set_disabled",value:function(ue){this.disabled=ue,this.disabled?this.remove():this.save()}},{key:"set_cross_subdomain",value:function(ue){ue!==this.cross_subdomain&&(this.cross_subdomain=ue,this.remove(),this.save())}},{key:"get_cross_subdomain",value:function(){return!!this.cross_subdomain}},{key:"set_secure",value:function(ue){ue!==this.secure&&(this.secure=ue,this.remove(),this.save())}},{key:"set_event_timer",value:function(ue,eo){var no=this.props[de]||{};no[ue]=eo,this.props[de]=no,this.save()}},{key:"remove_event_timer",value:function(ue){var eo=(this.props[de]||{})[ue];return w$1(eo)||(delete this.props[de][ue],this.save()),eo}},{key:"get_property",value:function(ue){return this.props[ue]}},{key:"set_property",value:function(ue,eo){this.props[ue]=eo,this.save()}}]),to}();function kn(to){return JSON.stringify(to,(ue=[],function(eo,no){if(b(no)){for(;ue.length>0&&ue.at(-1)!==this;)ue.pop();return ue.includes(no)?"[Circular]":(ue.push(no),no)}return no})).length;var ue}var wn=2,Sn=4;function En(to){var ue=arguments.length>1&&arguments[1]!==void 0?arguments[1]:66060288e-1;if(to.size>=ue&&to.data.length>1){var eo=Math.floor(to.data.length/2),no=to.data.slice(0,eo),ro=to.data.slice(eo);return[En({size:kn(no),data:no,sessionId:to.sessionId,windowId:to.windowId}),En({size:kn(ro),data:ro,sessionId:to.sessionId,windowId:to.windowId})].flatMap(function(oo){return oo})}return[to]}var In=function(to){return to[to.DomContentLoaded=0]="DomContentLoaded",to[to.Load=1]="Load",to[to.FullSnapshot=2]="FullSnapshot",to[to.IncrementalSnapshot=3]="IncrementalSnapshot",to[to.Meta=4]="Meta",to[to.Custom=5]="Custom",to[to.Plugin=6]="Plugin",to}(In||{}),Rn=function(to){return to[to.Mutation=0]="Mutation",to[to.MouseMove=1]="MouseMove",to[to.MouseInteraction=2]="MouseInteraction",to[to.Scroll=3]="Scroll",to[to.ViewportResize=4]="ViewportResize",to[to.Input=5]="Input",to[to.TouchMove=6]="TouchMove",to[to.MediaInteraction=7]="MediaInteraction",to[to.StyleSheetRule=8]="StyleSheetRule",to[to.CanvasMutation=9]="CanvasMutation",to[to.Font=10]="Font",to[to.Log=11]="Log",to[to.Drag=12]="Drag",to[to.StyleDeclaration=13]="StyleDeclaration",to[to.Selection=14]="Selection",to[to.AdoptedStyleSheet=15]="AdoptedStyleSheet",to[to.CustomElement=16]="CustomElement",to}(Rn||{});function Fn(to){return to?V(to).split(/\s+/):[]}function xn(to){var ue=T==null?void 0:T.location.href;return!!(ue&&to&&to.some(function(eo){return ue.match(eo)}))}function Pn(to){var ue="";switch(n(to.className)){case"string":ue=to.className;break;case"object":ue=(to.className&&"baseVal"in to.className?to.className.baseVal:null)||to.getAttribute("class")||"";break;default:ue=""}return Fn(ue)}function Tn(to){return R(to)?null:V(to).split(/(\s+)/).filter(function(ue){return zn(ue)}).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function Cn(to){var ue="";return Nn(to)&&!Bn(to)&&to.childNodes&&to.childNodes.length&&Q(to.childNodes,function(eo){var no;Mn(eo)&&eo.textContent&&(ue+=(no=Tn(eo.textContent))!==null&&no!==void 0?no:"")}),V(ue)}function $n(to){return!!to&&to.nodeType===1}function On(to,ue){return!!to&&!!to.tagName&&to.tagName.toLowerCase()===ue.toLowerCase()}function Mn(to){return!!to&&to.nodeType===3}function An(to){return!!to&&to.nodeType===11}var Ln=["a","button","form","input","select","textarea","label"];function Dn(to){var ue=to.parentNode;return!(!ue||!$n(ue))&&ue}function qn(to,ue){var eo=arguments.length>2&&arguments[2]!==void 0?arguments[2]:void 0,no=arguments.length>3?arguments[3]:void 0,ro=arguments.length>4?arguments[4]:void 0;if(!T||!to||On(to,"html")||!$n(to)||eo!=null&&eo.url_allowlist&&!xn(eo.url_allowlist)||eo!=null&&eo.url_ignorelist&&xn(eo.url_ignorelist))return!1;if(eo!=null&&eo.dom_event_allowlist){var oo=eo.dom_event_allowlist;if(oo&&!oo.some(function(po){return ue.type===po}))return!1}for(var io=!1,ao=[to],so=!0,lo=to;lo.parentNode&&!On(lo,"body");)if(An(lo.parentNode))ao.push(lo.parentNode.host),lo=lo.parentNode.host;else{if(!(so=Dn(lo)))break;if(no||Ln.indexOf(so.tagName.toLowerCase())>-1)io=!0;else{var co=T.getComputedStyle(so);co&&co.getPropertyValue("cursor")==="pointer"&&(io=!0)}ao.push(so),lo=so}if(!function(po,ho){var _o=ho==null?void 0:ho.element_allowlist;if(w$1(_o))return!0;var go,bo=h(po);try{var vo=function(){var $o=go.value;if(_o.some(function(ko){return $o.tagName.toLowerCase()===ko}))return{v:!0}};for(bo.s();!(go=bo.n()).done;){var yo=vo();if(n(yo)==="object")return yo.v}}catch($o){bo.e($o)}finally{bo.f()}return!1}(ao,eo)||!function(po,ho){var _o=ho==null?void 0:ho.css_selector_allowlist;if(w$1(_o))return!0;var go,bo=h(po);try{var vo=function(){var $o=go.value;if(_o.some(function(ko){return $o.matches(ko)}))return{v:!0}};for(bo.s();!(go=bo.n()).done;){var yo=vo();if(n(yo)==="object")return yo.v}}catch($o){bo.e($o)}finally{bo.f()}return!1}(ao,eo))return!1;var uo=T.getComputedStyle(to);if(uo&&uo.getPropertyValue("cursor")==="pointer"&&ue.type==="click")return!0;var fo=to.tagName.toLowerCase();switch(fo){case"html":return!1;case"form":return(ro||["submit"]).indexOf(ue.type)>=0;case"input":case"select":case"textarea":return(ro||["change","click"]).indexOf(ue.type)>=0;default:return io?(ro||["click"]).indexOf(ue.type)>=0:(ro||["click"]).indexOf(ue.type)>=0&&(Ln.indexOf(fo)>-1||to.getAttribute("contenteditable")==="true")}}function Nn(to){for(var ue=to;ue.parentNode&&!On(ue,"body");ue=ue.parentNode){var eo=Pn(ue);if(Y(eo,"ph-sensitive")||Y(eo,"ph-no-capture"))return!1}if(Y(Pn(to),"ph-include"))return!0;var no=to.type||"";if(S(no))switch(no.toLowerCase()){case"hidden":case"password":return!1}var ro=to.name||to.id||"";return!(S(ro)&&/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(ro.replace(/[^a-zA-Z0-9]/g,"")))}function Bn(to){return!!(On(to,"input")&&!["button","checkbox","submit","reset"].includes(to.type)||On(to,"select")||On(to,"textarea")||to.getAttribute("contenteditable")==="true")}var Hn="(4[0-9]{12}(?:[0-9]{3})?)|(5[1-5][0-9]{14})|(6(?:011|5[0-9]{2})[0-9]{12})|(3[47][0-9]{13})|(3(?:0[0-5]|[68][0-9])[0-9]{11})|((?:2131|1800|35[0-9]{3})[0-9]{11})",Un=new RegExp("^(?:".concat(Hn,")$")),jn=new RegExp(Hn),Gn="\\d{3}-?\\d{2}-?\\d{4}",Wn=new RegExp("^(".concat(Gn,")$")),Vn=new RegExp("(".concat(Gn,")"));function zn(to){var ue=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1];return!(R(to)||S(to)&&(to=V(to),(ue?Un:jn).test((to||"").replace(/[- ]/g,""))||(ue?Wn:Vn).test(to)))}function Qn(to){var ue=Cn(to);return zn(ue="".concat(ue," ").concat(Jn(to)).trim())?ue:""}function Jn(to){var ue="";return to&&to.childNodes&&to.childNodes.length&&Q(to.childNodes,function(eo){var no;if(eo&&((no=eo.tagName)===null||no===void 0?void 0:no.toLowerCase())==="span")try{var ro=Cn(eo);ue="".concat(ue," ").concat(ro).trim(),eo.childNodes&&eo.childNodes.length&&(ue="".concat(ue," ").concat(Jn(eo)).trim())}catch(oo){G.error(oo)}}),ue}function Yn(to){return function(ue){var eo=ue.map(function(no){var ro,oo,io="";if(no.tag_name&&(io+=no.tag_name),no.attr_class){no.attr_class.sort();var ao,so=h(no.attr_class);try{for(so.s();!(ao=so.n()).done;){var lo=ao.value;io+=".".concat(lo.replace(/"/g,""))}}catch(fo){so.e(fo)}finally{so.f()}}var co=t$1(t$1(t$1(t$1({},no.text?{text:no.text}:{}),{},{"nth-child":(ro=no.nth_child)!==null&&ro!==void 0?ro:0,"nth-of-type":(oo=no.nth_of_type)!==null&&oo!==void 0?oo:0},no.href?{href:no.href}:{}),no.attr_id?{attr_id:no.attr_id}:{}),no.attributes),uo={};return X(co).sort(function(fo,po){var ho=u(fo,1)[0],_o=u(po,1)[0];return ho.localeCompare(_o)}).forEach(function(fo){var po=u(fo,2),ho=po[0],_o=po[1];return uo[Xn(ho.toString())]=Xn(_o.toString())}),io+=":",io+=X(co).map(function(fo){var po=u(fo,2),ho=po[0],_o=po[1];return"".concat(ho,'="').concat(_o,'"')}).join("")});return eo.join(";")}(function(ue){return ue.map(function(eo){var no,ro,oo={text:(no=eo.$el_text)===null||no===void 0?void 0:no.slice(0,400),tag_name:eo.tag_name,href:(ro=eo.attr__href)===null||ro===void 0?void 0:ro.slice(0,2048),attr_class:Kn(eo),attr_id:eo.attr__id,nth_child:eo.nth_child,nth_of_type:eo.nth_of_type,attributes:{}};return X(eo).filter(function(io){return u(io,1)[0].indexOf("attr__")===0}).forEach(function(io){var ao=u(io,2),so=ao[0],lo=ao[1];return oo.attributes[so]=lo}),oo})}(to))}function Xn(to){return to.replace(/"|\\"/g,'\\"')}function Kn(to){var ue=to.attr__class;return ue?m(ue)?ue:Fn(ue):void 0}var Zn="[SessionRecording]",ei="redacted",ti={initiatorTypes:["audio","beacon","body","css","early-hint","embed","fetch","frame","iframe","icon","image","img","input","link","navigation","object","ping","script","track","video","xmlhttprequest"],maskRequestFn:function(to){return to},recordHeaders:!1,recordBody:!1,recordInitialRequests:!1,recordPerformance:!1,performanceEntryTypeToObserve:["first-input","navigation","paint","resource"],payloadSizeLimitBytes:1e6,payloadHostDenyList:[".lr-ingest.io",".ingest.sentry.io"]},ni=["authorization","x-forwarded-for","authorization","cookie","set-cookie","x-api-key","x-real-ip","remote-addr","forwarded","proxy-authorization","x-csrf-token","x-csrftoken","x-xsrf-token"],ii=["password","secret","passwd","api_key","apikey","auth","credentials","mysql_pwd","privatekey","private_key","token"],ri=["/s/","/e/","/i/"];function si(to,ue,eo,no){if(R(to))return to;var ro=(ue==null?void 0:ue["content-length"])||function(oo){return new Blob([oo]).size}(to);return S(ro)&&(ro=parseInt(ro)),ro>eo?Zn+" ".concat(no," body too large to record (").concat(ro," bytes)"):to}function oi(to,ue){if(R(to))return to;var eo=to;return zn(eo,!1)||(eo=Zn+" "+ue+" body "+ei),Q(ii,function(no){var ro,oo;(ro=eo)!==null&&ro!==void 0&&ro.length&&((oo=eo)===null||oo===void 0?void 0:oo.indexOf(no))!==-1&&(eo=Zn+" "+ue+" body "+ei+" as might contain: "+no)}),eo}var ai,ui=function(to,ue){var eo,no,ro,oo={payloadSizeLimitBytes:ti.payloadSizeLimitBytes,performanceEntryTypeToObserve:l(ti.performanceEntryTypeToObserve),payloadHostDenyList:[].concat(l(ue.payloadHostDenyList||[]),l(ti.payloadHostDenyList))},io=to.session_recording.recordHeaders!==!1&&ue.recordHeaders,ao=to.session_recording.recordBody!==!1&&ue.recordBody,so=to.capture_performance!==!1&&ue.recordPerformance,lo=(eo=oo,ro=Math.min(1e6,(no=eo.payloadSizeLimitBytes)!==null&&no!==void 0?no:1e6),function(fo){return fo!=null&&fo.requestBody&&(fo.requestBody=si(fo.requestBody,fo.requestHeaders,ro,"Request")),fo!=null&&fo.responseBody&&(fo.responseBody=si(fo.responseBody,fo.responseHeaders,ro,"Response")),fo}),co=function(fo){return lo(function(_o){var go=pt(_o.name);if(!(go&&go.pathname&&ri.some(function(bo){return go.pathname.indexOf(bo)===0})))return _o}((ho=(po=fo).requestHeaders,R(ho)||Q(Object.keys(ho??{}),function(_o){ni.includes(_o.toLowerCase())&&(ho[_o]=ei)}),po)));var po,ho},uo=y(to.session_recording.maskNetworkRequestFn);return uo&&y(to.session_recording.maskCapturedNetworkRequestFn)&&G.warn("Both `maskNetworkRequestFn` and `maskCapturedNetworkRequestFn` are defined. `maskNetworkRequestFn` will be ignored."),uo&&(to.session_recording.maskCapturedNetworkRequestFn=function(fo){var po=to.session_recording.maskNetworkRequestFn({url:fo.name});return t$1(t$1({},fo),{},{name:po==null?void 0:po.url})}),oo.maskRequestFn=y(to.session_recording.maskCapturedNetworkRequestFn)?function(fo){var po,ho,_o,go=co(fo);return go&&(po=(ho=(_o=to.session_recording).maskCapturedNetworkRequestFn)===null||ho===void 0?void 0:ho.call(_o,go))!==null&&po!==void 0?po:void 0}:function(fo){return function(po){if(!w$1(po))return po.requestBody=oi(po.requestBody,"Request"),po.responseBody=oi(po.responseBody,"Response"),po}(co(fo))},t$1(t$1(t$1({},ti),oo),{},{recordHeaders:io,recordBody:ao,recordPerformance:so,recordInitialRequests:so})},li=s(function to(ue){var eo,no,ro=this,oo=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};i$1(this,to),o(this,"bucketSize",100),o(this,"refillRate",10),o(this,"mutationBuckets",{}),o(this,"loggedTracker",{}),o(this,"refillBuckets",function(){Object.keys(ro.mutationBuckets).forEach(function(io){ro.mutationBuckets[io]=ro.mutationBuckets[io]+ro.refillRate,ro.mutationBuckets[io]>=ro.bucketSize&&delete ro.mutationBuckets[io]})}),o(this,"getNodeOrRelevantParent",function(io){var ao=ro.rrweb.mirror.getNode(io);if((ao==null?void 0:ao.nodeName)!=="svg"&&ao instanceof Element){var so=ao.closest("svg");if(so)return[ro.rrweb.mirror.getId(so),so]}return[io,ao]}),o(this,"numberOfChanges",function(io){var ao,so,lo,co,uo,fo,po,ho;return((ao=(so=io.removes)===null||so===void 0?void 0:so.length)!==null&&ao!==void 0?ao:0)+((lo=(co=io.attributes)===null||co===void 0?void 0:co.length)!==null&&lo!==void 0?lo:0)+((uo=(fo=io.texts)===null||fo===void 0?void 0:fo.length)!==null&&uo!==void 0?uo:0)+((po=(ho=io.adds)===null||ho===void 0?void 0:ho.length)!==null&&po!==void 0?po:0)}),o(this,"throttleMutations",function(io){if(io.type!==3||io.data.source!==0)return io;var ao=io.data,so=ro.numberOfChanges(ao);ao.attributes&&(ao.attributes=ao.attributes.filter(function(co){var uo,fo,po,ho=u(ro.getNodeOrRelevantParent(co.id),2),_o=ho[0],go=ho[1];return ro.mutationBuckets[_o]===0?!1:(ro.mutationBuckets[_o]=(uo=ro.mutationBuckets[_o])!==null&&uo!==void 0?uo:ro.bucketSize,ro.mutationBuckets[_o]=Math.max(ro.mutationBuckets[_o]-1,0),ro.mutationBuckets[_o]===0&&(ro.loggedTracker[_o]||(ro.loggedTracker[_o]=!0,(fo=(po=ro.options).onBlockedNode)===null||fo===void 0||fo.call(po,_o,go))),co)}));var lo=ro.numberOfChanges(ao);return lo!==0||so===lo?io:void 0}),this.rrweb=ue,this.options=oo,this.refillRate=(eo=this.options.refillRate)!==null&&eo!==void 0?eo:this.refillRate,this.bucketSize=(no=this.options.bucketSize)!==null&&no!==void 0?no:this.bucketSize,setInterval(function(){ro.refillBuckets()},1e3)}),ci=3e5,di=[Rn.MouseMove,Rn.MouseInteraction,Rn.Scroll,Rn.ViewportResize,Rn.Input,Rn.TouchMove,Rn.MediaInteraction,Rn.Drag],hi=function(to){return{rrwebMethod:to,enqueuedAt:Date.now(),attempt:1}},fi="[SessionRecording]",vi=function(){function to(ue){var eo=this;if(i$1(this,to),o(this,"queuedRRWebEvents",[]),o(this,"isIdle",!1),o(this,"_linkedFlagSeen",!1),o(this,"_lastActivityTimestamp",Date.now()),o(this,"_linkedFlag",null),o(this,"_forceAllowLocalhostNetworkCapture",!1),o(this,"_onBeforeUnload",function(){eo._flushBuffer()}),o(this,"_onOffline",function(){eo._tryAddCustomEvent("browser offline",{})}),o(this,"_onOnline",function(){eo._tryAddCustomEvent("browser online",{})}),o(this,"_onVisibilityChange",function(){if(L!=null&&L.visibilityState){var io="window "+L.visibilityState;eo._tryAddCustomEvent(io,{})}}),o(this,"_samplingSessionListener",null),this.instance=ue,this._captureStarted=!1,this._endpoint="/s/",this.stopRrweb=void 0,this.receivedDecide=!1,!this.instance.sessionManager)throw G.error(fi+" started without valid sessionManager"),new Error(fi+" started without valid sessionManager. This is a bug.");var no=this.sessionManager.checkAndGetSessionAndWindowId(),ro=no.sessionId,oo=no.windowId;this.sessionId=ro,this.windowId=oo,this.buffer=this.clearBuffer(),this._setupSampling()}return s(to,[{key:"rrwebRecord",get:function(){var ue;return U==null||(ue=U.rrweb)===null||ue===void 0?void 0:ue.record}},{key:"started",get:function(){return this._captureStarted}},{key:"sessionManager",get:function(){if(!this.instance.sessionManager)throw new Error(fi+" must be started with a valid sessionManager.");return this.instance.sessionManager}},{key:"fullSnapshotIntervalMillis",get:function(){var ue;return((ue=this.instance.config.session_recording)===null||ue===void 0?void 0:ue.full_snapshot_interval_millis)||ci}},{key:"isSampled",get:function(){var ue=this.instance.get_property(Ee);return x$1(ue)?ue:null}},{key:"sessionDuration",get:function(){var ue,eo,no=(ue=this.buffer)===null||ue===void 0?void 0:ue.data[((eo=this.buffer)===null||eo===void 0?void 0:eo.data.length)-1],ro=this.sessionManager.checkAndGetSessionAndWindowId(!0).sessionStartTimestamp;return no?no.timestamp-ro:null}},{key:"isRecordingEnabled",get:function(){var ue=!!this.instance.get_property(_e),eo=!this.instance.config.disable_session_recording;return T&&ue&&eo}},{key:"isConsoleLogCaptureEnabled",get:function(){var ue=!!this.instance.get_property(me),eo=this.instance.config.enable_recording_console_log;return eo??ue}},{key:"canvasRecording",get:function(){var ue=this.instance.get_property(be);return ue&&ue.fps&&ue.quality?{enabled:ue.enabled,fps:ue.fps,quality:ue.quality}:void 0}},{key:"networkPayloadCapture",get:function(){var ue,eo,no=this.instance.get_property(ye),ro={recordHeaders:(ue=this.instance.config.session_recording)===null||ue===void 0?void 0:ue.recordHeaders,recordBody:(eo=this.instance.config.session_recording)===null||eo===void 0?void 0:eo.recordBody},oo=(ro==null?void 0:ro.recordHeaders)||(no==null?void 0:no.recordHeaders),io=(ro==null?void 0:ro.recordBody)||(no==null?void 0:no.recordBody),ao=b(this.instance.config.capture_performance)?this.instance.config.capture_performance.network_timing:this.instance.config.capture_performance,so=!!(x$1(ao)?ao:no!=null&&no.capturePerformance);return oo||io||so?{recordHeaders:oo,recordBody:io,recordPerformance:so}:void 0}},{key:"sampleRate",get:function(){var ue=this.instance.get_property(ke);return F(ue)?ue:null}},{key:"minimumDuration",get:function(){var ue=this.instance.get_property(we);return F(ue)?ue:null}},{key:"status",get:function(){return this.receivedDecide?this.isRecordingEnabled?R(this._linkedFlag)||this._linkedFlagSeen?x$1(this.isSampled)?this.isSampled?"sampled":"disabled":"active":"buffering":"disabled":"buffering"}},{key:"startIfEnabledOrStop",value:function(){this.isRecordingEnabled?(this._startCapture(),T==null||T.addEventListener("beforeunload",this._onBeforeUnload),T==null||T.addEventListener("offline",this._onOffline),T==null||T.addEventListener("online",this._onOnline),T==null||T.addEventListener("visibilitychange",this._onVisibilityChange),G.info(fi+" started")):(this.stopRecording(),this.clearBuffer())}},{key:"stopRecording",value:function(){this._captureStarted&&this.stopRrweb&&(this.stopRrweb(),this.stopRrweb=void 0,this._captureStarted=!1,T==null||T.removeEventListener("beforeunload",this._onBeforeUnload),T==null||T.removeEventListener("offline",this._onOffline),T==null||T.removeEventListener("online",this._onOnline),T==null||T.removeEventListener("visibilitychange",this._onVisibilityChange),G.info(fi+" stopped"))}},{key:"makeSamplingDecision",value:function(ue){var eo,no=this.sessionId!==ue,ro=this.sampleRate;if(F(ro)){var oo,io=this.isSampled,ao=no||!x$1(io);ao?oo=Math.random()<ro:oo=io,!oo&&ao&&G.warn(fi+" Sample rate (".concat(ro,") has determined that this sessionId (").concat(ue,") will not be sent to the server.")),this._tryAddCustomEvent("samplingDecisionMade",{sampleRate:ro}),(eo=this.instance.persistence)===null||eo===void 0||eo.register(o({},Ee,oo))}else{var so;(so=this.instance.persistence)===null||so===void 0||so.register(o({},Ee,null))}}},{key:"afterDecideResponse",value:function(ue){var eo,no,ro,oo=this;if(this._persistDecideResponse(ue),this._linkedFlag=((eo=ue.sessionRecording)===null||eo===void 0?void 0:eo.linkedFlag)||null,(no=ue.sessionRecording)!==null&&no!==void 0&&no.endpoint&&(this._endpoint=(ro=ue.sessionRecording)===null||ro===void 0?void 0:ro.endpoint),this._setupSampling(),!R(this._linkedFlag)&&!this._linkedFlagSeen){var io=S(this._linkedFlag)?this._linkedFlag:this._linkedFlag.flag,ao=S(this._linkedFlag)?null:this._linkedFlag.variant;this.instance.onFeatureFlags(function(so,lo){var co=b(lo)&&io in lo,uo=ao?lo[io]===ao:co;if(uo){var fo={linkedFlag:io,linkedVariant:ao},po="linked flag matched";G.info(fi+" "+po,fo),oo._tryAddCustomEvent(po,fo)}oo._linkedFlagSeen=uo})}this.receivedDecide=!0,this.startIfEnabledOrStop()}},{key:"_setupSampling",value:function(){var ue=this;F(this.sampleRate)&&I(this._samplingSessionListener)&&(this._samplingSessionListener=this.sessionManager.onSessionId(function(eo){ue.makeSamplingDecision(eo)}))}},{key:"_persistDecideResponse",value:function(ue){if(this.instance.persistence){var eo=this.instance.persistence,no=function(){var ro,oo,io,ao,so,lo,co,uo,fo=(ro=ue.sessionRecording)===null||ro===void 0?void 0:ro.sampleRate,po=R(fo)?null:parseFloat(fo),ho=(oo=ue.sessionRecording)===null||oo===void 0?void 0:oo.minimumDurationMilliseconds;eo.register((o(uo={},_e,!!ue.sessionRecording),o(uo,me,(io=ue.sessionRecording)===null||io===void 0?void 0:io.consoleLogRecordingEnabled),o(uo,ye,t$1({capturePerformance:ue.capturePerformance},(ao=ue.sessionRecording)===null||ao===void 0?void 0:ao.networkPayloadCapture)),o(uo,be,{enabled:(so=ue.sessionRecording)===null||so===void 0?void 0:so.recordCanvas,fps:(lo=ue.sessionRecording)===null||lo===void 0?void 0:lo.canvasFps,quality:(co=ue.sessionRecording)===null||co===void 0?void 0:co.canvasQuality}),o(uo,ke,po),o(uo,we,w$1(ho)?null:ho),uo))};no(),this.sessionManager.onSessionId(no)}}},{key:"log",value:function(ue){var eo,no=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"log";(eo=this.instance.sessionRecording)===null||eo===void 0||eo.onRRwebEmit({type:6,data:{plugin:"rrweb/console@1",payload:{level:no,trace:[],payload:[JSON.stringify(ue)]}},timestamp:K()})}},{key:"_startCapture",value:function(){var ue=this;w$1(Object.assign)||this._captureStarted||this.instance.config.disable_session_recording||this.instance.consent.isOptedOut()||(this._captureStarted=!0,this.sessionManager.checkAndGetSessionAndWindowId(),this.rrwebRecord?this._onScriptLoaded():this.instance.requestRouter.loadScript("/static/recorder.js?v=".concat(f.LIB_VERSION),function(eo){if(eo)return G.error(fi+" could not load recorder.js",eo);ue._onScriptLoaded()}))}},{key:"isInteractiveEvent",value:function(ue){var eo;return ue.type===3&&di.indexOf((eo=ue.data)===null||eo===void 0?void 0:eo.source)!==-1}},{key:"_updateWindowAndSessionIds",value:function(ue){var eo=this.isInteractiveEvent(ue);eo||this.isIdle||ue.timestamp-this._lastActivityTimestamp>3e5&&(this.isIdle=!0,clearTimeout(this._fullSnapshotTimer),this._flushBuffer());var no=!1;if(eo&&(this._lastActivityTimestamp=ue.timestamp,this.isIdle&&(this.isIdle=!1,this._tryAddCustomEvent("sessionNoLongerIdle",{reason:"user activity",type:ue.type}),no=!0)),!this.isIdle){var ro=this.sessionManager.checkAndGetSessionAndWindowId(!eo,ue.timestamp),oo=ro.windowId,io=ro.sessionId,ao=this.sessionId!==io,so=this.windowId!==oo;this.windowId=oo,this.sessionId=io,(no||[wn,Sn].indexOf(ue.type)===-1&&(so||ao||w$1(this._fullSnapshotTimer)))&&this._tryTakeFullSnapshot()}}},{key:"_tryRRWebMethod",value:function(ue){try{return ue.rrwebMethod(),!0}catch(eo){return this.queuedRRWebEvents.length<10?this.queuedRRWebEvents.push({enqueuedAt:ue.enqueuedAt||Date.now(),attempt:ue.attempt++,rrwebMethod:ue.rrwebMethod}):G.warn(fi+" could not emit queued rrweb event.",eo,ue),!1}}},{key:"_tryAddCustomEvent",value:function(ue,eo){var no=this;return this._tryRRWebMethod(hi(function(){return no.rrwebRecord.addCustomEvent(ue,eo)}))}},{key:"_tryTakeFullSnapshot",value:function(){var ue=this;return this._tryRRWebMethod(hi(function(){return ue.rrwebRecord.takeFullSnapshot()}))}},{key:"_onScriptLoaded",value:function(){for(var ue,eo=this,no={blockClass:"ph-no-capture",blockSelector:void 0,ignoreClass:"ph-ignore-input",maskTextClass:"ph-mask",maskTextSelector:void 0,maskTextFn:void 0,maskAllInputs:!0,maskInputOptions:{password:!0},maskInputFn:void 0,slimDOMOptions:{},collectFonts:!1,inlineStylesheet:!0,recordCrossOriginIframes:!1},ro=this.instance.config.session_recording,oo=0,io=Object.entries(ro||{});oo<io.length;oo++){var ao=u(io[oo],2),so=ao[0],lo=ao[1];so in no&&(so==="maskInputOptions"?no.maskInputOptions=t$1({password:!0},lo):no[so]=lo)}if(this.canvasRecording&&this.canvasRecording.enabled&&(no.recordCanvas=!0,no.sampling={canvas:this.canvasRecording.fps},no.dataURLOptions={type:"image/webp",quality:this.canvasRecording.quality}),this.rrwebRecord){this.mutationRateLimiter=(ue=this.mutationRateLimiter)!==null&&ue!==void 0?ue:new li(this.rrwebRecord,{onBlockedNode:function(uo,fo){var po="Too many mutations on node '".concat(uo,"'. Rate limiting. This could be due to SVG animations or something similar");G.info(po,{node:fo}),eo.log(fi+" "+po,"warn")}});var co=this._gatherRRWebPlugins();this.stopRrweb=this.rrwebRecord(t$1({emit:function(uo){eo.onRRwebEmit(uo)},plugins:co},no)),this.instance._addCaptureHook(function(uo){try{if(uo==="$pageview"){var fo=T?eo._maskUrl(T.location.href):"";if(!fo)return;eo._tryAddCustomEvent("$pageview",{href:fo})}}catch(po){G.error("Could not add $pageview to rrweb session",po)}}),this._lastActivityTimestamp=Date.now(),this.isIdle=!1,this._tryAddCustomEvent("$session_options",{sessionRecordingOptions:no,activePlugins:co.map(function(uo){return uo==null?void 0:uo.name})}),this._tryAddCustomEvent("$posthog_config",{config:this.instance.config})}else G.error(fi+"onScriptLoaded was called but rrwebRecord is not available. This indicates something has gone wrong.")}},{key:"_scheduleFullSnapshot",value:function(){var ue=this;if(this._fullSnapshotTimer&&clearInterval(this._fullSnapshotTimer),!this.isIdle){var eo=this.fullSnapshotIntervalMillis;eo&&(this._fullSnapshotTimer=setInterval(function(){ue._tryTakeFullSnapshot()},eo))}}},{key:"_gatherRRWebPlugins",value:function(){var ue=[];return U.rrwebConsoleRecord&&this.isConsoleLogCaptureEnabled&&ue.push(U.rrwebConsoleRecord.getRecordConsolePlugin()),this.networkPayloadCapture&&y(U.getRecordNetworkPlugin)&&(!vt.includes(location.hostname)||this._forceAllowLocalhostNetworkCapture?ue.push(U.getRecordNetworkPlugin(ui(this.instance.config,this.networkPayloadCapture))):G.info(fi+" NetworkCapture not started because we are on localhost.")),ue}},{key:"onRRwebEmit",value:function(ue){if(this._processQueuedEvents(),ue&&b(ue)){if(ue.type===In.Meta){var eo=this._maskUrl(ue.data.href);if(this._lastHref=eo,!eo)return;ue.data.href=eo}else this._pageViewFallBack();ue.type===In.FullSnapshot&&this._scheduleFullSnapshot();var no=this.mutationRateLimiter?this.mutationRateLimiter.throttleMutations(ue):ue;if(no){var ro=function(ao){var so=ao;if(so&&b(so)&&so.type===6&&b(so.data)&&so.data.plugin==="rrweb/console@1"){so.data.payload.payload.length>10&&(so.data.payload.payload=so.data.payload.payload.slice(0,10),so.data.payload.payload.push("...[truncated]"));for(var lo=[],co=0;co<so.data.payload.payload.length;co++)so.data.payload.payload[co]&&so.data.payload.payload[co].length>2e3?lo.push(so.data.payload.payload[co].slice(0,2e3)+"...[truncated]"):lo.push(so.data.payload.payload[co]);return so.data.payload.payload=lo,ao}return ao}(no),oo=kn(ro);if(this._updateWindowAndSessionIds(ro),!this.isIdle||ro.type===In.Custom){var io={$snapshot_bytes:oo,$snapshot_data:ro,$session_id:this.sessionId,$window_id:this.windowId};this.status!=="disabled"?this._captureSnapshotBuffered(io):this.clearBuffer()}}}}},{key:"_pageViewFallBack",value:function(){if(!this.instance.config.capture_pageview&&T){var ue=this._maskUrl(T.location.href);this._lastHref!==ue&&(this._tryAddCustomEvent("$url_changed",{href:ue}),this._lastHref=ue)}}},{key:"_processQueuedEvents",value:function(){var ue=this;if(this.queuedRRWebEvents.length){var eo=l(this.queuedRRWebEvents);this.queuedRRWebEvents=[],eo.forEach(function(no){Date.now()-no.enqueuedAt<=2e3&&ue._tryRRWebMethod(no)})}}},{key:"_maskUrl",value:function(ue){var eo=this.instance.config.session_recording;if(eo.maskNetworkRequestFn){var no,ro={url:ue};return(no=ro=eo.maskNetworkRequestFn(ro))===null||no===void 0?void 0:no.url}return ue}},{key:"clearBuffer",value:function(){return this.buffer={size:0,data:[],sessionId:this.sessionId,windowId:this.windowId},this.buffer}},{key:"_flushBuffer",value:function(){var ue=this;this.flushBufferTimer&&(clearTimeout(this.flushBufferTimer),this.flushBufferTimer=void 0);var eo=this.minimumDuration,no=this.sessionDuration,ro=F(no)&&no>=0,oo=F(eo)&&ro&&no<eo;return this.status==="buffering"||oo?(this.flushBufferTimer=setTimeout(function(){ue._flushBuffer()},2e3),this.buffer):(this.buffer.data.length>0&&En(this.buffer).forEach(function(io){ue._captureSnapshot({$snapshot_bytes:io.size,$snapshot_data:io.data,$session_id:io.sessionId,$window_id:io.windowId})}),this.clearBuffer())}},{key:"_captureSnapshotBuffered",value:function(ue){var eo,no=this,ro=2+(((eo=this.buffer)===null||eo===void 0?void 0:eo.data.length)||0);(this.buffer.size+ue.$snapshot_bytes+ro>943718.4||this.buffer.sessionId!==this.sessionId)&&(this.buffer=this._flushBuffer()),this.buffer.size+=ue.$snapshot_bytes,this.buffer.data.push(ue.$snapshot_data),this.flushBufferTimer||(this.flushBufferTimer=setTimeout(function(){no._flushBuffer()},2e3))}},{key:"_captureSnapshot",value:function(ue){this.instance.capture("$snapshot",ue,{_url:this.instance.requestRouter.endpointFor("api",this._endpoint),_noTruncate:!0,_batchKey:"recordings",skip_client_rate_limiting:!0})}},{key:"overrideLinkedFlag",value:function(){this._linkedFlagSeen=!0}}]),to}(),pi=function(){function to(ue){i$1(this,to),this.instance=ue,this.instance.decideEndpointWasHit=this.instance._hasBootstrappedFeatureFlags()}return s(to,[{key:"call",value:function(){var ue=this,eo={token:this.instance.config.token,distinct_id:this.instance.get_distinct_id(),groups:this.instance.getGroups(),person_properties:this.instance.get_property(Fe),group_properties:this.instance.get_property(xe),disable_flags:this.instance.config.advanced_disable_feature_flags||this.instance.config.advanced_disable_feature_flags_on_first_load||void 0};this.instance._send_request({method:"POST",url:this.instance.requestRouter.endpointFor("api","/decide/?v=3"),data:eo,compression:this.instance.config.disable_compression?void 0:re.Base64,timeout:this.instance.config.feature_flag_request_timeout_ms,callback:function(no){return ue.parseDecideResponse(no.json)}})}},{key:"parseDecideResponse",value:function(ue){var eo=this;this.instance.featureFlags.setReloadingPaused(!1),this.instance.featureFlags._startReloadTimer();var no=!ue;if(this.instance.config.advanced_disable_feature_flags_on_first_load||this.instance.config.advanced_disable_feature_flags||this.instance.featureFlags.receivedFeatureFlags(ue??{},no),no)G.error("Failed to fetch feature flags from PostHog.");else{if(!L||!L.body)return G.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout(function(){eo.parseDecideResponse(ue)},500);if(this.instance._afterDecideResponse(ue),ue.siteApps)if(this.instance.config.opt_in_site_apps){var ro,oo=h(ue.siteApps);try{var io=function(){var ao=ro.value,so=ao.id,lo=ao.url,co=eo.instance.requestRouter.endpointFor("api",lo);U["__$$ph_site_app_".concat(so)]=eo.instance,eo.instance.requestRouter.loadScript(co,function(uo){if(uo)return G.error("Error while initializing PostHog app with config id ".concat(so),uo)})};for(oo.s();!(ro=oo.n()).done;)io()}catch(ao){oo.e(ao)}finally{oo.f()}}else ue.siteApps.length>0&&G.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}}]),to}(),gi=T!=null&&T.location?yt(T.location.hash,"__posthog")||yt(location.hash,"state"):null,_i="_postHogToolbarParams";(function(to){to[to.UNINITIALIZED=0]="UNINITIALIZED",to[to.LOADING=1]="LOADING",to[to.LOADED=2]="LOADED"})(ai||(ai={}));var mi=function(){function to(ue){i$1(this,to),this.instance=ue}return s(to,[{key:"setToolbarState",value:function(ue){U.ph_toolbar_state=ue}},{key:"getToolbarState",value:function(){var ue;return(ue=U.ph_toolbar_state)!==null&&ue!==void 0?ue:ai.UNINITIALIZED}},{key:"maybeLoadToolbar",value:function(){var ue,eo,no=arguments.length>0&&arguments[0]!==void 0?arguments[0]:void 0,ro=arguments.length>1&&arguments[1]!==void 0?arguments[1]:void 0,oo=arguments.length>2&&arguments[2]!==void 0?arguments[2]:void 0;if(!T||!L)return!1;no=(ue=no)!==null&&ue!==void 0?ue:T.location,oo=(eo=oo)!==null&&eo!==void 0?eo:T.history;try{if(!ro){try{T.localStorage.setItem("test","test"),T.localStorage.removeItem("test")}catch{return!1}ro=T==null?void 0:T.localStorage}var io,ao=gi||yt(no.hash,"__posthog")||yt(no.hash,"state"),so=ao?Z(function(){return JSON.parse(atob(decodeURIComponent(ao)))})||Z(function(){return JSON.parse(decodeURIComponent(ao))}):null;return so&&so.action==="ph_authorize"?((io=so).source="url",io&&Object.keys(io).length>0&&(so.desiredHash?no.hash=so.desiredHash:oo?oo.replaceState(oo.state,"",no.pathname+no.search):no.hash="")):((io=JSON.parse(ro.getItem(_i)||"{}")).source="localstorage",delete io.userIntent),!(!io.token||this.instance.config.token!==io.token)&&(this.loadToolbar(io),!0)}catch{return!1}}},{key:"_callLoadToolbar",value:function(ue){(U.ph_load_toolbar||U.ph_load_editor)(ue,this.instance)}},{key:"loadToolbar",value:function(ue){var eo=this,no=!(L==null||!L.getElementById(Ne));if(!T||no)return!1;var ro=this.instance.requestRouter.region==="custom"&&this.instance.config.advanced_disable_toolbar_metrics,oo=t$1(t$1({token:this.instance.config.token},ue),{},{apiURL:this.instance.requestRouter.endpointFor("ui")},ro?{instrument:!1}:{});if(T.localStorage.setItem(_i,JSON.stringify(t$1(t$1({},oo),{},{source:void 0}))),this.getToolbarState()===ai.LOADED)this._callLoadToolbar(oo);else if(this.getToolbarState()===ai.UNINITIALIZED){this.setToolbarState(ai.LOADING);var io=3e5,ao=Math.floor(Date.now()/io)*io;this.instance.requestRouter.loadScript("/static/toolbar.js?t=".concat(ao),function(so){if(so)return G.error("Failed to load toolbar",so),void eo.setToolbarState(ai.UNINITIALIZED);eo.setToolbarState(ai.LOADED),eo._callLoadToolbar(oo)}),oe(T,"turbolinks:load",function(){eo.setToolbarState(ai.UNINITIALIZED),eo.loadToolbar(oo)})}return!0}},{key:"_loadEditor",value:function(ue){return this.loadToolbar(ue)}},{key:"maybeLoadEditor",value:function(){var ue=arguments.length>0&&arguments[0]!==void 0?arguments[0]:void 0,eo=arguments.length>1&&arguments[1]!==void 0?arguments[1]:void 0,no=arguments.length>2&&arguments[2]!==void 0?arguments[2]:void 0;return this.maybeLoadToolbar(ue,eo,no)}}]),to}(),yi=function(){function to(ue){i$1(this,to),o(this,"isPaused",!0),o(this,"queue",[]),o(this,"flushTimeoutMs",3e3),this.sendRequest=ue}return s(to,[{key:"enqueue",value:function(ue){this.queue.push(ue),this.flushTimeout||this.setFlushTimeout()}},{key:"unload",value:function(){var ue=this;this.clearFlushTimeout();var eo=this.queue.length>0?this.formatQueue():{},no=Object.values(eo);[].concat(l(no.filter(function(ro){return ro.url.indexOf("/e")===0})),l(no.filter(function(ro){return ro.url.indexOf("/e")!==0}))).map(function(ro){ue.sendRequest(t$1(t$1({},ro),{},{transport:"sendBeacon"}))})}},{key:"enable",value:function(){this.isPaused=!1,this.setFlushTimeout()}},{key:"setFlushTimeout",value:function(){var ue=this;this.isPaused||(this.flushTimeout=setTimeout(function(){if(ue.clearFlushTimeout(),ue.queue.length>0){var eo=ue.formatQueue(),no=function(oo){var io=eo[oo],ao=new Date().getTime();io.data&&m(io.data)&&Q(io.data,function(so){so.offset=Math.abs(so.timestamp-ao),delete so.timestamp}),ue.sendRequest(io)};for(var ro in eo)no(ro)}},this.flushTimeoutMs))}},{key:"clearFlushTimeout",value:function(){clearTimeout(this.flushTimeout),this.flushTimeout=void 0}},{key:"formatQueue",value:function(){var ue={};return Q(this.queue,function(eo){var no,ro=eo,oo=(ro?ro.batchKey:null)||ro.url;w$1(ue[oo])&&(ue[oo]=t$1(t$1({},ro),{},{data:[]})),(no=ue[oo].data)===null||no===void 0||no.push(ro.data)}),this.queue=[],ue}}]),to}(),bi=Uint8Array,ki=Uint16Array,wi=Uint32Array,Si=new bi([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),Ei=new bi([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),Ii=new bi([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Ri=function(to,ue){for(var eo=new ki(31),no=0;no<31;++no)eo[no]=ue+=1<<to[no-1];var ro=new wi(eo[30]);for(no=1;no<30;++no)for(var oo=eo[no];oo<eo[no+1];++oo)ro[oo]=oo-eo[no]<<5|no;return[eo,ro]},Fi=Ri(Si,2),xi=Fi[0],Pi=Fi[1];xi[28]=258,Pi[258]=28;for(var Ti=Ri(Ei,0)[1],Ci=new ki(32768),$i=0;$i<32768;++$i){var Oi=(43690&$i)>>>1|(21845&$i)<<1;Oi=(61680&(Oi=(52428&Oi)>>>2|(13107&Oi)<<2))>>>4|(3855&Oi)<<4,Ci[$i]=((65280&Oi)>>>8|(255&Oi)<<8)>>>1}var Mi=function(to,ue,eo){for(var no=to.length,ro=0,oo=new ki(ue);ro<no;++ro)++oo[to[ro]-1];var io,ao=new ki(ue);for(ro=0;ro<ue;++ro)ao[ro]=ao[ro-1]+oo[ro-1]<<1;if(eo){io=new ki(1<<ue);var so=15-ue;for(ro=0;ro<no;++ro)if(to[ro])for(var lo=ro<<4|to[ro],co=ue-to[ro],uo=ao[to[ro]-1]++<<co,fo=uo|(1<<co)-1;uo<=fo;++uo)io[Ci[uo]>>>so]=lo}else for(io=new ki(no),ro=0;ro<no;++ro)io[ro]=Ci[ao[to[ro]-1]++]>>>15-to[ro];return io},Ai$1=new bi(288);for($i=0;$i<144;++$i)Ai$1[$i]=8;for($i=144;$i<256;++$i)Ai$1[$i]=9;for($i=256;$i<280;++$i)Ai$1[$i]=7;for($i=280;$i<288;++$i)Ai$1[$i]=8;var Li=new bi(32);for($i=0;$i<32;++$i)Li[$i]=5;var Di=Mi(Ai$1,9,0),qi=Mi(Li,5,0),Ni=function(to){return(to/8>>0)+(7&to&&1)},Bi=function(to,ue,eo){(ue==null||ue<0)&&(ue=0),(eo==null||eo>to.length)&&(eo=to.length);var no=new(to instanceof ki?ki:to instanceof wi?wi:bi)(eo-ue);return no.set(to.subarray(ue,eo)),no},Hi=function(to,ue,eo){eo<<=7&ue;var no=ue/8>>0;to[no]|=eo,to[no+1]|=eo>>>8},Ui=function(to,ue,eo){eo<<=7&ue;var no=ue/8>>0;to[no]|=eo,to[no+1]|=eo>>>8,to[no+2]|=eo>>>16},ji=function(to,ue){for(var eo=[],no=0;no<to.length;++no)to[no]&&eo.push({s:no,f:to[no]});var ro=eo.length,oo=eo.slice();if(!ro)return[new bi(0),0];if(ro==1){var io=new bi(eo[0].s+1);return io[eo[0].s]=1,[io,1]}eo.sort(function(ko,So){return ko.f-So.f}),eo.push({s:-1,f:25001});var ao=eo[0],so=eo[1],lo=0,co=1,uo=2;for(eo[0]={s:-1,f:ao.f+so.f,l:ao,r:so};co!=ro-1;)ao=eo[eo[lo].f<eo[uo].f?lo++:uo++],so=eo[lo!=co&&eo[lo].f<eo[uo].f?lo++:uo++],eo[co++]={s:-1,f:ao.f+so.f,l:ao,r:so};var fo=oo[0].s;for(no=1;no<ro;++no)oo[no].s>fo&&(fo=oo[no].s);var po=new ki(fo+1),ho=Gi(eo[co-1],po,0);if(ho>ue){no=0;var _o=0,go=ho-ue,bo=1<<go;for(oo.sort(function(ko,So){return po[So.s]-po[ko.s]||ko.f-So.f});no<ro;++no){var vo=oo[no].s;if(!(po[vo]>ue))break;_o+=bo-(1<<ho-po[vo]),po[vo]=ue}for(_o>>>=go;_o>0;){var yo=oo[no].s;po[yo]<ue?_o-=1<<ue-po[yo]++-1:++no}for(;no>=0&&_o;--no){var $o=oo[no].s;po[$o]==ue&&(--po[$o],++_o)}ho=ue}return[new bi(po),ho]},Gi=function to(ue,eo,no){return ue.s==-1?Math.max(to(ue.l,eo,no+1),to(ue.r,eo,no+1)):eo[ue.s]=no},Wi=function(to){for(var ue=to.length;ue&&!to[--ue];);for(var eo=new ki(++ue),no=0,ro=to[0],oo=1,io=function(so){eo[no++]=so},ao=1;ao<=ue;++ao)if(to[ao]==ro&&ao!=ue)++oo;else{if(!ro&&oo>2){for(;oo>138;oo-=138)io(32754);oo>2&&(io(oo>10?oo-11<<5|28690:oo-3<<5|12305),oo=0)}else if(oo>3){for(io(ro),--oo;oo>6;oo-=6)io(8304);oo>2&&(io(oo-3<<5|8208),oo=0)}for(;oo--;)io(ro);oo=1,ro=to[ao]}return[eo.subarray(0,no),ue]},Vi=function(to,ue){for(var eo=0,no=0;no<ue.length;++no)eo+=to[no]*ue[no];return eo},zi=function(to,ue,eo){var no=eo.length,ro=Ni(ue+2);to[ro]=255&no,to[ro+1]=no>>>8,to[ro+2]=255^to[ro],to[ro+3]=255^to[ro+1];for(var oo=0;oo<no;++oo)to[ro+oo+4]=eo[oo];return 8*(ro+4+no)},Qi=function(to,ue,eo,no,ro,oo,io,ao,so,lo,co){Hi(ue,co++,eo),++ro[256];for(var uo=ji(ro,15),fo=uo[0],po=uo[1],ho=ji(oo,15),_o=ho[0],go=ho[1],bo=Wi(fo),vo=bo[0],yo=bo[1],$o=Wi(_o),ko=$o[0],So=$o[1],Ao=new ki(19),Mo=0;Mo<vo.length;++Mo)Ao[31&vo[Mo]]++;for(Mo=0;Mo<ko.length;++Mo)Ao[31&ko[Mo]]++;for(var Eo=ji(Ao,7),To=Eo[0],Io=Eo[1],No=19;No>4&&!To[Ii[No-1]];--No);var xo,zo,Po,Bo,qo=lo+5<<3,Fo=Vi(ro,Ai$1)+Vi(oo,Li)+io,Wo=Vi(ro,fo)+Vi(oo,_o)+io+14+3*No+Vi(Ao,To)+(2*Ao[16]+3*Ao[17]+7*Ao[18]);if(qo<=Fo&&qo<=Wo)return zi(ue,co,to.subarray(so,so+lo));if(Hi(ue,co,1+(Wo<Fo)),co+=2,Wo<Fo){xo=Mi(fo,po,0),zo=fo,Po=Mi(_o,go,0),Bo=_o;var Go=Mi(To,Io,0);for(Hi(ue,co,yo-257),Hi(ue,co+5,So-1),Hi(ue,co+10,No-4),co+=14,Mo=0;Mo<No;++Mo)Hi(ue,co+3*Mo,To[Ii[Mo]]);co+=3*No;for(var Yo=[vo,ko],Xo=0;Xo<2;++Xo){var Qo=Yo[Xo];for(Mo=0;Mo<Qo.length;++Mo){var Jo=31&Qo[Mo];Hi(ue,co,Go[Jo]),co+=To[Jo],Jo>15&&(Hi(ue,co,Qo[Mo]>>>5&127),co+=Qo[Mo]>>>12)}}}else xo=Di,zo=Ai$1,Po=qi,Bo=Li;for(Mo=0;Mo<ao;++Mo)if(no[Mo]>255){Jo=no[Mo]>>>18&31,Ui(ue,co,xo[Jo+257]),co+=zo[Jo+257],Jo>7&&(Hi(ue,co,no[Mo]>>>23&31),co+=Si[Jo]);var na=31&no[Mo];Ui(ue,co,Po[na]),co+=Bo[na],na>3&&(Ui(ue,co,no[Mo]>>>5&8191),co+=Ei[na])}else Ui(ue,co,xo[no[Mo]]),co+=zo[no[Mo]];return Ui(ue,co,xo[256]),co+zo[256]},Ji=new wi([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Yi=new bi(0),Xi=function(){for(var to=new wi(256),ue=0;ue<256;++ue){for(var eo=ue,no=9;--no;)eo=(1&eo&&3988292384)^eo>>>1;to[ue]=eo}return to}(),Ki=function(to,ue,eo,no,ro){return function(oo,io,ao,so,lo,co){var uo=oo.length,fo=new bi(so+uo+5*(1+Math.floor(uo/7e3))+lo),po=fo.subarray(so,fo.length-lo),ho=0;if(!io||uo<8)for(var _o=0;_o<=uo;_o+=65535){var go=_o+65535;go<uo?ho=zi(po,ho,oo.subarray(_o,go)):(po[_o]=co,ho=zi(po,ho,oo.subarray(_o,uo)))}else{for(var bo=Ji[io-1],vo=bo>>>13,yo=8191&bo,$o=(1<<ao)-1,ko=new ki(32768),So=new ki($o+1),Ao=Math.ceil(ao/3),Mo=2*Ao,Eo=function(Sa){return(oo[Sa]^oo[Sa+1]<<Ao^oo[Sa+2]<<Mo)&$o},To=new wi(25e3),Io=new ki(288),No=new ki(32),xo=0,zo=0,Po=(_o=0,0),Bo=0,qo=0;_o<uo;++_o){var Fo=Eo(_o),Wo=32767&_o,Go=So[Fo];if(ko[Wo]=Go,So[Fo]=Wo,Bo<=_o){var Yo=uo-_o;if((xo>7e3||Po>24576)&&Yo>423){ho=Qi(oo,po,0,To,Io,No,zo,Po,qo,_o-qo,ho),Po=xo=zo=0,qo=_o;for(var Xo=0;Xo<286;++Xo)Io[Xo]=0;for(Xo=0;Xo<30;++Xo)No[Xo]=0}var Qo=2,Jo=0,na=yo,Ko=Wo-Go&32767;if(Yo>2&&Fo==Eo(_o-Ko))for(var ia=Math.min(vo,Yo)-1,ea=Math.min(32767,_o),sa=Math.min(258,Yo);Ko<=ea&&--na&&Wo!=Go;){if(oo[_o+Qo]==oo[_o+Qo-Ko]){for(var Aa=0;Aa<sa&&oo[_o+Aa]==oo[_o+Aa-Ko];++Aa);if(Aa>Qo){if(Qo=Aa,Jo=Ko,Aa>ia)break;var pa=Math.min(Ko,Aa-2),va=0;for(Xo=0;Xo<pa;++Xo){var ha=_o-Ko+Xo+32768&32767,La=ha-ko[ha]+32768&32767;La>va&&(va=La,Go=ha)}}}Ko+=(Wo=Go)-(Go=ko[Wo])+32768&32767}if(Jo){To[Po++]=268435456|Pi[Qo]<<18|Ti[Jo];var Ba=31&Pi[Qo],Ea=31&Ti[Jo];zo+=Si[Ba]+Ei[Ea],++Io[257+Ba],++No[Ea],Bo=_o+Qo,++xo}else To[Po++]=oo[_o],++Io[oo[_o]]}}ho=Qi(oo,po,co,To,Io,No,zo,Po,qo,_o-qo,ho),co||(ho=zi(po,ho,Yi))}return Bi(fo,0,so+Ni(ho)+lo)}(to,ue.level==null?6:ue.level,ue.mem==null?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(to.length)))):12+ue.mem,eo,no,!ro)},Zi=function(to,ue,eo){for(;eo;++ue)to[ue]=eo,eo>>>=8};function er(to,ue){ue===void 0&&(ue={});var eo=function(){var ao=4294967295;return{p:function(so){for(var lo=ao,co=0;co<so.length;++co)lo=Xi[255&lo^so[co]]^lo>>>8;ao=lo},d:function(){return 4294967295^ao}}}(),no=to.length;eo.p(to);var ro,oo=Ki(to,ue,10+((ro=ue).filename&&ro.filename.length+1||0),8),io=oo.length;return function(ao,so){var lo=so.filename;if(ao[0]=31,ao[1]=139,ao[2]=8,ao[8]=so.level<2?4:so.level==9?2:0,ao[9]=3,so.mtime!=0&&Zi(ao,4,Math.floor(new Date(so.mtime||Date.now())/1e3)),lo){ao[3]=8;for(var co=0;co<=lo.length;++co)ao[co+10]=lo.charCodeAt(co)}}(oo,ue),Zi(oo,io-8,eo.d()),Zi(oo,io-4,no),oo}var tr=!!N||!!q,nr="text/plain",ir=function(to,ue){var eo=u(to.split("?"),2),no=eo[0],ro=eo[1],oo=t$1({},ue);ro==null||ro.split("&").forEach(function(ao){var so=u(ao.split("="),1)[0];delete oo[so]});var io=_t(oo);return io=io?(ro?ro+"&":"")+io:ro,"".concat(no,"?").concat(io)},rr=function(to){return"data="+encodeURIComponent(typeof to=="string"?to:JSON.stringify(to))},sr=function(to){var ue=to.data,eo=to.compression;if(ue){if(eo===re.GZipJS){var no=er(function(oo,io){var ao=oo.length;if(!io&&typeof TextEncoder<"u")return new TextEncoder().encode(oo);for(var so=new bi(oo.length+(oo.length>>>1)),lo=0,co=function(ho){so[lo++]=ho},uo=0;uo<ao;++uo){if(lo+5>so.length){var fo=new bi(lo+8+(ao-uo<<1));fo.set(so),so=fo}var po=oo.charCodeAt(uo);po<128||io?co(po):po<2048?(co(192|po>>>6),co(128|63&po)):po>55295&&po<57344?(co(240|(po=65536+(1047552&po)|1023&oo.charCodeAt(++uo))>>>18),co(128|po>>>12&63),co(128|po>>>6&63),co(128|63&po)):(co(224|po>>>12),co(128|po>>>6&63),co(128|63&po))}return Bi(so,0,lo)}(JSON.stringify(ue)),{mtime:0});return{contentType:nr,body:new Blob([no],{type:nr})}}if(eo===re.Base64){var ro=function(oo){var io,ao,so,lo,co,uo="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",fo=0,po=0,ho="",_o=[];if(!oo)return oo;oo=se(oo);do io=(co=oo.charCodeAt(fo++)<<16|oo.charCodeAt(fo++)<<8|oo.charCodeAt(fo++))>>18&63,ao=co>>12&63,so=co>>6&63,lo=63&co,_o[po++]=uo.charAt(io)+uo.charAt(ao)+uo.charAt(so)+uo.charAt(lo);while(fo<oo.length);switch(ho=_o.join(""),oo.length%3){case 1:ho=ho.slice(0,-2)+"==";break;case 2:ho=ho.slice(0,-1)+"="}return ho}(JSON.stringify(ue));return{contentType:"application/x-www-form-urlencoded",body:rr(ro)}}return{contentType:"application/json",body:JSON.stringify(ue)}}},or=[];N&&or.push({transport:"XHR",method:function(to){var ue,eo=new N;eo.open(to.method||"GET",to.url,!0);var no=(ue=sr(to))!==null&&ue!==void 0?ue:{},ro=no.contentType,oo=no.body;Q(to.headers,function(io,ao){eo.setRequestHeader(ao,io)}),ro&&eo.setRequestHeader("Content-Type",ro),to.timeout&&(eo.timeout=to.timeout),eo.withCredentials=!0,eo.onreadystatechange=function(){if(eo.readyState===4){var io,ao={statusCode:eo.status,text:eo.responseText};if(eo.status===200)try{ao.json=JSON.parse(eo.responseText)}catch{}(io=to.callback)===null||io===void 0||io.call(to,ao)}},eo.send(oo)}}),q&&or.push({transport:"fetch",method:function(to){var ue,eo,no=(ue=sr(to))!==null&&ue!==void 0?ue:{},ro=no.contentType,oo=no.body,io=new Headers;Q(to.headers,function(co,uo){io.append(uo,co)}),ro&&io.append("Content-Type",ro);var ao=to.url,so=null;if(B){var lo=new B;so={signal:lo.signal,timeout:setTimeout(function(){return lo.abort()},to.timeout)}}q(ao,{method:(to==null?void 0:to.method)||"GET",headers:io,keepalive:to.method==="POST",body:oo,signal:(eo=so)===null||eo===void 0?void 0:eo.signal}).then(function(co){return co.text().then(function(uo){var fo,po={statusCode:co.status,text:uo};if(co.status===200)try{po.json=JSON.parse(uo)}catch(ho){G.error(ho)}(fo=to.callback)===null||fo===void 0||fo.call(to,po)})}).catch(function(co){var uo;G.error(co),(uo=to.callback)===null||uo===void 0||uo.call(to,{statusCode:0,text:co})}).finally(function(){return so?clearTimeout(so.timeout):null})}}),A!=null&&A.sendBeacon&&or.push({transport:"sendBeacon",method:function(to){var ue=ir(to.url,{beacon:"1"});try{var eo,no=(eo=sr(to))!==null&&eo!==void 0?eo:{},ro=no.contentType,oo=no.body,io=typeof oo=="string"?new Blob([oo],{type:ro}):oo;A.sendBeacon(ue,io)}catch{}}});var ar=["retriesPerformedSoFar"],ur,lr=function(){function to(ue){var eo=this;i$1(this,to),o(this,"isPolling",!1),o(this,"pollIntervalMs",3e3),o(this,"queue",[]),this.instance=ue,this.queue=[],this.areWeOnline=!0,!w$1(T)&&"onLine"in T.navigator&&(this.areWeOnline=T.navigator.onLine,T.addEventListener("online",function(){eo.areWeOnline=!0,eo.flush()}),T.addEventListener("offline",function(){eo.areWeOnline=!1}))}return s(to,[{key:"retriableRequest",value:function(ue){var eo=this,no=ue.retriesPerformedSoFar,ro=a(ue,ar);F(no)&&no>0&&(ro.url=ir(ro.url,{retry_count:no})),this.instance._send_request(t$1(t$1({},ro),{},{callback:function(oo){var io;oo.statusCode!==200&&(oo.statusCode<400||oo.statusCode>=500)&&(no??0)<10?eo.enqueue(t$1({retriesPerformedSoFar:no},ro)):(io=ro.callback)===null||io===void 0||io.call(ro,oo)}}))}},{key:"enqueue",value:function(ue){var eo=ue.retriesPerformedSoFar||0;ue.retriesPerformedSoFar=eo+1;var no=function(io){var ao=3e3*Math.pow(2,io),so=ao/2,lo=Math.min(18e5,ao),co=(Math.random()-.5)*(lo-so);return Math.ceil(lo+co)}(eo),ro=Date.now()+no;this.queue.push({retryAt:ro,requestOptions:ue});var oo="Enqueued failed request for retry in ".concat(no);navigator.onLine||(oo+=" (Browser is offline)"),G.warn(oo),this.isPolling||(this.isPolling=!0,this.poll())}},{key:"poll",value:function(){var ue=this;this.poller&&clearTimeout(this.poller),this.poller=setTimeout(function(){ue.areWeOnline&&ue.queue.length>0&&ue.flush(),ue.poll()},this.pollIntervalMs)}},{key:"flush",value:function(){var ue=Date.now(),eo=[],no=this.queue.filter(function(ao){return ao.retryAt<ue||(eo.push(ao),!1)});if(this.queue=eo,no.length>0){var ro,oo=h(no);try{for(oo.s();!(ro=oo.n()).done;){var io=ro.value.requestOptions;this.retriableRequest(io)}}catch(ao){oo.e(ao)}finally{oo.f()}}}},{key:"unload",value:function(){this.poller&&(clearTimeout(this.poller),this.poller=void 0);var ue,eo=h(this.queue);try{for(eo.s();!(ue=eo.n()).done;){var no=ue.value.requestOptions;try{this.instance._send_request(t$1(t$1({},no),{},{transport:"sendBeacon"}))}catch(ro){G.error(ro)}}}catch(ro){eo.e(ro)}finally{eo.f()}this.queue=[]}}]),to}(),cr=1800,dr=function(){function to(ue,eo,no,ro){var oo;i$1(this,to),o(this,"_sessionIdChangedHandlers",[]),this.config=ue,this.persistence=eo,this._windowId=void 0,this._sessionId=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this._sessionIdGenerator=no||Ke,this._windowIdGenerator=ro||Ke;var io=ue.persistence_name||ue.token,ao=ue.session_idle_timeout_seconds||cr;if(F(ao)?ao>cr?G.warn("session_idle_timeout_seconds cannot be greater than 30 minutes. Using 30 minutes instead."):ao<60&&G.warn("session_idle_timeout_seconds cannot be less than 60 seconds. Using 60 seconds instead."):(G.warn("session_idle_timeout_seconds must be a number. Defaulting to 30 minutes."),ao=cr),this._sessionTimeoutMs=1e3*Math.min(Math.max(ao,60),cr),this._window_id_storage_key="ph_"+io+"_window_id",this._primary_window_exists_storage_key="ph_"+io+"_primary_window_exists",this._canUseSessionStorage()){var so=ft.parse(this._window_id_storage_key),lo=ft.parse(this._primary_window_exists_storage_key);so&&!lo?this._windowId=so:ft.remove(this._window_id_storage_key),ft.set(this._primary_window_exists_storage_key,!0)}if((oo=this.config.bootstrap)!==null&&oo!==void 0&&oo.sessionID)try{var co=function(uo){var fo=uo.replace(/-/g,"");if(fo.length!==32)throw new Error("Not a valid UUID");if(fo[12]!=="7")throw new Error("Not a UUIDv7");return parseInt(fo.substring(0,12),16)}(this.config.bootstrap.sessionID);this._setSessionId(this.config.bootstrap.sessionID,new Date().getTime(),co)}catch(uo){G.error("Invalid sessionID in bootstrap",uo)}this._listenToReloadWindow()}return s(to,[{key:"onSessionId",value:function(ue){var eo=this;return w$1(this._sessionIdChangedHandlers)&&(this._sessionIdChangedHandlers=[]),this._sessionIdChangedHandlers.push(ue),this._sessionId&&ue(this._sessionId,this._windowId),function(){eo._sessionIdChangedHandlers=eo._sessionIdChangedHandlers.filter(function(no){return no!==ue})}}},{key:"_canUseSessionStorage",value:function(){return this.config.persistence!=="memory"&&!this.persistence.disabled&&ft.is_supported()}},{key:"_setWindowId",value:function(ue){ue!==this._windowId&&(this._windowId=ue,this._canUseSessionStorage()&&ft.set(this._window_id_storage_key,ue))}},{key:"_getWindowId",value:function(){return this._windowId?this._windowId:this._canUseSessionStorage()?ft.parse(this._window_id_storage_key):null}},{key:"_setSessionId",value:function(ue,eo,no){ue===this._sessionId&&eo===this._sessionActivityTimestamp&&no===this._sessionStartTimestamp||(this._sessionStartTimestamp=no,this._sessionActivityTimestamp=eo,this._sessionId=ue,this.persistence.register(o({},Se,[eo,ue,no])))}},{key:"_getSessionId",value:function(){if(this._sessionId&&this._sessionActivityTimestamp&&this._sessionStartTimestamp)return[this._sessionActivityTimestamp,this._sessionId,this._sessionStartTimestamp];var ue=this.persistence.props[Se];return m(ue)&&ue.length===2&&ue.push(ue[0]),ue||[0,null,0]}},{key:"resetSessionId",value:function(){this._setSessionId(null,null,null)}},{key:"_listenToReloadWindow",value:function(){var ue=this;T==null||T.addEventListener("beforeunload",function(){ue._canUseSessionStorage()&&ft.remove(ue._primary_window_exists_storage_key)})}},{key:"checkAndGetSessionAndWindowId",value:function(){var ue=arguments.length>0&&arguments[0]!==void 0&&arguments[0],eo=(arguments.length>1&&arguments[1]!==void 0?arguments[1]:null)||new Date().getTime(),no=u(this._getSessionId(),3),ro=no[0],oo=no[1],io=no[2],ao=this._getWindowId(),so=io&&io>0&&Math.abs(eo-io)>864e5,lo=!1,co=!oo,uo=!ue&&Math.abs(eo-ro)>this._sessionTimeoutMs;co||uo||so?(oo=this._sessionIdGenerator(),ao=this._windowIdGenerator(),G.info("[SessionId] new session ID generated",{sessionId:oo,windowId:ao,changeReason:{noSessionId:co,activityTimeout:uo,sessionPastMaximumLength:so}}),io=eo,lo=!0):ao||(ao=this._windowIdGenerator(),lo=!0);var fo=ro===0||!ue||so?eo:ro,po=io===0?new Date().getTime():io;return this._setWindowId(ao),this._setSessionId(oo,fo,po),lo&&this._sessionIdChangedHandlers.forEach(function(ho){return ho(oo,ao)}),{sessionId:oo,windowId:ao,sessionStartTimestamp:po}}}]),to}();(function(to){to.US="us",to.EU="eu",to.CUSTOM="custom"})(ur||(ur={}));var hr="i.posthog.com",fr=function(){function to(ue){i$1(this,to),o(this,"_regionCache",{}),this.instance=ue}return s(to,[{key:"apiHost",get:function(){var ue=this.instance.config.api_host.trim().replace(/\/$/,"");return ue==="https://app.posthog.com"?"https://us.i.posthog.com":ue}},{key:"uiHost",get:function(){var ue,eo=(ue=this.instance.config.ui_host)===null||ue===void 0?void 0:ue.replace(/\/$/,"");return eo||(eo=this.apiHost.replace(".".concat(hr),".posthog.com")),eo==="https://app.posthog.com"?"https://us.posthog.com":eo}},{key:"region",get:function(){return this._regionCache[this.apiHost]||(/https:\/\/(app|us|us-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this._regionCache[this.apiHost]=ur.US:/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this._regionCache[this.apiHost]=ur.EU:this._regionCache[this.apiHost]=ur.CUSTOM),this._regionCache[this.apiHost]}},{key:"endpointFor",value:function(ue){var eo=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";if(eo&&(eo=eo[0]==="/"?eo:"/".concat(eo)),ue==="ui")return this.uiHost+eo;if(this.region===ur.CUSTOM)return this.apiHost+eo;var no=hr+eo;switch(ue){case"assets":return"https://".concat(this.region,"-assets.").concat(no);case"api":return"https://".concat(this.region,".").concat(no)}}},{key:"loadScript",value:function(ue,eo){if(this.instance.config.disable_external_dependency_loading)return G.warn("".concat(ue," was requested but loading of external scripts is disabled.")),eo("Loading of external scripts is disabled");var no=ue[0]==="/"?this.endpointFor("assets",ue):ue,ro=function(){if(!L)return eo("document not found");var oo=L.createElement("script");oo.type="text/javascript",oo.src=no,oo.onload=function(so){return eo(void 0,so)},oo.onerror=function(so){return eo(so)};var io,ao=L.querySelectorAll("body > script");ao.length>0?(io=ao[0].parentNode)===null||io===void 0||io.insertBefore(oo,ao[0]):L.body.appendChild(oo)};L!=null&&L.body?ro():L==null||L.addEventListener("DOMContentLoaded",ro)}}]),to}(),vr="posthog-js";function pr(to){var ue=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},eo=ue.organization,no=ue.projectId,ro=ue.prefix,oo=ue.severityAllowList,io=oo===void 0?["error"]:oo;return function(ao){var so,lo,co,uo,fo;if(!(io==="*"||io.includes(ao.level))||!to.__loaded)return ao;ao.tags||(ao.tags={});var po=to.requestRouter.endpointFor("ui","/project/".concat(to.config.token,"/person/").concat(to.get_distinct_id()));ao.tags["PostHog Person URL"]=po,to.sessionRecordingStarted()&&(ao.tags["PostHog Recording URL"]=to.get_session_replay_url({withTimestamp:!0}));var ho=((so=ao.exception)===null||so===void 0?void 0:so.values)||[],_o={$exception_message:((lo=ho[0])===null||lo===void 0?void 0:lo.value)||ao.message,$exception_type:(co=ho[0])===null||co===void 0?void 0:co.type,$exception_personURL:po,$exception_level:ao.level,$sentry_event_id:ao.event_id,$sentry_exception:ao.exception,$sentry_exception_message:((uo=ho[0])===null||uo===void 0?void 0:uo.value)||ao.message,$sentry_exception_type:(fo=ho[0])===null||fo===void 0?void 0:fo.type,$sentry_tags:ao.tags,$level:ao.level};return eo&&no&&(_o.$sentry_url=(ro||"https://sentry.io/organizations/")+eo+"/issues/?project="+no+"&query="+ao.event_id),to.exceptions.sendExceptionEvent(_o),ao}}var gr=s(function to(ue,eo,no,ro,oo){i$1(this,to),this.name=vr,this.setupOnce=function(io){io(pr(ue,{organization:eo,projectId:no,prefix:ro,severityAllowList:oo}))}});function _r(to,ue){var eo=to.config.segment;if(!eo)return ue();(function(no,ro){var oo=no.config.segment;if(!oo)return ro();var io=function(so){var lo=function(){return so.anonymousId()||Ke()};no.config.get_device_id=lo,so.id()&&(no.register({distinct_id:so.id(),$device_id:lo()}),no.persistence.set_property($e,"identified")),ro()},ao=oo.user();"then"in ao&&y(ao.then)?ao.then(function(so){return io(so)}):io(ao)})(to,function(){eo.register(function(no){Promise&&Promise.resolve||G.warn("This browser does not have Promise support, and can not use the segment integration");var ro=function(oo,io){var ao;if(!io)return oo;oo.event.userId||oo.event.anonymousId===no.get_distinct_id()||(G.info("Segment integration does not have a userId set, resetting PostHog"),no.reset()),oo.event.userId&&oo.event.userId!==no.get_distinct_id()&&(G.info("Segment integration has a userId set, identifying with PostHog"),no.identify(oo.event.userId));var so=no._calculate_event_properties(io,(ao=oo.event.properties)!==null&&ao!==void 0?ao:{},new Date);return oo.event.properties=Object.assign({},so,oo.event.properties),oo};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:function(){return!0},load:function(){return Promise.resolve()},track:function(oo){return ro(oo,oo.event.event)},page:function(oo){return ro(oo,"$pageview")},identify:function(oo){return ro(oo,"$identify")},screen:function(oo){return ro(oo,"$screen")}}}(to)).then(function(){ue()})})}var mr,yr,br,kr=function(){function to(ue){i$1(this,to),this._instance=ue}return s(to,[{key:"doPageView",value:function(ue){var eo,no=this._previousPageViewProperties(ue);return this._currentPath=(eo=T==null?void 0:T.location.pathname)!==null&&eo!==void 0?eo:"",this._instance.scrollManager.resetContext(),this._prevPageviewTimestamp=ue,no}},{key:"doPageLeave",value:function(ue){return this._previousPageViewProperties(ue)}},{key:"_previousPageViewProperties",value:function(ue){var eo=this._currentPath,no=this._prevPageviewTimestamp,ro=this._instance.scrollManager.getContext();if(!no)return{};var oo={};if(ro){var io=ro.maxScrollHeight,ao=ro.lastScrollY,so=ro.maxScrollY,lo=ro.maxContentHeight,co=ro.lastContentY,uo=ro.maxContentY;w$1(io)||w$1(ao)||w$1(so)||w$1(lo)||w$1(co)||w$1(uo)||(io=Math.ceil(io),ao=Math.ceil(ao),so=Math.ceil(so),lo=Math.ceil(lo),co=Math.ceil(co),uo=Math.ceil(uo),oo={$prev_pageview_last_scroll:ao,$prev_pageview_last_scroll_percentage:io<=1?1:wr(ao/io,0,1),$prev_pageview_max_scroll:so,$prev_pageview_max_scroll_percentage:io<=1?1:wr(so/io,0,1),$prev_pageview_last_content:co,$prev_pageview_last_content_percentage:lo<=1?1:wr(co/lo,0,1),$prev_pageview_max_content:uo,$prev_pageview_max_content_percentage:lo<=1?1:wr(uo/lo,0,1)})}return eo&&(oo.$prev_pageview_pathname=eo),no&&(oo.$prev_pageview_duration=(ue.getTime()-no.getTime())/1e3),oo}}]),to}();function wr(to,ue,eo){return Math.max(ue,Math.min(to,eo))}(function(to){to.Popover="popover",to.API="api",to.Widget="widget"})(mr||(mr={})),function(to){to.Open="open",to.MultipleChoice="multiple_choice",to.SingleChoice="single_choice",to.Rating="rating",to.Link="link"}(yr||(yr={})),function(to){to.NextQuestion="next_question",to.End="end",to.ResponseBased="response_based",to.SpecificQuestion="specific_question"}(br||(br={}));var Sr=function(){function to(){i$1(this,to),o(this,"events",{}),this.events={}}return s(to,[{key:"on",value:function(ue,eo){var no=this;return this.events[ue]||(this.events[ue]=[]),this.events[ue].push(eo),function(){no.events[ue]=no.events[ue].filter(function(ro){return ro!==eo})}}},{key:"emit",value:function(ue,eo){var no,ro=h(this.events[ue]||[]);try{for(ro.s();!(no=ro.n()).done;)(0,no.value)(eo)}catch(ao){ro.e(ao)}finally{ro.f()}var oo,io=h(this.events["*"]||[]);try{for(io.s();!(oo=io.n()).done;)(0,oo.value)(ue,eo)}catch(ao){io.e(ao)}finally{io.f()}}}]),to}(),Er=function(){function to(ue){var eo=this;i$1(this,to),o(this,"_debugEventEmitter",new Sr),o(this,"checkStep",function(no,ro){return eo.checkStepEvent(no,ro)&&eo.checkStepUrl(no,ro)&&eo.checkStepElement(no,ro)}),o(this,"checkStepEvent",function(no,ro){return ro==null||!ro.event||(no==null?void 0:no.event)===(ro==null?void 0:ro.event)}),this.instance=ue,this.actionEvents=new Set,this.actionRegistry=new Set}return s(to,[{key:"init",value:function(){var ue,eo=this;if(!w$1((ue=this.instance)===null||ue===void 0?void 0:ue._addCaptureHook)){var no;(no=this.instance)===null||no===void 0||no._addCaptureHook(function(ro,oo){eo.on(ro,oo)})}}},{key:"register",value:function(ue){var eo,no,ro=this;if(!w$1((eo=this.instance)===null||eo===void 0?void 0:eo._addCaptureHook)&&(ue.forEach(function(ao){var so,lo;(so=ro.actionRegistry)===null||so===void 0||so.add(ao),(lo=ao.steps)===null||lo===void 0||lo.forEach(function(co){var uo;(uo=ro.actionEvents)===null||uo===void 0||uo.add((co==null?void 0:co.event)||"")})}),(no=this.instance)!==null&&no!==void 0&&no.autocapture)){var oo,io=new Set;ue.forEach(function(ao){var so;(so=ao.steps)===null||so===void 0||so.forEach(function(lo){lo!=null&&lo.selector&&io.add(lo==null?void 0:lo.selector)})}),(oo=this.instance)===null||oo===void 0||oo.autocapture.setElementSelectors(io)}}},{key:"on",value:function(ue,eo){var no,ro=this;eo!=null&&ue.length!=0&&(this.actionEvents.has(ue)||this.actionEvents.has(eo==null?void 0:eo.event))&&this.actionRegistry&&((no=this.actionRegistry)===null||no===void 0?void 0:no.size)>0&&this.actionRegistry.forEach(function(oo){ro.checkAction(eo,oo)&&ro._debugEventEmitter.emit("actionCaptured",oo.name)})}},{key:"_addActionHook",value:function(ue){this.onAction("actionCaptured",function(eo){return ue(eo)})}},{key:"checkAction",value:function(ue,eo){if((eo==null?void 0:eo.steps)==null)return!1;var no,ro=h(eo.steps);try{for(ro.s();!(no=ro.n()).done;){var oo=no.value;if(this.checkStep(ue,oo))return!0}}catch(io){ro.e(io)}finally{ro.f()}return!1}},{key:"onAction",value:function(ue,eo){return this._debugEventEmitter.on(ue,eo)}},{key:"checkStepUrl",value:function(ue,eo){if(eo!=null&&eo.url){var no,ro=ue==null||(no=ue.properties)===null||no===void 0?void 0:no.$current_url;if(!ro||typeof ro!="string"||!to.matchString(ro,eo==null?void 0:eo.url,(eo==null?void 0:eo.url_matching)||"contains"))return!1}return!0}},{key:"checkStepElement",value:function(ue,eo){if((eo!=null&&eo.href||eo!=null&&eo.tag_name||eo!=null&&eo.text)&&!this.getElementsList(ue).some(function(oo){return!(eo!=null&&eo.href&&!to.matchString(oo.href||"",eo==null?void 0:eo.href,(eo==null?void 0:eo.href_matching)||"exact"))&&(eo==null||!eo.tag_name||oo.tag_name===(eo==null?void 0:eo.tag_name))&&!(eo!=null&&eo.text&&!to.matchString(oo.text||"",eo==null?void 0:eo.text,(eo==null?void 0:eo.text_matching)||"exact")&&!to.matchString(oo.$el_text||"",eo==null?void 0:eo.text,(eo==null?void 0:eo.text_matching)||"exact"))}))return!1;if(eo!=null&&eo.selector){var no,ro=ue==null||(no=ue.properties)===null||no===void 0?void 0:no.$element_selectors;if(!ro||!ro.includes(eo==null?void 0:eo.selector))return!1}return!0}},{key:"getElementsList",value:function(ue){return(ue==null?void 0:ue.properties.$elements)==null?[]:ue==null?void 0:ue.properties.$elements}}],[{key:"matchString",value:function(ue,eo,no){switch(no){case"regex":return!!T&>(ue,eo);case"exact":return eo===ue;case"contains":var ro=to.escapeStringRegexp(eo).replace(/_/g,".").replace(/%/g,".*");return gt(ue,ro);default:return!1}}},{key:"escapeStringRegexp",value:function(ue){return ue.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}}]),to}(),Ir=function(){function to(ue){i$1(this,to),this.instance=ue,this.eventToSurveys=new Map,this.actionToSurveys=new Map}return s(to,[{key:"register",value:function(ue){var eo;w$1((eo=this.instance)===null||eo===void 0?void 0:eo._addCaptureHook)||(this.setupEventBasedSurveys(ue),this.setupActionBasedSurveys(ue))}},{key:"setupActionBasedSurveys",value:function(ue){var eo=this,no=ue.filter(function(ro){var oo,io,ao,so;return((oo=ro.conditions)===null||oo===void 0?void 0:oo.actions)&&((io=ro.conditions)===null||io===void 0||(ao=io.actions)===null||ao===void 0||(so=ao.values)===null||so===void 0?void 0:so.length)>0});no.length!==0&&(this.actionMatcher==null&&(this.actionMatcher=new Er(this.instance),this.actionMatcher.init(),this.actionMatcher._addActionHook(function(ro){eo.onAction(ro)})),no.forEach(function(ro){var oo,io,ao,so,lo,co,uo,fo,po,ho;ro.conditions&&(oo=ro.conditions)!==null&&oo!==void 0&&oo.actions&&(io=ro.conditions)!==null&&io!==void 0&&(ao=io.actions)!==null&&ao!==void 0&&ao.values&&((so=ro.conditions)===null||so===void 0||(lo=so.actions)===null||lo===void 0||(co=lo.values)===null||co===void 0?void 0:co.length)>0&&((uo=eo.actionMatcher)===null||uo===void 0||uo.register(ro.conditions.actions.values),(fo=ro.conditions)===null||fo===void 0||(po=fo.actions)===null||po===void 0||(ho=po.values)===null||ho===void 0||ho.forEach(function(_o){if(_o&&_o.name){var go=eo.actionToSurveys.get(_o.name);go&&go.push(ro.id),eo.actionToSurveys.set(_o.name,go||[ro.id])}}))}))}},{key:"setupEventBasedSurveys",value:function(ue){var eo,no=this;ue.filter(function(ro){var oo,io,ao,so;return((oo=ro.conditions)===null||oo===void 0?void 0:oo.events)&&((io=ro.conditions)===null||io===void 0||(ao=io.events)===null||ao===void 0||(so=ao.values)===null||so===void 0?void 0:so.length)>0}).length!==0&&((eo=this.instance)===null||eo===void 0||eo._addCaptureHook(function(ro,oo){no.onEvent(ro,oo)}),ue.forEach(function(ro){var oo,io,ao;(oo=ro.conditions)===null||oo===void 0||(io=oo.events)===null||io===void 0||(ao=io.values)===null||ao===void 0||ao.forEach(function(so){if(so&&so.name){var lo=no.eventToSurveys.get(so.name);lo&&lo.push(ro.id),no.eventToSurveys.set(so.name,lo||[ro.id])}})}))}},{key:"onEvent",value:function(ue,eo){var no,ro,oo=((no=this.instance)===null||no===void 0||(ro=no.persistence)===null||ro===void 0?void 0:ro.props[Te])||[];if(to.SURVEY_SHOWN_EVENT_NAME==ue&&eo&&oo.length>0){var io,ao=eo==null||(io=eo.properties)===null||io===void 0?void 0:io.$survey_id;if(ao){var so=oo.indexOf(ao);so>=0&&(oo.splice(so,1),this._updateActivatedSurveys(oo))}}else this.eventToSurveys.has(ue)&&this._updateActivatedSurveys(oo.concat(this.eventToSurveys.get(ue)||[]))}},{key:"onAction",value:function(ue){var eo,no,ro=((eo=this.instance)===null||eo===void 0||(no=eo.persistence)===null||no===void 0?void 0:no.props[Te])||[];this.actionToSurveys.has(ue)&&this._updateActivatedSurveys(ro.concat(this.actionToSurveys.get(ue)||[]))}},{key:"_updateActivatedSurveys",value:function(ue){var eo,no;(eo=this.instance)===null||eo===void 0||(no=eo.persistence)===null||no===void 0||no.register(o({},Te,l(new Set(ue))))}},{key:"getSurveys",value:function(){var ue,eo,no=(ue=this.instance)===null||ue===void 0||(eo=ue.persistence)===null||eo===void 0?void 0:eo.props[Te];return no||[]}},{key:"getEventToSurveys",value:function(){return this.eventToSurveys}},{key:"_getActionMatcher",value:function(){return this.actionMatcher}}]),to}();o(Ir,"SURVEY_SHOWN_EVENT_NAME","survey shown");var Rr="[Surveys]",Fr={icontains:function(to){return!!T&&T.location.href.toLowerCase().indexOf(to.toLowerCase())>-1},not_icontains:function(to){return!!T&&T.location.href.toLowerCase().indexOf(to.toLowerCase())===-1},regex:function(to){return!!T&>(T.location.href,to)},not_regex:function(to){return!!T&&!gt(T.location.href,to)},exact:function(to){return(T==null?void 0:T.location.href)===to},is_not:function(to){return(T==null?void 0:T.location.href)!==to}},xr=function(){function to(ue){i$1(this,to),this.instance=ue,this._surveyEventReceiver=null}return s(to,[{key:"afterDecideResponse",value:function(ue){this._decideServerResponse=!!ue.surveys,this.loadIfEnabled()}},{key:"loadIfEnabled",value:function(){var ue=this,eo=U==null?void 0:U.extendPostHogWithSurveys;this.instance.config.disable_surveys||!this._decideServerResponse||eo||(this._surveyEventReceiver==null&&(this._surveyEventReceiver=new Ir(this.instance)),this.instance.requestRouter.loadScript("/static/surveys.js",function(no){if(no)return G.error(Rr,"Could not load surveys script",no);ue._surveyManager=U.extendPostHogWithSurveys(ue.instance)}))}},{key:"getSurveys",value:function(ue){var eo=this,no=arguments.length>1&&arguments[1]!==void 0&&arguments[1];if(this.instance.config.disable_surveys)return ue([]);this._surveyEventReceiver==null&&(this._surveyEventReceiver=new Ir(this.instance));var ro=this.instance.get_property(Pe);if(ro&&!no)return ue(ro);this.instance._send_request({url:this.instance.requestRouter.endpointFor("api","/api/surveys/?token=".concat(this.instance.config.token)),method:"GET",transport:"XHR",callback:function(oo){var io;if(oo.statusCode!==200||!oo.json)return ue([]);var ao,so=oo.json.surveys||[],lo=so.filter(function(co){var uo,fo,po,ho,_o,go,bo,vo,yo,$o,ko,So;return((uo=co.conditions)===null||uo===void 0?void 0:uo.events)&&((fo=co.conditions)===null||fo===void 0||(po=fo.events)===null||po===void 0?void 0:po.values)&&((ho=co.conditions)===null||ho===void 0||(_o=ho.events)===null||_o===void 0||(go=_o.values)===null||go===void 0?void 0:go.length)>0||((bo=co.conditions)===null||bo===void 0?void 0:bo.actions)&&((vo=co.conditions)===null||vo===void 0||(yo=vo.actions)===null||yo===void 0?void 0:yo.values)&&(($o=co.conditions)===null||$o===void 0||(ko=$o.actions)===null||ko===void 0||(So=ko.values)===null||So===void 0?void 0:So.length)>0});return lo.length>0&&((ao=eo._surveyEventReceiver)===null||ao===void 0||ao.register(lo)),(io=eo.instance.persistence)===null||io===void 0||io.register(o({},Pe,so)),ue(so)}})}},{key:"getActiveMatchingSurveys",value:function(ue){var eo=this,no=arguments.length>1&&arguments[1]!==void 0&&arguments[1];this.getSurveys(function(ro){var oo,io=ro.filter(function(lo){return!(!lo.start_date||lo.end_date)}).filter(function(lo){var co,uo,fo,po;if(!lo.conditions)return!0;var ho=(co=lo.conditions)===null||co===void 0||!co.url||Fr[(uo=(fo=lo.conditions)===null||fo===void 0?void 0:fo.urlMatchType)!==null&&uo!==void 0?uo:"icontains"](lo.conditions.url),_o=(po=lo.conditions)===null||po===void 0||!po.selector||(L==null?void 0:L.querySelector(lo.conditions.selector));return ho&&_o}),ao=(oo=eo._surveyEventReceiver)===null||oo===void 0?void 0:oo.getSurveys(),so=io.filter(function(lo){var co,uo,fo,po,ho,_o,go,bo,vo,yo;if(!lo.linked_flag_key&&!lo.targeting_flag_key&&!lo.internal_targeting_flag_key)return!0;var $o=!lo.linked_flag_key||eo.instance.featureFlags.isFeatureEnabled(lo.linked_flag_key),ko=!lo.targeting_flag_key||eo.instance.featureFlags.isFeatureEnabled(lo.targeting_flag_key),So=((co=lo.conditions)===null||co===void 0?void 0:co.events)&&((uo=lo.conditions)===null||uo===void 0||(fo=uo.events)===null||fo===void 0?void 0:fo.values)&&((po=lo.conditions)===null||po===void 0||(ho=po.events)===null||ho===void 0?void 0:ho.values.length)>0,Ao=((_o=lo.conditions)===null||_o===void 0?void 0:_o.actions)&&((go=lo.conditions)===null||go===void 0||(bo=go.actions)===null||bo===void 0?void 0:bo.values)&&((vo=lo.conditions)===null||vo===void 0||(yo=vo.actions)===null||yo===void 0?void 0:yo.values.length)>0,Mo=!So&&!Ao||(ao==null?void 0:ao.includes(lo.id)),Eo=eo._canActivateRepeatedly(lo),To=!(lo.internal_targeting_flag_key&&!Eo)||eo.instance.featureFlags.isFeatureEnabled(lo.internal_targeting_flag_key);return $o&&ko&&To&&Mo});return ue(so)},no)}},{key:"getNextSurveyStep",value:function(ue,eo,no){var ro,oo=ue.questions[eo],io=eo+1;if((ro=oo.branching)===null||ro===void 0||!ro.type)return eo===ue.questions.length-1?br.End:io;if(oo.branching.type===br.End)return br.End;if(oo.branching.type===br.SpecificQuestion){if(Number.isInteger(oo.branching.index))return oo.branching.index}else if(oo.branching.type===br.ResponseBased){if(oo.type===yr.SingleChoice){var ao,so,lo=oo.choices.indexOf("".concat(no));if((ao=oo.branching)!==null&&ao!==void 0&&(so=ao.responseValues)!==null&&so!==void 0&&so.hasOwnProperty(lo)){var co=oo.branching.responseValues[lo];return Number.isInteger(co)?co:co===br.End?br.End:io}}else if(oo.type===yr.Rating){var uo,fo;if(typeof no!="number"||!Number.isInteger(no))throw new Error("The response type must be an integer");var po=function(_o,go){if(go===3){if(_o<1||_o>3)throw new Error("The response must be in range 1-3");return _o===1?"negative":_o===2?"neutral":"positive"}if(go===5){if(_o<1||_o>5)throw new Error("The response must be in range 1-5");return _o<=2?"negative":_o===3?"neutral":"positive"}if(go===10){if(_o<0||_o>10)throw new Error("The response must be in range 0-10");return _o<=6?"detractors":_o<=8?"passives":"promoters"}throw new Error("The scale must be one of: 3, 5, 10")}(no,oo.scale);if((uo=oo.branching)!==null&&uo!==void 0&&(fo=uo.responseValues)!==null&&fo!==void 0&&fo.hasOwnProperty(po)){var ho=oo.branching.responseValues[po];return Number.isInteger(ho)?ho:ho===br.End?br.End:io}}return io}return G.warn(Rr,"Falling back to next question index due to unexpected branching type"),io}},{key:"_canActivateRepeatedly",value:function(ue){return R(U.__PosthogExtensions__.canActivateRepeatedly)&&G.warn(Rr,"canActivateRepeatedly is not defined, must init before calling"),U.__PosthogExtensions__.canActivateRepeatedly(ue)}},{key:"canRenderSurvey",value:function(ue){var eo=this;R(this._surveyManager)?G.warn(Rr,"canActivateRepeatedly is not defined, must init before calling"):this.getSurveys(function(no){var ro=no.filter(function(oo){return oo.id===ue})[0];eo._surveyManager.canRenderSurvey(ro)})}},{key:"renderSurvey",value:function(ue,eo){var no=this;R(this._surveyManager)?G.warn(Rr,"canActivateRepeatedly is not defined, must init before calling"):this.getSurveys(function(ro){var oo=ro.filter(function(io){return io.id===ue})[0];no._surveyManager.renderSurvey(oo,L==null?void 0:L.querySelector(eo))})}}]),to}(),Pr=function(){function to(ue){var eo,no,ro=this;i$1(this,to),o(this,"serverLimits",{}),o(this,"lastEventRateLimited",!1),o(this,"checkForLimiting",function(oo){var io=oo.text;if(io&&io.length)try{(JSON.parse(io).quota_limited||[]).forEach(function(ao){G.info("[RateLimiter] ".concat(ao||"events"," is quota limited.")),ro.serverLimits[ao]=new Date().getTime()+6e4})}catch(ao){return void G.warn('[RateLimiter] could not rate limit - continuing. Error: "'.concat(ao==null?void 0:ao.message,'"'),{text:io})}}),this.instance=ue,this.captureEventsPerSecond=((eo=ue.config.rate_limiting)===null||eo===void 0?void 0:eo.events_per_second)||10,this.captureEventsBurstLimit=Math.max(((no=ue.config.rate_limiting)===null||no===void 0?void 0:no.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond),this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}return s(to,[{key:"clientRateLimitContext",value:function(){var ue,eo,no,ro=arguments.length>0&&arguments[0]!==void 0&&arguments[0],oo=new Date().getTime(),io=(ue=(eo=this.instance.persistence)===null||eo===void 0?void 0:eo.get_property(Me))!==null&&ue!==void 0?ue:{tokens:this.captureEventsBurstLimit,last:oo};io.tokens+=(oo-io.last)/1e3*this.captureEventsPerSecond,io.last=oo,io.tokens>this.captureEventsBurstLimit&&(io.tokens=this.captureEventsBurstLimit);var ao=io.tokens<1;return ao||ro||(io.tokens=Math.max(0,io.tokens-1)),!ao||this.lastEventRateLimited||ro||this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited. Config is set to ".concat(this.captureEventsPerSecond," events per second and ").concat(this.captureEventsBurstLimit," events burst limit.")},{skip_client_rate_limiting:!0}),this.lastEventRateLimited=ao,(no=this.instance.persistence)===null||no===void 0||no.set_property(Me,io),{isRateLimited:ao,remainingTokens:io.tokens}}},{key:"isServerRateLimited",value:function(ue){var eo=this.serverLimits[ue||"events"]||!1;return eo!==!1&&new Date().getTime()<eo}}]),to}(),Tr=function(){return t$1({initialPathName:(D==null?void 0:D.pathname)||"",referringDomain:mn.referringDomain()},mn.campaignParams())},Cr=function(){function to(ue,eo,no){var ro=this;i$1(this,to),o(this,"_onSessionIdCallback",function(oo){var io=ro._getStoredProps();if(!io||io.sessionId!==oo){var ao={sessionId:oo,props:ro._sessionSourceParamGenerator()};ro._persistence.register(o({},Oe,ao))}}),this._sessionIdManager=ue,this._persistence=eo,this._sessionSourceParamGenerator=no||Tr,this._sessionIdManager.onSessionId(this._onSessionIdCallback)}return s(to,[{key:"_getStoredProps",value:function(){return this._persistence.props[Oe]}},{key:"getSessionProps",value:function(){var ue,eo=(ue=this._getStoredProps())===null||ue===void 0?void 0:ue.props;return eo?{$client_session_initial_referring_host:eo.referringDomain,$client_session_initial_pathname:eo.initialPathName,$client_session_initial_utm_source:eo.utm_source,$client_session_initial_utm_campaign:eo.utm_campaign,$client_session_initial_utm_medium:eo.utm_medium,$client_session_initial_utm_content:eo.utm_content,$client_session_initial_utm_term:eo.utm_term}:{}}}]),to}(),$r=["ahrefsbot","ahrefssiteaudit","applebot","baiduspider","bingbot","bingpreview","bot.htm","bot.php","crawler","deepscan","duckduckbot","facebookexternal","facebookcatalog","gptbot","http://yandex.com/bots","hubspot","ia_archiver","linkedinbot","mj12bot","msnbot","nessus","petalbot","pinterest","prerender","rogerbot","screaming frog","semrushbot","sitebulb","slurp","turnitin","twitterbot","vercelbot","yahoo! slurp","yandexbot","headlesschrome","cypress","Google-HotelAdsVerifier","adsbot-google","apis-google","duplexweb-google","feedfetcher-google","google favicon","google web preview","google-read-aloud","googlebot","googleweblight","mediapartners-google","storebot-google","Bytespider;"],Or=function(to,ue){if(!to)return!1;var eo=to.toLowerCase();return $r.concat(ue||[]).some(function(no){var ro=no.toLowerCase();return eo.indexOf(ro)!==-1})},Mr=function(){function to(){i$1(this,to),this.clicks=[]}return s(to,[{key:"isRageClick",value:function(ue,eo,no){var ro=this.clicks[this.clicks.length-1];if(ro&&Math.abs(ue-ro.x)+Math.abs(eo-ro.y)<30&&no-ro.timestamp<1e3){if(this.clicks.push({x:ue,y:eo,timestamp:no}),this.clicks.length===3)return!0}else this.clicks=[{x:ue,y:eo,timestamp:no}];return!1}}]),to}();function Ar(to){var ue;return to.id===Ne||!((ue=to.closest)===null||ue===void 0||!ue.call(to,"#"+Ne))}var Lr=function(){function to(ue){var eo,no=this;i$1(this,to),o(this,"rageclicks",new Mr),o(this,"_enabledServerSide",!1),o(this,"_initialized",!1),o(this,"_flushInterval",null),this.instance=ue,this._enabledServerSide=!((eo=this.instance.persistence)===null||eo===void 0||!eo.props[fe]),T==null||T.addEventListener("beforeunload",function(){no.flush()})}return s(to,[{key:"flushIntervalMilliseconds",get:function(){var ue=5e3;return b(this.instance.config.capture_heatmaps)&&this.instance.config.capture_heatmaps.flush_interval_milliseconds&&(ue=this.instance.config.capture_heatmaps.flush_interval_milliseconds),ue}},{key:"isEnabled",get:function(){return w$1(this.instance.config.capture_heatmaps)?w$1(this.instance.config.enable_heatmaps)?this._enabledServerSide:this.instance.config.enable_heatmaps:this.instance.config.capture_heatmaps!==!1}},{key:"startIfEnabled",value:function(){if(this.isEnabled){if(this._initialized)return;G.info("[heatmaps] starting..."),this._setupListeners(),this._flushInterval=setInterval(this.flush.bind(this),this.flushIntervalMilliseconds)}else{var ue;clearInterval((ue=this._flushInterval)!==null&&ue!==void 0?ue:void 0),this.getAndClearBuffer()}}},{key:"afterDecideResponse",value:function(ue){var eo=!!ue.heatmaps;this.instance.persistence&&this.instance.persistence.register(o({},fe,eo)),this._enabledServerSide=eo,this.startIfEnabled()}},{key:"getAndClearBuffer",value:function(){var ue=this.buffer;return this.buffer=void 0,ue}},{key:"_setupListeners",value:function(){var ue=this;T&&L&&(oe(L,"click",function(eo){return ue._onClick(eo||(T==null?void 0:T.event))},!1,!0),oe(L,"mousemove",function(eo){return ue._onMouseMove(eo||(T==null?void 0:T.event))},!1,!0),this._initialized=!0)}},{key:"_getProperties",value:function(ue,eo){var no=this.instance.scrollManager.scrollY(),ro=this.instance.scrollManager.scrollX(),oo=this.instance.scrollManager.scrollElement(),io=function(ao,so,lo){for(var co=ao;co&&!On(co,"body");){if(co===lo)return!1;if(Y(so,T==null?void 0:T.getComputedStyle(co).position))return!0;co=Dn(co)}return!1}(ue.target,["fixed","sticky"],oo);return{x:ue.clientX+(io?0:ro),y:ue.clientY+(io?0:no),target_fixed:io,type:eo}}},{key:"_onClick",value:function(ue){var eo;if(!Ar(ue.target)){var no=this._getProperties(ue,"click");(eo=this.rageclicks)!==null&&eo!==void 0&&eo.isRageClick(ue.clientX,ue.clientY,new Date().getTime())&&this._capture(t$1(t$1({},no),{},{type:"rageclick"})),this._capture(no)}}},{key:"_onMouseMove",value:function(ue){var eo=this;Ar(ue.target)||(clearTimeout(this._mouseMoveTimeout),this._mouseMoveTimeout=setTimeout(function(){eo._capture(eo._getProperties(ue,"mousemove"))},500))}},{key:"_capture",value:function(ue){if(T){var eo=T.location.href;this.buffer=this.buffer||{},this.buffer[eo]||(this.buffer[eo]=[]),this.buffer[eo].push(ue)}}},{key:"flush",value:function(){this.buffer&&!k(this.buffer)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}}]),to}(),Dr=function(){function to(ue){var eo=this;i$1(this,to),o(this,"_updateScrollData",function(){var no,ro,oo,io;eo.context||(eo.context={});var ao=eo.scrollElement(),so=eo.scrollY(),lo=ao?Math.max(0,ao.scrollHeight-ao.clientHeight):0,co=so+((ao==null?void 0:ao.clientHeight)||0),uo=(ao==null?void 0:ao.scrollHeight)||0;eo.context.lastScrollY=Math.ceil(so),eo.context.maxScrollY=Math.max(so,(no=eo.context.maxScrollY)!==null&&no!==void 0?no:0),eo.context.maxScrollHeight=Math.max(lo,(ro=eo.context.maxScrollHeight)!==null&&ro!==void 0?ro:0),eo.context.lastContentY=co,eo.context.maxContentY=Math.max(co,(oo=eo.context.maxContentY)!==null&&oo!==void 0?oo:0),eo.context.maxContentHeight=Math.max(uo,(io=eo.context.maxContentHeight)!==null&&io!==void 0?io:0)}),this.instance=ue}return s(to,[{key:"getContext",value:function(){return this.context}},{key:"resetContext",value:function(){var ue=this.context;return setTimeout(this._updateScrollData,0),ue}},{key:"startMeasuringScrollPosition",value:function(){T==null||T.addEventListener("scroll",this._updateScrollData,!0),T==null||T.addEventListener("scrollend",this._updateScrollData,!0),T==null||T.addEventListener("resize",this._updateScrollData)}},{key:"scrollElement",value:function(){if(!this.instance.config.scroll_root_selector)return T==null?void 0:T.document.documentElement;var ue,eo=h(m(this.instance.config.scroll_root_selector)?this.instance.config.scroll_root_selector:[this.instance.config.scroll_root_selector]);try{for(eo.s();!(ue=eo.n()).done;){var no=ue.value,ro=T==null?void 0:T.document.querySelector(no);if(ro)return ro}}catch(oo){eo.e(oo)}finally{eo.f()}}},{key:"scrollY",value:function(){if(this.instance.config.scroll_root_selector){var ue=this.scrollElement();return ue&&ue.scrollTop||0}return T&&(T.scrollY||T.pageYOffset||T.document.documentElement.scrollTop)||0}},{key:"scrollX",value:function(){if(this.instance.config.scroll_root_selector){var ue=this.scrollElement();return ue&&ue.scrollLeft||0}return T&&(T.scrollX||T.pageXOffset||T.document.documentElement.scrollLeft)||0}}]),to}(),qr="$copy_autocapture";function Nr(to,ue){return ue.length>to?ue.slice(0,to)+"...":ue}var Br,Hr=function(){function to(ue){i$1(this,to),o(this,"_initialized",!1),o(this,"_isDisabledServerSide",null),o(this,"rageclicks",new Mr),o(this,"_elementsChainAsString",!1),this.instance=ue,this._elementSelectors=null}return s(to,[{key:"config",get:function(){var ue,eo,no=b(this.instance.config.autocapture)?this.instance.config.autocapture:{};return no.url_allowlist=(ue=no.url_allowlist)===null||ue===void 0?void 0:ue.map(function(ro){return new RegExp(ro)}),no.url_ignorelist=(eo=no.url_ignorelist)===null||eo===void 0?void 0:eo.map(function(ro){return new RegExp(ro)}),no}},{key:"_addDomEventHandlers",value:function(){var ue=this;if(this.isBrowserSupported()){if(T&&L){var eo=function(ro){ro=ro||(T==null?void 0:T.event);try{ue._captureEvent(ro)}catch(oo){G.error("Failed to capture event",oo)}},no=function(ro){ro=ro||(T==null?void 0:T.event),ue._captureEvent(ro,qr)};oe(L,"submit",eo,!1,!0),oe(L,"change",eo,!1,!0),oe(L,"click",eo,!1,!0),this.config.capture_copied_text&&(oe(L,"copy",no,!1,!0),oe(L,"cut",no,!1,!0))}}else G.info("Disabling Automatic Event Collection because this browser is not supported")}},{key:"startIfEnabled",value:function(){this.isEnabled&&!this._initialized&&(this._addDomEventHandlers(),this._initialized=!0)}},{key:"afterDecideResponse",value:function(ue){ue.elementsChainAsString&&(this._elementsChainAsString=ue.elementsChainAsString),this.instance.persistence&&this.instance.persistence.register(o({},he,!!ue.autocapture_opt_out)),this._isDisabledServerSide=!!ue.autocapture_opt_out,this.startIfEnabled()}},{key:"setElementSelectors",value:function(ue){this._elementSelectors=ue}},{key:"getElementSelectors",value:function(ue){var eo,no=[];return(eo=this._elementSelectors)===null||eo===void 0||eo.forEach(function(ro){var oo=L==null?void 0:L.querySelectorAll(ro);oo==null||oo.forEach(function(io){ue===io&&no.push(ro)})}),no}},{key:"isEnabled",get:function(){var ue,eo,no=(ue=this.instance.persistence)===null||ue===void 0?void 0:ue.props[he],ro=this._isDisabledServerSide;if(I(ro)&&!x$1(no)&&!this.instance.config.advanced_disable_decide)return!1;var oo=(eo=this._isDisabledServerSide)!==null&&eo!==void 0?eo:!!no;return!!this.instance.config.autocapture&&!oo}},{key:"_previousElementSibling",value:function(ue){if(ue.previousElementSibling)return ue.previousElementSibling;var eo=ue;do eo=eo.previousSibling;while(eo&&!$n(eo));return eo}},{key:"_getAugmentPropertiesFromElement",value:function(ue){if(!Nn(ue))return{};var eo={};return Q(ue.attributes,function(no){if(no.name&&no.name.indexOf("data-ph-capture-attribute")===0){var ro=no.name.replace("data-ph-capture-attribute-",""),oo=no.value;ro&&oo&&zn(oo)&&(eo[ro]=oo)}}),eo}},{key:"_getPropertiesFromElement",value:function(ue,eo,no){var ro,oo=ue.tagName.toLowerCase(),io={tag_name:oo};Ln.indexOf(oo)>-1&&!no&&(oo.toLowerCase()==="a"||oo.toLowerCase()==="button"?io.$el_text=Nr(1024,Qn(ue)):io.$el_text=Nr(1024,Cn(ue)));var ao=Pn(ue);ao.length>0&&(io.classes=ao.filter(function(fo){return fo!==""}));var so=(ro=this.config)===null||ro===void 0?void 0:ro.element_attribute_ignorelist;Q(ue.attributes,function(fo){var po;if((!Bn(ue)||["name","id","class","aria-label"].indexOf(fo.name)!==-1)&&(so==null||!so.includes(fo.name))&&!eo&&zn(fo.value)&&(po=fo.name,!S(po)||po.substring(0,10)!=="_ngcontent"&&po.substring(0,7)!=="_nghost")){var ho=fo.value;fo.name==="class"&&(ho=Fn(ho).join(" ")),io["attr__"+fo.name]=Nr(1024,ho)}});for(var lo=1,co=1,uo=ue;uo=this._previousElementSibling(uo);)lo++,uo.tagName===ue.tagName&&co++;return io.nth_child=lo,io.nth_of_type=co,io}},{key:"_getDefaultProperties",value:function(ue){return{$event_type:ue,$ce_version:1}}},{key:"_getEventTarget",value:function(ue){return w$1(ue.target)?ue.srcElement||null:(eo=ue.target)!==null&&eo!==void 0&&eo.shadowRoot?ue.composedPath()[0]||null:ue.target||null;var eo}},{key:"_captureEvent",value:function(ue){var eo=this,no=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"$autocapture";if(this.isEnabled){var ro,oo=this._getEventTarget(ue);Mn(oo)&&(oo=oo.parentNode||null),no==="$autocapture"&&ue.type==="click"&&ue instanceof MouseEvent&&this.instance.config.rageclick&&(ro=this.rageclicks)!==null&&ro!==void 0&&ro.isRageClick(ue.clientX,ue.clientY,new Date().getTime())&&this._captureEvent(ue,"$rageclick");var io=no===qr;if(oo&&qn(oo,ue,this.config,io,io?["copy","cut"]:void 0)){for(var ao,so,lo=[oo],co=oo;co.parentNode&&!On(co,"body");)An(co.parentNode)?(lo.push(co.parentNode.host),co=co.parentNode.host):(lo.push(co.parentNode),co=co.parentNode);var uo,fo,po=[],ho={},_o=!1;if(Q(lo,function(Eo){var To=Nn(Eo);Eo.tagName.toLowerCase()==="a"&&(uo=Eo.getAttribute("href"),uo=To&&zn(uo)&&uo),Y(Pn(Eo),"ph-no-capture")&&(_o=!0),po.push(eo._getPropertiesFromElement(Eo,eo.instance.config.mask_all_element_attributes,eo.instance.config.mask_all_text));var Io=eo._getAugmentPropertiesFromElement(Eo);J(ho,Io)}),this.instance.config.mask_all_text||(oo.tagName.toLowerCase()==="a"||oo.tagName.toLowerCase()==="button"?po[0].$el_text=Qn(oo):po[0].$el_text=Cn(oo)),uo){var go,bo;po[0].attr__href=uo;var vo=(go=pt(uo))===null||go===void 0?void 0:go.host,yo=T==null||(bo=T.location)===null||bo===void 0?void 0:bo.host;vo&&yo&&vo!==yo&&(fo=uo)}if(_o)return!1;var $o=J(this._getDefaultProperties(ue.type),this._elementsChainAsString?{$elements_chain:Yn(po)}:{$elements:po},(ao=po[0])!==null&&ao!==void 0&&ao.$el_text?{$el_text:(so=po[0])===null||so===void 0?void 0:so.$el_text}:{},fo&&ue.type==="click"?{$external_click_url:fo}:{},ho),ko=this.getElementSelectors(oo);if(ko&&ko.length>0&&($o.$element_selectors=ko),no===qr){var So,Ao=Tn(T==null||(So=T.getSelection())===null||So===void 0?void 0:So.toString()),Mo=ue.type||"clipboard";if(!Ao)return!1;$o.$selected_content=Ao,$o.$copy_type=Mo}return this.instance.capture(no,$o),!0}}}},{key:"isBrowserSupported",value:function(){return y(L==null?void 0:L.querySelectorAll)}}]),to}(),Ur=function(){function to(ue){var eo=this;i$1(this,to),o(this,"_restoreXHRPatch",void 0),o(this,"_restoreFetchPatch",void 0),o(this,"_startCapturing",function(){w$1(eo._restoreXHRPatch)&&U.postHogTracingHeadersPatchFns._patchXHR(eo.instance.sessionManager),w$1(eo._restoreFetchPatch)&&U.postHogTracingHeadersPatchFns._patchFetch(eo.instance.sessionManager)}),this.instance=ue}return s(to,[{key:"_loadScript",value:function(ue){U.postHogTracingHeadersPatchFns&&ue(),this.instance.requestRouter.loadScript("/static/tracing-headers.js?v=".concat(f.LIB_VERSION),function(eo){if(eo)return G.error("[TRACING-HEADERS] failed to load script",eo);ue()})}},{key:"startIfEnabledOrStop",value:function(){var ue,eo;this.instance.config.__add_tracing_headers?this._loadScript(this._startCapturing):((ue=this._restoreXHRPatch)===null||ue===void 0||ue.call(this),(eo=this._restoreFetchPatch)===null||eo===void 0||eo.call(this),this._restoreXHRPatch=void 0,this._restoreFetchPatch=void 0)}}]),to}();(function(to){to[to.PENDING=-1]="PENDING",to[to.DENIED=0]="DENIED",to[to.GRANTED=1]="GRANTED"})(Br||(Br={}));var jr=function(){function to(ue){i$1(this,to),this.instance=ue}return s(to,[{key:"config",get:function(){return this.instance.config}},{key:"consent",get:function(){return this.getDnt()?Br.DENIED:this.storedConsent}},{key:"isOptedOut",value:function(){return this.consent===Br.DENIED||this.consent===Br.PENDING&&this.config.opt_out_capturing_by_default}},{key:"isOptedIn",value:function(){return!this.isOptedOut()}},{key:"optInOut",value:function(ue){this.storage.set(this.storageKey,ue?1:0,this.config.cookie_expiration,this.config.cross_subdomain_cookie,this.config.secure_cookie)}},{key:"reset",value:function(){this.storage.remove(this.storageKey,this.config.cross_subdomain_cookie)}},{key:"storageKey",get:function(){var ue=this.instance.config,eo=ue.token;return(ue.opt_out_capturing_cookie_prefix||"__ph_opt_in_out_")+eo}},{key:"storedConsent",get:function(){var ue=this.storage.get(this.storageKey);return ue==="1"?Br.GRANTED:ue==="0"?Br.DENIED:Br.PENDING}},{key:"storage",get:function(){if(!this._storage){var ue=this.config.opt_out_capturing_persistence_type;this._storage=ue==="localStorage"?at:st;var eo=ue==="localStorage"?st:at;eo.get(this.storageKey)&&(this._storage.get(this.storageKey)||this.optInOut(eo.get(this.storageKey)==="1"),eo.remove(this.storageKey,this.config.cross_subdomain_cookie))}return this._storage}},{key:"getDnt",value:function(){return!!this.config.respect_dnt&&!!ae([A==null?void 0:A.doNotTrack,A==null?void 0:A.msDoNotTrack,U.doNotTrack],function(ue){return Y([!0,1,"1","yes"],ue)})}}]),to}(),Gr="[Exception Autocapture]",Wr=function(){function to(ue){var eo,no=this;i$1(this,to),o(this,"originalOnUnhandledRejectionHandler",void 0),o(this,"startCapturing",function(){if(T&&no.isEnabled&&!no.hasHandlers&&!no.isCapturing){var ro=T.posthogErrorWrappingFunctions.wrapOnError,oo=T.posthogErrorWrappingFunctions.wrapUnhandledRejection;if(ro&&oo)try{no.unwrapOnError=ro(no.captureException.bind(no)),no.unwrapUnhandledRejection=oo(no.captureException.bind(no))}catch(io){G.error(Gr+" failed to start",io),no.stopCapturing()}else G.error(Gr+" failed to load error wrapping functions - cannot start")}}),this.instance=ue,this.remoteEnabled=!((eo=this.instance.persistence)===null||eo===void 0||!eo.props[ve]),this.startIfEnabled()}return s(to,[{key:"isEnabled",get:function(){var ue;return(ue=this.remoteEnabled)!==null&&ue!==void 0&&ue}},{key:"isCapturing",get:function(){var ue;return!(T==null||(ue=T.onerror)===null||ue===void 0||!ue.__POSTHOG_INSTRUMENTED__)}},{key:"hasHandlers",get:function(){return this.originalOnUnhandledRejectionHandler||this.unwrapOnError}},{key:"startIfEnabled",value:function(){this.isEnabled&&!this.isCapturing&&(G.info(Gr+" enabled, starting..."),this.loadScript(this.startCapturing))}},{key:"loadScript",value:function(ue){this.hasHandlers&&ue(),this.instance.requestRouter.loadScript("/static/exception-autocapture.js?v=".concat(f.LIB_VERSION),function(eo){if(eo)return G.error(Gr+" failed to load script",eo);ue()})}},{key:"stopCapturing",value:function(){var ue,eo;(ue=this.unwrapOnError)===null||ue===void 0||ue.call(this),(eo=this.unwrapUnhandledRejection)===null||eo===void 0||eo.call(this)}},{key:"afterDecideResponse",value:function(ue){var eo=ue.autocaptureExceptions;this.remoteEnabled=!!eo||!1,this.instance.persistence&&this.instance.persistence.register(o({},ve,this.remoteEnabled)),this.startIfEnabled()}},{key:"captureException",value:function(ue){var eo=this.instance.requestRouter.endpointFor("ui");ue.$exception_personURL="".concat(eo,"/project/").concat(this.instance.config.token,"/person/").concat(this.instance.get_distinct_id()),this.instance.exceptions.sendExceptionEvent(ue)}}]),to}(),Vr=9e5,zr="[Web Vitals]",Qr=function(){function to(ue){var eo,no=this;i$1(this,to),o(this,"_enabledServerSide",!1),o(this,"_initialized",!1),o(this,"buffer",{url:void 0,metrics:[],firstMetricTimestamp:void 0}),o(this,"_flushToCapture",function(){clearTimeout(no._delayedFlushTimer),no.buffer.metrics.length!==0&&(no.instance.capture("$web_vitals",no.buffer.metrics.reduce(function(ro,oo){var io;return t$1(t$1({},ro),{},(o(io={},"$web_vitals_".concat(oo.name,"_event"),t$1({},oo)),o(io,"$web_vitals_".concat(oo.name,"_value"),oo.value),io))},{})),no.buffer={url:void 0,metrics:[],firstMetricTimestamp:void 0})}),o(this,"_addToBuffer",function(ro){var oo,io=(oo=no.instance.sessionManager)===null||oo===void 0?void 0:oo.checkAndGetSessionAndWindowId(!0);if(w$1(io))G.error(zr+"Could not read session ID. Dropping metrics!");else{no.buffer=no.buffer||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var ao=no._currentURL();w$1(ao)||(R(ro==null?void 0:ro.name)||R(ro==null?void 0:ro.value)?G.error(zr+"Invalid metric received",ro):no._maxAllowedValue&&ro.value>=no._maxAllowedValue?G.error(zr+"Ignoring metric with value >= "+no._maxAllowedValue,ro):(no.buffer.url!==ao&&(no._flushToCapture(),no._delayedFlushTimer=setTimeout(no._flushToCapture,8e3)),w$1(no.buffer.url)&&(no.buffer.url=ao),no.buffer.firstMetricTimestamp=w$1(no.buffer.firstMetricTimestamp)?Date.now():no.buffer.firstMetricTimestamp,no.buffer.metrics.push(t$1(t$1({},ro),{},{$current_url:ao,$session_id:io.sessionId,$window_id:io.windowId,timestamp:Date.now()})),no.buffer.metrics.length===4&&no._flushToCapture()))}}),o(this,"_startCapturing",function(){var ro=U.postHogWebVitalsCallbacks,oo=ro.onLCP,io=ro.onCLS,ao=ro.onFCP,so=ro.onINP;oo&&io&&ao&&so?(oo(no._addToBuffer),io(no._addToBuffer),ao(no._addToBuffer),so(no._addToBuffer),no._initialized=!0):G.error(zr+"web vitals callbacks not loaded - not starting")}),this.instance=ue,this._enabledServerSide=!((eo=this.instance.persistence)===null||eo===void 0||!eo.props[ge]),this.startIfEnabled()}return s(to,[{key:"_maxAllowedValue",get:function(){var ue=b(this.instance.config.capture_performance)&&F(this.instance.config.capture_performance.__web_vitals_max_value)?this.instance.config.capture_performance.__web_vitals_max_value:Vr;return 0<ue&&ue<=6e4?Vr:ue}},{key:"isEnabled",get:function(){var ue=b(this.instance.config.capture_performance)?this.instance.config.capture_performance.web_vitals:void 0;return x$1(ue)?ue:this._enabledServerSide}},{key:"startIfEnabled",value:function(){this.isEnabled&&!this._initialized&&(G.info(zr+" enabled, starting..."),this.loadScript(this._startCapturing))}},{key:"afterDecideResponse",value:function(ue){var eo=b(ue.capturePerformance)&&!!ue.capturePerformance.web_vitals;this.instance.persistence&&this.instance.persistence.register(o({},ge,eo)),this._enabledServerSide=eo,this.startIfEnabled()}},{key:"loadScript",value:function(ue){T.postHogWebVitalsCallbacks&&ue(),this.instance.requestRouter.loadScript("/static/web-vitals.js?v=".concat(f.LIB_VERSION),function(eo){eo?G.error(zr+" failed to load script",eo):ue()})}},{key:"_currentURL",value:function(){var ue=T?T.location.href:void 0;return ue||G.error(zr+"Could not determine current URL"),ue}}]),to}(),Jr="/e/",Yr=function(){function to(ue){var eo;i$1(this,to),this.instance=ue,this._endpointSuffix=((eo=this.instance.persistence)===null||eo===void 0?void 0:eo.props[pe])||Jr}return s(to,[{key:"endpoint",get:function(){return this.instance.requestRouter.endpointFor("api",this._endpointSuffix)}},{key:"afterDecideResponse",value:function(ue){var eo=ue.autocaptureExceptions;this._endpointSuffix=b(eo)&&eo.endpoint||Jr,this.instance.persistence&&this.instance.persistence.register(o({},pe,this._endpointSuffix))}},{key:"sendExceptionEvent",value:function(ue){this.instance.capture("$exception",ue,{_noTruncate:!0,_batchKey:"exceptionEvent",_url:this.endpoint})}}]),to}(),Xr={},Kr=function(){},Zr="posthog",es=!tr&&(H==null?void 0:H.indexOf("MSIE"))===-1&&(H==null?void 0:H.indexOf("Mozilla"))===-1,ts=function(){var to,ue,eo;return{api_host:"https://us.i.posthog.com",ui_host:null,token:"",autocapture:!0,rageclick:!0,cross_subdomain_cookie:(ue=L==null?void 0:L.location,eo=ue==null?void 0:ue.hostname,!!S(eo)&&eo.split(".").slice(-2).join(".")!=="herokuapp.com"),persistence:"localStorage+cookie",persistence_name:"",loaded:Kr,store_google:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageview:!0,capture_pageleave:"if_capture_pageview",debug:D&&S(D==null?void 0:D.search)&&D.search.indexOf("__posthog_debug=true")!==-1||!1,verbose:!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_surveys:!1,enable_recording_console_log:void 0,secure_cookie:(T==null||(to=T.location)===null||to===void 0?void 0:to.protocol)==="https:",ip:!0,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},inapp_protocol:"//",inapp_link_new_window:!1,request_batching:!0,properties_string_max_length:65535,session_recording:{},mask_all_element_attributes:!1,mask_all_text:!1,advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,on_request_error:function(no){var ro="Bad HTTP status: "+no.statusCode+" "+no.text;G.error(ro)},get_device_id:function(no){return no},_onCapture:Kr,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:"always",__add_tracing_headers:!1}},ns=function(to){var ue={};w$1(to.process_person)||(ue.person_profiles=to.process_person),w$1(to.xhr_headers)||(ue.request_headers=to.xhr_headers),w$1(to.cookie_name)||(ue.persistence_name=to.cookie_name),w$1(to.disable_cookie)||(ue.disable_persistence=to.disable_cookie);var eo=J({},ue,to);return m(to.property_blacklist)&&(w$1(to.property_denylist)?eo.property_denylist=to.property_blacklist:m(to.property_denylist)?eo.property_denylist=[].concat(l(to.property_blacklist),l(to.property_denylist)):G.error("Invalid value for property_denylist config: "+to.property_denylist)),eo},is=function(){function to(){i$1(this,to),o(this,"__forceAllowLocalhost",!1)}return s(to,[{key:"_forceAllowLocalhost",get:function(){return this.__forceAllowLocalhost},set:function(ue){G.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=ue}}]),to}(),rs=function(){function to(){var ue=this;i$1(this,to),o(this,"webPerformance",new is),o(this,"version",f.LIB_VERSION),o(this,"_internalEventEmitter",new Sr),this.config=ts(),this.decideEndpointWasHit=!1,this.SentryIntegration=gr,this.sentryIntegration=function(eo){return function(no,ro){var oo=pr(no,ro);return{name:vr,processEvent:function(io){return oo(io)}}}(ue,eo)},this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this._initialPageviewCaptured=!1,this.featureFlags=new We(this),this.toolbar=new mi(this),this.scrollManager=new Dr(this),this.pageViewManager=new kr(this),this.surveys=new xr(this),this.exceptions=new Yr(this),this.rateLimiter=new Pr(this),this.requestRouter=new fr(this),this.consent=new jr(this),this.people={set:function(eo,no,ro){var oo=S(eo)?o({},eo,no):eo;ue.setPersonProperties(oo),ro==null||ro({})},set_once:function(eo,no,ro){var oo=S(eo)?o({},eo,no):eo;ue.setPersonProperties(void 0,oo),ro==null||ro({})}},this.on("eventCaptured",function(eo){return G.info("send",eo)})}return s(to,[{key:"init",value:function(ue,eo,no){if(no&&no!==Zr){var ro,oo=(ro=Xr[no])!==null&&ro!==void 0?ro:new to;return oo._init(ue,eo,no),Xr[no]=oo,Xr[Zr][no]=oo,oo}return this._init(ue,eo,no)}},{key:"_init",value:function(ue){var eo,no,ro=this,oo=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},io=arguments.length>2?arguments[2]:void 0;if(w$1(ue)||E(ue))return G.critical("PostHog was initialized without a token. This likely indicates a misconfiguration. Please check the first argument passed to posthog.init()"),this;if(this.__loaded)return G.warn("You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config={},this._triggered_notifs=[],this.set_config(J({},ts(),ns(oo),{name:io,token:ue})),this.config.on_xhr_error&&G.error("[posthog] on_xhr_error is deprecated. Use on_request_error instead"),this.compression=oo.disable_compression?void 0:re.GZipJS,this.persistence=new bn(this.config),this.sessionPersistence=this.config.persistence==="sessionStorage"?this.persistence:new bn(t$1(t$1({},this.config),{},{persistence:"sessionStorage"}));var ao=t$1({},this.persistence.props),so=t$1({},this.sessionPersistence.props);if(this._requestQueue=new yi(function(vo){return ro._send_retriable_request(vo)}),this._retryQueue=new lr(this),this.__request_queue=[],this.sessionManager=new dr(this.config,this.persistence),this.sessionPropsManager=new Cr(this.sessionManager,this.persistence),new Ur(this).startIfEnabledOrStop(),this.sessionRecording=new vi(this),this.sessionRecording.startIfEnabledOrStop(),this.config.disable_scroll_properties||this.scrollManager.startMeasuringScrollPosition(),this.autocapture=new Hr(this),this.autocapture.startIfEnabled(),this.surveys.loadIfEnabled(),this.heatmaps=new Lr(this),this.heatmaps.startIfEnabled(),this.webVitalsAutocapture=new Qr(this),this.exceptionObserver=new Wr(this),this.exceptionObserver.startIfEnabled(),f.DEBUG=f.DEBUG||this.config.debug,f.DEBUG&&G.info("Starting in debug mode",{this:this,config:oo,thisC:t$1({},this.config),p:ao,s:so}),this._sync_opt_out_with_persistence(),((eo=oo.bootstrap)===null||eo===void 0?void 0:eo.distinctID)!==void 0){var lo,co,uo=this.config.get_device_id(Ke()),fo=(lo=oo.bootstrap)!==null&&lo!==void 0&&lo.isIdentifiedID?uo:oo.bootstrap.distinctID;this.persistence.set_property($e,(co=oo.bootstrap)!==null&&co!==void 0&&co.isIdentifiedID?"identified":"anonymous"),this.register({distinct_id:oo.bootstrap.distinctID,$device_id:fo})}if(this._hasBootstrappedFeatureFlags()){var po,ho,_o=Object.keys(((po=oo.bootstrap)===null||po===void 0?void 0:po.featureFlags)||{}).filter(function(vo){var yo,$o;return!((yo=oo.bootstrap)===null||yo===void 0||($o=yo.featureFlags)===null||$o===void 0||!$o[vo])}).reduce(function(vo,yo){var $o,ko;return vo[yo]=(($o=oo.bootstrap)===null||$o===void 0||(ko=$o.featureFlags)===null||ko===void 0?void 0:ko[yo])||!1,vo},{}),go=Object.keys(((ho=oo.bootstrap)===null||ho===void 0?void 0:ho.featureFlagPayloads)||{}).filter(function(vo){return _o[vo]}).reduce(function(vo,yo){var $o,ko,So,Ao;return($o=oo.bootstrap)!==null&&$o!==void 0&&(ko=$o.featureFlagPayloads)!==null&&ko!==void 0&&ko[yo]&&(vo[yo]=(So=oo.bootstrap)===null||So===void 0||(Ao=So.featureFlagPayloads)===null||Ao===void 0?void 0:Ao[yo]),vo},{});this.featureFlags.receivedFeatureFlags({featureFlags:_o,featureFlagPayloads:go})}if(!this.get_distinct_id()){var bo=this.config.get_device_id(Ke());this.register_once({distinct_id:bo,$device_id:bo},""),this.persistence.set_property($e,"anonymous")}return T==null||(no=T.addEventListener)===null||no===void 0||no.call(T,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this)),this.toolbar.maybeLoadToolbar(),oo.segment?_r(this,function(){return ro._loaded()}):this._loaded(),y(this.config._onCapture)&&this.on("eventCaptured",function(vo){return ro.config._onCapture(vo.event,vo)}),this}},{key:"_afterDecideResponse",value:function(ue){var eo,no,ro,oo,io,ao,so,lo;this.compression=void 0,ue.supportedCompression&&!this.config.disable_compression&&(this.compression=Y(ue.supportedCompression,re.GZipJS)?re.GZipJS:Y(ue.supportedCompression,re.Base64)?re.Base64:void 0),(eo=ue.analytics)!==null&&eo!==void 0&&eo.endpoint&&(this.analyticsDefaultEndpoint=ue.analytics.endpoint),(no=this.sessionRecording)===null||no===void 0||no.afterDecideResponse(ue),(ro=this.autocapture)===null||ro===void 0||ro.afterDecideResponse(ue),(oo=this.heatmaps)===null||oo===void 0||oo.afterDecideResponse(ue),(io=this.surveys)===null||io===void 0||io.afterDecideResponse(ue),(ao=this.webVitalsAutocapture)===null||ao===void 0||ao.afterDecideResponse(ue),(so=this.exceptions)===null||so===void 0||so.afterDecideResponse(ue),(lo=this.exceptionObserver)===null||lo===void 0||lo.afterDecideResponse(ue)}},{key:"_loaded",value:function(){var ue=this,eo=this.config.advanced_disable_decide;eo||this.featureFlags.setReloadingPaused(!0);try{this.config.loaded(this)}catch(no){G.critical("`loaded` function failed",no)}this._start_queue_if_opted_in(),this.config.capture_pageview&&setTimeout(function(){ue.consent.isOptedIn()&&ue._captureInitialPageview()},1),eo||(new pi(this).call(),this.featureFlags.resetRequestQueue())}},{key:"_start_queue_if_opted_in",value:function(){var ue;this.has_opted_out_capturing()||this.config.request_batching&&((ue=this._requestQueue)===null||ue===void 0||ue.enable())}},{key:"_dom_loaded",value:function(){var ue=this;this.has_opted_out_capturing()||z(this.__request_queue,function(eo){return ue._send_retriable_request(eo)}),this.__request_queue=[],this._start_queue_if_opted_in()}},{key:"_handle_unload",value:function(){var ue,eo;this.config.request_batching?(this._shouldCapturePageleave()&&this.capture("$pageleave"),(ue=this._requestQueue)===null||ue===void 0||ue.unload(),(eo=this._retryQueue)===null||eo===void 0||eo.unload()):this._shouldCapturePageleave()&&this.capture("$pageleave",null,{transport:"sendBeacon"})}},{key:"_send_request",value:function(ue){var eo=this;this.__loaded&&(es?this.__request_queue.push(ue):this.rateLimiter.isServerRateLimited(ue.batchKey)||(ue.transport=ue.transport||this.config.api_transport,ue.url=ir(ue.url,{ip:this.config.ip?1:0}),ue.headers=t$1({},this.config.request_headers),ue.compression=ue.compression==="best-available"?this.compression:ue.compression,function(no){var ro,oo,io,ao=t$1({},no);ao.timeout=ao.timeout||6e4,ao.url=ir(ao.url,{_:new Date().getTime().toString(),ver:f.LIB_VERSION,compression:ao.compression});var so=(ro=ao.transport)!==null&&ro!==void 0?ro:"XHR",lo=(oo=(io=ae(or,function(co){return co.transport===so}))===null||io===void 0?void 0:io.method)!==null&&oo!==void 0?oo:or[0].method;if(!lo)throw new Error("No available transport method");lo(ao)}(t$1(t$1({},ue),{},{callback:function(no){var ro,oo,io;eo.rateLimiter.checkForLimiting(no),no.statusCode>=400&&((oo=(io=eo.config).on_request_error)===null||oo===void 0||oo.call(io,no)),(ro=ue.callback)===null||ro===void 0||ro.call(ue,no)}}))))}},{key:"_send_retriable_request",value:function(ue){this._retryQueue?this._retryQueue.retriableRequest(ue):this._send_request(ue)}},{key:"_execute_array",value:function(ue){var eo,no=this,ro=[],oo=[],io=[];z(ue,function(so){so&&(eo=so[0],m(eo)?io.push(so):y(so)?so.call(no):m(so)&&eo==="alias"?ro.push(so):m(so)&&eo.indexOf("capture")!==-1&&y(no[eo])?io.push(so):oo.push(so))});var ao=function(so,lo){z(so,function(co){if(m(co[0])){var uo=lo;Q(co,function(fo){uo=uo[fo[0]].apply(uo,fo.slice(1))})}else this[co[0]].apply(this,co.slice(1))},lo)};ao(ro,this),ao(oo,this),ao(io,this)}},{key:"_hasBootstrappedFeatureFlags",value:function(){var ue,eo;return((ue=this.config.bootstrap)===null||ue===void 0?void 0:ue.featureFlags)&&Object.keys((eo=this.config.bootstrap)===null||eo===void 0?void 0:eo.featureFlags).length>0||!1}},{key:"push",value:function(ue){this._execute_array([ue])}},{key:"capture",value:function(ue,eo,no){var ro;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this._requestQueue){if(!this.consent.isOptedOut())if(!w$1(ue)&&S(ue)){if(this.config.opt_out_useragent_filter||!this._is_bot()){var oo=no!=null&&no.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(oo==null||!oo.isRateLimited){this.sessionPersistence.update_search_keyword(),this.config.store_google&&this.sessionPersistence.update_campaign_params(),this.config.save_referrer&&this.sessionPersistence.update_referrer_info(),(this.config.store_google||this.config.save_referrer)&&this.persistence.set_initial_person_info();var io=new Date,ao=(no==null?void 0:no.timestamp)||io,so={uuid:Ke(),event:ue,properties:this._calculate_event_properties(ue,eo||{},ao)};oo&&(so.properties.$lib_rate_limit_remaining_tokens=oo.remainingTokens),no!=null&&no.$set&&(so.$set=no==null?void 0:no.$set);var lo=this._calculate_set_once_properties(no==null?void 0:no.$set_once);lo&&(so.$set_once=lo),(so=ie$3(so,no!=null&&no._noTruncate?null:this.config.properties_string_max_length)).timestamp=ao,w$1(no==null?void 0:no.timestamp)||(so.properties.$event_time_override_provided=!0,so.properties.$event_time_override_system_time=io);var co=t$1(t$1({},so.properties.$set),so.$set);k(co)||this.setPersonPropertiesForFlags(co),this._internalEventEmitter.emit("eventCaptured",so);var uo={method:"POST",url:(ro=no==null?void 0:no._url)!==null&&ro!==void 0?ro:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),data:so,compression:"best-available",batchKey:no==null?void 0:no._batchKey};return!this.config.request_batching||no&&(no==null||!no._batchKey)||no!=null&&no.send_instantly?this._send_retriable_request(uo):this._requestQueue.enqueue(uo),so}G.critical("This capture call is ignored due to client rate limiting.")}}else G.error("No event name provided to posthog.capture")}else G.uninitializedWarning("posthog.capture")}},{key:"_addCaptureHook",value:function(ue){this.on("eventCaptured",function(eo){return ue(eo.event,eo)})}},{key:"_calculate_event_properties",value:function(ue,eo,no){if(no=no||new Date,!this.persistence||!this.sessionPersistence)return eo;var ro=this.persistence.remove_event_timer(ue),oo=t$1({},eo);if(oo.token=this.config.token,ue==="$snapshot"){var io=t$1(t$1({},this.persistence.properties()),this.sessionPersistence.properties());return oo.distinct_id=io.distinct_id,(!S(oo.distinct_id)&&!F(oo.distinct_id)||E(oo.distinct_id))&&G.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),oo}var ao=mn.properties();if(this.sessionManager){var so=this.sessionManager.checkAndGetSessionAndWindowId(),lo=so.sessionId,co=so.windowId;oo.$session_id=lo,oo.$window_id=co}if(this.requestRouter.region===ur.CUSTOM&&(oo.$lib_custom_api_host=this.config.api_host),this.sessionPropsManager&&this.config.__preview_send_client_session_params&&(ue==="$pageview"||ue==="$pageleave"||ue==="$autocapture")){var uo=this.sessionPropsManager.getSessionProps();oo=J(oo,uo)}if(!this.config.disable_scroll_properties){var fo={};ue==="$pageview"?fo=this.pageViewManager.doPageView(no):ue==="$pageleave"&&(fo=this.pageViewManager.doPageLeave(no)),oo=J(oo,fo)}if(ue==="$pageview"&&L&&(oo.title=L.title),!w$1(ro)){var po=no.getTime()-ro;oo.$duration=parseFloat((po/1e3).toFixed(3))}H&&this.config.opt_out_useragent_filter&&(oo.$browser_type=this._is_bot()?"bot":"browser"),(oo=J({},ao,this.persistence.properties(),this.sessionPersistence.properties(),oo)).$is_identified=this._isIdentified(),m(this.config.property_denylist)?Q(this.config.property_denylist,function(_o){delete oo[_o]}):G.error("Invalid value for property_denylist config: "+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var ho=this.config.sanitize_properties;return ho&&(oo=ho(oo,ue)),oo.$process_person_profile=this._hasPersonProcessing(),oo}},{key:"_calculate_set_once_properties",value:function(ue){if(!this.persistence||!this._hasPersonProcessing())return ue;var eo=J({},this.persistence.get_initial_props(),ue||{});return k(eo)?void 0:eo}},{key:"register",value:function(ue,eo){var no;(no=this.persistence)===null||no===void 0||no.register(ue,eo)}},{key:"register_once",value:function(ue,eo,no){var ro;(ro=this.persistence)===null||ro===void 0||ro.register_once(ue,eo,no)}},{key:"register_for_session",value:function(ue){var eo;(eo=this.sessionPersistence)===null||eo===void 0||eo.register(ue)}},{key:"unregister",value:function(ue){var eo;(eo=this.persistence)===null||eo===void 0||eo.unregister(ue)}},{key:"unregister_for_session",value:function(ue){var eo;(eo=this.sessionPersistence)===null||eo===void 0||eo.unregister(ue)}},{key:"_register_single",value:function(ue,eo){this.register(o({},ue,eo))}},{key:"getFeatureFlag",value:function(ue,eo){return this.featureFlags.getFeatureFlag(ue,eo)}},{key:"getFeatureFlagPayload",value:function(ue){var eo=this.featureFlags.getFeatureFlagPayload(ue);try{return JSON.parse(eo)}catch{return eo}}},{key:"isFeatureEnabled",value:function(ue,eo){return this.featureFlags.isFeatureEnabled(ue,eo)}},{key:"reloadFeatureFlags",value:function(){this.featureFlags.reloadFeatureFlags()}},{key:"updateEarlyAccessFeatureEnrollment",value:function(ue,eo){this.featureFlags.updateEarlyAccessFeatureEnrollment(ue,eo)}},{key:"getEarlyAccessFeatures",value:function(ue){var eo=arguments.length>1&&arguments[1]!==void 0&&arguments[1];return this.featureFlags.getEarlyAccessFeatures(ue,eo)}},{key:"on",value:function(ue,eo){return this._internalEventEmitter.on(ue,eo)}},{key:"onFeatureFlags",value:function(ue){return this.featureFlags.onFeatureFlags(ue)}},{key:"onSessionId",value:function(ue){var eo,no;return(eo=(no=this.sessionManager)===null||no===void 0?void 0:no.onSessionId(ue))!==null&&eo!==void 0?eo:function(){}}},{key:"getSurveys",value:function(ue){var eo=arguments.length>1&&arguments[1]!==void 0&&arguments[1];this.surveys.getSurveys(ue,eo)}},{key:"getActiveMatchingSurveys",value:function(ue){var eo=arguments.length>1&&arguments[1]!==void 0&&arguments[1];this.surveys.getActiveMatchingSurveys(ue,eo)}},{key:"renderSurvey",value:function(ue,eo){this.surveys.renderSurvey(ue,eo)}},{key:"canRenderSurvey",value:function(ue){this.surveys.canRenderSurvey(ue)}},{key:"getNextSurveyStep",value:function(ue,eo,no){return this.surveys.getNextSurveyStep(ue,eo,no)}},{key:"identify",value:function(ue,eo,no){if(!this.__loaded||!this.persistence)return G.uninitializedWarning("posthog.identify");if(F(ue)&&(ue=ue.toString(),G.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),ue){if(["distinct_id","distinctid"].includes(ue.toLowerCase()))G.critical('The string "'.concat(ue,'" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.'));else if(this._requirePersonProcessing("posthog.identify")){var ro=this.get_distinct_id();if(this.register({$user_id:ue}),!this.get_property("$device_id")){var oo=ro;this.register_once({$had_persisted_distinct_id:!0,$device_id:oo},"")}ue!==ro&&ue!==this.get_property(ce)&&(this.unregister(ce),this.register({distinct_id:ue}));var io=(this.persistence.get_property($e)||"anonymous")==="anonymous";ue!==ro&&io?(this.persistence.set_property($e,"identified"),this.setPersonPropertiesForFlags(eo||{},!1),this.capture("$identify",{distinct_id:ue,$anon_distinct_id:ro},{$set:eo||{},$set_once:no||{}}),this.featureFlags.setAnonymousDistinctId(ro)):(eo||no)&&this.setPersonProperties(eo,no),ue!==ro&&(this.reloadFeatureFlags(),this.unregister(Ce))}}else G.error("Unique user id has not been set in posthog.identify")}},{key:"setPersonProperties",value:function(ue,eo){(ue||eo)&&this._requirePersonProcessing("posthog.setPersonProperties")&&(this.setPersonPropertiesForFlags(ue||{}),this.capture("$set",{$set:ue||{},$set_once:eo||{}}))}},{key:"group",value:function(ue,eo,no){if(ue&&eo){if(this._requirePersonProcessing("posthog.group")){var ro=this.getGroups();ro[ue]!==eo&&this.resetGroupPropertiesForFlags(ue),this.register({$groups:t$1(t$1({},ro),{},o({},ue,eo))}),no&&(this.capture("$groupidentify",{$group_type:ue,$group_key:eo,$group_set:no}),this.setGroupPropertiesForFlags(o({},ue,no))),ro[ue]===eo||no||this.reloadFeatureFlags()}}else G.error("posthog.group requires a group type and group key")}},{key:"resetGroups",value:function(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}},{key:"setPersonPropertiesForFlags",value:function(ue){var eo=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1];this._requirePersonProcessing("posthog.setPersonPropertiesForFlags")&&this.featureFlags.setPersonPropertiesForFlags(ue,eo)}},{key:"resetPersonPropertiesForFlags",value:function(){this.featureFlags.resetPersonPropertiesForFlags()}},{key:"setGroupPropertiesForFlags",value:function(ue){var eo=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1];this._requirePersonProcessing("posthog.setGroupPropertiesForFlags")&&this.featureFlags.setGroupPropertiesForFlags(ue,eo)}},{key:"resetGroupPropertiesForFlags",value:function(ue){this.featureFlags.resetGroupPropertiesForFlags(ue)}},{key:"reset",value:function(ue){var eo,no,ro,oo;if(G.info("reset"),!this.__loaded)return G.uninitializedWarning("posthog.reset");var io=this.get_property("$device_id");this.consent.reset(),(eo=this.persistence)===null||eo===void 0||eo.clear(),(no=this.sessionPersistence)===null||no===void 0||no.clear(),(ro=this.persistence)===null||ro===void 0||ro.set_property($e,"anonymous"),(oo=this.sessionManager)===null||oo===void 0||oo.resetSessionId();var ao=this.config.get_device_id(Ke());this.register_once({distinct_id:ao,$device_id:ue?ao:io},"")}},{key:"get_distinct_id",value:function(){return this.get_property("distinct_id")}},{key:"getGroups",value:function(){return this.get_property("$groups")||{}}},{key:"get_session_id",value:function(){var ue,eo;return(ue=(eo=this.sessionManager)===null||eo===void 0?void 0:eo.checkAndGetSessionAndWindowId(!0).sessionId)!==null&&ue!==void 0?ue:""}},{key:"get_session_replay_url",value:function(ue){if(!this.sessionManager)return"";var eo=this.sessionManager.checkAndGetSessionAndWindowId(!0),no=eo.sessionId,ro=eo.sessionStartTimestamp,oo=this.requestRouter.endpointFor("ui","/project/".concat(this.config.token,"/replay/").concat(no));if(ue!=null&&ue.withTimestamp&&ro){var io,ao=(io=ue.timestampLookBack)!==null&&io!==void 0?io:10;if(!ro)return oo;var so=Math.max(Math.floor((new Date().getTime()-ro)/1e3)-ao,0);oo+="?t=".concat(so)}return oo}},{key:"alias",value:function(ue,eo){return ue===this.get_property(le)?(G.critical("Attempting to create alias for existing People user - aborting."),-2):this._requirePersonProcessing("posthog.alias")?(w$1(eo)&&(eo=this.get_distinct_id()),ue!==eo?(this._register_single(ce,ue),this.capture("$create_alias",{alias:ue,distinct_id:eo})):(G.warn("alias matches current distinct_id - skipping api call."),this.identify(ue),-1)):void 0}},{key:"set_config",value:function(ue){var eo,no,ro,oo,io=t$1({},this.config);b(ue)&&(J(this.config,ns(ue)),(eo=this.persistence)===null||eo===void 0||eo.update_config(this.config,io),this.sessionPersistence=this.config.persistence==="sessionStorage"?this.persistence:new bn(t$1(t$1({},this.config),{},{persistence:"sessionStorage"})),at.is_supported()&&at.get("ph_debug")==="true"&&(this.config.debug=!0),this.config.debug&&(f.DEBUG=!0,G.info("set_config",{config:ue,oldConfig:io,newConfig:t$1({},this.config)})),(no=this.sessionRecording)===null||no===void 0||no.startIfEnabledOrStop(),(ro=this.autocapture)===null||ro===void 0||ro.startIfEnabled(),(oo=this.heatmaps)===null||oo===void 0||oo.startIfEnabled(),this.surveys.loadIfEnabled(),this._sync_opt_out_with_persistence())}},{key:"startSessionRecording",value:function(ue){var eo,no=x$1(ue)&&ue;if(no||ue!=null&&ue.sampling){var ro,oo,io=(ro=this.sessionManager)===null||ro===void 0?void 0:ro.checkAndGetSessionAndWindowId();(oo=this.persistence)===null||oo===void 0||oo.register(o({},Ee,!0)),G.info("Session recording started with sampling override for session: ",io==null?void 0:io.sessionId)}(no||ue!=null&&ue.linked_flag)&&((eo=this.sessionRecording)===null||eo===void 0||eo.overrideLinkedFlag(),G.info("Session recording started with linked_flags override")),this.set_config({disable_session_recording:!1})}},{key:"stopSessionRecording",value:function(){this.set_config({disable_session_recording:!0})}},{key:"sessionRecordingStarted",value:function(){var ue;return!((ue=this.sessionRecording)===null||ue===void 0||!ue.started)}},{key:"captureException",value:function(ue,eo){var no=y(U.parseErrorAsProperties)?U.parseErrorAsProperties([ue.message,void 0,void 0,void 0,ue]):t$1({$exception_type:ue.name,$exception_message:ue.message,$exception_level:"error"},eo);this.exceptions.sendExceptionEvent(no)}},{key:"loadToolbar",value:function(ue){return this.toolbar.loadToolbar(ue)}},{key:"get_property",value:function(ue){var eo;return(eo=this.persistence)===null||eo===void 0?void 0:eo.props[ue]}},{key:"getSessionProperty",value:function(ue){var eo;return(eo=this.sessionPersistence)===null||eo===void 0?void 0:eo.props[ue]}},{key:"toString",value:function(){var ue,eo=(ue=this.config.name)!==null&&ue!==void 0?ue:Zr;return eo!==Zr&&(eo=Zr+"."+eo),eo}},{key:"_isIdentified",value:function(){var ue,eo;return((ue=this.persistence)===null||ue===void 0?void 0:ue.get_property($e))==="identified"||((eo=this.sessionPersistence)===null||eo===void 0?void 0:eo.get_property($e))==="identified"}},{key:"_hasPersonProcessing",value:function(){var ue,eo,no,ro;return!(this.config.person_profiles==="never"||this.config.person_profiles==="identified_only"&&!this._isIdentified()&&k(this.getGroups())&&((ue=this.persistence)===null||ue===void 0||(eo=ue.props)===null||eo===void 0||!eo[ce])&&((no=this.persistence)===null||no===void 0||(ro=no.props)===null||ro===void 0||!ro[qe]))}},{key:"_shouldCapturePageleave",value:function(){return this.config.capture_pageleave===!0||this.config.capture_pageleave==="if_capture_pageview"&&this.config.capture_pageview}},{key:"createPersonProfile",value:function(){this._hasPersonProcessing()||this._requirePersonProcessing("posthog.createPersonProfile")&&this.setPersonProperties({},{})}},{key:"_requirePersonProcessing",value:function(ue){return this.config.person_profiles==="never"?(G.error(ue+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this._register_single(qe,!0),!0)}},{key:"_sync_opt_out_with_persistence",value:function(){var ue,eo,no,ro,oo=this.consent.isOptedOut(),io=this.config.opt_out_persistence_by_default,ao=this.config.disable_persistence||oo&&!!io;((ue=this.persistence)===null||ue===void 0?void 0:ue.disabled)!==ao&&((no=this.persistence)===null||no===void 0||no.set_disabled(ao)),((eo=this.sessionPersistence)===null||eo===void 0?void 0:eo.disabled)!==ao&&((ro=this.sessionPersistence)===null||ro===void 0||ro.set_disabled(ao))}},{key:"opt_in_capturing",value:function(ue){var eo;this.consent.optInOut(!0),this._sync_opt_out_with_persistence(),(w$1(ue==null?void 0:ue.captureEventName)||ue!=null&&ue.captureEventName)&&this.capture((eo=ue==null?void 0:ue.captureEventName)!==null&&eo!==void 0?eo:"$opt_in",ue==null?void 0:ue.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this._captureInitialPageview()}},{key:"opt_out_capturing",value:function(){this.consent.optInOut(!1),this._sync_opt_out_with_persistence()}},{key:"has_opted_in_capturing",value:function(){return this.consent.isOptedIn()}},{key:"has_opted_out_capturing",value:function(){return this.consent.isOptedOut()}},{key:"clear_opt_in_out_capturing",value:function(){this.consent.reset(),this._sync_opt_out_with_persistence()}},{key:"_is_bot",value:function(){return A?function(ue,eo){if(!ue)return!1;var no=ue.userAgent;if(no&&Or(no,eo))return!0;try{var ro=ue==null?void 0:ue.userAgentData;if(ro!=null&&ro.brands&&ro.brands.some(function(oo){return Or(oo==null?void 0:oo.brand,eo)}))return!0}catch{}return!!ue.webdriver}(A,this.config.custom_blocked_useragents):void 0}},{key:"_captureInitialPageview",value:function(){L&&!this._initialPageviewCaptured&&(this._initialPageviewCaptured=!0,this.capture("$pageview",{title:L.title},{send_instantly:!0}))}},{key:"debug",value:function(ue){ue===!1?(T==null||T.console.log("You've disabled debug mode."),localStorage&&localStorage.removeItem("ph_debug"),this.set_config({debug:!1})):(T==null||T.console.log("You're now in debug mode. All calls to PostHog will be logged in your console.\nYou can disable this with `posthog.debug(false)`."),localStorage&&localStorage.setItem("ph_debug","true"),this.set_config({debug:!0}))}}]),to}();(function(to,ue){for(var eo=0;eo<ue.length;eo++)to.prototype[ue[eo]]=ee(to.prototype[ue[eo]])})(rs,["identify"]);var ss,os=(ss=Xr[Zr]=new rs,function(){function to(){to.done||(to.done=!0,es=!1,Q(Xr,function(ue){ue._dom_loaded()}))}L!=null&&L.addEventListener&&(L.readyState==="complete"?to():L.addEventListener("DOMContentLoaded",to,!1)),T&&oe(T,"load",to,!0)}(),ss);const Events={COMPONENT_CREATED:"component:created",COMPONENT_UPDATED:"component:updated",APP_VIEW_PUBLISHED:"app:view_published",BLOCK_EJECTED:"block:ejected"},EventSource$1={PORTAL:"portal",URL:"url",NOTIFICATION:"notification"};class PosthogClient{constructor(ue){this.token=ue}init(){this.token&&(os.init(this.token,{autocapture:!1,capture_pageview:!1}),os.set_config({persistence:"cookie"}),this.initialised=!0)}identify(ue){this.initialised&&os.identify(ue)}updateUser(ue){this.initialised&&os.people.set(ue)}captureEvent(ue,eo){this.initialised&&(eo.sourceApp="builder",os.capture(ue,eo))}npsFeedback(ue){if(!this.initialised)return;localStorage.setItem(Events.NPS.SUBMITTED,Date.now());const eo={};for(let no in ue)eo[`feedback_${no}`]=ue[no];os.capture(Events.NPS.SUBMITTED,eo)}logout(){this.initialised&&os.reset()}}const posthog=new PosthogClient(void 0);class AnalyticsHub{constructor(){this.clients=[posthog],this.initialised=!1}async activate(){(await API.getAnalyticsStatus()).enabled&&!this.initialised&&(this.clients.forEach(eo=>{eo.init()}),this.initialised=!0)}identify(ue){posthog.identify(ue)}captureException(ue){}captureEvent(ue,eo={}){posthog.captureEvent(ue,eo)}async logout(){posthog.logout()}}const analytics=new AnalyticsHub,capitalise=to=>to&&to.substring(0,1).toUpperCase()+to.substring(1),lowercase=to=>to.substring(0,1).toLowerCase()+to.substring(1),isBuilderInputFocused=to=>{var no,ro,oo;const ue=(no=document.activeElement)==null?void 0:no.tagName.toLowerCase();return!!((((oo=(ro=document.activeElement)==null?void 0:ro.classList)==null?void 0:oo.contains("cm-content"))||["input","textarea"].indexOf(ue)!==-1)&&to.key!=="Escape")},DEFAULT_STATE={platformUrl:"",emailBrandingEnabled:!0,testimonialsEnabled:!0,platformTitle:"Budibase",company:"Budibase",google:!1,googleDatasourceConfigured:!1,oidc:!1,oidcCallbackUrl:"",googleCallbackUrl:"",loaded:!1};class OrganisationStore extends BudiStore{constructor(){super(DEFAULT_STATE)}async init(){const ue=get_store_value(auth).tenantId,eo=await API.getTenantConfig(ue);this.set({...DEFAULT_STATE,...eo.config,loaded:!0})}async save(ue){const{oidc:eo,google:no,googleDatasourceConfigured:ro,oidcCallbackUrl:oo,googleCallbackUrl:io,loaded:ao,...so}=get_store_value(this.store),lo={...so,...ue};await API.saveConfig({type:ConfigType.SETTINGS,config:lo}),await this.init()}}const organisation=new OrganisationStore;let UserStore$1=class extends BudiStore{constructor(){super({data:[]})}async search(ue={}){const eo=await API.searchUsers(ue);return this.set({...eo,...ue}),eo}async get(ue){try{return await API.getUser(ue)}catch{return null}}async fetch(){return await API.getUsers()}async onboard(ue){return await API.onboardUsers(ue)}async invite(ue){const eo=ue.map(no=>{let ro;return no.admin||no.builder?ro={global:!0}:no.creator&&(ro={creator:!0}),{email:no.email,userInfo:{admin:no.admin?{global:!0}:void 0,builder:ro,userGroups:no.groups,roles:no.apps?no.apps:void 0}}});return API.inviteUsers(eo)}async removeInvites(ue){return API.removeUserInvites(ue)}async acceptInvite(ue,eo,no,ro){return API.acceptInvite({inviteCode:ue,password:eo,firstName:no,lastName:ro!=null&&ro.trim()?ro:void 0})}async fetchInvite(ue){return API.getUserInvite(ue)}async getInvites(){return API.getUserInvites()}async updateInvite(ue,eo){return API.updateUserInvite(ue,eo)}async getUserCountByApp(ue){return await API.getUserCountByApp(ue)}async create(ue){let eo=ue.users.map(ro=>{const oo={email:ro.email,password:ro.password,roles:{}};switch(ro.forceResetPassword&&(oo.forceResetPassword=ro.forceResetPassword),ro.role){case BudibaseRoles.AppUser:oo.builder={global:!1},oo.admin={global:!1};break;case BudibaseRoles.Developer:oo.builder={global:!0};break;case BudibaseRoles.Creator:oo.builder={creator:!0,global:!1};break;case BudibaseRoles.Admin:oo.admin={global:!0},oo.builder={global:!0};break}return oo});const no=await API.createUsers(eo,ue.groups);return licensing.setQuotaUsage(),await this.search(),no}async delete(ue){await API.deleteUser(ue),licensing.setQuotaUsage()}async bulkDelete(ue){const eo=API.deleteUsers(ue);return licensing.setQuotaUsage(),eo}async save(ue){const eo=await API.saveUser(ue);return licensing.setQuotaUsage(),eo}async addAppBuilder(ue,eo){return await API.addAppBuilder(ue,eo)}async removeAppBuilder(ue,eo){return await API.removeAppBuilder(ue,eo)}async getAccountHolder(){return await API.getAccountHolder()}getUserRole(ue){return ue?ue.email===ue.tenantOwnerEmail?BudibaseRoles.Owner:isAdmin(ue)?BudibaseRoles.Admin:isBuilder(ue)?BudibaseRoles.Developer:hasCreatorPermissions(ue)?BudibaseRoles.Creator:BudibaseRoles.AppUser:BudibaseRoles.AppUser}};const users=new UserStore$1;class AdminStore extends BudiStore{constructor(){super({loaded:!1,multiTenancy:!1,cloud:!1,isDev:!1,disableAccountPortal:!1,offlineMode:!1,maintenance:[]})}async init(){await this.getChecklist(),await this.getEnvironment(),get_store_value(this.store).cloud&&(await this.getSystemStatus(),this.checkStatus()),this.update(ue=>(ue.loaded=!0,ue))}async getEnvironment(){const ue=await API.getEnvironment();this.update(eo=>(eo.multiTenancy=ue.multiTenancy,eo.cloud=ue.cloud,eo.disableAccountPortal=ue.disableAccountPortal,eo.accountPortalUrl=ue.accountPortalUrl,eo.isDev=ue.isDev,eo.baseUrl=ue.baseUrl,eo.offlineMode=ue.offlineMode,eo.maintenance=ue.maintenance,eo.passwordMinLength=ue.passwordMinLength,eo))}async checkStatus(){var eo;const ue=(eo=get_store_value(this.store).status)==null?void 0:eo.health;ue!=null&&ue.passing||await banner.showStatus()}async getSystemStatus(){const ue=await API.getSystemStatus();this.update(eo=>(eo.status=ue,eo))}async getChecklist(){const ue=get_store_value(auth).tenantId,eo=await API.getChecklist(ue);this.update(no=>(no.checklist=eo,no))}unload(){this.update(ue=>(ue.loaded=!1,ue))}}const admin=new AdminStore,TableNames={USERS:"ta_users"},AppStatus={ALL:"all",DEV:"development",DEPLOYED:"published"},IntegrationNames={POSTGRES:"PostgreSQL",MONGODB:"MongoDB",COUCHDB:"CouchDB",S3:"S3",MYSQL:"MySQL",REST:"REST",DYNAMODB:"DynamoDB",ELASTICSEARCH:"ElasticSearch",SQL_SERVER:"SQL Server",AIRTABLE:"Airtable",ARANGODB:"ArangoDB",ORACLE:"Oracle",GOOGLE_SHEETS:"Google Sheets"},UNEDITABLE_USER_FIELDS=["email","password","roleId","status","firstName","lastName"],APP_NAME_REGEX=/^[\w\s]+$/,APP_URL_REGEX=/^[0-9a-zA-Z-_]+$/,DefaultAppTheme={primaryColor:"var(--spectrum-global-color-blue-600)",primaryColorHover:"var(--spectrum-global-color-blue-500)",buttonBorderRadius:"16px",navBackground:"var(--spectrum-global-color-gray-50)",navTextColor:"var(--spectrum-global-color-gray-800)"},PluginSource={URL:"URL",NPM:"NPM",GITHUB:"Github",FILE:"File Upload"},OnboardingType={EMAIL:"email",PASSWORD:"password"},PlanModel={PER_USER:"perUser"},ChangelogURL="https://docs.budibase.com/changelog",AutoScreenTypes={BLANK:"blank",TABLE:"table",FORM:"form"};class AuthStore extends BudiStore{constructor(){super({accountPortalAccess:!1,tenantId:"default",tenantSet:!1,loaded:!1,postLogout:!1,isSSO:!1})}setUser(ue){this.set({loaded:!0,user:ue,accountPortalAccess:!!(ue!=null&&ue.accountPortalAccess),tenantId:(ue==null?void 0:ue.tenantId)||"default",tenantSet:!!ue,isSSO:ue!=null&&isSSOUser(ue),postLogout:!1}),ue&&analytics.activate().then(()=>{analytics.identify(ue._id)}).catch(()=>{})}async setOrganisation(ue){const eo=get_store_value(this.store).tenantId;auth.update(no=>(no.tenantId=ue,no.tenantSet=!!ue,no)),eo!==ue&&await admin.init()}async setInitInfo(ue){return await API.setInitInfo(ue),auth.update(eo=>(eo.initInfo=ue,eo)),ue}setPostLogout(){auth.update(ue=>(ue.postLogout=!0,ue))}async getInitInfo(){const ue=await API.getInitInfo();return auth.update(eo=>(eo.initInfo=ue,eo)),ue}async checkQueryString(){const eo=new URLSearchParams(window.location.search).get("tenantId");eo&&await this.setOrganisation(eo)}async setOrg(ue){await this.setOrganisation(ue)}async getSelf(){try{const ue=await API.fetchBuilderSelf();this.setUser(ue)}catch{this.setUser()}}async login(ue,eo,no){const ro=no||get_store_value(this.store).tenantId;await API.logIn(ro,ue,eo),await this.getSelf()}async logout(){await API.logOut(),this.setPostLogout(),this.setUser(),await this.setInitInfo({})}async updateSelf(ue){await API.updateSelf(ue);try{const eo=await API.fetchBuilderSelf();this.setUser(eo)}catch{this.setUser()}}async forgotPassword(ue){const eo=get_store_value(this.store).tenantId;await API.requestForgotPassword(eo,ue)}async resetPassword(ue,eo){const no=get_store_value(this.store).tenantId;await API.resetPassword(no,ue,eo)}async generateAPIKey(){return API.generateAPIKey()}async fetchAPIKey(){const ue=await API.fetchDeveloperInfo();return ue==null?void 0:ue.apiKey}}const auth=new AuthStore;class AppsStore extends BudiStore{constructor(){super({apps:[]}),this.extractAppId=this.extractAppId.bind(this),this.getProdAppID=this.getProdAppID.bind(this),this.updateSort=this.updateSort.bind(this),this.load=this.load.bind(this),this.save=this.save.bind(this)}extractAppId(ue){const eo=(ue==null?void 0:ue.split("_"))||[];return eo.length?eo[eo.length-1]:null}getProdAppID(ue){if(!ue)return ue;let eo,no="";if(ue.startsWith("app_dev")){const ro=ue.split("app_dev");ro.shift(),eo=ro.join("app_dev")}else if(!ue.startsWith("app"))eo=ue,no="_";else return ue;return`app${no}${eo}`}async updateSort(ue){this.update(eo=>({...eo,sortBy:ue})),await this.updateUserSort(ue)}async updateUserSort(ue){try{await auth.updateSelf({appSort:ue})}catch(eo){console.error("couldn't save user sort: ",eo)}}async load(){const ue=await API.getApps();if(Array.isArray(ue)){let eo={},no=ue.filter(io=>io.status===AppStatus.DEV),ro=ue.filter(io=>io.status===AppStatus.DEPLOYED);no.forEach(io=>{const ao=this.extractAppId(io.appId);ao&&(eo[ao]={...io,devId:io.appId,devRev:io._rev})}),ro.forEach(io=>{const ao=this.extractAppId(io.appId);if(!ao||!eo[ao])return;let so={};eo[ao]&&(so={updatedBy:eo[ao].updatedBy,updatedAt:eo[ao].updatedAt}),eo[ao]={...eo[ao],...io,...so,prodId:io.appId,prodRev:io._rev}});const oo=Object.values(eo);oo.forEach(io=>{const ao=this.extractAppId(io.devId);ao&&(io.appId=ao),delete io._id,delete io._rev}),this.update(io=>({...io,apps:oo}))}else this.update(eo=>({...eo,apps:[]}))}async save(ue,eo){await API.saveAppMetadata(ue,eo),this.update(no=>{const ro=no.apps.findIndex(oo=>oo.instance._id===ue);if(ro!==-1){let oo=no.apps[ro];oo={...oo,...eo},no.apps.splice(ro,1,oo)}return no})}}const appsStore=new AppsStore,sortBy=derived([appsStore,auth],([to,ue])=>{var eo;return to.sortBy||((eo=ue.user)==null?void 0:eo.appSort)||"name"}),enrichedApps=derived([appsStore,auth,sortBy],([to,ue,eo])=>{const no=to.apps.map(ro=>{var io;const oo=ue.user;return{...ro,deployed:ro.status===AppStatus.DEPLOYED,lockedYou:ro.lockedBy!=null&&ro.lockedBy.email===(oo==null?void 0:oo.email),lockedOther:ro.lockedBy!=null&&ro.lockedBy.email!==(oo==null?void 0:oo.email),favourite:!!((io=oo==null?void 0:oo.appFavourites)!=null&&io.includes(ro.appId))}});return eo==="status"?no.sort((ro,oo)=>{var io,ao;return ro.favourite===oo.favourite?ro.status===oo.status?((io=ro.name)==null?void 0:io.toLowerCase())<((ao=oo.name)==null?void 0:ao.toLowerCase())?-1:1:ro.status===AppStatus.DEPLOYED?-1:1:ro.favourite?-1:1}):eo==="updated"?no==null?void 0:no.sort((ro,oo)=>{if(ro.favourite===oo.favourite){const io=ro.updatedAt||"9999",ao=oo.updatedAt||"9999";return io<ao?1:-1}return ro.favourite?-1:1}):no==null?void 0:no.sort((ro,oo)=>{var io,ao;return ro.favourite===oo.favourite?((io=ro.name)==null?void 0:io.toLowerCase())<((ao=oo.name)==null?void 0:ao.toLowerCase())?-1:1:ro.favourite?-1:1})});class EmailStore extends BudiStore{constructor(){super({templates:[]})}async fetchTemplates(){const ue=await API.getEmailTemplateDefinitions(),eo=await API.getEmailTemplates();this.set({definitions:ue,templates:eo})}async saveTemplate(ue){const eo=await API.saveEmailTemplate(ue);ue._rev=eo._rev,ue._id=eo._id,this.update(no=>{const ro=no.templates.findIndex(oo=>oo.purpose===eo.purpose);return no.templates.splice(ro,1,ue),no})}}const email=new EmailStore;class OIDCStore extends BudiStore{constructor(){super({})}async init(){const ue=get_store_value(auth).tenantId,eo=await API.getOIDCConfigs(ue);this.set(eo[0]||{})}}const oidc=new OIDCStore;class TemplateStore extends BudiStore{constructor(){super([])}async load(){const ue=await API.getAppTemplates();this.set(ue)}}const templates=new TemplateStore,ExpiringKeys={LICENSING_PAYMENT_FAILED:"licensing_payment_failed",LICENSING_ACCOUNT_DOWNGRADED_MODAL:"licensing_account_downgraded_modal",LICENSING_APP_LIMIT_MODAL:"licensing_app_limit_modal",LICENSING_ROWS_WARNING_BANNER:"licensing_rows_warning_banner",LICENSING_AUTOMATIONS_WARNING_BANNER:"licensing_automations_warning_banner",LICENSING_QUERIES_WARNING_BANNER:"licensing_queries_warning_banner",LICENSING_USERS_ABOVE_LIMIT_BANNER:"licensing_users_above_limit_banner"},StripeStatus={PAST_DUE:"past_due",ACTIVE:"active"},UNLIMITED=-1,ONE_DAY_MILLIS=864e5;class LicensingStore extends BudiStore{constructor(){super({goToUpgradePage:()=>{},goToPricingPage:()=>{},license:void 0,isFreePlan:!0,isEnterprisePlan:!0,isBusinessPlan:!0,groupsEnabled:!1,backupsEnabled:!1,brandingEnabled:!1,scimEnabled:!1,environmentVariablesEnabled:!1,budibaseAIEnabled:!1,customAIConfigsEnabled:!1,auditLogsEnabled:!1,quotaUsage:void 0,usageMetrics:void 0,quotaResetDaysRemaining:void 0,quotaResetDate:void 0,accountPastDue:!1,pastDueEndDate:void 0,pastDueDaysRemaining:void 0,accountDowngraded:!1,userCount:void 0,userLimit:void 0,userLimitReached:!1,errUserLimit:!1})}usersLimitReached(ue,eo=get_store_value(this.store).userLimit){return eo===UNLIMITED||eo===void 0?!1:ue>=eo}usersLimitExceeded(ue,eo=get_store_value(this.store).userLimit){return eo===UNLIMITED||eo===void 0?!1:ue>eo}async isCloud(){let ue=get_store_value(admin);return ue.loaded||(await admin.init(),ue=get_store_value(admin)),ue.cloud}async init(){this.setNavigation(),this.setLicense(),await this.setQuotaUsage()}setNavigation(){var io;const ue=get_store_value(admin),eo=get_store_value(auth),no=(io=eo==null?void 0:eo.user)!=null&&io.accountPortalAccess?`${ue.accountPortalUrl}/portal/upgrade`:"/builder/portal/account/upgrade",ro=()=>{window.location.href=no},oo=()=>{window.open("https://budibase.com/pricing/","_blank")};this.update(ao=>({...ao,goToUpgradePage:ro,goToPricingPage:oo}))}setLicense(){var $o;const ue=($o=get_store_value(auth).user)==null?void 0:$o.license,eo=ue==null?void 0:ue.plan.type,no=(ue==null?void 0:ue.features)||[],ro=eo===PlanType.ENTERPRISE,oo=eo===PlanType.FREE,io=eo===PlanType.BUSINESS,ao=eo===PlanType.ENTERPRISE_BASIC_TRIAL,so=no.includes(Feature.USER_GROUPS),lo=no.includes(Feature.APP_BACKUPS),co=no.includes(Feature.SCIM),uo=no.includes(Feature.ENVIRONMENT_VARIABLES),fo=no.includes(Feature.ENFORCEABLE_SSO),po=no.includes(Feature.BRANDING),ho=no.includes(Feature.AUDIT_LOGS),_o=no.includes(Feature.SYNC_AUTOMATIONS),go=no.includes(Feature.TRIGGER_AUTOMATION_RUN),bo=no.includes(Feature.APP_BUILDERS),vo=no.includes(Feature.BUDIBASE_AI),yo=no.includes(Feature.AI_CUSTOM_CONFIGS);this.update(ko=>({...ko,license:ue,isEnterprisePlan:ro,isFreePlan:oo,isBusinessPlan:io,isEnterpriseTrial:ao,groupsEnabled:so,backupsEnabled:lo,brandingEnabled:po,budibaseAIEnabled:vo,customAIConfigsEnabled:yo,scimEnabled:co,environmentVariablesEnabled:uo,auditLogsEnabled:ho,enforceableSSO:fo,syncAutomationsEnabled:_o,triggerAutomationRunEnabled:go,perAppBuildersEnabled:bo}))}async setQuotaUsage(){const ue=await API.getQuotaUsage();this.update(eo=>({...eo,quotaUsage:ue})),await this.setUsageMetrics()}async setUsageMetrics(){var ko,So,Ao,Mo,Eo,To,Io,No,xo,zo,Po;const ue=get_store_value(this.store).quotaUsage,eo=(ko=get_store_value(auth).user)==null?void 0:ko.license,no=new Date;if(!eo||!ue)return;const ro=[MonthlyQuotaName.QUERIES,MonthlyQuotaName.AUTOMATIONS].reduce((Bo,qo)=>{var Go;const Fo=eo.quotas.usage.monthly[qo].value,Wo=(((Go=ue.monthly.current)==null?void 0:Go[qo])||0)/Fo*100;return Bo[qo]=Fo>-1?Math.floor(Wo):-1,Bo},{}),oo=[StaticQuotaName.APPS,StaticQuotaName.ROWS].reduce((Bo,qo)=>{const Fo=eo.quotas.usage.static[qo].value,Wo=(ue.usageQuota[qo]||0)/Fo*100;return Bo[qo]=Fo>-1?Math.floor(Wo):-1,Bo},{}),io=(Bo,qo)=>qo>Bo?Math.round((qo.getTime()-Bo.getTime())/ONE_DAY_MILLIS):0,ao=new Date(ue.quotaReset),so=io(no,ao),lo=!!((Ao=(So=eo.billing)==null?void 0:So.subscription)!=null&&Ao.downgradeAt)&&((Eo=(Mo=eo.billing)==null?void 0:Mo.subscription)==null?void 0:Eo.downgradeAt)<=no.getTime()&&((Io=(To=eo.billing)==null?void 0:To.subscription)==null?void 0:Io.status)===StripeStatus.PAST_DUE&&eo.plan.type===PlanType.FREE,co=(xo=(No=eo.billing)==null?void 0:No.subscription)==null?void 0:xo.pastDueAt,uo=(Po=(zo=eo.billing)==null?void 0:zo.subscription)==null?void 0:Po.downgradeAt;let fo,po;co&&uo&&(po=new Date(uo),fo=io(new Date(co),po));const _o=eo.quotas.usage.static.users.value,go=ue.usageQuota.users,bo=this.usersLimitReached(go,_o),vo=this.usersLimitExceeded(go,_o),$o=await this.isCloud()&&eo.plan.model===PlanModel$1.PER_USER&&vo;this.update(Bo=>({...Bo,usageMetrics:{...ro,...oo},quotaResetDaysRemaining:so,quotaResetDate:ao,accountDowngraded:lo,accountPastDue:co!=null,pastDueEndDate:po,pastDueDaysRemaining:fo,userCount:go,userLimit:_o,userLimitReached:bo,errUserLimit:$o}))}}const licensing=new LicensingStore;class GroupStore extends BudiStore{constructor(){super([]),this.updateStore=ue=>{this.update(eo=>{const no=eo.findIndex(ro=>ro._id===ue._id);return no>=0?eo.splice(no,1,ue):eo.push(ue),eo})}}async init(){if(get_store_value(licensing).groupsEnabled){const ue=await API.getGroups();this.set(ue)}}async refreshGroup(ue){const eo=await API.getGroup(ue);this.updateStore(eo)}async save(ue){const{...eo}=ue;delete eo.scimInfo;const no=await API.saveGroup(eo);return ue._id=no._id,ue._rev=no._rev,this.updateStore(ue),ue}async delete(ue){await API.deleteGroup(ue._id,ue._rev),this.update(eo=>{const no=eo.findIndex(ro=>ro._id===ue._id);return no!==-1&&eo.splice(no,1),eo})}async addUser(ue,eo){await API.addUsersToGroup(ue,[eo]),await this.refreshGroup(ue)}async removeUser(ue,eo){await API.removeUsersFromGroup(ue,[eo]),await this.refreshGroup(ue)}async addApp(ue,eo,no){await API.addAppsToGroup(ue,[{appId:eo,roleId:no}]),await this.refreshGroup(ue)}async removeApp(ue,eo){await API.removeAppsFromGroup(ue,[{appId:eo}]),await this.refreshGroup(ue)}getGroupAppIds(ue){var no;let eo=Object.keys((ue==null?void 0:ue.roles)||{});return(no=ue==null?void 0:ue.builder)!=null&&no.apps&&(eo=eo.concat(ue.builder.apps)),eo}async addGroupAppBuilder(ue,eo){return await API.addGroupAppBuilder(ue,eo)}async removeGroupAppBuilder(ue,eo){return await API.removeGroupAppBuilder(ue,eo)}}const groups=new GroupStore;function createPluginsStore(){const{subscribe:to,set:ue,update:eo}=writable([]);async function no(){const ao=await API.getPlugins();ue(ao)}async function ro(ao){await API.deletePlugin(ao),eo(so=>(so=so.filter(lo=>lo._id!==ao),so))}async function oo(ao,so,lo=null){let co={source:ao,url:so};switch(ao){case PluginSource.URL:co.headers=lo;break;case PluginSource.GITHUB:co.githubToken=lo;break}let fo=(await API.createPlugin(co)).plugin;eo(po=>{const ho=po.findIndex(_o=>_o._id===fo._id);return ho>=0?po.splice(ho,1,fo):po.push(fo),po})}async function io(ao){if(!ao)return;let so=new FormData;so.append("file",ao);let co=(await API.uploadPlugin(so)).plugins[0];eo(uo=>{const fo=uo.findIndex(po=>po._id===co._id);return fo>=0?uo.splice(fo,1,co):uo.push(co),uo})}return{subscribe:to,load:no,createPlugin:oo,deletePlugin:ro,uploadPlugin:io}}const plugins$1=createPluginsStore();class BackupStore extends BudiStore{constructor(){super({})}selectBackup(ue){this.update(eo=>(eo.selectedBackup=ue,eo))}async searchBackups(ue,eo){return API.searchBackups(ue,eo)}async restoreBackup(ue,eo,no){return API.restoreBackup(ue,eo,no)}async deleteBackup(ue,eo){return API.deleteBackup(ue,eo)}async createManualBackup(ue){return API.createManualBackup(ue)}}const backups=new BackupStore;class EnvironmentStore extends BudiStore{constructor(){super({variables:[],status:{encryptionKeyAvailable:!1}})}async checkStatus(){const ue=await API.checkEnvironmentVariableStatus();this.update(eo=>(eo.status=ue,eo))}async loadVariables(){if(get_store_value(licensing).environmentVariablesEnabled){const eo=(await API.fetchEnvironmentVariables()).variables.map(no=>({name:no}));this.update(no=>(no.variables=eo,no))}}async createVariable(ue){await API.createEnvironmentVariable(ue);let eo={name:ue.name};this.update(no=>(no.variables=[eo,...no.variables],no))}async deleteVariable(ue){await API.deleteEnvironmentVariable(ue),this.update(eo=>(eo.variables=eo.variables.filter(no=>no.name!==ue),eo))}async updateVariable(ue,eo){await API.updateEnvironmentVariable(ue,eo)}async upgradePanelOpened(){await API.publishEvent(EventPublishType$1.ENVIRONMENT_VARIABLE_UPGRADE_PANEL_OPENED)}}const environment=new EnvironmentStore,menu=derived([admin,auth],([to,ue])=>{var lo;const eo=ue==null?void 0:ue.user,no=eo!=null&&isAdmin(eo),ro=eo!=null&&isGlobalBuilder(eo),oo=to==null?void 0:to.cloud;let io=[{title:"Users",href:"/builder/portal/users/users"}];io.push({title:"Groups",href:"/builder/portal/users/groups"});let ao=[{title:"Apps",href:"/builder/portal/apps"}];if(ro&&(ao.push({title:"Users",href:"/builder/portal/users",subPages:io}),ao.push({title:"Plugins",href:"/builder/portal/plugins"})),no){let co=[{title:"Auth",href:"/builder/portal/settings/auth"},{title:"Email",href:"/builder/portal/settings/email"},{title:"Organisation",href:"/builder/portal/settings/organisation"},{title:"Branding",href:"/builder/portal/settings/branding"},{title:"Environment",href:"/builder/portal/settings/environment"},{title:"AI",href:"/builder/portal/settings/ai"}];oo||(co.push({title:"Version",href:"/builder/portal/settings/version"}),co.push({title:"Diagnostics",href:"/builder/portal/settings/diagnostics"})),ao.push({title:"Settings",href:"/builder/portal/settings",subPages:[...co].sort((uo,fo)=>uo.title.localeCompare(fo.title))})}let so=[{title:"Usage",href:"/builder/portal/account/usage"}];return no&&(so.push({title:"Audit Logs",href:"/builder/portal/account/auditLogs"}),oo||so.push({title:"System Logs",href:"/builder/portal/account/systemLogs"})),oo&&(eo!=null&&eo.accountPortalAccess)?so.push({title:"Upgrade",href:(to==null?void 0:to.accountPortalUrl)+"/portal/upgrade"}):!oo&&no&&so.push({title:"Upgrade",href:"/builder/portal/account/upgrade"}),eo!=null&&eo.accountPortalAccess&&((lo=eo==null?void 0:eo.account)!=null&&lo.stripeCustomerId)&&so.push({title:"Billing",href:(to==null?void 0:to.accountPortalUrl)+"/portal/billing"}),ao.push({title:"Account",href:"/builder/portal/account",subPages:so}),ao});class AuditLogsStore extends BudiStore{constructor(){super({})}async search(ue={}){if(get_store_value(licensing).auditLogsEnabled){const eo=await API.searchAuditLogs(ue);return this.update(no=>({...no,logs:eo})),eo}}async getEventDefinitions(){const ue=await API.getEventDefinitions();this.update(eo=>({...eo,events:ue.events}))}getDownloadUrl(ue={}){return API.getDownloadUrl(ue)}}const auditLogs=new AuditLogsStore;class FeatureStore extends DerivedBudiStore{constructor(){const ue=eo=>derived([eo,licensing],([no,ro])=>({isScimEnabled:no.scimConfigEnabled&&ro.scimEnabled}));super({scimConfigEnabled:!1},ue)}async init(){const ue=await API.getConfig(ConfigType.SCIM);this.update(eo=>({...eo,scimConfigEnabled:isConfig(ue)&&isSCIMConfig(ue)&&ue.config.enabled}))}}const features=new FeatureStore;let ThemeStore$1=class extends DerivedBudiStore{constructor(){const ue=eo=>derived(eo,no=>({...no,theme:ensureValidTheme(no.theme,DefaultBuilderTheme)}));super({theme:DefaultBuilderTheme},ue,{persistence:{key:"bb-theme",type:PersistenceType.LOCAL}}),this.subscribe(({theme:eo})=>{const no=getThemeClassNames(eo).split(" ");ThemeOptions.forEach(ro=>{const oo=`${ThemeClassPrefix}${ro.id}`;document.documentElement.classList.toggle(oo,no.includes(oo))})})}};const themeStore$1=new ThemeStore$1;class TemporalStore extends BudiStore{constructor(){super({},{persistence:{key:"bb-temporal",type:PersistenceType.LOCAL}}),this.setExpiring=(ue,eo,no)=>{const ro={...eo,expiry:Date.now()+no*1e3};this.update(oo=>({...oo,[ue]:ro}))}}getExpiring(ue){const eo=get_store_value(this.store)[ue];return eo?eo.expiry<Date.now()?(this.update(ro=>(delete ro[ue],ro)),null):eo:null}}const temporalStore=new TemporalStore;let NavigationStore$1=class extends BudiStore{constructor(){super({initialisated:!1,goto:void 0})}init(ue){if(typeof ue!="function")throw new Error(`gotoFunc must be a function, found a "${typeof ue}" instead`);this.set({initialisated:!0,goto:ue})}};const navigation=new NavigationStore$1;derived(auth,to=>{var ue;return{...FeatureFlagDefaults,...((ue=to==null?void 0:to.user)==null?void 0:ue.flags)||{}}});const sideBarCollapsed=writable(!1);function extractRelationships(to){return to.filter(ue=>{var eo;return((eo=ue.fieldSchema)==null?void 0:eo.type)==="link"}).filter(ue=>{var eo;return!((eo=ue.component)!=null&&eo.endsWith("/form"))}).map(ue=>{const{providerId:eo,readableBinding:no,fieldSchema:ro}=ue||{},{name:oo,tableId:io}=ro||{},ao=makePropSafe(eo);return{providerId:eo,label:no,fieldName:oo,tableId:io,type:"link",rowId:`{{ ${ao}.${makePropSafe("_id")} }}`,rowTableId:`{{ ${ao}.${makePropSafe("tableId")} }}`}})}function extractFields(to){return to.filter(ue=>{var eo,no;return((eo=ue.fieldSchema)==null?void 0:eo.type)==="attachment"||((no=ue.fieldSchema)==null?void 0:no.type)==="array"&&ue.tableId}).map(ue=>{const{providerId:eo,readableBinding:no,runtimeBinding:ro}=ue,{name:oo,type:io,tableId:ao}=ue.fieldSchema;return{providerId:eo,label:no,fieldName:oo,fieldType:io,tableId:ao,type:"field",value:`{{ literal ${ro} }}`}})}function extractJSONArrayFields(to){return to.filter(ue=>{var eo,no,ro;return((eo=ue.fieldSchema)==null?void 0:eo.type)==="jsonarray"||((no=ue.fieldSchema)==null?void 0:no.type)==="json"&&((ro=ue.fieldSchema)==null?void 0:ro.subtype)==="array"}).map(ue=>{const{providerId:eo,readableBinding:no,runtimeBinding:ro,tableId:oo}=ue,{name:io,type:ao,prefixKeys:so,subtype:lo}=ue.fieldSchema;return{providerId:eo,label:no,fieldName:io,fieldType:ao,tableId:oo,prefixKeys:so,type:ao==="jsonarray"?"jsonarray":"queryarray",subtype:lo,value:`{{ literal ${ro} }}`}})}const{ContextScopes:ContextScopes$1}=Constants$1,findComponent=(to,ue)=>searchComponentTree(to,eo=>eo._id===ue),findComponentType=(to,ue)=>searchComponentTree(to,eo=>eo._component===ue),findComponentParent=(to,ue,eo)=>{if(!to||!ue)return null;if(to._id===ue)return eo;if(!to._children)return null;for(const no of to._children){const ro=findComponentParent(no,ue,to);if(ro)return ro}return null},findComponentPath=(to,ue,eo=[])=>{if(!to||!ue)return[];if(to._id===ue)return[...eo,to];if(!to._children)return[];for(const no of to._children){const ro=[...eo,to],oo=findComponentPath(no,ue,ro);if(oo!=null&&oo.length)return oo}return[]},findAllMatchingComponents=(to,ue)=>{if(!to||!ue)return[];let eo=[];return to._children&&to._children.forEach(no=>{eo=[...eo,...findAllMatchingComponents(no,ue)]}),ue(to)&&eo.push(to),eo.reverse()},findAllComponents=to=>findAllMatchingComponents(to,()=>!0),findClosestMatchingComponent=(to,ue,eo)=>{if(!eo)return null;const no=findComponentPath(to,ue).reverse();for(let ro of no)if(eo(ro))return ro;return null},searchComponentTree=(to,ue)=>{if(!to||!ue)return null;if(ue(to))return to;if(!to._children)return null;for(const eo of to._children){const no=searchComponentTree(eo,ue);if(no)return no}return null},makeComponentUnique=to=>{if(!to)return;const ue=[],eo=(oo,io)=>{var lo;const ao=oo._id,so=uuid$2();io.push([ao,so]),(lo=oo._children)==null||lo.forEach(co=>eo(co,io))};eo(to,ue);let no=JSON.stringify(to);return ue.forEach(([oo,io])=>{no=no.replace(new RegExp(oo,"g"),io)}),findHBSBlocks(no).forEach(oo=>{let io=oo.replace(/\\"/g,'"'),ao=decodeJSBinding(io);if(ao!=null){ue.forEach(([lo,co])=>{ao=ao.replace(new RegExp(lo,"g"),co)});let so=encodeJSBinding(ao);so=so.replace(/"/g,'\\"'),no=no.replace(oo,so)}}),JSON.parse(no)},getComponentText=to=>{var eo;if(to==null)return"";if(to!=null&&to._instanceName)return to._instanceName;const ue=((eo=to._component)==null?void 0:eo.replace("@budibase/standard-components/",""))||"component";return capitalise(ue)},getComponentName=to=>{var no;if(to==null)return"";const eo=(((no=get_store_value(componentStore))==null?void 0:no.components)||{})[to._component]||{};return eo.friendlyName||eo.name||""},getComponentContexts=to=>{const ue=componentStore.getDefinition(to);let eo=[];return ue!=null&&ue.context&&(eo=Array.isArray(ue.context)?[...ue.context]:[ue.context]),ue!=null&&ue.actions&&eo.push({type:"action",scope:ContextScopes$1.Global,actions:ue.actions.map(no=>typeof no=="string"?{type:no}:no)}),eo},buildContextTree=(to,ue={root:[]},eo="root")=>{if(!to)return ue;const no=getComponentContexts(to._component);return no.length&&(ue[eo].push(to._id),no.some(ro=>ro.scope===ContextScopes$1.Local)&&(eo=to._id,ue[to._id]=[])),to._children&&to._children.forEach(ro=>{buildContextTree(ro,ue,eo)}),ue},buildContextTreeLookupMap=to=>{const ue=buildContextTree(to);let eo={};return Object.entries(ue).forEach(([no,ro])=>{ro.forEach(oo=>{eo[oo]=no})}),eo},getChildIdsForComponent=to=>[to._id,...((to==null?void 0:to._children)??[]).map(getChildIdsForComponent).flat(1)],actions=[{name:"Save Row",type:"data",component:"SaveRow",context:[{label:"Saved row",value:"row"}]},{name:"Duplicate Row",type:"data",component:"DuplicateRow",context:[{label:"Duplicated row",value:"row"}]},{name:"Delete Row",displayName:"Delete Rows",type:"data",component:"DeleteRow"},{name:"Fetch Row",type:"data",component:"FetchRow",context:[{label:"Fetched row",value:"row"}]},{name:"Navigate To",type:"application",component:"NavigateTo"},{name:"Execute Query",type:"data",component:"ExecuteQuery",context:[{label:"Query result",value:"result"}]},{name:"Trigger Automation",type:"application",component:"TriggerAutomation",context:[{label:"Automation Result",value:"result"}]},{name:"Update Field Value",type:"form",component:"UpdateFieldValue"},{name:"Scroll To Field",type:"form",component:"ScrollTo"},{name:"Validate Form",type:"form",component:"ValidateForm"},{name:"Change Form Step",type:"form",component:"ChangeFormStep"},{name:"Clear Form",type:"form",component:"ClearForm"},{name:"Log Out",type:"application",component:"LogOut"},{name:"Close Screen Modal",type:"application",component:"CloseScreenModal"},{name:"Refresh Data Provider",type:"data",component:"RefreshDataProvider"},{name:"Update State",type:"data",component:"UpdateState",dependsOnFeature:"state"},{name:"Upload File to S3",type:"data",component:"S3Upload",context:[{label:"File URL",value:"publicUrl"}]},{name:"Export Data",type:"data",component:"ExportData"},{name:"Continue if / Stop if",type:"logic",component:"ContinueIf",dependsOnFeature:"continueIfAction"},{name:"Show Notification",type:"application",component:"ShowNotification",dependsOnFeature:"showNotificationAction"},{name:"Prompt User",type:"application",component:"PromptUser"},{name:"Open Side Panel",type:"application",component:"OpenSidePanel",dependsOnFeature:"sidePanel"},{name:"Close Side Panel",type:"application",component:"CloseSidePanel",dependsOnFeature:"sidePanel"},{name:"Open Modal",type:"application",component:"OpenModal",dependsOnFeature:"modal"},{name:"Close Modal",type:"application",component:"CloseModal",dependsOnFeature:"modal"},{name:"Clear Row Selection",type:"data",component:"ClearRowSelection"},{name:"Download File",type:"data",component:"DownloadFile"},{name:"Row Action",type:"data",component:"RowAction"}],ActionDefinitions={actions},convertOldFieldFormat=to=>to?to.map(eo=>typeof eo=="string"?{field:eo,active:!0}:typeof(eo==null?void 0:eo.active)!="boolean"?{field:eo.name,active:!0}:eo):[],getComponentForField=(to,ue)=>{if(!to||!(ue!=null&&ue[to]))return null;const eo=ue[to].type;return FieldTypeToComponentMap[eo]},FieldTypeToComponentMap={[FieldType.STRING]:"stringfield",[FieldType.NUMBER]:"numberfield",[FieldType.BIGINT]:"bigintfield",[FieldType.OPTIONS]:"optionsfield",[FieldType.ARRAY]:"multifieldselect",[FieldType.BOOLEAN]:"booleanfield",[FieldType.LONGFORM]:"longformfield",[FieldType.DATETIME]:"datetimefield",[FieldType.SIGNATURE_SINGLE]:"signaturesinglefield",[FieldType.ATTACHMENTS]:"attachmentfield",[FieldType.ATTACHMENT_SINGLE]:"attachmentsinglefield",[FieldType.LINK]:"relationshipfield",[FieldType.JSON]:"jsonfield",[FieldType.BARCODEQR]:"codescanner",[FieldType.BB_REFERENCE]:"bbreferencefield",[FieldType.BB_REFERENCE_SINGLE]:"bbreferencesinglefield"},{TypeIconMap}=Constants$1,AUTO_COLUMN_SUB_TYPES=AutoFieldSubType,AUTO_COLUMN_DISPLAY_NAMES={AUTO_ID:"Auto ID",CREATED_BY:"Created By",CREATED_AT:"Created At",UPDATED_BY:"Updated By",UPDATED_AT:"Updated At"},FIELDS={STRING:{name:"Text",type:FieldType.STRING,icon:TypeIconMap[FieldType.STRING],constraints:{type:"string",length:{},presence:!1}},BARCODEQR:{name:"Barcode / QR",type:FieldType.BARCODEQR,icon:TypeIconMap[FieldType.BARCODEQR],constraints:{type:"string",length:{},presence:!1}},LONGFORM:{name:"Long form text",type:FieldType.LONGFORM,icon:TypeIconMap[FieldType.LONGFORM],constraints:{type:"string",length:{},presence:!1}},OPTIONS:{name:"Single select",type:FieldType.OPTIONS,icon:TypeIconMap[FieldType.OPTIONS],constraints:{type:"string",presence:!1,inclusion:[]}},ARRAY:{name:"Multi select",type:FieldType.ARRAY,icon:TypeIconMap[FieldType.ARRAY],constraints:{type:"array",presence:!1,inclusion:[]}},NUMBER:{name:"Number",type:FieldType.NUMBER,icon:TypeIconMap[FieldType.NUMBER],constraints:{type:"number",presence:!1,numericality:{greaterThanOrEqualTo:"",lessThanOrEqualTo:""}}},BIGINT:{name:"Big integer",type:FieldType.BIGINT,icon:TypeIconMap[FieldType.BIGINT]},BOOLEAN:{name:"Boolean",type:FieldType.BOOLEAN,icon:TypeIconMap[FieldType.BOOLEAN],constraints:{type:"boolean",presence:!1}},DATETIME:{name:"Date / time",type:FieldType.DATETIME,icon:TypeIconMap[FieldType.DATETIME],constraints:{type:"string",length:{},presence:!1,datetime:{latest:"",earliest:""}}},ATTACHMENT_SINGLE:{name:"Single attachment",type:FieldType.ATTACHMENT_SINGLE,icon:TypeIconMap[FieldType.ATTACHMENT_SINGLE],constraints:{presence:!1}},ATTACHMENTS:{name:"Multi attachment",type:FieldType.ATTACHMENTS,icon:TypeIconMap[FieldType.ATTACHMENTS],constraints:{type:"array",presence:!1}},SIGNATURE_SINGLE:{name:"Signature",type:FieldType.SIGNATURE_SINGLE,icon:"AnnotatePen",constraints:{presence:!1}},LINK:{name:"Relationship",type:FieldType.LINK,icon:TypeIconMap[FieldType.LINK],constraints:{type:"array",presence:!1}},AUTO:{name:"Auto column",type:FieldType.AUTO,icon:TypeIconMap[FieldType.AUTO],constraints:{}},FORMULA:{name:"Formula",type:FieldType.FORMULA,icon:TypeIconMap[FieldType.FORMULA],constraints:{}},AI:{name:"AI",type:FieldType.AI,icon:TypeIconMap[FieldType.AI],constraints:{}},JSON:{name:"JSON",type:FieldType.JSON,icon:TypeIconMap[FieldType.JSON],constraints:{type:"object",presence:!1}},USER:{name:"Single user",type:FieldType.BB_REFERENCE_SINGLE,subtype:BBReferenceFieldSubType.USER,icon:TypeIconMap[FieldType.BB_REFERENCE_SINGLE][BBReferenceFieldSubType.USER]},USERS:{name:"Multi user",type:FieldType.BB_REFERENCE,subtype:BBReferenceFieldSubType.USER,icon:TypeIconMap[FieldType.BB_REFERENCE][BBReferenceFieldSubType.USER],constraints:{type:"array"}}},Roles$1={ADMIN:"ADMIN",POWER:"POWER",BASIC:"BASIC",PUBLIC:"PUBLIC",BUILDER:"BUILDER"},PrettyRelationshipDefinitions={MANY:"Many rows",ONE:"One row"},BUDIBASE_INTERNAL_DB_ID=INTERNAL_TABLE_SOURCE_ID,DEFAULT_BB_DATASOURCE_ID="datasource_internal_bb_default",BUDIBASE_DATASOURCE_TYPE="budibase",DB_TYPE_INTERNAL="internal",DB_TYPE_EXTERNAL="external",IntegrationTypes={POSTGRES:"POSTGRES",MONGODB:"MONGODB",COUCHDB:"COUCHDB",S3:"S3",MYSQL:"MYSQL",REST:"REST",DYNAMODB:"DYNAMODB",ELASTICSEARCH:"ELASTICSEARCH",SQL_SERVER:"SQL_SERVER",AIRTABLE:"AIRTABLE",ARANGODB:"ARANGODB",ORACLE:"ORACLE",INTERNAL:"INTERNAL",GOOGLE_SHEETS:"GOOGLE_SHEETS",FIRESTORE:"FIRESTORE",REDIS:"REDIS",SNOWFLAKE:"SNOWFLAKE"},SchemaTypeOptions=[{label:"Text",value:FieldType.STRING},{label:"Number",value:FieldType.NUMBER},{label:"Boolean",value:FieldType.BOOLEAN},{label:"Datetime",value:FieldType.DATETIME},{label:"JSON",value:FieldType.JSON}],SchemaTypeOptionsExpanded=SchemaTypeOptions.map(to=>({...to,value:{type:to.value}})),RawRestBodyTypes={NONE:"none",FORM:"form",ENCODED:"encoded",JSON:"json",TEXT:"text",XML:"xml"},RestBodyTypes=[{name:"none",value:"none"},{name:"form-data",value:"form"},{name:"x-www-form-encoded",value:"encoded"},{name:"raw (JSON)",value:"json"},{name:"raw (XML)",value:"xml"},{name:"raw (Text)",value:"text"}],PaginationTypes=[{label:"Page number based",value:"page"},{label:"Cursor based",value:"cursor"}],PaginationLocations=[{label:"Query parameters",value:"query"},{label:"Request body",value:"body"}],DatasourceTypes={RELATIONAL:"Relational",NON_RELATIONAL:"Non-relational",SPREADSHEET:"Spreadsheet",OBJECT_STORE:"Object store",GRAPH:"Graph",API:"API"},{ContextScopes}=Constants$1,CAPTURE_VAR_INSIDE_TEMPLATE=/{{([^}]+)}}/g,CAPTURE_VAR_INSIDE_JS=/\$\("([^")]+)"\)/g,UpdateReferenceAction={ADD:"add",DELETE:"delete",MOVE:"move"},getBindableProperties=(to,ue)=>{const eo=getContextBindings(to,ue),no=getUserBindings(),ro=getUrlBindings(to),oo=getDeviceBindings(),io=getStateBindings(),ao=getSelectedRowsBindings(to),so=getRoleBindings(),lo=getEmbedBindings();return[...eo,...ro,...io,...no,...oo,...ao,...so,...lo]},getRestBindings=()=>{const to=get_store_value(licensing).environmentVariablesEnabled;return[...getUserBindings(),...getAuthBindings(),...to?getEnvironmentBindings():[]]},getAuthBindings=()=>{let to=[];const ue=makePropSafe("user"),eo=makePropSafe("oauth2"),no=makePropSafe("accessToken");return to=[{runtime:`${ue}.${eo}.${no}`,readable:"Current User.OAuthToken",key:"accessToken",display:{name:"OAuthToken",type:"text"}}].map(oo=>({type:"context",runtimeBinding:oo.runtime,readableBinding:oo.readable,fieldSchema:{type:"string",name:oo.key},providerId:"user",category:"Current User",display:oo.display})),to},getEnvironmentBindings=()=>get_store_value(environment).variables.map(ue=>({type:"context",runtimeBinding:`env.${makePropSafe(ue.name)}`,readableBinding:`env.${ue.name}`,category:"Environment",icon:"Key",display:{type:"string",name:ue.name}})),toBindingsArray=(to,ue,eo)=>to?Object.keys(to).reduce((no,ro)=>{if(!ro)return no;let oo={type:"context",runtimeBinding:ro,readableBinding:`${ue}.${ro}`,icon:"Brackets"};return eo&&(oo.category=eo),no.push(oo),no},[]):[],readableToRuntimeMap=(to,ue)=>!to||!ue?{}:Object.keys(ue).reduce((eo,no)=>(eo[no]=readableToRuntimeBinding(to,ue[no]),eo),{}),runtimeToReadableMap=(to,ue)=>!to||!ue?{}:Object.keys(ue).reduce((eo,no)=>(eo[no]=runtimeToReadableBinding(to,ue[no]),eo),{}),getComponentBindableProperties=(to,ue)=>{if(!to||!ue)return[];const eo=findComponent(to.props,ue),no=componentStore.getDefinition(eo==null?void 0:eo._component);if(!(no!=null&&no.context))return[];const ro=Array.isArray(no.context)?no.context:[no.context];return generateComponentContextBindings(to,{component:eo,definition:no,contexts:ro})},getAllComponentContexts=(to,ue,eo,no={includeSelf:!1})=>{if(!to||!ue)return[];let ro={};const oo=findComponentPath(to.props,ue),io=oo.map(co=>co._id),ao=buildContextTreeLookupMap(to.props),so=co=>uo=>{const fo=ao[uo._id];if(fo!=="root"&&!io.includes(fo))return;const po=uo._component;getComponentContexts(po).forEach(_o=>{eo&&_o.type!==eo||(_o.scope||ContextScopes.Global)!==co||isContextCompatibleWithComponent(_o,uo)&&(ro[uo._id]||(ro[uo._id]={component:uo,definition:componentStore.getDefinition(po),contexts:[]}),ro[uo._id].contexts.push(_o))})};return findAllComponents(to.props).forEach(so(ContextScopes.Global)),oo.forEach(so(ContextScopes.Local)),no!=null&&no.includeSelf||delete ro[ue],Object.values(ro).filter(co=>co.contexts.length>0)},getActionProviders=(to,ue,eo,no={includeSelf:!1})=>getAllComponentContexts(to,ue,"action",{includeSelf:no==null?void 0:no.includeSelf}).map(oo=>{var io,ao;return{...oo,action:(ao=(io=oo.contexts[0])==null?void 0:io.actions)==null?void 0:ao.find(so=>so.type===eo)}}).filter(({action:oo})=>oo!=null).map(({component:oo,action:io})=>{let ao=oo._id;return io.suffix&&(ao+=`-${io.suffix}`),{readableBinding:oo._instanceName,runtimeBinding:ao}}),getDatasourceForProvider=(to,ue)=>{const eo=componentStore.getComponentSettings(ue==null?void 0:ue._component),no=eo.find(ao=>ao.type==="dataProvider");if(no){const ao=ue[no.key],so=extractLiteralHandlebarsID(ao),lo=findComponent(to==null?void 0:to.props,so);return getDatasourceForProvider(to,lo)}const ro=["dataSource","table","schema"],oo=eo.find(ao=>ro.includes(ao.type));if(!oo)return null;const io=ue[oo==null?void 0:oo.key];return typeof io=="string"?{tableId:io,type:"table"}:io},getContextBindings=(to,ue)=>getAllComponentContexts(to,ue).map(no=>generateComponentContextBindings(to,no)).flat(),generateComponentContextBindings=(to,ue)=>{const{component:eo,definition:no,contexts:ro}=ue;if(!eo||!no||!(ro!=null&&ro.length))return[];let oo=[];return ro.forEach(io=>{var ho;if(!(io!=null&&io.type))return;let ao,so,lo,co=io.suffix;if(io.type==="form")ao=buildFormSchema(eo,to),lo="Fields";else if(io.type==="static")ao={},(io.values||[]).forEach(go=>{ao[go.key]={name:go.label,type:go.type||"string"}});else if(io.type==="schema"){const _o=getDatasourceForProvider(to,eo);if(!_o)return;const go=getSchemaForDatasource(to,_o);if(ao=go.schema,so=go.table,_o.type==="jsonarray"||_o.type==="queryarray"){const bo=_o.label.split(".");lo=bo[bo.length-1]}else if(_o.type==="viewV2"){const bo=Object.values((so==null?void 0:so.views)||{}).find(vo=>vo.id===_o.id);lo=bo==null?void 0:bo.name}else lo=(ho=go.table)==null?void 0:ho.name}if(!ao)return;const uo=Object.keys(ao).sort();let fo=eo._id;co&&(fo+=`-${co}`);const po=makePropSafe(fo);uo.forEach(_o=>{var ko;const go=ao[_o],bo=_o.split(".").map(makePropSafe).join("."),vo=`${po}.${bo}`;let yo=eo._instanceName;lo&&(yo+=`.${lo}`),yo+=`.${go.name||_o}`;const $o=getComponentBindingCategory(eo,io,no);oo.push({type:"context",runtimeBinding:vo,readableBinding:`${yo}`,fieldSchema:go,providerId:fo,tableId:so==null?void 0:so._id,component:eo._component,category:$o.category,icon:$o.icon,display:{name:`${go.name||_o}`,type:((ko=go.display)==null?void 0:ko.type)||go.type}})})}),oo},isContextCompatibleWithComponent=(to,ue)=>{if(!ue)return!1;const{_component:eo,actionType:no}=ue,{type:ro}=to;return!(eo.endsWith("formblock")&&(no==="Create"&&ro==="schema"||no==="View"&&ro==="form"))},getComponentBindingCategory=(to,ue,eo)=>{let no=eo.icon,ro=to._instanceName;return to._component.endsWith("formblock")&&(ue.type==="form"?(ro=`${to._instanceName} - Fields`,no="Form"):ue.type==="schema"&&(ro=`${to._instanceName} - Row`,no="Data")),{icon:no,category:ro}},getUserBindings=()=>{let to=[];const{schema:ue}=getSchemaForDatasourcePlus(TableNames.USERS);ue.globalId={type:FieldType.STRING};const eo=Object.keys(ue).sort(),no=makePropSafe("user");return to=eo.reduce((ro,oo)=>{const io=ue[oo];return ro.push({type:"context",runtimeBinding:`${no}.${makePropSafe(oo)}`,readableBinding:`Current User.${oo}`,fieldSchema:io,providerId:"user",category:"Current User",icon:"User",display:{name:oo}}),ro},[]),to},getDeviceBindings=()=>{var ue;let to=[];if((ue=get_store_value(appStore).clientFeatures)!=null&&ue.deviceAwareness){const eo=makePropSafe("device");to=[{type:"context",runtimeBinding:`${eo}.${makePropSafe("mobile")}`,readableBinding:"Device.Mobile",category:"Device",icon:"DevicePhone",display:{type:"boolean",name:"mobile"}},{type:"context",runtimeBinding:`${eo}.${makePropSafe("tablet")}`,readableBinding:"Device.Tablet",category:"Device",icon:"DevicePhone",display:{type:"boolean",name:"tablet"}},{type:"context",runtimeBinding:`${eo}.${makePropSafe("theme")}`,readableBinding:"App.Theme",category:"Device",icon:"DevicePhone",display:{type:"string",name:"App Theme"}}]}return to},getSettingBindings=()=>{let to=[];const ue=makePropSafe("settings");return to=[{type:"context",runtimeBinding:`${ue}.${makePropSafe("url")}`,readableBinding:"Settings.url",category:"Settings",icon:"Settings",display:{type:"string",name:"url"}},{type:"context",runtimeBinding:`${ue}.${makePropSafe("logo")}`,readableBinding:"Settings.logo",category:"Settings",icon:"Settings",display:{type:"string",name:"logo"}},{type:"context",runtimeBinding:`${ue}.${makePropSafe("company")}`,readableBinding:"Settings.company",category:"Settings",icon:"Settings",display:{type:"string",name:"company"}}],to},getSelectedRowsBindings=to=>{var eo;let ue=[];if((eo=get_store_value(appStore).clientFeatures)!=null&&eo.rowSelection){let no=findAllMatchingComponents(to==null?void 0:to.props,io=>io._component.endsWith("table"));const ro=makePropSafe("rowSelection");ue=ue.concat(no.map(io=>({type:"context",runtimeBinding:`${ro}.${makePropSafe(io._id)}.${makePropSafe("selectedRows")}`,readableBinding:`${io._instanceName}.Selected Row IDs (deprecated)`,category:"Selected Row IDs (deprecated)",icon:"ViewRow",display:{name:io._instanceName}})));let oo=findAllMatchingComponents(to==null?void 0:to.props,io=>io._component.endsWith("tableblock"));ue=ue.concat(oo.map(io=>({type:"context",runtimeBinding:`${ro}.${makePropSafe(io._id+"-table")}.${makePropSafe("selectedRows")}`,readableBinding:`${io._instanceName}.Selected Row IDs (deprecated)`,category:"Selected Row IDs (deprecated)",icon:"ViewRow",display:{name:io._instanceName}})))}return ue},makeStateBinding=to=>({type:"context",runtimeBinding:`${makePropSafe("state")}.${makePropSafe(to)}`,readableBinding:`State.${to}`,category:"State",icon:"AutomatedSegment",display:{name:to}}),getStateBindings=()=>{var ue;let to=[];return(ue=get_store_value(appStore).clientFeatures)!=null&&ue.state&&(to=getAllStateVariables().map(makeStateBinding)),to},getUrlBindings=to=>{var ao;const eo=(((ao=to==null?void 0:to.routing)==null?void 0:ao.route)??"").split("/");let no=[];eo.forEach(so=>{so.startsWith(":")&&so.length>1&&no.push(so.replace(/:/g,"").replace(/\?/g,""))});const ro=makePropSafe("url"),oo=no.map(so=>({type:"context",runtimeBinding:`${ro}.${makePropSafe(so)}`,readableBinding:`URL.${so}`,category:"URL",icon:"RailTop",display:{type:"string",name:so}})),io={type:"context",runtimeBinding:makePropSafe("query"),readableBinding:"Query params",category:"URL",icon:"RailTop",display:{type:"object",name:"Query params"}};return oo.concat([io])},getRoleBindings=()=>(get_store_value(roles)||[]).map(to=>({type:"context",runtimeBinding:`'${to._id}'`,readableBinding:`Role.${to.uiMetadata.displayName}`,category:"Role",icon:"UserGroup",display:{type:"string",name:to.uiMetadata.displayName}})),getEventContextBindings=({settingKey:to,componentInstance:ue,componentId:eo,componentDefinition:no,asset:ro})=>{var co;let oo=[];ro=ro??get_store_value(selectedScreen);const io=ue??findComponent(ro.props,eo);if(!io)return oo;const ao=no??componentStore.getDefinition(io==null?void 0:io._component),lo=componentStore.getComponentSettings(io==null?void 0:io._component).find(uo=>uo.key===to);return(co=lo==null?void 0:lo.context)!=null&&co.length&&lo.context.forEach(uo=>{oo.push({readableBinding:uo.label,runtimeBinding:`${makePropSafe("eventContext")}.${makePropSafe(uo.key)}`,category:io._instanceName,icon:ao.icon,display:{name:uo.label}})}),oo},getActionBindings=(to,ue)=>{let eo=[];const no=to==null?void 0:to.findIndex(oo=>oo.id===ue);return no==null||no===-1||to.slice(0,no).forEach((oo,io)=>{const ao=ActionDefinitions.actions.find(so=>so.name===oo["##eventHandlerType"]);ao.context&&ao.context.forEach(so=>{eo.push({readableBinding:`Action ${io+1}.${so.label}`,runtimeBinding:`actions.${io}.${so.value}`,category:"Actions",icon:"JourneyAction",display:{name:so.label}})})}),eo},getEmbedBindings=()=>{let to=[];return to=[{type:"context",runtimeBinding:`${makePropSafe("embed")}`,readableBinding:"ParentWindow",category:"Embed",icon:"DistributeVertically"}],to},getSchemaForDatasourcePlus=(to,ue)=>{const no=(to==null?void 0:to.startsWith("view_"))?{type:"viewV2",id:to,tableId:to.split("_").slice(1,3).join("_")}:{type:"table",tableId:to};return getSchemaForDatasource(null,no,ue)},getSchemaForDatasource=(to,ue,eo)=>{var oo,io;eo=eo||{};let no,ro;if(ue){const{type:ao}=ue,so=get_store_value(tables).list;if(ao==="provider"){const ho=findComponent(to==null?void 0:to.props,ue.providerId),_o=getDatasourceForProvider(to,ho);return getSchemaForDatasource(to,_o,eo)}else if(ao==="query")ro=get_store_value(queries).list.find(_o=>_o._id===ue._id);else if(ao==="field"){ro={name:ue.fieldName};const{fieldType:ho}=ue;ho==="attachment"?no={url:{type:"string"},name:{type:"string"}}:ho==="array"&&(no={value:{type:"string"}})}else if(ao==="jsonarray"){ro=so.find(_o=>_o._id===ue.tableId);let ho=ro==null?void 0:ro.schema;no=getJSONArrayDatasourceSchema(ho,ue)}else if(ao==="queryarray"){ro=get_store_value(queries).list.find(bo=>bo._id===ue.tableId);let _o=ro==null?void 0:ro.schema,go=ro==null?void 0:ro.nestedSchemaFields;no=generateQueryArraySchemas(_o,go),no=getJSONArrayDatasourceSchema(no,ue)}else ro=so.find(ho=>ho._id===ue.tableId);if(ro&&!no)if(ao==="view")no=fp$1.cloneDeep((io=(oo=ro.views)==null?void 0:oo[ue.name])==null?void 0:io.schema);else if(ao==="viewV2"){const ho=Object.values(ro.views||{}).find(_o=>_o.id===ue.id);no=fp$1.cloneDeep(ho==null?void 0:ho.schema),Object.keys(no||{}).forEach(_o=>{no[_o].visible||delete no[_o]})}else ao==="query"&&(eo.formSchema||eo.searchableSchema)?(no={},(ro.parameters||[]).forEach(_o=>{_o!=null&&_o.name&&(no[_o.name]={..._o,type:"string"})})):no=fp$1.cloneDeep(ro.schema);if(no){let ho={};Object.keys(no).forEach(_o=>{const go=no[_o];if((go==null?void 0:go.type)==="json"){const bo=convertJSONSchemaToTableSchema(go,{squashObjects:!0});Object.keys(bo).forEach(vo=>{ho[`${_o}.${vo}`]={type:bo[vo].type,nestedJSON:!0}})}}),no={...no,...ho}}const lo=ro&&(ro==null?void 0:ro.sourceType)===DB_TYPE_INTERNAL,co=["table","link","viewV2"].includes(ue.type);let uo=co,fo=co&&lo;eo.formSchema?(uo=!1,fo=!1):eo.searchableSchema&&(uo=co&&lo),no&&(uo&&(no._id={type:"string"}),fo&&(no._rev={type:"string"}));let po={};Object.entries(no||{}).forEach(([ho,_o])=>{const go=Object.values(FIELDS).find(bo=>bo.type===_o.type&&bo.subtype===_o.subtype);typeof _o=="string"?po[ho]={type:_o,name:ho,display:{type:_o}}:po[ho]={..._o,name:ho,display:{type:(go==null?void 0:go.name)||_o.type}}}),no=po}return{schema:no,table:ro}},buildFormSchema=(to,ue)=>{var oo;let eo={};if(!to)return eo;if(to._component.endsWith("formblock")){let io={};const ao=getDatasourceForProvider(ue,to),so=getSchemaForDatasource(to,ao);if(!(so!=null&&so.schema))return io;if(!to.fields)Object.values(so.schema).filter(({autocolumn:lo,name:co})=>!lo&&!["_rev","_id"].includes(co)).forEach(({name:lo})=>{io[lo]={type:so==null?void 0:so.schema[lo].type}});else{const lo=convertOldFieldFormat(to.fields||[]);lo==null||lo.forEach(({field:co,active:uo})=>{uo&&so!=null&&so.schema[co]&&(io[co]={type:so==null?void 0:so.schema[co].type})})}return io}const ro=componentStore.getComponentSettings(to._component).find(io=>io.key==="field"&&io.type.startsWith("field/"));if(ro){const io=ro.type.split("field/")[1],ao=to.field||to._instanceName;io&&ao&&(eo[ao]={type:io})}return(oo=to._children)==null||oo.forEach(io=>{const ao=buildFormSchema(io,ue);eo={...eo,...ao}}),eo},getAllStateVariables=to=>{let ue=[];to?ue.push(to):ue=getAllAssets();let eo=[];ue.forEach(ro=>{findAllMatchingComponents(ro.props,oo=>{const io=componentStore.getComponentSettings(oo._component),ao=["buttonConfiguration","fieldConfiguration","stepConfiguration"],so=(lo,co)=>{lo!=null&&lo.length&&(lo.filter(uo=>uo.type==="event").forEach(uo=>{eo.push(co[uo.key])}),lo.filter(uo=>ao.includes(uo.type)).forEach(uo=>{const fo=co[uo.key];Array.isArray(fo)&&fo.length&&fo.forEach(po=>{let ho=po==null?void 0:po._component;uo.type==="stepConfiguration"&&!ho&&(ho="@budibase/standard-components/multistepformblockstep");const _o=componentStore.getComponentSettings(ho);so(_o,po)})}))};so(io,oo)})}),to?to.onLoad&&eo.push(to.onLoad):get_store_value(screenStore).screens.forEach(ro=>{ro.onLoad&&eo.push(ro.onLoad)});let no=new Set;return eo.forEach(ro=>{Array.isArray(ro)&&ro.forEach(oo=>{var io,ao,so;oo["##eventHandlerType"]==="Update State"&&((io=oo.parameters)==null?void 0:io.type)==="set"&&((ao=oo.parameters)!=null&&ao.key)&&((so=oo.parameters)!=null&&so.value)&&no.add(oo.parameters.key)})}),Array.from(no)},getAllAssets=()=>{let to=[];return to=to.concat(get_store_value(layoutStore).layouts||[]),to=to.concat(get_store_value(screenStore).screens||[]),to},shouldReplaceBinding=(to,ue,eo,no)=>{if(!(to!=null&&to.includes(ue)))return!1;const ro=no.runtimeBinding.includes(no.readableBinding),oo=eo==="readableBinding",ao=Object.keys(getJsHelperList()).filter(uo=>uo.includes(ue)&&to.includes(uo));if(ao.length>0){const uo=to.indexOf(ue),fo=uo+ue.length;for(let po of ao){const ho=to.indexOf(po),_o=ho+po.length;if(uo>=ho&&fo<=_o)return!1}}if(oo&&!ro)return to.indexOf(no.readableBinding)===-1;if(oo)return!0;const so=to.replace(/\s+/g,""),lo=ue.replace(/\s+/g,"");return![`[${lo}]`,`"${lo}"`,`'${lo}'`].find(uo=>so==null?void 0:so.includes(uo))},replaceBetween=(to,ue,eo,no)=>to.substring(0,ue)+no+to.substring(eo),bindingReplacement=(to,ue,eo)=>{const no=isJSBinding(ue);no&&(ue=decodeJSBinding(ue));const ro=no?CAPTURE_VAR_INSIDE_JS:CAPTURE_VAR_INSIDE_TEMPLATE,oo=eo==="runtimeBinding"?"readableBinding":"runtimeBinding";if(typeof ue!="string")return ue;const io=to.map(lo=>lo[oo]).sort((lo,co)=>co.length-lo.length),ao=ue.match(ro)||[];let so=ue;for(let lo of ao){let co=lo,uo=co;for(let fo of io){const po=to.find(ho=>ho[oo]===fo);if(no||shouldReplaceBinding(co,fo,eo,po)){let ho;do if(ho=uo.indexOf(fo),ho!==-1){let _o=ho+fo.length,go=Array(po[eo].length+1).join("*");uo=replaceBetween(uo,ho,_o,go),co=replaceBetween(co,ho,_o,po[eo])}while(ho!==-1)}}so=so.replace(lo,co)}return no&&(so=encodeJSBinding(so)),so},extractLiteralHandlebarsID=to=>{var ue;return!to||typeof to!="string"?null:(ue=to.match(/{{\s*literal\s*\[+([^\]]+)].*}}/))==null?void 0:ue[1]},readableToRuntimeBinding=(to,ue)=>bindingReplacement(to,ue,"runtimeBinding"),runtimeToReadableBinding=(to,ue)=>bindingReplacement(to,ue,"readableBinding"),updateReferencesInObject=({obj:to,modifiedIndex:ue,action:eo,label:no,originalIndex:ro})=>{const oo=new RegExp(`{{\\s*${no}\\.(\\d+)\\.`,"g"),io=(ao,so,lo)=>ao.replace(`{{ ${no}.${so}.`,`{{ ${no}.${lo}.`);for(const ao in to)if(typeof to[ao]=="string"){let so;for(;(so=oo.exec(to[ao]))!==null;){const lo=parseInt(so[1]);eo===UpdateReferenceAction.ADD&&lo>=ue?to[ao]=io(to[ao],lo,lo+1):eo===UpdateReferenceAction.DELETE&&lo>ue?to[ao]=io(to[ao],lo,lo-1):eo===UpdateReferenceAction.MOVE&&(lo===ro?to[ao]=io(to[ao],lo,ue):ue<=lo&&ue<ro?to[ao]=io(to[ao],lo,lo+1):ue>=lo&&ue>ro&&(to[ao]=io(to[ao],lo,lo-1)))}}else typeof to[ao]=="object"&&to[ao]!==null&&updateReferencesInObject({obj:to[ao],modifiedIndex:ue,action:eo,label:no,originalIndex:ro})},migrateReferencesInObject=({obj:to,label:ue="steps",steps:eo,originalIndex:no})=>{var io;const ro=new RegExp(`{{\\s*${ue}\\.(\\d+)\\.`,"g"),oo=(ao,so,lo)=>ao.replace(`{{ ${ue}.${so}.`,`{{ ${ue}.${lo}.`);for(const ao in to)if(typeof to[ao]=="string"){let so;for(;(so=ro.exec(to[ao]))!==null;){const lo=parseInt(so[1]);to[ao]=oo(to[ao],lo,(io=eo[lo])==null?void 0:io.id)}}else typeof to[ao]=="object"&&to[ao]!==null&&migrateReferencesInObject({obj:to[ao],steps:eo,originalIndex:no})},getComponentFieldOptions=(to,ue,eo,no=!0)=>{const ro=findClosestMatchingComponent(to,ue,so=>so._component==="@budibase/standard-components/form"),oo=getDatasourceForProvider(to,ro),io=getSchemaForDatasource(to,oo,{formSchema:!0}).schema;let ao=[eo];return no&&(eo==="field/options"||eo==="field/longform")&&(ao=[eo,"field/string"]),ao=ao.map(so=>so.slice(so.indexOf("/")+1)),Object.entries(io||{}).filter(so=>ao.includes(so[1].type)).map(so=>so[0])};/*!
|
|
499
|
+
`)).length,ro=0;ro<no;ro++){var io=to.charCodeAt(ro),ao=null;io<128?eo++:ao=io>127&&io<2048?String.fromCharCode(io>>6|192,63&io|128):String.fromCharCode(io>>12|224,io>>6&63|128,63&io|128),I(ao)||(eo>ue&&(oo+=to.substring(ue,eo)),oo+=ao,ue=eo=ro+1)}return eo>ue&&(oo+=to.substring(ue,to.length)),oo},oe=function(){function to(ue){return ue&&(ue.preventDefault=to.preventDefault,ue.stopPropagation=to.stopPropagation),ue}return to.preventDefault=function(){this.returnValue=!1},to.stopPropagation=function(){this.cancelBubble=!0},function(ue,eo,no,ro,oo){if(ue)if(ue.addEventListener&&!ro)ue.addEventListener(eo,no,!!oo);else{var io="on"+eo,ao=ue[io];ue[io]=function(so,lo,co){return function(uo){if(uo=uo||to(T==null?void 0:T.event)){var fo,po=!0;y(co)&&(fo=co(uo));var ho=lo.call(so,uo);return fo!==!1&&ho!==!1||(po=!1),po}}}(ue,no,ao)}else G.error("No valid element provided to register_event")}}();function ae(to,ue){for(var eo=0;eo<to.length;eo++)if(ue(to[eo]))return to[eo]}(function(to){to.GZipJS="gzip-js",to.Base64="base64"})(re||(re={}));var le="$people_distinct_id",ce="__alias",de="__timers",he="$autocapture_disabled_server_side",fe="$heatmaps_enabled_server_side",ve="$exception_capture_enabled_server_side",pe="$exception_capture_endpoint_suffix",ge="$web_vitals_enabled_server_side",_e="$session_recording_enabled_server_side",me="$console_log_recording_enabled_server_side",ye="$session_recording_network_payload_capture",be="$session_recording_canvas_recording",ke="$replay_sample_rate",we="$replay_minimum_duration",Se="$sesid",Ee="$session_is_sampled",Ie="$enabled_feature_flags",Re="$early_access_features",Fe="$stored_person_properties",xe="$stored_group_properties",Pe="$surveys",Te="$surveys_activated",Ce="$flag_call_reported",$e="$user_state",Oe="$client_session_props",Me="$capture_rate_limit",Ae="$initial_campaign_params",Le="$initial_referrer_info",De="$initial_person_info",qe="$epp",Ne="__POSTHOG_TOOLBAR__",Be=[le,ce,"__cmpns",de,_e,fe,Se,Ie,$e,Re,xe,Fe,Pe,Ce,Oe,Me,Ae,Le,qe],He="$active_feature_flags",Ue="$override_feature_flags",je="$feature_flag_payloads",Ge=function(to){var ue,eo={},no=h(X(to||{}));try{for(no.s();!(ue=no.n()).done;){var ro=u(ue.value,2),oo=ro[0],io=ro[1];io&&(eo[oo]=io)}}catch(ao){no.e(ao)}finally{no.f()}return eo},We=function(){function to(ue){i$1(this,to),this.instance=ue,this._override_warning=!1,this.featureFlagEventHandlers=[],this.reloadFeatureFlagsQueued=!1,this.reloadFeatureFlagsInAction=!1}return s(to,[{key:"getFlags",value:function(){return Object.keys(this.getFlagVariants())}},{key:"getFlagVariants",value:function(){var ue=this.instance.get_property(Ie),eo=this.instance.get_property(Ue);if(!eo)return ue||{};for(var no=J({},ue),ro=Object.keys(eo),oo=0;oo<ro.length;oo++)no[ro[oo]]=eo[ro[oo]];return this._override_warning||(G.warn(" Overriding feature flags!",{enabledFlags:ue,overriddenFlags:eo,finalFlags:no}),this._override_warning=!0),no}},{key:"getFlagPayloads",value:function(){return this.instance.get_property(je)||{}}},{key:"reloadFeatureFlags",value:function(){this.reloadFeatureFlagsQueued||(this.reloadFeatureFlagsQueued=!0,this._startReloadTimer())}},{key:"setAnonymousDistinctId",value:function(ue){this.$anon_distinct_id=ue}},{key:"setReloadingPaused",value:function(ue){this.reloadFeatureFlagsInAction=ue}},{key:"resetRequestQueue",value:function(){this.reloadFeatureFlagsQueued=!1}},{key:"_startReloadTimer",value:function(){var ue=this;this.reloadFeatureFlagsQueued&&!this.reloadFeatureFlagsInAction&&setTimeout(function(){!ue.reloadFeatureFlagsInAction&&ue.reloadFeatureFlagsQueued&&(ue.reloadFeatureFlagsQueued=!1,ue._reloadFeatureFlagsRequest())},5)}},{key:"_reloadFeatureFlagsRequest",value:function(){var ue=this;if(!this.instance.config.advanced_disable_feature_flags){this.setReloadingPaused(!0);var eo=this.instance.config.token,no=this.instance.get_property(Fe),ro=this.instance.get_property(xe),oo={token:eo,distinct_id:this.instance.get_distinct_id(),groups:this.instance.getGroups(),$anon_distinct_id:this.$anon_distinct_id,person_properties:no,group_properties:ro,disable_flags:this.instance.config.advanced_disable_feature_flags||void 0};this.instance._send_request({method:"POST",url:this.instance.requestRouter.endpointFor("api","/decide/?v=3"),data:oo,compression:this.instance.config.disable_compression?void 0:re.Base64,timeout:this.instance.config.feature_flag_request_timeout_ms,callback:function(io){var ao;ue.setReloadingPaused(!1);var so=!0;io.statusCode===200&&(ue.$anon_distinct_id=void 0,so=!1),ue.receivedFeatureFlags((ao=io.json)!==null&&ao!==void 0?ao:{},so),ue._startReloadTimer()}})}}},{key:"getFeatureFlag",value:function(ue){var eo=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(this.instance.decideEndpointWasHit||this.getFlags()&&this.getFlags().length>0){var no,ro=this.getFlagVariants()[ue],oo="".concat(ro),io=this.instance.get_property(Ce)||{};return(eo.send_event||!("send_event"in eo))&&(!(ue in io)||!io[ue].includes(oo))&&(m(io[ue])?io[ue].push(oo):io[ue]=[oo],(no=this.instance.persistence)===null||no===void 0||no.register(o({},Ce,io)),this.instance.capture("$feature_flag_called",{$feature_flag:ue,$feature_flag_response:ro})),ro}G.warn('getFeatureFlag for key "'+ue+`" failed. Feature flags didn't load in time.`)}},{key:"getFeatureFlagPayload",value:function(ue){return this.getFlagPayloads()[ue]}},{key:"isFeatureEnabled",value:function(ue){var eo=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(this.instance.decideEndpointWasHit||this.getFlags()&&this.getFlags().length>0)return!!this.getFeatureFlag(ue,eo);G.warn('isFeatureEnabled for key "'+ue+`" failed. Feature flags didn't load in time.`)}},{key:"addFeatureFlagsHandler",value:function(ue){this.featureFlagEventHandlers.push(ue)}},{key:"removeFeatureFlagsHandler",value:function(ue){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter(function(eo){return eo!==ue})}},{key:"receivedFeatureFlags",value:function(ue,eo){if(this.instance.persistence){this.instance.decideEndpointWasHit=!0;var no=this.getFlagVariants(),ro=this.getFlagPayloads();(function(oo,io){var ao,so=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},lo=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},co=oo.featureFlags,uo=oo.featureFlagPayloads;if(co)if(m(co)){var fo,po={};if(co)for(var ho=0;ho<co.length;ho++)po[co[ho]]=!0;io&&io.register((o(fo={},He,co),o(fo,Ie,po),fo))}else{var _o=co,go=uo;oo.errorsWhileComputingFlags&&(_o=t$1(t$1({},so),_o),go=t$1(t$1({},lo),go)),io&&io.register((o(ao={},He,Object.keys(Ge(_o))),o(ao,Ie,_o||{}),o(ao,je,go||{}),ao))}})(ue,this.instance.persistence,no,ro),this._fireFeatureFlagsCallbacks(eo)}}},{key:"override",value:function(ue){var eo=arguments.length>1&&arguments[1]!==void 0&&arguments[1];if(!this.instance.__loaded||!this.instance.persistence)return G.uninitializedWarning("posthog.feature_flags.override");if(this._override_warning=eo,ue===!1)this.instance.persistence.unregister(Ue);else if(m(ue)){for(var no={},ro=0;ro<ue.length;ro++)no[ue[ro]]=!0;this.instance.persistence.register(o({},Ue,no))}else this.instance.persistence.register(o({},Ue,ue))}},{key:"onFeatureFlags",value:function(ue){var eo=this;if(this.addFeatureFlagsHandler(ue),this.instance.decideEndpointWasHit){var no=this._prepareFeatureFlagsForCallbacks(),ro=no.flags,oo=no.flagVariants;ue(ro,oo)}return function(){return eo.removeFeatureFlagsHandler(ue)}}},{key:"updateEarlyAccessFeatureEnrollment",value:function(ue,eo){var no,ro,oo=o({},"$feature_enrollment/".concat(ue),eo);this.instance.capture("$feature_enrollment_update",{$feature_flag:ue,$feature_enrollment:eo,$set:oo}),this.setPersonPropertiesForFlags(oo,!1);var io=t$1(t$1({},this.getFlagVariants()),{},o({},ue,eo));(no=this.instance.persistence)===null||no===void 0||no.register((o(ro={},He,Object.keys(Ge(io))),o(ro,Ie,io),ro)),this._fireFeatureFlagsCallbacks()}},{key:"getEarlyAccessFeatures",value:function(ue){var eo=this,no=arguments.length>1&&arguments[1]!==void 0&&arguments[1],ro=this.instance.get_property(Re);if(ro&&!no)return ue(ro);this.instance._send_request({transport:"XHR",url:this.instance.requestRouter.endpointFor("api","/api/early_access_features/?token=".concat(this.instance.config.token)),method:"GET",callback:function(oo){var io;if(oo.json){var ao=oo.json.earlyAccessFeatures;return(io=eo.instance.persistence)===null||io===void 0||io.register(o({},Re,ao)),ue(ao)}}})}},{key:"_prepareFeatureFlagsForCallbacks",value:function(){var ue=this.getFlags(),eo=this.getFlagVariants();return{flags:ue.filter(function(no){return eo[no]}),flagVariants:Object.keys(eo).filter(function(no){return eo[no]}).reduce(function(no,ro){return no[ro]=eo[ro],no},{})}}},{key:"_fireFeatureFlagsCallbacks",value:function(ue){var eo=this._prepareFeatureFlagsForCallbacks(),no=eo.flags,ro=eo.flagVariants;this.featureFlagEventHandlers.forEach(function(oo){return oo(no,ro,{errorsLoading:ue})})}},{key:"setPersonPropertiesForFlags",value:function(ue){var eo=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1],no=this.instance.get_property(Fe)||{};this.instance.register(o({},Fe,t$1(t$1({},no),ue))),eo&&this.instance.reloadFeatureFlags()}},{key:"resetPersonPropertiesForFlags",value:function(){this.instance.unregister(Fe)}},{key:"setGroupPropertiesForFlags",value:function(ue){var eo=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1],no=this.instance.get_property(xe)||{};Object.keys(no).length!==0&&Object.keys(no).forEach(function(ro){no[ro]=t$1(t$1({},no[ro]),ue[ro]),delete ue[ro]}),this.instance.register(o({},xe,t$1(t$1({},no),ue))),eo&&this.instance.reloadFeatureFlags()}},{key:"resetGroupPropertiesForFlags",value:function(ue){if(ue){var eo=this.instance.get_property(xe)||{};this.instance.register(o({},xe,t$1(t$1({},eo),{},o({},ue,{}))))}else this.instance.unregister(xe)}}]),to}();Math.trunc||(Math.trunc=function(to){return to<0?Math.ceil(to):Math.floor(to)}),Number.isInteger||(Number.isInteger=function(to){return F(to)&&isFinite(to)&&Math.floor(to)===to});var Ve="0123456789abcdef",ze=function(){function to(ue){if(i$1(this,to),this.bytes=ue,ue.length!==16)throw new TypeError("not 128-bit length")}return s(to,[{key:"toString",value:function(){for(var ue="",eo=0;eo<this.bytes.length;eo++)ue=ue+Ve.charAt(this.bytes[eo]>>>4)+Ve.charAt(15&this.bytes[eo]),eo!==3&&eo!==5&&eo!==7&&eo!==9||(ue+="-");if(ue.length!==36)throw new Error("Invalid UUIDv7 was generated");return ue}},{key:"clone",value:function(){return new to(this.bytes.slice(0))}},{key:"equals",value:function(ue){return this.compareTo(ue)===0}},{key:"compareTo",value:function(ue){for(var eo=0;eo<16;eo++){var no=this.bytes[eo]-ue.bytes[eo];if(no!==0)return Math.sign(no)}return 0}}],[{key:"fromFieldsV7",value:function(ue,eo,no,ro){if(!Number.isInteger(ue)||!Number.isInteger(eo)||!Number.isInteger(no)||!Number.isInteger(ro)||ue<0||eo<0||no<0||ro<0||ue>0xffffffffffff||eo>4095||no>1073741823||ro>4294967295)throw new RangeError("invalid field value");var oo=new Uint8Array(16);return oo[0]=ue/Math.pow(2,40),oo[1]=ue/Math.pow(2,32),oo[2]=ue/Math.pow(2,24),oo[3]=ue/Math.pow(2,16),oo[4]=ue/Math.pow(2,8),oo[5]=ue,oo[6]=112|eo>>>8,oo[7]=eo,oo[8]=128|no>>>24,oo[9]=no>>>16,oo[10]=no>>>8,oo[11]=no,oo[12]=ro>>>24,oo[13]=ro>>>16,oo[14]=ro>>>8,oo[15]=ro,new to(oo)}}]),to}(),Qe=function(){function to(){i$1(this,to),o(this,"timestamp",0),o(this,"counter",0),o(this,"random",new Xe)}return s(to,[{key:"generate",value:function(){var ue=this.generateOrAbort();if(w$1(ue)){this.timestamp=0;var eo=this.generateOrAbort();if(w$1(eo))throw new Error("Could not generate UUID after timestamp reset");return eo}return ue}},{key:"generateOrAbort",value:function(){var ue=Date.now();if(ue>this.timestamp)this.timestamp=ue,this.resetCounter();else{if(!(ue+1e4>this.timestamp))return;this.counter++,this.counter>4398046511103&&(this.timestamp++,this.resetCounter())}return ze.fromFieldsV7(this.timestamp,Math.trunc(this.counter/Math.pow(2,30)),this.counter&Math.pow(2,30)-1,this.random.nextUint32())}},{key:"resetCounter",value:function(){this.counter=1024*this.random.nextUint32()+(1023&this.random.nextUint32())}}]),to}(),Je=function(to){if(typeof UUIDV7_DENY_WEAK_RNG<"u"&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var ue=0;ue<to.length;ue++)to[ue]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return to};T&&!w$1(T.crypto)&&crypto.getRandomValues&&(Je=function(to){return crypto.getRandomValues(to)});var Ye,Xe=function(){function to(){i$1(this,to),o(this,"buffer",new Uint32Array(8)),o(this,"cursor",1/0)}return s(to,[{key:"nextUint32",value:function(){return this.cursor>=this.buffer.length&&(Je(this.buffer),this.cursor=0),this.buffer[this.cursor++]}}]),to}(),Ke=function(){return Ze().toString()},Ze=function(){return(Ye||(Ye=new Qe)).generate()},et="Thu, 01 Jan 1970 00:00:00 GMT",tt="",nt=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;function it(to,ue){if(ue){var eo=function(ro){var oo=arguments.length>1&&arguments[1]!==void 0?arguments[1]:L;if(tt)return tt;if(!oo||["localhost","127.0.0.1"].includes(ro))return"";for(var io=ro.split("."),ao=Math.min(io.length,8),so="dmn_chk_"+Ke(),lo=new RegExp("(^|;)\\s*"+so+"=1");!tt&&ao--;){var co=io.slice(ao).join("."),uo=so+"=1;domain=."+co;oo.cookie=uo,lo.test(oo.cookie)&&(oo.cookie=uo+";expires="+et,tt=co)}return tt}(to);if(!eo){var no=function(ro){var oo=ro.match(nt);return oo?oo[0]:""}(to);no!==eo&&G.info("Warning: cookie subdomain discovery mismatch",no,eo),eo=no}return eo?"; domain=."+eo:""}return""}var rt,st={is_supported:function(){return!!L},error:function(to){G.error("cookieStore error: "+to)},get:function(to){if(L){try{for(var ue=to+"=",eo=L.cookie.split(";").filter(function(oo){return oo.length}),no=0;no<eo.length;no++){for(var ro=eo[no];ro.charAt(0)==" ";)ro=ro.substring(1,ro.length);if(ro.indexOf(ue)===0)return decodeURIComponent(ro.substring(ue.length,ro.length))}}catch{}return null}},parse:function(to){var ue;try{ue=JSON.parse(st.get(to))||{}}catch{}return ue},set:function(to,ue,eo,no,ro){if(L)try{var oo="",io="",ao=it(L.location.hostname,no);if(eo){var so=new Date;so.setTime(so.getTime()+24*eo*60*60*1e3),oo="; expires="+so.toUTCString()}ro&&(io="; secure");var lo=to+"="+encodeURIComponent(JSON.stringify(ue))+oo+"; SameSite=Lax; path=/"+ao+io;return lo.length>3686.4&&G.warn("cookieStore warning: large cookie, len="+lo.length),L.cookie=lo,lo}catch{return}},remove:function(to,ue){try{st.set(to,"",-1,ue)}catch{return}}},ot=null,at={is_supported:function(){if(!I(ot))return ot;var to=!0;if(w$1(T))to=!1;else try{var ue="__mplssupport__";at.set(ue,"xyz"),at.get(ue)!=='"xyz"'&&(to=!1),at.remove(ue)}catch{to=!1}return to||G.error("localStorage unsupported; falling back to cookie store"),ot=to,to},error:function(to){G.error("localStorage error: "+to)},get:function(to){try{return T==null?void 0:T.localStorage.getItem(to)}catch(ue){at.error(ue)}return null},parse:function(to){try{return JSON.parse(at.get(to))||{}}catch{}return null},set:function(to,ue){try{T==null||T.localStorage.setItem(to,JSON.stringify(ue))}catch(eo){at.error(eo)}},remove:function(to){try{T==null||T.localStorage.removeItem(to)}catch(ue){at.error(ue)}}},ut=["distinct_id",Se,Ee,qe],lt=t$1(t$1({},at),{},{parse:function(to){try{var ue={};try{ue=st.parse(to)||{}}catch{}var eo=J(ue,JSON.parse(at.get(to)||"{}"));return at.set(to,eo),eo}catch{}return null},set:function(to,ue,eo,no,ro,oo){try{at.set(to,ue,void 0,void 0,oo);var io={};ut.forEach(function(ao){ue[ao]&&(io[ao]=ue[ao])}),Object.keys(io).length&&st.set(to,io,eo,no,ro,oo)}catch(ao){at.error(ao)}},remove:function(to,ue){try{T==null||T.localStorage.removeItem(to),st.remove(to,ue)}catch(eo){at.error(eo)}}}),ct={},dt={is_supported:function(){return!0},error:function(to){G.error("memoryStorage error: "+to)},get:function(to){return ct[to]||null},parse:function(to){return ct[to]||null},set:function(to,ue){ct[to]=ue},remove:function(to){delete ct[to]}},ht=null,ft={is_supported:function(){if(!I(ht))return ht;if(ht=!0,w$1(T))ht=!1;else try{var to="__support__";ft.set(to,"xyz"),ft.get(to)!=='"xyz"'&&(ht=!1),ft.remove(to)}catch{ht=!1}return ht},error:function(to){G.error("sessionStorage error: ",to)},get:function(to){try{return T==null?void 0:T.sessionStorage.getItem(to)}catch(ue){ft.error(ue)}return null},parse:function(to){try{return JSON.parse(ft.get(to))||null}catch{}return null},set:function(to,ue){try{T==null||T.sessionStorage.setItem(to,JSON.stringify(ue))}catch(eo){ft.error(eo)}},remove:function(to){try{T==null||T.sessionStorage.removeItem(to)}catch(ue){ft.error(ue)}}},vt=["localhost","127.0.0.1"],pt=function(to){var ue=L==null?void 0:L.createElement("a");return w$1(ue)?null:(ue.href=to,ue)},gt=function(to,ue){return!!function(eo){try{new RegExp(eo)}catch{return!1}return!0}(ue)&&new RegExp(ue).test(to)},_t=function(to){var ue,eo,no=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"&",ro=[];return Q(to,function(oo,io){w$1(oo)||w$1(io)||io==="undefined"||(ue=encodeURIComponent(function(ao){return ao instanceof File}(oo)?oo.name:oo.toString()),eo=encodeURIComponent(io),ro[ro.length]=eo+"="+ue)}),ro.join(no)},mt=function(to,ue){for(var eo,no=((to.split("#")[0]||"").split("?")[1]||"").split("&"),ro=0;ro<no.length;ro++){var oo=no[ro].split("=");if(oo[0]===ue){eo=oo;break}}if(!m(eo)||eo.length<2)return"";var io=eo[1];try{io=decodeURIComponent(io)}catch{G.error("Skipping decoding for malformed query param: "+io)}return io.replace(/\+/g," ")},yt=function(to,ue){var eo=to.match(new RegExp(ue+"=([^&]*)"));return eo?eo[1]:null},bt="Mobile",kt="iOS",wt="Android",St="Tablet",Et=wt+" "+St,It="iPad",Rt="Apple",Ft=Rt+" Watch",xt="Safari",Pt="BlackBerry",Tt="Samsung",Ct=Tt+"Browser",$t=Tt+" Internet",Ot="Chrome",Mt=Ot+" OS",At=Ot+" "+kt,Lt="Internet Explorer",Dt=Lt+" "+bt,qt="Opera",Nt=qt+" Mini",Bt="Edge",Ht="Microsoft "+Bt,Ut="Firefox",jt=Ut+" "+kt,Gt="Nintendo",Wt="PlayStation",Vt="Xbox",zt=wt+" "+bt,Qt=bt+" "+xt,Jt="Windows",Yt=Jt+" Phone",Xt="Nokia",Kt="Ouya",Zt="Generic",en=Zt+" "+bt.toLowerCase(),tn=Zt+" "+St.toLowerCase(),nn="Konqueror",rn="(\\d+(\\.\\d+)?)",sn=new RegExp("Version/"+rn),on=new RegExp(Vt,"i"),an=new RegExp(Wt+" \\w+","i"),un=new RegExp(Gt+" \\w+","i"),ln=new RegExp(Pt+"|PlayBook|BB10","i"),cn={"NT3.51":"NT 3.11","NT4.0":"NT 4.0","5.0":"2000",5.1:"XP",5.2:"XP","6.0":"Vista",6.1:"7",6.2:"8",6.3:"8.1",6.4:"10","10.0":"10"},dn=function(to,ue){return ue&&Y(ue,Rt)||function(eo){return Y(eo,xt)&&!Y(eo,Ot)&&!Y(eo,wt)}(to)},hn=function(to,ue){return ue=ue||"",Y(to," OPR/")&&Y(to,"Mini")?Nt:Y(to," OPR/")?qt:ln.test(to)?Pt:Y(to,"IE"+bt)||Y(to,"WPDesktop")?Dt:Y(to,Ct)?$t:Y(to,Bt)||Y(to,"Edg/")?Ht:Y(to,"FBIOS")?"Facebook "+bt:Y(to,"UCWEB")||Y(to,"UCBrowser")?"UC Browser":Y(to,"CriOS")?At:Y(to,"CrMo")?Ot:Y(to,wt)&&Y(to,xt)?zt:Y(to,Ot)?Ot:Y(to,"FxiOS")?jt:Y(to.toLowerCase(),nn.toLowerCase())?nn:dn(to,ue)?Y(to,bt)?Qt:xt:Y(to,Ut)?Ut:Y(to,"MSIE")||Y(to,"Trident/")?Lt:Y(to,"Gecko")?Ut:""},fn=(o(rt={},Dt,[new RegExp("rv:"+rn)]),o(rt,Ht,[new RegExp(Bt+"?\\/"+rn)]),o(rt,Ot,[new RegExp("("+Ot+"|CrMo)\\/"+rn)]),o(rt,At,[new RegExp("CriOS\\/"+rn)]),o(rt,"UC Browser",[new RegExp("(UCBrowser|UCWEB)\\/"+rn)]),o(rt,xt,[sn]),o(rt,Qt,[sn]),o(rt,qt,[new RegExp("(Opera|OPR)\\/"+rn)]),o(rt,Ut,[new RegExp(Ut+"\\/"+rn)]),o(rt,jt,[new RegExp("FxiOS\\/"+rn)]),o(rt,nn,[new RegExp("Konqueror[:/]?"+rn,"i")]),o(rt,Pt,[new RegExp(Pt+" "+rn),sn]),o(rt,zt,[new RegExp("android\\s"+rn,"i")]),o(rt,$t,[new RegExp(Ct+"\\/"+rn)]),o(rt,Lt,[new RegExp("(rv:|MSIE )"+rn)]),o(rt,"Mozilla",[new RegExp("rv:"+rn)]),rt),vn=[[new RegExp(Vt+"; "+Vt+" (.*?)[);]","i"),function(to){return[Vt,to&&to[1]||""]}],[new RegExp(Gt,"i"),[Gt,""]],[new RegExp(Wt,"i"),[Wt,""]],[ln,[Pt,""]],[new RegExp(Jt,"i"),function(to,ue){if(/Phone/.test(ue)||/WPDesktop/.test(ue))return[Yt,""];if(new RegExp(bt).test(ue)&&!/IEMobile\b/.test(ue))return[Jt+" "+bt,""];var eo=/Windows NT ([0-9.]+)/i.exec(ue);if(eo&&eo[1]){var no=eo[1],ro=cn[no]||"";return/arm/i.test(ue)&&(ro="RT"),[Jt,ro]}return[Jt,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,function(to){if(to&&to[3]){var ue=[to[3],to[4],to[5]||"0"];return[kt,ue.join(".")]}return[kt,""]}],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,function(to){var ue="";return to&&to.length>=3&&(ue=w$1(to[2])?to[3]:to[2]),["watchOS",ue]}],[new RegExp("("+wt+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+wt+")","i"),function(to){if(to&&to[2]){var ue=[to[2],to[3],to[4]||"0"];return[wt,ue.join(".")]}return[wt,""]}],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,function(to){var ue=["Mac OS X",""];if(to&&to[1]){var eo=[to[1],to[2],to[3]||"0"];ue[1]=eo.join(".")}return ue}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[Mt,""]],[/Linux|debian/i,["Linux",""]]],pn=function(to){return un.test(to)?Gt:an.test(to)?Wt:on.test(to)?Vt:new RegExp(Kt,"i").test(to)?Kt:new RegExp("("+Yt+"|WPDesktop)","i").test(to)?Yt:/iPad/.test(to)?It:/iPod/.test(to)?"iPod Touch":/iPhone/.test(to)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(to)?Ft:ln.test(to)?Pt:/(kobo)\s(ereader|touch)/i.test(to)?"Kobo":new RegExp(Xt,"i").test(to)?Xt:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(to)||/(kf[a-z]+)( bui|\)).+silk\//i.test(to)?"Kindle Fire":/(Android|ZTE)/i.test(to)?!new RegExp(bt).test(to)||/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(to)?/pixel[\daxl ]{1,6}/i.test(to)&&!/pixel c/i.test(to)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(to)||/lmy47v/i.test(to)&&!/QTAQZ3/i.test(to)?wt:Et:wt:new RegExp("(pda|"+bt+")","i").test(to)?en:new RegExp(St,"i").test(to)&&!new RegExp(St+" pc","i").test(to)?tn:""},gn="https?://(.*)",_n=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gclid","gad_source","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","mc_cid","igshid","ttclid","rdt_cid"],mn={campaignParams:function(to){return L?this._campaignParamsFromUrl(L.URL,to):{}},_campaignParamsFromUrl:function(to,ue){var eo=_n.concat(ue||[]),no={};return Q(eo,function(ro){var oo=mt(to,ro);oo&&(no[ro]=oo)}),no},_searchEngine:function(to){return to?to.search(gn+"google.([^/?]*)")===0?"google":to.search(gn+"bing.com")===0?"bing":to.search(gn+"yahoo.com")===0?"yahoo":to.search(gn+"duckduckgo.com")===0?"duckduckgo":null:null},_searchInfoFromReferrer:function(to){var ue=mn._searchEngine(to),eo=ue!="yahoo"?"q":"p",no={};if(!I(ue)){no.$search_engine=ue;var ro=L?mt(L.referrer,eo):"";ro.length&&(no.ph_keyword=ro)}return no},searchInfo:function(){var to=L==null?void 0:L.referrer;return to?this._searchInfoFromReferrer(to):{}},browser:hn,browserVersion:function(to,ue){var eo=hn(to,ue),no=fn[eo];if(w$1(no))return null;for(var ro=0;ro<no.length;ro++){var oo=no[ro],io=to.match(oo);if(io)return parseFloat(io[io.length-2])}return null},browserLanguage:function(){return navigator.language||navigator.userLanguage},os:function(to){for(var ue=0;ue<vn.length;ue++){var eo=u(vn[ue],2),no=eo[0],ro=eo[1],oo=no.exec(to),io=oo&&(y(ro)?ro(oo,to):ro);if(io)return io}return["",""]},device:pn,deviceType:function(to){var ue=pn(to);return ue===It||ue===Et||ue==="Kobo"||ue==="Kindle Fire"||ue===tn?St:ue===Gt||ue===Vt||ue===Wt||ue===Kt?"Console":ue===Ft?"Wearable":ue?bt:"Desktop"},referrer:function(){return(L==null?void 0:L.referrer)||"$direct"},referringDomain:function(){var to;return L!=null&&L.referrer&&((to=pt(L.referrer))===null||to===void 0?void 0:to.host)||"$direct"},referrerInfo:function(){return{$referrer:this.referrer(),$referring_domain:this.referringDomain()}},initialPersonInfo:function(){return{r:this.referrer(),u:D==null?void 0:D.href}},initialPersonPropsFromInfo:function(to){var ue,eo=to.r,no=to.u,ro={$initial_referrer:eo,$initial_referring_domain:eo==null?void 0:eo=="$direct"?"$direct":(ue=pt(eo))===null||ue===void 0?void 0:ue.host};if(no){ro.$initial_current_url=no;var oo=pt(no);ro.$initial_host=oo==null?void 0:oo.host,ro.$initial_pathname=oo==null?void 0:oo.pathname,Q(this._campaignParamsFromUrl(no),function(io,ao){ro["$initial_"+ne(ao)]=io})}return eo&&Q(this._searchInfoFromReferrer(eo),function(io,ao){ro["$initial_"+ne(ao)]=io}),ro},properties:function(){if(!H)return{};var to=u(mn.os(H),2),ue=to[0],eo=to[1];return J(te({$os:ue,$os_version:eo,$browser:mn.browser(H,navigator.vendor),$device:mn.device(H),$device_type:mn.deviceType(H)}),{$current_url:D==null?void 0:D.href,$host:D==null?void 0:D.host,$pathname:D==null?void 0:D.pathname,$raw_user_agent:H.length>1e3?H.substring(0,997)+"...":H,$browser_version:mn.browserVersion(H,navigator.vendor),$browser_language:mn.browserLanguage(),$screen_height:T==null?void 0:T.screen.height,$screen_width:T==null?void 0:T.screen.width,$viewport_height:T==null?void 0:T.innerHeight,$viewport_width:T==null?void 0:T.innerWidth,$lib:"web",$lib_version:f.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:K()/1e3})},people_properties:function(){if(!H)return{};var to=u(mn.os(H),2),ue=to[0],eo=to[1];return J(te({$os:ue,$os_version:eo,$browser:mn.browser(H,navigator.vendor)}),{$browser_version:mn.browserVersion(H,navigator.vendor)})}},yn=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],bn=function(){function to(ue){i$1(this,to),this.config=ue,this.props={},this.campaign_params_saved=!1,this.name=function(eo){var no="";return eo.token&&(no=eo.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),eo.persistence_name?"ph_"+eo.persistence_name:"ph_"+no+"_posthog"}(ue),this.storage=this.buildStorage(ue),this.load(),ue.debug&&G.info("Persistence loaded",ue.persistence,t$1({},this.props)),this.update_config(ue,ue),this.save()}return s(to,[{key:"buildStorage",value:function(ue){yn.indexOf(ue.persistence.toLowerCase())===-1&&(G.critical("Unknown persistence type "+ue.persistence+"; falling back to localStorage+cookie"),ue.persistence="localStorage+cookie");var eo=ue.persistence.toLowerCase();return eo==="localstorage"&&at.is_supported()?at:eo==="localstorage+cookie"&<.is_supported()?lt:eo==="sessionstorage"&&ft.is_supported()?ft:eo==="memory"?dt:eo==="cookie"?st:lt.is_supported()?lt:st}},{key:"properties",value:function(){var ue={};return Q(this.props,function(eo,no){if(no===Ie&&b(eo))for(var ro=Object.keys(eo),oo=0;oo<ro.length;oo++)ue["$feature/".concat(ro[oo])]=eo[ro[oo]];else ao=no,so=!1,(I(io=Be)?so:M&&io.indexOf===M?io.indexOf(ao)!=-1:(Q(io,function(lo){if(so||(so=lo===ao))return W}),so))||(ue[no]=eo);var io,ao,so}),ue}},{key:"load",value:function(){if(!this.disabled){var ue=this.storage.parse(this.name);ue&&(this.props=J({},ue))}}},{key:"save",value:function(){this.disabled||this.storage.set(this.name,this.props,this.expire_days,this.cross_subdomain,this.secure,this.config.debug)}},{key:"remove",value:function(){this.storage.remove(this.name,!1),this.storage.remove(this.name,!0)}},{key:"clear",value:function(){this.remove(),this.props={}}},{key:"register_once",value:function(ue,eo,no){var ro=this;if(b(ue)){w$1(eo)&&(eo="None"),this.expire_days=w$1(no)?this.default_expiry:no;var oo=!1;if(Q(ue,function(io,ao){ro.props.hasOwnProperty(ao)&&ro.props[ao]!==eo||(ro.props[ao]=io,oo=!0)}),oo)return this.save(),!0}return!1}},{key:"register",value:function(ue,eo){var no=this;if(b(ue)){this.expire_days=w$1(eo)?this.default_expiry:eo;var ro=!1;if(Q(ue,function(oo,io){ue.hasOwnProperty(io)&&no.props[io]!==oo&&(no.props[io]=oo,ro=!0)}),ro)return this.save(),!0}return!1}},{key:"unregister",value:function(ue){ue in this.props&&(delete this.props[ue],this.save())}},{key:"update_campaign_params",value:function(){this.campaign_params_saved||(this.register(mn.campaignParams(this.config.custom_campaign_params)),this.campaign_params_saved=!0)}},{key:"update_search_keyword",value:function(){this.register(mn.searchInfo())}},{key:"update_referrer_info",value:function(){this.register_once(mn.referrerInfo(),void 0)}},{key:"set_initial_person_info",value:function(){this.props[Ae]||this.props[Le]||this.register_once(o({},De,mn.initialPersonInfo()),void 0)}},{key:"get_referrer_info",value:function(){return te({$referrer:this.props.$referrer,$referring_domain:this.props.$referring_domain})}},{key:"get_initial_props",value:function(){var ue=this,eo={};Q([Le,Ae],function(oo){var io=ue.props[oo];io&&Q(io,function(ao,so){eo["$initial_"+ne(so)]=ao})});var no=this.props[De];if(no){var ro=mn.initialPersonPropsFromInfo(no);J(eo,ro)}return eo}},{key:"safe_merge",value:function(ue){return Q(this.props,function(eo,no){no in ue||(ue[no]=eo)}),ue}},{key:"update_config",value:function(ue,eo){if(this.default_expiry=this.expire_days=ue.cookie_expiration,this.set_disabled(ue.disable_persistence),this.set_cross_subdomain(ue.cross_subdomain_cookie),this.set_secure(ue.secure_cookie),ue.persistence!==eo.persistence){var no=this.buildStorage(ue),ro=this.props;this.clear(),this.storage=no,this.props=ro,this.save()}}},{key:"set_disabled",value:function(ue){this.disabled=ue,this.disabled?this.remove():this.save()}},{key:"set_cross_subdomain",value:function(ue){ue!==this.cross_subdomain&&(this.cross_subdomain=ue,this.remove(),this.save())}},{key:"get_cross_subdomain",value:function(){return!!this.cross_subdomain}},{key:"set_secure",value:function(ue){ue!==this.secure&&(this.secure=ue,this.remove(),this.save())}},{key:"set_event_timer",value:function(ue,eo){var no=this.props[de]||{};no[ue]=eo,this.props[de]=no,this.save()}},{key:"remove_event_timer",value:function(ue){var eo=(this.props[de]||{})[ue];return w$1(eo)||(delete this.props[de][ue],this.save()),eo}},{key:"get_property",value:function(ue){return this.props[ue]}},{key:"set_property",value:function(ue,eo){this.props[ue]=eo,this.save()}}]),to}();function kn(to){return JSON.stringify(to,(ue=[],function(eo,no){if(b(no)){for(;ue.length>0&&ue.at(-1)!==this;)ue.pop();return ue.includes(no)?"[Circular]":(ue.push(no),no)}return no})).length;var ue}var wn=2,Sn=4;function En(to){var ue=arguments.length>1&&arguments[1]!==void 0?arguments[1]:66060288e-1;if(to.size>=ue&&to.data.length>1){var eo=Math.floor(to.data.length/2),no=to.data.slice(0,eo),ro=to.data.slice(eo);return[En({size:kn(no),data:no,sessionId:to.sessionId,windowId:to.windowId}),En({size:kn(ro),data:ro,sessionId:to.sessionId,windowId:to.windowId})].flatMap(function(oo){return oo})}return[to]}var In=function(to){return to[to.DomContentLoaded=0]="DomContentLoaded",to[to.Load=1]="Load",to[to.FullSnapshot=2]="FullSnapshot",to[to.IncrementalSnapshot=3]="IncrementalSnapshot",to[to.Meta=4]="Meta",to[to.Custom=5]="Custom",to[to.Plugin=6]="Plugin",to}(In||{}),Rn=function(to){return to[to.Mutation=0]="Mutation",to[to.MouseMove=1]="MouseMove",to[to.MouseInteraction=2]="MouseInteraction",to[to.Scroll=3]="Scroll",to[to.ViewportResize=4]="ViewportResize",to[to.Input=5]="Input",to[to.TouchMove=6]="TouchMove",to[to.MediaInteraction=7]="MediaInteraction",to[to.StyleSheetRule=8]="StyleSheetRule",to[to.CanvasMutation=9]="CanvasMutation",to[to.Font=10]="Font",to[to.Log=11]="Log",to[to.Drag=12]="Drag",to[to.StyleDeclaration=13]="StyleDeclaration",to[to.Selection=14]="Selection",to[to.AdoptedStyleSheet=15]="AdoptedStyleSheet",to[to.CustomElement=16]="CustomElement",to}(Rn||{});function Fn(to){return to?V(to).split(/\s+/):[]}function xn(to){var ue=T==null?void 0:T.location.href;return!!(ue&&to&&to.some(function(eo){return ue.match(eo)}))}function Pn(to){var ue="";switch(n(to.className)){case"string":ue=to.className;break;case"object":ue=(to.className&&"baseVal"in to.className?to.className.baseVal:null)||to.getAttribute("class")||"";break;default:ue=""}return Fn(ue)}function Tn(to){return R(to)?null:V(to).split(/(\s+)/).filter(function(ue){return zn(ue)}).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function Cn(to){var ue="";return Nn(to)&&!Bn(to)&&to.childNodes&&to.childNodes.length&&Q(to.childNodes,function(eo){var no;Mn(eo)&&eo.textContent&&(ue+=(no=Tn(eo.textContent))!==null&&no!==void 0?no:"")}),V(ue)}function $n(to){return!!to&&to.nodeType===1}function On(to,ue){return!!to&&!!to.tagName&&to.tagName.toLowerCase()===ue.toLowerCase()}function Mn(to){return!!to&&to.nodeType===3}function An(to){return!!to&&to.nodeType===11}var Ln=["a","button","form","input","select","textarea","label"];function Dn(to){var ue=to.parentNode;return!(!ue||!$n(ue))&&ue}function qn(to,ue){var eo=arguments.length>2&&arguments[2]!==void 0?arguments[2]:void 0,no=arguments.length>3?arguments[3]:void 0,ro=arguments.length>4?arguments[4]:void 0;if(!T||!to||On(to,"html")||!$n(to)||eo!=null&&eo.url_allowlist&&!xn(eo.url_allowlist)||eo!=null&&eo.url_ignorelist&&xn(eo.url_ignorelist))return!1;if(eo!=null&&eo.dom_event_allowlist){var oo=eo.dom_event_allowlist;if(oo&&!oo.some(function(po){return ue.type===po}))return!1}for(var io=!1,ao=[to],so=!0,lo=to;lo.parentNode&&!On(lo,"body");)if(An(lo.parentNode))ao.push(lo.parentNode.host),lo=lo.parentNode.host;else{if(!(so=Dn(lo)))break;if(no||Ln.indexOf(so.tagName.toLowerCase())>-1)io=!0;else{var co=T.getComputedStyle(so);co&&co.getPropertyValue("cursor")==="pointer"&&(io=!0)}ao.push(so),lo=so}if(!function(po,ho){var _o=ho==null?void 0:ho.element_allowlist;if(w$1(_o))return!0;var go,bo=h(po);try{var vo=function(){var $o=go.value;if(_o.some(function(ko){return $o.tagName.toLowerCase()===ko}))return{v:!0}};for(bo.s();!(go=bo.n()).done;){var yo=vo();if(n(yo)==="object")return yo.v}}catch($o){bo.e($o)}finally{bo.f()}return!1}(ao,eo)||!function(po,ho){var _o=ho==null?void 0:ho.css_selector_allowlist;if(w$1(_o))return!0;var go,bo=h(po);try{var vo=function(){var $o=go.value;if(_o.some(function(ko){return $o.matches(ko)}))return{v:!0}};for(bo.s();!(go=bo.n()).done;){var yo=vo();if(n(yo)==="object")return yo.v}}catch($o){bo.e($o)}finally{bo.f()}return!1}(ao,eo))return!1;var uo=T.getComputedStyle(to);if(uo&&uo.getPropertyValue("cursor")==="pointer"&&ue.type==="click")return!0;var fo=to.tagName.toLowerCase();switch(fo){case"html":return!1;case"form":return(ro||["submit"]).indexOf(ue.type)>=0;case"input":case"select":case"textarea":return(ro||["change","click"]).indexOf(ue.type)>=0;default:return io?(ro||["click"]).indexOf(ue.type)>=0:(ro||["click"]).indexOf(ue.type)>=0&&(Ln.indexOf(fo)>-1||to.getAttribute("contenteditable")==="true")}}function Nn(to){for(var ue=to;ue.parentNode&&!On(ue,"body");ue=ue.parentNode){var eo=Pn(ue);if(Y(eo,"ph-sensitive")||Y(eo,"ph-no-capture"))return!1}if(Y(Pn(to),"ph-include"))return!0;var no=to.type||"";if(S(no))switch(no.toLowerCase()){case"hidden":case"password":return!1}var ro=to.name||to.id||"";return!(S(ro)&&/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(ro.replace(/[^a-zA-Z0-9]/g,"")))}function Bn(to){return!!(On(to,"input")&&!["button","checkbox","submit","reset"].includes(to.type)||On(to,"select")||On(to,"textarea")||to.getAttribute("contenteditable")==="true")}var Hn="(4[0-9]{12}(?:[0-9]{3})?)|(5[1-5][0-9]{14})|(6(?:011|5[0-9]{2})[0-9]{12})|(3[47][0-9]{13})|(3(?:0[0-5]|[68][0-9])[0-9]{11})|((?:2131|1800|35[0-9]{3})[0-9]{11})",Un=new RegExp("^(?:".concat(Hn,")$")),jn=new RegExp(Hn),Gn="\\d{3}-?\\d{2}-?\\d{4}",Wn=new RegExp("^(".concat(Gn,")$")),Vn=new RegExp("(".concat(Gn,")"));function zn(to){var ue=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1];return!(R(to)||S(to)&&(to=V(to),(ue?Un:jn).test((to||"").replace(/[- ]/g,""))||(ue?Wn:Vn).test(to)))}function Qn(to){var ue=Cn(to);return zn(ue="".concat(ue," ").concat(Jn(to)).trim())?ue:""}function Jn(to){var ue="";return to&&to.childNodes&&to.childNodes.length&&Q(to.childNodes,function(eo){var no;if(eo&&((no=eo.tagName)===null||no===void 0?void 0:no.toLowerCase())==="span")try{var ro=Cn(eo);ue="".concat(ue," ").concat(ro).trim(),eo.childNodes&&eo.childNodes.length&&(ue="".concat(ue," ").concat(Jn(eo)).trim())}catch(oo){G.error(oo)}}),ue}function Yn(to){return function(ue){var eo=ue.map(function(no){var ro,oo,io="";if(no.tag_name&&(io+=no.tag_name),no.attr_class){no.attr_class.sort();var ao,so=h(no.attr_class);try{for(so.s();!(ao=so.n()).done;){var lo=ao.value;io+=".".concat(lo.replace(/"/g,""))}}catch(fo){so.e(fo)}finally{so.f()}}var co=t$1(t$1(t$1(t$1({},no.text?{text:no.text}:{}),{},{"nth-child":(ro=no.nth_child)!==null&&ro!==void 0?ro:0,"nth-of-type":(oo=no.nth_of_type)!==null&&oo!==void 0?oo:0},no.href?{href:no.href}:{}),no.attr_id?{attr_id:no.attr_id}:{}),no.attributes),uo={};return X(co).sort(function(fo,po){var ho=u(fo,1)[0],_o=u(po,1)[0];return ho.localeCompare(_o)}).forEach(function(fo){var po=u(fo,2),ho=po[0],_o=po[1];return uo[Xn(ho.toString())]=Xn(_o.toString())}),io+=":",io+=X(co).map(function(fo){var po=u(fo,2),ho=po[0],_o=po[1];return"".concat(ho,'="').concat(_o,'"')}).join("")});return eo.join(";")}(function(ue){return ue.map(function(eo){var no,ro,oo={text:(no=eo.$el_text)===null||no===void 0?void 0:no.slice(0,400),tag_name:eo.tag_name,href:(ro=eo.attr__href)===null||ro===void 0?void 0:ro.slice(0,2048),attr_class:Kn(eo),attr_id:eo.attr__id,nth_child:eo.nth_child,nth_of_type:eo.nth_of_type,attributes:{}};return X(eo).filter(function(io){return u(io,1)[0].indexOf("attr__")===0}).forEach(function(io){var ao=u(io,2),so=ao[0],lo=ao[1];return oo.attributes[so]=lo}),oo})}(to))}function Xn(to){return to.replace(/"|\\"/g,'\\"')}function Kn(to){var ue=to.attr__class;return ue?m(ue)?ue:Fn(ue):void 0}var Zn="[SessionRecording]",ei="redacted",ti={initiatorTypes:["audio","beacon","body","css","early-hint","embed","fetch","frame","iframe","icon","image","img","input","link","navigation","object","ping","script","track","video","xmlhttprequest"],maskRequestFn:function(to){return to},recordHeaders:!1,recordBody:!1,recordInitialRequests:!1,recordPerformance:!1,performanceEntryTypeToObserve:["first-input","navigation","paint","resource"],payloadSizeLimitBytes:1e6,payloadHostDenyList:[".lr-ingest.io",".ingest.sentry.io"]},ni=["authorization","x-forwarded-for","authorization","cookie","set-cookie","x-api-key","x-real-ip","remote-addr","forwarded","proxy-authorization","x-csrf-token","x-csrftoken","x-xsrf-token"],ii=["password","secret","passwd","api_key","apikey","auth","credentials","mysql_pwd","privatekey","private_key","token"],ri=["/s/","/e/","/i/"];function si(to,ue,eo,no){if(R(to))return to;var ro=(ue==null?void 0:ue["content-length"])||function(oo){return new Blob([oo]).size}(to);return S(ro)&&(ro=parseInt(ro)),ro>eo?Zn+" ".concat(no," body too large to record (").concat(ro," bytes)"):to}function oi(to,ue){if(R(to))return to;var eo=to;return zn(eo,!1)||(eo=Zn+" "+ue+" body "+ei),Q(ii,function(no){var ro,oo;(ro=eo)!==null&&ro!==void 0&&ro.length&&((oo=eo)===null||oo===void 0?void 0:oo.indexOf(no))!==-1&&(eo=Zn+" "+ue+" body "+ei+" as might contain: "+no)}),eo}var ai,ui=function(to,ue){var eo,no,ro,oo={payloadSizeLimitBytes:ti.payloadSizeLimitBytes,performanceEntryTypeToObserve:l(ti.performanceEntryTypeToObserve),payloadHostDenyList:[].concat(l(ue.payloadHostDenyList||[]),l(ti.payloadHostDenyList))},io=to.session_recording.recordHeaders!==!1&&ue.recordHeaders,ao=to.session_recording.recordBody!==!1&&ue.recordBody,so=to.capture_performance!==!1&&ue.recordPerformance,lo=(eo=oo,ro=Math.min(1e6,(no=eo.payloadSizeLimitBytes)!==null&&no!==void 0?no:1e6),function(fo){return fo!=null&&fo.requestBody&&(fo.requestBody=si(fo.requestBody,fo.requestHeaders,ro,"Request")),fo!=null&&fo.responseBody&&(fo.responseBody=si(fo.responseBody,fo.responseHeaders,ro,"Response")),fo}),co=function(fo){return lo(function(_o){var go=pt(_o.name);if(!(go&&go.pathname&&ri.some(function(bo){return go.pathname.indexOf(bo)===0})))return _o}((ho=(po=fo).requestHeaders,R(ho)||Q(Object.keys(ho??{}),function(_o){ni.includes(_o.toLowerCase())&&(ho[_o]=ei)}),po)));var po,ho},uo=y(to.session_recording.maskNetworkRequestFn);return uo&&y(to.session_recording.maskCapturedNetworkRequestFn)&&G.warn("Both `maskNetworkRequestFn` and `maskCapturedNetworkRequestFn` are defined. `maskNetworkRequestFn` will be ignored."),uo&&(to.session_recording.maskCapturedNetworkRequestFn=function(fo){var po=to.session_recording.maskNetworkRequestFn({url:fo.name});return t$1(t$1({},fo),{},{name:po==null?void 0:po.url})}),oo.maskRequestFn=y(to.session_recording.maskCapturedNetworkRequestFn)?function(fo){var po,ho,_o,go=co(fo);return go&&(po=(ho=(_o=to.session_recording).maskCapturedNetworkRequestFn)===null||ho===void 0?void 0:ho.call(_o,go))!==null&&po!==void 0?po:void 0}:function(fo){return function(po){if(!w$1(po))return po.requestBody=oi(po.requestBody,"Request"),po.responseBody=oi(po.responseBody,"Response"),po}(co(fo))},t$1(t$1(t$1({},ti),oo),{},{recordHeaders:io,recordBody:ao,recordPerformance:so,recordInitialRequests:so})},li=s(function to(ue){var eo,no,ro=this,oo=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};i$1(this,to),o(this,"bucketSize",100),o(this,"refillRate",10),o(this,"mutationBuckets",{}),o(this,"loggedTracker",{}),o(this,"refillBuckets",function(){Object.keys(ro.mutationBuckets).forEach(function(io){ro.mutationBuckets[io]=ro.mutationBuckets[io]+ro.refillRate,ro.mutationBuckets[io]>=ro.bucketSize&&delete ro.mutationBuckets[io]})}),o(this,"getNodeOrRelevantParent",function(io){var ao=ro.rrweb.mirror.getNode(io);if((ao==null?void 0:ao.nodeName)!=="svg"&&ao instanceof Element){var so=ao.closest("svg");if(so)return[ro.rrweb.mirror.getId(so),so]}return[io,ao]}),o(this,"numberOfChanges",function(io){var ao,so,lo,co,uo,fo,po,ho;return((ao=(so=io.removes)===null||so===void 0?void 0:so.length)!==null&&ao!==void 0?ao:0)+((lo=(co=io.attributes)===null||co===void 0?void 0:co.length)!==null&&lo!==void 0?lo:0)+((uo=(fo=io.texts)===null||fo===void 0?void 0:fo.length)!==null&&uo!==void 0?uo:0)+((po=(ho=io.adds)===null||ho===void 0?void 0:ho.length)!==null&&po!==void 0?po:0)}),o(this,"throttleMutations",function(io){if(io.type!==3||io.data.source!==0)return io;var ao=io.data,so=ro.numberOfChanges(ao);ao.attributes&&(ao.attributes=ao.attributes.filter(function(co){var uo,fo,po,ho=u(ro.getNodeOrRelevantParent(co.id),2),_o=ho[0],go=ho[1];return ro.mutationBuckets[_o]===0?!1:(ro.mutationBuckets[_o]=(uo=ro.mutationBuckets[_o])!==null&&uo!==void 0?uo:ro.bucketSize,ro.mutationBuckets[_o]=Math.max(ro.mutationBuckets[_o]-1,0),ro.mutationBuckets[_o]===0&&(ro.loggedTracker[_o]||(ro.loggedTracker[_o]=!0,(fo=(po=ro.options).onBlockedNode)===null||fo===void 0||fo.call(po,_o,go))),co)}));var lo=ro.numberOfChanges(ao);return lo!==0||so===lo?io:void 0}),this.rrweb=ue,this.options=oo,this.refillRate=(eo=this.options.refillRate)!==null&&eo!==void 0?eo:this.refillRate,this.bucketSize=(no=this.options.bucketSize)!==null&&no!==void 0?no:this.bucketSize,setInterval(function(){ro.refillBuckets()},1e3)}),ci=3e5,di=[Rn.MouseMove,Rn.MouseInteraction,Rn.Scroll,Rn.ViewportResize,Rn.Input,Rn.TouchMove,Rn.MediaInteraction,Rn.Drag],hi=function(to){return{rrwebMethod:to,enqueuedAt:Date.now(),attempt:1}},fi="[SessionRecording]",vi=function(){function to(ue){var eo=this;if(i$1(this,to),o(this,"queuedRRWebEvents",[]),o(this,"isIdle",!1),o(this,"_linkedFlagSeen",!1),o(this,"_lastActivityTimestamp",Date.now()),o(this,"_linkedFlag",null),o(this,"_forceAllowLocalhostNetworkCapture",!1),o(this,"_onBeforeUnload",function(){eo._flushBuffer()}),o(this,"_onOffline",function(){eo._tryAddCustomEvent("browser offline",{})}),o(this,"_onOnline",function(){eo._tryAddCustomEvent("browser online",{})}),o(this,"_onVisibilityChange",function(){if(L!=null&&L.visibilityState){var io="window "+L.visibilityState;eo._tryAddCustomEvent(io,{})}}),o(this,"_samplingSessionListener",null),this.instance=ue,this._captureStarted=!1,this._endpoint="/s/",this.stopRrweb=void 0,this.receivedDecide=!1,!this.instance.sessionManager)throw G.error(fi+" started without valid sessionManager"),new Error(fi+" started without valid sessionManager. This is a bug.");var no=this.sessionManager.checkAndGetSessionAndWindowId(),ro=no.sessionId,oo=no.windowId;this.sessionId=ro,this.windowId=oo,this.buffer=this.clearBuffer(),this._setupSampling()}return s(to,[{key:"rrwebRecord",get:function(){var ue;return U==null||(ue=U.rrweb)===null||ue===void 0?void 0:ue.record}},{key:"started",get:function(){return this._captureStarted}},{key:"sessionManager",get:function(){if(!this.instance.sessionManager)throw new Error(fi+" must be started with a valid sessionManager.");return this.instance.sessionManager}},{key:"fullSnapshotIntervalMillis",get:function(){var ue;return((ue=this.instance.config.session_recording)===null||ue===void 0?void 0:ue.full_snapshot_interval_millis)||ci}},{key:"isSampled",get:function(){var ue=this.instance.get_property(Ee);return x$1(ue)?ue:null}},{key:"sessionDuration",get:function(){var ue,eo,no=(ue=this.buffer)===null||ue===void 0?void 0:ue.data[((eo=this.buffer)===null||eo===void 0?void 0:eo.data.length)-1],ro=this.sessionManager.checkAndGetSessionAndWindowId(!0).sessionStartTimestamp;return no?no.timestamp-ro:null}},{key:"isRecordingEnabled",get:function(){var ue=!!this.instance.get_property(_e),eo=!this.instance.config.disable_session_recording;return T&&ue&&eo}},{key:"isConsoleLogCaptureEnabled",get:function(){var ue=!!this.instance.get_property(me),eo=this.instance.config.enable_recording_console_log;return eo??ue}},{key:"canvasRecording",get:function(){var ue=this.instance.get_property(be);return ue&&ue.fps&&ue.quality?{enabled:ue.enabled,fps:ue.fps,quality:ue.quality}:void 0}},{key:"networkPayloadCapture",get:function(){var ue,eo,no=this.instance.get_property(ye),ro={recordHeaders:(ue=this.instance.config.session_recording)===null||ue===void 0?void 0:ue.recordHeaders,recordBody:(eo=this.instance.config.session_recording)===null||eo===void 0?void 0:eo.recordBody},oo=(ro==null?void 0:ro.recordHeaders)||(no==null?void 0:no.recordHeaders),io=(ro==null?void 0:ro.recordBody)||(no==null?void 0:no.recordBody),ao=b(this.instance.config.capture_performance)?this.instance.config.capture_performance.network_timing:this.instance.config.capture_performance,so=!!(x$1(ao)?ao:no!=null&&no.capturePerformance);return oo||io||so?{recordHeaders:oo,recordBody:io,recordPerformance:so}:void 0}},{key:"sampleRate",get:function(){var ue=this.instance.get_property(ke);return F(ue)?ue:null}},{key:"minimumDuration",get:function(){var ue=this.instance.get_property(we);return F(ue)?ue:null}},{key:"status",get:function(){return this.receivedDecide?this.isRecordingEnabled?R(this._linkedFlag)||this._linkedFlagSeen?x$1(this.isSampled)?this.isSampled?"sampled":"disabled":"active":"buffering":"disabled":"buffering"}},{key:"startIfEnabledOrStop",value:function(){this.isRecordingEnabled?(this._startCapture(),T==null||T.addEventListener("beforeunload",this._onBeforeUnload),T==null||T.addEventListener("offline",this._onOffline),T==null||T.addEventListener("online",this._onOnline),T==null||T.addEventListener("visibilitychange",this._onVisibilityChange),G.info(fi+" started")):(this.stopRecording(),this.clearBuffer())}},{key:"stopRecording",value:function(){this._captureStarted&&this.stopRrweb&&(this.stopRrweb(),this.stopRrweb=void 0,this._captureStarted=!1,T==null||T.removeEventListener("beforeunload",this._onBeforeUnload),T==null||T.removeEventListener("offline",this._onOffline),T==null||T.removeEventListener("online",this._onOnline),T==null||T.removeEventListener("visibilitychange",this._onVisibilityChange),G.info(fi+" stopped"))}},{key:"makeSamplingDecision",value:function(ue){var eo,no=this.sessionId!==ue,ro=this.sampleRate;if(F(ro)){var oo,io=this.isSampled,ao=no||!x$1(io);ao?oo=Math.random()<ro:oo=io,!oo&&ao&&G.warn(fi+" Sample rate (".concat(ro,") has determined that this sessionId (").concat(ue,") will not be sent to the server.")),this._tryAddCustomEvent("samplingDecisionMade",{sampleRate:ro}),(eo=this.instance.persistence)===null||eo===void 0||eo.register(o({},Ee,oo))}else{var so;(so=this.instance.persistence)===null||so===void 0||so.register(o({},Ee,null))}}},{key:"afterDecideResponse",value:function(ue){var eo,no,ro,oo=this;if(this._persistDecideResponse(ue),this._linkedFlag=((eo=ue.sessionRecording)===null||eo===void 0?void 0:eo.linkedFlag)||null,(no=ue.sessionRecording)!==null&&no!==void 0&&no.endpoint&&(this._endpoint=(ro=ue.sessionRecording)===null||ro===void 0?void 0:ro.endpoint),this._setupSampling(),!R(this._linkedFlag)&&!this._linkedFlagSeen){var io=S(this._linkedFlag)?this._linkedFlag:this._linkedFlag.flag,ao=S(this._linkedFlag)?null:this._linkedFlag.variant;this.instance.onFeatureFlags(function(so,lo){var co=b(lo)&&io in lo,uo=ao?lo[io]===ao:co;if(uo){var fo={linkedFlag:io,linkedVariant:ao},po="linked flag matched";G.info(fi+" "+po,fo),oo._tryAddCustomEvent(po,fo)}oo._linkedFlagSeen=uo})}this.receivedDecide=!0,this.startIfEnabledOrStop()}},{key:"_setupSampling",value:function(){var ue=this;F(this.sampleRate)&&I(this._samplingSessionListener)&&(this._samplingSessionListener=this.sessionManager.onSessionId(function(eo){ue.makeSamplingDecision(eo)}))}},{key:"_persistDecideResponse",value:function(ue){if(this.instance.persistence){var eo=this.instance.persistence,no=function(){var ro,oo,io,ao,so,lo,co,uo,fo=(ro=ue.sessionRecording)===null||ro===void 0?void 0:ro.sampleRate,po=R(fo)?null:parseFloat(fo),ho=(oo=ue.sessionRecording)===null||oo===void 0?void 0:oo.minimumDurationMilliseconds;eo.register((o(uo={},_e,!!ue.sessionRecording),o(uo,me,(io=ue.sessionRecording)===null||io===void 0?void 0:io.consoleLogRecordingEnabled),o(uo,ye,t$1({capturePerformance:ue.capturePerformance},(ao=ue.sessionRecording)===null||ao===void 0?void 0:ao.networkPayloadCapture)),o(uo,be,{enabled:(so=ue.sessionRecording)===null||so===void 0?void 0:so.recordCanvas,fps:(lo=ue.sessionRecording)===null||lo===void 0?void 0:lo.canvasFps,quality:(co=ue.sessionRecording)===null||co===void 0?void 0:co.canvasQuality}),o(uo,ke,po),o(uo,we,w$1(ho)?null:ho),uo))};no(),this.sessionManager.onSessionId(no)}}},{key:"log",value:function(ue){var eo,no=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"log";(eo=this.instance.sessionRecording)===null||eo===void 0||eo.onRRwebEmit({type:6,data:{plugin:"rrweb/console@1",payload:{level:no,trace:[],payload:[JSON.stringify(ue)]}},timestamp:K()})}},{key:"_startCapture",value:function(){var ue=this;w$1(Object.assign)||this._captureStarted||this.instance.config.disable_session_recording||this.instance.consent.isOptedOut()||(this._captureStarted=!0,this.sessionManager.checkAndGetSessionAndWindowId(),this.rrwebRecord?this._onScriptLoaded():this.instance.requestRouter.loadScript("/static/recorder.js?v=".concat(f.LIB_VERSION),function(eo){if(eo)return G.error(fi+" could not load recorder.js",eo);ue._onScriptLoaded()}))}},{key:"isInteractiveEvent",value:function(ue){var eo;return ue.type===3&&di.indexOf((eo=ue.data)===null||eo===void 0?void 0:eo.source)!==-1}},{key:"_updateWindowAndSessionIds",value:function(ue){var eo=this.isInteractiveEvent(ue);eo||this.isIdle||ue.timestamp-this._lastActivityTimestamp>3e5&&(this.isIdle=!0,clearTimeout(this._fullSnapshotTimer),this._flushBuffer());var no=!1;if(eo&&(this._lastActivityTimestamp=ue.timestamp,this.isIdle&&(this.isIdle=!1,this._tryAddCustomEvent("sessionNoLongerIdle",{reason:"user activity",type:ue.type}),no=!0)),!this.isIdle){var ro=this.sessionManager.checkAndGetSessionAndWindowId(!eo,ue.timestamp),oo=ro.windowId,io=ro.sessionId,ao=this.sessionId!==io,so=this.windowId!==oo;this.windowId=oo,this.sessionId=io,(no||[wn,Sn].indexOf(ue.type)===-1&&(so||ao||w$1(this._fullSnapshotTimer)))&&this._tryTakeFullSnapshot()}}},{key:"_tryRRWebMethod",value:function(ue){try{return ue.rrwebMethod(),!0}catch(eo){return this.queuedRRWebEvents.length<10?this.queuedRRWebEvents.push({enqueuedAt:ue.enqueuedAt||Date.now(),attempt:ue.attempt++,rrwebMethod:ue.rrwebMethod}):G.warn(fi+" could not emit queued rrweb event.",eo,ue),!1}}},{key:"_tryAddCustomEvent",value:function(ue,eo){var no=this;return this._tryRRWebMethod(hi(function(){return no.rrwebRecord.addCustomEvent(ue,eo)}))}},{key:"_tryTakeFullSnapshot",value:function(){var ue=this;return this._tryRRWebMethod(hi(function(){return ue.rrwebRecord.takeFullSnapshot()}))}},{key:"_onScriptLoaded",value:function(){for(var ue,eo=this,no={blockClass:"ph-no-capture",blockSelector:void 0,ignoreClass:"ph-ignore-input",maskTextClass:"ph-mask",maskTextSelector:void 0,maskTextFn:void 0,maskAllInputs:!0,maskInputOptions:{password:!0},maskInputFn:void 0,slimDOMOptions:{},collectFonts:!1,inlineStylesheet:!0,recordCrossOriginIframes:!1},ro=this.instance.config.session_recording,oo=0,io=Object.entries(ro||{});oo<io.length;oo++){var ao=u(io[oo],2),so=ao[0],lo=ao[1];so in no&&(so==="maskInputOptions"?no.maskInputOptions=t$1({password:!0},lo):no[so]=lo)}if(this.canvasRecording&&this.canvasRecording.enabled&&(no.recordCanvas=!0,no.sampling={canvas:this.canvasRecording.fps},no.dataURLOptions={type:"image/webp",quality:this.canvasRecording.quality}),this.rrwebRecord){this.mutationRateLimiter=(ue=this.mutationRateLimiter)!==null&&ue!==void 0?ue:new li(this.rrwebRecord,{onBlockedNode:function(uo,fo){var po="Too many mutations on node '".concat(uo,"'. Rate limiting. This could be due to SVG animations or something similar");G.info(po,{node:fo}),eo.log(fi+" "+po,"warn")}});var co=this._gatherRRWebPlugins();this.stopRrweb=this.rrwebRecord(t$1({emit:function(uo){eo.onRRwebEmit(uo)},plugins:co},no)),this.instance._addCaptureHook(function(uo){try{if(uo==="$pageview"){var fo=T?eo._maskUrl(T.location.href):"";if(!fo)return;eo._tryAddCustomEvent("$pageview",{href:fo})}}catch(po){G.error("Could not add $pageview to rrweb session",po)}}),this._lastActivityTimestamp=Date.now(),this.isIdle=!1,this._tryAddCustomEvent("$session_options",{sessionRecordingOptions:no,activePlugins:co.map(function(uo){return uo==null?void 0:uo.name})}),this._tryAddCustomEvent("$posthog_config",{config:this.instance.config})}else G.error(fi+"onScriptLoaded was called but rrwebRecord is not available. This indicates something has gone wrong.")}},{key:"_scheduleFullSnapshot",value:function(){var ue=this;if(this._fullSnapshotTimer&&clearInterval(this._fullSnapshotTimer),!this.isIdle){var eo=this.fullSnapshotIntervalMillis;eo&&(this._fullSnapshotTimer=setInterval(function(){ue._tryTakeFullSnapshot()},eo))}}},{key:"_gatherRRWebPlugins",value:function(){var ue=[];return U.rrwebConsoleRecord&&this.isConsoleLogCaptureEnabled&&ue.push(U.rrwebConsoleRecord.getRecordConsolePlugin()),this.networkPayloadCapture&&y(U.getRecordNetworkPlugin)&&(!vt.includes(location.hostname)||this._forceAllowLocalhostNetworkCapture?ue.push(U.getRecordNetworkPlugin(ui(this.instance.config,this.networkPayloadCapture))):G.info(fi+" NetworkCapture not started because we are on localhost.")),ue}},{key:"onRRwebEmit",value:function(ue){if(this._processQueuedEvents(),ue&&b(ue)){if(ue.type===In.Meta){var eo=this._maskUrl(ue.data.href);if(this._lastHref=eo,!eo)return;ue.data.href=eo}else this._pageViewFallBack();ue.type===In.FullSnapshot&&this._scheduleFullSnapshot();var no=this.mutationRateLimiter?this.mutationRateLimiter.throttleMutations(ue):ue;if(no){var ro=function(ao){var so=ao;if(so&&b(so)&&so.type===6&&b(so.data)&&so.data.plugin==="rrweb/console@1"){so.data.payload.payload.length>10&&(so.data.payload.payload=so.data.payload.payload.slice(0,10),so.data.payload.payload.push("...[truncated]"));for(var lo=[],co=0;co<so.data.payload.payload.length;co++)so.data.payload.payload[co]&&so.data.payload.payload[co].length>2e3?lo.push(so.data.payload.payload[co].slice(0,2e3)+"...[truncated]"):lo.push(so.data.payload.payload[co]);return so.data.payload.payload=lo,ao}return ao}(no),oo=kn(ro);if(this._updateWindowAndSessionIds(ro),!this.isIdle||ro.type===In.Custom){var io={$snapshot_bytes:oo,$snapshot_data:ro,$session_id:this.sessionId,$window_id:this.windowId};this.status!=="disabled"?this._captureSnapshotBuffered(io):this.clearBuffer()}}}}},{key:"_pageViewFallBack",value:function(){if(!this.instance.config.capture_pageview&&T){var ue=this._maskUrl(T.location.href);this._lastHref!==ue&&(this._tryAddCustomEvent("$url_changed",{href:ue}),this._lastHref=ue)}}},{key:"_processQueuedEvents",value:function(){var ue=this;if(this.queuedRRWebEvents.length){var eo=l(this.queuedRRWebEvents);this.queuedRRWebEvents=[],eo.forEach(function(no){Date.now()-no.enqueuedAt<=2e3&&ue._tryRRWebMethod(no)})}}},{key:"_maskUrl",value:function(ue){var eo=this.instance.config.session_recording;if(eo.maskNetworkRequestFn){var no,ro={url:ue};return(no=ro=eo.maskNetworkRequestFn(ro))===null||no===void 0?void 0:no.url}return ue}},{key:"clearBuffer",value:function(){return this.buffer={size:0,data:[],sessionId:this.sessionId,windowId:this.windowId},this.buffer}},{key:"_flushBuffer",value:function(){var ue=this;this.flushBufferTimer&&(clearTimeout(this.flushBufferTimer),this.flushBufferTimer=void 0);var eo=this.minimumDuration,no=this.sessionDuration,ro=F(no)&&no>=0,oo=F(eo)&&ro&&no<eo;return this.status==="buffering"||oo?(this.flushBufferTimer=setTimeout(function(){ue._flushBuffer()},2e3),this.buffer):(this.buffer.data.length>0&&En(this.buffer).forEach(function(io){ue._captureSnapshot({$snapshot_bytes:io.size,$snapshot_data:io.data,$session_id:io.sessionId,$window_id:io.windowId})}),this.clearBuffer())}},{key:"_captureSnapshotBuffered",value:function(ue){var eo,no=this,ro=2+(((eo=this.buffer)===null||eo===void 0?void 0:eo.data.length)||0);(this.buffer.size+ue.$snapshot_bytes+ro>943718.4||this.buffer.sessionId!==this.sessionId)&&(this.buffer=this._flushBuffer()),this.buffer.size+=ue.$snapshot_bytes,this.buffer.data.push(ue.$snapshot_data),this.flushBufferTimer||(this.flushBufferTimer=setTimeout(function(){no._flushBuffer()},2e3))}},{key:"_captureSnapshot",value:function(ue){this.instance.capture("$snapshot",ue,{_url:this.instance.requestRouter.endpointFor("api",this._endpoint),_noTruncate:!0,_batchKey:"recordings",skip_client_rate_limiting:!0})}},{key:"overrideLinkedFlag",value:function(){this._linkedFlagSeen=!0}}]),to}(),pi=function(){function to(ue){i$1(this,to),this.instance=ue,this.instance.decideEndpointWasHit=this.instance._hasBootstrappedFeatureFlags()}return s(to,[{key:"call",value:function(){var ue=this,eo={token:this.instance.config.token,distinct_id:this.instance.get_distinct_id(),groups:this.instance.getGroups(),person_properties:this.instance.get_property(Fe),group_properties:this.instance.get_property(xe),disable_flags:this.instance.config.advanced_disable_feature_flags||this.instance.config.advanced_disable_feature_flags_on_first_load||void 0};this.instance._send_request({method:"POST",url:this.instance.requestRouter.endpointFor("api","/decide/?v=3"),data:eo,compression:this.instance.config.disable_compression?void 0:re.Base64,timeout:this.instance.config.feature_flag_request_timeout_ms,callback:function(no){return ue.parseDecideResponse(no.json)}})}},{key:"parseDecideResponse",value:function(ue){var eo=this;this.instance.featureFlags.setReloadingPaused(!1),this.instance.featureFlags._startReloadTimer();var no=!ue;if(this.instance.config.advanced_disable_feature_flags_on_first_load||this.instance.config.advanced_disable_feature_flags||this.instance.featureFlags.receivedFeatureFlags(ue??{},no),no)G.error("Failed to fetch feature flags from PostHog.");else{if(!L||!L.body)return G.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout(function(){eo.parseDecideResponse(ue)},500);if(this.instance._afterDecideResponse(ue),ue.siteApps)if(this.instance.config.opt_in_site_apps){var ro,oo=h(ue.siteApps);try{var io=function(){var ao=ro.value,so=ao.id,lo=ao.url,co=eo.instance.requestRouter.endpointFor("api",lo);U["__$$ph_site_app_".concat(so)]=eo.instance,eo.instance.requestRouter.loadScript(co,function(uo){if(uo)return G.error("Error while initializing PostHog app with config id ".concat(so),uo)})};for(oo.s();!(ro=oo.n()).done;)io()}catch(ao){oo.e(ao)}finally{oo.f()}}else ue.siteApps.length>0&&G.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}}]),to}(),gi=T!=null&&T.location?yt(T.location.hash,"__posthog")||yt(location.hash,"state"):null,_i="_postHogToolbarParams";(function(to){to[to.UNINITIALIZED=0]="UNINITIALIZED",to[to.LOADING=1]="LOADING",to[to.LOADED=2]="LOADED"})(ai||(ai={}));var mi=function(){function to(ue){i$1(this,to),this.instance=ue}return s(to,[{key:"setToolbarState",value:function(ue){U.ph_toolbar_state=ue}},{key:"getToolbarState",value:function(){var ue;return(ue=U.ph_toolbar_state)!==null&&ue!==void 0?ue:ai.UNINITIALIZED}},{key:"maybeLoadToolbar",value:function(){var ue,eo,no=arguments.length>0&&arguments[0]!==void 0?arguments[0]:void 0,ro=arguments.length>1&&arguments[1]!==void 0?arguments[1]:void 0,oo=arguments.length>2&&arguments[2]!==void 0?arguments[2]:void 0;if(!T||!L)return!1;no=(ue=no)!==null&&ue!==void 0?ue:T.location,oo=(eo=oo)!==null&&eo!==void 0?eo:T.history;try{if(!ro){try{T.localStorage.setItem("test","test"),T.localStorage.removeItem("test")}catch{return!1}ro=T==null?void 0:T.localStorage}var io,ao=gi||yt(no.hash,"__posthog")||yt(no.hash,"state"),so=ao?Z(function(){return JSON.parse(atob(decodeURIComponent(ao)))})||Z(function(){return JSON.parse(decodeURIComponent(ao))}):null;return so&&so.action==="ph_authorize"?((io=so).source="url",io&&Object.keys(io).length>0&&(so.desiredHash?no.hash=so.desiredHash:oo?oo.replaceState(oo.state,"",no.pathname+no.search):no.hash="")):((io=JSON.parse(ro.getItem(_i)||"{}")).source="localstorage",delete io.userIntent),!(!io.token||this.instance.config.token!==io.token)&&(this.loadToolbar(io),!0)}catch{return!1}}},{key:"_callLoadToolbar",value:function(ue){(U.ph_load_toolbar||U.ph_load_editor)(ue,this.instance)}},{key:"loadToolbar",value:function(ue){var eo=this,no=!(L==null||!L.getElementById(Ne));if(!T||no)return!1;var ro=this.instance.requestRouter.region==="custom"&&this.instance.config.advanced_disable_toolbar_metrics,oo=t$1(t$1({token:this.instance.config.token},ue),{},{apiURL:this.instance.requestRouter.endpointFor("ui")},ro?{instrument:!1}:{});if(T.localStorage.setItem(_i,JSON.stringify(t$1(t$1({},oo),{},{source:void 0}))),this.getToolbarState()===ai.LOADED)this._callLoadToolbar(oo);else if(this.getToolbarState()===ai.UNINITIALIZED){this.setToolbarState(ai.LOADING);var io=3e5,ao=Math.floor(Date.now()/io)*io;this.instance.requestRouter.loadScript("/static/toolbar.js?t=".concat(ao),function(so){if(so)return G.error("Failed to load toolbar",so),void eo.setToolbarState(ai.UNINITIALIZED);eo.setToolbarState(ai.LOADED),eo._callLoadToolbar(oo)}),oe(T,"turbolinks:load",function(){eo.setToolbarState(ai.UNINITIALIZED),eo.loadToolbar(oo)})}return!0}},{key:"_loadEditor",value:function(ue){return this.loadToolbar(ue)}},{key:"maybeLoadEditor",value:function(){var ue=arguments.length>0&&arguments[0]!==void 0?arguments[0]:void 0,eo=arguments.length>1&&arguments[1]!==void 0?arguments[1]:void 0,no=arguments.length>2&&arguments[2]!==void 0?arguments[2]:void 0;return this.maybeLoadToolbar(ue,eo,no)}}]),to}(),yi=function(){function to(ue){i$1(this,to),o(this,"isPaused",!0),o(this,"queue",[]),o(this,"flushTimeoutMs",3e3),this.sendRequest=ue}return s(to,[{key:"enqueue",value:function(ue){this.queue.push(ue),this.flushTimeout||this.setFlushTimeout()}},{key:"unload",value:function(){var ue=this;this.clearFlushTimeout();var eo=this.queue.length>0?this.formatQueue():{},no=Object.values(eo);[].concat(l(no.filter(function(ro){return ro.url.indexOf("/e")===0})),l(no.filter(function(ro){return ro.url.indexOf("/e")!==0}))).map(function(ro){ue.sendRequest(t$1(t$1({},ro),{},{transport:"sendBeacon"}))})}},{key:"enable",value:function(){this.isPaused=!1,this.setFlushTimeout()}},{key:"setFlushTimeout",value:function(){var ue=this;this.isPaused||(this.flushTimeout=setTimeout(function(){if(ue.clearFlushTimeout(),ue.queue.length>0){var eo=ue.formatQueue(),no=function(oo){var io=eo[oo],ao=new Date().getTime();io.data&&m(io.data)&&Q(io.data,function(so){so.offset=Math.abs(so.timestamp-ao),delete so.timestamp}),ue.sendRequest(io)};for(var ro in eo)no(ro)}},this.flushTimeoutMs))}},{key:"clearFlushTimeout",value:function(){clearTimeout(this.flushTimeout),this.flushTimeout=void 0}},{key:"formatQueue",value:function(){var ue={};return Q(this.queue,function(eo){var no,ro=eo,oo=(ro?ro.batchKey:null)||ro.url;w$1(ue[oo])&&(ue[oo]=t$1(t$1({},ro),{},{data:[]})),(no=ue[oo].data)===null||no===void 0||no.push(ro.data)}),this.queue=[],ue}}]),to}(),bi=Uint8Array,ki=Uint16Array,wi=Uint32Array,Si=new bi([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),Ei=new bi([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),Ii=new bi([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Ri=function(to,ue){for(var eo=new ki(31),no=0;no<31;++no)eo[no]=ue+=1<<to[no-1];var ro=new wi(eo[30]);for(no=1;no<30;++no)for(var oo=eo[no];oo<eo[no+1];++oo)ro[oo]=oo-eo[no]<<5|no;return[eo,ro]},Fi=Ri(Si,2),xi=Fi[0],Pi=Fi[1];xi[28]=258,Pi[258]=28;for(var Ti=Ri(Ei,0)[1],Ci=new ki(32768),$i=0;$i<32768;++$i){var Oi=(43690&$i)>>>1|(21845&$i)<<1;Oi=(61680&(Oi=(52428&Oi)>>>2|(13107&Oi)<<2))>>>4|(3855&Oi)<<4,Ci[$i]=((65280&Oi)>>>8|(255&Oi)<<8)>>>1}var Mi=function(to,ue,eo){for(var no=to.length,ro=0,oo=new ki(ue);ro<no;++ro)++oo[to[ro]-1];var io,ao=new ki(ue);for(ro=0;ro<ue;++ro)ao[ro]=ao[ro-1]+oo[ro-1]<<1;if(eo){io=new ki(1<<ue);var so=15-ue;for(ro=0;ro<no;++ro)if(to[ro])for(var lo=ro<<4|to[ro],co=ue-to[ro],uo=ao[to[ro]-1]++<<co,fo=uo|(1<<co)-1;uo<=fo;++uo)io[Ci[uo]>>>so]=lo}else for(io=new ki(no),ro=0;ro<no;++ro)io[ro]=Ci[ao[to[ro]-1]++]>>>15-to[ro];return io},Ai$1=new bi(288);for($i=0;$i<144;++$i)Ai$1[$i]=8;for($i=144;$i<256;++$i)Ai$1[$i]=9;for($i=256;$i<280;++$i)Ai$1[$i]=7;for($i=280;$i<288;++$i)Ai$1[$i]=8;var Li=new bi(32);for($i=0;$i<32;++$i)Li[$i]=5;var Di=Mi(Ai$1,9,0),qi=Mi(Li,5,0),Ni=function(to){return(to/8>>0)+(7&to&&1)},Bi=function(to,ue,eo){(ue==null||ue<0)&&(ue=0),(eo==null||eo>to.length)&&(eo=to.length);var no=new(to instanceof ki?ki:to instanceof wi?wi:bi)(eo-ue);return no.set(to.subarray(ue,eo)),no},Hi=function(to,ue,eo){eo<<=7&ue;var no=ue/8>>0;to[no]|=eo,to[no+1]|=eo>>>8},Ui=function(to,ue,eo){eo<<=7&ue;var no=ue/8>>0;to[no]|=eo,to[no+1]|=eo>>>8,to[no+2]|=eo>>>16},ji=function(to,ue){for(var eo=[],no=0;no<to.length;++no)to[no]&&eo.push({s:no,f:to[no]});var ro=eo.length,oo=eo.slice();if(!ro)return[new bi(0),0];if(ro==1){var io=new bi(eo[0].s+1);return io[eo[0].s]=1,[io,1]}eo.sort(function(ko,So){return ko.f-So.f}),eo.push({s:-1,f:25001});var ao=eo[0],so=eo[1],lo=0,co=1,uo=2;for(eo[0]={s:-1,f:ao.f+so.f,l:ao,r:so};co!=ro-1;)ao=eo[eo[lo].f<eo[uo].f?lo++:uo++],so=eo[lo!=co&&eo[lo].f<eo[uo].f?lo++:uo++],eo[co++]={s:-1,f:ao.f+so.f,l:ao,r:so};var fo=oo[0].s;for(no=1;no<ro;++no)oo[no].s>fo&&(fo=oo[no].s);var po=new ki(fo+1),ho=Gi(eo[co-1],po,0);if(ho>ue){no=0;var _o=0,go=ho-ue,bo=1<<go;for(oo.sort(function(ko,So){return po[So.s]-po[ko.s]||ko.f-So.f});no<ro;++no){var vo=oo[no].s;if(!(po[vo]>ue))break;_o+=bo-(1<<ho-po[vo]),po[vo]=ue}for(_o>>>=go;_o>0;){var yo=oo[no].s;po[yo]<ue?_o-=1<<ue-po[yo]++-1:++no}for(;no>=0&&_o;--no){var $o=oo[no].s;po[$o]==ue&&(--po[$o],++_o)}ho=ue}return[new bi(po),ho]},Gi=function to(ue,eo,no){return ue.s==-1?Math.max(to(ue.l,eo,no+1),to(ue.r,eo,no+1)):eo[ue.s]=no},Wi=function(to){for(var ue=to.length;ue&&!to[--ue];);for(var eo=new ki(++ue),no=0,ro=to[0],oo=1,io=function(so){eo[no++]=so},ao=1;ao<=ue;++ao)if(to[ao]==ro&&ao!=ue)++oo;else{if(!ro&&oo>2){for(;oo>138;oo-=138)io(32754);oo>2&&(io(oo>10?oo-11<<5|28690:oo-3<<5|12305),oo=0)}else if(oo>3){for(io(ro),--oo;oo>6;oo-=6)io(8304);oo>2&&(io(oo-3<<5|8208),oo=0)}for(;oo--;)io(ro);oo=1,ro=to[ao]}return[eo.subarray(0,no),ue]},Vi=function(to,ue){for(var eo=0,no=0;no<ue.length;++no)eo+=to[no]*ue[no];return eo},zi=function(to,ue,eo){var no=eo.length,ro=Ni(ue+2);to[ro]=255&no,to[ro+1]=no>>>8,to[ro+2]=255^to[ro],to[ro+3]=255^to[ro+1];for(var oo=0;oo<no;++oo)to[ro+oo+4]=eo[oo];return 8*(ro+4+no)},Qi=function(to,ue,eo,no,ro,oo,io,ao,so,lo,co){Hi(ue,co++,eo),++ro[256];for(var uo=ji(ro,15),fo=uo[0],po=uo[1],ho=ji(oo,15),_o=ho[0],go=ho[1],bo=Wi(fo),vo=bo[0],yo=bo[1],$o=Wi(_o),ko=$o[0],So=$o[1],Ao=new ki(19),Mo=0;Mo<vo.length;++Mo)Ao[31&vo[Mo]]++;for(Mo=0;Mo<ko.length;++Mo)Ao[31&ko[Mo]]++;for(var Eo=ji(Ao,7),To=Eo[0],Io=Eo[1],No=19;No>4&&!To[Ii[No-1]];--No);var xo,zo,Po,Bo,qo=lo+5<<3,Fo=Vi(ro,Ai$1)+Vi(oo,Li)+io,Wo=Vi(ro,fo)+Vi(oo,_o)+io+14+3*No+Vi(Ao,To)+(2*Ao[16]+3*Ao[17]+7*Ao[18]);if(qo<=Fo&&qo<=Wo)return zi(ue,co,to.subarray(so,so+lo));if(Hi(ue,co,1+(Wo<Fo)),co+=2,Wo<Fo){xo=Mi(fo,po,0),zo=fo,Po=Mi(_o,go,0),Bo=_o;var Go=Mi(To,Io,0);for(Hi(ue,co,yo-257),Hi(ue,co+5,So-1),Hi(ue,co+10,No-4),co+=14,Mo=0;Mo<No;++Mo)Hi(ue,co+3*Mo,To[Ii[Mo]]);co+=3*No;for(var Yo=[vo,ko],Xo=0;Xo<2;++Xo){var Qo=Yo[Xo];for(Mo=0;Mo<Qo.length;++Mo){var Jo=31&Qo[Mo];Hi(ue,co,Go[Jo]),co+=To[Jo],Jo>15&&(Hi(ue,co,Qo[Mo]>>>5&127),co+=Qo[Mo]>>>12)}}}else xo=Di,zo=Ai$1,Po=qi,Bo=Li;for(Mo=0;Mo<ao;++Mo)if(no[Mo]>255){Jo=no[Mo]>>>18&31,Ui(ue,co,xo[Jo+257]),co+=zo[Jo+257],Jo>7&&(Hi(ue,co,no[Mo]>>>23&31),co+=Si[Jo]);var na=31&no[Mo];Ui(ue,co,Po[na]),co+=Bo[na],na>3&&(Ui(ue,co,no[Mo]>>>5&8191),co+=Ei[na])}else Ui(ue,co,xo[no[Mo]]),co+=zo[no[Mo]];return Ui(ue,co,xo[256]),co+zo[256]},Ji=new wi([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Yi=new bi(0),Xi=function(){for(var to=new wi(256),ue=0;ue<256;++ue){for(var eo=ue,no=9;--no;)eo=(1&eo&&3988292384)^eo>>>1;to[ue]=eo}return to}(),Ki=function(to,ue,eo,no,ro){return function(oo,io,ao,so,lo,co){var uo=oo.length,fo=new bi(so+uo+5*(1+Math.floor(uo/7e3))+lo),po=fo.subarray(so,fo.length-lo),ho=0;if(!io||uo<8)for(var _o=0;_o<=uo;_o+=65535){var go=_o+65535;go<uo?ho=zi(po,ho,oo.subarray(_o,go)):(po[_o]=co,ho=zi(po,ho,oo.subarray(_o,uo)))}else{for(var bo=Ji[io-1],vo=bo>>>13,yo=8191&bo,$o=(1<<ao)-1,ko=new ki(32768),So=new ki($o+1),Ao=Math.ceil(ao/3),Mo=2*Ao,Eo=function(Sa){return(oo[Sa]^oo[Sa+1]<<Ao^oo[Sa+2]<<Mo)&$o},To=new wi(25e3),Io=new ki(288),No=new ki(32),xo=0,zo=0,Po=(_o=0,0),Bo=0,qo=0;_o<uo;++_o){var Fo=Eo(_o),Wo=32767&_o,Go=So[Fo];if(ko[Wo]=Go,So[Fo]=Wo,Bo<=_o){var Yo=uo-_o;if((xo>7e3||Po>24576)&&Yo>423){ho=Qi(oo,po,0,To,Io,No,zo,Po,qo,_o-qo,ho),Po=xo=zo=0,qo=_o;for(var Xo=0;Xo<286;++Xo)Io[Xo]=0;for(Xo=0;Xo<30;++Xo)No[Xo]=0}var Qo=2,Jo=0,na=yo,Ko=Wo-Go&32767;if(Yo>2&&Fo==Eo(_o-Ko))for(var ia=Math.min(vo,Yo)-1,ea=Math.min(32767,_o),sa=Math.min(258,Yo);Ko<=ea&&--na&&Wo!=Go;){if(oo[_o+Qo]==oo[_o+Qo-Ko]){for(var Aa=0;Aa<sa&&oo[_o+Aa]==oo[_o+Aa-Ko];++Aa);if(Aa>Qo){if(Qo=Aa,Jo=Ko,Aa>ia)break;var pa=Math.min(Ko,Aa-2),va=0;for(Xo=0;Xo<pa;++Xo){var ha=_o-Ko+Xo+32768&32767,La=ha-ko[ha]+32768&32767;La>va&&(va=La,Go=ha)}}}Ko+=(Wo=Go)-(Go=ko[Wo])+32768&32767}if(Jo){To[Po++]=268435456|Pi[Qo]<<18|Ti[Jo];var Ba=31&Pi[Qo],Ea=31&Ti[Jo];zo+=Si[Ba]+Ei[Ea],++Io[257+Ba],++No[Ea],Bo=_o+Qo,++xo}else To[Po++]=oo[_o],++Io[oo[_o]]}}ho=Qi(oo,po,co,To,Io,No,zo,Po,qo,_o-qo,ho),co||(ho=zi(po,ho,Yi))}return Bi(fo,0,so+Ni(ho)+lo)}(to,ue.level==null?6:ue.level,ue.mem==null?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(to.length)))):12+ue.mem,eo,no,!ro)},Zi=function(to,ue,eo){for(;eo;++ue)to[ue]=eo,eo>>>=8};function er(to,ue){ue===void 0&&(ue={});var eo=function(){var ao=4294967295;return{p:function(so){for(var lo=ao,co=0;co<so.length;++co)lo=Xi[255&lo^so[co]]^lo>>>8;ao=lo},d:function(){return 4294967295^ao}}}(),no=to.length;eo.p(to);var ro,oo=Ki(to,ue,10+((ro=ue).filename&&ro.filename.length+1||0),8),io=oo.length;return function(ao,so){var lo=so.filename;if(ao[0]=31,ao[1]=139,ao[2]=8,ao[8]=so.level<2?4:so.level==9?2:0,ao[9]=3,so.mtime!=0&&Zi(ao,4,Math.floor(new Date(so.mtime||Date.now())/1e3)),lo){ao[3]=8;for(var co=0;co<=lo.length;++co)ao[co+10]=lo.charCodeAt(co)}}(oo,ue),Zi(oo,io-8,eo.d()),Zi(oo,io-4,no),oo}var tr=!!N||!!q,nr="text/plain",ir=function(to,ue){var eo=u(to.split("?"),2),no=eo[0],ro=eo[1],oo=t$1({},ue);ro==null||ro.split("&").forEach(function(ao){var so=u(ao.split("="),1)[0];delete oo[so]});var io=_t(oo);return io=io?(ro?ro+"&":"")+io:ro,"".concat(no,"?").concat(io)},rr=function(to){return"data="+encodeURIComponent(typeof to=="string"?to:JSON.stringify(to))},sr=function(to){var ue=to.data,eo=to.compression;if(ue){if(eo===re.GZipJS){var no=er(function(oo,io){var ao=oo.length;if(!io&&typeof TextEncoder<"u")return new TextEncoder().encode(oo);for(var so=new bi(oo.length+(oo.length>>>1)),lo=0,co=function(ho){so[lo++]=ho},uo=0;uo<ao;++uo){if(lo+5>so.length){var fo=new bi(lo+8+(ao-uo<<1));fo.set(so),so=fo}var po=oo.charCodeAt(uo);po<128||io?co(po):po<2048?(co(192|po>>>6),co(128|63&po)):po>55295&&po<57344?(co(240|(po=65536+(1047552&po)|1023&oo.charCodeAt(++uo))>>>18),co(128|po>>>12&63),co(128|po>>>6&63),co(128|63&po)):(co(224|po>>>12),co(128|po>>>6&63),co(128|63&po))}return Bi(so,0,lo)}(JSON.stringify(ue)),{mtime:0});return{contentType:nr,body:new Blob([no],{type:nr})}}if(eo===re.Base64){var ro=function(oo){var io,ao,so,lo,co,uo="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",fo=0,po=0,ho="",_o=[];if(!oo)return oo;oo=se(oo);do io=(co=oo.charCodeAt(fo++)<<16|oo.charCodeAt(fo++)<<8|oo.charCodeAt(fo++))>>18&63,ao=co>>12&63,so=co>>6&63,lo=63&co,_o[po++]=uo.charAt(io)+uo.charAt(ao)+uo.charAt(so)+uo.charAt(lo);while(fo<oo.length);switch(ho=_o.join(""),oo.length%3){case 1:ho=ho.slice(0,-2)+"==";break;case 2:ho=ho.slice(0,-1)+"="}return ho}(JSON.stringify(ue));return{contentType:"application/x-www-form-urlencoded",body:rr(ro)}}return{contentType:"application/json",body:JSON.stringify(ue)}}},or=[];N&&or.push({transport:"XHR",method:function(to){var ue,eo=new N;eo.open(to.method||"GET",to.url,!0);var no=(ue=sr(to))!==null&&ue!==void 0?ue:{},ro=no.contentType,oo=no.body;Q(to.headers,function(io,ao){eo.setRequestHeader(ao,io)}),ro&&eo.setRequestHeader("Content-Type",ro),to.timeout&&(eo.timeout=to.timeout),eo.withCredentials=!0,eo.onreadystatechange=function(){if(eo.readyState===4){var io,ao={statusCode:eo.status,text:eo.responseText};if(eo.status===200)try{ao.json=JSON.parse(eo.responseText)}catch{}(io=to.callback)===null||io===void 0||io.call(to,ao)}},eo.send(oo)}}),q&&or.push({transport:"fetch",method:function(to){var ue,eo,no=(ue=sr(to))!==null&&ue!==void 0?ue:{},ro=no.contentType,oo=no.body,io=new Headers;Q(to.headers,function(co,uo){io.append(uo,co)}),ro&&io.append("Content-Type",ro);var ao=to.url,so=null;if(B){var lo=new B;so={signal:lo.signal,timeout:setTimeout(function(){return lo.abort()},to.timeout)}}q(ao,{method:(to==null?void 0:to.method)||"GET",headers:io,keepalive:to.method==="POST",body:oo,signal:(eo=so)===null||eo===void 0?void 0:eo.signal}).then(function(co){return co.text().then(function(uo){var fo,po={statusCode:co.status,text:uo};if(co.status===200)try{po.json=JSON.parse(uo)}catch(ho){G.error(ho)}(fo=to.callback)===null||fo===void 0||fo.call(to,po)})}).catch(function(co){var uo;G.error(co),(uo=to.callback)===null||uo===void 0||uo.call(to,{statusCode:0,text:co})}).finally(function(){return so?clearTimeout(so.timeout):null})}}),A!=null&&A.sendBeacon&&or.push({transport:"sendBeacon",method:function(to){var ue=ir(to.url,{beacon:"1"});try{var eo,no=(eo=sr(to))!==null&&eo!==void 0?eo:{},ro=no.contentType,oo=no.body,io=typeof oo=="string"?new Blob([oo],{type:ro}):oo;A.sendBeacon(ue,io)}catch{}}});var ar=["retriesPerformedSoFar"],ur,lr=function(){function to(ue){var eo=this;i$1(this,to),o(this,"isPolling",!1),o(this,"pollIntervalMs",3e3),o(this,"queue",[]),this.instance=ue,this.queue=[],this.areWeOnline=!0,!w$1(T)&&"onLine"in T.navigator&&(this.areWeOnline=T.navigator.onLine,T.addEventListener("online",function(){eo.areWeOnline=!0,eo.flush()}),T.addEventListener("offline",function(){eo.areWeOnline=!1}))}return s(to,[{key:"retriableRequest",value:function(ue){var eo=this,no=ue.retriesPerformedSoFar,ro=a(ue,ar);F(no)&&no>0&&(ro.url=ir(ro.url,{retry_count:no})),this.instance._send_request(t$1(t$1({},ro),{},{callback:function(oo){var io;oo.statusCode!==200&&(oo.statusCode<400||oo.statusCode>=500)&&(no??0)<10?eo.enqueue(t$1({retriesPerformedSoFar:no},ro)):(io=ro.callback)===null||io===void 0||io.call(ro,oo)}}))}},{key:"enqueue",value:function(ue){var eo=ue.retriesPerformedSoFar||0;ue.retriesPerformedSoFar=eo+1;var no=function(io){var ao=3e3*Math.pow(2,io),so=ao/2,lo=Math.min(18e5,ao),co=(Math.random()-.5)*(lo-so);return Math.ceil(lo+co)}(eo),ro=Date.now()+no;this.queue.push({retryAt:ro,requestOptions:ue});var oo="Enqueued failed request for retry in ".concat(no);navigator.onLine||(oo+=" (Browser is offline)"),G.warn(oo),this.isPolling||(this.isPolling=!0,this.poll())}},{key:"poll",value:function(){var ue=this;this.poller&&clearTimeout(this.poller),this.poller=setTimeout(function(){ue.areWeOnline&&ue.queue.length>0&&ue.flush(),ue.poll()},this.pollIntervalMs)}},{key:"flush",value:function(){var ue=Date.now(),eo=[],no=this.queue.filter(function(ao){return ao.retryAt<ue||(eo.push(ao),!1)});if(this.queue=eo,no.length>0){var ro,oo=h(no);try{for(oo.s();!(ro=oo.n()).done;){var io=ro.value.requestOptions;this.retriableRequest(io)}}catch(ao){oo.e(ao)}finally{oo.f()}}}},{key:"unload",value:function(){this.poller&&(clearTimeout(this.poller),this.poller=void 0);var ue,eo=h(this.queue);try{for(eo.s();!(ue=eo.n()).done;){var no=ue.value.requestOptions;try{this.instance._send_request(t$1(t$1({},no),{},{transport:"sendBeacon"}))}catch(ro){G.error(ro)}}}catch(ro){eo.e(ro)}finally{eo.f()}this.queue=[]}}]),to}(),cr=1800,dr=function(){function to(ue,eo,no,ro){var oo;i$1(this,to),o(this,"_sessionIdChangedHandlers",[]),this.config=ue,this.persistence=eo,this._windowId=void 0,this._sessionId=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this._sessionIdGenerator=no||Ke,this._windowIdGenerator=ro||Ke;var io=ue.persistence_name||ue.token,ao=ue.session_idle_timeout_seconds||cr;if(F(ao)?ao>cr?G.warn("session_idle_timeout_seconds cannot be greater than 30 minutes. Using 30 minutes instead."):ao<60&&G.warn("session_idle_timeout_seconds cannot be less than 60 seconds. Using 60 seconds instead."):(G.warn("session_idle_timeout_seconds must be a number. Defaulting to 30 minutes."),ao=cr),this._sessionTimeoutMs=1e3*Math.min(Math.max(ao,60),cr),this._window_id_storage_key="ph_"+io+"_window_id",this._primary_window_exists_storage_key="ph_"+io+"_primary_window_exists",this._canUseSessionStorage()){var so=ft.parse(this._window_id_storage_key),lo=ft.parse(this._primary_window_exists_storage_key);so&&!lo?this._windowId=so:ft.remove(this._window_id_storage_key),ft.set(this._primary_window_exists_storage_key,!0)}if((oo=this.config.bootstrap)!==null&&oo!==void 0&&oo.sessionID)try{var co=function(uo){var fo=uo.replace(/-/g,"");if(fo.length!==32)throw new Error("Not a valid UUID");if(fo[12]!=="7")throw new Error("Not a UUIDv7");return parseInt(fo.substring(0,12),16)}(this.config.bootstrap.sessionID);this._setSessionId(this.config.bootstrap.sessionID,new Date().getTime(),co)}catch(uo){G.error("Invalid sessionID in bootstrap",uo)}this._listenToReloadWindow()}return s(to,[{key:"onSessionId",value:function(ue){var eo=this;return w$1(this._sessionIdChangedHandlers)&&(this._sessionIdChangedHandlers=[]),this._sessionIdChangedHandlers.push(ue),this._sessionId&&ue(this._sessionId,this._windowId),function(){eo._sessionIdChangedHandlers=eo._sessionIdChangedHandlers.filter(function(no){return no!==ue})}}},{key:"_canUseSessionStorage",value:function(){return this.config.persistence!=="memory"&&!this.persistence.disabled&&ft.is_supported()}},{key:"_setWindowId",value:function(ue){ue!==this._windowId&&(this._windowId=ue,this._canUseSessionStorage()&&ft.set(this._window_id_storage_key,ue))}},{key:"_getWindowId",value:function(){return this._windowId?this._windowId:this._canUseSessionStorage()?ft.parse(this._window_id_storage_key):null}},{key:"_setSessionId",value:function(ue,eo,no){ue===this._sessionId&&eo===this._sessionActivityTimestamp&&no===this._sessionStartTimestamp||(this._sessionStartTimestamp=no,this._sessionActivityTimestamp=eo,this._sessionId=ue,this.persistence.register(o({},Se,[eo,ue,no])))}},{key:"_getSessionId",value:function(){if(this._sessionId&&this._sessionActivityTimestamp&&this._sessionStartTimestamp)return[this._sessionActivityTimestamp,this._sessionId,this._sessionStartTimestamp];var ue=this.persistence.props[Se];return m(ue)&&ue.length===2&&ue.push(ue[0]),ue||[0,null,0]}},{key:"resetSessionId",value:function(){this._setSessionId(null,null,null)}},{key:"_listenToReloadWindow",value:function(){var ue=this;T==null||T.addEventListener("beforeunload",function(){ue._canUseSessionStorage()&&ft.remove(ue._primary_window_exists_storage_key)})}},{key:"checkAndGetSessionAndWindowId",value:function(){var ue=arguments.length>0&&arguments[0]!==void 0&&arguments[0],eo=(arguments.length>1&&arguments[1]!==void 0?arguments[1]:null)||new Date().getTime(),no=u(this._getSessionId(),3),ro=no[0],oo=no[1],io=no[2],ao=this._getWindowId(),so=io&&io>0&&Math.abs(eo-io)>864e5,lo=!1,co=!oo,uo=!ue&&Math.abs(eo-ro)>this._sessionTimeoutMs;co||uo||so?(oo=this._sessionIdGenerator(),ao=this._windowIdGenerator(),G.info("[SessionId] new session ID generated",{sessionId:oo,windowId:ao,changeReason:{noSessionId:co,activityTimeout:uo,sessionPastMaximumLength:so}}),io=eo,lo=!0):ao||(ao=this._windowIdGenerator(),lo=!0);var fo=ro===0||!ue||so?eo:ro,po=io===0?new Date().getTime():io;return this._setWindowId(ao),this._setSessionId(oo,fo,po),lo&&this._sessionIdChangedHandlers.forEach(function(ho){return ho(oo,ao)}),{sessionId:oo,windowId:ao,sessionStartTimestamp:po}}}]),to}();(function(to){to.US="us",to.EU="eu",to.CUSTOM="custom"})(ur||(ur={}));var hr="i.posthog.com",fr=function(){function to(ue){i$1(this,to),o(this,"_regionCache",{}),this.instance=ue}return s(to,[{key:"apiHost",get:function(){var ue=this.instance.config.api_host.trim().replace(/\/$/,"");return ue==="https://app.posthog.com"?"https://us.i.posthog.com":ue}},{key:"uiHost",get:function(){var ue,eo=(ue=this.instance.config.ui_host)===null||ue===void 0?void 0:ue.replace(/\/$/,"");return eo||(eo=this.apiHost.replace(".".concat(hr),".posthog.com")),eo==="https://app.posthog.com"?"https://us.posthog.com":eo}},{key:"region",get:function(){return this._regionCache[this.apiHost]||(/https:\/\/(app|us|us-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this._regionCache[this.apiHost]=ur.US:/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this._regionCache[this.apiHost]=ur.EU:this._regionCache[this.apiHost]=ur.CUSTOM),this._regionCache[this.apiHost]}},{key:"endpointFor",value:function(ue){var eo=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";if(eo&&(eo=eo[0]==="/"?eo:"/".concat(eo)),ue==="ui")return this.uiHost+eo;if(this.region===ur.CUSTOM)return this.apiHost+eo;var no=hr+eo;switch(ue){case"assets":return"https://".concat(this.region,"-assets.").concat(no);case"api":return"https://".concat(this.region,".").concat(no)}}},{key:"loadScript",value:function(ue,eo){if(this.instance.config.disable_external_dependency_loading)return G.warn("".concat(ue," was requested but loading of external scripts is disabled.")),eo("Loading of external scripts is disabled");var no=ue[0]==="/"?this.endpointFor("assets",ue):ue,ro=function(){if(!L)return eo("document not found");var oo=L.createElement("script");oo.type="text/javascript",oo.src=no,oo.onload=function(so){return eo(void 0,so)},oo.onerror=function(so){return eo(so)};var io,ao=L.querySelectorAll("body > script");ao.length>0?(io=ao[0].parentNode)===null||io===void 0||io.insertBefore(oo,ao[0]):L.body.appendChild(oo)};L!=null&&L.body?ro():L==null||L.addEventListener("DOMContentLoaded",ro)}}]),to}(),vr="posthog-js";function pr(to){var ue=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},eo=ue.organization,no=ue.projectId,ro=ue.prefix,oo=ue.severityAllowList,io=oo===void 0?["error"]:oo;return function(ao){var so,lo,co,uo,fo;if(!(io==="*"||io.includes(ao.level))||!to.__loaded)return ao;ao.tags||(ao.tags={});var po=to.requestRouter.endpointFor("ui","/project/".concat(to.config.token,"/person/").concat(to.get_distinct_id()));ao.tags["PostHog Person URL"]=po,to.sessionRecordingStarted()&&(ao.tags["PostHog Recording URL"]=to.get_session_replay_url({withTimestamp:!0}));var ho=((so=ao.exception)===null||so===void 0?void 0:so.values)||[],_o={$exception_message:((lo=ho[0])===null||lo===void 0?void 0:lo.value)||ao.message,$exception_type:(co=ho[0])===null||co===void 0?void 0:co.type,$exception_personURL:po,$exception_level:ao.level,$sentry_event_id:ao.event_id,$sentry_exception:ao.exception,$sentry_exception_message:((uo=ho[0])===null||uo===void 0?void 0:uo.value)||ao.message,$sentry_exception_type:(fo=ho[0])===null||fo===void 0?void 0:fo.type,$sentry_tags:ao.tags,$level:ao.level};return eo&&no&&(_o.$sentry_url=(ro||"https://sentry.io/organizations/")+eo+"/issues/?project="+no+"&query="+ao.event_id),to.exceptions.sendExceptionEvent(_o),ao}}var gr=s(function to(ue,eo,no,ro,oo){i$1(this,to),this.name=vr,this.setupOnce=function(io){io(pr(ue,{organization:eo,projectId:no,prefix:ro,severityAllowList:oo}))}});function _r(to,ue){var eo=to.config.segment;if(!eo)return ue();(function(no,ro){var oo=no.config.segment;if(!oo)return ro();var io=function(so){var lo=function(){return so.anonymousId()||Ke()};no.config.get_device_id=lo,so.id()&&(no.register({distinct_id:so.id(),$device_id:lo()}),no.persistence.set_property($e,"identified")),ro()},ao=oo.user();"then"in ao&&y(ao.then)?ao.then(function(so){return io(so)}):io(ao)})(to,function(){eo.register(function(no){Promise&&Promise.resolve||G.warn("This browser does not have Promise support, and can not use the segment integration");var ro=function(oo,io){var ao;if(!io)return oo;oo.event.userId||oo.event.anonymousId===no.get_distinct_id()||(G.info("Segment integration does not have a userId set, resetting PostHog"),no.reset()),oo.event.userId&&oo.event.userId!==no.get_distinct_id()&&(G.info("Segment integration has a userId set, identifying with PostHog"),no.identify(oo.event.userId));var so=no._calculate_event_properties(io,(ao=oo.event.properties)!==null&&ao!==void 0?ao:{},new Date);return oo.event.properties=Object.assign({},so,oo.event.properties),oo};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:function(){return!0},load:function(){return Promise.resolve()},track:function(oo){return ro(oo,oo.event.event)},page:function(oo){return ro(oo,"$pageview")},identify:function(oo){return ro(oo,"$identify")},screen:function(oo){return ro(oo,"$screen")}}}(to)).then(function(){ue()})})}var mr,yr,br,kr=function(){function to(ue){i$1(this,to),this._instance=ue}return s(to,[{key:"doPageView",value:function(ue){var eo,no=this._previousPageViewProperties(ue);return this._currentPath=(eo=T==null?void 0:T.location.pathname)!==null&&eo!==void 0?eo:"",this._instance.scrollManager.resetContext(),this._prevPageviewTimestamp=ue,no}},{key:"doPageLeave",value:function(ue){return this._previousPageViewProperties(ue)}},{key:"_previousPageViewProperties",value:function(ue){var eo=this._currentPath,no=this._prevPageviewTimestamp,ro=this._instance.scrollManager.getContext();if(!no)return{};var oo={};if(ro){var io=ro.maxScrollHeight,ao=ro.lastScrollY,so=ro.maxScrollY,lo=ro.maxContentHeight,co=ro.lastContentY,uo=ro.maxContentY;w$1(io)||w$1(ao)||w$1(so)||w$1(lo)||w$1(co)||w$1(uo)||(io=Math.ceil(io),ao=Math.ceil(ao),so=Math.ceil(so),lo=Math.ceil(lo),co=Math.ceil(co),uo=Math.ceil(uo),oo={$prev_pageview_last_scroll:ao,$prev_pageview_last_scroll_percentage:io<=1?1:wr(ao/io,0,1),$prev_pageview_max_scroll:so,$prev_pageview_max_scroll_percentage:io<=1?1:wr(so/io,0,1),$prev_pageview_last_content:co,$prev_pageview_last_content_percentage:lo<=1?1:wr(co/lo,0,1),$prev_pageview_max_content:uo,$prev_pageview_max_content_percentage:lo<=1?1:wr(uo/lo,0,1)})}return eo&&(oo.$prev_pageview_pathname=eo),no&&(oo.$prev_pageview_duration=(ue.getTime()-no.getTime())/1e3),oo}}]),to}();function wr(to,ue,eo){return Math.max(ue,Math.min(to,eo))}(function(to){to.Popover="popover",to.API="api",to.Widget="widget"})(mr||(mr={})),function(to){to.Open="open",to.MultipleChoice="multiple_choice",to.SingleChoice="single_choice",to.Rating="rating",to.Link="link"}(yr||(yr={})),function(to){to.NextQuestion="next_question",to.End="end",to.ResponseBased="response_based",to.SpecificQuestion="specific_question"}(br||(br={}));var Sr=function(){function to(){i$1(this,to),o(this,"events",{}),this.events={}}return s(to,[{key:"on",value:function(ue,eo){var no=this;return this.events[ue]||(this.events[ue]=[]),this.events[ue].push(eo),function(){no.events[ue]=no.events[ue].filter(function(ro){return ro!==eo})}}},{key:"emit",value:function(ue,eo){var no,ro=h(this.events[ue]||[]);try{for(ro.s();!(no=ro.n()).done;)(0,no.value)(eo)}catch(ao){ro.e(ao)}finally{ro.f()}var oo,io=h(this.events["*"]||[]);try{for(io.s();!(oo=io.n()).done;)(0,oo.value)(ue,eo)}catch(ao){io.e(ao)}finally{io.f()}}}]),to}(),Er=function(){function to(ue){var eo=this;i$1(this,to),o(this,"_debugEventEmitter",new Sr),o(this,"checkStep",function(no,ro){return eo.checkStepEvent(no,ro)&&eo.checkStepUrl(no,ro)&&eo.checkStepElement(no,ro)}),o(this,"checkStepEvent",function(no,ro){return ro==null||!ro.event||(no==null?void 0:no.event)===(ro==null?void 0:ro.event)}),this.instance=ue,this.actionEvents=new Set,this.actionRegistry=new Set}return s(to,[{key:"init",value:function(){var ue,eo=this;if(!w$1((ue=this.instance)===null||ue===void 0?void 0:ue._addCaptureHook)){var no;(no=this.instance)===null||no===void 0||no._addCaptureHook(function(ro,oo){eo.on(ro,oo)})}}},{key:"register",value:function(ue){var eo,no,ro=this;if(!w$1((eo=this.instance)===null||eo===void 0?void 0:eo._addCaptureHook)&&(ue.forEach(function(ao){var so,lo;(so=ro.actionRegistry)===null||so===void 0||so.add(ao),(lo=ao.steps)===null||lo===void 0||lo.forEach(function(co){var uo;(uo=ro.actionEvents)===null||uo===void 0||uo.add((co==null?void 0:co.event)||"")})}),(no=this.instance)!==null&&no!==void 0&&no.autocapture)){var oo,io=new Set;ue.forEach(function(ao){var so;(so=ao.steps)===null||so===void 0||so.forEach(function(lo){lo!=null&&lo.selector&&io.add(lo==null?void 0:lo.selector)})}),(oo=this.instance)===null||oo===void 0||oo.autocapture.setElementSelectors(io)}}},{key:"on",value:function(ue,eo){var no,ro=this;eo!=null&&ue.length!=0&&(this.actionEvents.has(ue)||this.actionEvents.has(eo==null?void 0:eo.event))&&this.actionRegistry&&((no=this.actionRegistry)===null||no===void 0?void 0:no.size)>0&&this.actionRegistry.forEach(function(oo){ro.checkAction(eo,oo)&&ro._debugEventEmitter.emit("actionCaptured",oo.name)})}},{key:"_addActionHook",value:function(ue){this.onAction("actionCaptured",function(eo){return ue(eo)})}},{key:"checkAction",value:function(ue,eo){if((eo==null?void 0:eo.steps)==null)return!1;var no,ro=h(eo.steps);try{for(ro.s();!(no=ro.n()).done;){var oo=no.value;if(this.checkStep(ue,oo))return!0}}catch(io){ro.e(io)}finally{ro.f()}return!1}},{key:"onAction",value:function(ue,eo){return this._debugEventEmitter.on(ue,eo)}},{key:"checkStepUrl",value:function(ue,eo){if(eo!=null&&eo.url){var no,ro=ue==null||(no=ue.properties)===null||no===void 0?void 0:no.$current_url;if(!ro||typeof ro!="string"||!to.matchString(ro,eo==null?void 0:eo.url,(eo==null?void 0:eo.url_matching)||"contains"))return!1}return!0}},{key:"checkStepElement",value:function(ue,eo){if((eo!=null&&eo.href||eo!=null&&eo.tag_name||eo!=null&&eo.text)&&!this.getElementsList(ue).some(function(oo){return!(eo!=null&&eo.href&&!to.matchString(oo.href||"",eo==null?void 0:eo.href,(eo==null?void 0:eo.href_matching)||"exact"))&&(eo==null||!eo.tag_name||oo.tag_name===(eo==null?void 0:eo.tag_name))&&!(eo!=null&&eo.text&&!to.matchString(oo.text||"",eo==null?void 0:eo.text,(eo==null?void 0:eo.text_matching)||"exact")&&!to.matchString(oo.$el_text||"",eo==null?void 0:eo.text,(eo==null?void 0:eo.text_matching)||"exact"))}))return!1;if(eo!=null&&eo.selector){var no,ro=ue==null||(no=ue.properties)===null||no===void 0?void 0:no.$element_selectors;if(!ro||!ro.includes(eo==null?void 0:eo.selector))return!1}return!0}},{key:"getElementsList",value:function(ue){return(ue==null?void 0:ue.properties.$elements)==null?[]:ue==null?void 0:ue.properties.$elements}}],[{key:"matchString",value:function(ue,eo,no){switch(no){case"regex":return!!T&>(ue,eo);case"exact":return eo===ue;case"contains":var ro=to.escapeStringRegexp(eo).replace(/_/g,".").replace(/%/g,".*");return gt(ue,ro);default:return!1}}},{key:"escapeStringRegexp",value:function(ue){return ue.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}}]),to}(),Ir=function(){function to(ue){i$1(this,to),this.instance=ue,this.eventToSurveys=new Map,this.actionToSurveys=new Map}return s(to,[{key:"register",value:function(ue){var eo;w$1((eo=this.instance)===null||eo===void 0?void 0:eo._addCaptureHook)||(this.setupEventBasedSurveys(ue),this.setupActionBasedSurveys(ue))}},{key:"setupActionBasedSurveys",value:function(ue){var eo=this,no=ue.filter(function(ro){var oo,io,ao,so;return((oo=ro.conditions)===null||oo===void 0?void 0:oo.actions)&&((io=ro.conditions)===null||io===void 0||(ao=io.actions)===null||ao===void 0||(so=ao.values)===null||so===void 0?void 0:so.length)>0});no.length!==0&&(this.actionMatcher==null&&(this.actionMatcher=new Er(this.instance),this.actionMatcher.init(),this.actionMatcher._addActionHook(function(ro){eo.onAction(ro)})),no.forEach(function(ro){var oo,io,ao,so,lo,co,uo,fo,po,ho;ro.conditions&&(oo=ro.conditions)!==null&&oo!==void 0&&oo.actions&&(io=ro.conditions)!==null&&io!==void 0&&(ao=io.actions)!==null&&ao!==void 0&&ao.values&&((so=ro.conditions)===null||so===void 0||(lo=so.actions)===null||lo===void 0||(co=lo.values)===null||co===void 0?void 0:co.length)>0&&((uo=eo.actionMatcher)===null||uo===void 0||uo.register(ro.conditions.actions.values),(fo=ro.conditions)===null||fo===void 0||(po=fo.actions)===null||po===void 0||(ho=po.values)===null||ho===void 0||ho.forEach(function(_o){if(_o&&_o.name){var go=eo.actionToSurveys.get(_o.name);go&&go.push(ro.id),eo.actionToSurveys.set(_o.name,go||[ro.id])}}))}))}},{key:"setupEventBasedSurveys",value:function(ue){var eo,no=this;ue.filter(function(ro){var oo,io,ao,so;return((oo=ro.conditions)===null||oo===void 0?void 0:oo.events)&&((io=ro.conditions)===null||io===void 0||(ao=io.events)===null||ao===void 0||(so=ao.values)===null||so===void 0?void 0:so.length)>0}).length!==0&&((eo=this.instance)===null||eo===void 0||eo._addCaptureHook(function(ro,oo){no.onEvent(ro,oo)}),ue.forEach(function(ro){var oo,io,ao;(oo=ro.conditions)===null||oo===void 0||(io=oo.events)===null||io===void 0||(ao=io.values)===null||ao===void 0||ao.forEach(function(so){if(so&&so.name){var lo=no.eventToSurveys.get(so.name);lo&&lo.push(ro.id),no.eventToSurveys.set(so.name,lo||[ro.id])}})}))}},{key:"onEvent",value:function(ue,eo){var no,ro,oo=((no=this.instance)===null||no===void 0||(ro=no.persistence)===null||ro===void 0?void 0:ro.props[Te])||[];if(to.SURVEY_SHOWN_EVENT_NAME==ue&&eo&&oo.length>0){var io,ao=eo==null||(io=eo.properties)===null||io===void 0?void 0:io.$survey_id;if(ao){var so=oo.indexOf(ao);so>=0&&(oo.splice(so,1),this._updateActivatedSurveys(oo))}}else this.eventToSurveys.has(ue)&&this._updateActivatedSurveys(oo.concat(this.eventToSurveys.get(ue)||[]))}},{key:"onAction",value:function(ue){var eo,no,ro=((eo=this.instance)===null||eo===void 0||(no=eo.persistence)===null||no===void 0?void 0:no.props[Te])||[];this.actionToSurveys.has(ue)&&this._updateActivatedSurveys(ro.concat(this.actionToSurveys.get(ue)||[]))}},{key:"_updateActivatedSurveys",value:function(ue){var eo,no;(eo=this.instance)===null||eo===void 0||(no=eo.persistence)===null||no===void 0||no.register(o({},Te,l(new Set(ue))))}},{key:"getSurveys",value:function(){var ue,eo,no=(ue=this.instance)===null||ue===void 0||(eo=ue.persistence)===null||eo===void 0?void 0:eo.props[Te];return no||[]}},{key:"getEventToSurveys",value:function(){return this.eventToSurveys}},{key:"_getActionMatcher",value:function(){return this.actionMatcher}}]),to}();o(Ir,"SURVEY_SHOWN_EVENT_NAME","survey shown");var Rr="[Surveys]",Fr={icontains:function(to){return!!T&&T.location.href.toLowerCase().indexOf(to.toLowerCase())>-1},not_icontains:function(to){return!!T&&T.location.href.toLowerCase().indexOf(to.toLowerCase())===-1},regex:function(to){return!!T&>(T.location.href,to)},not_regex:function(to){return!!T&&!gt(T.location.href,to)},exact:function(to){return(T==null?void 0:T.location.href)===to},is_not:function(to){return(T==null?void 0:T.location.href)!==to}},xr=function(){function to(ue){i$1(this,to),this.instance=ue,this._surveyEventReceiver=null}return s(to,[{key:"afterDecideResponse",value:function(ue){this._decideServerResponse=!!ue.surveys,this.loadIfEnabled()}},{key:"loadIfEnabled",value:function(){var ue=this,eo=U==null?void 0:U.extendPostHogWithSurveys;this.instance.config.disable_surveys||!this._decideServerResponse||eo||(this._surveyEventReceiver==null&&(this._surveyEventReceiver=new Ir(this.instance)),this.instance.requestRouter.loadScript("/static/surveys.js",function(no){if(no)return G.error(Rr,"Could not load surveys script",no);ue._surveyManager=U.extendPostHogWithSurveys(ue.instance)}))}},{key:"getSurveys",value:function(ue){var eo=this,no=arguments.length>1&&arguments[1]!==void 0&&arguments[1];if(this.instance.config.disable_surveys)return ue([]);this._surveyEventReceiver==null&&(this._surveyEventReceiver=new Ir(this.instance));var ro=this.instance.get_property(Pe);if(ro&&!no)return ue(ro);this.instance._send_request({url:this.instance.requestRouter.endpointFor("api","/api/surveys/?token=".concat(this.instance.config.token)),method:"GET",transport:"XHR",callback:function(oo){var io;if(oo.statusCode!==200||!oo.json)return ue([]);var ao,so=oo.json.surveys||[],lo=so.filter(function(co){var uo,fo,po,ho,_o,go,bo,vo,yo,$o,ko,So;return((uo=co.conditions)===null||uo===void 0?void 0:uo.events)&&((fo=co.conditions)===null||fo===void 0||(po=fo.events)===null||po===void 0?void 0:po.values)&&((ho=co.conditions)===null||ho===void 0||(_o=ho.events)===null||_o===void 0||(go=_o.values)===null||go===void 0?void 0:go.length)>0||((bo=co.conditions)===null||bo===void 0?void 0:bo.actions)&&((vo=co.conditions)===null||vo===void 0||(yo=vo.actions)===null||yo===void 0?void 0:yo.values)&&(($o=co.conditions)===null||$o===void 0||(ko=$o.actions)===null||ko===void 0||(So=ko.values)===null||So===void 0?void 0:So.length)>0});return lo.length>0&&((ao=eo._surveyEventReceiver)===null||ao===void 0||ao.register(lo)),(io=eo.instance.persistence)===null||io===void 0||io.register(o({},Pe,so)),ue(so)}})}},{key:"getActiveMatchingSurveys",value:function(ue){var eo=this,no=arguments.length>1&&arguments[1]!==void 0&&arguments[1];this.getSurveys(function(ro){var oo,io=ro.filter(function(lo){return!(!lo.start_date||lo.end_date)}).filter(function(lo){var co,uo,fo,po;if(!lo.conditions)return!0;var ho=(co=lo.conditions)===null||co===void 0||!co.url||Fr[(uo=(fo=lo.conditions)===null||fo===void 0?void 0:fo.urlMatchType)!==null&&uo!==void 0?uo:"icontains"](lo.conditions.url),_o=(po=lo.conditions)===null||po===void 0||!po.selector||(L==null?void 0:L.querySelector(lo.conditions.selector));return ho&&_o}),ao=(oo=eo._surveyEventReceiver)===null||oo===void 0?void 0:oo.getSurveys(),so=io.filter(function(lo){var co,uo,fo,po,ho,_o,go,bo,vo,yo;if(!lo.linked_flag_key&&!lo.targeting_flag_key&&!lo.internal_targeting_flag_key)return!0;var $o=!lo.linked_flag_key||eo.instance.featureFlags.isFeatureEnabled(lo.linked_flag_key),ko=!lo.targeting_flag_key||eo.instance.featureFlags.isFeatureEnabled(lo.targeting_flag_key),So=((co=lo.conditions)===null||co===void 0?void 0:co.events)&&((uo=lo.conditions)===null||uo===void 0||(fo=uo.events)===null||fo===void 0?void 0:fo.values)&&((po=lo.conditions)===null||po===void 0||(ho=po.events)===null||ho===void 0?void 0:ho.values.length)>0,Ao=((_o=lo.conditions)===null||_o===void 0?void 0:_o.actions)&&((go=lo.conditions)===null||go===void 0||(bo=go.actions)===null||bo===void 0?void 0:bo.values)&&((vo=lo.conditions)===null||vo===void 0||(yo=vo.actions)===null||yo===void 0?void 0:yo.values.length)>0,Mo=!So&&!Ao||(ao==null?void 0:ao.includes(lo.id)),Eo=eo._canActivateRepeatedly(lo),To=!(lo.internal_targeting_flag_key&&!Eo)||eo.instance.featureFlags.isFeatureEnabled(lo.internal_targeting_flag_key);return $o&&ko&&To&&Mo});return ue(so)},no)}},{key:"getNextSurveyStep",value:function(ue,eo,no){var ro,oo=ue.questions[eo],io=eo+1;if((ro=oo.branching)===null||ro===void 0||!ro.type)return eo===ue.questions.length-1?br.End:io;if(oo.branching.type===br.End)return br.End;if(oo.branching.type===br.SpecificQuestion){if(Number.isInteger(oo.branching.index))return oo.branching.index}else if(oo.branching.type===br.ResponseBased){if(oo.type===yr.SingleChoice){var ao,so,lo=oo.choices.indexOf("".concat(no));if((ao=oo.branching)!==null&&ao!==void 0&&(so=ao.responseValues)!==null&&so!==void 0&&so.hasOwnProperty(lo)){var co=oo.branching.responseValues[lo];return Number.isInteger(co)?co:co===br.End?br.End:io}}else if(oo.type===yr.Rating){var uo,fo;if(typeof no!="number"||!Number.isInteger(no))throw new Error("The response type must be an integer");var po=function(_o,go){if(go===3){if(_o<1||_o>3)throw new Error("The response must be in range 1-3");return _o===1?"negative":_o===2?"neutral":"positive"}if(go===5){if(_o<1||_o>5)throw new Error("The response must be in range 1-5");return _o<=2?"negative":_o===3?"neutral":"positive"}if(go===10){if(_o<0||_o>10)throw new Error("The response must be in range 0-10");return _o<=6?"detractors":_o<=8?"passives":"promoters"}throw new Error("The scale must be one of: 3, 5, 10")}(no,oo.scale);if((uo=oo.branching)!==null&&uo!==void 0&&(fo=uo.responseValues)!==null&&fo!==void 0&&fo.hasOwnProperty(po)){var ho=oo.branching.responseValues[po];return Number.isInteger(ho)?ho:ho===br.End?br.End:io}}return io}return G.warn(Rr,"Falling back to next question index due to unexpected branching type"),io}},{key:"_canActivateRepeatedly",value:function(ue){return R(U.__PosthogExtensions__.canActivateRepeatedly)&&G.warn(Rr,"canActivateRepeatedly is not defined, must init before calling"),U.__PosthogExtensions__.canActivateRepeatedly(ue)}},{key:"canRenderSurvey",value:function(ue){var eo=this;R(this._surveyManager)?G.warn(Rr,"canActivateRepeatedly is not defined, must init before calling"):this.getSurveys(function(no){var ro=no.filter(function(oo){return oo.id===ue})[0];eo._surveyManager.canRenderSurvey(ro)})}},{key:"renderSurvey",value:function(ue,eo){var no=this;R(this._surveyManager)?G.warn(Rr,"canActivateRepeatedly is not defined, must init before calling"):this.getSurveys(function(ro){var oo=ro.filter(function(io){return io.id===ue})[0];no._surveyManager.renderSurvey(oo,L==null?void 0:L.querySelector(eo))})}}]),to}(),Pr=function(){function to(ue){var eo,no,ro=this;i$1(this,to),o(this,"serverLimits",{}),o(this,"lastEventRateLimited",!1),o(this,"checkForLimiting",function(oo){var io=oo.text;if(io&&io.length)try{(JSON.parse(io).quota_limited||[]).forEach(function(ao){G.info("[RateLimiter] ".concat(ao||"events"," is quota limited.")),ro.serverLimits[ao]=new Date().getTime()+6e4})}catch(ao){return void G.warn('[RateLimiter] could not rate limit - continuing. Error: "'.concat(ao==null?void 0:ao.message,'"'),{text:io})}}),this.instance=ue,this.captureEventsPerSecond=((eo=ue.config.rate_limiting)===null||eo===void 0?void 0:eo.events_per_second)||10,this.captureEventsBurstLimit=Math.max(((no=ue.config.rate_limiting)===null||no===void 0?void 0:no.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond),this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}return s(to,[{key:"clientRateLimitContext",value:function(){var ue,eo,no,ro=arguments.length>0&&arguments[0]!==void 0&&arguments[0],oo=new Date().getTime(),io=(ue=(eo=this.instance.persistence)===null||eo===void 0?void 0:eo.get_property(Me))!==null&&ue!==void 0?ue:{tokens:this.captureEventsBurstLimit,last:oo};io.tokens+=(oo-io.last)/1e3*this.captureEventsPerSecond,io.last=oo,io.tokens>this.captureEventsBurstLimit&&(io.tokens=this.captureEventsBurstLimit);var ao=io.tokens<1;return ao||ro||(io.tokens=Math.max(0,io.tokens-1)),!ao||this.lastEventRateLimited||ro||this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited. Config is set to ".concat(this.captureEventsPerSecond," events per second and ").concat(this.captureEventsBurstLimit," events burst limit.")},{skip_client_rate_limiting:!0}),this.lastEventRateLimited=ao,(no=this.instance.persistence)===null||no===void 0||no.set_property(Me,io),{isRateLimited:ao,remainingTokens:io.tokens}}},{key:"isServerRateLimited",value:function(ue){var eo=this.serverLimits[ue||"events"]||!1;return eo!==!1&&new Date().getTime()<eo}}]),to}(),Tr=function(){return t$1({initialPathName:(D==null?void 0:D.pathname)||"",referringDomain:mn.referringDomain()},mn.campaignParams())},Cr=function(){function to(ue,eo,no){var ro=this;i$1(this,to),o(this,"_onSessionIdCallback",function(oo){var io=ro._getStoredProps();if(!io||io.sessionId!==oo){var ao={sessionId:oo,props:ro._sessionSourceParamGenerator()};ro._persistence.register(o({},Oe,ao))}}),this._sessionIdManager=ue,this._persistence=eo,this._sessionSourceParamGenerator=no||Tr,this._sessionIdManager.onSessionId(this._onSessionIdCallback)}return s(to,[{key:"_getStoredProps",value:function(){return this._persistence.props[Oe]}},{key:"getSessionProps",value:function(){var ue,eo=(ue=this._getStoredProps())===null||ue===void 0?void 0:ue.props;return eo?{$client_session_initial_referring_host:eo.referringDomain,$client_session_initial_pathname:eo.initialPathName,$client_session_initial_utm_source:eo.utm_source,$client_session_initial_utm_campaign:eo.utm_campaign,$client_session_initial_utm_medium:eo.utm_medium,$client_session_initial_utm_content:eo.utm_content,$client_session_initial_utm_term:eo.utm_term}:{}}}]),to}(),$r=["ahrefsbot","ahrefssiteaudit","applebot","baiduspider","bingbot","bingpreview","bot.htm","bot.php","crawler","deepscan","duckduckbot","facebookexternal","facebookcatalog","gptbot","http://yandex.com/bots","hubspot","ia_archiver","linkedinbot","mj12bot","msnbot","nessus","petalbot","pinterest","prerender","rogerbot","screaming frog","semrushbot","sitebulb","slurp","turnitin","twitterbot","vercelbot","yahoo! slurp","yandexbot","headlesschrome","cypress","Google-HotelAdsVerifier","adsbot-google","apis-google","duplexweb-google","feedfetcher-google","google favicon","google web preview","google-read-aloud","googlebot","googleweblight","mediapartners-google","storebot-google","Bytespider;"],Or=function(to,ue){if(!to)return!1;var eo=to.toLowerCase();return $r.concat(ue||[]).some(function(no){var ro=no.toLowerCase();return eo.indexOf(ro)!==-1})},Mr=function(){function to(){i$1(this,to),this.clicks=[]}return s(to,[{key:"isRageClick",value:function(ue,eo,no){var ro=this.clicks[this.clicks.length-1];if(ro&&Math.abs(ue-ro.x)+Math.abs(eo-ro.y)<30&&no-ro.timestamp<1e3){if(this.clicks.push({x:ue,y:eo,timestamp:no}),this.clicks.length===3)return!0}else this.clicks=[{x:ue,y:eo,timestamp:no}];return!1}}]),to}();function Ar(to){var ue;return to.id===Ne||!((ue=to.closest)===null||ue===void 0||!ue.call(to,"#"+Ne))}var Lr=function(){function to(ue){var eo,no=this;i$1(this,to),o(this,"rageclicks",new Mr),o(this,"_enabledServerSide",!1),o(this,"_initialized",!1),o(this,"_flushInterval",null),this.instance=ue,this._enabledServerSide=!((eo=this.instance.persistence)===null||eo===void 0||!eo.props[fe]),T==null||T.addEventListener("beforeunload",function(){no.flush()})}return s(to,[{key:"flushIntervalMilliseconds",get:function(){var ue=5e3;return b(this.instance.config.capture_heatmaps)&&this.instance.config.capture_heatmaps.flush_interval_milliseconds&&(ue=this.instance.config.capture_heatmaps.flush_interval_milliseconds),ue}},{key:"isEnabled",get:function(){return w$1(this.instance.config.capture_heatmaps)?w$1(this.instance.config.enable_heatmaps)?this._enabledServerSide:this.instance.config.enable_heatmaps:this.instance.config.capture_heatmaps!==!1}},{key:"startIfEnabled",value:function(){if(this.isEnabled){if(this._initialized)return;G.info("[heatmaps] starting..."),this._setupListeners(),this._flushInterval=setInterval(this.flush.bind(this),this.flushIntervalMilliseconds)}else{var ue;clearInterval((ue=this._flushInterval)!==null&&ue!==void 0?ue:void 0),this.getAndClearBuffer()}}},{key:"afterDecideResponse",value:function(ue){var eo=!!ue.heatmaps;this.instance.persistence&&this.instance.persistence.register(o({},fe,eo)),this._enabledServerSide=eo,this.startIfEnabled()}},{key:"getAndClearBuffer",value:function(){var ue=this.buffer;return this.buffer=void 0,ue}},{key:"_setupListeners",value:function(){var ue=this;T&&L&&(oe(L,"click",function(eo){return ue._onClick(eo||(T==null?void 0:T.event))},!1,!0),oe(L,"mousemove",function(eo){return ue._onMouseMove(eo||(T==null?void 0:T.event))},!1,!0),this._initialized=!0)}},{key:"_getProperties",value:function(ue,eo){var no=this.instance.scrollManager.scrollY(),ro=this.instance.scrollManager.scrollX(),oo=this.instance.scrollManager.scrollElement(),io=function(ao,so,lo){for(var co=ao;co&&!On(co,"body");){if(co===lo)return!1;if(Y(so,T==null?void 0:T.getComputedStyle(co).position))return!0;co=Dn(co)}return!1}(ue.target,["fixed","sticky"],oo);return{x:ue.clientX+(io?0:ro),y:ue.clientY+(io?0:no),target_fixed:io,type:eo}}},{key:"_onClick",value:function(ue){var eo;if(!Ar(ue.target)){var no=this._getProperties(ue,"click");(eo=this.rageclicks)!==null&&eo!==void 0&&eo.isRageClick(ue.clientX,ue.clientY,new Date().getTime())&&this._capture(t$1(t$1({},no),{},{type:"rageclick"})),this._capture(no)}}},{key:"_onMouseMove",value:function(ue){var eo=this;Ar(ue.target)||(clearTimeout(this._mouseMoveTimeout),this._mouseMoveTimeout=setTimeout(function(){eo._capture(eo._getProperties(ue,"mousemove"))},500))}},{key:"_capture",value:function(ue){if(T){var eo=T.location.href;this.buffer=this.buffer||{},this.buffer[eo]||(this.buffer[eo]=[]),this.buffer[eo].push(ue)}}},{key:"flush",value:function(){this.buffer&&!k(this.buffer)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}}]),to}(),Dr=function(){function to(ue){var eo=this;i$1(this,to),o(this,"_updateScrollData",function(){var no,ro,oo,io;eo.context||(eo.context={});var ao=eo.scrollElement(),so=eo.scrollY(),lo=ao?Math.max(0,ao.scrollHeight-ao.clientHeight):0,co=so+((ao==null?void 0:ao.clientHeight)||0),uo=(ao==null?void 0:ao.scrollHeight)||0;eo.context.lastScrollY=Math.ceil(so),eo.context.maxScrollY=Math.max(so,(no=eo.context.maxScrollY)!==null&&no!==void 0?no:0),eo.context.maxScrollHeight=Math.max(lo,(ro=eo.context.maxScrollHeight)!==null&&ro!==void 0?ro:0),eo.context.lastContentY=co,eo.context.maxContentY=Math.max(co,(oo=eo.context.maxContentY)!==null&&oo!==void 0?oo:0),eo.context.maxContentHeight=Math.max(uo,(io=eo.context.maxContentHeight)!==null&&io!==void 0?io:0)}),this.instance=ue}return s(to,[{key:"getContext",value:function(){return this.context}},{key:"resetContext",value:function(){var ue=this.context;return setTimeout(this._updateScrollData,0),ue}},{key:"startMeasuringScrollPosition",value:function(){T==null||T.addEventListener("scroll",this._updateScrollData,!0),T==null||T.addEventListener("scrollend",this._updateScrollData,!0),T==null||T.addEventListener("resize",this._updateScrollData)}},{key:"scrollElement",value:function(){if(!this.instance.config.scroll_root_selector)return T==null?void 0:T.document.documentElement;var ue,eo=h(m(this.instance.config.scroll_root_selector)?this.instance.config.scroll_root_selector:[this.instance.config.scroll_root_selector]);try{for(eo.s();!(ue=eo.n()).done;){var no=ue.value,ro=T==null?void 0:T.document.querySelector(no);if(ro)return ro}}catch(oo){eo.e(oo)}finally{eo.f()}}},{key:"scrollY",value:function(){if(this.instance.config.scroll_root_selector){var ue=this.scrollElement();return ue&&ue.scrollTop||0}return T&&(T.scrollY||T.pageYOffset||T.document.documentElement.scrollTop)||0}},{key:"scrollX",value:function(){if(this.instance.config.scroll_root_selector){var ue=this.scrollElement();return ue&&ue.scrollLeft||0}return T&&(T.scrollX||T.pageXOffset||T.document.documentElement.scrollLeft)||0}}]),to}(),qr="$copy_autocapture";function Nr(to,ue){return ue.length>to?ue.slice(0,to)+"...":ue}var Br,Hr=function(){function to(ue){i$1(this,to),o(this,"_initialized",!1),o(this,"_isDisabledServerSide",null),o(this,"rageclicks",new Mr),o(this,"_elementsChainAsString",!1),this.instance=ue,this._elementSelectors=null}return s(to,[{key:"config",get:function(){var ue,eo,no=b(this.instance.config.autocapture)?this.instance.config.autocapture:{};return no.url_allowlist=(ue=no.url_allowlist)===null||ue===void 0?void 0:ue.map(function(ro){return new RegExp(ro)}),no.url_ignorelist=(eo=no.url_ignorelist)===null||eo===void 0?void 0:eo.map(function(ro){return new RegExp(ro)}),no}},{key:"_addDomEventHandlers",value:function(){var ue=this;if(this.isBrowserSupported()){if(T&&L){var eo=function(ro){ro=ro||(T==null?void 0:T.event);try{ue._captureEvent(ro)}catch(oo){G.error("Failed to capture event",oo)}},no=function(ro){ro=ro||(T==null?void 0:T.event),ue._captureEvent(ro,qr)};oe(L,"submit",eo,!1,!0),oe(L,"change",eo,!1,!0),oe(L,"click",eo,!1,!0),this.config.capture_copied_text&&(oe(L,"copy",no,!1,!0),oe(L,"cut",no,!1,!0))}}else G.info("Disabling Automatic Event Collection because this browser is not supported")}},{key:"startIfEnabled",value:function(){this.isEnabled&&!this._initialized&&(this._addDomEventHandlers(),this._initialized=!0)}},{key:"afterDecideResponse",value:function(ue){ue.elementsChainAsString&&(this._elementsChainAsString=ue.elementsChainAsString),this.instance.persistence&&this.instance.persistence.register(o({},he,!!ue.autocapture_opt_out)),this._isDisabledServerSide=!!ue.autocapture_opt_out,this.startIfEnabled()}},{key:"setElementSelectors",value:function(ue){this._elementSelectors=ue}},{key:"getElementSelectors",value:function(ue){var eo,no=[];return(eo=this._elementSelectors)===null||eo===void 0||eo.forEach(function(ro){var oo=L==null?void 0:L.querySelectorAll(ro);oo==null||oo.forEach(function(io){ue===io&&no.push(ro)})}),no}},{key:"isEnabled",get:function(){var ue,eo,no=(ue=this.instance.persistence)===null||ue===void 0?void 0:ue.props[he],ro=this._isDisabledServerSide;if(I(ro)&&!x$1(no)&&!this.instance.config.advanced_disable_decide)return!1;var oo=(eo=this._isDisabledServerSide)!==null&&eo!==void 0?eo:!!no;return!!this.instance.config.autocapture&&!oo}},{key:"_previousElementSibling",value:function(ue){if(ue.previousElementSibling)return ue.previousElementSibling;var eo=ue;do eo=eo.previousSibling;while(eo&&!$n(eo));return eo}},{key:"_getAugmentPropertiesFromElement",value:function(ue){if(!Nn(ue))return{};var eo={};return Q(ue.attributes,function(no){if(no.name&&no.name.indexOf("data-ph-capture-attribute")===0){var ro=no.name.replace("data-ph-capture-attribute-",""),oo=no.value;ro&&oo&&zn(oo)&&(eo[ro]=oo)}}),eo}},{key:"_getPropertiesFromElement",value:function(ue,eo,no){var ro,oo=ue.tagName.toLowerCase(),io={tag_name:oo};Ln.indexOf(oo)>-1&&!no&&(oo.toLowerCase()==="a"||oo.toLowerCase()==="button"?io.$el_text=Nr(1024,Qn(ue)):io.$el_text=Nr(1024,Cn(ue)));var ao=Pn(ue);ao.length>0&&(io.classes=ao.filter(function(fo){return fo!==""}));var so=(ro=this.config)===null||ro===void 0?void 0:ro.element_attribute_ignorelist;Q(ue.attributes,function(fo){var po;if((!Bn(ue)||["name","id","class","aria-label"].indexOf(fo.name)!==-1)&&(so==null||!so.includes(fo.name))&&!eo&&zn(fo.value)&&(po=fo.name,!S(po)||po.substring(0,10)!=="_ngcontent"&&po.substring(0,7)!=="_nghost")){var ho=fo.value;fo.name==="class"&&(ho=Fn(ho).join(" ")),io["attr__"+fo.name]=Nr(1024,ho)}});for(var lo=1,co=1,uo=ue;uo=this._previousElementSibling(uo);)lo++,uo.tagName===ue.tagName&&co++;return io.nth_child=lo,io.nth_of_type=co,io}},{key:"_getDefaultProperties",value:function(ue){return{$event_type:ue,$ce_version:1}}},{key:"_getEventTarget",value:function(ue){return w$1(ue.target)?ue.srcElement||null:(eo=ue.target)!==null&&eo!==void 0&&eo.shadowRoot?ue.composedPath()[0]||null:ue.target||null;var eo}},{key:"_captureEvent",value:function(ue){var eo=this,no=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"$autocapture";if(this.isEnabled){var ro,oo=this._getEventTarget(ue);Mn(oo)&&(oo=oo.parentNode||null),no==="$autocapture"&&ue.type==="click"&&ue instanceof MouseEvent&&this.instance.config.rageclick&&(ro=this.rageclicks)!==null&&ro!==void 0&&ro.isRageClick(ue.clientX,ue.clientY,new Date().getTime())&&this._captureEvent(ue,"$rageclick");var io=no===qr;if(oo&&qn(oo,ue,this.config,io,io?["copy","cut"]:void 0)){for(var ao,so,lo=[oo],co=oo;co.parentNode&&!On(co,"body");)An(co.parentNode)?(lo.push(co.parentNode.host),co=co.parentNode.host):(lo.push(co.parentNode),co=co.parentNode);var uo,fo,po=[],ho={},_o=!1;if(Q(lo,function(Eo){var To=Nn(Eo);Eo.tagName.toLowerCase()==="a"&&(uo=Eo.getAttribute("href"),uo=To&&zn(uo)&&uo),Y(Pn(Eo),"ph-no-capture")&&(_o=!0),po.push(eo._getPropertiesFromElement(Eo,eo.instance.config.mask_all_element_attributes,eo.instance.config.mask_all_text));var Io=eo._getAugmentPropertiesFromElement(Eo);J(ho,Io)}),this.instance.config.mask_all_text||(oo.tagName.toLowerCase()==="a"||oo.tagName.toLowerCase()==="button"?po[0].$el_text=Qn(oo):po[0].$el_text=Cn(oo)),uo){var go,bo;po[0].attr__href=uo;var vo=(go=pt(uo))===null||go===void 0?void 0:go.host,yo=T==null||(bo=T.location)===null||bo===void 0?void 0:bo.host;vo&&yo&&vo!==yo&&(fo=uo)}if(_o)return!1;var $o=J(this._getDefaultProperties(ue.type),this._elementsChainAsString?{$elements_chain:Yn(po)}:{$elements:po},(ao=po[0])!==null&&ao!==void 0&&ao.$el_text?{$el_text:(so=po[0])===null||so===void 0?void 0:so.$el_text}:{},fo&&ue.type==="click"?{$external_click_url:fo}:{},ho),ko=this.getElementSelectors(oo);if(ko&&ko.length>0&&($o.$element_selectors=ko),no===qr){var So,Ao=Tn(T==null||(So=T.getSelection())===null||So===void 0?void 0:So.toString()),Mo=ue.type||"clipboard";if(!Ao)return!1;$o.$selected_content=Ao,$o.$copy_type=Mo}return this.instance.capture(no,$o),!0}}}},{key:"isBrowserSupported",value:function(){return y(L==null?void 0:L.querySelectorAll)}}]),to}(),Ur=function(){function to(ue){var eo=this;i$1(this,to),o(this,"_restoreXHRPatch",void 0),o(this,"_restoreFetchPatch",void 0),o(this,"_startCapturing",function(){w$1(eo._restoreXHRPatch)&&U.postHogTracingHeadersPatchFns._patchXHR(eo.instance.sessionManager),w$1(eo._restoreFetchPatch)&&U.postHogTracingHeadersPatchFns._patchFetch(eo.instance.sessionManager)}),this.instance=ue}return s(to,[{key:"_loadScript",value:function(ue){U.postHogTracingHeadersPatchFns&&ue(),this.instance.requestRouter.loadScript("/static/tracing-headers.js?v=".concat(f.LIB_VERSION),function(eo){if(eo)return G.error("[TRACING-HEADERS] failed to load script",eo);ue()})}},{key:"startIfEnabledOrStop",value:function(){var ue,eo;this.instance.config.__add_tracing_headers?this._loadScript(this._startCapturing):((ue=this._restoreXHRPatch)===null||ue===void 0||ue.call(this),(eo=this._restoreFetchPatch)===null||eo===void 0||eo.call(this),this._restoreXHRPatch=void 0,this._restoreFetchPatch=void 0)}}]),to}();(function(to){to[to.PENDING=-1]="PENDING",to[to.DENIED=0]="DENIED",to[to.GRANTED=1]="GRANTED"})(Br||(Br={}));var jr=function(){function to(ue){i$1(this,to),this.instance=ue}return s(to,[{key:"config",get:function(){return this.instance.config}},{key:"consent",get:function(){return this.getDnt()?Br.DENIED:this.storedConsent}},{key:"isOptedOut",value:function(){return this.consent===Br.DENIED||this.consent===Br.PENDING&&this.config.opt_out_capturing_by_default}},{key:"isOptedIn",value:function(){return!this.isOptedOut()}},{key:"optInOut",value:function(ue){this.storage.set(this.storageKey,ue?1:0,this.config.cookie_expiration,this.config.cross_subdomain_cookie,this.config.secure_cookie)}},{key:"reset",value:function(){this.storage.remove(this.storageKey,this.config.cross_subdomain_cookie)}},{key:"storageKey",get:function(){var ue=this.instance.config,eo=ue.token;return(ue.opt_out_capturing_cookie_prefix||"__ph_opt_in_out_")+eo}},{key:"storedConsent",get:function(){var ue=this.storage.get(this.storageKey);return ue==="1"?Br.GRANTED:ue==="0"?Br.DENIED:Br.PENDING}},{key:"storage",get:function(){if(!this._storage){var ue=this.config.opt_out_capturing_persistence_type;this._storage=ue==="localStorage"?at:st;var eo=ue==="localStorage"?st:at;eo.get(this.storageKey)&&(this._storage.get(this.storageKey)||this.optInOut(eo.get(this.storageKey)==="1"),eo.remove(this.storageKey,this.config.cross_subdomain_cookie))}return this._storage}},{key:"getDnt",value:function(){return!!this.config.respect_dnt&&!!ae([A==null?void 0:A.doNotTrack,A==null?void 0:A.msDoNotTrack,U.doNotTrack],function(ue){return Y([!0,1,"1","yes"],ue)})}}]),to}(),Gr="[Exception Autocapture]",Wr=function(){function to(ue){var eo,no=this;i$1(this,to),o(this,"originalOnUnhandledRejectionHandler",void 0),o(this,"startCapturing",function(){if(T&&no.isEnabled&&!no.hasHandlers&&!no.isCapturing){var ro=T.posthogErrorWrappingFunctions.wrapOnError,oo=T.posthogErrorWrappingFunctions.wrapUnhandledRejection;if(ro&&oo)try{no.unwrapOnError=ro(no.captureException.bind(no)),no.unwrapUnhandledRejection=oo(no.captureException.bind(no))}catch(io){G.error(Gr+" failed to start",io),no.stopCapturing()}else G.error(Gr+" failed to load error wrapping functions - cannot start")}}),this.instance=ue,this.remoteEnabled=!((eo=this.instance.persistence)===null||eo===void 0||!eo.props[ve]),this.startIfEnabled()}return s(to,[{key:"isEnabled",get:function(){var ue;return(ue=this.remoteEnabled)!==null&&ue!==void 0&&ue}},{key:"isCapturing",get:function(){var ue;return!(T==null||(ue=T.onerror)===null||ue===void 0||!ue.__POSTHOG_INSTRUMENTED__)}},{key:"hasHandlers",get:function(){return this.originalOnUnhandledRejectionHandler||this.unwrapOnError}},{key:"startIfEnabled",value:function(){this.isEnabled&&!this.isCapturing&&(G.info(Gr+" enabled, starting..."),this.loadScript(this.startCapturing))}},{key:"loadScript",value:function(ue){this.hasHandlers&&ue(),this.instance.requestRouter.loadScript("/static/exception-autocapture.js?v=".concat(f.LIB_VERSION),function(eo){if(eo)return G.error(Gr+" failed to load script",eo);ue()})}},{key:"stopCapturing",value:function(){var ue,eo;(ue=this.unwrapOnError)===null||ue===void 0||ue.call(this),(eo=this.unwrapUnhandledRejection)===null||eo===void 0||eo.call(this)}},{key:"afterDecideResponse",value:function(ue){var eo=ue.autocaptureExceptions;this.remoteEnabled=!!eo||!1,this.instance.persistence&&this.instance.persistence.register(o({},ve,this.remoteEnabled)),this.startIfEnabled()}},{key:"captureException",value:function(ue){var eo=this.instance.requestRouter.endpointFor("ui");ue.$exception_personURL="".concat(eo,"/project/").concat(this.instance.config.token,"/person/").concat(this.instance.get_distinct_id()),this.instance.exceptions.sendExceptionEvent(ue)}}]),to}(),Vr=9e5,zr="[Web Vitals]",Qr=function(){function to(ue){var eo,no=this;i$1(this,to),o(this,"_enabledServerSide",!1),o(this,"_initialized",!1),o(this,"buffer",{url:void 0,metrics:[],firstMetricTimestamp:void 0}),o(this,"_flushToCapture",function(){clearTimeout(no._delayedFlushTimer),no.buffer.metrics.length!==0&&(no.instance.capture("$web_vitals",no.buffer.metrics.reduce(function(ro,oo){var io;return t$1(t$1({},ro),{},(o(io={},"$web_vitals_".concat(oo.name,"_event"),t$1({},oo)),o(io,"$web_vitals_".concat(oo.name,"_value"),oo.value),io))},{})),no.buffer={url:void 0,metrics:[],firstMetricTimestamp:void 0})}),o(this,"_addToBuffer",function(ro){var oo,io=(oo=no.instance.sessionManager)===null||oo===void 0?void 0:oo.checkAndGetSessionAndWindowId(!0);if(w$1(io))G.error(zr+"Could not read session ID. Dropping metrics!");else{no.buffer=no.buffer||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var ao=no._currentURL();w$1(ao)||(R(ro==null?void 0:ro.name)||R(ro==null?void 0:ro.value)?G.error(zr+"Invalid metric received",ro):no._maxAllowedValue&&ro.value>=no._maxAllowedValue?G.error(zr+"Ignoring metric with value >= "+no._maxAllowedValue,ro):(no.buffer.url!==ao&&(no._flushToCapture(),no._delayedFlushTimer=setTimeout(no._flushToCapture,8e3)),w$1(no.buffer.url)&&(no.buffer.url=ao),no.buffer.firstMetricTimestamp=w$1(no.buffer.firstMetricTimestamp)?Date.now():no.buffer.firstMetricTimestamp,no.buffer.metrics.push(t$1(t$1({},ro),{},{$current_url:ao,$session_id:io.sessionId,$window_id:io.windowId,timestamp:Date.now()})),no.buffer.metrics.length===4&&no._flushToCapture()))}}),o(this,"_startCapturing",function(){var ro=U.postHogWebVitalsCallbacks,oo=ro.onLCP,io=ro.onCLS,ao=ro.onFCP,so=ro.onINP;oo&&io&&ao&&so?(oo(no._addToBuffer),io(no._addToBuffer),ao(no._addToBuffer),so(no._addToBuffer),no._initialized=!0):G.error(zr+"web vitals callbacks not loaded - not starting")}),this.instance=ue,this._enabledServerSide=!((eo=this.instance.persistence)===null||eo===void 0||!eo.props[ge]),this.startIfEnabled()}return s(to,[{key:"_maxAllowedValue",get:function(){var ue=b(this.instance.config.capture_performance)&&F(this.instance.config.capture_performance.__web_vitals_max_value)?this.instance.config.capture_performance.__web_vitals_max_value:Vr;return 0<ue&&ue<=6e4?Vr:ue}},{key:"isEnabled",get:function(){var ue=b(this.instance.config.capture_performance)?this.instance.config.capture_performance.web_vitals:void 0;return x$1(ue)?ue:this._enabledServerSide}},{key:"startIfEnabled",value:function(){this.isEnabled&&!this._initialized&&(G.info(zr+" enabled, starting..."),this.loadScript(this._startCapturing))}},{key:"afterDecideResponse",value:function(ue){var eo=b(ue.capturePerformance)&&!!ue.capturePerformance.web_vitals;this.instance.persistence&&this.instance.persistence.register(o({},ge,eo)),this._enabledServerSide=eo,this.startIfEnabled()}},{key:"loadScript",value:function(ue){T.postHogWebVitalsCallbacks&&ue(),this.instance.requestRouter.loadScript("/static/web-vitals.js?v=".concat(f.LIB_VERSION),function(eo){eo?G.error(zr+" failed to load script",eo):ue()})}},{key:"_currentURL",value:function(){var ue=T?T.location.href:void 0;return ue||G.error(zr+"Could not determine current URL"),ue}}]),to}(),Jr="/e/",Yr=function(){function to(ue){var eo;i$1(this,to),this.instance=ue,this._endpointSuffix=((eo=this.instance.persistence)===null||eo===void 0?void 0:eo.props[pe])||Jr}return s(to,[{key:"endpoint",get:function(){return this.instance.requestRouter.endpointFor("api",this._endpointSuffix)}},{key:"afterDecideResponse",value:function(ue){var eo=ue.autocaptureExceptions;this._endpointSuffix=b(eo)&&eo.endpoint||Jr,this.instance.persistence&&this.instance.persistence.register(o({},pe,this._endpointSuffix))}},{key:"sendExceptionEvent",value:function(ue){this.instance.capture("$exception",ue,{_noTruncate:!0,_batchKey:"exceptionEvent",_url:this.endpoint})}}]),to}(),Xr={},Kr=function(){},Zr="posthog",es=!tr&&(H==null?void 0:H.indexOf("MSIE"))===-1&&(H==null?void 0:H.indexOf("Mozilla"))===-1,ts=function(){var to,ue,eo;return{api_host:"https://us.i.posthog.com",ui_host:null,token:"",autocapture:!0,rageclick:!0,cross_subdomain_cookie:(ue=L==null?void 0:L.location,eo=ue==null?void 0:ue.hostname,!!S(eo)&&eo.split(".").slice(-2).join(".")!=="herokuapp.com"),persistence:"localStorage+cookie",persistence_name:"",loaded:Kr,store_google:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageview:!0,capture_pageleave:"if_capture_pageview",debug:D&&S(D==null?void 0:D.search)&&D.search.indexOf("__posthog_debug=true")!==-1||!1,verbose:!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_surveys:!1,enable_recording_console_log:void 0,secure_cookie:(T==null||(to=T.location)===null||to===void 0?void 0:to.protocol)==="https:",ip:!0,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},inapp_protocol:"//",inapp_link_new_window:!1,request_batching:!0,properties_string_max_length:65535,session_recording:{},mask_all_element_attributes:!1,mask_all_text:!1,advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,on_request_error:function(no){var ro="Bad HTTP status: "+no.statusCode+" "+no.text;G.error(ro)},get_device_id:function(no){return no},_onCapture:Kr,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:"always",__add_tracing_headers:!1}},ns=function(to){var ue={};w$1(to.process_person)||(ue.person_profiles=to.process_person),w$1(to.xhr_headers)||(ue.request_headers=to.xhr_headers),w$1(to.cookie_name)||(ue.persistence_name=to.cookie_name),w$1(to.disable_cookie)||(ue.disable_persistence=to.disable_cookie);var eo=J({},ue,to);return m(to.property_blacklist)&&(w$1(to.property_denylist)?eo.property_denylist=to.property_blacklist:m(to.property_denylist)?eo.property_denylist=[].concat(l(to.property_blacklist),l(to.property_denylist)):G.error("Invalid value for property_denylist config: "+to.property_denylist)),eo},is=function(){function to(){i$1(this,to),o(this,"__forceAllowLocalhost",!1)}return s(to,[{key:"_forceAllowLocalhost",get:function(){return this.__forceAllowLocalhost},set:function(ue){G.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=ue}}]),to}(),rs=function(){function to(){var ue=this;i$1(this,to),o(this,"webPerformance",new is),o(this,"version",f.LIB_VERSION),o(this,"_internalEventEmitter",new Sr),this.config=ts(),this.decideEndpointWasHit=!1,this.SentryIntegration=gr,this.sentryIntegration=function(eo){return function(no,ro){var oo=pr(no,ro);return{name:vr,processEvent:function(io){return oo(io)}}}(ue,eo)},this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this._initialPageviewCaptured=!1,this.featureFlags=new We(this),this.toolbar=new mi(this),this.scrollManager=new Dr(this),this.pageViewManager=new kr(this),this.surveys=new xr(this),this.exceptions=new Yr(this),this.rateLimiter=new Pr(this),this.requestRouter=new fr(this),this.consent=new jr(this),this.people={set:function(eo,no,ro){var oo=S(eo)?o({},eo,no):eo;ue.setPersonProperties(oo),ro==null||ro({})},set_once:function(eo,no,ro){var oo=S(eo)?o({},eo,no):eo;ue.setPersonProperties(void 0,oo),ro==null||ro({})}},this.on("eventCaptured",function(eo){return G.info("send",eo)})}return s(to,[{key:"init",value:function(ue,eo,no){if(no&&no!==Zr){var ro,oo=(ro=Xr[no])!==null&&ro!==void 0?ro:new to;return oo._init(ue,eo,no),Xr[no]=oo,Xr[Zr][no]=oo,oo}return this._init(ue,eo,no)}},{key:"_init",value:function(ue){var eo,no,ro=this,oo=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},io=arguments.length>2?arguments[2]:void 0;if(w$1(ue)||E(ue))return G.critical("PostHog was initialized without a token. This likely indicates a misconfiguration. Please check the first argument passed to posthog.init()"),this;if(this.__loaded)return G.warn("You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config={},this._triggered_notifs=[],this.set_config(J({},ts(),ns(oo),{name:io,token:ue})),this.config.on_xhr_error&&G.error("[posthog] on_xhr_error is deprecated. Use on_request_error instead"),this.compression=oo.disable_compression?void 0:re.GZipJS,this.persistence=new bn(this.config),this.sessionPersistence=this.config.persistence==="sessionStorage"?this.persistence:new bn(t$1(t$1({},this.config),{},{persistence:"sessionStorage"}));var ao=t$1({},this.persistence.props),so=t$1({},this.sessionPersistence.props);if(this._requestQueue=new yi(function(vo){return ro._send_retriable_request(vo)}),this._retryQueue=new lr(this),this.__request_queue=[],this.sessionManager=new dr(this.config,this.persistence),this.sessionPropsManager=new Cr(this.sessionManager,this.persistence),new Ur(this).startIfEnabledOrStop(),this.sessionRecording=new vi(this),this.sessionRecording.startIfEnabledOrStop(),this.config.disable_scroll_properties||this.scrollManager.startMeasuringScrollPosition(),this.autocapture=new Hr(this),this.autocapture.startIfEnabled(),this.surveys.loadIfEnabled(),this.heatmaps=new Lr(this),this.heatmaps.startIfEnabled(),this.webVitalsAutocapture=new Qr(this),this.exceptionObserver=new Wr(this),this.exceptionObserver.startIfEnabled(),f.DEBUG=f.DEBUG||this.config.debug,f.DEBUG&&G.info("Starting in debug mode",{this:this,config:oo,thisC:t$1({},this.config),p:ao,s:so}),this._sync_opt_out_with_persistence(),((eo=oo.bootstrap)===null||eo===void 0?void 0:eo.distinctID)!==void 0){var lo,co,uo=this.config.get_device_id(Ke()),fo=(lo=oo.bootstrap)!==null&&lo!==void 0&&lo.isIdentifiedID?uo:oo.bootstrap.distinctID;this.persistence.set_property($e,(co=oo.bootstrap)!==null&&co!==void 0&&co.isIdentifiedID?"identified":"anonymous"),this.register({distinct_id:oo.bootstrap.distinctID,$device_id:fo})}if(this._hasBootstrappedFeatureFlags()){var po,ho,_o=Object.keys(((po=oo.bootstrap)===null||po===void 0?void 0:po.featureFlags)||{}).filter(function(vo){var yo,$o;return!((yo=oo.bootstrap)===null||yo===void 0||($o=yo.featureFlags)===null||$o===void 0||!$o[vo])}).reduce(function(vo,yo){var $o,ko;return vo[yo]=(($o=oo.bootstrap)===null||$o===void 0||(ko=$o.featureFlags)===null||ko===void 0?void 0:ko[yo])||!1,vo},{}),go=Object.keys(((ho=oo.bootstrap)===null||ho===void 0?void 0:ho.featureFlagPayloads)||{}).filter(function(vo){return _o[vo]}).reduce(function(vo,yo){var $o,ko,So,Ao;return($o=oo.bootstrap)!==null&&$o!==void 0&&(ko=$o.featureFlagPayloads)!==null&&ko!==void 0&&ko[yo]&&(vo[yo]=(So=oo.bootstrap)===null||So===void 0||(Ao=So.featureFlagPayloads)===null||Ao===void 0?void 0:Ao[yo]),vo},{});this.featureFlags.receivedFeatureFlags({featureFlags:_o,featureFlagPayloads:go})}if(!this.get_distinct_id()){var bo=this.config.get_device_id(Ke());this.register_once({distinct_id:bo,$device_id:bo},""),this.persistence.set_property($e,"anonymous")}return T==null||(no=T.addEventListener)===null||no===void 0||no.call(T,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this)),this.toolbar.maybeLoadToolbar(),oo.segment?_r(this,function(){return ro._loaded()}):this._loaded(),y(this.config._onCapture)&&this.on("eventCaptured",function(vo){return ro.config._onCapture(vo.event,vo)}),this}},{key:"_afterDecideResponse",value:function(ue){var eo,no,ro,oo,io,ao,so,lo;this.compression=void 0,ue.supportedCompression&&!this.config.disable_compression&&(this.compression=Y(ue.supportedCompression,re.GZipJS)?re.GZipJS:Y(ue.supportedCompression,re.Base64)?re.Base64:void 0),(eo=ue.analytics)!==null&&eo!==void 0&&eo.endpoint&&(this.analyticsDefaultEndpoint=ue.analytics.endpoint),(no=this.sessionRecording)===null||no===void 0||no.afterDecideResponse(ue),(ro=this.autocapture)===null||ro===void 0||ro.afterDecideResponse(ue),(oo=this.heatmaps)===null||oo===void 0||oo.afterDecideResponse(ue),(io=this.surveys)===null||io===void 0||io.afterDecideResponse(ue),(ao=this.webVitalsAutocapture)===null||ao===void 0||ao.afterDecideResponse(ue),(so=this.exceptions)===null||so===void 0||so.afterDecideResponse(ue),(lo=this.exceptionObserver)===null||lo===void 0||lo.afterDecideResponse(ue)}},{key:"_loaded",value:function(){var ue=this,eo=this.config.advanced_disable_decide;eo||this.featureFlags.setReloadingPaused(!0);try{this.config.loaded(this)}catch(no){G.critical("`loaded` function failed",no)}this._start_queue_if_opted_in(),this.config.capture_pageview&&setTimeout(function(){ue.consent.isOptedIn()&&ue._captureInitialPageview()},1),eo||(new pi(this).call(),this.featureFlags.resetRequestQueue())}},{key:"_start_queue_if_opted_in",value:function(){var ue;this.has_opted_out_capturing()||this.config.request_batching&&((ue=this._requestQueue)===null||ue===void 0||ue.enable())}},{key:"_dom_loaded",value:function(){var ue=this;this.has_opted_out_capturing()||z(this.__request_queue,function(eo){return ue._send_retriable_request(eo)}),this.__request_queue=[],this._start_queue_if_opted_in()}},{key:"_handle_unload",value:function(){var ue,eo;this.config.request_batching?(this._shouldCapturePageleave()&&this.capture("$pageleave"),(ue=this._requestQueue)===null||ue===void 0||ue.unload(),(eo=this._retryQueue)===null||eo===void 0||eo.unload()):this._shouldCapturePageleave()&&this.capture("$pageleave",null,{transport:"sendBeacon"})}},{key:"_send_request",value:function(ue){var eo=this;this.__loaded&&(es?this.__request_queue.push(ue):this.rateLimiter.isServerRateLimited(ue.batchKey)||(ue.transport=ue.transport||this.config.api_transport,ue.url=ir(ue.url,{ip:this.config.ip?1:0}),ue.headers=t$1({},this.config.request_headers),ue.compression=ue.compression==="best-available"?this.compression:ue.compression,function(no){var ro,oo,io,ao=t$1({},no);ao.timeout=ao.timeout||6e4,ao.url=ir(ao.url,{_:new Date().getTime().toString(),ver:f.LIB_VERSION,compression:ao.compression});var so=(ro=ao.transport)!==null&&ro!==void 0?ro:"XHR",lo=(oo=(io=ae(or,function(co){return co.transport===so}))===null||io===void 0?void 0:io.method)!==null&&oo!==void 0?oo:or[0].method;if(!lo)throw new Error("No available transport method");lo(ao)}(t$1(t$1({},ue),{},{callback:function(no){var ro,oo,io;eo.rateLimiter.checkForLimiting(no),no.statusCode>=400&&((oo=(io=eo.config).on_request_error)===null||oo===void 0||oo.call(io,no)),(ro=ue.callback)===null||ro===void 0||ro.call(ue,no)}}))))}},{key:"_send_retriable_request",value:function(ue){this._retryQueue?this._retryQueue.retriableRequest(ue):this._send_request(ue)}},{key:"_execute_array",value:function(ue){var eo,no=this,ro=[],oo=[],io=[];z(ue,function(so){so&&(eo=so[0],m(eo)?io.push(so):y(so)?so.call(no):m(so)&&eo==="alias"?ro.push(so):m(so)&&eo.indexOf("capture")!==-1&&y(no[eo])?io.push(so):oo.push(so))});var ao=function(so,lo){z(so,function(co){if(m(co[0])){var uo=lo;Q(co,function(fo){uo=uo[fo[0]].apply(uo,fo.slice(1))})}else this[co[0]].apply(this,co.slice(1))},lo)};ao(ro,this),ao(oo,this),ao(io,this)}},{key:"_hasBootstrappedFeatureFlags",value:function(){var ue,eo;return((ue=this.config.bootstrap)===null||ue===void 0?void 0:ue.featureFlags)&&Object.keys((eo=this.config.bootstrap)===null||eo===void 0?void 0:eo.featureFlags).length>0||!1}},{key:"push",value:function(ue){this._execute_array([ue])}},{key:"capture",value:function(ue,eo,no){var ro;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this._requestQueue){if(!this.consent.isOptedOut())if(!w$1(ue)&&S(ue)){if(this.config.opt_out_useragent_filter||!this._is_bot()){var oo=no!=null&&no.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(oo==null||!oo.isRateLimited){this.sessionPersistence.update_search_keyword(),this.config.store_google&&this.sessionPersistence.update_campaign_params(),this.config.save_referrer&&this.sessionPersistence.update_referrer_info(),(this.config.store_google||this.config.save_referrer)&&this.persistence.set_initial_person_info();var io=new Date,ao=(no==null?void 0:no.timestamp)||io,so={uuid:Ke(),event:ue,properties:this._calculate_event_properties(ue,eo||{},ao)};oo&&(so.properties.$lib_rate_limit_remaining_tokens=oo.remainingTokens),no!=null&&no.$set&&(so.$set=no==null?void 0:no.$set);var lo=this._calculate_set_once_properties(no==null?void 0:no.$set_once);lo&&(so.$set_once=lo),(so=ie$3(so,no!=null&&no._noTruncate?null:this.config.properties_string_max_length)).timestamp=ao,w$1(no==null?void 0:no.timestamp)||(so.properties.$event_time_override_provided=!0,so.properties.$event_time_override_system_time=io);var co=t$1(t$1({},so.properties.$set),so.$set);k(co)||this.setPersonPropertiesForFlags(co),this._internalEventEmitter.emit("eventCaptured",so);var uo={method:"POST",url:(ro=no==null?void 0:no._url)!==null&&ro!==void 0?ro:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),data:so,compression:"best-available",batchKey:no==null?void 0:no._batchKey};return!this.config.request_batching||no&&(no==null||!no._batchKey)||no!=null&&no.send_instantly?this._send_retriable_request(uo):this._requestQueue.enqueue(uo),so}G.critical("This capture call is ignored due to client rate limiting.")}}else G.error("No event name provided to posthog.capture")}else G.uninitializedWarning("posthog.capture")}},{key:"_addCaptureHook",value:function(ue){this.on("eventCaptured",function(eo){return ue(eo.event,eo)})}},{key:"_calculate_event_properties",value:function(ue,eo,no){if(no=no||new Date,!this.persistence||!this.sessionPersistence)return eo;var ro=this.persistence.remove_event_timer(ue),oo=t$1({},eo);if(oo.token=this.config.token,ue==="$snapshot"){var io=t$1(t$1({},this.persistence.properties()),this.sessionPersistence.properties());return oo.distinct_id=io.distinct_id,(!S(oo.distinct_id)&&!F(oo.distinct_id)||E(oo.distinct_id))&&G.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),oo}var ao=mn.properties();if(this.sessionManager){var so=this.sessionManager.checkAndGetSessionAndWindowId(),lo=so.sessionId,co=so.windowId;oo.$session_id=lo,oo.$window_id=co}if(this.requestRouter.region===ur.CUSTOM&&(oo.$lib_custom_api_host=this.config.api_host),this.sessionPropsManager&&this.config.__preview_send_client_session_params&&(ue==="$pageview"||ue==="$pageleave"||ue==="$autocapture")){var uo=this.sessionPropsManager.getSessionProps();oo=J(oo,uo)}if(!this.config.disable_scroll_properties){var fo={};ue==="$pageview"?fo=this.pageViewManager.doPageView(no):ue==="$pageleave"&&(fo=this.pageViewManager.doPageLeave(no)),oo=J(oo,fo)}if(ue==="$pageview"&&L&&(oo.title=L.title),!w$1(ro)){var po=no.getTime()-ro;oo.$duration=parseFloat((po/1e3).toFixed(3))}H&&this.config.opt_out_useragent_filter&&(oo.$browser_type=this._is_bot()?"bot":"browser"),(oo=J({},ao,this.persistence.properties(),this.sessionPersistence.properties(),oo)).$is_identified=this._isIdentified(),m(this.config.property_denylist)?Q(this.config.property_denylist,function(_o){delete oo[_o]}):G.error("Invalid value for property_denylist config: "+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var ho=this.config.sanitize_properties;return ho&&(oo=ho(oo,ue)),oo.$process_person_profile=this._hasPersonProcessing(),oo}},{key:"_calculate_set_once_properties",value:function(ue){if(!this.persistence||!this._hasPersonProcessing())return ue;var eo=J({},this.persistence.get_initial_props(),ue||{});return k(eo)?void 0:eo}},{key:"register",value:function(ue,eo){var no;(no=this.persistence)===null||no===void 0||no.register(ue,eo)}},{key:"register_once",value:function(ue,eo,no){var ro;(ro=this.persistence)===null||ro===void 0||ro.register_once(ue,eo,no)}},{key:"register_for_session",value:function(ue){var eo;(eo=this.sessionPersistence)===null||eo===void 0||eo.register(ue)}},{key:"unregister",value:function(ue){var eo;(eo=this.persistence)===null||eo===void 0||eo.unregister(ue)}},{key:"unregister_for_session",value:function(ue){var eo;(eo=this.sessionPersistence)===null||eo===void 0||eo.unregister(ue)}},{key:"_register_single",value:function(ue,eo){this.register(o({},ue,eo))}},{key:"getFeatureFlag",value:function(ue,eo){return this.featureFlags.getFeatureFlag(ue,eo)}},{key:"getFeatureFlagPayload",value:function(ue){var eo=this.featureFlags.getFeatureFlagPayload(ue);try{return JSON.parse(eo)}catch{return eo}}},{key:"isFeatureEnabled",value:function(ue,eo){return this.featureFlags.isFeatureEnabled(ue,eo)}},{key:"reloadFeatureFlags",value:function(){this.featureFlags.reloadFeatureFlags()}},{key:"updateEarlyAccessFeatureEnrollment",value:function(ue,eo){this.featureFlags.updateEarlyAccessFeatureEnrollment(ue,eo)}},{key:"getEarlyAccessFeatures",value:function(ue){var eo=arguments.length>1&&arguments[1]!==void 0&&arguments[1];return this.featureFlags.getEarlyAccessFeatures(ue,eo)}},{key:"on",value:function(ue,eo){return this._internalEventEmitter.on(ue,eo)}},{key:"onFeatureFlags",value:function(ue){return this.featureFlags.onFeatureFlags(ue)}},{key:"onSessionId",value:function(ue){var eo,no;return(eo=(no=this.sessionManager)===null||no===void 0?void 0:no.onSessionId(ue))!==null&&eo!==void 0?eo:function(){}}},{key:"getSurveys",value:function(ue){var eo=arguments.length>1&&arguments[1]!==void 0&&arguments[1];this.surveys.getSurveys(ue,eo)}},{key:"getActiveMatchingSurveys",value:function(ue){var eo=arguments.length>1&&arguments[1]!==void 0&&arguments[1];this.surveys.getActiveMatchingSurveys(ue,eo)}},{key:"renderSurvey",value:function(ue,eo){this.surveys.renderSurvey(ue,eo)}},{key:"canRenderSurvey",value:function(ue){this.surveys.canRenderSurvey(ue)}},{key:"getNextSurveyStep",value:function(ue,eo,no){return this.surveys.getNextSurveyStep(ue,eo,no)}},{key:"identify",value:function(ue,eo,no){if(!this.__loaded||!this.persistence)return G.uninitializedWarning("posthog.identify");if(F(ue)&&(ue=ue.toString(),G.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),ue){if(["distinct_id","distinctid"].includes(ue.toLowerCase()))G.critical('The string "'.concat(ue,'" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.'));else if(this._requirePersonProcessing("posthog.identify")){var ro=this.get_distinct_id();if(this.register({$user_id:ue}),!this.get_property("$device_id")){var oo=ro;this.register_once({$had_persisted_distinct_id:!0,$device_id:oo},"")}ue!==ro&&ue!==this.get_property(ce)&&(this.unregister(ce),this.register({distinct_id:ue}));var io=(this.persistence.get_property($e)||"anonymous")==="anonymous";ue!==ro&&io?(this.persistence.set_property($e,"identified"),this.setPersonPropertiesForFlags(eo||{},!1),this.capture("$identify",{distinct_id:ue,$anon_distinct_id:ro},{$set:eo||{},$set_once:no||{}}),this.featureFlags.setAnonymousDistinctId(ro)):(eo||no)&&this.setPersonProperties(eo,no),ue!==ro&&(this.reloadFeatureFlags(),this.unregister(Ce))}}else G.error("Unique user id has not been set in posthog.identify")}},{key:"setPersonProperties",value:function(ue,eo){(ue||eo)&&this._requirePersonProcessing("posthog.setPersonProperties")&&(this.setPersonPropertiesForFlags(ue||{}),this.capture("$set",{$set:ue||{},$set_once:eo||{}}))}},{key:"group",value:function(ue,eo,no){if(ue&&eo){if(this._requirePersonProcessing("posthog.group")){var ro=this.getGroups();ro[ue]!==eo&&this.resetGroupPropertiesForFlags(ue),this.register({$groups:t$1(t$1({},ro),{},o({},ue,eo))}),no&&(this.capture("$groupidentify",{$group_type:ue,$group_key:eo,$group_set:no}),this.setGroupPropertiesForFlags(o({},ue,no))),ro[ue]===eo||no||this.reloadFeatureFlags()}}else G.error("posthog.group requires a group type and group key")}},{key:"resetGroups",value:function(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}},{key:"setPersonPropertiesForFlags",value:function(ue){var eo=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1];this._requirePersonProcessing("posthog.setPersonPropertiesForFlags")&&this.featureFlags.setPersonPropertiesForFlags(ue,eo)}},{key:"resetPersonPropertiesForFlags",value:function(){this.featureFlags.resetPersonPropertiesForFlags()}},{key:"setGroupPropertiesForFlags",value:function(ue){var eo=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1];this._requirePersonProcessing("posthog.setGroupPropertiesForFlags")&&this.featureFlags.setGroupPropertiesForFlags(ue,eo)}},{key:"resetGroupPropertiesForFlags",value:function(ue){this.featureFlags.resetGroupPropertiesForFlags(ue)}},{key:"reset",value:function(ue){var eo,no,ro,oo;if(G.info("reset"),!this.__loaded)return G.uninitializedWarning("posthog.reset");var io=this.get_property("$device_id");this.consent.reset(),(eo=this.persistence)===null||eo===void 0||eo.clear(),(no=this.sessionPersistence)===null||no===void 0||no.clear(),(ro=this.persistence)===null||ro===void 0||ro.set_property($e,"anonymous"),(oo=this.sessionManager)===null||oo===void 0||oo.resetSessionId();var ao=this.config.get_device_id(Ke());this.register_once({distinct_id:ao,$device_id:ue?ao:io},"")}},{key:"get_distinct_id",value:function(){return this.get_property("distinct_id")}},{key:"getGroups",value:function(){return this.get_property("$groups")||{}}},{key:"get_session_id",value:function(){var ue,eo;return(ue=(eo=this.sessionManager)===null||eo===void 0?void 0:eo.checkAndGetSessionAndWindowId(!0).sessionId)!==null&&ue!==void 0?ue:""}},{key:"get_session_replay_url",value:function(ue){if(!this.sessionManager)return"";var eo=this.sessionManager.checkAndGetSessionAndWindowId(!0),no=eo.sessionId,ro=eo.sessionStartTimestamp,oo=this.requestRouter.endpointFor("ui","/project/".concat(this.config.token,"/replay/").concat(no));if(ue!=null&&ue.withTimestamp&&ro){var io,ao=(io=ue.timestampLookBack)!==null&&io!==void 0?io:10;if(!ro)return oo;var so=Math.max(Math.floor((new Date().getTime()-ro)/1e3)-ao,0);oo+="?t=".concat(so)}return oo}},{key:"alias",value:function(ue,eo){return ue===this.get_property(le)?(G.critical("Attempting to create alias for existing People user - aborting."),-2):this._requirePersonProcessing("posthog.alias")?(w$1(eo)&&(eo=this.get_distinct_id()),ue!==eo?(this._register_single(ce,ue),this.capture("$create_alias",{alias:ue,distinct_id:eo})):(G.warn("alias matches current distinct_id - skipping api call."),this.identify(ue),-1)):void 0}},{key:"set_config",value:function(ue){var eo,no,ro,oo,io=t$1({},this.config);b(ue)&&(J(this.config,ns(ue)),(eo=this.persistence)===null||eo===void 0||eo.update_config(this.config,io),this.sessionPersistence=this.config.persistence==="sessionStorage"?this.persistence:new bn(t$1(t$1({},this.config),{},{persistence:"sessionStorage"})),at.is_supported()&&at.get("ph_debug")==="true"&&(this.config.debug=!0),this.config.debug&&(f.DEBUG=!0,G.info("set_config",{config:ue,oldConfig:io,newConfig:t$1({},this.config)})),(no=this.sessionRecording)===null||no===void 0||no.startIfEnabledOrStop(),(ro=this.autocapture)===null||ro===void 0||ro.startIfEnabled(),(oo=this.heatmaps)===null||oo===void 0||oo.startIfEnabled(),this.surveys.loadIfEnabled(),this._sync_opt_out_with_persistence())}},{key:"startSessionRecording",value:function(ue){var eo,no=x$1(ue)&&ue;if(no||ue!=null&&ue.sampling){var ro,oo,io=(ro=this.sessionManager)===null||ro===void 0?void 0:ro.checkAndGetSessionAndWindowId();(oo=this.persistence)===null||oo===void 0||oo.register(o({},Ee,!0)),G.info("Session recording started with sampling override for session: ",io==null?void 0:io.sessionId)}(no||ue!=null&&ue.linked_flag)&&((eo=this.sessionRecording)===null||eo===void 0||eo.overrideLinkedFlag(),G.info("Session recording started with linked_flags override")),this.set_config({disable_session_recording:!1})}},{key:"stopSessionRecording",value:function(){this.set_config({disable_session_recording:!0})}},{key:"sessionRecordingStarted",value:function(){var ue;return!((ue=this.sessionRecording)===null||ue===void 0||!ue.started)}},{key:"captureException",value:function(ue,eo){var no=y(U.parseErrorAsProperties)?U.parseErrorAsProperties([ue.message,void 0,void 0,void 0,ue]):t$1({$exception_type:ue.name,$exception_message:ue.message,$exception_level:"error"},eo);this.exceptions.sendExceptionEvent(no)}},{key:"loadToolbar",value:function(ue){return this.toolbar.loadToolbar(ue)}},{key:"get_property",value:function(ue){var eo;return(eo=this.persistence)===null||eo===void 0?void 0:eo.props[ue]}},{key:"getSessionProperty",value:function(ue){var eo;return(eo=this.sessionPersistence)===null||eo===void 0?void 0:eo.props[ue]}},{key:"toString",value:function(){var ue,eo=(ue=this.config.name)!==null&&ue!==void 0?ue:Zr;return eo!==Zr&&(eo=Zr+"."+eo),eo}},{key:"_isIdentified",value:function(){var ue,eo;return((ue=this.persistence)===null||ue===void 0?void 0:ue.get_property($e))==="identified"||((eo=this.sessionPersistence)===null||eo===void 0?void 0:eo.get_property($e))==="identified"}},{key:"_hasPersonProcessing",value:function(){var ue,eo,no,ro;return!(this.config.person_profiles==="never"||this.config.person_profiles==="identified_only"&&!this._isIdentified()&&k(this.getGroups())&&((ue=this.persistence)===null||ue===void 0||(eo=ue.props)===null||eo===void 0||!eo[ce])&&((no=this.persistence)===null||no===void 0||(ro=no.props)===null||ro===void 0||!ro[qe]))}},{key:"_shouldCapturePageleave",value:function(){return this.config.capture_pageleave===!0||this.config.capture_pageleave==="if_capture_pageview"&&this.config.capture_pageview}},{key:"createPersonProfile",value:function(){this._hasPersonProcessing()||this._requirePersonProcessing("posthog.createPersonProfile")&&this.setPersonProperties({},{})}},{key:"_requirePersonProcessing",value:function(ue){return this.config.person_profiles==="never"?(G.error(ue+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this._register_single(qe,!0),!0)}},{key:"_sync_opt_out_with_persistence",value:function(){var ue,eo,no,ro,oo=this.consent.isOptedOut(),io=this.config.opt_out_persistence_by_default,ao=this.config.disable_persistence||oo&&!!io;((ue=this.persistence)===null||ue===void 0?void 0:ue.disabled)!==ao&&((no=this.persistence)===null||no===void 0||no.set_disabled(ao)),((eo=this.sessionPersistence)===null||eo===void 0?void 0:eo.disabled)!==ao&&((ro=this.sessionPersistence)===null||ro===void 0||ro.set_disabled(ao))}},{key:"opt_in_capturing",value:function(ue){var eo;this.consent.optInOut(!0),this._sync_opt_out_with_persistence(),(w$1(ue==null?void 0:ue.captureEventName)||ue!=null&&ue.captureEventName)&&this.capture((eo=ue==null?void 0:ue.captureEventName)!==null&&eo!==void 0?eo:"$opt_in",ue==null?void 0:ue.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this._captureInitialPageview()}},{key:"opt_out_capturing",value:function(){this.consent.optInOut(!1),this._sync_opt_out_with_persistence()}},{key:"has_opted_in_capturing",value:function(){return this.consent.isOptedIn()}},{key:"has_opted_out_capturing",value:function(){return this.consent.isOptedOut()}},{key:"clear_opt_in_out_capturing",value:function(){this.consent.reset(),this._sync_opt_out_with_persistence()}},{key:"_is_bot",value:function(){return A?function(ue,eo){if(!ue)return!1;var no=ue.userAgent;if(no&&Or(no,eo))return!0;try{var ro=ue==null?void 0:ue.userAgentData;if(ro!=null&&ro.brands&&ro.brands.some(function(oo){return Or(oo==null?void 0:oo.brand,eo)}))return!0}catch{}return!!ue.webdriver}(A,this.config.custom_blocked_useragents):void 0}},{key:"_captureInitialPageview",value:function(){L&&!this._initialPageviewCaptured&&(this._initialPageviewCaptured=!0,this.capture("$pageview",{title:L.title},{send_instantly:!0}))}},{key:"debug",value:function(ue){ue===!1?(T==null||T.console.log("You've disabled debug mode."),localStorage&&localStorage.removeItem("ph_debug"),this.set_config({debug:!1})):(T==null||T.console.log("You're now in debug mode. All calls to PostHog will be logged in your console.\nYou can disable this with `posthog.debug(false)`."),localStorage&&localStorage.setItem("ph_debug","true"),this.set_config({debug:!0}))}}]),to}();(function(to,ue){for(var eo=0;eo<ue.length;eo++)to.prototype[ue[eo]]=ee(to.prototype[ue[eo]])})(rs,["identify"]);var ss,os=(ss=Xr[Zr]=new rs,function(){function to(){to.done||(to.done=!0,es=!1,Q(Xr,function(ue){ue._dom_loaded()}))}L!=null&&L.addEventListener&&(L.readyState==="complete"?to():L.addEventListener("DOMContentLoaded",to,!1)),T&&oe(T,"load",to,!0)}(),ss);const Events={COMPONENT_CREATED:"component:created",COMPONENT_UPDATED:"component:updated",APP_VIEW_PUBLISHED:"app:view_published",BLOCK_EJECTED:"block:ejected"},EventSource$1={PORTAL:"portal",URL:"url",NOTIFICATION:"notification"};class PosthogClient{constructor(ue){this.token=ue}init(){this.token&&(os.init(this.token,{autocapture:!1,capture_pageview:!1}),os.set_config({persistence:"cookie"}),this.initialised=!0)}identify(ue){this.initialised&&os.identify(ue)}updateUser(ue){this.initialised&&os.people.set(ue)}captureEvent(ue,eo){this.initialised&&(eo.sourceApp="builder",os.capture(ue,eo))}npsFeedback(ue){if(!this.initialised)return;localStorage.setItem(Events.NPS.SUBMITTED,Date.now());const eo={};for(let no in ue)eo[`feedback_${no}`]=ue[no];os.capture(Events.NPS.SUBMITTED,eo)}logout(){this.initialised&&os.reset()}}const posthog=new PosthogClient(void 0);class AnalyticsHub{constructor(){this.clients=[posthog],this.initialised=!1}async activate(){(await API.getAnalyticsStatus()).enabled&&!this.initialised&&(this.clients.forEach(eo=>{eo.init()}),this.initialised=!0)}identify(ue){posthog.identify(ue)}captureException(ue){}captureEvent(ue,eo={}){posthog.captureEvent(ue,eo)}async logout(){posthog.logout()}}const analytics=new AnalyticsHub,capitalise=to=>to&&to.substring(0,1).toUpperCase()+to.substring(1),lowercase=to=>to.substring(0,1).toLowerCase()+to.substring(1),isBuilderInputFocused=to=>{var no,ro,oo;const ue=(no=document.activeElement)==null?void 0:no.tagName.toLowerCase();return!!((((oo=(ro=document.activeElement)==null?void 0:ro.classList)==null?void 0:oo.contains("cm-content"))||["input","textarea"].indexOf(ue)!==-1)&&to.key!=="Escape")},DEFAULT_STATE={platformUrl:"",emailBrandingEnabled:!0,testimonialsEnabled:!0,platformTitle:"Budibase",company:"Budibase",google:!1,googleDatasourceConfigured:!1,oidc:!1,oidcCallbackUrl:"",googleCallbackUrl:"",loaded:!1};class OrganisationStore extends BudiStore{constructor(){super(DEFAULT_STATE)}async init(){const ue=get_store_value(auth).tenantId,eo=await API.getTenantConfig(ue);this.set({...DEFAULT_STATE,...eo.config,loaded:!0})}async save(ue){const{oidc:eo,google:no,googleDatasourceConfigured:ro,oidcCallbackUrl:oo,googleCallbackUrl:io,loaded:ao,...so}=get_store_value(this.store),lo={...so,...ue};await API.saveConfig({type:ConfigType.SETTINGS,config:lo}),await this.init()}}const organisation=new OrganisationStore;let UserStore$1=class extends BudiStore{constructor(){super({data:[]})}async search(ue={}){const eo=await API.searchUsers(ue);return this.set({...eo,...ue}),eo}async get(ue){try{return await API.getUser(ue)}catch{return null}}async fetch(){return await API.getUsers()}async onboard(ue){return await API.onboardUsers(ue)}async invite(ue){const eo=ue.map(no=>{let ro;return no.admin||no.builder?ro={global:!0}:no.creator&&(ro={creator:!0}),{email:no.email,userInfo:{admin:no.admin?{global:!0}:void 0,builder:ro,userGroups:no.groups,roles:no.apps?no.apps:void 0}}});return API.inviteUsers(eo)}async removeInvites(ue){return API.removeUserInvites(ue)}async acceptInvite(ue,eo,no,ro){return API.acceptInvite({inviteCode:ue,password:eo,firstName:no,lastName:ro!=null&&ro.trim()?ro:void 0})}async fetchInvite(ue){return API.getUserInvite(ue)}async getInvites(){return API.getUserInvites()}async updateInvite(ue,eo){return API.updateUserInvite(ue,eo)}async getUserCountByApp(ue){return await API.getUserCountByApp(ue)}async create(ue){let eo=ue.users.map(ro=>{const oo={email:ro.email,password:ro.password,roles:{}};switch(ro.forceResetPassword&&(oo.forceResetPassword=ro.forceResetPassword),ro.role){case BudibaseRoles.AppUser:oo.builder={global:!1},oo.admin={global:!1};break;case BudibaseRoles.Developer:oo.builder={global:!0};break;case BudibaseRoles.Creator:oo.builder={creator:!0,global:!1};break;case BudibaseRoles.Admin:oo.admin={global:!0},oo.builder={global:!0};break}return oo});const no=await API.createUsers(eo,ue.groups);return licensing.setQuotaUsage(),await this.search(),no}async delete(ue){await API.deleteUser(ue),licensing.setQuotaUsage()}async bulkDelete(ue){const eo=API.deleteUsers(ue);return licensing.setQuotaUsage(),eo}async save(ue){const eo=await API.saveUser(ue);return licensing.setQuotaUsage(),eo}async addAppBuilder(ue,eo){return await API.addAppBuilder(ue,eo)}async removeAppBuilder(ue,eo){return await API.removeAppBuilder(ue,eo)}async getAccountHolder(){return await API.getAccountHolder()}getUserRole(ue){return ue?ue.email===ue.tenantOwnerEmail?BudibaseRoles.Owner:isAdmin(ue)?BudibaseRoles.Admin:isBuilder(ue)?BudibaseRoles.Developer:hasCreatorPermissions(ue)?BudibaseRoles.Creator:BudibaseRoles.AppUser:BudibaseRoles.AppUser}};const users=new UserStore$1;class AdminStore extends BudiStore{constructor(){super({loaded:!1,multiTenancy:!1,cloud:!1,isDev:!1,disableAccountPortal:!1,offlineMode:!1,maintenance:[]})}async init(){await this.getChecklist(),await this.getEnvironment(),get_store_value(this.store).cloud&&(await this.getSystemStatus(),this.checkStatus()),this.update(ue=>(ue.loaded=!0,ue))}async getEnvironment(){const ue=await API.getEnvironment();this.update(eo=>(eo.multiTenancy=ue.multiTenancy,eo.cloud=ue.cloud,eo.disableAccountPortal=ue.disableAccountPortal,eo.accountPortalUrl=ue.accountPortalUrl,eo.isDev=ue.isDev,eo.baseUrl=ue.baseUrl,eo.offlineMode=ue.offlineMode,eo.maintenance=ue.maintenance,eo.passwordMinLength=ue.passwordMinLength,eo))}async checkStatus(){var eo;const ue=(eo=get_store_value(this.store).status)==null?void 0:eo.health;ue!=null&&ue.passing||await banner.showStatus()}async getSystemStatus(){const ue=await API.getSystemStatus();this.update(eo=>(eo.status=ue,eo))}async getChecklist(){const ue=get_store_value(auth).tenantId,eo=await API.getChecklist(ue);this.update(no=>(no.checklist=eo,no))}unload(){this.update(ue=>(ue.loaded=!1,ue))}}const admin=new AdminStore,TableNames={USERS:"ta_users"},AppStatus={ALL:"all",DEV:"development",DEPLOYED:"published"},IntegrationNames={POSTGRES:"PostgreSQL",MONGODB:"MongoDB",COUCHDB:"CouchDB",S3:"S3",MYSQL:"MySQL",REST:"REST",DYNAMODB:"DynamoDB",ELASTICSEARCH:"ElasticSearch",SQL_SERVER:"SQL Server",AIRTABLE:"Airtable",ARANGODB:"ArangoDB",ORACLE:"Oracle",GOOGLE_SHEETS:"Google Sheets"},UNEDITABLE_USER_FIELDS=["email","password","roleId","status","firstName","lastName"],APP_NAME_REGEX=/^[\w\s]+$/,APP_URL_REGEX=/^[0-9a-zA-Z-_]+$/,DefaultAppTheme={primaryColor:"var(--spectrum-global-color-blue-600)",primaryColorHover:"var(--spectrum-global-color-blue-500)",buttonBorderRadius:"16px",navBackground:"var(--spectrum-global-color-gray-50)",navTextColor:"var(--spectrum-global-color-gray-800)"},PluginSource={URL:"URL",NPM:"NPM",GITHUB:"Github",FILE:"File Upload"},OnboardingType={EMAIL:"email",PASSWORD:"password"},PlanModel={PER_USER:"perUser"},ChangelogURL="https://docs.budibase.com/changelog",AutoScreenTypes={BLANK:"blank",TABLE:"table",FORM:"form"};class AuthStore extends BudiStore{constructor(){super({accountPortalAccess:!1,tenantId:"default",tenantSet:!1,loaded:!1,postLogout:!1,isSSO:!1})}setUser(ue){this.set({loaded:!0,user:ue,accountPortalAccess:!!(ue!=null&&ue.accountPortalAccess),tenantId:(ue==null?void 0:ue.tenantId)||"default",tenantSet:!!ue,isSSO:ue!=null&&isSSOUser(ue),postLogout:!1}),ue&&analytics.activate().then(()=>{analytics.identify(ue._id)}).catch(()=>{})}async setOrganisation(ue){const eo=get_store_value(this.store).tenantId;auth.update(no=>(no.tenantId=ue,no.tenantSet=!!ue,no)),eo!==ue&&await admin.init()}async setInitInfo(ue){return await API.setInitInfo(ue),auth.update(eo=>(eo.initInfo=ue,eo)),ue}setPostLogout(){auth.update(ue=>(ue.postLogout=!0,ue))}async getInitInfo(){const ue=await API.getInitInfo();return auth.update(eo=>(eo.initInfo=ue,eo)),ue}async checkQueryString(){const eo=new URLSearchParams(window.location.search).get("tenantId");eo&&await this.setOrganisation(eo)}async setOrg(ue){await this.setOrganisation(ue)}async getSelf(){try{const ue=await API.fetchBuilderSelf();this.setUser(ue)}catch{this.setUser()}}async login(ue,eo,no){const ro=no||get_store_value(this.store).tenantId;await API.logIn(ro,ue,eo),await this.getSelf()}async logout(){await API.logOut(),this.setPostLogout(),this.setUser(),await this.setInitInfo({})}async updateSelf(ue){await API.updateSelf(ue);try{const eo=await API.fetchBuilderSelf();this.setUser(eo)}catch{this.setUser()}}async forgotPassword(ue){const eo=get_store_value(this.store).tenantId;await API.requestForgotPassword(eo,ue)}async resetPassword(ue,eo){const no=get_store_value(this.store).tenantId;await API.resetPassword(no,ue,eo)}async generateAPIKey(){return API.generateAPIKey()}async fetchAPIKey(){const ue=await API.fetchDeveloperInfo();return ue==null?void 0:ue.apiKey}}const auth=new AuthStore;class AppsStore extends BudiStore{constructor(){super({apps:[]}),this.extractAppId=this.extractAppId.bind(this),this.getProdAppID=this.getProdAppID.bind(this),this.updateSort=this.updateSort.bind(this),this.load=this.load.bind(this),this.save=this.save.bind(this)}extractAppId(ue){const eo=(ue==null?void 0:ue.split("_"))||[];return eo.length?eo[eo.length-1]:null}getProdAppID(ue){if(!ue)return ue;let eo,no="";if(ue.startsWith("app_dev")){const ro=ue.split("app_dev");ro.shift(),eo=ro.join("app_dev")}else if(!ue.startsWith("app"))eo=ue,no="_";else return ue;return`app${no}${eo}`}async updateSort(ue){this.update(eo=>({...eo,sortBy:ue})),await this.updateUserSort(ue)}async updateUserSort(ue){try{await auth.updateSelf({appSort:ue})}catch(eo){console.error("couldn't save user sort: ",eo)}}async load(){const ue=await API.getApps();if(Array.isArray(ue)){let eo={},no=ue.filter(io=>io.status===AppStatus.DEV),ro=ue.filter(io=>io.status===AppStatus.DEPLOYED);no.forEach(io=>{const ao=this.extractAppId(io.appId);ao&&(eo[ao]={...io,devId:io.appId,devRev:io._rev})}),ro.forEach(io=>{const ao=this.extractAppId(io.appId);if(!ao||!eo[ao])return;let so={};eo[ao]&&(so={updatedBy:eo[ao].updatedBy,updatedAt:eo[ao].updatedAt}),eo[ao]={...eo[ao],...io,...so,prodId:io.appId,prodRev:io._rev}});const oo=Object.values(eo);oo.forEach(io=>{const ao=this.extractAppId(io.devId);ao&&(io.appId=ao),delete io._id,delete io._rev}),this.update(io=>({...io,apps:oo}))}else this.update(eo=>({...eo,apps:[]}))}async save(ue,eo){await API.saveAppMetadata(ue,eo),this.update(no=>{const ro=no.apps.findIndex(oo=>oo.instance._id===ue);if(ro!==-1){let oo=no.apps[ro];oo={...oo,...eo},no.apps.splice(ro,1,oo)}return no})}}const appsStore=new AppsStore,sortBy=derived([appsStore,auth],([to,ue])=>{var eo;return to.sortBy||((eo=ue.user)==null?void 0:eo.appSort)||"name"}),enrichedApps=derived([appsStore,auth,sortBy],([to,ue,eo])=>{const no=to.apps.map(ro=>{var io;const oo=ue.user;return{...ro,deployed:ro.status===AppStatus.DEPLOYED,lockedYou:ro.lockedBy!=null&&ro.lockedBy.email===(oo==null?void 0:oo.email),lockedOther:ro.lockedBy!=null&&ro.lockedBy.email!==(oo==null?void 0:oo.email),favourite:!!((io=oo==null?void 0:oo.appFavourites)!=null&&io.includes(ro.appId))}});return eo==="status"?no.sort((ro,oo)=>{var io,ao;return ro.favourite===oo.favourite?ro.status===oo.status?((io=ro.name)==null?void 0:io.toLowerCase())<((ao=oo.name)==null?void 0:ao.toLowerCase())?-1:1:ro.status===AppStatus.DEPLOYED?-1:1:ro.favourite?-1:1}):eo==="updated"?no==null?void 0:no.sort((ro,oo)=>{if(ro.favourite===oo.favourite){const io=ro.updatedAt||"9999",ao=oo.updatedAt||"9999";return io<ao?1:-1}return ro.favourite?-1:1}):no==null?void 0:no.sort((ro,oo)=>{var io,ao;return ro.favourite===oo.favourite?((io=ro.name)==null?void 0:io.toLowerCase())<((ao=oo.name)==null?void 0:ao.toLowerCase())?-1:1:ro.favourite?-1:1})});class EmailStore extends BudiStore{constructor(){super({templates:[]})}async fetchTemplates(){const ue=await API.getEmailTemplateDefinitions(),eo=await API.getEmailTemplates();this.set({definitions:ue,templates:eo})}async saveTemplate(ue){const eo=await API.saveEmailTemplate(ue);ue._rev=eo._rev,ue._id=eo._id,this.update(no=>{const ro=no.templates.findIndex(oo=>oo.purpose===eo.purpose);return no.templates.splice(ro,1,ue),no})}}const email=new EmailStore;class OIDCStore extends BudiStore{constructor(){super({})}async init(){const ue=get_store_value(auth).tenantId,eo=await API.getOIDCConfigs(ue);this.set(eo[0]||{})}}const oidc=new OIDCStore;class TemplateStore extends BudiStore{constructor(){super([])}async load(){const ue=await API.getAppTemplates();this.set(ue)}}const templates=new TemplateStore,ExpiringKeys={LICENSING_PAYMENT_FAILED:"licensing_payment_failed",LICENSING_ACCOUNT_DOWNGRADED_MODAL:"licensing_account_downgraded_modal",LICENSING_APP_LIMIT_MODAL:"licensing_app_limit_modal",LICENSING_ROWS_WARNING_BANNER:"licensing_rows_warning_banner",LICENSING_AUTOMATIONS_WARNING_BANNER:"licensing_automations_warning_banner",LICENSING_QUERIES_WARNING_BANNER:"licensing_queries_warning_banner",LICENSING_USERS_ABOVE_LIMIT_BANNER:"licensing_users_above_limit_banner"},StripeStatus={PAST_DUE:"past_due",ACTIVE:"active"},UNLIMITED=-1,ONE_DAY_MILLIS=864e5;class LicensingStore extends BudiStore{constructor(){super({goToUpgradePage:()=>{},goToPricingPage:()=>{},license:void 0,isFreePlan:!0,isEnterprisePlan:!0,isBusinessPlan:!0,groupsEnabled:!1,backupsEnabled:!1,brandingEnabled:!1,scimEnabled:!1,environmentVariablesEnabled:!1,budibaseAIEnabled:!1,customAIConfigsEnabled:!1,auditLogsEnabled:!1,quotaUsage:void 0,usageMetrics:void 0,quotaResetDaysRemaining:void 0,quotaResetDate:void 0,accountPastDue:!1,pastDueEndDate:void 0,pastDueDaysRemaining:void 0,accountDowngraded:!1,userCount:void 0,userLimit:void 0,userLimitReached:!1,errUserLimit:!1})}usersLimitReached(ue,eo=get_store_value(this.store).userLimit){return eo===UNLIMITED||eo===void 0?!1:ue>=eo}usersLimitExceeded(ue,eo=get_store_value(this.store).userLimit){return eo===UNLIMITED||eo===void 0?!1:ue>eo}async isCloud(){let ue=get_store_value(admin);return ue.loaded||(await admin.init(),ue=get_store_value(admin)),ue.cloud}async init(){this.setNavigation(),this.setLicense(),await this.setQuotaUsage()}setNavigation(){var io;const ue=get_store_value(admin),eo=get_store_value(auth),no=(io=eo==null?void 0:eo.user)!=null&&io.accountPortalAccess?`${ue.accountPortalUrl}/portal/upgrade`:"/builder/portal/account/upgrade",ro=()=>{window.location.href=no},oo=()=>{window.open("https://budibase.com/pricing/","_blank")};this.update(ao=>({...ao,goToUpgradePage:ro,goToPricingPage:oo}))}setLicense(){var $o;const ue=($o=get_store_value(auth).user)==null?void 0:$o.license,eo=ue==null?void 0:ue.plan.type,no=(ue==null?void 0:ue.features)||[],ro=eo===PlanType.ENTERPRISE,oo=eo===PlanType.FREE,io=eo===PlanType.BUSINESS,ao=eo===PlanType.ENTERPRISE_BASIC_TRIAL,so=no.includes(Feature.USER_GROUPS),lo=no.includes(Feature.APP_BACKUPS),co=no.includes(Feature.SCIM),uo=no.includes(Feature.ENVIRONMENT_VARIABLES),fo=no.includes(Feature.ENFORCEABLE_SSO),po=no.includes(Feature.BRANDING),ho=no.includes(Feature.AUDIT_LOGS),_o=no.includes(Feature.SYNC_AUTOMATIONS),go=no.includes(Feature.TRIGGER_AUTOMATION_RUN),bo=no.includes(Feature.APP_BUILDERS),vo=no.includes(Feature.BUDIBASE_AI),yo=no.includes(Feature.AI_CUSTOM_CONFIGS);this.update(ko=>({...ko,license:ue,isEnterprisePlan:ro,isFreePlan:oo,isBusinessPlan:io,isEnterpriseTrial:ao,groupsEnabled:so,backupsEnabled:lo,brandingEnabled:po,budibaseAIEnabled:vo,customAIConfigsEnabled:yo,scimEnabled:co,environmentVariablesEnabled:uo,auditLogsEnabled:ho,enforceableSSO:fo,syncAutomationsEnabled:_o,triggerAutomationRunEnabled:go,perAppBuildersEnabled:bo}))}async setQuotaUsage(){const ue=await API.getQuotaUsage();this.update(eo=>({...eo,quotaUsage:ue})),await this.setUsageMetrics()}async setUsageMetrics(){var ko,So,Ao,Mo,Eo,To,Io,No,xo,zo,Po;const ue=get_store_value(this.store).quotaUsage,eo=(ko=get_store_value(auth).user)==null?void 0:ko.license,no=new Date;if(!eo||!ue)return;const ro=[MonthlyQuotaName.QUERIES,MonthlyQuotaName.AUTOMATIONS].reduce((Bo,qo)=>{var Go;const Fo=eo.quotas.usage.monthly[qo].value,Wo=(((Go=ue.monthly.current)==null?void 0:Go[qo])||0)/Fo*100;return Bo[qo]=Fo>-1?Math.floor(Wo):-1,Bo},{}),oo=[StaticQuotaName.APPS,StaticQuotaName.ROWS].reduce((Bo,qo)=>{const Fo=eo.quotas.usage.static[qo].value,Wo=(ue.usageQuota[qo]||0)/Fo*100;return Bo[qo]=Fo>-1?Math.floor(Wo):-1,Bo},{}),io=(Bo,qo)=>qo>Bo?Math.round((qo.getTime()-Bo.getTime())/ONE_DAY_MILLIS):0,ao=new Date(ue.quotaReset),so=io(no,ao),lo=!!((Ao=(So=eo.billing)==null?void 0:So.subscription)!=null&&Ao.downgradeAt)&&((Eo=(Mo=eo.billing)==null?void 0:Mo.subscription)==null?void 0:Eo.downgradeAt)<=no.getTime()&&((Io=(To=eo.billing)==null?void 0:To.subscription)==null?void 0:Io.status)===StripeStatus.PAST_DUE&&eo.plan.type===PlanType.FREE,co=(xo=(No=eo.billing)==null?void 0:No.subscription)==null?void 0:xo.pastDueAt,uo=(Po=(zo=eo.billing)==null?void 0:zo.subscription)==null?void 0:Po.downgradeAt;let fo,po;co&&uo&&(po=new Date(uo),fo=io(new Date(co),po));const _o=eo.quotas.usage.static.users.value,go=ue.usageQuota.users,bo=this.usersLimitReached(go,_o),vo=this.usersLimitExceeded(go,_o),$o=await this.isCloud()&&eo.plan.model===PlanModel$1.PER_USER&&vo;this.update(Bo=>({...Bo,usageMetrics:{...ro,...oo},quotaResetDaysRemaining:so,quotaResetDate:ao,accountDowngraded:lo,accountPastDue:co!=null,pastDueEndDate:po,pastDueDaysRemaining:fo,userCount:go,userLimit:_o,userLimitReached:bo,errUserLimit:$o}))}}const licensing=new LicensingStore;class GroupStore extends BudiStore{constructor(){super([]),this.updateStore=ue=>{this.update(eo=>{const no=eo.findIndex(ro=>ro._id===ue._id);return no>=0?eo.splice(no,1,ue):eo.push(ue),eo})}}async init(){if(get_store_value(licensing).groupsEnabled){const ue=await API.getGroups();this.set(ue)}}async refreshGroup(ue){const eo=await API.getGroup(ue);this.updateStore(eo)}async save(ue){const{...eo}=ue;delete eo.scimInfo;const no=await API.saveGroup(eo);return ue._id=no._id,ue._rev=no._rev,this.updateStore(ue),ue}async delete(ue){await API.deleteGroup(ue._id,ue._rev),this.update(eo=>{const no=eo.findIndex(ro=>ro._id===ue._id);return no!==-1&&eo.splice(no,1),eo})}async addUser(ue,eo){await API.addUsersToGroup(ue,[eo]),await this.refreshGroup(ue)}async removeUser(ue,eo){await API.removeUsersFromGroup(ue,[eo]),await this.refreshGroup(ue)}async addApp(ue,eo,no){await API.addAppsToGroup(ue,[{appId:eo,roleId:no}]),await this.refreshGroup(ue)}async removeApp(ue,eo){await API.removeAppsFromGroup(ue,[{appId:eo}]),await this.refreshGroup(ue)}getGroupAppIds(ue){var no;let eo=Object.keys((ue==null?void 0:ue.roles)||{});return(no=ue==null?void 0:ue.builder)!=null&&no.apps&&(eo=eo.concat(ue.builder.apps)),eo}async addGroupAppBuilder(ue,eo){return await API.addGroupAppBuilder(ue,eo)}async removeGroupAppBuilder(ue,eo){return await API.removeGroupAppBuilder(ue,eo)}}const groups=new GroupStore;function createPluginsStore(){const{subscribe:to,set:ue,update:eo}=writable([]);async function no(){const ao=await API.getPlugins();ue(ao)}async function ro(ao){await API.deletePlugin(ao),eo(so=>(so=so.filter(lo=>lo._id!==ao),so))}async function oo(ao,so,lo=null){let co={source:ao,url:so};switch(ao){case PluginSource.URL:co.headers=lo;break;case PluginSource.GITHUB:co.githubToken=lo;break}let fo=(await API.createPlugin(co)).plugin;eo(po=>{const ho=po.findIndex(_o=>_o._id===fo._id);return ho>=0?po.splice(ho,1,fo):po.push(fo),po})}async function io(ao){if(!ao)return;let so=new FormData;so.append("file",ao);let co=(await API.uploadPlugin(so)).plugins[0];eo(uo=>{const fo=uo.findIndex(po=>po._id===co._id);return fo>=0?uo.splice(fo,1,co):uo.push(co),uo})}return{subscribe:to,load:no,createPlugin:oo,deletePlugin:ro,uploadPlugin:io}}const plugins$1=createPluginsStore();class BackupStore extends BudiStore{constructor(){super({})}selectBackup(ue){this.update(eo=>(eo.selectedBackup=ue,eo))}async searchBackups(ue,eo){return API.searchBackups(ue,eo)}async restoreBackup(ue,eo,no){return API.restoreBackup(ue,eo,no)}async deleteBackup(ue,eo){return API.deleteBackup(ue,eo)}async createManualBackup(ue){return API.createManualBackup(ue)}}const backups=new BackupStore;class EnvironmentStore extends BudiStore{constructor(){super({variables:[],status:{encryptionKeyAvailable:!1}})}async checkStatus(){const ue=await API.checkEnvironmentVariableStatus();this.update(eo=>(eo.status=ue,eo))}async loadVariables(){if(get_store_value(licensing).environmentVariablesEnabled){const eo=(await API.fetchEnvironmentVariables()).variables.map(no=>({name:no}));this.update(no=>(no.variables=eo,no))}}async createVariable(ue){await API.createEnvironmentVariable(ue);let eo={name:ue.name};this.update(no=>(no.variables=[eo,...no.variables],no))}async deleteVariable(ue){await API.deleteEnvironmentVariable(ue),this.update(eo=>(eo.variables=eo.variables.filter(no=>no.name!==ue),eo))}async updateVariable(ue,eo){await API.updateEnvironmentVariable(ue,eo)}async upgradePanelOpened(){await API.publishEvent(EventPublishType$1.ENVIRONMENT_VARIABLE_UPGRADE_PANEL_OPENED)}}const environment=new EnvironmentStore,menu=derived([admin,auth],([to,ue])=>{var lo;const eo=ue==null?void 0:ue.user,no=eo!=null&&isAdmin(eo),ro=eo!=null&&isGlobalBuilder(eo),oo=to==null?void 0:to.cloud;let io=[{title:"Users",href:"/builder/portal/users/users"}];io.push({title:"Groups",href:"/builder/portal/users/groups"});let ao=[{title:"Apps",href:"/builder/portal/apps"}];if(ro&&(ao.push({title:"Users",href:"/builder/portal/users",subPages:io}),ao.push({title:"Plugins",href:"/builder/portal/plugins"})),no){let co=[{title:"Auth",href:"/builder/portal/settings/auth"},{title:"Email",href:"/builder/portal/settings/email"},{title:"Organisation",href:"/builder/portal/settings/organisation"},{title:"Branding",href:"/builder/portal/settings/branding"},{title:"Environment",href:"/builder/portal/settings/environment"},{title:"AI",href:"/builder/portal/settings/ai"}];oo||(co.push({title:"Version",href:"/builder/portal/settings/version"}),co.push({title:"Diagnostics",href:"/builder/portal/settings/diagnostics"})),ao.push({title:"Settings",href:"/builder/portal/settings",subPages:[...co].sort((uo,fo)=>uo.title.localeCompare(fo.title))})}let so=[{title:"Usage",href:"/builder/portal/account/usage"}];return no&&(so.push({title:"Audit Logs",href:"/builder/portal/account/auditLogs"}),oo||so.push({title:"System Logs",href:"/builder/portal/account/systemLogs"})),oo&&(eo!=null&&eo.accountPortalAccess)?so.push({title:"Upgrade",href:(to==null?void 0:to.accountPortalUrl)+"/portal/upgrade"}):!oo&&no&&so.push({title:"Upgrade",href:"/builder/portal/account/upgrade"}),eo!=null&&eo.accountPortalAccess&&((lo=eo==null?void 0:eo.account)!=null&&lo.stripeCustomerId)&&so.push({title:"Billing",href:(to==null?void 0:to.accountPortalUrl)+"/portal/billing"}),ao.push({title:"Account",href:"/builder/portal/account",subPages:so}),ao});class AuditLogsStore extends BudiStore{constructor(){super({})}async search(ue={}){if(get_store_value(licensing).auditLogsEnabled){const eo=await API.searchAuditLogs(ue);return this.update(no=>({...no,logs:eo})),eo}}async getEventDefinitions(){const ue=await API.getEventDefinitions();this.update(eo=>({...eo,events:ue.events}))}getDownloadUrl(ue={}){return API.getDownloadUrl(ue)}}const auditLogs=new AuditLogsStore;class FeatureStore extends DerivedBudiStore{constructor(){const ue=eo=>derived([eo,licensing],([no,ro])=>({isScimEnabled:no.scimConfigEnabled&&ro.scimEnabled}));super({scimConfigEnabled:!1},ue)}async init(){const ue=await API.getConfig(ConfigType.SCIM);this.update(eo=>({...eo,scimConfigEnabled:isConfig(ue)&&isSCIMConfig(ue)&&ue.config.enabled}))}}const features=new FeatureStore;let ThemeStore$1=class extends DerivedBudiStore{constructor(){const ue=eo=>derived(eo,no=>({...no,theme:ensureValidTheme(no.theme,DefaultBuilderTheme)}));super({theme:DefaultBuilderTheme},ue,{persistence:{key:"bb-theme",type:PersistenceType.LOCAL}}),this.subscribe(({theme:eo})=>{const no=getThemeClassNames(eo).split(" ");ThemeOptions.forEach(ro=>{const oo=`${ThemeClassPrefix}${ro.id}`;document.documentElement.classList.toggle(oo,no.includes(oo))})})}};const themeStore$1=new ThemeStore$1;class TemporalStore extends BudiStore{constructor(){super({},{persistence:{key:"bb-temporal",type:PersistenceType.LOCAL}}),this.setExpiring=(ue,eo,no)=>{const ro={...eo,expiry:Date.now()+no*1e3};this.update(oo=>({...oo,[ue]:ro}))}}getExpiring(ue){const eo=get_store_value(this.store)[ue];return eo?eo.expiry<Date.now()?(this.update(ro=>(delete ro[ue],ro)),null):eo:null}}const temporalStore=new TemporalStore;let NavigationStore$1=class extends BudiStore{constructor(){super({initialisated:!1,goto:void 0})}init(ue){if(typeof ue!="function")throw new Error(`gotoFunc must be a function, found a "${typeof ue}" instead`);this.set({initialisated:!0,goto:ue})}};const navigation=new NavigationStore$1;derived(auth,to=>{var ue;return{...FeatureFlagDefaults,...((ue=to==null?void 0:to.user)==null?void 0:ue.flags)||{}}});const sideBarCollapsed=writable(!1);function extractRelationships(to){return to.filter(ue=>{var eo;return((eo=ue.fieldSchema)==null?void 0:eo.type)==="link"}).filter(ue=>{var eo;return!((eo=ue.component)!=null&&eo.endsWith("/form"))}).map(ue=>{const{providerId:eo,readableBinding:no,fieldSchema:ro}=ue||{},{name:oo,tableId:io}=ro||{},ao=makePropSafe(eo);return{providerId:eo,label:no,fieldName:oo,tableId:io,type:"link",rowId:`{{ ${ao}.${makePropSafe("_id")} }}`,rowTableId:`{{ ${ao}.${makePropSafe("tableId")} }}`}})}function extractFields(to){return to.filter(ue=>{var eo,no;return((eo=ue.fieldSchema)==null?void 0:eo.type)==="attachment"||((no=ue.fieldSchema)==null?void 0:no.type)==="array"&&ue.tableId}).map(ue=>{const{providerId:eo,readableBinding:no,runtimeBinding:ro}=ue,{name:oo,type:io,tableId:ao}=ue.fieldSchema;return{providerId:eo,label:no,fieldName:oo,fieldType:io,tableId:ao,type:"field",value:`{{ literal ${ro} }}`}})}function extractJSONArrayFields(to){return to.filter(ue=>{var eo,no,ro;return((eo=ue.fieldSchema)==null?void 0:eo.type)==="jsonarray"||((no=ue.fieldSchema)==null?void 0:no.type)==="json"&&((ro=ue.fieldSchema)==null?void 0:ro.subtype)==="array"}).map(ue=>{const{providerId:eo,readableBinding:no,runtimeBinding:ro,tableId:oo}=ue,{name:io,type:ao,prefixKeys:so,subtype:lo}=ue.fieldSchema;return{providerId:eo,label:no,fieldName:io,fieldType:ao,tableId:oo,prefixKeys:so,type:ao==="jsonarray"?"jsonarray":"queryarray",subtype:lo,value:`{{ literal ${ro} }}`}})}const{ContextScopes:ContextScopes$1}=Constants$1,findComponent=(to,ue)=>searchComponentTree(to,eo=>eo._id===ue),findComponentType=(to,ue)=>searchComponentTree(to,eo=>eo._component===ue),findComponentParent=(to,ue,eo=null)=>{if(!to||!ue)return null;if(to._id===ue)return eo;if(!to._children)return null;for(const no of to._children){const ro=findComponentParent(no,ue,to);if(ro)return ro}return null},findComponentPath=(to,ue,eo=[])=>{if(!to||!ue)return[];if(to._id===ue)return[...eo,to];if(!to._children)return[];for(const no of to._children){const ro=[...eo,to],oo=findComponentPath(no,ue,ro);if(oo!=null&&oo.length)return oo}return[]},findAllMatchingComponents=(to,ue)=>{if(!to||!ue)return[];let eo=[];return to._children&&to._children.forEach(no=>{eo=[...eo,...findAllMatchingComponents(no,ue)]}),ue(to)&&eo.push(to),eo.reverse()},findAllComponents=to=>findAllMatchingComponents(to,()=>!0),findClosestMatchingComponent=(to,ue,eo)=>{if(!eo)return null;const no=findComponentPath(to,ue).reverse();for(let ro of no)if(eo(ro))return ro;return null},searchComponentTree=(to,ue)=>{if(!to||!ue)return null;if(ue(to))return to;if(!to._children)return null;for(const eo of to._children){const no=searchComponentTree(eo,ue);if(no)return no}return null},makeComponentUnique=to=>{if(!to)return;const ue=[],eo=(oo,io)=>{var lo;const ao=oo._id,so=uuid$2();io.push([ao,so]),(lo=oo._children)==null||lo.forEach(co=>eo(co,io))};eo(to,ue);let no=JSON.stringify(to);return ue.forEach(([oo,io])=>{no=no.replace(new RegExp(oo,"g"),io)}),findHBSBlocks(no).forEach(oo=>{let io=oo.replace(/\\"/g,'"'),ao=decodeJSBinding(io);if(ao!=null){for(const[lo,co]of ue)ao=ao.replace(new RegExp(lo,"g"),co);let so=encodeJSBinding(ao);so=so.replace(/"/g,'\\"'),no=no.replace(oo,so)}}),JSON.parse(no)},getComponentText=to=>{var eo;if(to==null)return"";if(to!=null&&to._instanceName)return to._instanceName;const ue=((eo=to._component)==null?void 0:eo.replace("@budibase/standard-components/",""))||"component";return capitalise(ue)},getComponentName=to=>{var no;if(to==null)return"";const eo=(((no=get_store_value(componentStore))==null?void 0:no.components)||{})[to._component]||{};return eo.friendlyName||eo.name||""},getComponentContexts=to=>{const ue=componentStore.getDefinition(to);let eo=[];return ue!=null&&ue.context&&(eo=Array.isArray(ue.context)?[...ue.context]:[ue.context]),ue!=null&&ue.actions&&eo.push({type:"action",scope:ContextScopes$1.Global,actions:ue.actions.map(no=>typeof no=="string"?{type:no}:no)}),eo},buildContextTree=(to,ue={root:[]},eo="root")=>{if(!to)return ue;const no=getComponentContexts(to._component);return no.length&&(ue[eo].push(to._id),no.some(ro=>ro.scope===ContextScopes$1.Local)&&(eo=to._id,ue[to._id]=[])),to._children&&to._children.forEach(ro=>{buildContextTree(ro,ue,eo)}),ue},buildContextTreeLookupMap=to=>{const ue=buildContextTree(to),eo={};return Object.entries(ue).forEach(([no,ro])=>{ro.forEach(oo=>{eo[oo]=no})}),eo},getChildIdsForComponent=to=>[to._id,...((to==null?void 0:to._children)??[]).map(getChildIdsForComponent).flat(1)],actions=[{name:"Save Row",type:"data",component:"SaveRow",context:[{label:"Saved row",value:"row"}]},{name:"Duplicate Row",type:"data",component:"DuplicateRow",context:[{label:"Duplicated row",value:"row"}]},{name:"Delete Row",displayName:"Delete Rows",type:"data",component:"DeleteRow"},{name:"Fetch Row",type:"data",component:"FetchRow",context:[{label:"Fetched row",value:"row"}]},{name:"Navigate To",type:"application",component:"NavigateTo"},{name:"Execute Query",type:"data",component:"ExecuteQuery",context:[{label:"Query result",value:"result"}]},{name:"Trigger Automation",type:"application",component:"TriggerAutomation",context:[{label:"Automation Result",value:"result"}]},{name:"Update Field Value",type:"form",component:"UpdateFieldValue"},{name:"Scroll To Field",type:"form",component:"ScrollTo"},{name:"Validate Form",type:"form",component:"ValidateForm"},{name:"Change Form Step",type:"form",component:"ChangeFormStep"},{name:"Clear Form",type:"form",component:"ClearForm"},{name:"Log Out",type:"application",component:"LogOut"},{name:"Close Screen Modal",type:"application",component:"CloseScreenModal"},{name:"Refresh Data Provider",type:"data",component:"RefreshDataProvider"},{name:"Update State",type:"data",component:"UpdateState",dependsOnFeature:"state"},{name:"Upload File to S3",type:"data",component:"S3Upload",context:[{label:"File URL",value:"publicUrl"}]},{name:"Export Data",type:"data",component:"ExportData"},{name:"Continue if / Stop if",type:"logic",component:"ContinueIf",dependsOnFeature:"continueIfAction"},{name:"Show Notification",type:"application",component:"ShowNotification",dependsOnFeature:"showNotificationAction"},{name:"Prompt User",type:"application",component:"PromptUser"},{name:"Open Side Panel",type:"application",component:"OpenSidePanel",dependsOnFeature:"sidePanel"},{name:"Close Side Panel",type:"application",component:"CloseSidePanel",dependsOnFeature:"sidePanel"},{name:"Open Modal",type:"application",component:"OpenModal",dependsOnFeature:"modal"},{name:"Close Modal",type:"application",component:"CloseModal",dependsOnFeature:"modal"},{name:"Clear Row Selection",type:"data",component:"ClearRowSelection"},{name:"Download File",type:"data",component:"DownloadFile"},{name:"Row Action",type:"data",component:"RowAction"}],ActionDefinitions={actions},convertOldFieldFormat=to=>to?to.map(eo=>typeof eo=="string"?{field:eo,active:!0}:typeof(eo==null?void 0:eo.active)!="boolean"?{field:eo.name,active:!0}:eo):[],getComponentForField=(to,ue)=>{if(!to||!(ue!=null&&ue[to]))return null;const eo=ue[to].type;return FieldTypeToComponentMap[eo]},FieldTypeToComponentMap={[FieldType.STRING]:"stringfield",[FieldType.NUMBER]:"numberfield",[FieldType.BIGINT]:"bigintfield",[FieldType.OPTIONS]:"optionsfield",[FieldType.ARRAY]:"multifieldselect",[FieldType.BOOLEAN]:"booleanfield",[FieldType.LONGFORM]:"longformfield",[FieldType.DATETIME]:"datetimefield",[FieldType.SIGNATURE_SINGLE]:"signaturesinglefield",[FieldType.ATTACHMENTS]:"attachmentfield",[FieldType.ATTACHMENT_SINGLE]:"attachmentsinglefield",[FieldType.LINK]:"relationshipfield",[FieldType.JSON]:"jsonfield",[FieldType.BARCODEQR]:"codescanner",[FieldType.BB_REFERENCE]:"bbreferencefield",[FieldType.BB_REFERENCE_SINGLE]:"bbreferencesinglefield"},{TypeIconMap}=Constants$1,AUTO_COLUMN_SUB_TYPES=AutoFieldSubType,AUTO_COLUMN_DISPLAY_NAMES={AUTO_ID:"Auto ID",CREATED_BY:"Created By",CREATED_AT:"Created At",UPDATED_BY:"Updated By",UPDATED_AT:"Updated At"},FIELDS={STRING:{name:"Text",type:FieldType.STRING,icon:TypeIconMap[FieldType.STRING],constraints:{type:"string",length:{},presence:!1}},BARCODEQR:{name:"Barcode / QR",type:FieldType.BARCODEQR,icon:TypeIconMap[FieldType.BARCODEQR],constraints:{type:"string",length:{},presence:!1}},LONGFORM:{name:"Long form text",type:FieldType.LONGFORM,icon:TypeIconMap[FieldType.LONGFORM],constraints:{type:"string",length:{},presence:!1}},OPTIONS:{name:"Single select",type:FieldType.OPTIONS,icon:TypeIconMap[FieldType.OPTIONS],constraints:{type:"string",presence:!1,inclusion:[]}},ARRAY:{name:"Multi select",type:FieldType.ARRAY,icon:TypeIconMap[FieldType.ARRAY],constraints:{type:"array",presence:!1,inclusion:[]}},NUMBER:{name:"Number",type:FieldType.NUMBER,icon:TypeIconMap[FieldType.NUMBER],constraints:{type:"number",presence:!1,numericality:{greaterThanOrEqualTo:"",lessThanOrEqualTo:""}}},BIGINT:{name:"Big integer",type:FieldType.BIGINT,icon:TypeIconMap[FieldType.BIGINT]},BOOLEAN:{name:"Boolean",type:FieldType.BOOLEAN,icon:TypeIconMap[FieldType.BOOLEAN],constraints:{type:"boolean",presence:!1}},DATETIME:{name:"Date / time",type:FieldType.DATETIME,icon:TypeIconMap[FieldType.DATETIME],constraints:{type:"string",length:{},presence:!1,datetime:{latest:"",earliest:""}}},ATTACHMENT_SINGLE:{name:"Single attachment",type:FieldType.ATTACHMENT_SINGLE,icon:TypeIconMap[FieldType.ATTACHMENT_SINGLE],constraints:{presence:!1}},ATTACHMENTS:{name:"Multi attachment",type:FieldType.ATTACHMENTS,icon:TypeIconMap[FieldType.ATTACHMENTS],constraints:{type:"array",presence:!1}},SIGNATURE_SINGLE:{name:"Signature",type:FieldType.SIGNATURE_SINGLE,icon:"AnnotatePen",constraints:{presence:!1}},LINK:{name:"Relationship",type:FieldType.LINK,icon:TypeIconMap[FieldType.LINK],constraints:{type:"array",presence:!1}},AUTO:{name:"Auto column",type:FieldType.AUTO,icon:TypeIconMap[FieldType.AUTO],constraints:{}},FORMULA:{name:"Formula",type:FieldType.FORMULA,icon:TypeIconMap[FieldType.FORMULA],constraints:{}},AI:{name:"AI",type:FieldType.AI,icon:TypeIconMap[FieldType.AI],constraints:{}},JSON:{name:"JSON",type:FieldType.JSON,icon:TypeIconMap[FieldType.JSON],constraints:{type:"object",presence:!1}},USER:{name:"Single user",type:FieldType.BB_REFERENCE_SINGLE,subtype:BBReferenceFieldSubType.USER,icon:TypeIconMap[FieldType.BB_REFERENCE_SINGLE][BBReferenceFieldSubType.USER]},USERS:{name:"Multi user",type:FieldType.BB_REFERENCE,subtype:BBReferenceFieldSubType.USER,icon:TypeIconMap[FieldType.BB_REFERENCE][BBReferenceFieldSubType.USER],constraints:{type:"array"}}},Roles$1={ADMIN:"ADMIN",POWER:"POWER",BASIC:"BASIC",PUBLIC:"PUBLIC",BUILDER:"BUILDER"},PrettyRelationshipDefinitions={MANY:"Many rows",ONE:"One row"},BUDIBASE_INTERNAL_DB_ID=INTERNAL_TABLE_SOURCE_ID,DEFAULT_BB_DATASOURCE_ID="datasource_internal_bb_default",BUDIBASE_DATASOURCE_TYPE="budibase",DB_TYPE_INTERNAL="internal",DB_TYPE_EXTERNAL="external",IntegrationTypes={POSTGRES:"POSTGRES",MONGODB:"MONGODB",COUCHDB:"COUCHDB",S3:"S3",MYSQL:"MYSQL",REST:"REST",DYNAMODB:"DYNAMODB",ELASTICSEARCH:"ELASTICSEARCH",SQL_SERVER:"SQL_SERVER",AIRTABLE:"AIRTABLE",ARANGODB:"ARANGODB",ORACLE:"ORACLE",INTERNAL:"INTERNAL",GOOGLE_SHEETS:"GOOGLE_SHEETS",FIRESTORE:"FIRESTORE",REDIS:"REDIS",SNOWFLAKE:"SNOWFLAKE"},SchemaTypeOptions=[{label:"Text",value:FieldType.STRING},{label:"Number",value:FieldType.NUMBER},{label:"Boolean",value:FieldType.BOOLEAN},{label:"Datetime",value:FieldType.DATETIME},{label:"JSON",value:FieldType.JSON}],SchemaTypeOptionsExpanded=SchemaTypeOptions.map(to=>({...to,value:{type:to.value}})),RawRestBodyTypes={NONE:"none",FORM:"form",ENCODED:"encoded",JSON:"json",TEXT:"text",XML:"xml"},RestBodyTypes=[{name:"none",value:"none"},{name:"form-data",value:"form"},{name:"x-www-form-encoded",value:"encoded"},{name:"raw (JSON)",value:"json"},{name:"raw (XML)",value:"xml"},{name:"raw (Text)",value:"text"}],PaginationTypes=[{label:"Page number based",value:"page"},{label:"Cursor based",value:"cursor"}],PaginationLocations=[{label:"Query parameters",value:"query"},{label:"Request body",value:"body"}],DatasourceTypes={RELATIONAL:"Relational",NON_RELATIONAL:"Non-relational",SPREADSHEET:"Spreadsheet",OBJECT_STORE:"Object store",GRAPH:"Graph",API:"API"},{ContextScopes}=Constants$1,CAPTURE_VAR_INSIDE_TEMPLATE=/{{([^}]+)}}/g,CAPTURE_VAR_INSIDE_JS=/\$\("([^")]+)"\)/g,UpdateReferenceAction={ADD:"add",DELETE:"delete",MOVE:"move"},getBindableProperties=(to,ue)=>{const eo=getContextBindings(to,ue),no=getUserBindings(),ro=getUrlBindings(to),oo=getDeviceBindings(),io=getStateBindings(),ao=getSelectedRowsBindings(to),so=getRoleBindings(),lo=getEmbedBindings();return[...eo,...ro,...io,...no,...oo,...ao,...so,...lo]},getRestBindings=()=>{const to=get_store_value(licensing).environmentVariablesEnabled;return[...getUserBindings(),...getAuthBindings(),...to?getEnvironmentBindings():[]]},getAuthBindings=()=>{let to=[];const ue=makePropSafe("user"),eo=makePropSafe("oauth2"),no=makePropSafe("accessToken");return to=[{runtime:`${ue}.${eo}.${no}`,readable:"Current User.OAuthToken",key:"accessToken",display:{name:"OAuthToken",type:"text"}}].map(oo=>({type:"context",runtimeBinding:oo.runtime,readableBinding:oo.readable,fieldSchema:{type:"string",name:oo.key},providerId:"user",category:"Current User",display:oo.display})),to},getEnvironmentBindings=()=>get_store_value(environment).variables.map(ue=>({type:"context",runtimeBinding:`env.${makePropSafe(ue.name)}`,readableBinding:`env.${ue.name}`,category:"Environment",icon:"Key",display:{type:"string",name:ue.name}})),toBindingsArray=(to,ue,eo)=>to?Object.keys(to).reduce((no,ro)=>{if(!ro)return no;let oo={type:"context",runtimeBinding:ro,readableBinding:`${ue}.${ro}`,icon:"Brackets"};return eo&&(oo.category=eo),no.push(oo),no},[]):[],readableToRuntimeMap=(to,ue)=>!to||!ue?{}:Object.keys(ue).reduce((eo,no)=>(eo[no]=readableToRuntimeBinding(to,ue[no]),eo),{}),runtimeToReadableMap=(to,ue)=>!to||!ue?{}:Object.keys(ue).reduce((eo,no)=>(eo[no]=runtimeToReadableBinding(to,ue[no]),eo),{}),getComponentBindableProperties=(to,ue)=>{if(!to||!ue)return[];const eo=findComponent(to.props,ue),no=componentStore.getDefinition(eo==null?void 0:eo._component);if(!(no!=null&&no.context))return[];const ro=Array.isArray(no.context)?no.context:[no.context];return generateComponentContextBindings(to,{component:eo,definition:no,contexts:ro})},getAllComponentContexts=(to,ue,eo,no={includeSelf:!1})=>{if(!to||!ue)return[];let ro={};const oo=findComponentPath(to.props,ue),io=oo.map(co=>co._id),ao=buildContextTreeLookupMap(to.props),so=co=>uo=>{const fo=ao[uo._id];if(fo!=="root"&&!io.includes(fo))return;const po=uo._component;getComponentContexts(po).forEach(_o=>{eo&&_o.type!==eo||(_o.scope||ContextScopes.Global)!==co||isContextCompatibleWithComponent(_o,uo)&&(ro[uo._id]||(ro[uo._id]={component:uo,definition:componentStore.getDefinition(po),contexts:[]}),ro[uo._id].contexts.push(_o))})};return findAllComponents(to.props).forEach(so(ContextScopes.Global)),oo.forEach(so(ContextScopes.Local)),no!=null&&no.includeSelf||delete ro[ue],Object.values(ro).filter(co=>co.contexts.length>0)},getActionProviders=(to,ue,eo,no={includeSelf:!1})=>getAllComponentContexts(to,ue,"action",{includeSelf:no==null?void 0:no.includeSelf}).map(oo=>{var io,ao;return{...oo,action:(ao=(io=oo.contexts[0])==null?void 0:io.actions)==null?void 0:ao.find(so=>so.type===eo)}}).filter(({action:oo})=>oo!=null).map(({component:oo,action:io})=>{let ao=oo._id;return io.suffix&&(ao+=`-${io.suffix}`),{readableBinding:oo._instanceName,runtimeBinding:ao}}),getDatasourceForProvider=(to,ue)=>{const eo=componentStore.getComponentSettings(ue==null?void 0:ue._component),no=eo.find(ao=>ao.type==="dataProvider");if(no){const ao=ue[no.key],so=extractLiteralHandlebarsID(ao),lo=findComponent(to==null?void 0:to.props,so);return getDatasourceForProvider(to,lo)}const ro=["dataSource","table","schema"],oo=eo.find(ao=>ro.includes(ao.type));if(!oo)return null;const io=ue[oo==null?void 0:oo.key];return typeof io=="string"?{tableId:io,type:"table"}:io},getContextBindings=(to,ue)=>getAllComponentContexts(to,ue).map(no=>generateComponentContextBindings(to,no)).flat(),generateComponentContextBindings=(to,ue)=>{const{component:eo,definition:no,contexts:ro}=ue;if(!eo||!no||!(ro!=null&&ro.length))return[];let oo=[];return ro.forEach(io=>{var ho;if(!(io!=null&&io.type))return;let ao,so,lo,co=io.suffix;if(io.type==="form")ao=buildFormSchema(eo,to),lo="Fields";else if(io.type==="static")ao={},(io.values||[]).forEach(go=>{ao[go.key]={name:go.label,type:go.type||"string"}});else if(io.type==="schema"){const _o=getDatasourceForProvider(to,eo);if(!_o)return;const go=getSchemaForDatasource(to,_o);if(ao=go.schema,so=go.table,_o.type==="jsonarray"||_o.type==="queryarray"){const bo=_o.label.split(".");lo=bo[bo.length-1]}else if(_o.type==="viewV2"){const bo=Object.values((so==null?void 0:so.views)||{}).find(vo=>vo.id===_o.id);lo=bo==null?void 0:bo.name}else lo=(ho=go.table)==null?void 0:ho.name}if(!ao)return;const uo=Object.keys(ao).sort();let fo=eo._id;co&&(fo+=`-${co}`);const po=makePropSafe(fo);uo.forEach(_o=>{var ko;const go=ao[_o],bo=_o.split(".").map(makePropSafe).join("."),vo=`${po}.${bo}`;let yo=eo._instanceName;lo&&(yo+=`.${lo}`),yo+=`.${go.name||_o}`;const $o=getComponentBindingCategory(eo,io,no);oo.push({type:"context",runtimeBinding:vo,readableBinding:`${yo}`,fieldSchema:go,providerId:fo,tableId:so==null?void 0:so._id,component:eo._component,category:$o.category,icon:$o.icon,display:{name:`${go.name||_o}`,type:((ko=go.display)==null?void 0:ko.type)||go.type}})})}),oo},isContextCompatibleWithComponent=(to,ue)=>{if(!ue)return!1;const{_component:eo,actionType:no}=ue,{type:ro}=to;return!(eo.endsWith("formblock")&&(no==="Create"&&ro==="schema"||no==="View"&&ro==="form"))},getComponentBindingCategory=(to,ue,eo)=>{let no=eo.icon,ro=to._instanceName;return to._component.endsWith("formblock")&&(ue.type==="form"?(ro=`${to._instanceName} - Fields`,no="Form"):ue.type==="schema"&&(ro=`${to._instanceName} - Row`,no="Data")),{icon:no,category:ro}},getUserBindings=()=>{let to=[];const{schema:ue}=getSchemaForDatasourcePlus(TableNames.USERS);ue.globalId={type:FieldType.STRING};const eo=Object.keys(ue).sort(),no=makePropSafe("user");return to=eo.reduce((ro,oo)=>{const io=ue[oo];return ro.push({type:"context",runtimeBinding:`${no}.${makePropSafe(oo)}`,readableBinding:`Current User.${oo}`,fieldSchema:io,providerId:"user",category:"Current User",icon:"User",display:{name:oo}}),ro},[]),to},getDeviceBindings=()=>{var ue;let to=[];if((ue=get_store_value(appStore).clientFeatures)!=null&&ue.deviceAwareness){const eo=makePropSafe("device");to=[{type:"context",runtimeBinding:`${eo}.${makePropSafe("mobile")}`,readableBinding:"Device.Mobile",category:"Device",icon:"DevicePhone",display:{type:"boolean",name:"mobile"}},{type:"context",runtimeBinding:`${eo}.${makePropSafe("tablet")}`,readableBinding:"Device.Tablet",category:"Device",icon:"DevicePhone",display:{type:"boolean",name:"tablet"}},{type:"context",runtimeBinding:`${eo}.${makePropSafe("theme")}`,readableBinding:"App.Theme",category:"Device",icon:"DevicePhone",display:{type:"string",name:"App Theme"}}]}return to},getSettingBindings=()=>{let to=[];const ue=makePropSafe("settings");return to=[{type:"context",runtimeBinding:`${ue}.${makePropSafe("url")}`,readableBinding:"Settings.url",category:"Settings",icon:"Settings",display:{type:"string",name:"url"}},{type:"context",runtimeBinding:`${ue}.${makePropSafe("logo")}`,readableBinding:"Settings.logo",category:"Settings",icon:"Settings",display:{type:"string",name:"logo"}},{type:"context",runtimeBinding:`${ue}.${makePropSafe("company")}`,readableBinding:"Settings.company",category:"Settings",icon:"Settings",display:{type:"string",name:"company"}}],to},getSelectedRowsBindings=to=>{var eo;let ue=[];if((eo=get_store_value(appStore).clientFeatures)!=null&&eo.rowSelection){let no=findAllMatchingComponents(to==null?void 0:to.props,io=>io._component.endsWith("table"));const ro=makePropSafe("rowSelection");ue=ue.concat(no.map(io=>({type:"context",runtimeBinding:`${ro}.${makePropSafe(io._id)}.${makePropSafe("selectedRows")}`,readableBinding:`${io._instanceName}.Selected Row IDs (deprecated)`,category:"Selected Row IDs (deprecated)",icon:"ViewRow",display:{name:io._instanceName}})));let oo=findAllMatchingComponents(to==null?void 0:to.props,io=>io._component.endsWith("tableblock"));ue=ue.concat(oo.map(io=>({type:"context",runtimeBinding:`${ro}.${makePropSafe(io._id+"-table")}.${makePropSafe("selectedRows")}`,readableBinding:`${io._instanceName}.Selected Row IDs (deprecated)`,category:"Selected Row IDs (deprecated)",icon:"ViewRow",display:{name:io._instanceName}})))}return ue},makeStateBinding=to=>({type:"context",runtimeBinding:`${makePropSafe("state")}.${makePropSafe(to)}`,readableBinding:`State.${to}`,category:"State",icon:"AutomatedSegment",display:{name:to}}),getStateBindings=()=>{var ue;let to=[];return(ue=get_store_value(appStore).clientFeatures)!=null&&ue.state&&(to=getAllStateVariables().map(makeStateBinding)),to},getUrlBindings=to=>{var ao;const eo=(((ao=to==null?void 0:to.routing)==null?void 0:ao.route)??"").split("/");let no=[];eo.forEach(so=>{so.startsWith(":")&&so.length>1&&no.push(so.replace(/:/g,"").replace(/\?/g,""))});const ro=makePropSafe("url"),oo=no.map(so=>({type:"context",runtimeBinding:`${ro}.${makePropSafe(so)}`,readableBinding:`URL.${so}`,category:"URL",icon:"RailTop",display:{type:"string",name:so}})),io={type:"context",runtimeBinding:makePropSafe("query"),readableBinding:"Query params",category:"URL",icon:"RailTop",display:{type:"object",name:"Query params"}};return oo.concat([io])},getRoleBindings=()=>(get_store_value(roles)||[]).map(to=>({type:"context",runtimeBinding:`'${to._id}'`,readableBinding:`Role.${to.uiMetadata.displayName}`,category:"Role",icon:"UserGroup",display:{type:"string",name:to.uiMetadata.displayName}})),getEventContextBindings=({settingKey:to,componentInstance:ue,componentId:eo,componentDefinition:no,asset:ro})=>{var co;let oo=[];ro=ro??get_store_value(selectedScreen);const io=ue??findComponent(ro.props,eo);if(!io)return oo;const ao=no??componentStore.getDefinition(io==null?void 0:io._component),lo=componentStore.getComponentSettings(io==null?void 0:io._component).find(uo=>uo.key===to);return(co=lo==null?void 0:lo.context)!=null&&co.length&&lo.context.forEach(uo=>{oo.push({readableBinding:uo.label,runtimeBinding:`${makePropSafe("eventContext")}.${makePropSafe(uo.key)}`,category:io._instanceName,icon:ao.icon,display:{name:uo.label}})}),oo},getActionBindings=(to,ue)=>{let eo=[];const no=to==null?void 0:to.findIndex(oo=>oo.id===ue);return no==null||no===-1||to.slice(0,no).forEach((oo,io)=>{const ao=ActionDefinitions.actions.find(so=>so.name===oo["##eventHandlerType"]);ao.context&&ao.context.forEach(so=>{eo.push({readableBinding:`Action ${io+1}.${so.label}`,runtimeBinding:`actions.${io}.${so.value}`,category:"Actions",icon:"JourneyAction",display:{name:so.label}})})}),eo},getEmbedBindings=()=>{let to=[];return to=[{type:"context",runtimeBinding:`${makePropSafe("embed")}`,readableBinding:"ParentWindow",category:"Embed",icon:"DistributeVertically"}],to},getSchemaForDatasourcePlus=(to,ue)=>{const no=(to==null?void 0:to.startsWith("view_"))?{type:"viewV2",id:to,tableId:to.split("_").slice(1,3).join("_")}:{type:"table",tableId:to};return getSchemaForDatasource(null,no,ue)},getSchemaForDatasource=(to,ue,eo)=>{var oo,io;eo=eo||{};let no,ro;if(ue){const{type:ao}=ue,so=get_store_value(tables).list;if(ao==="provider"){const ho=findComponent(to==null?void 0:to.props,ue.providerId),_o=getDatasourceForProvider(to,ho);return getSchemaForDatasource(to,_o,eo)}else if(ao==="query")ro=get_store_value(queries).list.find(_o=>_o._id===ue._id);else if(ao==="field"){ro={name:ue.fieldName};const{fieldType:ho}=ue;ho==="attachment"?no={url:{type:"string"},name:{type:"string"}}:ho==="array"&&(no={value:{type:"string"}})}else if(ao==="jsonarray"){ro=so.find(_o=>_o._id===ue.tableId);let ho=ro==null?void 0:ro.schema;no=getJSONArrayDatasourceSchema(ho,ue)}else if(ao==="queryarray"){ro=get_store_value(queries).list.find(bo=>bo._id===ue.tableId);let _o=ro==null?void 0:ro.schema,go=ro==null?void 0:ro.nestedSchemaFields;no=generateQueryArraySchemas(_o,go),no=getJSONArrayDatasourceSchema(no,ue)}else ro=so.find(ho=>ho._id===ue.tableId);if(ro&&!no)if(ao==="view")no=fp$1.cloneDeep((io=(oo=ro.views)==null?void 0:oo[ue.name])==null?void 0:io.schema);else if(ao==="viewV2"){const ho=Object.values(ro.views||{}).find(_o=>_o.id===ue.id);no=fp$1.cloneDeep(ho==null?void 0:ho.schema),Object.keys(no||{}).forEach(_o=>{no[_o].visible||delete no[_o]})}else ao==="query"&&(eo.formSchema||eo.searchableSchema)?(no={},(ro.parameters||[]).forEach(_o=>{_o!=null&&_o.name&&(no[_o.name]={..._o,type:"string"})})):no=fp$1.cloneDeep(ro.schema);if(no){let ho={};Object.keys(no).forEach(_o=>{const go=no[_o];if((go==null?void 0:go.type)==="json"){const bo=convertJSONSchemaToTableSchema(go,{squashObjects:!0});Object.keys(bo).forEach(vo=>{ho[`${_o}.${vo}`]={type:bo[vo].type,nestedJSON:!0}})}}),no={...no,...ho}}const lo=ro&&(ro==null?void 0:ro.sourceType)===DB_TYPE_INTERNAL,co=["table","link","viewV2"].includes(ue.type);let uo=co,fo=co&&lo;eo.formSchema?(uo=!1,fo=!1):eo.searchableSchema&&(uo=co&&lo),no&&(uo&&(no._id={type:"string"}),fo&&(no._rev={type:"string"}));let po={};Object.entries(no||{}).forEach(([ho,_o])=>{const go=Object.values(FIELDS).find(bo=>bo.type===_o.type&&bo.subtype===_o.subtype);typeof _o=="string"?po[ho]={type:_o,name:ho,display:{type:_o}}:po[ho]={..._o,name:ho,display:{type:(go==null?void 0:go.name)||_o.type}}}),no=po}return{schema:no,table:ro}},buildFormSchema=(to,ue)=>{var oo;let eo={};if(!to)return eo;if(to._component.endsWith("formblock")){let io={};const ao=getDatasourceForProvider(ue,to),so=getSchemaForDatasource(to,ao);if(!(so!=null&&so.schema))return io;if(!to.fields)Object.values(so.schema).filter(({autocolumn:lo,name:co})=>!lo&&!["_rev","_id"].includes(co)).forEach(({name:lo})=>{io[lo]={type:so==null?void 0:so.schema[lo].type}});else{const lo=convertOldFieldFormat(to.fields||[]);lo==null||lo.forEach(({field:co,active:uo})=>{uo&&so!=null&&so.schema[co]&&(io[co]={type:so==null?void 0:so.schema[co].type})})}return io}const ro=componentStore.getComponentSettings(to._component).find(io=>io.key==="field"&&io.type.startsWith("field/"));if(ro){const io=ro.type.split("field/")[1],ao=to.field||to._instanceName;io&&ao&&(eo[ao]={type:io})}return(oo=to._children)==null||oo.forEach(io=>{const ao=buildFormSchema(io,ue);eo={...eo,...ao}}),eo},getAllStateVariables=to=>{let ue=[];to?ue.push(to):ue=getAllAssets();let eo=[];ue.forEach(ro=>{findAllMatchingComponents(ro.props,oo=>{const io=componentStore.getComponentSettings(oo._component),ao=["buttonConfiguration","fieldConfiguration","stepConfiguration"],so=(lo,co)=>{lo!=null&&lo.length&&(lo.filter(uo=>uo.type==="event").forEach(uo=>{eo.push(co[uo.key])}),lo.filter(uo=>ao.includes(uo.type)).forEach(uo=>{const fo=co[uo.key];Array.isArray(fo)&&fo.length&&fo.forEach(po=>{let ho=po==null?void 0:po._component;uo.type==="stepConfiguration"&&!ho&&(ho="@budibase/standard-components/multistepformblockstep");const _o=componentStore.getComponentSettings(ho);so(_o,po)})}))};so(io,oo)})}),to?to.onLoad&&eo.push(to.onLoad):get_store_value(screenStore).screens.forEach(ro=>{ro.onLoad&&eo.push(ro.onLoad)});let no=new Set;return eo.forEach(ro=>{Array.isArray(ro)&&ro.forEach(oo=>{var io,ao,so;oo["##eventHandlerType"]==="Update State"&&((io=oo.parameters)==null?void 0:io.type)==="set"&&((ao=oo.parameters)!=null&&ao.key)&&((so=oo.parameters)!=null&&so.value)&&no.add(oo.parameters.key)})}),Array.from(no)},getAllAssets=()=>{let to=[];return to=to.concat(get_store_value(layoutStore).layouts||[]),to=to.concat(get_store_value(screenStore).screens||[]),to},shouldReplaceBinding=(to,ue,eo,no)=>{if(!(to!=null&&to.includes(ue)))return!1;const ro=no.runtimeBinding.includes(no.readableBinding),oo=eo==="readableBinding",ao=Object.keys(getJsHelperList()).filter(uo=>uo.includes(ue)&&to.includes(uo));if(ao.length>0){const uo=to.indexOf(ue),fo=uo+ue.length;for(let po of ao){const ho=to.indexOf(po),_o=ho+po.length;if(uo>=ho&&fo<=_o)return!1}}if(oo&&!ro)return to.indexOf(no.readableBinding)===-1;if(oo)return!0;const so=to.replace(/\s+/g,""),lo=ue.replace(/\s+/g,"");return![`[${lo}]`,`"${lo}"`,`'${lo}'`].find(uo=>so==null?void 0:so.includes(uo))},replaceBetween=(to,ue,eo,no)=>to.substring(0,ue)+no+to.substring(eo),bindingReplacement=(to,ue,eo)=>{const no=isJSBinding(ue);no&&(ue=decodeJSBinding(ue));const ro=no?CAPTURE_VAR_INSIDE_JS:CAPTURE_VAR_INSIDE_TEMPLATE,oo=eo==="runtimeBinding"?"readableBinding":"runtimeBinding";if(typeof ue!="string")return ue;const io=to.map(lo=>lo[oo]).sort((lo,co)=>co.length-lo.length),ao=ue.match(ro)||[];let so=ue;for(let lo of ao){let co=lo,uo=co;for(let fo of io){const po=to.find(ho=>ho[oo]===fo);if(no||shouldReplaceBinding(co,fo,eo,po)){let ho;do if(ho=uo.indexOf(fo),ho!==-1){let _o=ho+fo.length,go=Array(po[eo].length+1).join("*");uo=replaceBetween(uo,ho,_o,go),co=replaceBetween(co,ho,_o,po[eo])}while(ho!==-1)}}so=so.replace(lo,co)}return no&&(so=encodeJSBinding(so)),so},extractLiteralHandlebarsID=to=>{var ue;return!to||typeof to!="string"?null:(ue=to.match(/{{\s*literal\s*\[+([^\]]+)].*}}/))==null?void 0:ue[1]},readableToRuntimeBinding=(to,ue)=>bindingReplacement(to,ue,"runtimeBinding"),runtimeToReadableBinding=(to,ue)=>bindingReplacement(to,ue,"readableBinding"),updateReferencesInObject=({obj:to,modifiedIndex:ue,action:eo,label:no,originalIndex:ro})=>{const oo=new RegExp(`{{\\s*${no}\\.(\\d+)\\.`,"g"),io=(ao,so,lo)=>ao.replace(`{{ ${no}.${so}.`,`{{ ${no}.${lo}.`);for(const ao in to)if(typeof to[ao]=="string"){let so;for(;(so=oo.exec(to[ao]))!==null;){const lo=parseInt(so[1]);eo===UpdateReferenceAction.ADD&&lo>=ue?to[ao]=io(to[ao],lo,lo+1):eo===UpdateReferenceAction.DELETE&&lo>ue?to[ao]=io(to[ao],lo,lo-1):eo===UpdateReferenceAction.MOVE&&(lo===ro?to[ao]=io(to[ao],lo,ue):ue<=lo&&ue<ro?to[ao]=io(to[ao],lo,lo+1):ue>=lo&&ue>ro&&(to[ao]=io(to[ao],lo,lo-1)))}}else typeof to[ao]=="object"&&to[ao]!==null&&updateReferencesInObject({obj:to[ao],modifiedIndex:ue,action:eo,label:no,originalIndex:ro})},migrateReferencesInObject=({obj:to,label:ue="steps",steps:eo,originalIndex:no})=>{var io;const ro=new RegExp(`{{\\s*${ue}\\.(\\d+)\\.`,"g"),oo=(ao,so,lo)=>ao.replace(`{{ ${ue}.${so}.`,`{{ ${ue}.${lo}.`);for(const ao in to)if(typeof to[ao]=="string"){let so;for(;(so=ro.exec(to[ao]))!==null;){const lo=parseInt(so[1]);to[ao]=oo(to[ao],lo,(io=eo[lo])==null?void 0:io.id)}}else typeof to[ao]=="object"&&to[ao]!==null&&migrateReferencesInObject({obj:to[ao],steps:eo,originalIndex:no})},getComponentFieldOptions=(to,ue,eo,no=!0)=>{const ro=findClosestMatchingComponent(to,ue,so=>so._component==="@budibase/standard-components/form"),oo=getDatasourceForProvider(to,ro),io=getSchemaForDatasource(to,oo,{formSchema:!0}).schema;let ao=[eo];return no&&(eo==="field/options"||eo==="field/longform")&&(ao=[eo,"field/string"]),ao=ao.map(so=>so.slice(so.indexOf("/")+1)),Object.entries(io||{}).filter(so=>ao.includes(so[1].type)).map(so=>so[0])};/*!
|
|
500
500
|
* https://github.com/Starcounter-Jack/JSON-Patch
|
|
501
501
|
* (c) 2017-2022 Joachim Wester
|
|
502
502
|
* MIT licensed
|
|
@@ -505,7 +505,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
505
505
|
* https://github.com/Starcounter-Jack/JSON-Patch
|
|
506
506
|
* (c) 2017-2021 Joachim Wester
|
|
507
507
|
* MIT license
|
|
508
|
-
*/var beforeDict=new WeakMap,Mirror=function(){function to(ue){this.observers=new Map,this.obj=ue}return to}(),ObserverInfo=function(){function to(ue,eo){this.callback=ue,this.observer=eo}return to}();function getMirror(to){return beforeDict.get(to)}function getObserverFromMirror(to,ue){return to.observers.get(ue)}function removeObserverFromMirror(to,ue){to.observers.delete(ue.callback)}function unobserve$1(to,ue){ue.unobserve()}function observe$2(to,ue){var eo=[],no,ro=getMirror(to);if(!ro)ro=new Mirror(to),beforeDict.set(to,ro);else{var oo=getObserverFromMirror(ro,ue);no=oo&&oo.observer}if(no)return no;if(no={},ro.value=_deepClone(to),ue){no.callback=ue,no.next=null;var io=function(){generate$1(no)},ao=function(){clearTimeout(no.next),no.next=setTimeout(io)};typeof window<"u"&&(window.addEventListener("mouseup",ao),window.addEventListener("keyup",ao),window.addEventListener("mousedown",ao),window.addEventListener("keydown",ao),window.addEventListener("change",ao))}return no.patches=eo,no.object=to,no.unobserve=function(){generate$1(no),clearTimeout(no.next),removeObserverFromMirror(ro,no),typeof window<"u"&&(window.removeEventListener("mouseup",ao),window.removeEventListener("keyup",ao),window.removeEventListener("mousedown",ao),window.removeEventListener("keydown",ao),window.removeEventListener("change",ao))},ro.observers.set(ue,new ObserverInfo(ue,no)),no}function generate$1(to,ue){ue===void 0&&(ue=!1);var eo=beforeDict.get(to.object);_generate(eo.value,to.object,to.patches,"",ue),to.patches.length&&applyPatch(eo.value,to.patches);var no=to.patches;return no.length>0&&(to.patches=[],to.callback&&to.callback(no)),no}function _generate(to,ue,eo,no,ro){if(ue!==to){typeof ue.toJSON=="function"&&(ue=ue.toJSON());for(var oo=_objectKeys(ue),io=_objectKeys(to),ao=!1,so=io.length-1;so>=0;so--){var lo=io[so],co=to[lo];if(hasOwnProperty$6(ue,lo)&&!(ue[lo]===void 0&&co!==void 0&&Array.isArray(ue)===!1)){var uo=ue[lo];typeof co=="object"&&co!=null&&typeof uo=="object"&&uo!=null&&Array.isArray(co)===Array.isArray(uo)?_generate(co,uo,eo,no+"/"+escapePathComponent(lo),ro):co!==uo&&(ro&&eo.push({op:"test",path:no+"/"+escapePathComponent(lo),value:_deepClone(co)}),eo.push({op:"replace",path:no+"/"+escapePathComponent(lo),value:_deepClone(uo)}))}else Array.isArray(to)===Array.isArray(ue)?(ro&&eo.push({op:"test",path:no+"/"+escapePathComponent(lo),value:_deepClone(co)}),eo.push({op:"remove",path:no+"/"+escapePathComponent(lo)}),ao=!0):(ro&&eo.push({op:"test",path:no,value:to}),eo.push({op:"replace",path:no,value:ue}))}if(!(!ao&&oo.length==io.length))for(var so=0;so<oo.length;so++){var lo=oo[so];!hasOwnProperty$6(to,lo)&&ue[lo]!==void 0&&eo.push({op:"add",path:no+"/"+escapePathComponent(lo),value:_deepClone(ue[lo])})}}}function compare$2(to,ue,eo){eo===void 0&&(eo=!1);var no=[];return _generate(to,ue,no,"",eo),no}const duplex=Object.freeze(Object.defineProperty({__proto__:null,compare:compare$2,generate:generate$1,observe:observe$2,unobserve:unobserve$1},Symbol.toStringTag,{value:"Module"}));Object.assign({},core,duplex,{JsonPatchError:PatchError,deepClone:_deepClone,escapePathComponent,unescapePathComponent});const initialState$2={history:[],position:0,loading:!1},createHistoryStore=({getDoc:to,selectDoc:ue,beforeAction:eo,afterAction:no})=>{const ro=writable(initialState$2),oo=derived(ro,go=>({...go,canUndo:go.position>0,canRedo:go.position<go.history.length}));let io,ao;const so=()=>{ro.update(go=>(go.loading=!0,go))},lo=()=>{ro.update(go=>(go.loading=!1,go))},co=()=>{ro.set(initialState$2)},uo=go=>{ro.update(bo=>{let vo=bo.history,yo=bo.position;if(!go.id)go.id=Math.random(),vo=[...vo.slice(0,bo.position),go],yo+=1;else{const $o=vo.findIndex(ko=>ko.id===go.id);vo[$o].doc=go.doc}return{history:vo,position:yo}})},fo=go=>(io=async(bo,vo)=>{if(!(!bo||Array.isArray(bo))){so();try{const yo=to(bo._id),$o=_deepClone(await go(bo));return uo(yo?{type:"Change",forwardPatch:compare$2(yo,bo),backwardsPatch:compare$2(bo,yo),doc:$o,id:vo}:{type:"Add",doc:$o,id:vo}),lo(),$o}catch(yo){throw lo(),yo}}},io),po=go=>(ao=async(bo,vo)=>{if(!(!bo||Array.isArray(bo))){so();try{const yo=_deepClone(bo);await go(bo),uo({type:"Delete",doc:yo,id:vo}),lo()}catch(yo){throw lo(),yo}}},ao),ho=async()=>{const{canUndo:go,history:bo,position:vo,loading:yo}=get_store_value(oo);if(!go||yo)return;const $o=bo[vo-1];if($o){so(),await(eo==null?void 0:eo($o)),ro.update(ko=>({...ko,position:ko.position-1}));try{if($o.type==="Add"){const So=to($o.doc._id)||$o.doc;await ao(So,$o.id)}else if($o.type==="Delete"){let ko=_deepClone($o.doc);delete ko._rev;const So=await io(ko,$o.id);ue==null||ue((So==null?void 0:So._id)||ko._id)}else{let ko=_deepClone(to($o.doc._id));ko&&(applyPatch(ko,_deepClone($o.backwardsPatch)),await io(ko,$o.id),ue==null||ue(ko._id))}lo()}catch(ko){throw lo(),ko}await(no==null?void 0:no($o))}},_o=async()=>{const{canRedo:go,history:bo,position:vo,loading:yo}=get_store_value(oo);if(!go||yo)return;const $o=bo[vo];if($o){so(),await(eo==null?void 0:eo($o)),ro.update(ko=>({...ko,position:ko.position+1}));try{if($o.type==="Add"){let ko=_deepClone($o.doc);delete ko._rev;const So=await io(ko,$o.id);ue==null||ue((So==null?void 0:So._id)||ko._id)}else if($o.type==="Delete"){const So=to($o.doc._id)||$o.doc;await ao(So,$o.id)}else{let ko=_deepClone(to($o.doc._id));ko&&(applyPatch(ko,_deepClone($o.forwardPatch)),await io(ko,$o.id),ue==null||ue(ko._id))}lo()}catch(ko){throw lo(),ko}await(no==null?void 0:no($o))}};return{subscribe:oo.subscribe,wrapSaveDoc:fo,wrapDeleteDoc:po,reset:co,undo:ho,redo:_o}},initialScreenState={screens:[]};class ScreenStore extends BudiStore{constructor(){super(initialScreenState),this.sequentialScreenPatch=sequential(async(ue,eo)=>{const ro=get_store_value(this.store).screens.find(ao=>ao._id===eo);if(!ro)return;let oo=fp$1.cloneDeep(ro);if(ue(oo)!==!1)return this.save(oo)}),this.select=this.select.bind(this),this.reset=this.reset.bind(this),this.syncAppScreens=this.syncAppScreens.bind(this),this.validate=this.validate.bind(this),this.patch=this.patch.bind(this),this.replace=this.replace.bind(this),this.saveScreen=this.saveScreen.bind(this),this.deleteScreen=this.deleteScreen.bind(this),this.syncScreenData=this.syncScreenData.bind(this),this.updateSetting=this.updateSetting.bind(this),this.sequentialScreenPatch=this.sequentialScreenPatch.bind(this),this.removeCustomLayout=this.removeCustomLayout.bind(this),this.history=createHistoryStore({getDoc:ue=>{var eo;return(eo=get_store_value(this.store).screens)==null?void 0:eo.find(no=>no._id===ue)},selectDoc:this.select,afterAction:()=>{get_store_value(selectedComponent)||componentStore.update(ue=>{var eo;return{...ue,selectedComponentId:(eo=get_store_value(selectedScreen))==null?void 0:eo._id}})}}),this.delete=this.history.wrapDeleteDoc(this.deleteScreen),this.save=this.history.wrapSaveDoc(this.saveScreen)}reset(){this.store.set({...initialScreenState})}syncAppScreens(ue){this.update(eo=>({...eo,screens:[...ue.screens]}))}select(ue){const eo=get_store_value(this.store),no=eo.screens.find(ro=>ro._id===ue);no&&eo.selectedScreenId!==no._id&&this.update(ro=>(ro.selectedScreenId=no._id,ro))}validate(ue){const eo=(ro,oo=[],io=[])=>{var lo,co,uo;const ao=ro._component;if(oo.includes(ao)||io.length&&!io.includes(ao))return ao;if(!((lo=ro==null?void 0:ro._children)!=null&&lo.length))return;["@budibase/standard-components/sidepanel","@budibase/standard-components/modal"].includes(ao)&&(oo=[]);const so=componentStore.getDefinition(ro._component);if(so==null)throw`Invalid defintion ${ro._component}`;if(io=[],(co=so==null?void 0:so.legalDirectChildren)!=null&&co.length&&(io=so.legalDirectChildren.map(fo=>`@budibase/standard-components/${fo}`)),(uo=so==null?void 0:so.illegalChildren)!=null&&uo.length){const fo=so.illegalChildren.map(po=>`@budibase/standard-components/${po}`);oo=[...new Set([...oo,...fo])]}for(let fo of ro._children){const po=eo(fo,oo,io);if(po)return po}},no=eo(ue.props);if(no){const ro=componentStore.getDefinition(no);throw`You can't place a ${ro==null?void 0:ro.name} here`}}async saveScreen(ue){var oo;(oo=get_store_value(appStore).features)!=null&&oo.componentValidation&&this.validate(ue),this.enrichEmptySettings(ue);const no=ue._id===void 0,ro=await API.saveScreen(ue);return this.update(io=>{const ao=io.screens.findIndex(so=>so._id===ro._id);return ao!==-1?io.screens.splice(ao,1,ro):io.screens.push(ro),no&&(io.selectedScreenId=ro._id,componentStore.update(so=>({...so,selectedComponentId:ro.props._id}))),io}),await this.syncScreenData(ro),ro}async syncScreenData(ue){const eo=get_store_value(appStore);let no=eo.usedPlugins;if(ue.pluginAdded){const{application:oo}=await API.fetchAppPackage(eo.appId);no=oo.usedPlugins||[]}const ro=await API.fetchAppRoutes();appStore.update(oo=>({...oo,routes:ro.routes,usedPlugins:no}))}async patch(ue,eo){if(eo||(eo=get_store_value(this.store).selectedScreenId),!(!eo||!ue))return await this.sequentialScreenPatch(ue,eo)}async replace(ue,eo){if(ue)if(!eo)this.update(no=>({...no,screens:no.screens.filter(ro=>ro._id!==ue)}));else{const no=get_store_value(this.store).screens.findIndex(ro=>ro._id===eo._id);no===-1?this.update(ro=>({...ro,screens:[...ro.screens,eo]})):this.update(ro=>(ro.screens[no]=eo,ro))}}async deleteScreen(ue){const eo=[ue];let no=[],ro=[];eo.filter(ao=>!!ao._id||!!ao._rev).forEach(ao=>{no.push(API.deleteScreen(ao._id,ao._rev)),ro.push(ao.routing.route)}),await Promise.all(no),await navigationStore.deleteLink(ro);const oo=eo.map(ao=>ao._id),io=await API.fetchAppRoutes();this.update(ao=>(ao.screens=ao.screens.filter(so=>!oo.includes(so._id)),ao.selectedScreenId&&oo.includes(ao.selectedScreenId)&&(delete ao.selectedScreenId,componentStore.update(so=>(delete so.selectedComponentId,so))),appStore.update(so=>({...so,routes:io.routes})),ao))}async updateSetting(ue,eo,no){if(!ue||!eo)return;const ro=so=>{if(!so||deepGet(so,eo)===no)return!1;deepSet(so,eo,no)};await this.patch(ro,ue._id);const oo=get_store_value(this.store),io=oo.screens.find(so=>so._id===ue._id);if(!io)return;const ao=oo.screens.filter(so=>so.routing.roleId===io.routing.roleId&&so.routing.homeScreen&&so._id!==ue._id);if(ao.length&&io.routing.homeScreen){const so=lo=>{lo.routing.homeScreen=!1};for(let lo of ao)await this.patch(so,lo._id)}}async removeCustomLayout(ue){const eo=get_store_value(layoutStore).layouts.find(ro=>ro._id===ue.layoutId),no=ro=>{delete ro.layoutId,ro.showNavigation=(eo==null?void 0:eo.props.navigation)!=="None",ro.width=(eo==null?void 0:eo.props.width)||"Large"};await this.patch(no,ue._id)}async enrichEmptySettings(ue){findAllMatchingComponents(ue.props,no=>no).forEach(no=>{componentStore.enrichEmptySettings(no,{screen:ue})})}async usageInScreens(ue){return API.usageInScreens(ue)}}const screenStore=new ScreenStore,selectedScreen=derived(screenStore,to=>to.screens.find(ue=>ue._id===to.selectedScreenId)),sortedScreens=derived(screenStore,to=>to.screens.slice().sort((ue,eo)=>{const no=getRolePriority(ue.routing.roleId),ro=getRolePriority(eo.routing.roleId);if(no!==ro)return no>ro?-1:1;const oo=!!ue.routing.homeScreen,io=!!eo.routing.homeScreen;if(oo!==io)return oo?-1:1;const ao=ue.routing.route.split("/"),so=eo.routing.route.split("/");let lo=Math.min(ao.length,so.length);for(let co=0;co<lo;co++)if(ao[co]!==so[co])return ao[co]<so[co]?-1:1;return ao.length<so.length?-1:1})),duplicateName=(to,ue)=>{const eo=new RegExp("\\s(\\d+)$"),no=to.split(eo)[0],ro=new RegExp(`${no}\\s(\\d+)$`),oo=[];ue.filter(ao=>{if(ao===no)return!0;const so=ao.match(ro);return so?(oo.push(parseInt(so[1])),!0):!1}),oo.sort((ao,so)=>ao-so);let io;if(oo.length===0)io=1;else{for(let ao=0;ao<oo.length;ao++)if(oo[ao]!==ao+1){io=ao+1;break}io||(io=oo.length+1)}return`${no} ${io}`},getSequentialName=(to,ue,{getName:eo,numberFirstItem:no,separator:ro=""}={})=>{if(!(ue!=null&&ue.length))return"";const oo=ue.trim(),io=no?`${ue}1`:oo;if(!(to!=null&&to.length))return io;let ao=0;return to.forEach(so=>{const lo=(eo==null?void 0:eo(so))??so;if(typeof lo!="string"||!lo.startsWith(oo))return;const co=lo.split(oo);if(co.length!==2)return;co[1].trim()===""&&(co[1]="1");const uo=parseInt(co[1]);uo>ao&&(ao=uo)}),ao===0?io:`${ue}${ro}${ao+1}`},INITIAL_COMPONENTS_STATE={components:{},customComponents:[],settingsCache:{}};class ComponentStore extends BudiStore{constructor(){super(INITIAL_COMPONENTS_STATE),this.reset=this.reset.bind(this),this.refreshDefinitions=this.refreshDefinitions.bind(this),this.getDefinition=this.getDefinition.bind(this),this.getDefaultDatasource=this.getDefaultDatasource.bind(this),this.enrichEmptySettings=this.enrichEmptySettings.bind(this),this.createInstance=this.createInstance.bind(this),this.create=this.create.bind(this),this.patch=this.patch.bind(this),this.delete=this.delete.bind(this),this.copy=this.copy.bind(this),this.paste=this.paste.bind(this),this.select=this.select.bind(this),this.getPrevious=this.getPrevious.bind(this),this.getNext=this.getNext.bind(this),this.selectPrevious=this.selectPrevious.bind(this),this.selectNext=this.selectNext.bind(this),this.moveUp=this.moveUp.bind(this),this.moveDown=this.moveDown.bind(this),this.updateStyle=this.updateStyle.bind(this),this.updateStyles=this.updateStyles.bind(this),this.updateCustomStyle=this.updateCustomStyle.bind(this),this.updateConditions=this.updateConditions.bind(this),this.requestEjectBlock=this.requestEjectBlock.bind(this),this.handleEjectBlock=this.handleEjectBlock.bind(this),this.updateSetting=this.updateSetting.bind(this),this.updateComponentSetting=this.updateComponentSetting.bind(this),this.addParent=this.addParent.bind(this),this.isCached=this.isCached.bind(this),this.cacheSettings=this.cacheSettings.bind(this),this.getComponentSettings=this.getComponentSettings.bind(this)}reset(){this.store.set({...INITIAL_COMPONENTS_STATE})}async refreshDefinitions(ue){if(!ue)return;const eo=await API.fetchComponentLibDefinitions(ue),no=Object.keys(eo).filter(ro=>ro.startsWith("plugin/"));return this.update(ro=>({...ro,components:eo,customComponents:no})),appStore.syncClientFeatures(eo.features),appStore.syncClientTypeSupportPresets((eo==null?void 0:eo.typeSupportPresets)??{}),eo}getDefinition(ue){return ue?get_store_value(this.store).components[ue]:null}getDefaultDatasource(){const ue=get_store_value(tables).list.filter(no=>no._id!=="ta_users");let eo=ue.find(no=>no.sourceId===BUDIBASE_INTERNAL_DB_ID&&no.sourceType===DB_TYPE_INTERNAL);return eo||(eo=ue.find(no=>no.sourceId===DEFAULT_BB_DATASOURCE_ID&&no.sourceType===DB_TYPE_INTERNAL),eo)?eo:ue.find(no=>no.sourceType===DB_TYPE_EXTERNAL)}migrateSettings(ue){var io;const eo="@budibase/standard-components";let no=!1;if((ue==null?void 0:ue._component)===`${eo}/formblock`){if(!("buttons"in ue))ue.buttons=buildFormBlockButtonConfig(ue),no=!0;else if(ue.buttons==null){const{_id:ao,actionType:so,dataSource:lo}=ue;ue.buttons=buildFormBlockButtonConfig({_id:ao,actionType:so,dataSource:lo}),no=!0}"buttonPosition"in ue||(ue.buttonPosition="top",no=!0)}if(!(ue!=null&&ue._component))return no;const ro=this.getDefinition(ue==null?void 0:ue._component),oo=(io=ro==null?void 0:ro.settings)==null?void 0:io.filter(ao=>{var so;return(so=ao==null?void 0:ao.type)==null?void 0:so.startsWith("filter")});for(let ao of oo||[])Array.isArray(ue[ao.key])&&(ue[ao.key]=processSearchFilters(ue[ao.key]),no=!0);return no}enrichEmptySettings(ue,eo){if(!(ue!=null&&ue._component))return;const no=this.getDefaultDatasource(),ro=this.getComponentSettings(ue._component),{parent:oo,screen:io,useDefaultValues:ao}=eo||{},so=(oo==null?void 0:oo._id)||ue._id;if(io&&(ro.forEach(lo=>{var uo,fo,po;const co=ue[lo.key];if(co==null||co==="")if(lo.type==="multifield"&&lo.selectAllFields)ue[lo.key]=Object.keys((no==null?void 0:no.schema)||{});else if((lo.type==="dataSource"||lo.type==="table")&&no)ue[lo.key]={label:no.name,tableId:no._id,resourceId:no._id,type:"table"};else if(lo.type==="dataProvider"){let ho;const go=findComponentPath(io.props,so).filter(bo=>{var vo;return(vo=bo._component)==null?void 0:vo.endsWith("/dataprovider")});ho=(uo=go[go.length-1])==null?void 0:uo._id,ho||(ho=(fo=findComponentType(io.props,"@budibase/standard-components/dataprovider"))==null?void 0:fo._id),ho&&(ue[lo.key]=`{{ literal ${makePropSafe(ho)} }}`)}else if(lo.type.startsWith("field/")){let ho=getComponentFieldOptions(io.props,so,lo.type,!1);const _o=findClosestMatchingComponent(io.props,so,bo=>bo._component==="@budibase/standard-components/form"),go=Object.keys(buildFormSchema(_o)||{});ho=ho.filter(bo=>!go.includes(bo)),ho[0]&&(ue[lo.key]=ho[0],ue.label=ho[0])}else ao&&lo.defaultValue!==void 0&&(ue[lo.key]=lo.defaultValue);else if(lo.type==="dataProvider"){const ho=findAllMatchingComponents(io==null?void 0:io.props,go=>go._component==="@budibase/standard-components/dataprovider");if(!(ho==null?void 0:ho.some(go=>{var bo;return(bo=co.includes)==null?void 0:bo.call(co,go._id)})))if(ho.length){const go=(po=ho[ho.length-1])==null?void 0:po._id;ue[lo.key]=`{{ literal ${makePropSafe(go)} }}`}else delete ue[lo.key]}}),ue._component.endsWith("/cardsblock")&&["cardTitle","cardSubtitle","cardDescription"].every(co=>!ue[co])&&!ue.cardImageURL)){const{_id:co,dataSource:uo}=ue;if(uo){const{schema:fo,table:po}=getSchemaForDatasource(io,uo,{}),ho=$o=>(Array.isArray($o)||($o=[$o]),Object.entries(fo||{}).filter(([ko,So])=>$o.includes(So.type)&&!So.autoColumn&&ko!==(po==null?void 0:po.primaryDisplay)&&!ko.startsWith("_")).map(([ko])=>ko)),_o=($o,ko,...So)=>{So.some(Ao=>Ao==null)?ue[$o]=ko:(So.unshift(`${co}-repeater`),ue[$o]=`{{ ${So.map(makePropSafe).join(".")} }}`)},go=[...ho(FieldType.STRING),...ho(FieldType.OPTIONS),...ho(FieldType.ARRAY),...ho(FieldType.NUMBER)],bo=ho(FieldType.LONGFORM);po!=null&&po.primaryDisplay&&(fo!=null&&fo[po.primaryDisplay])&&go.unshift(po.primaryDisplay),_o("cardTitle","Title",go[0]),_o("cardSubtitle","Subtitle",go[1]);const vo=bo[0]??go[2];_o("cardDescription","Description",vo);let yo=ho(FieldType.ATTACHMENT_SINGLE)[0];yo?_o("cardImageURL",null,yo,"url"):(yo=ho(FieldType.ATTACHMENTS)[0],yo&&_o("cardImageURL",null,yo,0,"url"))}}}createInstance(ue,eo,no){var lo,co;const ro=get_store_value(selectedScreen);if(!ro)throw"A valid screen must be selected";const oo=this.getDefinition(ue);if(!oo)return null;const io=getSequentialName(get_store_value(screenComponentsList),`New ${oo.friendlyName||oo.name}`,{getName:uo=>uo._instanceName,separator:" "});let ao={_id:uuid$2(),_component:oo.component,_styles:{normal:{...(lo=eo==null?void 0:eo._styles)==null?void 0:lo.normal},hover:{},active:{}},_instanceName:io,...eo};this.enrichEmptySettings(ao,{parent:no,screen:ro,useDefaultValues:!0});try{this.migrateSettings(ao)}catch(uo){throw console.error(uo),uo}let so={};if(oo.hasChildren&&(so._children=[]),ue.endsWith("/formstep")){const uo=findClosestMatchingComponent(ro.props,(co=get_store_value(selectedComponent))==null?void 0:co._id,po=>po._component.endsWith("/form")),fo=findAllMatchingComponents(uo,po=>po._component.endsWith("/formstep"));so.step=fo.length+1,so._instanceName=`Step ${fo.length+1}`}return{...fp$1.cloneDeep(ao),...so}}async create(ue,eo,no,ro){const oo=get_store_value(this.store),io=this.createInstance(ue,eo,no);if(io)return no&&ro!=null?await screenStore.patch(ao=>{var lo;let so=findComponent(ao.props,no);(lo=so._children)!=null&&lo.length?so._children.splice(ro,0,io):so._children=[io]},null):await screenStore.patch(ao=>{let so=oo.selectedComponentId;so!=null&&so.startsWith(`${ao._id}-`)&&(so=ao.props._id);const lo=findComponent(ao.props,so);if(!lo)return!1;let co;if(lo){const uo=this.getDefinition(lo._component);uo!=null&&uo.hasChildren?co=lo:co=findComponentParent(ao.props,lo._id)}else co=ao.props;if(!co)return!1;co._children||(co._children=[]),co._children.push(io)},null),this.update(ao=>(ao.selectedComponentId=io._id,ao)),componentTreeNodesStore.makeNodeVisible(io._id),analytics.captureEvent(Events.COMPONENT_CREATED,{name:io._component}),io}async patch(ue,eo,no){if(!eo||!no){const oo=get_store_value(this.store);eo=eo??oo.selectedComponentId??void 0;const io=get_store_value(screenStore);no=no||io.selectedScreenId}if(!eo||!no||!ue)return;const ro=oo=>{let io=findComponent(oo.props,eo);if(!io)return!1;const ao=ue(io,oo);return this.migrateSettings(io)?null:ao};await screenStore.patch(ro,no)}async delete(ue){if(!ue)return;const eo=get_store_value(this.store);let no="";eo.selectedComponentId===ue._id&&(no=this.getNext(),no||(no=this.getPrevious())),no&&(no.endsWith("-navigation")&&(no=no.replace("-navigation","-screen")),this.update(ro=>(ro.selectedComponentId=no,ro))),await screenStore.patch(ro=>{if(ue=findComponent(ro.props,ue._id),!ue)return!1;const oo=findComponentParent(ro.props,ue._id);if(!oo)return!1;oo._children=oo._children.filter(io=>io._id!==ue._id)},null)}copy(ue,eo=!1,no=!0){if(this.update(ro=>(ro.componentToPaste=fp$1.cloneDeep(ue),ro.componentToPaste.isCut=eo,ro.componentToPaste.screenId=get_store_value(screenStore).selectedScreenId,ro)),eo&&no){const ro=get_store_value(selectedScreen),oo=findComponentParent(ro==null?void 0:ro.props,ue._id);oo&&this.update(io=>(io.selectedComponentId=oo._id,io))}}select(ue){this.update(eo=>(ue.includes(eo.selectedComponentId)||builderStore.highlightSetting(),{...eo,selectedComponentId:ue}))}async paste(ue,eo,no,ro=!0){const oo=get_store_value(this.store);if(!oo.componentToPaste)return;let io="",ao=fp$1.cloneDeep(oo.componentToPaste);ao.isCut&&this.update(co=>(delete co.componentToPaste,co));const so=co=>{var ho;if(ue=findComponent(co.props,ue._id),!ue)return!1;const uo=ao.isCut,fo=ao.screenId,po=ao._id;if(delete ao.isCut,delete ao.screenId,uo||(ao=makeComponentUnique(ao)),io=ao._id,fo&&fo!==co._id)for(let _o of Object.keys(((ho=ao._styles)==null?void 0:ho.normal)||{}))_o.startsWith("--grid")&&(_o.endsWith("-start")||_o.endsWith("-end"))&&delete ao._styles.normal[_o];if(uo){const _o=findComponentParent(co.props,po);_o!=null&&_o._children&&(_o._children=_o._children.filter(go=>go._id!==po))}if(eo==="inside"){const _o=this.getDefinition(ue._component);_o!=null&&_o.hasChildren||(eo="below")}if(eo==="inside")ue._children||(ue._children=[]),ue._children.push(ao);else{const _o=findComponentParent(co.props,ue._id);if(!(_o!=null&&_o._children))return!1;const go=_o._children.findIndex(vo=>vo._id===ue._id),bo=eo==="above"?go:go+1;_o._children.splice(bo,0,ao)}},lo=(no==null?void 0:no._id)??oo.selectedScreenId??null;await screenStore.patch(so,lo),ro&&this.update(co=>(co.selectedScreenId=lo,co.selectedComponentId=io,co)),componentTreeNodesStore.makeNodeVisible(io)}getPrevious(){var so,lo;const eo=get_store_value(this.store).selectedComponentId,no=get_store_value(selectedScreen);if(!no)throw"A valid screen must be selected";const ro=findComponentParent(no.props,eo),oo=ro==null?void 0:ro._children.findIndex(co=>co._id===eo),io=`${no._id}-screen`,ao=`${no._id}-navigation`;if(eo===io)return null;if(eo===ao)return io;if(ro._id===no.props._id&&oo===0)return ao;if(oo>0){const co=ro._children[oo-1];if((so=co._children)!=null&&so.length&&componentTreeNodesStore.isNodeExpanded(co._id)){let uo=co;for(;(lo=uo._children)!=null&&lo.length&&componentTreeNodesStore.isNodeExpanded(uo._id);)uo=uo._children[uo._children.length-1];return uo._id}return co._id}return ro._id}getNext(){var fo,po;const ue=get_store_value(this.store),eo=get_store_value(selectedComponent),no=eo==null?void 0:eo._id,ro=get_store_value(selectedScreen);if(!ro)throw"A valid screen must be selected";const oo=findComponentParent(ro.props,no),io=oo==null?void 0:oo._children.findIndex(ho=>ho._id===no),ao=`${ro._id}-screen`,so=`${ro._id}-navigation`;if(ue.selectedComponentId===ao)return so;if((fo=eo==null?void 0:eo._children)!=null&&fo.length&&(ue.selectedComponentId===so||componentTreeNodesStore.isNodeExpanded(eo._id)))return eo._children[0]._id;if(!oo)return null;if(io<oo._children.length-1)return oo._children[io+1]._id;let lo=oo,co=findComponentParent(ro.props,lo._id),uo=co==null?void 0:co._children.findIndex(ho=>ho._id===lo._id);for(;co!=null&&uo===((po=co._children)==null?void 0:po.length)-1;)lo=co,co=findComponentParent(ro.props,lo._id),uo=co==null?void 0:co._children.findIndex(ho=>ho._id===lo._id);return co?co._children[uo+1]._id:null}selectPrevious(){const ue=this.getPrevious();ue&&this.update(eo=>(eo.selectedComponentId=ue,eo))}selectNext(){const ue=this.getNext();ue&&this.update(eo=>(eo.selectedComponentId=ue,eo))}async moveUp(ue){await screenStore.patch(eo=>{const no=ue==null?void 0:ue._id,ro=findComponentParent(eo.props,no),oo=ro==null?void 0:ro._children.findIndex(ao=>ao._id===no);if(!ro||oo===0&&ro._id===eo.props._id)return;const io=fp$1.cloneDeep(ro._children[oo]);if(ro._children=ro._children.filter(ao=>ao._id!==no),oo>0){const ao=ro._children[oo-1],so=this.getDefinition(ao._component);so!=null&&so.hasChildren&&componentTreeNodesStore.isNodeExpanded(ao._id)?ao._children.push(io):ro._children.splice(oo-1,0,io)}else if(ro._id!==eo.props._id){const ao=findComponentParent(eo.props,ro._id),so=ao._children.findIndex(lo=>lo._id===ro._id);ao._children.splice(so,0,io)}},null)}async moveDown(ue){await screenStore.patch(eo=>{var ao;const no=ue==null?void 0:ue._id,ro=findComponentParent(eo.props,no);if(!((ao=ro==null?void 0:ro._children)!=null&&ao.length))return!1;const oo=ro._children.findIndex(so=>so._id===no);if(oo===ro._children.length-1&&ro._id===eo.props._id)return;const io=fp$1.cloneDeep(ro._children[oo]);if(ro._children=ro._children.filter(so=>so._id!==no),oo<ro._children.length){const so=ro._children[oo],lo=this.getDefinition(so._component);lo!=null&&lo.hasChildren&&componentTreeNodesStore.isNodeExpanded(so._id)?so._children.splice(0,0,io):ro._children.splice(oo+1,0,io)}else{const so=findComponentParent(eo.props,ro._id),lo=so._children.findIndex(co=>co._id===ro._id);so._children.splice(lo+1,0,io)}},null)}async updateStyle(ue,eo){await this.patch(no=>{eo==null||eo===""?delete no._styles.normal[ue]:no._styles.normal[ue]=eo})}async updateStyles(ue,eo){const no=ro=>{delete ro._placeholder,ro._styles.normal={...ro._styles.normal,...ue}};await this.patch(no,eo)}async updateCustomStyle(ue){await this.patch(eo=>{eo._styles.custom=ue})}async updateConditions(ue){await this.patch(eo=>{eo._conditions=ue})}async updateSetting(ue,eo){await this.patch(this.updateComponentSetting(ue,eo))}updateComponentSetting(ue,eo){return no=>{if(!ue||!no||no[ue]===eo)return!1;const ro=this.getComponentSettings(no._component),oo=ro.find(io=>io.key===ue);if(ro.forEach(io=>{(ue===io.resetOn||Array.isArray(io.resetOn)&&io.resetOn.includes(ue))&&(no[io.key]=io.defaultValue||null)}),(oo==null?void 0:oo.type)==="dataSource"||(oo==null?void 0:oo.type)==="table"){const{schema:io}=getSchemaForDatasource(null,eo,null),ao=Object.keys(io||{});ro.filter(lo=>lo.type==="multifield"&&lo.selectAllFields).map(lo=>lo.key).forEach(lo=>{no[lo]=ao})}return no[ue]=eo,!0}}requestEjectBlock(ue){previewStore.sendEvent("eject-block",ue)}async handleEjectBlock(ue,eo){let no;await screenStore.patch(ro=>{var lo;const oo=findComponent(ro.props,ue),io=findComponentParent(ro.props,ue);if(!oo||!((lo=io==null?void 0:io._children)!=null&&lo.length))return!1;analytics.captureEvent(Events.BLOCK_EJECTED,{block:oo._component});const ao=findAllMatchingComponents(eo,co=>co._containsSlot)[0];ao&&(delete ao._containsSlot,ao._children=[...ao._children||[],...oo._children||[]]),eo=makeComponentUnique(eo);const so=io._children.findIndex(co=>co._id===ue);io._children[so]=eo,no=eo._id},null),no&&this.update(ro=>(ro.selectedComponentId=no,ro))}async addParent(ue,eo){if(!ue||!eo)return;const no=this.createInstance(eo);no&&(await screenStore.patch(ro=>{let oo=findComponent(ro.props,ue),io=findComponentParent(ro.props,ue);if(!oo||!io)return!1;const ao=io._children.findIndex(so=>so._id===ue);if(ao===-1)return!1;io._children[ao]={...no,_children:[oo]}},null),this.update(ro=>(ro.selectedComponentId=no._id,ro)))}isCached(ue){const eo=get_store_value(this.store).settingsCache;return ue in eo}cacheSettings(ue,eo){var ro,oo;let no=[];return eo&&(no=((ro=eo.settings)==null?void 0:ro.filter(io=>!io.section))??[],(oo=eo.settings)==null||oo.filter(io=>io.section).forEach(io=>{no=no.concat((io.settings||[]).map(ao=>({...ao,section:io.name})))})),this.update(io=>({...io,settingsCache:{...io.settingsCache,[ue]:no}})),no}getComponentSettings(ue){if(!ue)return[];!ue.startsWith("plugin/")&&!ue.startsWith("@budibase")&&(ue=`@budibase/standard-components/${ue}`);const eo=get_store_value(this.store).settingsCache[ue];if(eo)return eo;const no=this.getDefinition(ue);return this.cacheSettings(ue,no)}}const componentStore=new ComponentStore,selectedComponent=derived([componentStore,selectedScreen],([to,ue])=>{var ro;if(ue&&((ro=to.selectedComponentId)!=null&&ro.startsWith(`${ue._id}-`)))return{...ue.props,_id:ue.props._id};if(!ue||!to.selectedComponentId)return null;const eo=findComponent(ue==null?void 0:ue.props,to.selectedComponentId),no=eo&&fp$1.cloneDeep(eo);return componentStore.migrateSettings(no),no}),INITIAL_NAVIGATION_STATE={navigation:"Top",links:[],textAlign:"Left"};class NavigationStore extends BudiStore{constructor(){super(INITIAL_NAVIGATION_STATE)}syncAppNavigation(ue){this.update(eo=>({...eo,...ue}))}reset(){this.store.set({...INITIAL_NAVIGATION_STATE})}async save(ue){const eo=get_store_value(appStore).appId,no=await API.saveAppMetadata(eo,{navigation:ue});no.navigation&&this.syncAppNavigation(no.navigation)}async saveLink(ue,eo,no){const ro=get_store_value(this.store);let oo=[...(ro==null?void 0:ro.links)??[]];oo.find(io=>io.url===ue&&io.text===eo)||(oo.push({text:eo,url:ue,type:"link",roleId:no}),await this.save({...ro,links:[...oo]}))}async deleteLink(ue){const eo=get_store_value(this.store);let no=eo==null?void 0:eo.links;no!=null&&no.length&&(ue=Array.isArray(ue)?ue:[ue],no=no.filter(ro=>!ue.includes(ro.url)),no.forEach(ro=>{var oo;ro.type==="sublinks"&&((oo=ro.subLinks)!=null&&oo.length)&&(ro.subLinks=ro.subLinks.filter(io=>!ue.includes(io.url)))}),await this.save({...eo,links:no}))}syncMetadata(ue){const{navigation:eo}=ue;this.syncAppNavigation(eo)}}const navigationStore=new NavigationStore;class ThemeStore extends BudiStore{constructor(){super({theme:DefaultAppTheme$1,customTheme:{}}),this.syncAppTheme=ue=>{this.update(eo=>{const no=ensureValidTheme(ue.theme,DefaultAppTheme$1);return{...eo,theme:no,customTheme:ue.customTheme||{}}})},this.save=async(ue,eo)=>{const no=await API.saveAppMetadata(eo,{theme:ue});this.update(ro=>({...ro,theme:ensureValidTheme(no.theme,DefaultAppTheme$1)}))},this.saveCustom=async(ue,eo)=>{const no={...get_store_value(this).customTheme,...ue},ro=await API.saveAppMetadata(eo,{customTheme:no});this.update(oo=>({...oo,customTheme:ro.customTheme||{}}))},this.syncMetadata=ue=>{const{theme:eo,customTheme:no}=ue;this.update(ro=>({...ro,theme:ensureValidTheme(eo,DefaultAppTheme$1),customTheme:no||{}}))}}}const themeStore=new ThemeStore,createBuilderWebsocket=to=>{const ue=createWebsocket("/socket/builder");return ue.on("connect",()=>{ue.emit(BuilderSocketEvent.SelectApp,{appId:to},({users:eo})=>{userStore.init(eo)})}),ue.on("connect_error",eo=>{console.error("Failed to connect to builder websocket:",eo.message)}),ue.on("disconnect",()=>{userStore.reset()}),ue.onOther(SocketEvent.UserUpdate,({user:eo})=>{userStore.updateUser(eo)}),ue.onOther(SocketEvent.UserDisconnect,({sessionId:eo})=>{userStore.removeUser(eo)}),ue.onOther(BuilderSocketEvent.LockTransfer,({userId:eo})=>{var no,ro;eo===((ro=(no=get_store_value(auth))==null?void 0:no.user)==null?void 0:ro._id)&&appStore.update(oo=>({...oo,hasLock:!0}))}),ue.onOther(BuilderSocketEvent.TableChange,({id:eo,table:no})=>{tables.replaceTable(eo,no)}),ue.onOther(BuilderSocketEvent.DatasourceChange,({id:eo,datasource:no})=>{datasources.replaceDatasource(eo,no)}),ue.onOther(BuilderSocketEvent.RoleChange,({id:eo,role:no})=>{roles.replace(eo,no)}),ue.onOther(BuilderSocketEvent.ScreenChange,({id:eo,screen:no})=>{screenStore.replace(eo,no)}),ue.onOther(BuilderSocketEvent.AppMetadataChange,({metadata:eo})=>{appStore.syncMetadata(eo),themeStore.syncMetadata(eo),navigationStore.syncMetadata(eo),snippets$1.syncMetadata(eo)}),ue.onOther(BuilderSocketEvent.AppPublishChange,async({user:eo,published:no})=>{await appsStore.load(),no&&await deploymentStore.load();const ro=no?"published":"unpublished";notifications.success(`${getUserLabel(eo)} ${ro} this app`)}),ue.onOther(BuilderSocketEvent.AutomationChange,({id:eo,automation:no})=>{automationStore.actions.replace(eo,no)}),ue};function create_fragment$9l(to){let ue;return{c(){ue=element("div"),ue.innerHTML=`In this section you can manage the data for your app:
|
|
508
|
+
*/var beforeDict=new WeakMap,Mirror=function(){function to(ue){this.observers=new Map,this.obj=ue}return to}(),ObserverInfo=function(){function to(ue,eo){this.callback=ue,this.observer=eo}return to}();function getMirror(to){return beforeDict.get(to)}function getObserverFromMirror(to,ue){return to.observers.get(ue)}function removeObserverFromMirror(to,ue){to.observers.delete(ue.callback)}function unobserve$1(to,ue){ue.unobserve()}function observe$2(to,ue){var eo=[],no,ro=getMirror(to);if(!ro)ro=new Mirror(to),beforeDict.set(to,ro);else{var oo=getObserverFromMirror(ro,ue);no=oo&&oo.observer}if(no)return no;if(no={},ro.value=_deepClone(to),ue){no.callback=ue,no.next=null;var io=function(){generate$1(no)},ao=function(){clearTimeout(no.next),no.next=setTimeout(io)};typeof window<"u"&&(window.addEventListener("mouseup",ao),window.addEventListener("keyup",ao),window.addEventListener("mousedown",ao),window.addEventListener("keydown",ao),window.addEventListener("change",ao))}return no.patches=eo,no.object=to,no.unobserve=function(){generate$1(no),clearTimeout(no.next),removeObserverFromMirror(ro,no),typeof window<"u"&&(window.removeEventListener("mouseup",ao),window.removeEventListener("keyup",ao),window.removeEventListener("mousedown",ao),window.removeEventListener("keydown",ao),window.removeEventListener("change",ao))},ro.observers.set(ue,new ObserverInfo(ue,no)),no}function generate$1(to,ue){ue===void 0&&(ue=!1);var eo=beforeDict.get(to.object);_generate(eo.value,to.object,to.patches,"",ue),to.patches.length&&applyPatch(eo.value,to.patches);var no=to.patches;return no.length>0&&(to.patches=[],to.callback&&to.callback(no)),no}function _generate(to,ue,eo,no,ro){if(ue!==to){typeof ue.toJSON=="function"&&(ue=ue.toJSON());for(var oo=_objectKeys(ue),io=_objectKeys(to),ao=!1,so=io.length-1;so>=0;so--){var lo=io[so],co=to[lo];if(hasOwnProperty$6(ue,lo)&&!(ue[lo]===void 0&&co!==void 0&&Array.isArray(ue)===!1)){var uo=ue[lo];typeof co=="object"&&co!=null&&typeof uo=="object"&&uo!=null&&Array.isArray(co)===Array.isArray(uo)?_generate(co,uo,eo,no+"/"+escapePathComponent(lo),ro):co!==uo&&(ro&&eo.push({op:"test",path:no+"/"+escapePathComponent(lo),value:_deepClone(co)}),eo.push({op:"replace",path:no+"/"+escapePathComponent(lo),value:_deepClone(uo)}))}else Array.isArray(to)===Array.isArray(ue)?(ro&&eo.push({op:"test",path:no+"/"+escapePathComponent(lo),value:_deepClone(co)}),eo.push({op:"remove",path:no+"/"+escapePathComponent(lo)}),ao=!0):(ro&&eo.push({op:"test",path:no,value:to}),eo.push({op:"replace",path:no,value:ue}))}if(!(!ao&&oo.length==io.length))for(var so=0;so<oo.length;so++){var lo=oo[so];!hasOwnProperty$6(to,lo)&&ue[lo]!==void 0&&eo.push({op:"add",path:no+"/"+escapePathComponent(lo),value:_deepClone(ue[lo])})}}}function compare$2(to,ue,eo){eo===void 0&&(eo=!1);var no=[];return _generate(to,ue,no,"",eo),no}const duplex=Object.freeze(Object.defineProperty({__proto__:null,compare:compare$2,generate:generate$1,observe:observe$2,unobserve:unobserve$1},Symbol.toStringTag,{value:"Module"}));Object.assign({},core,duplex,{JsonPatchError:PatchError,deepClone:_deepClone,escapePathComponent,unescapePathComponent});const initialState$2={history:[],position:0,loading:!1},createHistoryStore=({getDoc:to,selectDoc:ue,beforeAction:eo,afterAction:no})=>{const ro=writable(initialState$2),oo=derived(ro,go=>({...go,canUndo:go.position>0,canRedo:go.position<go.history.length}));let io,ao;const so=()=>{ro.update(go=>(go.loading=!0,go))},lo=()=>{ro.update(go=>(go.loading=!1,go))},co=()=>{ro.set(initialState$2)},uo=go=>{ro.update(bo=>{let vo=bo.history,yo=bo.position;if(!go.id)go.id=Math.random(),vo=[...vo.slice(0,bo.position),go],yo+=1;else{const $o=vo.findIndex(ko=>ko.id===go.id);vo[$o].doc=go.doc}return{history:vo,position:yo}})},fo=go=>(io=async(bo,vo)=>{if(!(!bo||Array.isArray(bo))){so();try{const yo=to(bo._id),$o=_deepClone(await go(bo));return uo(yo?{type:"Change",forwardPatch:compare$2(yo,bo),backwardsPatch:compare$2(bo,yo),doc:$o,id:vo}:{type:"Add",doc:$o,id:vo}),lo(),$o}catch(yo){throw lo(),yo}}},io),po=go=>(ao=async(bo,vo)=>{if(!(!bo||Array.isArray(bo))){so();try{const yo=_deepClone(bo);await go(bo),uo({type:"Delete",doc:yo,id:vo}),lo()}catch(yo){throw lo(),yo}}},ao),ho=async()=>{const{canUndo:go,history:bo,position:vo,loading:yo}=get_store_value(oo);if(!go||yo)return;const $o=bo[vo-1];if($o){so(),await(eo==null?void 0:eo($o)),ro.update(ko=>({...ko,position:ko.position-1}));try{if($o.type==="Add"){const So=to($o.doc._id)||$o.doc;await ao(So,$o.id)}else if($o.type==="Delete"){let ko=_deepClone($o.doc);delete ko._rev;const So=await io(ko,$o.id);ue==null||ue((So==null?void 0:So._id)||ko._id)}else{let ko=_deepClone(to($o.doc._id));ko&&(applyPatch(ko,_deepClone($o.backwardsPatch)),await io(ko,$o.id),ue==null||ue(ko._id))}lo()}catch(ko){throw lo(),ko}await(no==null?void 0:no($o))}},_o=async()=>{const{canRedo:go,history:bo,position:vo,loading:yo}=get_store_value(oo);if(!go||yo)return;const $o=bo[vo];if($o){so(),await(eo==null?void 0:eo($o)),ro.update(ko=>({...ko,position:ko.position+1}));try{if($o.type==="Add"){let ko=_deepClone($o.doc);delete ko._rev;const So=await io(ko,$o.id);ue==null||ue((So==null?void 0:So._id)||ko._id)}else if($o.type==="Delete"){const So=to($o.doc._id)||$o.doc;await ao(So,$o.id)}else{let ko=_deepClone(to($o.doc._id));ko&&(applyPatch(ko,_deepClone($o.forwardPatch)),await io(ko,$o.id),ue==null||ue(ko._id))}lo()}catch(ko){throw lo(),ko}await(no==null?void 0:no($o))}};return{subscribe:oo.subscribe,wrapSaveDoc:fo,wrapDeleteDoc:po,reset:co,undo:ho,redo:_o}},initialScreenState={screens:[]};class ScreenStore extends BudiStore{constructor(){super(initialScreenState),this.sequentialScreenPatch=sequential(async(ue,eo)=>{const ro=get_store_value(this.store).screens.find(ao=>ao._id===eo);if(!ro)return;let oo=fp$1.cloneDeep(ro);if(ue(oo)!==!1)return this.save(oo)}),this.select=this.select.bind(this),this.reset=this.reset.bind(this),this.syncAppScreens=this.syncAppScreens.bind(this),this.validate=this.validate.bind(this),this.patch=this.patch.bind(this),this.replace=this.replace.bind(this),this.saveScreen=this.saveScreen.bind(this),this.deleteScreen=this.deleteScreen.bind(this),this.syncScreenData=this.syncScreenData.bind(this),this.updateSetting=this.updateSetting.bind(this),this.sequentialScreenPatch=this.sequentialScreenPatch.bind(this),this.removeCustomLayout=this.removeCustomLayout.bind(this),this.history=createHistoryStore({getDoc:ue=>{var eo;return(eo=get_store_value(this.store).screens)==null?void 0:eo.find(no=>no._id===ue)},selectDoc:this.select,afterAction:()=>{get_store_value(selectedComponent)||componentStore.update(ue=>{var eo;return{...ue,selectedComponentId:(eo=get_store_value(selectedScreen))==null?void 0:eo._id}})}}),this.delete=this.history.wrapDeleteDoc(this.deleteScreen),this.save=this.history.wrapSaveDoc(this.saveScreen)}reset(){this.store.set({...initialScreenState})}syncAppScreens(ue){this.update(eo=>({...eo,screens:[...ue.screens]}))}select(ue){const eo=get_store_value(this.store),no=eo.screens.find(ro=>ro._id===ue);no&&eo.selectedScreenId!==no._id&&this.update(ro=>(ro.selectedScreenId=no._id,ro))}validate(ue){const eo=(ro,oo=[],io=[])=>{var lo,co,uo;const ao=ro._component;if(oo.includes(ao)||io.length&&!io.includes(ao))return ao;if(!((lo=ro==null?void 0:ro._children)!=null&&lo.length))return;["@budibase/standard-components/sidepanel","@budibase/standard-components/modal"].includes(ao)&&(oo=[]);const so=componentStore.getDefinition(ro._component);if(so==null)throw`Invalid defintion ${ro._component}`;if(io=[],(co=so==null?void 0:so.legalDirectChildren)!=null&&co.length&&(io=so.legalDirectChildren.map(fo=>`@budibase/standard-components/${fo}`)),(uo=so==null?void 0:so.illegalChildren)!=null&&uo.length){const fo=so.illegalChildren.map(po=>`@budibase/standard-components/${po}`);oo=[...new Set([...oo,...fo])]}for(let fo of ro._children){const po=eo(fo,oo,io);if(po)return po}},no=eo(ue.props);if(no){const ro=componentStore.getDefinition(no);throw`You can't place a ${ro==null?void 0:ro.name} here`}}async saveScreen(ue){var oo;(oo=get_store_value(appStore).features)!=null&&oo.componentValidation&&this.validate(ue),this.enrichEmptySettings(ue);const no=ue._id===void 0,ro=await API.saveScreen(ue);return this.update(io=>{const ao=io.screens.findIndex(so=>so._id===ro._id);return ao!==-1?io.screens.splice(ao,1,ro):io.screens.push(ro),no&&(io.selectedScreenId=ro._id,componentStore.update(so=>({...so,selectedComponentId:ro.props._id}))),io}),await this.syncScreenData(ro),ro}async syncScreenData(ue){const eo=get_store_value(appStore);let no=eo.usedPlugins;if(ue.pluginAdded){const{application:oo}=await API.fetchAppPackage(eo.appId);no=oo.usedPlugins||[]}const ro=await API.fetchAppRoutes();appStore.update(oo=>({...oo,routes:ro.routes,usedPlugins:no}))}async patch(ue,eo){if(eo||(eo=get_store_value(this.store).selectedScreenId),!(!eo||!ue))return await this.sequentialScreenPatch(ue,eo)}async replace(ue,eo){if(ue)if(!eo)this.update(no=>({...no,screens:no.screens.filter(ro=>ro._id!==ue)}));else{const no=get_store_value(this.store).screens.findIndex(ro=>ro._id===eo._id);no===-1?this.update(ro=>({...ro,screens:[...ro.screens,eo]})):this.update(ro=>(ro.screens[no]=eo,ro))}}async deleteScreen(ue){const eo=[ue];let no=[],ro=[];eo.filter(ao=>!!ao._id||!!ao._rev).forEach(ao=>{no.push(API.deleteScreen(ao._id,ao._rev)),ro.push(ao.routing.route)}),await Promise.all(no),await navigationStore.deleteLink(ro);const oo=eo.map(ao=>ao._id),io=await API.fetchAppRoutes();this.update(ao=>(ao.screens=ao.screens.filter(so=>!oo.includes(so._id)),ao.selectedScreenId&&oo.includes(ao.selectedScreenId)&&(delete ao.selectedScreenId,componentStore.update(so=>(delete so.selectedComponentId,so))),appStore.update(so=>({...so,routes:io.routes})),ao))}async updateSetting(ue,eo,no){if(!ue||!eo)return;const ro=so=>{if(!so||deepGet(so,eo)===no)return!1;deepSet(so,eo,no)};await this.patch(ro,ue._id);const oo=get_store_value(this.store),io=oo.screens.find(so=>so._id===ue._id);if(!io)return;const ao=oo.screens.filter(so=>so.routing.roleId===io.routing.roleId&&so.routing.homeScreen&&so._id!==ue._id);if(ao.length&&io.routing.homeScreen){const so=lo=>{lo.routing.homeScreen=!1};for(let lo of ao)await this.patch(so,lo._id)}}async removeCustomLayout(ue){const eo=get_store_value(layoutStore).layouts.find(ro=>ro._id===ue.layoutId),no=ro=>{delete ro.layoutId,ro.showNavigation=(eo==null?void 0:eo.props.navigation)!=="None",ro.width=(eo==null?void 0:eo.props.width)||"Large"};await this.patch(no,ue._id)}async enrichEmptySettings(ue){findAllMatchingComponents(ue.props,no=>!!no).forEach(no=>{componentStore.enrichEmptySettings(no,{screen:ue})})}async usageInScreens(ue){return API.usageInScreens(ue)}}const screenStore=new ScreenStore,selectedScreen=derived(screenStore,to=>to.screens.find(ue=>ue._id===to.selectedScreenId)),sortedScreens=derived(screenStore,to=>to.screens.slice().sort((ue,eo)=>{const no=getRolePriority(ue.routing.roleId),ro=getRolePriority(eo.routing.roleId);if(no!==ro)return no>ro?-1:1;const oo=!!ue.routing.homeScreen,io=!!eo.routing.homeScreen;if(oo!==io)return oo?-1:1;const ao=ue.routing.route.split("/"),so=eo.routing.route.split("/");let lo=Math.min(ao.length,so.length);for(let co=0;co<lo;co++)if(ao[co]!==so[co])return ao[co]<so[co]?-1:1;return ao.length<so.length?-1:1})),duplicateName=(to,ue)=>{const eo=new RegExp("\\s(\\d+)$"),no=to.split(eo)[0],ro=new RegExp(`${no}\\s(\\d+)$`),oo=[];ue.filter(ao=>{if(ao===no)return!0;const so=ao.match(ro);return so?(oo.push(parseInt(so[1])),!0):!1}),oo.sort((ao,so)=>ao-so);let io;if(oo.length===0)io=1;else{for(let ao=0;ao<oo.length;ao++)if(oo[ao]!==ao+1){io=ao+1;break}io||(io=oo.length+1)}return`${no} ${io}`},getSequentialName=(to,ue,{getName:eo,numberFirstItem:no,separator:ro=""}={})=>{if(!(ue!=null&&ue.length))return"";const oo=ue.trim(),io=no?`${ue}1`:oo;if(!(to!=null&&to.length))return io;let ao=0;return to.forEach(so=>{const lo=(eo==null?void 0:eo(so))??so;if(typeof lo!="string"||!lo.startsWith(oo))return;const co=lo.split(oo);if(co.length!==2)return;co[1].trim()===""&&(co[1]="1");const uo=parseInt(co[1]);uo>ao&&(ao=uo)}),ao===0?io:`${ue}${ro}${ao+1}`},INITIAL_COMPONENTS_STATE={components:{},customComponents:[],settingsCache:{}};class ComponentStore extends BudiStore{constructor(){super(INITIAL_COMPONENTS_STATE),this.reset=this.reset.bind(this),this.refreshDefinitions=this.refreshDefinitions.bind(this),this.getDefinition=this.getDefinition.bind(this),this.getDefaultDatasource=this.getDefaultDatasource.bind(this),this.enrichEmptySettings=this.enrichEmptySettings.bind(this),this.createInstance=this.createInstance.bind(this),this.create=this.create.bind(this),this.patch=this.patch.bind(this),this.delete=this.delete.bind(this),this.copy=this.copy.bind(this),this.paste=this.paste.bind(this),this.select=this.select.bind(this),this.getPrevious=this.getPrevious.bind(this),this.getNext=this.getNext.bind(this),this.selectPrevious=this.selectPrevious.bind(this),this.selectNext=this.selectNext.bind(this),this.moveUp=this.moveUp.bind(this),this.moveDown=this.moveDown.bind(this),this.updateStyle=this.updateStyle.bind(this),this.updateStyles=this.updateStyles.bind(this),this.updateCustomStyle=this.updateCustomStyle.bind(this),this.updateConditions=this.updateConditions.bind(this),this.requestEjectBlock=this.requestEjectBlock.bind(this),this.handleEjectBlock=this.handleEjectBlock.bind(this),this.updateSetting=this.updateSetting.bind(this),this.updateComponentSetting=this.updateComponentSetting.bind(this),this.addParent=this.addParent.bind(this),this.isCached=this.isCached.bind(this),this.cacheSettings=this.cacheSettings.bind(this),this.getComponentSettings=this.getComponentSettings.bind(this)}reset(){this.store.set({...INITIAL_COMPONENTS_STATE})}async refreshDefinitions(ue){if(!ue)return;const eo=await API.fetchComponentLibDefinitions(ue),no=Object.keys(eo).filter(ro=>ro.startsWith("plugin/"));return this.update(ro=>({...ro,components:eo,customComponents:no})),appStore.syncClientFeatures(eo.features),appStore.syncClientTypeSupportPresets((eo==null?void 0:eo.typeSupportPresets)??{}),eo}getDefinition(ue){return ue?get_store_value(this.store).components[ue]:null}getDefaultDatasource(){const ue=get_store_value(tables).list.filter(no=>no._id!=="ta_users");let eo=ue.find(no=>no.sourceId===BUDIBASE_INTERNAL_DB_ID&&no.sourceType===DB_TYPE_INTERNAL);return eo||(eo=ue.find(no=>no.sourceId===DEFAULT_BB_DATASOURCE_ID&&no.sourceType===DB_TYPE_INTERNAL),eo)?eo:ue.find(no=>no.sourceType===DB_TYPE_EXTERNAL)}migrateSettings(ue){var io;const eo="@budibase/standard-components";let no=!1;if((ue==null?void 0:ue._component)===`${eo}/formblock`){if(!("buttons"in ue))ue.buttons=buildFormBlockButtonConfig(ue),no=!0;else if(ue.buttons==null){const{_id:ao,actionType:so,dataSource:lo}=ue;ue.buttons=buildFormBlockButtonConfig({_id:ao,actionType:so,dataSource:lo}),no=!0}"buttonPosition"in ue||(ue.buttonPosition="top",no=!0)}if(!(ue!=null&&ue._component))return no;const ro=this.getDefinition(ue==null?void 0:ue._component),oo=(io=ro==null?void 0:ro.settings)==null?void 0:io.filter(ao=>{var so;return(so=ao==null?void 0:ao.type)==null?void 0:so.startsWith("filter")});for(let ao of oo||[])Array.isArray(ue[ao.key])&&(ue[ao.key]=processSearchFilters(ue[ao.key]),no=!0);return no}enrichEmptySettings(ue,eo){if(!(ue!=null&&ue._component))return;const no=this.getDefaultDatasource(),ro=this.getComponentSettings(ue._component),{parent:oo,screen:io,useDefaultValues:ao}=eo||{},so=oo||ue._id;if(io&&(ro.forEach(lo=>{var uo,fo,po;const co=ue[lo.key];if(co==null||co==="")if(lo.type==="multifield"&&lo.selectAllFields)ue[lo.key]=Object.keys((no==null?void 0:no.schema)||{});else if((lo.type==="dataSource"||lo.type==="table")&&no)ue[lo.key]={label:no.name,tableId:no._id,resourceId:no._id,type:"table"};else if(lo.type==="dataProvider"){let ho;const go=findComponentPath(io.props,so).filter(bo=>{var vo;return(vo=bo._component)==null?void 0:vo.endsWith("/dataprovider")});ho=(uo=go[go.length-1])==null?void 0:uo._id,ho||(ho=(fo=findComponentType(io.props,"@budibase/standard-components/dataprovider"))==null?void 0:fo._id),ho&&(ue[lo.key]=`{{ literal ${makePropSafe(ho)} }}`)}else if(lo.type.startsWith("field/")){let ho=getComponentFieldOptions(io.props,so,lo.type,!1);const _o=findClosestMatchingComponent(io.props,so,bo=>bo._component==="@budibase/standard-components/form"),go=Object.keys(buildFormSchema(_o)||{});ho=ho.filter(bo=>!go.includes(bo)),ho[0]&&(ue[lo.key]=ho[0],ue.label=ho[0])}else ao&&lo.defaultValue!==void 0&&(ue[lo.key]=lo.defaultValue);else if(lo.type==="dataProvider"){const ho=findAllMatchingComponents(io==null?void 0:io.props,go=>go._component==="@budibase/standard-components/dataprovider");if(!(ho==null?void 0:ho.some(go=>{var bo;return(bo=co.includes)==null?void 0:bo.call(co,go._id)})))if(ho.length){const go=(po=ho[ho.length-1])==null?void 0:po._id;ue[lo.key]=`{{ literal ${makePropSafe(go)} }}`}else delete ue[lo.key]}}),ue._component.endsWith("/cardsblock")&&["cardTitle","cardSubtitle","cardDescription"].every(co=>!ue[co])&&!ue.cardImageURL)){const{_id:co,dataSource:uo}=ue;if(uo){const{schema:fo,table:po}=getSchemaForDatasource(io,uo,{}),ho=$o=>(Array.isArray($o)||($o=[$o]),Object.entries(fo||{}).filter(([ko,So])=>$o.includes(So.type)&&!So.autoColumn&&ko!==(po==null?void 0:po.primaryDisplay)&&!ko.startsWith("_")).map(([ko])=>ko)),_o=($o,ko,...So)=>{So.some(Ao=>Ao==null)?ue[$o]=ko:(So.unshift(`${co}-repeater`),ue[$o]=`{{ ${So.map(makePropSafe).join(".")} }}`)},go=[...ho(FieldType.STRING),...ho(FieldType.OPTIONS),...ho(FieldType.ARRAY),...ho(FieldType.NUMBER)],bo=ho(FieldType.LONGFORM);po!=null&&po.primaryDisplay&&(fo!=null&&fo[po.primaryDisplay])&&go.unshift(po.primaryDisplay),_o("cardTitle","Title",go[0]),_o("cardSubtitle","Subtitle",go[1]);const vo=bo[0]??go[2];_o("cardDescription","Description",vo);let yo=ho(FieldType.ATTACHMENT_SINGLE)[0];yo?_o("cardImageURL",null,yo,"url"):(yo=ho(FieldType.ATTACHMENTS)[0],yo&&_o("cardImageURL",null,yo,0,"url"))}}}createInstance(ue,eo,no){var lo,co;const ro=get_store_value(selectedScreen);if(!ro)throw"A valid screen must be selected";const oo=this.getDefinition(ue);if(!oo)return null;const io=getSequentialName(get_store_value(screenComponentsList),`New ${oo.friendlyName||oo.name}`,{getName:uo=>uo._instanceName,separator:" "});let ao={_id:uuid$2(),_component:oo.component,_styles:{normal:{...(lo=eo==null?void 0:eo._styles)==null?void 0:lo.normal},hover:{},active:{}},_instanceName:io,...eo};this.enrichEmptySettings(ao,{parent:no,screen:ro,useDefaultValues:!0});try{this.migrateSettings(ao)}catch(uo){throw console.error(uo),uo}let so={};if(oo.hasChildren&&(so._children=[]),ue.endsWith("/formstep")){const uo=findClosestMatchingComponent(ro.props,(co=get_store_value(selectedComponent))==null?void 0:co._id,po=>po._component.endsWith("/form")),fo=findAllMatchingComponents(uo,po=>po._component.endsWith("/formstep"));so.step=fo.length+1,so._instanceName=`Step ${fo.length+1}`}return{...fp$1.cloneDeep(ao),...so}}async create(ue,eo,no,ro){const oo=get_store_value(this.store),io=this.createInstance(ue,eo,no);if(io)return no&&ro!=null?await screenStore.patch(ao=>{var lo;let so=findComponent(ao.props,no);(lo=so._children)!=null&&lo.length?so._children.splice(ro,0,io):so._children=[io]},null):await screenStore.patch(ao=>{let so=oo.selectedComponentId;so!=null&&so.startsWith(`${ao._id}-`)&&(so=ao.props._id);const lo=findComponent(ao.props,so);if(!lo)return!1;let co;if(lo){const uo=this.getDefinition(lo._component);uo!=null&&uo.hasChildren?co=lo:co=findComponentParent(ao.props,lo._id)}else co=ao.props;if(!co)return!1;co._children||(co._children=[]),co._children.push(io)},null),this.update(ao=>(ao.selectedComponentId=io._id,ao)),componentTreeNodesStore.makeNodeVisible(io._id),analytics.captureEvent(Events.COMPONENT_CREATED,{name:io._component}),io}async patch(ue,eo,no){if(!eo||!no){const oo=get_store_value(this.store);eo=eo??oo.selectedComponentId??void 0;const io=get_store_value(screenStore);no=no||io.selectedScreenId}if(!eo||!no||!ue)return;const ro=oo=>{let io=findComponent(oo.props,eo);if(!io)return!1;const ao=ue(io,oo);return this.migrateSettings(io)?null:ao};await screenStore.patch(ro,no)}async delete(ue){if(!ue)return;const eo=get_store_value(this.store);let no="";eo.selectedComponentId===ue._id&&(no=this.getNext(),no||(no=this.getPrevious())),no&&(no.endsWith("-navigation")&&(no=no.replace("-navigation","-screen")),this.update(ro=>(ro.selectedComponentId=no??void 0,ro))),await screenStore.patch(ro=>{const oo=findComponent(ro.props,ue._id);if(!oo)return!1;const io=findComponentParent(ro.props,oo._id);if(!io)return!1;io._children=io._children.filter(ao=>ao._id!==oo._id)},null)}copy(ue,eo=!1,no=!0){if(this.update(ro=>(ro.componentToPaste=fp$1.cloneDeep(ue),ro.componentToPaste.isCut=eo,ro.componentToPaste.screenId=get_store_value(screenStore).selectedScreenId,ro)),eo&&no){const ro=get_store_value(selectedScreen),oo=findComponentParent(ro==null?void 0:ro.props,ue._id);oo&&this.update(io=>(io.selectedComponentId=oo._id,io))}}select(ue){this.update(eo=>(ue.includes(eo.selectedComponentId)||builderStore.highlightSetting(),{...eo,selectedComponentId:ue}))}async paste(ue,eo,no,ro=!0){const oo=get_store_value(this.store);if(!oo.componentToPaste)return;let io="",ao=fp$1.cloneDeep(oo.componentToPaste);ao.isCut&&this.update(co=>(delete co.componentToPaste,co));const so=co=>{var ho;if(ue=findComponent(co.props,ue._id),!ue)return!1;const uo=ao.isCut,fo=ao.screenId,po=ao._id;if(delete ao.isCut,delete ao.screenId,uo||(ao=makeComponentUnique(ao)),io=ao._id,fo&&fo!==co._id)for(let _o of Object.keys(((ho=ao._styles)==null?void 0:ho.normal)||{}))_o.startsWith("--grid")&&(_o.endsWith("-start")||_o.endsWith("-end"))&&delete ao._styles.normal[_o];if(uo){const _o=findComponentParent(co.props,po);_o!=null&&_o._children&&(_o._children=_o._children.filter(go=>go._id!==po))}if(eo==="inside"){const _o=this.getDefinition(ue._component);_o!=null&&_o.hasChildren||(eo="below")}if(eo==="inside")ue._children||(ue._children=[]),ue._children.push(ao);else{const _o=findComponentParent(co.props,ue._id);if(!(_o!=null&&_o._children))return!1;const go=_o._children.findIndex(vo=>vo._id===ue._id),bo=eo==="above"?go:go+1;_o._children.splice(bo,0,ao)}},lo=(no==null?void 0:no._id)??oo.selectedScreenId??null;await screenStore.patch(so,lo),ro&&this.update(co=>(co.selectedScreenId=lo,co.selectedComponentId=io,co)),componentTreeNodesStore.makeNodeVisible(io)}getPrevious(){var so,lo,co;const eo=get_store_value(this.store).selectedComponentId,no=get_store_value(selectedScreen);if(!no)throw"A valid screen must be selected";const ro=findComponentParent(no.props,eo),oo=(so=ro==null?void 0:ro._children)==null?void 0:so.findIndex(uo=>uo._id===eo),io=`${no._id}-screen`,ao=`${no._id}-navigation`;if(eo===io)return null;if(eo===ao)return io;if(ro._id===no.props._id&&oo===0)return ao;if(oo!==void 0&&oo>0){const uo=ro._children[oo-1];if((lo=uo._children)!=null&&lo.length&&componentTreeNodesStore.isNodeExpanded(uo._id)){let fo=uo;for(;(co=fo._children)!=null&&co.length&&componentTreeNodesStore.isNodeExpanded(fo._id);)fo=fo._children[fo._children.length-1];return fo._id}return uo._id}return ro._id}getNext(){var fo,po,ho;const ue=get_store_value(this.store),eo=get_store_value(selectedComponent),no=eo==null?void 0:eo._id,ro=get_store_value(selectedScreen);if(!ro)throw"A valid screen must be selected";const oo=findComponentParent(ro.props,no),io=(fo=oo==null?void 0:oo._children)==null?void 0:fo.findIndex(_o=>_o._id===no),ao=`${ro._id}-screen`,so=`${ro._id}-navigation`;if(ue.selectedComponentId===ao)return so;if((po=eo==null?void 0:eo._children)!=null&&po.length&&(ue.selectedComponentId===so||componentTreeNodesStore.isNodeExpanded(eo._id)))return eo._children[0]._id;if(!oo)return null;if(io<oo._children.length-1)return oo._children[io+1]._id;let lo=oo,co=findComponentParent(ro.props,lo._id),uo=(ho=co==null?void 0:co._children)==null?void 0:ho.findIndex(_o=>_o._id===lo._id);for(;co!=null&&co._children&&uo===co._children.length-1;)lo=co,co=findComponentParent(ro.props,lo._id),uo=co==null?void 0:co._children.findIndex(_o=>_o._id===lo._id);return co?co._children[uo+1]._id:null}selectPrevious(){const ue=this.getPrevious();ue&&this.update(eo=>(eo.selectedComponentId=ue,eo))}selectNext(){const ue=this.getNext();ue&&this.update(eo=>(eo.selectedComponentId=ue,eo))}async moveUp(ue){await screenStore.patch(eo=>{var ao;const no=ue==null?void 0:ue._id,ro=findComponentParent(eo.props,no),oo=(ao=ro==null?void 0:ro._children)==null?void 0:ao.findIndex(so=>so._id===no);if(!ro||oo===0&&ro._id===eo.props._id)return;const io=fp$1.cloneDeep(ro._children[oo]);if(ro._children=ro._children.filter(so=>so._id!==no),oo>0){const so=ro._children[oo-1],lo=this.getDefinition(so._component);lo!=null&&lo.hasChildren&&componentTreeNodesStore.isNodeExpanded(so._id)?so._children.push(io):ro._children.splice(oo-1,0,io)}else if(ro._id!==eo.props._id){const so=findComponentParent(eo.props,ro._id),lo=so._children.findIndex(co=>co._id===ro._id);so._children.splice(lo,0,io)}},null)}async moveDown(ue){await screenStore.patch(eo=>{var ao;const no=ue==null?void 0:ue._id,ro=findComponentParent(eo.props,no);if(!((ao=ro==null?void 0:ro._children)!=null&&ao.length))return!1;const oo=ro._children.findIndex(so=>so._id===no);if(oo===ro._children.length-1&&ro._id===eo.props._id)return;const io=fp$1.cloneDeep(ro._children[oo]);if(ro._children=ro._children.filter(so=>so._id!==no),oo<ro._children.length){const so=ro._children[oo],lo=this.getDefinition(so._component);lo!=null&&lo.hasChildren&&componentTreeNodesStore.isNodeExpanded(so._id)?so._children.splice(0,0,io):ro._children.splice(oo+1,0,io)}else{const so=findComponentParent(eo.props,ro._id),lo=so._children.findIndex(co=>co._id===ro._id);so._children.splice(lo+1,0,io)}},null)}async updateStyle(ue,eo){await this.patch(no=>{eo==null||eo===""?delete no._styles.normal[ue]:no._styles.normal[ue]=eo})}async updateStyles(ue,eo){const no=ro=>{delete ro._placeholder,ro._styles.normal={...ro._styles.normal,...ue}};await this.patch(no,eo)}async updateCustomStyle(ue){await this.patch(eo=>{eo._styles.custom=ue})}async updateConditions(ue){await this.patch(eo=>{eo._conditions=ue})}async updateSetting(ue,eo){await this.patch(this.updateComponentSetting(ue,eo))}updateComponentSetting(ue,eo){return no=>{if(!ue||!no||no[ue]===eo)return!1;const ro=this.getComponentSettings(no._component),oo=ro.find(io=>io.key===ue);if(ro.forEach(io=>{(ue===io.resetOn||Array.isArray(io.resetOn)&&io.resetOn.includes(ue))&&(no[io.key]=io.defaultValue||null)}),(oo==null?void 0:oo.type)==="dataSource"||(oo==null?void 0:oo.type)==="table"){const{schema:io}=getSchemaForDatasource(null,eo,null),ao=Object.keys(io||{});ro.filter(lo=>lo.type==="multifield"&&lo.selectAllFields).map(lo=>lo.key).forEach(lo=>{no[lo]=ao})}return no[ue]=eo,!0}}requestEjectBlock(ue){previewStore.sendEvent("eject-block",ue)}async handleEjectBlock(ue,eo){let no;await screenStore.patch(ro=>{var lo;const oo=findComponent(ro.props,ue),io=findComponentParent(ro.props,ue);if(!oo||!((lo=io==null?void 0:io._children)!=null&&lo.length))return!1;analytics.captureEvent(Events.BLOCK_EJECTED,{block:oo._component});const ao=findAllMatchingComponents(eo,co=>co._containsSlot)[0];ao&&(delete ao._containsSlot,ao._children=[...ao._children||[],...oo._children||[]]),eo=makeComponentUnique(eo);const so=io._children.findIndex(co=>co._id===ue);io._children[so]=eo,no=eo._id},null),no&&this.update(ro=>(ro.selectedComponentId=no,ro))}async addParent(ue,eo){if(!ue||!eo)return;const no=this.createInstance(eo);no&&(await screenStore.patch(ro=>{let oo=findComponent(ro.props,ue),io=findComponentParent(ro.props,ue);if(!oo||!io)return!1;const ao=io._children.findIndex(so=>so._id===ue);if(ao===-1)return!1;io._children[ao]={...no,_children:[oo]}},null),this.update(ro=>(ro.selectedComponentId=no._id,ro)))}isCached(ue){const eo=get_store_value(this.store).settingsCache;return ue in eo}cacheSettings(ue,eo){var ro,oo;let no=[];return eo&&(no=((ro=eo.settings)==null?void 0:ro.filter(io=>!io.section))??[],(oo=eo.settings)==null||oo.filter(io=>io.section).forEach(io=>{no=no.concat((io.settings||[]).map(ao=>({...ao,section:io.name})))})),this.update(io=>({...io,settingsCache:{...io.settingsCache,[ue]:no}})),no}getComponentSettings(ue){if(!ue)return[];!ue.startsWith("plugin/")&&!ue.startsWith("@budibase")&&(ue=`@budibase/standard-components/${ue}`);const eo=get_store_value(this.store).settingsCache[ue];if(eo)return eo;const no=this.getDefinition(ue);return this.cacheSettings(ue,no)}}const componentStore=new ComponentStore,selectedComponent=derived([componentStore,selectedScreen],([to,ue])=>{var ro;if(ue&&((ro=to.selectedComponentId)!=null&&ro.startsWith(`${ue._id}-`)))return{...ue.props,_id:ue.props._id};if(!ue||!to.selectedComponentId)return null;const eo=findComponent(ue==null?void 0:ue.props,to.selectedComponentId),no=eo&&fp$1.cloneDeep(eo);return componentStore.migrateSettings(no),no}),INITIAL_NAVIGATION_STATE={navigation:"Top",links:[],textAlign:"Left"};class NavigationStore extends BudiStore{constructor(){super(INITIAL_NAVIGATION_STATE)}syncAppNavigation(ue){this.update(eo=>({...eo,...ue}))}reset(){this.store.set({...INITIAL_NAVIGATION_STATE})}async save(ue){const eo=get_store_value(appStore).appId,no=await API.saveAppMetadata(eo,{navigation:ue});no.navigation&&this.syncAppNavigation(no.navigation)}async saveLink(ue,eo,no){const ro=get_store_value(this.store);let oo=[...(ro==null?void 0:ro.links)??[]];oo.find(io=>io.url===ue&&io.text===eo)||(oo.push({text:eo,url:ue,type:"link",roleId:no}),await this.save({...ro,links:[...oo]}))}async deleteLink(ue){const eo=get_store_value(this.store);let no=eo==null?void 0:eo.links;no!=null&&no.length&&(ue=Array.isArray(ue)?ue:[ue],no=no.filter(ro=>!ue.includes(ro.url)),no.forEach(ro=>{var oo;ro.type==="sublinks"&&((oo=ro.subLinks)!=null&&oo.length)&&(ro.subLinks=ro.subLinks.filter(io=>!ue.includes(io.url)))}),await this.save({...eo,links:no}))}syncMetadata(ue){const{navigation:eo}=ue;this.syncAppNavigation(eo)}}const navigationStore=new NavigationStore;class ThemeStore extends BudiStore{constructor(){super({theme:DefaultAppTheme$1,customTheme:{}}),this.syncAppTheme=ue=>{this.update(eo=>{const no=ensureValidTheme(ue.theme,DefaultAppTheme$1);return{...eo,theme:no,customTheme:ue.customTheme||{}}})},this.save=async(ue,eo)=>{const no=await API.saveAppMetadata(eo,{theme:ue});this.update(ro=>({...ro,theme:ensureValidTheme(no.theme,DefaultAppTheme$1)}))},this.saveCustom=async(ue,eo)=>{const no={...get_store_value(this).customTheme,...ue},ro=await API.saveAppMetadata(eo,{customTheme:no});this.update(oo=>({...oo,customTheme:ro.customTheme||{}}))},this.syncMetadata=ue=>{const{theme:eo,customTheme:no}=ue;this.update(ro=>({...ro,theme:ensureValidTheme(eo,DefaultAppTheme$1),customTheme:no||{}}))}}}const themeStore=new ThemeStore,createBuilderWebsocket=to=>{const ue=createWebsocket("/socket/builder");return ue.on("connect",()=>{ue.emit(BuilderSocketEvent.SelectApp,{appId:to},({users:eo})=>{userStore.init(eo)})}),ue.on("connect_error",eo=>{console.error("Failed to connect to builder websocket:",eo.message)}),ue.on("disconnect",()=>{userStore.reset()}),ue.onOther(SocketEvent.UserUpdate,({user:eo})=>{userStore.updateUser(eo)}),ue.onOther(SocketEvent.UserDisconnect,({sessionId:eo})=>{userStore.removeUser(eo)}),ue.onOther(BuilderSocketEvent.LockTransfer,({userId:eo})=>{var no,ro;eo===((ro=(no=get_store_value(auth))==null?void 0:no.user)==null?void 0:ro._id)&&appStore.update(oo=>({...oo,hasLock:!0}))}),ue.onOther(BuilderSocketEvent.TableChange,({id:eo,table:no})=>{tables.replaceTable(eo,no)}),ue.onOther(BuilderSocketEvent.DatasourceChange,({id:eo,datasource:no})=>{datasources.replaceDatasource(eo,no)}),ue.onOther(BuilderSocketEvent.RoleChange,({id:eo,role:no})=>{roles.replace(eo,no)}),ue.onOther(BuilderSocketEvent.ScreenChange,({id:eo,screen:no})=>{screenStore.replace(eo,no)}),ue.onOther(BuilderSocketEvent.AppMetadataChange,({metadata:eo})=>{appStore.syncMetadata(eo),themeStore.syncMetadata(eo),navigationStore.syncMetadata(eo),snippets$1.syncMetadata(eo)}),ue.onOther(BuilderSocketEvent.AppPublishChange,async({user:eo,published:no})=>{await appsStore.load(),no&&await deploymentStore.load();const ro=no?"published":"unpublished";notifications.success(`${getUserLabel(eo)} ${ro} this app`)}),ue.onOther(BuilderSocketEvent.AutomationChange,({id:eo,automation:no})=>{automationStore.actions.replace(eo,no)}),ue};function create_fragment$9l(to){let ue;return{c(){ue=element("div"),ue.innerHTML=`In this section you can manage the data for your app:
|
|
509
509
|
<ul class="feature-list"><li>Connect data sources</li> <li>Edit data</li> <li>Manage read & write access</li> <li>Create views</li> <li>Add bindings</li></ul>`},m(eo,no){insert$2(eo,ue,no)},p:noop$7,i:noop$7,o:noop$7,d(eo){eo&&detach(ue)}}}class OnboardingData extends SvelteComponent{constructor(ue){super(),init$3(this,ue,null,create_fragment$9l,safe_not_equal,{})}}function create_fragment$9k(to){let ue;return{c(){ue=element("div"),ue.innerHTML=`After setting up your data, Design is where you build the screens for your
|
|
510
510
|
app:
|
|
511
511
|
<ul class="feature-list"><li>Add screens</li> <li>Add components</li> <li>Choose your theme</li> <li>Edit navigation</li></ul>`},m(eo,no){insert$2(eo,ue,no)},p:noop$7,i:noop$7,o:noop$7,d(eo){eo&&detach(ue)}}}class OnboardingDesign extends SvelteComponent{constructor(ue){super(),init$3(this,ue,null,create_fragment$9k,safe_not_equal,{})}}function create_fragment$9j(to){let ue;return{c(){ue=element("div"),ue.innerHTML=`Once you’re happy with your app you can publish it to production!
|