@inploi/plugin-chatbot 3.20.2 → 3.20.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/cdn/index.js CHANGED
@@ -42,4 +42,4 @@ var fm=Object.defineProperty;var pm=(et,ge,Ve)=>ge in et?fm(et,ge,{enumerable:!0
42
42
  `,Ka="isdk",uh={not_in_local_storage:"Application not found in local storage",invalid_end_node:"Unexpected node type to finish flow",no_submissions:"Application ended without any fields submitted",invalid_state:"Invalid state"},dh=()=>({getOrCreateChatbotElement:()=>{const e=document.getElementById(Ka);if(e)return e;const t=document.createElement("div");return document.body.appendChild(t),t.id=Ka,t}});var fh=["1","2","3","4","5","6","7","8","9","10","11","12"],ph={light:{1:[98.8,.015],2:[97.8,.018],3:[95.8,.025],4:[92,.04],5:[89,.05],6:[85,.07],7:[80.5,.08],8:[74,.11],9:[60,.22],10:[56,.23],11:[50,.19],12:[25,.18]},dark:{1:[19,.015],2:[21,.018],3:[25.5,.055],4:[29.3,.084],5:[33.5,.098],6:[39.05,.107],7:[45,.11],8:[55,.13],9:[60,.22],10:[67,.18],11:[79.3,.12],12:[95,.04]}},hh=(e,t=1,r)=>n=>{const[o,i]=ph[r][n];return"oklch("+o+"% "+i*t+" "+e+")"},qn=e=>{const t=hh(e.hue,e.chroma,e.mode);return Object.fromEntries(fh.map(r=>[e.prefix+r,e.transform(t(r))]))},Kn=e=>e,vh=e=>{const t=Object.keys(e).flatMap(r=>{const n=e[r];return typeof n=="object"&&n!==null?Object.keys(n).map(o=>{const i=n[o];return[`${String(r)}.${o}`,i]}):[[r,n]]});return Object.fromEntries(t)},Tr=e=>!!e&&typeof e=="object"&&!Array.isArray(e),Wn=(e,...t)=>{if(!t.length)return e;const r=t.shift();if(Tr(e)&&Tr(r))for(const n in r){const o=r[n];if(Tr(o)){e[n]||Object.assign(e,{[n]:{}});const i=e[n];Tr(i)&&Wn(i,o)}else Object.assign(e,{[n]:r[n]})}return Wn(e,...t)},mh=e=>{function t(r,n){const o=[e.prefix,n.toString().replace(/\./g,"-")].join("");return r==="declaration"?`--${o}`:`var(--${o})`}return t},bh=()=>({core:e=>({semantic:t=>({component:r=>({from:n=>{const{theme:o,getToken:i}=n,a=v=>i("reference",v.toString()),s=e({theme:o}),l=t({theme:o,core:a,raw:{core:s}}),u=r({theme:o,core:a,semantic:a,raw:{core:s,semantic:l}}),p=vh(Wn(s,l,u)),c=([v,g],m)=>{const h=[m,v].filter(Boolean).join(".");return typeof g=="object"?Object.entries(g).flatMap(w=>c(w,h)):[[n.getToken("declaration",h),g]]};return{values:p,declarations:Object.fromEntries(Object.entries(p).flatMap(v=>c(v))),ref:v=>i("reference",v.toString())}}})})})});const[Gn,Yn,Wa]=["oklch(0% 0 0)","oklch(100% 0 0)","transparent"],gh=bh().core(({theme:e})=>({color:{black:Gn,white:Yn,lowest:e.mode==="light"?Yn:Gn,highest:e.mode==="light"?Gn:Yn,...qn({prefix:"a-",hue:e.hue,chroma:e.chroma,mode:e.mode,transform:Kn}),...qn({prefix:"n-",hue:e.hue,chroma:.05,mode:e.mode,transform:Kn}),...qn({prefix:"e-",hue:20,chroma:e.chroma,mode:e.mode,transform:Kn})},typography:{}})).semantic(({core:e,raw:t,theme:r})=>{const n=(o,i)=>t.core.color[o].replace(")",` / ${i})`);return{"font-family":{body:"inherit",headings:"inherit"},"font-style":{body:"normal",headings:"normal"},"font-weight-body":"normal","font-weight-headings":"normal","radius-app":"1.5rem","radius-interactive":"1.5rem",color:{divider:n("n-8",r.mode==="dark"?.4:.2)},"copy-body":e("color.n-12"),"copy-headings":e("color.n-12"),interactive:{copy:e("color.n-11"),"copy-hover":e("color.n-12"),"copy-active":e("color.n-12"),bg:Wa,"bg-hover":n("n-10",.4),"bg-active":n("n-10",.5)}}}).component(({raw:e,theme:t,semantic:r,core:n})=>{const o=(i,a)=>e.core.color[i].replace(")",` / ${a})`);return{app:{bg:n(t.mode==="dark"?"color.n-1":"color.n-2")},overlay:{bg:o("black",.4)},bubble:{"weak-bg":n(t.mode==="dark"?"color.n-3":"color.lowest"),"weak-outline":r("color.divider"),"strong-shadow":o("a-9",.05)},"status-bar":{bg:o("n-2",.8),"bg-button":Wa,"bg-button-hover":o("n-10",.4),"bg-button-active":o("n-10",.5)},"submit-button":{"bg-active":n(t.mode==="dark"?"color.a-8":"color.a-11")}}}),yh=mh({prefix:"i-"}),_h=e=>{const t=gh.from({theme:e,getToken:yh}),r=Object.entries(t.declarations).map(([n,o])=>`${n}: ${o};`);return`#isdk {
43
43
  ${r.concat(r).join(`
44
44
  `)}
45
- }`},Ga=({context:e,schema:t})=>{if(t)for(const r in t){const n=t[r];if(!n)continue;const o=Dt(e,r,null);if(n.required&&o===null)throw new Error(`Configuration error in context: ${r} is required`);switch(n.type){case"number":if(typeof o!="number")throw new Error(`Configuration error in context: ${r} is not a number`);break;case"string":if(typeof o!="string")throw new Error(`Configuration error in context: ${r} is not a string`);break;default:n.type}}},wh=({_internal_domManager:e=dh(),theme:t})=>et(({apiClient:r,logger:n,analytics:o})=>{let i=!1;const a=()=>{if(typeof window>"u")return;const s=[D("style",{id:"inploi-chatbot-styles"},ch),D("style",{id:"inploi-chatbot-theme"},_h(t))],l=e.getOrCreateChatbotElement();ht(D(G,{},[s,D(oh,{apiClient:r,logger:n,analytics:o})]),l),i=!0};return{prepare:async()=>{if(!(typeof window>"u"))try{if(i)return;a(),n.info("Chatbot plugin prepared")}catch(s){n.error("Error preparing chatbot plugin",s)}},fetchFlowByJobId:async s=>r.fetch(`/flow/job/${s}`).then(l=>{const u=Rt(sh,l);return{context:{job_id:u.job.id,flow_id:u.flow.id,flow_version:u.flow.version},flow:u.flow,title:`Applying for “${u.job.title}”`,flowKeys:[u.job.id]}}),fetchFlowById:async s=>r.fetch(`/flow/id/${s}`).then(l=>{const u=Rt(ah,l);return{flow:u.flow,context:{flow_id:u.flow.id,flow_version:u.flow.version},title:"Chatbot",flowKeys:[]}}),open:async s=>{if(!(typeof window>"u"))try{T.cancelCurrentFlow(),T.viewState$.value="maximised",i||a(),s instanceof Promise?(T.current$.value={state:"loading"},s.then(async l=>{const u=Rt(lh,l);Ga({context:u.context,schema:u.flow.context_schema}),T.startFlow(u)}).catch(l=>{const u=l instanceof Error?l.message:"An error occurred";T.current$.value={state:"error",error:u}})):(Ga({context:s.context,schema:s.flow.context_schema}),T.startFlow(s))}catch(l){n.error("Error starting flow",l)}},startApplication:void 0,closeApplication:void 0,close:async()=>{typeof window>"u"||(T.cancelCurrentFlow(),n.info("Closed flow from an external source"))}}});if(!window.inploi)throw new Error("Please insert the SDK script tag above the plugins.");window.inploi.chatbotPlugin=wh;const Zt=(e,{context:t,submissions:r})=>{const[n,...o]=e.data.compareKey.split(".");if(!n)return!1;const i=Za({context:t,key:n,path:o,submissions:r});if(!i)return!1;switch(i.type){case"address":{const a=Dt(i.value,o.join("."));switch(e.data.compare){case"equals":return a===e.data.compareValue;case"contains":return a?a.includes(e.data.compareValue):!1;case"notEquals":return a!==e.data.compareValue;case"notContains":return a?!a.includes(e.data.compareValue):!0}break}case"integration":{if(typeof i.value!="object"||Array.isArray(i.value))return!1;const a=Dt(i.value,o.join(".")),s={...e,data:{...e.data,compareKey:"_temp"}};switch(typeof a){case"boolean":return Zt(s,{submissions:{_temp:{value:a,type:"boolean"}},context:t});case"string":return Zt(s,{submissions:{_temp:{value:a,type:"string"}},context:t});case"number":return Zt(s,{submissions:{_temp:{value:a,type:"number"}},context:t});case"object":return Array.isArray(a)&&a.every(Ba)?Zt(s,{submissions:{_temp:{value:a,type:"enum"}},context:t}):!1}break}case"boolean":{const a=e.data.compareValue==="true";switch(e.data.compare){case"equals":return i.value===a;case"notEquals":return i.value!==a}break}case"string":switch(e.data.compare){case"equals":return i.value===e.data.compareValue;case"contains":return i.value?i.value.includes(e.data.compareValue):!1;case"notEquals":return i.value!==e.data.compareValue;case"notContains":return i.value?!i.value.includes(e.data.compareValue):!0}break;case"number":{try{const a=Number(e.data.compareValue);switch(e.data.compare){case"equals":return i.value===a;case"notEquals":return i.value!==a;case"greaterThan":return i.value>a;case"greaterThanOrEqualTo":return i.value>=a;case"lessThan":return i.value<a;case"lessThanOrEqualTo":return i.value<=a}}catch{return console.error(`Failed to parse number in if-block ${e.id}`,i.value),!1}break}case"enum":switch(e.data.compare){case"equals":return i.value.length===1&&i.value[0]===e.data.compareValue;case"notEquals":return i.value.length===1&&i.value[0]!==e.data.compareValue;case"contains":return i.value.includes(e.data.compareValue);case"notContains":return!i.value.includes(e.data.compareValue)}break}return!1},xh=/{{\s*([^}]+?)\s*(?:\|\s*([^}]+?)\s*)?}}/g,Xe=(e,{context:t,submissions:r})=>e.replace(xh,(n,o,i="")=>{const[a,...s]=o.trim().split("."),l=Za({key:a,path:s,submissions:r,context:t});if(!l)return i;switch(l.type){case"boolean":return l.value===!0?"true":"false";case"file":return l.value.map(u=>`${u.name} (${Kt(u.sizeKb)})`).join(", ");case"enum":return l.value.join(", ");case"address":return Object.values(l.value).filter(u=>u&&u.trim().length>0).join(", ");case"number":case"string":return l.value?l.value.toString():i;case"integration":{if(typeof l.value!="object"||Array.isArray(l.value))break;const u=Dt(l.value,s.join("."));switch(typeof u){case"boolean":return u===!0?"true":"false";case"string":return u;case"number":return u.toString();case"object":if(Array.isArray(u)&&u.every(Ba))return u.join(", ")}break}}return i}),Ya=({node:e,nodes:t,stopWhen:r})=>{if((r==null?void 0:r(e))===!0)return e;const n=e.nextId?t.find(o=>o.id===e.nextId):void 0;if(n)return Ya({node:n,nodes:t,stopWhen:r})},kh=({childNode:e,nodes:t})=>{const n=t.filter(o=>o.type==="if-block").find(o=>{if(!o.branchId)return!1;const i=t.find(s=>s.id===o.branchId);if(!i)return!1;const a=Ya({node:i,nodes:t,stopWhen:s=>s.id===e.id});return!(!a||a.id!==e.id)});if(n!=null&&n.nextId)return t.find(o=>o.id===n.nextId)},$h=({flow:e,analytics:t,logger:r,context:n,apiClient:o,getSubmissions:i,chatService:a,onFlowEnd:s,onInterpret:l})=>{let u=new AbortController;const p=async(c,v)=>{const g=i();l==null||l(c,v);try{await Sh({flow:e,analytics:t,logger:r,apiClient:o,context:n,node:c,submissions:g,chat:{sendMessage:async m=>a.send({groupId:c.id,message:m,signal:u.signal}),userInput:async m=>a.input({input:m,signal:u.signal}),addToSubmissions:a.addToSubmissions},next:m=>{const h=m?e.nodes.find(w=>w.id===m):kh({childNode:c,nodes:e.nodes});return h?p(h,c):s==null?void 0:s(c)},end:()=>s==null?void 0:s(c)})}catch(m){if(m instanceof Wt)return;throw m}};return{interpret:async c=>{const v=e.nodes.find(g=>g.id===c)??Va(e.nodes);return p(v)},undo:c=>{let v=1;const g=e.nodes.find(h=>h.id===c[c.length-1]);for(let h=c.length-2;h>0;h--){const w=c[h],k=e.nodes.find(_=>_.id===w);if(!k||(v++,k.type.startsWith("question-")))break}u.abort(),u=new AbortController;const m=e.nodes.find(h=>h.id===c[c.length-v]);return ke(m,"Undo failed: new start node not found"),p(m,g),{removed:v}},abort:()=>{u.abort()}}};async function Sh(e){return await We(e).with({node:{type:"text"}},Oh).with({node:{type:"image"}},Ih).with({node:{type:"question-text"}},Ah).with({node:{type:"question-enum"}},Dh).with({node:{type:"question-number"}},Th).with({node:{type:"question-boolean"}},Nh).with({node:{type:"question-file"}},Fh).with({node:{type:"question-address"}},Mh).with({node:{type:"end-flow"}},Lh).with({node:{type:"if-block"}},Ph).with({node:{type:"jump"}},({node:t,next:r})=>r(t.data.targetId)).with({node:{type:"link"}},Eh).with({node:{type:"integration-application-submit"}},Ch).with({node:{type:"integration-workflow-get"}},()=>Error("Unreachable")).exhaustive()}async function Ch({chat:e,next:t,node:r,logger:n,apiClient:o,submissions:i,context:a,analytics:s,flow:l}){const u=async p=>{p!==!0&&await e.userInput({type:"submit",key:void 0,config:{label:r.data.submitLabel}}),await e.sendMessage({type:"system",variant:"info",text:"Submitting…"});const{anonymous_id:c,session_id:v}=s.getSessionInfo(),g=await o.fetch("/flow/submit",{method:"POST",body:JSON.stringify({...a,integration_id:r.data.integrationId,anonymous_id:c,session_id:v,submissions:Gp(i||{})})}).catch(m=>m);r.data.key&&e.addToSubmissions(r.data.key,{type:"integration",value:g}),await We(g).with({ats_data:{redirect_url:Oe.string}},async m=>{await e.sendMessage({type:"text",author:"bot",text:"Almost there! Please complete your submission here:"});const h=new URL(m.ats_data.redirect_url);c&&!h.searchParams.has("anonymous_id")&&h.searchParams.set("anonymous_id",c),await e.sendMessage({type:"link",href:h.toString(),text:"Complete submission",onClick:()=>{if(alert("kek"),!v)return n.error("session_id not set, cannot log FLOW_REDIRECT event");s.log({event:"FLOW_REDIRECT",properties:{flow_build:l.build,flow_id:l.id,flow_session_id:v,flow_version:l.version,href:h.toString()},customProperties:a})}}),t(r.nextId)}).with({success:!0},async()=>{await e.sendMessage({type:"system",variant:"success",text:"Submission completed!"}),t(r.nextId)}).with({sucess:!1,ats_data:{message:Oe.string}},async m=>{n.error(m.ats_data),await e.sendMessage({type:"system",variant:"error",text:m.ats_data.message}),await u(!1)}).otherwise(async m=>{n.error(m),await e.sendMessage({type:"system",variant:"error",text:"Failed to submit"}),await u(!1)})};await u(r.data.skipConfirmation)}async function Eh({chat:e,next:t,node:r,submissions:n,context:o,analytics:i,flow:a,logger:s}){const{session_id:l}=i.getSessionInfo();await e.sendMessage({type:"link",href:Xe(r.data.href,{submissions:n,context:o}),text:Xe(r.data.cta,{submissions:n,context:o}),onClick:()=>{if(!l)return s.error("session_id not set, cannot log FLOW_REDIRECT event");i.log({event:"FLOW_REDIRECT",properties:{flow_build:a.build,flow_id:a.id,flow_session_id:l,flow_version:a.version,href:r.data.href},customProperties:o})}}),t(r.nextId)}async function Ph({submissions:e,next:t,node:r,context:n}){t(Zt(r,{submissions:e,context:n})?r.branchId:r.nextId)}async function Oh({chat:e,next:t,node:r,submissions:n,context:o}){await e.sendMessage({author:"bot",type:"text",text:Xe(r.data.text,{submissions:n,context:o})}),t(r.nextId)}async function Ih({chat:e,next:t,node:r}){await e.sendMessage({author:"bot",type:"image",url:r.data.url,height:r.data.height,width:r.data.width}),t(r.nextId)}async function Ah({chat:e,next:t,node:r,submissions:n,context:o}){await e.sendMessage({author:"bot",type:"text",text:Xe(r.data.question,{submissions:n,context:o})});const i=await e.userInput({key:r.data.key,type:"text",config:{optional:r.data.optional,placeholder:r.data.placeholder,format:r.data.format,maxChars:r.data.maxChars}});i===null?await e.sendMessage({type:"system",variant:"info",text:"Skipped"}):await e.sendMessage({author:"user",type:"text",text:i.value}),t(r.nextId)}async function Th({chat:e,next:t,node:r,submissions:n,context:o}){await e.sendMessage({author:"bot",type:"text",text:Xe(r.data.question,{submissions:n,context:o})});const i=await e.userInput({key:r.data.key,type:"number",config:{max:r.data.max,min:r.data.min,optional:r.data.optional,placeholder:r.data.placeholder,decimalCases:r.data.decimalCases}});i===null?await e.sendMessage({type:"system",variant:"info",text:"Skipped"}):await e.sendMessage({author:"user",type:"text",text:i.value.toString()}),t(r.nextId)}async function Dh({chat:e,next:t,node:r,submissions:n,context:o}){await e.sendMessage({author:"bot",type:"text",text:Xe(r.data.question,{submissions:n,context:o})});const i=await e.userInput({key:r.data.key,type:"multiple-choice",config:r.data});i.value.length===0?await e.sendMessage({type:"system",variant:"info",text:"Skipped"}):await e.sendMessage({author:"user",type:"text",text:r.data.options.filter(a=>i.value.includes(a.value)).map(a=>a.label).join(", ")}),t(r.nextId)}async function Nh({chat:e,next:t,node:r,submissions:n,context:o}){await e.sendMessage({author:"bot",type:"text",text:Xe(r.data.question,{submissions:n,context:o})});const i=await e.userInput({key:r.data.key,type:"boolean",config:{optional:r.data.optional,labels:{true:r.data.trueLabel,false:r.data.falseLabel}}});i===null?await e.sendMessage({type:"system",variant:"info",text:"Skipped"}):await e.sendMessage({author:"user",type:"text",text:i.value===!0?r.data.trueLabel:r.data.falseLabel}),t(r.nextId)}async function Mh({chat:e,next:t,node:r}){await e.sendMessage({author:"bot",type:"text",text:r.data.question});const n=await e.userInput({type:"address",key:r.data.key,config:{optional:r.data.optional,keys:r.data.keys,placeholder:r.data.placeholder}});if(n===null)await e.sendMessage({type:"system",variant:"info",text:"Skipped"});else{const o=Object.values(n.value).filter(i=>i&&i.trim().length>0).join(", ");await e.sendMessage({author:"user",type:"text",text:o})}return t(r.nextId)}async function Fh({node:e,chat:t,next:r,submissions:n,context:o}){await t.sendMessage({author:"bot",type:"text",text:Xe(e.data.question,{submissions:n,context:o})});const i=await t.userInput({key:e.data.key,type:"file",config:{optional:e.data.optional,extensions:e.data.extensions,fileSizeLimitKib:e.data.maxSizeKb??10*1024,allowMultiple:e.data.multiple===!0}});if(i===null)await t.sendMessage({type:"system",variant:"info",text:"Skipped"});else for(const a of i.value)await t.sendMessage({author:"user",type:"file",fileName:a.name,fileSizeKb:a.sizeKb});r(e.nextId)}async function Lh({chat:e,end:t,node:r}){await e.sendMessage({type:"system",variant:"info",text:r.data.systemMessage}),t()}const Za=({key:e,path:t,submissions:r,context:n})=>{if(e==="$context"){if(!t)return;const o=Dt(n,t.join("."));switch(typeof o){case"string":return{type:"string",value:o};case"number":return{type:"number",value:o};case"boolean":return{type:"boolean",value:o};default:console.warn(`Unexpected type for $context.${t.join(".")}`,o);return}}return r==null?void 0:r[e]};function Zn(e,t,r){var n,o,i,a,s;t==null&&(t=100);function l(){var p=Date.now()-a;p<t&&p>=0?n=setTimeout(l,t-p):(n=null,r||(s=e.apply(i,o),i=o=null))}var u=function(){i=this,o=arguments,a=Date.now();var p=r&&!n;return n||(n=setTimeout(l,t)),p&&(s=e.apply(i,o),i=o=null),s};return u.clear=function(){n&&(clearTimeout(n),n=null)},u.flush=function(){n&&(s=e.apply(i,o),i=o=null,clearTimeout(n),n=null)},u}Zn.debounce=Zn;var Rh=Zn;const Xa=Ve(Rh);function Vh(e){let{debounce:t,scroll:r,polyfill:n,offsetSize:o}=e===void 0?{debounce:0,scroll:!1,offsetSize:!1}:e;const i=n||(typeof window>"u"?class{}:window.ResizeObserver);if(!i)throw new Error("This browser does not support ResizeObserver out of the box. See: https://github.com/react-spring/react-use-measure/#resize-observer-polyfills");const[a,s]=W({left:0,top:0,width:0,height:0,bottom:0,right:0,x:0,y:0}),l=L({element:null,scrollContainers:null,resizeObserver:null,lastBounds:a}),u=t?typeof t=="number"?t:t.scroll:null,p=t?typeof t=="number"?t:t.resize:null,c=L(!1);V(()=>(c.current=!0,()=>void(c.current=!1)));const[v,g,m]=le(()=>{const _=()=>{if(!l.current.element)return;const{left:O,top:A,width:P,height:U,bottom:q,right:N,x:M,y:oe}=l.current.element.getBoundingClientRect(),te={left:O,top:A,width:P,height:U,bottom:q,right:N,x:M,y:oe};l.current.element instanceof HTMLElement&&o&&(te.height=l.current.element.offsetHeight,te.width=l.current.element.offsetWidth),Object.freeze(te),c.current&&!Uh(l.current.lastBounds,te)&&s(l.current.lastBounds=te)};return[_,p?Xa(_,p):_,u?Xa(_,u):_]},[s,o,u,p]);function h(){l.current.scrollContainers&&(l.current.scrollContainers.forEach(_=>_.removeEventListener("scroll",m,!0)),l.current.scrollContainers=null),l.current.resizeObserver&&(l.current.resizeObserver.disconnect(),l.current.resizeObserver=null)}function w(){l.current.element&&(l.current.resizeObserver=new i(m),l.current.resizeObserver.observe(l.current.element),r&&l.current.scrollContainers&&l.current.scrollContainers.forEach(_=>_.addEventListener("scroll",m,{capture:!0,passive:!0})))}const k=_=>{!_||_===l.current.element||(h(),l.current.element=_,l.current.scrollContainers=Qa(_),w())};return Bh(m,!!r),jh(g),V(()=>{h(),w()},[r,m,g]),V(()=>h,[]),[k,a,v]}function jh(e){V(()=>{const t=e;return window.addEventListener("resize",t),()=>void window.removeEventListener("resize",t)},[e])}function Bh(e,t){V(()=>{if(t){const r=e;return window.addEventListener("scroll",r,{capture:!0,passive:!0}),()=>void window.removeEventListener("scroll",r,!0)}},[e,t])}function Qa(e){const t=[];if(!e||e===document.body)return t;const{overflow:r,overflowX:n,overflowY:o}=window.getComputedStyle(e);return[r,n,o].some(i=>i==="auto"||i==="scroll")&&t.push(e),[...t,...Qa(e.parentElement)]}const zh=["x","y","top","bottom","left","right","width","height"],Uh=(e,t)=>zh.every(r=>e[r]===t[r]),Ct=({class:e,...t})=>d("button",{class:He("bg-accent-9 active:bg-accent-10 pointer-coarse:touch-hitbox fr flex-shrink-0 rounded-full p-2 text-white transition-all disabled:cursor-not-allowed disabled:opacity-50",e),type:"submit",...t,children:d("svg",{class:"block",width:"16",height:"16",viewBox:"0 0 16 16",fill:"transparent",stroke:"currentColor","stroke-linecap":"round","stroke-width":"2",children:[d("title",{children:"Send"}),d("path",{d:"M3.5 7.5L8 3L12.5 7.5"}),d("path",{d:"M8 4V13"})]})}),Hh=25,Xn=Ge({instant:()=>{},smooth:()=>{}}),Z={onSubmitSuccessFn$:Ge(()=>{}),isBotTyping$:Ge(!1),scrollToEnd:{instant:()=>Xn.value.instant(),smooth:()=>Xn.value.smooth()}},qh=()=>{const e=L(null);ve(()=>{Xn.value={instant:()=>{var r;return(r=e.current)==null?void 0:r.scrollTo({top:e.current.scrollHeight,behavior:"instant"})},smooth:()=>{e.current&&e.current.scrollHeight-e.current.scrollTop<=e.current.clientHeight*1.5&&e.current.scrollTo({top:e.current.scrollHeight,behavior:"smooth"})}}},[e]);const t=le(()=>({addToSubmissions:(n,o)=>T.setSubmission(n,o),send:async({message:n,signal:o,groupId:i})=>{if(await We(n).with({author:"bot",type:"text"},async a=>{if(o!=null&&o.aborted)throw new Wt;Z.isBotTyping$.value=!0;const s=Math.min(Math.max(20,a.text.length),100)*Hh;await new Promise(l=>setTimeout(l,s,{signal:o})),Z.isBotTyping$.value=!1}).otherwise(async()=>{}),o!=null&&o.aborted)throw new Wt;T.addMessage(n,i)},input:({input:n,signal:o})=>{if(o!=null&&o.aborted)throw new Wt;return T.setInput(n),new Promise(i=>{const a=s=>{if(o!=null&&o.aborted)throw new Wt;T.setInput(void 0),n.key&&T.setSubmission(n.key,s),i(s)};Z.onSubmitSuccessFn$.value=a})}}),[]);return{chatRef:e,chatService:t}},Et=({class:e,...t})=>d("button",{type:"button",class:He("fr text-neutral-9 flex flex-shrink-0 items-center justify-center gap-1 rounded-full py-[6px] pl-2 pr-3 text-sm underline-offset-2 transition-all",e),...t,children:[d("svg",{class:"block",width:"16",height:"16",viewBox:"0 0 16 16",fill:"transparent",stroke:"currentColor","stroke-linecap":"round","stroke-width":"1.5",children:[d("title",{children:"Skip"}),d("path",{d:"M3.25 11.25A5 5 0 0 1 12 7"}),d("path",{d:"M13.25 4.5V8.25H9.5"})]}),"Skip"]}),Ja=["Afghanistan","Albania","Algeria","American Samoa","Andorra","Angola","Anguilla","Antarctica","Antigua and Barbuda","Argentina","Armenia","Aruba","Australia","Austria","Azerbaijan","Bahrain","Bangladesh","Barbados","Belarus","Belgium","Belize","Benin","Bermuda","Bhutan","Bolivia","Bosnia and Herzegovina","Botswana","Bouvet Island","Brazil","British Indian Ocean Territory","British Virgin Islands","Brunei","Bulgaria","Burkina Faso","Burundi","Cabo Verde","Cambodia","Cameroon","Canada","Caribbean Netherlands","Cayman Islands","Central African Republic","Chad","Chile","China","Christmas Island","Cocos (Keeling) Islands","Colombia","Comoros","Cook Islands","Costa Rica","Croatia","Cuba","Curaçao","Cyprus","Czechia","Côte d'Ivoire","Democratic Republic of the Congo","Denmark","Djibouti","Dominican Republic","Ecuador","Egypt","El Salvador","Equatorial Guinea","Eritrea","Estonia","Eswatini","Ethiopia","Falkland Islands (Islas Malvinas)","Faroe Islands","Fiji","Finland","France","French Guiana","French Polynesia","French Southern and Antarctic Lands","Gabon","Georgia","Germany","Ghana","Gibraltar","Greece","Greenland","Grenada","Guadeloupe","Guam","Guatemala","Guernsey","Guinea","Guinea-Bissau","Guyana","Haiti","Heard Island and McDonald Islands","Honduras","Hong Kong","Hungary","Iceland","India","Indonesia","Iran","Iraq","Ireland","Isle of Man","Israel","Italy","Jamaica","Japan","Jersey","Jordan","Kazakhstan","Kenya","Kiribati","Kosovo","Kuwait","Kyrgyzstan","Laos","Latvia","Lebanon","Lesotho","Liberia","Libya","Liechtenstein","Lithuania","Luxembourg","Macao","Madagascar","Malawi","Malaysia","Maldives","Mali","Malta","Marshall Islands","Martinique","Mauritania","Mauritius","Mayotte","Mexico","Micronesia","Moldova","Monaco","Mongolia","Montenegro","Montserrat","Morocco","Mozambique","Myanmar (Burma)","Namibia","Nauru","Nepal","Netherlands","New Caledonia","New Zealand","Nicaragua","Niger","Nigeria","Niue","Norfolk Island","North Korea","North Macedonia","Northern Mariana Islands","Norway","Oman","Pakistan","Palau","Palestine","Panama","Papua New Guinea","Paraguay","Peru","Philippines","Pitcairn Islands","Poland","Portugal","Puerto Rico","Qatar","Romania","Russia","Rwanda","Réunion","Saint Barthélemy","Saint Helena, Ascension and Tristan da Cunha","Saint Kitts and Nevis","Saint Lucia","Saint Martin","Saint Pierre and Miquelon","Saint Vincent and the Grenadines","Samoa","San Marino","Saudi Arabia","Senegal","Serbia","Seychelles","Sierra Leone","Singapore","Sint Maarten","Slovakia","Slovenia","Solomon Islands","Somalia","South Africa","South Georgia and the South Sandwich Islands","South Korea","South Sudan","Spain","Sri Lanka","Sudan","Suriname","Svalbard and Jan Mayen","Sweden","Switzerland","Syria","São Tomé and Príncipe","Taiwan","Tajikistan","Tanzania","Thailand","The Bahamas","The Gambia","Timor-Leste","Togo","Tokelau","Tonga","Trinidad and Tobago","Tunisia","Turkmenistan","Turks and Caicos Islands","Tuvalu","Türkiye","U.S. Virgin Islands","Uganda","Ukraine","United Arab Emirates","United Kingdom","United States","United States Minor Outlying Islands","Uruguay","Uzbekistan","Vanuatu","Vatican City","Venezuela","Vietnam","Wallis and Futuna","Western Sahara","Yemen","Zambia","Zimbabwe","Åland Islands"],es={line1:["street_number","floor","room","premise"],line2:["subpremise","street_address","route"],line3:["sublocality","neighborhood"],city:["locality","postal_town"],state:["administrative_area_level_1"],postcode:["postal_code"],country:["country"]},Dr=Object.keys(es),Kh=e=>Dr.reduce((t,r)=>{const n=es[r],o=e.filter(i=>i.types.some(a=>n.includes(a))).map(i=>i.long_name).join(", ");return o&&(t[r]=o),t},{}),Wh=document.createElement("div"),Gh=()=>le(()=>{const{google:e}=window;if(!("google"in window)||!("maps"in e)||!("places"in e.maps))return{enabled:!1};const t=new e.maps.places.AutocompleteService,r=new e.maps.places.PlacesService(Wh);return{enabled:!0,getPredictions:async n=>{const{predictions:o}=await t.getPlacePredictions({input:n,language:"en"});return o.map(i=>({label:i.description,value:i.place_id}))},getPlaceDetails:async n=>await new Promise((i,a)=>r.getDetails({placeId:n,fields:["address_components"],language:"en"},(s,l)=>l!==e.maps.places.PlacesServiceStatus.OK?a(l):s===null?a("ZERO_RESULTS"):i({ok:!0,place:s}))).catch(async i=>(console.error("Failed to get address details",i),{ok:!1}))}},[]),Qn=e=>d("button",{type:"button",class:"text-neutral-10 hover:bg-neutral-4 hover:text-neutral-12 hover:border-neutral-5 flex items-center gap-1 rounded-[18px] border border-solid border-transparent px-3 py-1 pl-1.5 text-sm transition-colors",...e,children:[d("svg",{width:"16",height:"16",viewBox:"0 0 16 16",stroke:"currentColor","stroke-width":"1.5",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:d("path",{d:"M10 3L5 8L10 13"})}),d("span",{children:"Back"})]}),Jn={label:"Fill in manually",value:""},Yh=({input:e,onSubmitSuccess:t})=>{const[r,n]=W(""),[o,i]=W(),[a,s]=W([]),[l,u]=W(),{enabled:p,getPredictions:c,getPlaceDetails:v}=Gh(),[g,m]=W(p?"query":"manual"),h=le(()=>ja(w=>{ke(p,"Query state should not be enabled if Google Places isn't available"),n(w),w===""&&s([]),!(w.length<3)&&c(w).then(k=>{s(k)})},500),[p,c]);switch(V(()=>{if(p&&!(l===void 0||l===""))return v(l).then(w=>{if(!w.ok||!w.place.address_components){i({});return}const k=Kh(w.place.address_components);i(k),m("details")}),()=>{i(void 0)}},[l,v,p]),g){case"query":return ke(p,"Query state should not be enabled if Google Places isn't available"),d(Zh,{input:e,onSkip:()=>t(null),onAddressSelect:w=>{u(w),m("loading")},onInputChange:h,suggestions:a,query:r});case"loading":return d(ei,{input:e,onSubmitSuccess:t,addressFields:{},actions:d(Qn,{onClick:()=>{u(void 0),m("query")}})});case"details":return ke(o!==void 0),d(ei,{input:e,onSubmitSuccess:t,addressFields:o,actions:d(Qn,{onClick:()=>{u(void 0),m("query")}})});case"manual":return d(ei,{input:e,onSubmitSuccess:t,addressFields:{},actions:p?d(Qn,{onClick:()=>{u(void 0),m("query")}}):void 0})}},Zh=({input:e,onSkip:t,suggestions:r,onAddressSelect:n,query:o,onInputChange:i})=>{const a=L(null);return ve(()=>{a.current&&(a.current.focus(),a.current.select())},[]),d(G,{children:[d("form",{noValidate:!0,onSubmit:s=>{s.preventDefault()},class:"flex flex-col justify-end gap-1 p-2.5",children:[d("input",{onChange:s=>{i(s.currentTarget.value)},ref:a,name:"address",id:"chat-address",autocomplete:"address-line1 country-name postal-code",autoFocus:!0,class:"outline-divider ease-expo-out placeholder:text-neutral-10 text-neutral-12 focus-visible:outline-accent-7 caret-accent-9 bg-lowest w-full rounded-full px-3 py-1 text-base outline outline-2 transition-all",placeholder:e.config.placeholder||"Search an address",defaultValue:o}),e.config.optional&&d(Et,{class:"absolute right-3",onClick:t})]}),d("ul",{children:[r.map(s=>d("li",{children:d("button",{class:"text-neutral-11 fr hover:bg-neutral-3 focus-visible:bg-neutral-3 hover:text-neutral-12 border-b-neutral-3 flex w-full items-center border border-b border-solid border-transparent px-4 py-3 text-sm transition-colors duration-100",onClick:()=>{n(s.value)},children:[d("span",{class:"flex-grow",children:s.label}),d("svg",{class:"flex-none",width:"16",height:"16",viewBox:"0 0 16 16",stroke:"currentColor","stroke-width":"1.5",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:d("path",{d:"M6 3L11 8L6 13"})})]})},s.label)),d("li",{children:d("button",{class:"text-neutral-11 fr hover:bg-neutral-3 focus-visible:bg-neutral-3 hover:text-neutral-12 border-b-neutral-3 flex w-full items-center border border-b border-solid border-transparent px-4 py-3 text-sm transition-colors duration-100",onClick:()=>{n(Jn.value)},children:d("span",{class:"flex-grow",children:Jn.label})})},Jn.label)]})]})},Xh={line1:"Line 1",line2:"Line 2",line3:"Line 3",city:"City",state:"State",postcode:"Postcode",country:"Country"},ei=({addressFields:e,onSubmitSuccess:t,actions:r,input:n})=>{const o=L(null);return ve(()=>{if(o.current){const i=o.current.querySelector("input");i&&(i.focus(),i.select())}},[]),d("form",{class:"bg-neutral-1/90 flex flex-col justify-end gap-2 p-2",onSubmit:i=>{const a=new FormData(i.currentTarget),s=Object.fromEntries(a.entries());t({type:"address",value:s})},children:[d("div",{class:"bg-neutral-3 border-neutral-5 grid items-center gap-1.5 rounded-2xl border pb-2 pl-4 pr-3 pt-3 [grid-template-columns:min-content_1fr]",ref:o,children:Dr.map((i,a)=>{const s=`isdk_${i}`,l=n.config.keys[i];return l?d(G,{children:[d("label",{for:s,class:"text-neutral-9 [&:has(+*>input:focus)]:text-neutral-11 w-24 pb-2 text-xs uppercase leading-3 tracking-widest transition-colors",children:Xh[i]}),d("div",{class:"flex flex-col items-stretch gap-1.5",children:[i==="country"?d("div",{class:"relative",children:[d("select",{class:"text-neutral-12 hover:bg-neutral-4 placeholder:text-neutral-8 focus:bg-neutral-5 w-full flex-1 appearance-none rounded-lg border-solid bg-transparent bg-none px-3 py-1.5 text-base transition-colors focus:outline-none",name:l,id:s,defaultValue:e[i],required:!0,children:[e.country&&!Ja.includes(e.country)?d("option",{value:e[i],children:e[i]}):d("option",{value:"",children:"Select a country"}),Ja.map(u=>d("option",{value:u,children:u},u))]}),d("svg",{class:"text-neutral-12 absolute bottom-2.5 right-2 flex items-center justify-center",width:"16",height:"16",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:d("path",{d:"M4 6.5L8 10.5L12 6.5"})})]}):d("input",{autoFocus:a===0?!0:void 0,class:"text-neutral-12 hover:bg-neutral-4 placeholder:text-neutral-8 focus:bg-neutral-5 flex-1 rounded-lg border-solid bg-transparent px-3 py-1.5 text-base transition-colors autofill:shadow-[inset_0_0_0_1000px_hsl(210_16.7%_97.6%)] focus:outline-none",name:l,id:s,defaultValue:e[i],required:!0}),a!==Dr.length-1&&d("hr",{class:"border-b-neutral-5 m-0 w-full border-b border-solid"}),a===Dr.length-1&&d("hr",{class:"m-0 w-full border-b border-b-transparent"})]})]}):null})}),d("div",{class:"flex w-full flex-1 ",children:[d("div",{class:"flex-grow",children:r}),d(Ct,{class:"flex items-center justify-center"})]})]})},ti=()=>{const e=L(null);return V(()=>{var t;(t=e.current)==null||t.focus()},[]),e},ts=["true","false"],Qh=_d(ts),Jh="answer",ev=({input:e,onSubmitSuccess:t})=>{const r=ti();return d("form",{noValidate:!0,class:"",onSubmit:n=>{n.preventDefault();const o=We(n).with({nativeEvent:{submitter:Oe.select(Oe.union(Oe.instanceOf(HTMLButtonElement),Oe.instanceOf(HTMLInputElement)))}},a=>a.value).otherwise(()=>{throw new Error("invalid form")}),i=Rt(Qh,o);t({type:"boolean",value:i==="true"})},children:[d("div",{class:"flex items-center gap-2 p-2.5",children:ts.map((n,o)=>d("button",{ref:o===0?r:null,type:"submit",name:Jh,value:n,class:"bg-lowest ease-expo-out ring-divider text-neutral-12 active:ring-accent-7 active:bg-accent-2 active:text-accent-11 fr block flex-1 overflow-hidden rounded-2xl px-2.5 py-2.5 ring-2 transition-all selection:bg-transparent",children:d("p",{class:"truncate text-center text-base",children:e.config.labels[n]})}))}),e.config.optional&&d("div",{class:"px-2 pb-2",children:d(Et,{class:"w-full",type:"button",onClick:()=>t(null)})})]})},Nr=({error:e})=>e?d("div",{role:"alert",class:"text-error-11 flex max-w-full items-center gap-1 overflow-hidden rounded-full px-2 py-2",children:[d("svg",{class:"text-error-9 h-4 w-4",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[d("circle",{cx:"8",cy:"8",r:"6.3",stroke:"currentColor","stroke-width":"1.4"}),d("rect",{x:"7",y:"4",width:"2",height:"5",fill:"currentColor"}),d("rect",{x:"7",y:"10",width:"2",height:"2",fill:"currentColor"})]}),d("p",{class:"truncate pr-1 text-sm",children:e.message})]}):null,tv=e=>new Promise((t,r)=>{const n=new FileReader;n.readAsDataURL(e),n.onload=()=>n.result?t(n.result.toString()):r("No result from reader"),n.onerror=r}),rv=e=>e.reduce((t,r)=>t+r.sizeKb,0),nv=Or("file"),rs=3,iv=({file:e,class:t,...r})=>{const n=e.name.split(".").pop(),o=e.name.replace(new RegExp(`.${n}$`),"");return d("div",{class:He("bg-accent-1 outline-accent-4 flex max-w-full gap-2 overflow-hidden rounded-lg px-3 py-2 text-sm outline",t),...r,children:[d("p",{"aria-label":"File name",class:"text-accent-12 flex flex-grow overflow-hidden",children:[d("span",{class:"block truncate",children:o}),d("span",{children:[".",n]})]}),d("p",{"aria-label":"File size",class:"text-accent-11",children:Kt(e.sizeKb)})]})},ns=({class:e,...t})=>d("li",{class:He("outline-neutral-6 text-neutral-11 bg-neutral-1 block rounded-md px-1 py-0.5 text-xs outline outline-1",e),...t}),is=e=>{const t=e.split(".").pop();if(!t)throw new Error("No file extension found");return t?"."+t:""},ov=({allowedExtensions:e,files:t})=>{const r=e.map(n=>n.toLowerCase());return t.every(n=>r.includes(is(n.name).toLowerCase()))},av=(e,t)=>{const r=is(e);return`${e.replace(new RegExp(`${r}$`),"").slice(0,t)}${r}`},sv=({input:e,onSubmitSuccess:t})=>{var p;const r=(p=T.current$.value.flow)==null?void 0:p.data.submissions[e.key],[n,o]=W(nv(r)?r.value:[]),[i,a]=W(),s=n.length-rs,l=rv(n),u=ti();return d("form",{class:"flex flex-col gap-1 p-2.5",onSubmit:c=>(c.preventDefault(),a(void 0),n.length===0?a({type:"required",message:"Please select a file"}):e.config.extensions.length>0&&!ov({allowedExtensions:e.config.extensions,files:n})?a({type:"validate",message:`Please upload ${e.config.extensions.join(", ")} files only`}):e.config.fileSizeLimitKib&&l>e.config.fileSizeLimitKib?a({type:"max",message:`File size exceeds limit of ${Kt(e.config.fileSizeLimitKib)}`}):e.config.allowMultiple===!1&&n.length>1?a({type:"invalid",message:"Only one file is allowed"}):t({type:"file",value:n})),children:[d("div",{class:"flex items-center gap-2",children:[d("label",{ref:u,for:"dropzone-file",class:"border-neutral-8 bg-neutral-2 flex h-48 w-full cursor-pointer flex-col items-center justify-center overflow-hidden rounded-2xl border border-dashed p-4",children:[n.length>0?d(G,{children:[d("ul",{class:"flex max-w-full flex-wrap justify-center gap-1 overflow-hidden p-1",children:[n.slice(0,rs).map(c=>{const v=c.name.split(".").pop(),g=c.name.replace(new RegExp(`.${v}$`),"");return d(ns,{class:"flex overflow-hidden",children:[d("span",{class:"block truncate",children:g}),d("span",{children:[".",v]})]})}),s>0?d(ns,{children:["+",s," file",s!==1?"s":""]}):null]}),d("p",{class:"text-neutral-11 text-xs",children:[Kt(l)," ",n.length>1?"total":""]})]}):d("div",{class:"flex flex-col justify-center gap-4 pb-6 pt-5",children:[d("header",{class:"flex flex-col items-center gap-0",children:[d("svg",{class:"text-neutral-11 mb-1 h-8 w-8","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 20 16",children:d("path",{stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"1.5",d:"M13 13h3a3 3 0 0 0 0-6h-.025A5.56 5.56 0 0 0 16 6.5 5.5 5.5 0 0 0 5.207 5.021C5.137 5.017 5.071 5 5 5a4 4 0 0 0 0 8h2.167M10 15V6m0 0L8 8m2-2 2 2"})}),d("p",{class:"text-neutral-12 tracking-[-0.01em]",children:[e.config.allowMultiple?"Select files":"Select a file"," to upload"]}),e.config.fileSizeLimitKib?d("p",{class:"text-neutral-10 text-xs",children:["(max ",Kt(e.config.fileSizeLimitKib),")"]}):null]}),d("aside",{class:"flex flex-col items-center gap-2",children:[d("p",{id:"accepted-filetypes",class:"sr-only",children:"Accepted file extensions"}),d("ul",{"aria-describedby":"accepted-filetypes",class:"flex flex-wrap justify-center gap-2",children:e.config.extensions.map(c=>d("li",{class:"ring-lowest outline-neutral-6 text-neutral-9 bg-neutral-1 rounded-md px-1 py-0.5 text-[11px] uppercase tracking-wide outline outline-1 ring-2",children:c.replace(".","")}))})]})]}),d("input",{id:"dropzone-file",onInput:async c=>{ke(c.target instanceof HTMLInputElement);const v=c.target.files?Array.from(c.target.files):[],g=await Promise.allSettled(v.map(async h=>{const w=await tv(h);return{name:av(h.name,42),data:w,sizeKb:h.size/1e3}}));if(g.some(({status:h})=>h==="rejected"))return a({type:"invalid",message:"Invalid file"});const m=g.map(h=>h.status==="fulfilled"?h.value:null).filter(Boolean);o(m)},multiple:e.config.allowMultiple,type:"file",class:"sr-only"})]}),d("div",{class:"flex h-full flex-col items-center gap-2",children:[d(Ct,{disabled:n.length===0}),e.config.optional&&d(Et,{onClick:()=>t(null)})]})]}),d(Nr,{error:i})]})};var Xt=e=>e.type==="checkbox",Pt=e=>e instanceof Date,ue=e=>e==null;const os=e=>typeof e=="object";var ee=e=>!ue(e)&&!Array.isArray(e)&&os(e)&&!Pt(e),lv=e=>ee(e)&&e.target?Xt(e.target)?e.target.checked:e.target.value:e,cv=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,uv=(e,t)=>e.has(cv(t)),dv=e=>{const t=e.constructor&&e.constructor.prototype;return ee(t)&&t.hasOwnProperty("isPrototypeOf")},ri=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function Le(e){let t;const r=Array.isArray(e);if(e instanceof Date)t=new Date(e);else if(e instanceof Set)t=new Set(e);else if(!(ri&&(e instanceof Blob||e instanceof FileList))&&(r||ee(e)))if(t=r?[]:{},!r&&!dv(e))t=e;else for(const n in e)e.hasOwnProperty(n)&&(t[n]=Le(e[n]));else return e;return t}var Qt=e=>Array.isArray(e)?e.filter(Boolean):[],X=e=>e===void 0,C=(e,t,r)=>{if(!t||!ee(e))return r;const n=Qt(t.split(/[,[\].]+?/)).reduce((o,i)=>ue(o)?o:o[i],e);return X(n)||n===e?X(e[t])?r:e[t]:n},Qe=e=>typeof e=="boolean";const as={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change"},$e={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},Re={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"};xe.createContext(null);var fv=(e,t,r,n=!0)=>{const o={defaultValues:t._defaultValues};for(const i in e)Object.defineProperty(o,i,{get:()=>{const a=i;return t._proxyFormState[a]!==$e.all&&(t._proxyFormState[a]=!n||$e.all),r&&(r[a]=!0),e[a]}});return o},_e=e=>ee(e)&&!Object.keys(e).length,pv=(e,t,r,n)=>{r(e);const{name:o,...i}=e;return _e(i)||Object.keys(i).length>=Object.keys(t).length||Object.keys(i).find(a=>t[a]===(!n||$e.all))},ni=e=>Array.isArray(e)?e:[e];function hv(e){const t=xe.useRef(e);t.current=e,xe.useEffect(()=>{const r=!e.disabled&&t.current.subject&&t.current.subject.subscribe({next:t.current.next});return()=>{r&&r.unsubscribe()}},[e.disabled])}var Ie=e=>typeof e=="string",vv=(e,t,r,n,o)=>Ie(e)?(n&&t.watch.add(e),C(r,e,o)):Array.isArray(e)?e.map(i=>(n&&t.watch.add(i),C(r,i))):(n&&(t.watchAll=!0),r),ii=e=>/^\w*$/.test(e),ss=e=>Qt(e.replace(/["|']|\]/g,"").split(/\.|\[/));function z(e,t,r){let n=-1;const o=ii(t)?[t]:ss(t),i=o.length,a=i-1;for(;++n<i;){const s=o[n];let l=r;if(n!==a){const u=e[s];l=ee(u)||Array.isArray(u)?u:isNaN(+o[n+1])?{}:[]}e[s]=l,e=e[s]}return e}var ls=(e,t,r,n,o)=>t?{...r[e],types:{...r[e]&&r[e].types?r[e].types:{},[n]:o||!0}}:{},cs=e=>({isOnSubmit:!e||e===$e.onSubmit,isOnBlur:e===$e.onBlur,isOnChange:e===$e.onChange,isOnAll:e===$e.all,isOnTouch:e===$e.onTouched}),us=(e,t,r)=>!r&&(t.watchAll||t.watch.has(e)||[...t.watch].some(n=>e.startsWith(n)&&/^\.\w+/.test(e.slice(n.length))));const Mr=(e,t,r,n)=>{for(const o of r||Object.keys(e)){const i=C(e,o);if(i){const{_f:a,...s}=i;if(a){if(a.refs&&a.refs[0]&&t(a.refs[0],o)&&!n)break;if(a.ref&&t(a.ref,a.name)&&!n)break}else ee(s)&&Mr(s,t)}}};var mv=(e,t,r)=>{const n=Qt(C(e,r));return z(n,"root",t[r]),z(e,r,n),e},oi=e=>e.type==="file",Je=e=>typeof e=="function",Fr=e=>{if(!ri)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},Lr=e=>Ie(e),ai=e=>e.type==="radio",Rr=e=>e instanceof RegExp;const ds={value:!1,isValid:!1},fs={value:!0,isValid:!0};var ps=e=>{if(Array.isArray(e)){if(e.length>1){const t=e.filter(r=>r&&r.checked&&!r.disabled).map(r=>r.value);return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!X(e[0].attributes.value)?X(e[0].value)||e[0].value===""?fs:{value:e[0].value,isValid:!0}:fs:ds}return ds};const hs={isValid:!1,value:null};var vs=e=>Array.isArray(e)?e.reduce((t,r)=>r&&r.checked&&!r.disabled?{isValid:!0,value:r.value}:t,hs):hs;function ms(e,t,r="validate"){if(Lr(e)||Array.isArray(e)&&e.every(Lr)||Qe(e)&&!e)return{type:r,message:Lr(e)?e:"",ref:t}}var Ot=e=>ee(e)&&!Rr(e)?e:{value:e,message:""},bs=async(e,t,r,n,o)=>{const{ref:i,refs:a,required:s,maxLength:l,minLength:u,min:p,max:c,pattern:v,validate:g,name:m,valueAsNumber:h,mount:w,disabled:k}=e._f,_=C(t,m);if(!w||k)return{};const O=a?a[0]:i,A=j=>{n&&O.reportValidity&&(O.setCustomValidity(Qe(j)?"":j||""),O.reportValidity())},P={},U=ai(i),q=Xt(i),N=U||q,M=(h||oi(i))&&X(i.value)&&X(_)||Fr(i)&&i.value===""||_===""||Array.isArray(_)&&!_.length,oe=ls.bind(null,m,r,P),te=(j,F,Q,pe=Re.maxLength,we=Re.minLength)=>{const Ae=j?F:Q;P[m]={type:j?pe:we,message:Ae,ref:i,...oe(j?pe:we,Ae)}};if(o?!Array.isArray(_)||!_.length:s&&(!N&&(M||ue(_))||Qe(_)&&!_||q&&!ps(a).isValid||U&&!vs(a).isValid)){const{value:j,message:F}=Lr(s)?{value:!!s,message:s}:Ot(s);if(j&&(P[m]={type:Re.required,message:F,ref:O,...oe(Re.required,F)},!r))return A(F),P}if(!M&&(!ue(p)||!ue(c))){let j,F;const Q=Ot(c),pe=Ot(p);if(!ue(_)&&!isNaN(_)){const we=i.valueAsNumber||_&&+_;ue(Q.value)||(j=we>Q.value),ue(pe.value)||(F=we<pe.value)}else{const we=i.valueAsDate||new Date(_),Ae=zr=>new Date(new Date().toDateString()+" "+zr),ct=i.type=="time",er=i.type=="week";Ie(Q.value)&&_&&(j=ct?Ae(_)>Ae(Q.value):er?_>Q.value:we>new Date(Q.value)),Ie(pe.value)&&_&&(F=ct?Ae(_)<Ae(pe.value):er?_<pe.value:we<new Date(pe.value))}if((j||F)&&(te(!!j,Q.message,pe.message,Re.max,Re.min),!r))return A(P[m].message),P}if((l||u)&&!M&&(Ie(_)||o&&Array.isArray(_))){const j=Ot(l),F=Ot(u),Q=!ue(j.value)&&_.length>+j.value,pe=!ue(F.value)&&_.length<+F.value;if((Q||pe)&&(te(Q,j.message,F.message),!r))return A(P[m].message),P}if(v&&!M&&Ie(_)){const{value:j,message:F}=Ot(v);if(Rr(j)&&!_.match(j)&&(P[m]={type:Re.pattern,message:F,ref:i,...oe(Re.pattern,F)},!r))return A(F),P}if(g){if(Je(g)){const j=await g(_,t),F=ms(j,O);if(F&&(P[m]={...F,...oe(Re.validate,F.message)},!r))return A(F.message),P}else if(ee(g)){let j={};for(const F in g){if(!_e(j)&&!r)break;const Q=ms(await g[F](_,t),O,F);Q&&(j={...Q,...oe(F,Q.message)},A(Q.message),r&&(P[m]=j))}if(!_e(j)&&(P[m]={ref:O,...j},!r))return P}}return A(!0),P};function bv(e,t){const r=t.slice(0,-1).length;let n=0;for(;n<r;)e=X(e)?n++:e[t[n++]];return e}function gv(e){for(const t in e)if(e.hasOwnProperty(t)&&!X(e[t]))return!1;return!0}function ie(e,t){const r=Array.isArray(t)?t:ii(t)?[t]:ss(t),n=r.length===1?e:bv(e,r),o=r.length-1,i=r[o];return n&&delete n[i],o!==0&&(ee(n)&&_e(n)||Array.isArray(n)&&gv(n))&&ie(e,r.slice(0,-1)),e}function si(){let e=[];return{get observers(){return e},next:o=>{for(const i of e)i.next&&i.next(o)},subscribe:o=>(e.push(o),{unsubscribe:()=>{e=e.filter(i=>i!==o)}}),unsubscribe:()=>{e=[]}}}var Vr=e=>ue(e)||!os(e);function lt(e,t){if(Vr(e)||Vr(t))return e===t;if(Pt(e)&&Pt(t))return e.getTime()===t.getTime();const r=Object.keys(e),n=Object.keys(t);if(r.length!==n.length)return!1;for(const o of r){const i=e[o];if(!n.includes(o))return!1;if(o!=="ref"){const a=t[o];if(Pt(i)&&Pt(a)||ee(i)&&ee(a)||Array.isArray(i)&&Array.isArray(a)?!lt(i,a):i!==a)return!1}}return!0}var gs=e=>e.type==="select-multiple",yv=e=>ai(e)||Xt(e),li=e=>Fr(e)&&e.isConnected,ys=e=>{for(const t in e)if(Je(e[t]))return!0;return!1};function jr(e,t={}){const r=Array.isArray(e);if(ee(e)||r)for(const n in e)Array.isArray(e[n])||ee(e[n])&&!ys(e[n])?(t[n]=Array.isArray(e[n])?[]:{},jr(e[n],t[n])):ue(e[n])||(t[n]=!0);return t}function _s(e,t,r){const n=Array.isArray(e);if(ee(e)||n)for(const o in e)Array.isArray(e[o])||ee(e[o])&&!ys(e[o])?X(t)||Vr(r[o])?r[o]=Array.isArray(e[o])?jr(e[o],[]):{...jr(e[o])}:_s(e[o],ue(t)?{}:t[o],r[o]):r[o]=!lt(e[o],t[o]);return r}var ci=(e,t)=>_s(e,t,jr(t)),ws=(e,{valueAsNumber:t,valueAsDate:r,setValueAs:n})=>X(e)?e:t?e===""?NaN:e&&+e:r&&Ie(e)?new Date(e):n?n(e):e;function ui(e){const t=e.ref;if(!(e.refs?e.refs.every(r=>r.disabled):t.disabled))return oi(t)?t.files:ai(t)?vs(e.refs).value:gs(t)?[...t.selectedOptions].map(({value:r})=>r):Xt(t)?ps(e.refs).value:ws(X(t.value)?e.ref.value:t.value,e)}var _v=(e,t,r,n)=>{const o={};for(const i of e){const a=C(t,i);a&&z(o,i,a._f)}return{criteriaMode:r,names:[...e],fields:o,shouldUseNativeValidation:n}},Jt=e=>X(e)?e:Rr(e)?e.source:ee(e)?Rr(e.value)?e.value.source:e.value:e,wv=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate);function xs(e,t,r){const n=C(e,r);if(n||ii(r))return{error:n,name:r};const o=r.split(".");for(;o.length;){const i=o.join("."),a=C(t,i),s=C(e,i);if(a&&!Array.isArray(a)&&r!==i)return{name:r};if(s&&s.type)return{name:i,error:s};o.pop()}return{name:r}}var xv=(e,t,r,n,o)=>o.isOnAll?!1:!r&&o.isOnTouch?!(t||e):(r?n.isOnBlur:o.isOnBlur)?!e:(r?n.isOnChange:o.isOnChange)?e:!0,kv=(e,t)=>!Qt(C(e,t)).length&&ie(e,t);const $v={mode:$e.onSubmit,reValidateMode:$e.onChange,shouldFocusError:!0};function Sv(e={},t){let r={...$v,...e},n={submitCount:0,isDirty:!1,isLoading:Je(r.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},errors:{},disabled:!1},o={},i=ee(r.defaultValues)||ee(r.values)?Le(r.defaultValues||r.values)||{}:{},a=r.shouldUnregister?{}:Le(i),s={action:!1,mount:!1,watch:!1},l={mount:new Set,unMount:new Set,array:new Set,watch:new Set},u,p=0;const c={isDirty:!1,dirtyFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},v={values:si(),array:si(),state:si()},g=e.resetOptions&&e.resetOptions.keepDirtyValues,m=cs(r.mode),h=cs(r.reValidateMode),w=r.criteriaMode===$e.all,k=f=>b=>{clearTimeout(p),p=setTimeout(f,b)},_=async f=>{if(c.isValid||f){const b=r.resolver?_e((await M()).errors):await te(o,!0);b!==n.isValid&&v.state.next({isValid:b})}},O=f=>c.isValidating&&v.state.next({isValidating:f}),A=(f,b=[],y,E,$=!0,x=!0)=>{if(E&&y){if(s.action=!0,x&&Array.isArray(C(o,f))){const I=y(C(o,f),E.argA,E.argB);$&&z(o,f,I)}if(x&&Array.isArray(C(n.errors,f))){const I=y(C(n.errors,f),E.argA,E.argB);$&&z(n.errors,f,I),kv(n.errors,f)}if(c.touchedFields&&x&&Array.isArray(C(n.touchedFields,f))){const I=y(C(n.touchedFields,f),E.argA,E.argB);$&&z(n.touchedFields,f,I)}c.dirtyFields&&(n.dirtyFields=ci(i,a)),v.state.next({name:f,isDirty:F(f,b),dirtyFields:n.dirtyFields,errors:n.errors,isValid:n.isValid})}else z(a,f,b)},P=(f,b)=>{z(n.errors,f,b),v.state.next({errors:n.errors})},U=(f,b,y,E)=>{const $=C(o,f);if($){const x=C(a,f,X(y)?C(i,f):y);X(x)||E&&E.defaultChecked||b?z(a,f,b?x:ui($._f)):we(f,x),s.mount&&_()}},q=(f,b,y,E,$)=>{let x=!1,I=!1;const H={name:f};if(!y||E){c.isDirty&&(I=n.isDirty,n.isDirty=H.isDirty=F(),x=I!==H.isDirty);const J=lt(C(i,f),b);I=C(n.dirtyFields,f),J?ie(n.dirtyFields,f):z(n.dirtyFields,f,!0),H.dirtyFields=n.dirtyFields,x=x||c.dirtyFields&&I!==!J}if(y){const J=C(n.touchedFields,f);J||(z(n.touchedFields,f,y),H.touchedFields=n.touchedFields,x=x||c.touchedFields&&J!==y)}return x&&$&&v.state.next(H),x?H:{}},N=(f,b,y,E)=>{const $=C(n.errors,f),x=c.isValid&&Qe(b)&&n.isValid!==b;if(e.delayError&&y?(u=k(()=>P(f,y)),u(e.delayError)):(clearTimeout(p),u=null,y?z(n.errors,f,y):ie(n.errors,f)),(y?!lt($,y):$)||!_e(E)||x){const I={...E,...x&&Qe(b)?{isValid:b}:{},errors:n.errors,name:f};n={...n,...I},v.state.next(I)}O(!1)},M=async f=>r.resolver(a,r.context,_v(f||l.mount,o,r.criteriaMode,r.shouldUseNativeValidation)),oe=async f=>{const{errors:b}=await M(f);if(f)for(const y of f){const E=C(b,y);E?z(n.errors,y,E):ie(n.errors,y)}else n.errors=b;return b},te=async(f,b,y={valid:!0})=>{for(const E in f){const $=f[E];if($){const{_f:x,...I}=$;if(x){const H=l.array.has(x.name),J=await bs($,a,w,r.shouldUseNativeValidation&&!b,H);if(J[x.name]&&(y.valid=!1,b))break;!b&&(C(J,x.name)?H?mv(n.errors,J,x.name):z(n.errors,x.name,J[x.name]):ie(n.errors,x.name))}I&&await te(I,b,y)}}return y.valid},j=()=>{for(const f of l.unMount){const b=C(o,f);b&&(b._f.refs?b._f.refs.every(y=>!li(y)):!li(b._f.ref))&&hi(f)}l.unMount=new Set},F=(f,b)=>(f&&b&&z(a,f,b),!lt($s(),i)),Q=(f,b,y)=>vv(f,l,{...s.mount?a:X(b)?i:Ie(f)?{[f]:b}:b},y,b),pe=f=>Qt(C(s.mount?a:i,f,e.shouldUnregister?C(i,f,[]):[])),we=(f,b,y={})=>{const E=C(o,f);let $=b;if(E){const x=E._f;x&&(!x.disabled&&z(a,f,ws(b,x)),$=Fr(x.ref)&&ue(b)?"":b,gs(x.ref)?[...x.ref.options].forEach(I=>I.selected=$.includes(I.value)):x.refs?Xt(x.ref)?x.refs.length>1?x.refs.forEach(I=>(!I.defaultChecked||!I.disabled)&&(I.checked=Array.isArray($)?!!$.find(H=>H===I.value):$===I.value)):x.refs[0]&&(x.refs[0].checked=!!$):x.refs.forEach(I=>I.checked=I.value===$):oi(x.ref)?x.ref.value="":(x.ref.value=$,x.ref.type||v.values.next({name:f,values:{...a}})))}(y.shouldDirty||y.shouldTouch)&&q(f,$,y.shouldTouch,y.shouldDirty,!0),y.shouldValidate&&pi(f)},Ae=(f,b,y)=>{for(const E in b){const $=b[E],x=`${f}.${E}`,I=C(o,x);(l.array.has(f)||!Vr($)||I&&!I._f)&&!Pt($)?Ae(x,$,y):we(x,$,y)}},ct=(f,b,y={})=>{const E=C(o,f),$=l.array.has(f),x=Le(b);z(a,f,x),$?(v.array.next({name:f,values:{...a}}),(c.isDirty||c.dirtyFields)&&y.shouldDirty&&v.state.next({name:f,dirtyFields:ci(i,a),isDirty:F(f,x)})):E&&!E._f&&!ue(x)?Ae(f,x,y):we(f,x,y),us(f,l)&&v.state.next({...n}),v.values.next({name:f,values:{...a}}),!s.mount&&t()},er=async f=>{const b=f.target;let y=b.name,E=!0;const $=C(o,y),x=()=>b.type?ui($._f):lv(f),I=H=>{E=Number.isNaN(H)||H===C(a,y,H)};if($){let H,J;const Ur=x(),At=f.type===as.BLUR||f.type===as.FOCUS_OUT,cm=!wv($._f)&&!r.resolver&&!C(n.errors,y)&&!$._f.deps||xv(At,C(n.touchedFields,y),n.isSubmitted,h,m),mi=us(y,l,At);z(a,y,Ur),At?($._f.onBlur&&$._f.onBlur(f),u&&u(0)):$._f.onChange&&$._f.onChange(f);const bi=q(y,Ur,At,!1),um=!_e(bi)||mi;if(!At&&v.values.next({name:y,type:f.type,values:{...a}}),cm)return c.isValid&&_(),um&&v.state.next({name:y,...mi?{}:bi});if(!At&&mi&&v.state.next({...n}),O(!0),r.resolver){const{errors:Ts}=await M([y]);if(I(Ur),E){const dm=xs(n.errors,o,y),Ds=xs(Ts,o,dm.name||y);H=Ds.error,y=Ds.name,J=_e(Ts)}}else H=(await bs($,a,w,r.shouldUseNativeValidation))[y],I(Ur),E&&(H?J=!1:c.isValid&&(J=await te(o,!0)));E&&($._f.deps&&pi($._f.deps),N(y,J,H,bi))}},zr=(f,b)=>{if(C(n.errors,b)&&f.focus)return f.focus(),1},pi=async(f,b={})=>{let y,E;const $=ni(f);if(O(!0),r.resolver){const x=await oe(X(f)?f:$);y=_e(x),E=f?!$.some(I=>C(x,I)):y}else f?(E=(await Promise.all($.map(async x=>{const I=C(o,x);return await te(I&&I._f?{[x]:I}:I)}))).every(Boolean),!(!E&&!n.isValid)&&_()):E=y=await te(o);return v.state.next({...!Ie(f)||c.isValid&&y!==n.isValid?{}:{name:f},...r.resolver||!f?{isValid:y}:{},errors:n.errors,isValidating:!1}),b.shouldFocus&&!E&&Mr(o,zr,f?$:l.mount),E},$s=f=>{const b={...i,...s.mount?a:{}};return X(f)?b:Ie(f)?C(b,f):f.map(y=>C(b,y))},Ss=(f,b)=>({invalid:!!C((b||n).errors,f),isDirty:!!C((b||n).dirtyFields,f),isTouched:!!C((b||n).touchedFields,f),error:C((b||n).errors,f)}),om=f=>{f&&ni(f).forEach(b=>ie(n.errors,b)),v.state.next({errors:f?n.errors:{}})},Cs=(f,b,y)=>{const E=(C(o,f,{_f:{}})._f||{}).ref;z(n.errors,f,{...b,ref:E}),v.state.next({name:f,errors:n.errors,isValid:!1}),y&&y.shouldFocus&&E&&E.focus&&E.focus()},am=(f,b)=>Je(f)?v.values.subscribe({next:y=>f(Q(void 0,b),y)}):Q(f,b,!0),hi=(f,b={})=>{for(const y of f?ni(f):l.mount)l.mount.delete(y),l.array.delete(y),b.keepValue||(ie(o,y),ie(a,y)),!b.keepError&&ie(n.errors,y),!b.keepDirty&&ie(n.dirtyFields,y),!b.keepTouched&&ie(n.touchedFields,y),!r.shouldUnregister&&!b.keepDefaultValue&&ie(i,y);v.values.next({values:{...a}}),v.state.next({...n,...b.keepDirty?{isDirty:F()}:{}}),!b.keepIsValid&&_()},Es=({disabled:f,name:b,field:y,fields:E,value:$})=>{if(Qe(f)){const x=f?void 0:X($)?ui(y?y._f:C(E,b)._f):$;z(a,b,x),q(b,x,!1,!1,!0)}},vi=(f,b={})=>{let y=C(o,f);const E=Qe(b.disabled);return z(o,f,{...y||{},_f:{...y&&y._f?y._f:{ref:{name:f}},name:f,mount:!0,...b}}),l.mount.add(f),y?Es({field:y,disabled:b.disabled,name:f}):U(f,!0,b.value),{...E?{disabled:b.disabled}:{},...r.progressive?{required:!!b.required,min:Jt(b.min),max:Jt(b.max),minLength:Jt(b.minLength),maxLength:Jt(b.maxLength),pattern:Jt(b.pattern)}:{},name:f,onChange:er,onBlur:er,ref:$=>{if($){vi(f,b),y=C(o,f);const x=X($.value)&&$.querySelectorAll&&$.querySelectorAll("input,select,textarea")[0]||$,I=yv(x),H=y._f.refs||[];if(I?H.find(J=>J===x):x===y._f.ref)return;z(o,f,{_f:{...y._f,...I?{refs:[...H.filter(li),x,...Array.isArray(C(i,f))?[{}]:[]],ref:{type:x.type,name:f}}:{ref:x}}}),U(f,!1,void 0,x)}else y=C(o,f,{}),y._f&&(y._f.mount=!1),(r.shouldUnregister||b.shouldUnregister)&&!(uv(l.array,f)&&s.action)&&l.unMount.add(f)}}},Ps=()=>r.shouldFocusError&&Mr(o,zr,l.mount),sm=f=>{Qe(f)&&(v.state.next({disabled:f}),Mr(o,b=>{b.disabled=f},0,!1))},Os=(f,b)=>async y=>{y&&(y.preventDefault&&y.preventDefault(),y.persist&&y.persist());let E=Le(a);if(v.state.next({isSubmitting:!0}),r.resolver){const{errors:$,values:x}=await M();n.errors=$,E=x}else await te(o);ie(n.errors,"root"),_e(n.errors)?(v.state.next({errors:{}}),await f(E,y)):(b&&await b({...n.errors},y),Ps(),setTimeout(Ps)),v.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:_e(n.errors),submitCount:n.submitCount+1,errors:n.errors})},lm=(f,b={})=>{C(o,f)&&(X(b.defaultValue)?ct(f,C(i,f)):(ct(f,b.defaultValue),z(i,f,b.defaultValue)),b.keepTouched||ie(n.touchedFields,f),b.keepDirty||(ie(n.dirtyFields,f),n.isDirty=b.defaultValue?F(f,C(i,f)):F()),b.keepError||(ie(n.errors,f),c.isValid&&_()),v.state.next({...n}))},Is=(f,b={})=>{const y=f?Le(f):i,E=Le(y),$=f&&!_e(f)?E:i;if(b.keepDefaultValues||(i=y),!b.keepValues){if(b.keepDirtyValues||g)for(const x of l.mount)C(n.dirtyFields,x)?z($,x,C(a,x)):ct(x,C($,x));else{if(ri&&X(f))for(const x of l.mount){const I=C(o,x);if(I&&I._f){const H=Array.isArray(I._f.refs)?I._f.refs[0]:I._f.ref;if(Fr(H)){const J=H.closest("form");if(J){J.reset();break}}}}o={}}a=e.shouldUnregister?b.keepDefaultValues?Le(i):{}:Le($),v.array.next({values:{...$}}),v.values.next({values:{...$}})}l={mount:new Set,unMount:new Set,array:new Set,watch:new Set,watchAll:!1,focus:""},!s.mount&&t(),s.mount=!c.isValid||!!b.keepIsValid,s.watch=!!e.shouldUnregister,v.state.next({submitCount:b.keepSubmitCount?n.submitCount:0,isDirty:b.keepDirty?n.isDirty:!!(b.keepDefaultValues&&!lt(f,i)),isSubmitted:b.keepIsSubmitted?n.isSubmitted:!1,dirtyFields:b.keepDirtyValues?n.dirtyFields:b.keepDefaultValues&&f?ci(i,f):{},touchedFields:b.keepTouched?n.touchedFields:{},errors:b.keepErrors?n.errors:{},isSubmitSuccessful:b.keepIsSubmitSuccessful?n.isSubmitSuccessful:!1,isSubmitting:!1})},As=(f,b)=>Is(Je(f)?f(a):f,b);return{control:{register:vi,unregister:hi,getFieldState:Ss,handleSubmit:Os,setError:Cs,_executeSchema:M,_getWatch:Q,_getDirty:F,_updateValid:_,_removeUnmounted:j,_updateFieldArray:A,_updateDisabledField:Es,_getFieldArray:pe,_reset:Is,_resetDefaultValues:()=>Je(r.defaultValues)&&r.defaultValues().then(f=>{As(f,r.resetOptions),v.state.next({isLoading:!1})}),_updateFormState:f=>{n={...n,...f}},_disableForm:sm,_subjects:v,_proxyFormState:c,get _fields(){return o},get _formValues(){return a},get _state(){return s},set _state(f){s=f},get _defaultValues(){return i},get _names(){return l},set _names(f){l=f},get _formState(){return n},set _formState(f){n=f},get _options(){return r},set _options(f){r={...r,...f}}},trigger:pi,register:vi,handleSubmit:Os,watch:am,setValue:ct,getValues:$s,reset:As,resetField:lm,clearErrors:om,unregister:hi,setError:Cs,setFocus:(f,b={})=>{const y=C(o,f),E=y&&y._f;if(E){const $=E.refs?E.refs[0]:E.ref;$.focus&&($.focus(),b.shouldSelect&&$.select())}},getFieldState:Ss}}function di(e={}){const t=xe.useRef(),r=xe.useRef(),[n,o]=xe.useState({isDirty:!1,isValidating:!1,isLoading:Je(e.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},errors:{},disabled:!1,defaultValues:Je(e.defaultValues)?void 0:e.defaultValues});t.current||(t.current={...Sv(e,()=>o(a=>({...a}))),formState:n});const i=t.current.control;return i._options=e,hv({subject:i._subjects.state,next:a=>{pv(a,i._proxyFormState,i._updateFormState,!0)&&o({...i._formState})}}),xe.useEffect(()=>i._disableForm(e.disabled),[i,e.disabled]),xe.useEffect(()=>{if(i._proxyFormState.isDirty){const a=i._getDirty();a!==n.isDirty&&i._subjects.state.next({isDirty:a})}},[i,n.isDirty]),xe.useEffect(()=>{e.values&&!lt(e.values,r.current)?(i._reset(e.values,i._options.resetOptions),r.current=e.values):i._resetDefaultValues()},[e.values,i]),xe.useEffect(()=>{i._state.mount||(i._updateValid(),i._state.mount=!0),i._state.watch&&(i._state.watch=!1,i._subjects.state.next({...i._formState})),i._removeUnmounted()}),t.current.formState=fv(n,i),t.current}var ks=function(e,t,r){if(e&&"reportValidity"in e){var n=C(r,t);e.setCustomValidity(n&&n.message||""),e.reportValidity()}},Cv=function(e,t){var r=function(o){var i=t.fields[o];i&&i.ref&&"reportValidity"in i.ref?ks(i.ref,o,e):i.refs&&i.refs.forEach(function(a){return ks(a,o,e)})};for(var n in t.fields)r(n)},Ev=function(e,t){t.shouldUseNativeValidation&&Cv(e,t);var r={};for(var n in e){var o=C(t.fields,n),i=Object.assign(e[n]||{},{ref:o&&o.ref});if(Ov(t.names||Object.keys(e),n)){var a=Object.assign({},Pv(C(r,n)));z(a,"root",i),z(r,n,a)}else z(r,n,i)}return r},Pv=function(e){return Array.isArray(e)?e.filter(Boolean):[]},Ov=function(e,t){return e.some(function(r){return r.startsWith(t+".")})},Iv=function(e,t){for(var r={};e.issues.length;){var n=e.issues[0];if(n.path){var o=n.path.map(function(s){return s.key}).join(".");if(r[o]||(r[o]={message:n.message,type:n.validation}),t){var i=r[o].types,a=i&&i[n.validation];r[o]=ls(o,t,r,n.validation,a?[].concat(a,n.message):n.message)}e.issues.shift()}}return r},fi=function(e,t,r){return r===void 0&&(r={}),function(n,o,i){try{return Promise.resolve(function(a,s){try{var l=function(){function u(c){return{values:r.raw?n:c,errors:{}}}var p=Object.assign({},{abortEarly:!1,abortPipeEarly:!1},t);return r.mode==="sync"?u(Rt(e,n,p)):Promise.resolve($d(e,n,p)).then(u)}()}catch(u){return s(u)}return l&&l.then?l.then(void 0,s):l}(0,function(a){if(a instanceof en)return{values:{},errors:Ev(Iv(a,!i.shouldUseNativeValidation&&i.criteriaMode==="all"),i)};throw a}))}catch(a){return Promise.reject(a)}}};const Av=27,Tv=12,Dv=10,Nv=e=>{const t=Object.fromEntries(new FormData(e).entries());Object.keys(t).length&&e.dispatchEvent(new Event("submit",{bubbles:!0}))},Mv=Or("enum"),Fv=e=>{const t={min:e.minSelected??0,max:e.maxSelected??e.options.length};return fi(Se({checked:io(rn(ro()),r=>Object.entries(r).filter(([n,o])=>o).map(([n,o])=>n),[Vt(t.max,`Please select at most ${t.max} option${t.max!==1?"s":""}`),oo(t.min,`Please select at least ${t.min} option${t.min!==1?"s":""}`)])}))},Lv=({input:e,onSubmitSuccess:t})=>{var l,u;const r=e.key?(l=T.current$.value.flow)==null?void 0:l.data.submissions[e.key]:void 0,n=(e.config.minSelected===1||e.config.minSelected===void 0)&&e.config.maxSelected===1,{register:o,handleSubmit:i,formState:{errors:a}}=di({defaultValues:{checked:n?{}:Mv(r)?Object.fromEntries(r.value.map(p=>[p,!0])):{}},resolver:Fv(e.config)}),s=ti();return d("form",{noValidate:!0,class:"pr-2.5",onChange:p=>{n&&Nv(p.currentTarget)},onSubmit:i(p=>{const c=p.checked;t({type:"enum",value:c})}),children:[d("div",{class:"flex items-center gap-1",children:[d("ul",{style:{maxHeight:6.5*Av+5*Tv+2*Dv},class:He("gutter-stable flex w-full flex-1 flex-wrap gap-3 overflow-y-auto rounded-xl p-2.5 pr-4",{"justify-center":e.config.options.length===1}),children:e.config.options.map((p,c)=>{const v=`checked.${p.value}`,{ref:g,...m}=o(v);return d("li",{class:"relative",children:[d("input",{autoFocus:c===0,ref:h=>{h&&c===0&&(s.current=h),g(h)},id:v,...m,class:"peer sr-only h-full",type:"checkbox"}),d("label",{class:"bg-lowest hover:bg-neutral-2 active:outline-neutral-8 ease-expo-out outline-divider text-neutral-11 peer-checked:outline-accent-7 peer-checked:bg-accent-2 peer-checked:text-accent-9 peer-focus-visible:ring-accent-9 peer-focus-visible:ring-offset-accent-7 block cursor-pointer select-none rounded-2xl px-3 py-1.5 outline outline-1 ring-0 ring-transparent transition-all selection:bg-transparent peer-focus-visible:ring-4",htmlFor:v,children:p.label})]},p.value)})}),d("div",{class:"flex flex-col items-center gap-2",children:[!n&&d(Ct,{}),e.config.minSelected===0&&d(Et,{type:"button",onClick:()=>t({type:"enum",value:[]})})]})]}),d("div",{class:"px-1",children:d(Nr,{error:(u=a.checked)==null?void 0:u.root})})]})},Rv=Or("number"),Br={number:()=>"Please enter a valid number",min:e=>`Please enter a number greater than or equal to ${e}`,max:e=>`Please enter a number less than or equal to ${e}`,decimalCases:e=>`Please enter a number with at most ${e} decimal cases`},Vv=e=>{const t=e.min??Number.MIN_SAFE_INTEGER,r=e.max??Number.MAX_SAFE_INTEGER,n=e.decimalCases??0;return fi(Se({number:tn(Br.number(),[Od(t,Br.min(t)),Pd(r,Br.max(r)),Cd(o=>o===Number(o.toFixed(n)),Br.decimalCases(n))])}))},jv=({input:e,onSubmitSuccess:t})=>{var p;const r=e.config.defaultValue,n=e.key?(p=T.current$.value.flow)==null?void 0:p.data.submissions[e.key]:void 0,{register:o,handleSubmit:i,formState:{errors:a}}=di({defaultValues:{number:r?Number(r):Rv(n)?n.value:void 0},resolver:Vv(e.config)}),{ref:s,...l}=o("number",{required:!e.config.optional,valueAsNumber:!0}),u=L();return ve(()=>{u.current&&(u.current.focus(),u.current.select())},[]),d("form",{class:"flex flex-col gap-1 p-2.5",onSubmit:i(c=>{c.number!==void 0&&t({type:"number",value:c.number})}),children:[d("div",{class:"flex items-center gap-2",children:[d("div",{class:"relative min-w-0 flex-grow",children:[d("input",{...l,id:"chat-input",autocomplete:"off",autoCapitalize:"off",autoCorrect:"off",autoFocus:!0,ref:c=>{c&&(u.current=c),s(c)},type:"text",min:e.config.min,max:e.config.max,class:"outline-divider ease-expo-out placeholder:text-neutral-10 text-neutral-12 focus-visible:outline-accent-7 caret-accent-9 bg-lowest [type=number:-webkit-inner-spin-button] w-full rounded-full px-3 py-1 text-base outline outline-2 transition-all [-webkit-outer-spin-button:none]",placeholder:e.config.placeholder}),e.config.optional&&d(Et,{class:"absolute right-0 top-0",onClick:()=>t(null)})]}),d(Ct,{})]}),d(Nr,{error:a.number})]})},Bv=({input:e,onSubmitSuccess:t})=>d("div",{class:"flex flex-col items-center py-3",children:d("button",{class:"bg-accent-9 hover:bg-accent-10 active:bg-submit-bg-active hover:border-accent-10 active:border-submit-bg-active border-accent-9 ring-accent-6 focus-visible:outline-accent-8 ring-offset-neutral-1 flex cursor-pointer rounded-full border border-solid px-5 py-3 pr-4 text-white outline-none ring-1 ring-offset-[1.5px] transition-all duration-300 focus-visible:outline-2 active:ring-2 active:ring-offset-2",name:e.key,onClick:()=>{t(null)},children:d("span",{class:"flex items-center gap-1.5",children:[d("span",{class:"inline-flex items-center text-sm font-medium",children:e.config.label}),d("svg",{stroke:"currentColor","stroke-width":"1.5",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[d("path",{d:"M4 8L8 4L12 8"}),d("path",{d:"M8 4V13"})]})]})})}),It={empty:"Please enter some text",email:"That doesn’t look like a valid email address",phone:"That doesn’t look like a valid phone number",url:"That doesn’t look like a valid URL"},zv=he(It.phone,[Id(/^\+?[0-9 -]+$/,It.phone)]),Uv={email:{type:"email",inputMode:"email",formNoValidate:!0},phone:{type:"tel",inputMode:"tel"},text:{type:"text",inputMode:"text"},url:{type:"url",inputMode:"url",formNoValidate:!0}},Hv=Or("string"),qv=e=>{const t=`Please enter no more than ${e.maxChars} characters`;return fi(Se({text:{email:he(It.email,[Ed(It.email),Vt(e.maxChars??1/0,t)]),phone:io(zv,r=>r.replace(/[^0-9]/g,""),[Vt(e.maxChars??1/0,t)]),text:he([oo(1,It.empty),Vt(e.maxChars??1/0,t)]),url:he([Ad(It.url),Vt(e.maxChars??1/0,t)])}[e.format]}))},Kv=({input:e,onSubmitSuccess:t})=>{var p;const r=e.key?(p=T.current$.value.flow)==null?void 0:p.data.submissions[e.key]:void 0,n=e.config.defaultValue,{register:o,handleSubmit:i,formState:{errors:a}}=di({defaultValues:{text:n||(Hv(r)?r.value:"")},resolver:qv(e.config)}),{ref:s,...l}=o("text",{required:!e.config.optional}),u=L();return ve(()=>{u.current&&(u.current.focus(),u.current.select())},[]),d("form",{noValidate:!0,class:"flex flex-col gap-1 p-2.5",onSubmit:i(c=>{t({type:"string",value:c.text})}),children:[d("div",{class:"flex items-center gap-2",children:[d("div",{class:"relative min-w-0 flex-grow",children:[d("input",{id:"chat-input",...l,...Uv[e.config.format],autocomplete:"off",autoCapitalize:"off",autoCorrect:"off",autoFocus:!0,ref:c=>{c&&(u.current=c),s(c)},class:"outline-divider ease-expo-out placeholder:text-neutral-10 text-neutral-12 focus-visible:outline-accent-7 caret-accent-9 bg-lowest w-full rounded-full px-3 py-1 text-base outline outline-2 transition-all",placeholder:e.config.placeholder}),e.config.optional&&d(Et,{class:"absolute right-0 top-0",onClick:()=>t(null)})]}),d(Ct,{})]}),d(Nr,{error:a.text})]})},Wv=()=>{var o;const e=(o=T.current$.value.flow)==null?void 0:o.data.currentInput,[t,r]=Vh(),n=L(null);return T.inputHeight$.value=r.height,V(()=>{const i=n.current;if(i)return i.addEventListener("transitionstart",Z.scrollToEnd.smooth),i.addEventListener("transitioncancel",Z.scrollToEnd.smooth),i.addEventListener("transitionend",Z.scrollToEnd.smooth),()=>{i.removeEventListener("transitionstart",Z.scrollToEnd.smooth),i.removeEventListener("transitioncancel",Z.scrollToEnd.smooth),i.removeEventListener("transitionend",Z.scrollToEnd.smooth)}},[]),d("div",{ref:n,class:"ease-expo-out absolute bottom-0 w-full overflow-hidden rounded-b-3xl backdrop-blur-xl transition-all duration-700 will-change-[height]",style:{height:r.height},children:d("div",{ref:t,class:"border-divider flex flex-col justify-end border-t",children:We({input:e}).with({input:Oe.nullish},()=>d("div",{class:"flex items-center gap-2 p-2.5",children:[d("input",{"aria-hidden":"true",id:"chat-input",class:"outline-divider flex-grow rounded-full bg-transparent px-3 py-1 text-base outline outline-2",disabled:!0}),d(Ct,{disabled:!0,"aria-hidden":"true",tabIndex:-1})]})).with({input:{type:"text"}},i=>d(Kv,{onSubmitSuccess:Z.onSubmitSuccessFn$.value,...i})).with({input:{type:"multiple-choice"}},i=>d(Lv,{onSubmitSuccess:Z.onSubmitSuccessFn$.value,...i})).with({input:{type:"boolean"}},i=>d(ev,{onSubmitSuccess:Z.onSubmitSuccessFn$.value,...i})).with({input:{type:"file"}},i=>d(sv,{onSubmitSuccess:Z.onSubmitSuccessFn$.value,...i})).with({input:{type:"submit"}},i=>d(Bv,{onSubmitSuccess:Z.onSubmitSuccessFn$.value,...i})).with({input:{type:"address"}},i=>d(Yh,{onSubmitSuccess:Z.onSubmitSuccessFn$.value,...i})).with({input:{type:"number"}},i=>d(jv,{onSubmitSuccess:Z.onSubmitSuccessFn$.value,...i})).exhaustive()})})},Gv=En("max-w-[min(100%,24rem)] [text-wrap:pretty] leading-snug flex-shrink min-w-[2rem] py-2 px-3 rounded-[18px] min-h-[36px] break-words relative",{variants:{side:{left:"bg-bubble-weak-bg text-neutral-12 shadow-surface-sm outline outline-1 outline-bubble-weak rounded-bl-md",right:"ml-auto bg-accent-9 text-white rounded-br-md shadow-surface-sm shadow-bubble-strong-shadow"},animate:{true:"animate-bubble-in",false:""}},defaultVariants:{side:"left"}}),Yv=({children:e,className:t,animate:r,side:n,...o})=>d("p",{style:{transformOrigin:n==="left"?"0% 50%":"100% 50%"},class:Gv({className:t,side:n,animate:r}),...o,children:e}),Zv=({message:e})=>d("div",{class:"bg-accent-3 flex w-full items-center justify-center overflow-hidden rounded-xl px-2 py-2",children:d("a",{onClick:e.onClick,class:"bg-lowest shadow-surface-sm ring-accent-6 hover:ring-accent-8 active:bg-accent-2 active:text-accent-10 text-accent-9 focus-visible:ring-accent-7/50 text-wrap-balance flex items-center gap-1.5 rounded-full py-2 pl-4 pr-2.5 text-center no-underline ring-1 transition-all focus:outline-none focus-visible:ring-4 focus-visible:ring-offset-2",target:"_blank",href:e.href,children:[e.text,d("svg",{class:"flex-none",width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:d("path",{d:"M3.64645 11.3536C3.45118 11.1583 3.45118 10.8417 3.64645 10.6465L10.2929 4L6 4C5.72386 4 5.5 3.77614 5.5 3.5C5.5 3.22386 5.72386 3 6 3L11.5 3C11.6326 3 11.7598 3.05268 11.8536 3.14645C11.9473 3.24022 12 3.36739 12 3.5L12 9.00001C12 9.27615 11.7761 9.50001 11.5 9.50001C11.2239 9.50001 11 9.27615 11 9.00001V4.70711L4.35355 11.3536C4.15829 11.5488 3.84171 11.5488 3.64645 11.3536Z",fill:"currentColor","fill-rule":"evenodd","clip-rule":"evenodd"})})]})}),Xv=({className:e,...t})=>(V(()=>{Z.scrollToEnd.smooth()}),d("div",{"aria-hidden":!0,children:Z.isBotTyping$.value===!0?d("div",{"aria-label":"Typing…",class:He("flex gap-1 p-4",e),...t,children:Array.from({length:3},(r,n)=>d("div",{class:"bg-accent-9 h-1.5 w-1.5 animate-bounce rounded-full",style:{animationDelay:`${-n*200}ms`}}))}):void 0})),Qv={bot:"left",user:"right"},Jv=En("w-full select-none py-2 text-wrap-balance text-center text-[10px] uppercase tracking-widest drop-shadow-[0_1.5px_var(--i-color-n-1)]",{variants:{variant:{info:"text-neutral-8",warning:"text-[#FFC107]",error:"text-error-9",success:"text-[#4CAF50]"}}}),em=({lastSentMessageFooter:e})=>{var r;const t=((r=T.current$.value.flow)==null?void 0:r.data.messages)??[];return V(()=>{Z.scrollToEnd.smooth()},[t.length]),d("ol",{"aria-label":"Chat messages",class:"mt-auto flex flex-col justify-end gap-2 p-2 pt-[calc(var(--header-height)+1rem)]",children:[t.map((n,o)=>d(G,{children:d("li",{class:"flex",children:We(n).with({type:"system"},i=>d("p",{class:Jv({variant:i.variant}),children:i.text})).with({type:"text",author:Oe.union("bot","user")},i=>{const a=i.author==="user"&&!t.slice(o+1).some(l=>l.type==="text"&&l.author==="user"),s=o===t.length-1;return d(Yv,{animate:s,side:Qv[i.author],children:[i.text,a?e:null]},o)}).with({type:"link"},i=>d(Zv,{message:i})).with({type:"image"},i=>d("img",{class:"shadow-surface-md w-full max-w-[min(100%,24rem)] rounded-2xl",src:i.url,style:{aspectRatio:i.width/i.height}})).with({type:"file"},i=>d(iv,{class:i.author==="bot"?void 0:"ml-auto",file:{name:i.fileName,sizeKb:i.fileSizeKb}})).exhaustive()})},o)),d(Xv,{},"typing")]})},tm=({logger:e,apiClient:t,analytics:r})=>{const{flow:n}=T.current$.value;ke(n,"Flow is required to exist to show chatbot body");const o=T.viewState$.value,{chatRef:i,chatService:a}=qh(),[s,l]=W();return ve(()=>{o==="maximised"&&Z.scrollToEnd.instant()},[o]),ve(()=>{const{state:u,flow:p}=T.current$.peek();if(u!=="loaded")throw new Error(uh.invalid_state);let c=p.data.nodeHistory.at(-1);if(Z.scrollToEnd.instant(),T.setInput(void 0),p.data.isFinished)return;c===void 0?(c=Va(n.nodes).id,T.setCurrentNodeId(c),r.log({event:"FLOW_START",properties:{flow_id:n.id,flow_version:n.version,flow_session_id:p.data.flowSessionId,flow_build:n.build},customProperties:n.context})):T.removeMessagesSentByNodeIds([c]);const{interpret:v,abort:g,undo:m}=$h({context:n.context,analytics:r,apiClient:t,logger:e,flow:n,chatService:a,getSubmissions:()=>{var h;return(h=T.current$.peek().flow)==null?void 0:h.data.submissions},onInterpret:(h,w)=>{const k=T.current$.peek().flow;ke(k),w&&(k.data.sequence=k.data.sequence+1,r.log({event:"FLOW_NODE",properties:{flow_id:n.id,flow_version:n.version,from_node_id:w.id,flow_build:n.build,to_node_id:h.id,sequence:k.data.sequence,flow_session_id:k.data.flowSessionId},customProperties:n.context})),T.setCurrentNodeId(h.id)},onFlowEnd:async()=>{T.markAsFinished();const h=T.current$.peek().flow;ke(h),r.log({event:"FLOW_END",properties:{flow_id:n.id,flow_version:n.version,flow_session_id:h.data.flowSessionId,flow_build:n.build},customProperties:n.context})}});return l(()=>m),v(c),g},[r,t,a,e,n]),d(G,{children:[d("div",{ref:i,className:"hide-scrollbars relative flex w-full max-w-full flex-grow flex-col overflow-y-scroll",style:{WebkitOverflowScrolling:"touch",paddingBottom:T.inputHeight$.value},children:d(em,{lastSentMessageFooter:n.data.isFinished||!s?null:d(nm,{undoFn:s})})}),d(Wv,{})]})},rm=e=>"key"in e.data&&e.data.key?[e.data.key]:"keys"in e.data?Object.values(e.data.keys).filter(t=>typeof t=="string"):[],nm=({undoFn:e})=>d("div",{class:"absolute bottom-0 right-0 flex w-full translate-y-full justify-end",children:d("button",{class:"fr touch-hitbox text-neutral-9 hover:text-neutral-12 rounded-full p-1 text-right text-xs transition-all",onClick:async()=>{const{flow:t}=T.current$.peek();ke(t);const{removed:r}=e(t.data.nodeHistory),n=t.data.nodeHistory.splice(-r);n.length!==0&&(T.removeMessagesSentByNodeIds(n),T.setInput(void 0),n.pop(),n.map(o=>t.nodes.find(i=>i.id===o)).filter(Boolean).flatMap(rm).forEach(o=>delete t.data.submissions[o]),T.current$.value={...T.current$.value})},children:"Undo"})}),im=Object.freeze(Object.defineProperty({__proto__:null,ChatbotBody:tm},Symbol.toStringTag,{value:"Module"}))})();
45
+ }`},Ga=({context:e,schema:t})=>{if(t)for(const r in t){const n=t[r];if(!n)continue;const o=Dt(e,r,null);if(n.required&&o===null)throw new Error(`Configuration error in context: ${r} is required`);switch(n.type){case"number":if(typeof o!="number")throw new Error(`Configuration error in context: ${r} is not a number`);break;case"string":if(typeof o!="string")throw new Error(`Configuration error in context: ${r} is not a string`);break;default:n.type}}},wh=({_internal_domManager:e=dh(),theme:t})=>et(({apiClient:r,logger:n,analytics:o})=>{let i=!1;const a=()=>{if(typeof window>"u")return;const s=[D("style",{id:"inploi-chatbot-styles"},ch),D("style",{id:"inploi-chatbot-theme"},_h(t))],l=e.getOrCreateChatbotElement();ht(D(G,{},[s,D(oh,{apiClient:r,logger:n,analytics:o})]),l),i=!0};return{prepare:async()=>{if(!(typeof window>"u"))try{if(i)return;a(),n.info("Chatbot plugin prepared")}catch(s){n.error("Error preparing chatbot plugin",s)}},fetchFlowByJobId:async s=>r.fetch(`/flow/job/${s}`).then(l=>{const u=Rt(sh,l);return{context:{job_id:u.job.id,flow_id:u.flow.id,flow_version:u.flow.version},flow:u.flow,title:`Applying for “${u.job.title}”`,flowKeys:[u.job.id]}}),fetchFlowById:async s=>r.fetch(`/flow/id/${s}`).then(l=>{const u=Rt(ah,l);return{flow:u.flow,context:{flow_id:u.flow.id,flow_version:u.flow.version},title:"Chatbot",flowKeys:[]}}),open:async s=>{if(!(typeof window>"u"))try{T.cancelCurrentFlow(),T.viewState$.value="maximised",i||a(),s instanceof Promise?(T.current$.value={state:"loading"},s.then(async l=>{const u=Rt(lh,l);Ga({context:u.context,schema:u.flow.context_schema}),T.startFlow(u)}).catch(l=>{const u=l instanceof Error?l.message:"An error occurred";T.current$.value={state:"error",error:u}})):(Ga({context:s.context,schema:s.flow.context_schema}),T.startFlow(s))}catch(l){n.error("Error starting flow",l)}},startApplication:void 0,closeApplication:void 0,close:async()=>{typeof window>"u"||(T.cancelCurrentFlow(),n.info("Closed flow from an external source"))}}});if(!window.inploi)throw new Error("Please insert the SDK script tag above the plugins.");window.inploi.chatbotPlugin=wh;const Zt=(e,{context:t,submissions:r})=>{const[n,...o]=e.data.compareKey.split(".");if(!n)return!1;const i=Za({context:t,key:n,path:o,submissions:r});if(!i)return!1;switch(i.type){case"address":{const a=Dt(i.value,o.join("."));switch(e.data.compare){case"equals":return a===e.data.compareValue;case"contains":return a?a.includes(e.data.compareValue):!1;case"notEquals":return a!==e.data.compareValue;case"notContains":return a?!a.includes(e.data.compareValue):!0}break}case"integration":{if(typeof i.value!="object"||Array.isArray(i.value))return!1;const a=Dt(i.value,o.join(".")),s={...e,data:{...e.data,compareKey:"_temp"}};switch(typeof a){case"boolean":return Zt(s,{submissions:{_temp:{value:a,type:"boolean"}},context:t});case"string":return Zt(s,{submissions:{_temp:{value:a,type:"string"}},context:t});case"number":return Zt(s,{submissions:{_temp:{value:a,type:"number"}},context:t});case"object":return Array.isArray(a)&&a.every(Ba)?Zt(s,{submissions:{_temp:{value:a,type:"enum"}},context:t}):!1}break}case"boolean":{const a=e.data.compareValue==="true";switch(e.data.compare){case"equals":return i.value===a;case"notEquals":return i.value!==a}break}case"string":switch(e.data.compare){case"equals":return i.value===e.data.compareValue;case"contains":return i.value?i.value.includes(e.data.compareValue):!1;case"notEquals":return i.value!==e.data.compareValue;case"notContains":return i.value?!i.value.includes(e.data.compareValue):!0}break;case"number":{try{const a=Number(e.data.compareValue);switch(e.data.compare){case"equals":return i.value===a;case"notEquals":return i.value!==a;case"greaterThan":return i.value>a;case"greaterThanOrEqualTo":return i.value>=a;case"lessThan":return i.value<a;case"lessThanOrEqualTo":return i.value<=a}}catch{return console.error(`Failed to parse number in if-block ${e.id}`,i.value),!1}break}case"enum":switch(e.data.compare){case"equals":return i.value.length===1&&i.value[0]===e.data.compareValue;case"notEquals":return i.value.length===1&&i.value[0]!==e.data.compareValue;case"contains":return i.value.includes(e.data.compareValue);case"notContains":return!i.value.includes(e.data.compareValue)}break}return!1},xh=/{{\s*([^}]+?)\s*(?:\|\s*([^}]+?)\s*)?}}/g,Xe=(e,{context:t,submissions:r})=>e.replace(xh,(n,o,i="")=>{const[a,...s]=o.trim().split("."),l=Za({key:a,path:s,submissions:r,context:t});if(!l)return i;switch(l.type){case"boolean":return l.value===!0?"true":"false";case"file":return l.value.map(u=>`${u.name} (${Kt(u.sizeKb)})`).join(", ");case"enum":return l.value.join(", ");case"address":return Object.values(l.value).filter(u=>u&&u.trim().length>0).join(", ");case"number":case"string":return l.value?l.value.toString():i;case"integration":{if(typeof l.value!="object"||Array.isArray(l.value))break;const u=Dt(l.value,s.join("."));switch(typeof u){case"boolean":return u===!0?"true":"false";case"string":return u;case"number":return u.toString();case"object":if(Array.isArray(u)&&u.every(Ba))return u.join(", ")}break}}return i}),Ya=({node:e,nodes:t,stopWhen:r})=>{if((r==null?void 0:r(e))===!0)return e;const n=e.nextId?t.find(o=>o.id===e.nextId):void 0;if(n)return Ya({node:n,nodes:t,stopWhen:r})},kh=({childNode:e,nodes:t})=>{const n=t.filter(o=>o.type==="if-block").find(o=>{if(!o.branchId)return!1;const i=t.find(s=>s.id===o.branchId);if(!i)return!1;const a=Ya({node:i,nodes:t,stopWhen:s=>s.id===e.id});return!(!a||a.id!==e.id)});if(n!=null&&n.nextId)return t.find(o=>o.id===n.nextId)},$h=({flow:e,analytics:t,logger:r,context:n,apiClient:o,getSubmissions:i,chatService:a,onFlowEnd:s,onInterpret:l})=>{let u=new AbortController;const p=async(c,v)=>{const g=i();l==null||l(c,v);try{await Sh({flow:e,analytics:t,logger:r,apiClient:o,context:n,node:c,submissions:g,chat:{sendMessage:async m=>a.send({groupId:c.id,message:m,signal:u.signal}),userInput:async m=>a.input({input:m,signal:u.signal}),addToSubmissions:a.addToSubmissions},next:m=>{const h=m?e.nodes.find(w=>w.id===m):kh({childNode:c,nodes:e.nodes});return h?p(h,c):s==null?void 0:s(c)},end:()=>s==null?void 0:s(c)})}catch(m){if(m instanceof Wt)return;throw m}};return{interpret:async c=>{const v=e.nodes.find(g=>g.id===c)??Va(e.nodes);return p(v)},undo:c=>{let v=1;const g=e.nodes.find(h=>h.id===c[c.length-1]);for(let h=c.length-2;h>0;h--){const w=c[h],k=e.nodes.find(_=>_.id===w);if(!k||(v++,k.type.startsWith("question-")))break}u.abort(),u=new AbortController;const m=e.nodes.find(h=>h.id===c[c.length-v]);return ke(m,"Undo failed: new start node not found"),p(m,g),{removed:v}},abort:()=>{u.abort()}}};async function Sh(e){return await We(e).with({node:{type:"text"}},Oh).with({node:{type:"image"}},Ih).with({node:{type:"question-text"}},Ah).with({node:{type:"question-enum"}},Dh).with({node:{type:"question-number"}},Th).with({node:{type:"question-boolean"}},Nh).with({node:{type:"question-file"}},Fh).with({node:{type:"question-address"}},Mh).with({node:{type:"end-flow"}},Lh).with({node:{type:"if-block"}},Ph).with({node:{type:"jump"}},({node:t,next:r})=>r(t.data.targetId)).with({node:{type:"link"}},Eh).with({node:{type:"integration-application-submit"}},Ch).with({node:{type:"integration-workflow-get"}},()=>Error("Unreachable")).exhaustive()}async function Ch({chat:e,next:t,node:r,logger:n,apiClient:o,submissions:i,context:a,analytics:s,flow:l}){const u=async p=>{p!==!0&&await e.userInput({type:"submit",key:void 0,config:{label:r.data.submitLabel}}),await e.sendMessage({type:"system",variant:"info",text:"Submitting…"});const{anonymous_id:c,session_id:v}=s.getSessionInfo(),g=await o.fetch("/flow/submit",{method:"POST",body:JSON.stringify({...a,integration_id:r.data.integrationId,anonymous_id:c,session_id:v,submissions:Gp(i||{})})}).catch(m=>m);r.data.key&&e.addToSubmissions(r.data.key,{type:"integration",value:g}),await We(g).with({ats_data:{redirect_url:Oe.string}},async m=>{await e.sendMessage({type:"text",author:"bot",text:"Almost there! Please complete your submission here:"});const h=new URL(m.ats_data.redirect_url);c&&!h.searchParams.has("anonymous_id")&&h.searchParams.set("anonymous_id",c),await e.sendMessage({type:"link",href:h.toString(),text:"Complete submission",onClick:()=>{if(alert("kek"),!v)return n.error("session_id not set, cannot log FLOW_REDIRECT event");s.log({event:"FLOW_REDIRECT",properties:{flow_build:l.build,flow_id:l.id,flow_session_id:v,flow_version:l.version,href:h.toString()},customProperties:a})}}),t(r.nextId)}).with({success:!0},async()=>{await e.sendMessage({type:"system",variant:"success",text:"Submission completed!"}),t(r.nextId)}).with({sucess:!1,ats_data:{message:Oe.string}},async m=>{n.error(m.ats_data),await e.sendMessage({type:"system",variant:"error",text:m.ats_data.message}),await u(!1)}).otherwise(async m=>{n.error(m),await e.sendMessage({type:"system",variant:"error",text:"Failed to submit"}),await u(!1)})};await u(r.data.skipConfirmation)}async function Eh({chat:e,next:t,node:r,submissions:n,context:o,analytics:i,flow:a,logger:s}){const{session_id:l}=i.getSessionInfo();await e.sendMessage({type:"link",href:Xe(r.data.href,{submissions:n,context:o}),text:Xe(r.data.cta,{submissions:n,context:o}),onClick:()=>{if(!l)return s.error("session_id not set, cannot log FLOW_REDIRECT event");i.log({event:"FLOW_REDIRECT",properties:{flow_build:a.build,flow_id:a.id,flow_session_id:l,flow_version:a.version,href:r.data.href},customProperties:o})}}),t(r.nextId)}async function Ph({submissions:e,next:t,node:r,context:n}){t(Zt(r,{submissions:e,context:n})?r.branchId:r.nextId)}async function Oh({chat:e,next:t,node:r,submissions:n,context:o}){await e.sendMessage({author:"bot",type:"text",text:Xe(r.data.text,{submissions:n,context:o})}),t(r.nextId)}async function Ih({chat:e,next:t,node:r}){await e.sendMessage({author:"bot",type:"image",url:r.data.url,height:r.data.height,width:r.data.width}),t(r.nextId)}async function Ah({chat:e,next:t,node:r,submissions:n,context:o}){await e.sendMessage({author:"bot",type:"text",text:Xe(r.data.question,{submissions:n,context:o})});const i=await e.userInput({key:r.data.key,type:"text",config:{optional:r.data.optional,placeholder:r.data.placeholder,format:r.data.format,maxChars:r.data.maxChars}});i===null?await e.sendMessage({type:"system",variant:"info",text:"Skipped"}):await e.sendMessage({author:"user",type:"text",text:i.value}),t(r.nextId)}async function Th({chat:e,next:t,node:r,submissions:n,context:o}){await e.sendMessage({author:"bot",type:"text",text:Xe(r.data.question,{submissions:n,context:o})});const i=await e.userInput({key:r.data.key,type:"number",config:{max:r.data.max,min:r.data.min,optional:r.data.optional,placeholder:r.data.placeholder,decimalCases:r.data.decimalCases}});i===null?await e.sendMessage({type:"system",variant:"info",text:"Skipped"}):await e.sendMessage({author:"user",type:"text",text:i.value.toString()}),t(r.nextId)}async function Dh({chat:e,next:t,node:r,submissions:n,context:o}){await e.sendMessage({author:"bot",type:"text",text:Xe(r.data.question,{submissions:n,context:o})});const i=await e.userInput({key:r.data.key,type:"multiple-choice",config:r.data});i.value.length===0?await e.sendMessage({type:"system",variant:"info",text:"Skipped"}):await e.sendMessage({author:"user",type:"text",text:r.data.options.filter(a=>i.value.includes(a.value)).map(a=>a.label).join(", ")}),t(r.nextId)}async function Nh({chat:e,next:t,node:r,submissions:n,context:o}){await e.sendMessage({author:"bot",type:"text",text:Xe(r.data.question,{submissions:n,context:o})});const i=await e.userInput({key:r.data.key,type:"boolean",config:{optional:r.data.optional,labels:{true:r.data.trueLabel,false:r.data.falseLabel}}});i===null?await e.sendMessage({type:"system",variant:"info",text:"Skipped"}):await e.sendMessage({author:"user",type:"text",text:i.value===!0?r.data.trueLabel:r.data.falseLabel}),t(r.nextId)}async function Mh({chat:e,next:t,node:r}){await e.sendMessage({author:"bot",type:"text",text:r.data.question});const n=await e.userInput({type:"address",key:r.data.key,config:{optional:r.data.optional,keys:r.data.keys,placeholder:r.data.placeholder}});if(n===null)await e.sendMessage({type:"system",variant:"info",text:"Skipped"});else{const o=Object.values(n.value).filter(i=>i&&i.trim().length>0).join(", ");await e.sendMessage({author:"user",type:"text",text:o})}return t(r.nextId)}async function Fh({node:e,chat:t,next:r,submissions:n,context:o}){await t.sendMessage({author:"bot",type:"text",text:Xe(e.data.question,{submissions:n,context:o})});const i=await t.userInput({key:e.data.key,type:"file",config:{optional:e.data.optional,extensions:e.data.extensions,fileSizeLimitKib:e.data.maxSizeKb??10*1024,allowMultiple:e.data.multiple===!0}});if(i===null)await t.sendMessage({type:"system",variant:"info",text:"Skipped"});else for(const a of i.value)await t.sendMessage({author:"user",type:"file",fileName:a.name,fileSizeKb:a.sizeKb});r(e.nextId)}async function Lh({chat:e,end:t,node:r}){await e.sendMessage({type:"system",variant:"info",text:r.data.systemMessage}),t()}const Za=({key:e,path:t,submissions:r,context:n})=>{if(e==="$context"){if(!t)return;const o=Dt(n,t.join("."));switch(typeof o){case"string":return{type:"string",value:o};case"number":return{type:"number",value:o};case"boolean":return{type:"boolean",value:o};default:console.warn(`Unexpected type for $context.${t.join(".")}`,o);return}}return r==null?void 0:r[e]};function Zn(e,t,r){var n,o,i,a,s;t==null&&(t=100);function l(){var p=Date.now()-a;p<t&&p>=0?n=setTimeout(l,t-p):(n=null,r||(s=e.apply(i,o),i=o=null))}var u=function(){i=this,o=arguments,a=Date.now();var p=r&&!n;return n||(n=setTimeout(l,t)),p&&(s=e.apply(i,o),i=o=null),s};return u.clear=function(){n&&(clearTimeout(n),n=null)},u.flush=function(){n&&(s=e.apply(i,o),i=o=null,clearTimeout(n),n=null)},u}Zn.debounce=Zn;var Rh=Zn;const Xa=Ve(Rh);function Vh(e){let{debounce:t,scroll:r,polyfill:n,offsetSize:o}=e===void 0?{debounce:0,scroll:!1,offsetSize:!1}:e;const i=n||(typeof window>"u"?class{}:window.ResizeObserver);if(!i)throw new Error("This browser does not support ResizeObserver out of the box. See: https://github.com/react-spring/react-use-measure/#resize-observer-polyfills");const[a,s]=W({left:0,top:0,width:0,height:0,bottom:0,right:0,x:0,y:0}),l=L({element:null,scrollContainers:null,resizeObserver:null,lastBounds:a}),u=t?typeof t=="number"?t:t.scroll:null,p=t?typeof t=="number"?t:t.resize:null,c=L(!1);V(()=>(c.current=!0,()=>void(c.current=!1)));const[v,g,m]=le(()=>{const _=()=>{if(!l.current.element)return;const{left:O,top:A,width:P,height:U,bottom:q,right:N,x:M,y:oe}=l.current.element.getBoundingClientRect(),te={left:O,top:A,width:P,height:U,bottom:q,right:N,x:M,y:oe};l.current.element instanceof HTMLElement&&o&&(te.height=l.current.element.offsetHeight,te.width=l.current.element.offsetWidth),Object.freeze(te),c.current&&!Uh(l.current.lastBounds,te)&&s(l.current.lastBounds=te)};return[_,p?Xa(_,p):_,u?Xa(_,u):_]},[s,o,u,p]);function h(){l.current.scrollContainers&&(l.current.scrollContainers.forEach(_=>_.removeEventListener("scroll",m,!0)),l.current.scrollContainers=null),l.current.resizeObserver&&(l.current.resizeObserver.disconnect(),l.current.resizeObserver=null)}function w(){l.current.element&&(l.current.resizeObserver=new i(m),l.current.resizeObserver.observe(l.current.element),r&&l.current.scrollContainers&&l.current.scrollContainers.forEach(_=>_.addEventListener("scroll",m,{capture:!0,passive:!0})))}const k=_=>{!_||_===l.current.element||(h(),l.current.element=_,l.current.scrollContainers=Qa(_),w())};return Bh(m,!!r),jh(g),V(()=>{h(),w()},[r,m,g]),V(()=>h,[]),[k,a,v]}function jh(e){V(()=>{const t=e;return window.addEventListener("resize",t),()=>void window.removeEventListener("resize",t)},[e])}function Bh(e,t){V(()=>{if(t){const r=e;return window.addEventListener("scroll",r,{capture:!0,passive:!0}),()=>void window.removeEventListener("scroll",r,!0)}},[e,t])}function Qa(e){const t=[];if(!e||e===document.body)return t;const{overflow:r,overflowX:n,overflowY:o}=window.getComputedStyle(e);return[r,n,o].some(i=>i==="auto"||i==="scroll")&&t.push(e),[...t,...Qa(e.parentElement)]}const zh=["x","y","top","bottom","left","right","width","height"],Uh=(e,t)=>zh.every(r=>e[r]===t[r]),Ct=({class:e,...t})=>d("button",{class:He("bg-accent-9 active:bg-accent-10 pointer-coarse:touch-hitbox fr flex-shrink-0 rounded-full p-2 text-white transition-all disabled:cursor-not-allowed disabled:opacity-50",e),type:"submit",...t,children:d("svg",{class:"block",width:"16",height:"16",viewBox:"0 0 16 16",fill:"transparent",stroke:"currentColor","stroke-linecap":"round","stroke-width":"2",children:[d("title",{children:"Send"}),d("path",{d:"M3.5 7.5L8 3L12.5 7.5"}),d("path",{d:"M8 4V13"})]})}),Hh=25,Xn=Ge({instant:()=>{},smooth:()=>{}}),Z={onSubmitSuccessFn$:Ge(()=>{}),isBotTyping$:Ge(!1),scrollToEnd:{instant:()=>Xn.value.instant(),smooth:()=>Xn.value.smooth()}},qh=()=>{const e=L(null);ve(()=>{Xn.value={instant:()=>{var r;return(r=e.current)==null?void 0:r.scrollTo({top:e.current.scrollHeight,behavior:"instant"})},smooth:()=>{e.current&&e.current.scrollHeight-e.current.scrollTop<=e.current.clientHeight*2&&e.current.scrollTo({top:e.current.scrollHeight,behavior:"smooth"})}}},[e]);const t=le(()=>({addToSubmissions:(n,o)=>T.setSubmission(n,o),send:async({message:n,signal:o,groupId:i})=>{if(await We(n).with({author:"bot",type:"text"},async a=>{if(o!=null&&o.aborted)throw new Wt;Z.isBotTyping$.value=!0;const s=Math.min(Math.max(20,a.text.length),100)*Hh;await new Promise(l=>setTimeout(l,s,{signal:o})),Z.isBotTyping$.value=!1}).otherwise(async()=>{}),o!=null&&o.aborted)throw new Wt;T.addMessage(n,i)},input:({input:n,signal:o})=>{if(o!=null&&o.aborted)throw new Wt;return T.setInput(n),new Promise(i=>{const a=s=>{if(o!=null&&o.aborted)throw new Wt;T.setInput(void 0),n.key&&T.setSubmission(n.key,s),i(s)};Z.onSubmitSuccessFn$.value=a})}}),[]);return{chatRef:e,chatService:t}},Et=({class:e,...t})=>d("button",{type:"button",class:He("fr text-neutral-9 flex flex-shrink-0 items-center justify-center gap-1 rounded-full py-[6px] pl-2 pr-3 text-sm underline-offset-2 transition-all",e),...t,children:[d("svg",{class:"block",width:"16",height:"16",viewBox:"0 0 16 16",fill:"transparent",stroke:"currentColor","stroke-linecap":"round","stroke-width":"1.5",children:[d("title",{children:"Skip"}),d("path",{d:"M3.25 11.25A5 5 0 0 1 12 7"}),d("path",{d:"M13.25 4.5V8.25H9.5"})]}),"Skip"]}),Ja=["Afghanistan","Albania","Algeria","American Samoa","Andorra","Angola","Anguilla","Antarctica","Antigua and Barbuda","Argentina","Armenia","Aruba","Australia","Austria","Azerbaijan","Bahrain","Bangladesh","Barbados","Belarus","Belgium","Belize","Benin","Bermuda","Bhutan","Bolivia","Bosnia and Herzegovina","Botswana","Bouvet Island","Brazil","British Indian Ocean Territory","British Virgin Islands","Brunei","Bulgaria","Burkina Faso","Burundi","Cabo Verde","Cambodia","Cameroon","Canada","Caribbean Netherlands","Cayman Islands","Central African Republic","Chad","Chile","China","Christmas Island","Cocos (Keeling) Islands","Colombia","Comoros","Cook Islands","Costa Rica","Croatia","Cuba","Curaçao","Cyprus","Czechia","Côte d'Ivoire","Democratic Republic of the Congo","Denmark","Djibouti","Dominican Republic","Ecuador","Egypt","El Salvador","Equatorial Guinea","Eritrea","Estonia","Eswatini","Ethiopia","Falkland Islands (Islas Malvinas)","Faroe Islands","Fiji","Finland","France","French Guiana","French Polynesia","French Southern and Antarctic Lands","Gabon","Georgia","Germany","Ghana","Gibraltar","Greece","Greenland","Grenada","Guadeloupe","Guam","Guatemala","Guernsey","Guinea","Guinea-Bissau","Guyana","Haiti","Heard Island and McDonald Islands","Honduras","Hong Kong","Hungary","Iceland","India","Indonesia","Iran","Iraq","Ireland","Isle of Man","Israel","Italy","Jamaica","Japan","Jersey","Jordan","Kazakhstan","Kenya","Kiribati","Kosovo","Kuwait","Kyrgyzstan","Laos","Latvia","Lebanon","Lesotho","Liberia","Libya","Liechtenstein","Lithuania","Luxembourg","Macao","Madagascar","Malawi","Malaysia","Maldives","Mali","Malta","Marshall Islands","Martinique","Mauritania","Mauritius","Mayotte","Mexico","Micronesia","Moldova","Monaco","Mongolia","Montenegro","Montserrat","Morocco","Mozambique","Myanmar (Burma)","Namibia","Nauru","Nepal","Netherlands","New Caledonia","New Zealand","Nicaragua","Niger","Nigeria","Niue","Norfolk Island","North Korea","North Macedonia","Northern Mariana Islands","Norway","Oman","Pakistan","Palau","Palestine","Panama","Papua New Guinea","Paraguay","Peru","Philippines","Pitcairn Islands","Poland","Portugal","Puerto Rico","Qatar","Romania","Russia","Rwanda","Réunion","Saint Barthélemy","Saint Helena, Ascension and Tristan da Cunha","Saint Kitts and Nevis","Saint Lucia","Saint Martin","Saint Pierre and Miquelon","Saint Vincent and the Grenadines","Samoa","San Marino","Saudi Arabia","Senegal","Serbia","Seychelles","Sierra Leone","Singapore","Sint Maarten","Slovakia","Slovenia","Solomon Islands","Somalia","South Africa","South Georgia and the South Sandwich Islands","South Korea","South Sudan","Spain","Sri Lanka","Sudan","Suriname","Svalbard and Jan Mayen","Sweden","Switzerland","Syria","São Tomé and Príncipe","Taiwan","Tajikistan","Tanzania","Thailand","The Bahamas","The Gambia","Timor-Leste","Togo","Tokelau","Tonga","Trinidad and Tobago","Tunisia","Turkmenistan","Turks and Caicos Islands","Tuvalu","Türkiye","U.S. Virgin Islands","Uganda","Ukraine","United Arab Emirates","United Kingdom","United States","United States Minor Outlying Islands","Uruguay","Uzbekistan","Vanuatu","Vatican City","Venezuela","Vietnam","Wallis and Futuna","Western Sahara","Yemen","Zambia","Zimbabwe","Åland Islands"],es={line1:["street_number","floor","room","premise"],line2:["subpremise","street_address","route"],line3:["sublocality","neighborhood"],city:["locality","postal_town"],state:["administrative_area_level_1"],postcode:["postal_code"],country:["country"]},Dr=Object.keys(es),Kh=e=>Dr.reduce((t,r)=>{const n=es[r],o=e.filter(i=>i.types.some(a=>n.includes(a))).map(i=>i.long_name).join(", ");return o&&(t[r]=o),t},{}),Wh=document.createElement("div"),Gh=()=>le(()=>{const{google:e}=window;if(!("google"in window)||!("maps"in e)||!("places"in e.maps))return{enabled:!1};const t=new e.maps.places.AutocompleteService,r=new e.maps.places.PlacesService(Wh);return{enabled:!0,getPredictions:async n=>{const{predictions:o}=await t.getPlacePredictions({input:n,language:"en"});return o.map(i=>({label:i.description,value:i.place_id}))},getPlaceDetails:async n=>await new Promise((i,a)=>r.getDetails({placeId:n,fields:["address_components"],language:"en"},(s,l)=>l!==e.maps.places.PlacesServiceStatus.OK?a(l):s===null?a("ZERO_RESULTS"):i({ok:!0,place:s}))).catch(async i=>(console.error("Failed to get address details",i),{ok:!1}))}},[]),Qn=e=>d("button",{type:"button",class:"text-neutral-10 hover:bg-neutral-4 hover:text-neutral-12 hover:border-neutral-5 flex items-center gap-1 rounded-[18px] border border-solid border-transparent px-3 py-1 pl-1.5 text-sm transition-colors",...e,children:[d("svg",{width:"16",height:"16",viewBox:"0 0 16 16",stroke:"currentColor","stroke-width":"1.5",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:d("path",{d:"M10 3L5 8L10 13"})}),d("span",{children:"Back"})]}),Jn={label:"Fill in manually",value:""},Yh=({input:e,onSubmitSuccess:t})=>{const[r,n]=W(""),[o,i]=W(),[a,s]=W([]),[l,u]=W(),{enabled:p,getPredictions:c,getPlaceDetails:v}=Gh(),[g,m]=W(p?"query":"manual"),h=le(()=>ja(w=>{ke(p,"Query state should not be enabled if Google Places isn't available"),n(w),w===""&&s([]),!(w.length<3)&&c(w).then(k=>{s(k)})},500),[p,c]);switch(V(()=>{if(p&&!(l===void 0||l===""))return v(l).then(w=>{if(!w.ok||!w.place.address_components){i({});return}const k=Kh(w.place.address_components);i(k),m("details")}),()=>{i(void 0)}},[l,v,p]),g){case"query":return ke(p,"Query state should not be enabled if Google Places isn't available"),d(Zh,{input:e,onSkip:()=>t(null),onAddressSelect:w=>{u(w),m("loading")},onInputChange:h,suggestions:a,query:r});case"loading":return d(ei,{input:e,onSubmitSuccess:t,addressFields:{},actions:d(Qn,{onClick:()=>{u(void 0),m("query")}})});case"details":return ke(o!==void 0),d(ei,{input:e,onSubmitSuccess:t,addressFields:o,actions:d(Qn,{onClick:()=>{u(void 0),m("query")}})});case"manual":return d(ei,{input:e,onSubmitSuccess:t,addressFields:{},actions:p?d(Qn,{onClick:()=>{u(void 0),m("query")}}):void 0})}},Zh=({input:e,onSkip:t,suggestions:r,onAddressSelect:n,query:o,onInputChange:i})=>{const a=L(null);return ve(()=>{a.current&&(a.current.focus(),a.current.select())},[]),d(G,{children:[d("form",{noValidate:!0,onSubmit:s=>{s.preventDefault()},class:"flex flex-col justify-end gap-1 p-2.5",children:[d("input",{onChange:s=>{i(s.currentTarget.value)},ref:a,name:"address",id:"chat-address",autocomplete:"address-line1 country-name postal-code",autoFocus:!0,class:"outline-divider ease-expo-out placeholder:text-neutral-10 text-neutral-12 focus-visible:outline-accent-7 caret-accent-9 bg-lowest w-full rounded-full px-3 py-1 text-base outline outline-2 transition-all",placeholder:e.config.placeholder||"Search an address",defaultValue:o}),e.config.optional&&d(Et,{class:"absolute right-3",onClick:t})]}),d("ul",{children:[r.map(s=>d("li",{children:d("button",{class:"text-neutral-11 fr hover:bg-neutral-3 focus-visible:bg-neutral-3 hover:text-neutral-12 border-b-neutral-3 flex w-full items-center border border-b border-solid border-transparent px-4 py-3 text-sm transition-colors duration-100",onClick:()=>{n(s.value)},children:[d("span",{class:"flex-grow",children:s.label}),d("svg",{class:"flex-none",width:"16",height:"16",viewBox:"0 0 16 16",stroke:"currentColor","stroke-width":"1.5",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:d("path",{d:"M6 3L11 8L6 13"})})]})},s.label)),d("li",{children:d("button",{class:"text-neutral-11 fr hover:bg-neutral-3 focus-visible:bg-neutral-3 hover:text-neutral-12 border-b-neutral-3 flex w-full items-center border border-b border-solid border-transparent px-4 py-3 text-sm transition-colors duration-100",onClick:()=>{n(Jn.value)},children:d("span",{class:"flex-grow",children:Jn.label})})},Jn.label)]})]})},Xh={line1:"Line 1",line2:"Line 2",line3:"Line 3",city:"City",state:"State",postcode:"Postcode",country:"Country"},ei=({addressFields:e,onSubmitSuccess:t,actions:r,input:n})=>{const o=L(null);return ve(()=>{if(o.current){const i=o.current.querySelector("input");i&&(i.focus(),i.select())}},[]),d("form",{class:"bg-neutral-1/90 flex flex-col justify-end gap-2 p-2",onSubmit:i=>{const a=new FormData(i.currentTarget),s=Object.fromEntries(a.entries());t({type:"address",value:s})},children:[d("div",{class:"bg-neutral-3 border-neutral-5 grid items-center gap-1.5 rounded-2xl border pb-2 pl-4 pr-3 pt-3 [grid-template-columns:min-content_1fr]",ref:o,children:Dr.map((i,a)=>{const s=`isdk_${i}`,l=n.config.keys[i];return l?d(G,{children:[d("label",{for:s,class:"text-neutral-9 [&:has(+*>input:focus)]:text-neutral-11 w-24 pb-2 text-xs uppercase leading-3 tracking-widest transition-colors",children:Xh[i]}),d("div",{class:"flex flex-col items-stretch gap-1.5",children:[i==="country"?d("div",{class:"relative",children:[d("select",{class:"text-neutral-12 hover:bg-neutral-4 placeholder:text-neutral-8 focus:bg-neutral-5 w-full flex-1 appearance-none rounded-lg border-solid bg-transparent bg-none px-3 py-1.5 text-base transition-colors focus:outline-none",name:l,id:s,defaultValue:e[i],required:!0,children:[e.country&&!Ja.includes(e.country)?d("option",{value:e[i],children:e[i]}):d("option",{value:"",children:"Select a country"}),Ja.map(u=>d("option",{value:u,children:u},u))]}),d("svg",{class:"text-neutral-12 absolute bottom-2.5 right-2 flex items-center justify-center",width:"16",height:"16",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:d("path",{d:"M4 6.5L8 10.5L12 6.5"})})]}):d("input",{autoFocus:a===0?!0:void 0,class:"text-neutral-12 hover:bg-neutral-4 placeholder:text-neutral-8 focus:bg-neutral-5 flex-1 rounded-lg border-solid bg-transparent px-3 py-1.5 text-base transition-colors autofill:shadow-[inset_0_0_0_1000px_hsl(210_16.7%_97.6%)] focus:outline-none",name:l,id:s,defaultValue:e[i],required:!0}),a!==Dr.length-1&&d("hr",{class:"border-b-neutral-5 m-0 w-full border-b border-solid"}),a===Dr.length-1&&d("hr",{class:"m-0 w-full border-b border-b-transparent"})]})]}):null})}),d("div",{class:"flex w-full flex-1 ",children:[d("div",{class:"flex-grow",children:r}),d(Ct,{class:"flex items-center justify-center"})]})]})},ti=()=>{const e=L(null);return V(()=>{var t;(t=e.current)==null||t.focus()},[]),e},ts=["true","false"],Qh=_d(ts),Jh="answer",ev=({input:e,onSubmitSuccess:t})=>{const r=ti();return d("form",{noValidate:!0,class:"",onSubmit:n=>{n.preventDefault();const o=We(n).with({nativeEvent:{submitter:Oe.select(Oe.union(Oe.instanceOf(HTMLButtonElement),Oe.instanceOf(HTMLInputElement)))}},a=>a.value).otherwise(()=>{throw new Error("invalid form")}),i=Rt(Qh,o);t({type:"boolean",value:i==="true"})},children:[d("div",{class:"flex items-center gap-2 p-2.5",children:ts.map((n,o)=>d("button",{ref:o===0?r:null,type:"submit",name:Jh,value:n,class:"bg-lowest ease-expo-out ring-divider text-neutral-12 active:ring-accent-7 active:bg-accent-2 active:text-accent-11 fr block flex-1 overflow-hidden rounded-2xl px-2.5 py-2.5 ring-2 transition-all selection:bg-transparent",children:d("p",{class:"truncate text-center text-base",children:e.config.labels[n]})}))}),e.config.optional&&d("div",{class:"px-2 pb-2",children:d(Et,{class:"w-full",type:"button",onClick:()=>t(null)})})]})},Nr=({error:e})=>e?d("div",{role:"alert",class:"text-error-11 flex max-w-full items-center gap-1 overflow-hidden rounded-full px-2 py-2",children:[d("svg",{class:"text-error-9 h-4 w-4",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[d("circle",{cx:"8",cy:"8",r:"6.3",stroke:"currentColor","stroke-width":"1.4"}),d("rect",{x:"7",y:"4",width:"2",height:"5",fill:"currentColor"}),d("rect",{x:"7",y:"10",width:"2",height:"2",fill:"currentColor"})]}),d("p",{class:"truncate pr-1 text-sm",children:e.message})]}):null,tv=e=>new Promise((t,r)=>{const n=new FileReader;n.readAsDataURL(e),n.onload=()=>n.result?t(n.result.toString()):r("No result from reader"),n.onerror=r}),rv=e=>e.reduce((t,r)=>t+r.sizeKb,0),nv=Or("file"),rs=3,iv=({file:e,class:t,...r})=>{const n=e.name.split(".").pop(),o=e.name.replace(new RegExp(`.${n}$`),"");return d("div",{class:He("bg-accent-1 outline-accent-4 flex max-w-full gap-2 overflow-hidden rounded-lg px-3 py-2 text-sm outline",t),...r,children:[d("p",{"aria-label":"File name",class:"text-accent-12 flex flex-grow overflow-hidden",children:[d("span",{class:"block truncate",children:o}),d("span",{children:[".",n]})]}),d("p",{"aria-label":"File size",class:"text-accent-11",children:Kt(e.sizeKb)})]})},ns=({class:e,...t})=>d("li",{class:He("outline-neutral-6 text-neutral-11 bg-neutral-1 block rounded-md px-1 py-0.5 text-xs outline outline-1",e),...t}),is=e=>{const t=e.split(".").pop();if(!t)throw new Error("No file extension found");return t?"."+t:""},ov=({allowedExtensions:e,files:t})=>{const r=e.map(n=>n.toLowerCase());return t.every(n=>r.includes(is(n.name).toLowerCase()))},av=(e,t)=>{const r=is(e);return`${e.replace(new RegExp(`${r}$`),"").slice(0,t)}${r}`},sv=({input:e,onSubmitSuccess:t})=>{var p;const r=(p=T.current$.value.flow)==null?void 0:p.data.submissions[e.key],[n,o]=W(nv(r)?r.value:[]),[i,a]=W(),s=n.length-rs,l=rv(n),u=ti();return d("form",{class:"flex flex-col gap-1 p-2.5",onSubmit:c=>(c.preventDefault(),a(void 0),n.length===0?a({type:"required",message:"Please select a file"}):e.config.extensions.length>0&&!ov({allowedExtensions:e.config.extensions,files:n})?a({type:"validate",message:`Please upload ${e.config.extensions.join(", ")} files only`}):e.config.fileSizeLimitKib&&l>e.config.fileSizeLimitKib?a({type:"max",message:`File size exceeds limit of ${Kt(e.config.fileSizeLimitKib)}`}):e.config.allowMultiple===!1&&n.length>1?a({type:"invalid",message:"Only one file is allowed"}):t({type:"file",value:n})),children:[d("div",{class:"flex items-center gap-2",children:[d("label",{ref:u,for:"dropzone-file",class:"border-neutral-8 bg-neutral-2 flex h-48 w-full cursor-pointer flex-col items-center justify-center overflow-hidden rounded-2xl border border-dashed p-4",children:[n.length>0?d(G,{children:[d("ul",{class:"flex max-w-full flex-wrap justify-center gap-1 overflow-hidden p-1",children:[n.slice(0,rs).map(c=>{const v=c.name.split(".").pop(),g=c.name.replace(new RegExp(`.${v}$`),"");return d(ns,{class:"flex overflow-hidden",children:[d("span",{class:"block truncate",children:g}),d("span",{children:[".",v]})]})}),s>0?d(ns,{children:["+",s," file",s!==1?"s":""]}):null]}),d("p",{class:"text-neutral-11 text-xs",children:[Kt(l)," ",n.length>1?"total":""]})]}):d("div",{class:"flex flex-col justify-center gap-4 pb-6 pt-5",children:[d("header",{class:"flex flex-col items-center gap-0",children:[d("svg",{class:"text-neutral-11 mb-1 h-8 w-8","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 20 16",children:d("path",{stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"1.5",d:"M13 13h3a3 3 0 0 0 0-6h-.025A5.56 5.56 0 0 0 16 6.5 5.5 5.5 0 0 0 5.207 5.021C5.137 5.017 5.071 5 5 5a4 4 0 0 0 0 8h2.167M10 15V6m0 0L8 8m2-2 2 2"})}),d("p",{class:"text-neutral-12 tracking-[-0.01em]",children:[e.config.allowMultiple?"Select files":"Select a file"," to upload"]}),e.config.fileSizeLimitKib?d("p",{class:"text-neutral-10 text-xs",children:["(max ",Kt(e.config.fileSizeLimitKib),")"]}):null]}),d("aside",{class:"flex flex-col items-center gap-2",children:[d("p",{id:"accepted-filetypes",class:"sr-only",children:"Accepted file extensions"}),d("ul",{"aria-describedby":"accepted-filetypes",class:"flex flex-wrap justify-center gap-2",children:e.config.extensions.map(c=>d("li",{class:"ring-lowest outline-neutral-6 text-neutral-9 bg-neutral-1 rounded-md px-1 py-0.5 text-[11px] uppercase tracking-wide outline outline-1 ring-2",children:c.replace(".","")}))})]})]}),d("input",{id:"dropzone-file",onInput:async c=>{ke(c.target instanceof HTMLInputElement);const v=c.target.files?Array.from(c.target.files):[],g=await Promise.allSettled(v.map(async h=>{const w=await tv(h);return{name:av(h.name,42),data:w,sizeKb:h.size/1e3}}));if(g.some(({status:h})=>h==="rejected"))return a({type:"invalid",message:"Invalid file"});const m=g.map(h=>h.status==="fulfilled"?h.value:null).filter(Boolean);o(m)},multiple:e.config.allowMultiple,type:"file",class:"sr-only"})]}),d("div",{class:"flex h-full flex-col items-center gap-2",children:[d(Ct,{disabled:n.length===0}),e.config.optional&&d(Et,{onClick:()=>t(null)})]})]}),d(Nr,{error:i})]})};var Xt=e=>e.type==="checkbox",Pt=e=>e instanceof Date,ue=e=>e==null;const os=e=>typeof e=="object";var ee=e=>!ue(e)&&!Array.isArray(e)&&os(e)&&!Pt(e),lv=e=>ee(e)&&e.target?Xt(e.target)?e.target.checked:e.target.value:e,cv=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,uv=(e,t)=>e.has(cv(t)),dv=e=>{const t=e.constructor&&e.constructor.prototype;return ee(t)&&t.hasOwnProperty("isPrototypeOf")},ri=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function Le(e){let t;const r=Array.isArray(e);if(e instanceof Date)t=new Date(e);else if(e instanceof Set)t=new Set(e);else if(!(ri&&(e instanceof Blob||e instanceof FileList))&&(r||ee(e)))if(t=r?[]:{},!r&&!dv(e))t=e;else for(const n in e)e.hasOwnProperty(n)&&(t[n]=Le(e[n]));else return e;return t}var Qt=e=>Array.isArray(e)?e.filter(Boolean):[],X=e=>e===void 0,C=(e,t,r)=>{if(!t||!ee(e))return r;const n=Qt(t.split(/[,[\].]+?/)).reduce((o,i)=>ue(o)?o:o[i],e);return X(n)||n===e?X(e[t])?r:e[t]:n},Qe=e=>typeof e=="boolean";const as={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change"},$e={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},Re={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"};xe.createContext(null);var fv=(e,t,r,n=!0)=>{const o={defaultValues:t._defaultValues};for(const i in e)Object.defineProperty(o,i,{get:()=>{const a=i;return t._proxyFormState[a]!==$e.all&&(t._proxyFormState[a]=!n||$e.all),r&&(r[a]=!0),e[a]}});return o},_e=e=>ee(e)&&!Object.keys(e).length,pv=(e,t,r,n)=>{r(e);const{name:o,...i}=e;return _e(i)||Object.keys(i).length>=Object.keys(t).length||Object.keys(i).find(a=>t[a]===(!n||$e.all))},ni=e=>Array.isArray(e)?e:[e];function hv(e){const t=xe.useRef(e);t.current=e,xe.useEffect(()=>{const r=!e.disabled&&t.current.subject&&t.current.subject.subscribe({next:t.current.next});return()=>{r&&r.unsubscribe()}},[e.disabled])}var Ie=e=>typeof e=="string",vv=(e,t,r,n,o)=>Ie(e)?(n&&t.watch.add(e),C(r,e,o)):Array.isArray(e)?e.map(i=>(n&&t.watch.add(i),C(r,i))):(n&&(t.watchAll=!0),r),ii=e=>/^\w*$/.test(e),ss=e=>Qt(e.replace(/["|']|\]/g,"").split(/\.|\[/));function z(e,t,r){let n=-1;const o=ii(t)?[t]:ss(t),i=o.length,a=i-1;for(;++n<i;){const s=o[n];let l=r;if(n!==a){const u=e[s];l=ee(u)||Array.isArray(u)?u:isNaN(+o[n+1])?{}:[]}e[s]=l,e=e[s]}return e}var ls=(e,t,r,n,o)=>t?{...r[e],types:{...r[e]&&r[e].types?r[e].types:{},[n]:o||!0}}:{},cs=e=>({isOnSubmit:!e||e===$e.onSubmit,isOnBlur:e===$e.onBlur,isOnChange:e===$e.onChange,isOnAll:e===$e.all,isOnTouch:e===$e.onTouched}),us=(e,t,r)=>!r&&(t.watchAll||t.watch.has(e)||[...t.watch].some(n=>e.startsWith(n)&&/^\.\w+/.test(e.slice(n.length))));const Mr=(e,t,r,n)=>{for(const o of r||Object.keys(e)){const i=C(e,o);if(i){const{_f:a,...s}=i;if(a){if(a.refs&&a.refs[0]&&t(a.refs[0],o)&&!n)break;if(a.ref&&t(a.ref,a.name)&&!n)break}else ee(s)&&Mr(s,t)}}};var mv=(e,t,r)=>{const n=Qt(C(e,r));return z(n,"root",t[r]),z(e,r,n),e},oi=e=>e.type==="file",Je=e=>typeof e=="function",Fr=e=>{if(!ri)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},Lr=e=>Ie(e),ai=e=>e.type==="radio",Rr=e=>e instanceof RegExp;const ds={value:!1,isValid:!1},fs={value:!0,isValid:!0};var ps=e=>{if(Array.isArray(e)){if(e.length>1){const t=e.filter(r=>r&&r.checked&&!r.disabled).map(r=>r.value);return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!X(e[0].attributes.value)?X(e[0].value)||e[0].value===""?fs:{value:e[0].value,isValid:!0}:fs:ds}return ds};const hs={isValid:!1,value:null};var vs=e=>Array.isArray(e)?e.reduce((t,r)=>r&&r.checked&&!r.disabled?{isValid:!0,value:r.value}:t,hs):hs;function ms(e,t,r="validate"){if(Lr(e)||Array.isArray(e)&&e.every(Lr)||Qe(e)&&!e)return{type:r,message:Lr(e)?e:"",ref:t}}var Ot=e=>ee(e)&&!Rr(e)?e:{value:e,message:""},bs=async(e,t,r,n,o)=>{const{ref:i,refs:a,required:s,maxLength:l,minLength:u,min:p,max:c,pattern:v,validate:g,name:m,valueAsNumber:h,mount:w,disabled:k}=e._f,_=C(t,m);if(!w||k)return{};const O=a?a[0]:i,A=j=>{n&&O.reportValidity&&(O.setCustomValidity(Qe(j)?"":j||""),O.reportValidity())},P={},U=ai(i),q=Xt(i),N=U||q,M=(h||oi(i))&&X(i.value)&&X(_)||Fr(i)&&i.value===""||_===""||Array.isArray(_)&&!_.length,oe=ls.bind(null,m,r,P),te=(j,F,Q,pe=Re.maxLength,we=Re.minLength)=>{const Ae=j?F:Q;P[m]={type:j?pe:we,message:Ae,ref:i,...oe(j?pe:we,Ae)}};if(o?!Array.isArray(_)||!_.length:s&&(!N&&(M||ue(_))||Qe(_)&&!_||q&&!ps(a).isValid||U&&!vs(a).isValid)){const{value:j,message:F}=Lr(s)?{value:!!s,message:s}:Ot(s);if(j&&(P[m]={type:Re.required,message:F,ref:O,...oe(Re.required,F)},!r))return A(F),P}if(!M&&(!ue(p)||!ue(c))){let j,F;const Q=Ot(c),pe=Ot(p);if(!ue(_)&&!isNaN(_)){const we=i.valueAsNumber||_&&+_;ue(Q.value)||(j=we>Q.value),ue(pe.value)||(F=we<pe.value)}else{const we=i.valueAsDate||new Date(_),Ae=zr=>new Date(new Date().toDateString()+" "+zr),ct=i.type=="time",er=i.type=="week";Ie(Q.value)&&_&&(j=ct?Ae(_)>Ae(Q.value):er?_>Q.value:we>new Date(Q.value)),Ie(pe.value)&&_&&(F=ct?Ae(_)<Ae(pe.value):er?_<pe.value:we<new Date(pe.value))}if((j||F)&&(te(!!j,Q.message,pe.message,Re.max,Re.min),!r))return A(P[m].message),P}if((l||u)&&!M&&(Ie(_)||o&&Array.isArray(_))){const j=Ot(l),F=Ot(u),Q=!ue(j.value)&&_.length>+j.value,pe=!ue(F.value)&&_.length<+F.value;if((Q||pe)&&(te(Q,j.message,F.message),!r))return A(P[m].message),P}if(v&&!M&&Ie(_)){const{value:j,message:F}=Ot(v);if(Rr(j)&&!_.match(j)&&(P[m]={type:Re.pattern,message:F,ref:i,...oe(Re.pattern,F)},!r))return A(F),P}if(g){if(Je(g)){const j=await g(_,t),F=ms(j,O);if(F&&(P[m]={...F,...oe(Re.validate,F.message)},!r))return A(F.message),P}else if(ee(g)){let j={};for(const F in g){if(!_e(j)&&!r)break;const Q=ms(await g[F](_,t),O,F);Q&&(j={...Q,...oe(F,Q.message)},A(Q.message),r&&(P[m]=j))}if(!_e(j)&&(P[m]={ref:O,...j},!r))return P}}return A(!0),P};function bv(e,t){const r=t.slice(0,-1).length;let n=0;for(;n<r;)e=X(e)?n++:e[t[n++]];return e}function gv(e){for(const t in e)if(e.hasOwnProperty(t)&&!X(e[t]))return!1;return!0}function ie(e,t){const r=Array.isArray(t)?t:ii(t)?[t]:ss(t),n=r.length===1?e:bv(e,r),o=r.length-1,i=r[o];return n&&delete n[i],o!==0&&(ee(n)&&_e(n)||Array.isArray(n)&&gv(n))&&ie(e,r.slice(0,-1)),e}function si(){let e=[];return{get observers(){return e},next:o=>{for(const i of e)i.next&&i.next(o)},subscribe:o=>(e.push(o),{unsubscribe:()=>{e=e.filter(i=>i!==o)}}),unsubscribe:()=>{e=[]}}}var Vr=e=>ue(e)||!os(e);function lt(e,t){if(Vr(e)||Vr(t))return e===t;if(Pt(e)&&Pt(t))return e.getTime()===t.getTime();const r=Object.keys(e),n=Object.keys(t);if(r.length!==n.length)return!1;for(const o of r){const i=e[o];if(!n.includes(o))return!1;if(o!=="ref"){const a=t[o];if(Pt(i)&&Pt(a)||ee(i)&&ee(a)||Array.isArray(i)&&Array.isArray(a)?!lt(i,a):i!==a)return!1}}return!0}var gs=e=>e.type==="select-multiple",yv=e=>ai(e)||Xt(e),li=e=>Fr(e)&&e.isConnected,ys=e=>{for(const t in e)if(Je(e[t]))return!0;return!1};function jr(e,t={}){const r=Array.isArray(e);if(ee(e)||r)for(const n in e)Array.isArray(e[n])||ee(e[n])&&!ys(e[n])?(t[n]=Array.isArray(e[n])?[]:{},jr(e[n],t[n])):ue(e[n])||(t[n]=!0);return t}function _s(e,t,r){const n=Array.isArray(e);if(ee(e)||n)for(const o in e)Array.isArray(e[o])||ee(e[o])&&!ys(e[o])?X(t)||Vr(r[o])?r[o]=Array.isArray(e[o])?jr(e[o],[]):{...jr(e[o])}:_s(e[o],ue(t)?{}:t[o],r[o]):r[o]=!lt(e[o],t[o]);return r}var ci=(e,t)=>_s(e,t,jr(t)),ws=(e,{valueAsNumber:t,valueAsDate:r,setValueAs:n})=>X(e)?e:t?e===""?NaN:e&&+e:r&&Ie(e)?new Date(e):n?n(e):e;function ui(e){const t=e.ref;if(!(e.refs?e.refs.every(r=>r.disabled):t.disabled))return oi(t)?t.files:ai(t)?vs(e.refs).value:gs(t)?[...t.selectedOptions].map(({value:r})=>r):Xt(t)?ps(e.refs).value:ws(X(t.value)?e.ref.value:t.value,e)}var _v=(e,t,r,n)=>{const o={};for(const i of e){const a=C(t,i);a&&z(o,i,a._f)}return{criteriaMode:r,names:[...e],fields:o,shouldUseNativeValidation:n}},Jt=e=>X(e)?e:Rr(e)?e.source:ee(e)?Rr(e.value)?e.value.source:e.value:e,wv=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate);function xs(e,t,r){const n=C(e,r);if(n||ii(r))return{error:n,name:r};const o=r.split(".");for(;o.length;){const i=o.join("."),a=C(t,i),s=C(e,i);if(a&&!Array.isArray(a)&&r!==i)return{name:r};if(s&&s.type)return{name:i,error:s};o.pop()}return{name:r}}var xv=(e,t,r,n,o)=>o.isOnAll?!1:!r&&o.isOnTouch?!(t||e):(r?n.isOnBlur:o.isOnBlur)?!e:(r?n.isOnChange:o.isOnChange)?e:!0,kv=(e,t)=>!Qt(C(e,t)).length&&ie(e,t);const $v={mode:$e.onSubmit,reValidateMode:$e.onChange,shouldFocusError:!0};function Sv(e={},t){let r={...$v,...e},n={submitCount:0,isDirty:!1,isLoading:Je(r.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},errors:{},disabled:!1},o={},i=ee(r.defaultValues)||ee(r.values)?Le(r.defaultValues||r.values)||{}:{},a=r.shouldUnregister?{}:Le(i),s={action:!1,mount:!1,watch:!1},l={mount:new Set,unMount:new Set,array:new Set,watch:new Set},u,p=0;const c={isDirty:!1,dirtyFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},v={values:si(),array:si(),state:si()},g=e.resetOptions&&e.resetOptions.keepDirtyValues,m=cs(r.mode),h=cs(r.reValidateMode),w=r.criteriaMode===$e.all,k=f=>b=>{clearTimeout(p),p=setTimeout(f,b)},_=async f=>{if(c.isValid||f){const b=r.resolver?_e((await M()).errors):await te(o,!0);b!==n.isValid&&v.state.next({isValid:b})}},O=f=>c.isValidating&&v.state.next({isValidating:f}),A=(f,b=[],y,E,$=!0,x=!0)=>{if(E&&y){if(s.action=!0,x&&Array.isArray(C(o,f))){const I=y(C(o,f),E.argA,E.argB);$&&z(o,f,I)}if(x&&Array.isArray(C(n.errors,f))){const I=y(C(n.errors,f),E.argA,E.argB);$&&z(n.errors,f,I),kv(n.errors,f)}if(c.touchedFields&&x&&Array.isArray(C(n.touchedFields,f))){const I=y(C(n.touchedFields,f),E.argA,E.argB);$&&z(n.touchedFields,f,I)}c.dirtyFields&&(n.dirtyFields=ci(i,a)),v.state.next({name:f,isDirty:F(f,b),dirtyFields:n.dirtyFields,errors:n.errors,isValid:n.isValid})}else z(a,f,b)},P=(f,b)=>{z(n.errors,f,b),v.state.next({errors:n.errors})},U=(f,b,y,E)=>{const $=C(o,f);if($){const x=C(a,f,X(y)?C(i,f):y);X(x)||E&&E.defaultChecked||b?z(a,f,b?x:ui($._f)):we(f,x),s.mount&&_()}},q=(f,b,y,E,$)=>{let x=!1,I=!1;const H={name:f};if(!y||E){c.isDirty&&(I=n.isDirty,n.isDirty=H.isDirty=F(),x=I!==H.isDirty);const J=lt(C(i,f),b);I=C(n.dirtyFields,f),J?ie(n.dirtyFields,f):z(n.dirtyFields,f,!0),H.dirtyFields=n.dirtyFields,x=x||c.dirtyFields&&I!==!J}if(y){const J=C(n.touchedFields,f);J||(z(n.touchedFields,f,y),H.touchedFields=n.touchedFields,x=x||c.touchedFields&&J!==y)}return x&&$&&v.state.next(H),x?H:{}},N=(f,b,y,E)=>{const $=C(n.errors,f),x=c.isValid&&Qe(b)&&n.isValid!==b;if(e.delayError&&y?(u=k(()=>P(f,y)),u(e.delayError)):(clearTimeout(p),u=null,y?z(n.errors,f,y):ie(n.errors,f)),(y?!lt($,y):$)||!_e(E)||x){const I={...E,...x&&Qe(b)?{isValid:b}:{},errors:n.errors,name:f};n={...n,...I},v.state.next(I)}O(!1)},M=async f=>r.resolver(a,r.context,_v(f||l.mount,o,r.criteriaMode,r.shouldUseNativeValidation)),oe=async f=>{const{errors:b}=await M(f);if(f)for(const y of f){const E=C(b,y);E?z(n.errors,y,E):ie(n.errors,y)}else n.errors=b;return b},te=async(f,b,y={valid:!0})=>{for(const E in f){const $=f[E];if($){const{_f:x,...I}=$;if(x){const H=l.array.has(x.name),J=await bs($,a,w,r.shouldUseNativeValidation&&!b,H);if(J[x.name]&&(y.valid=!1,b))break;!b&&(C(J,x.name)?H?mv(n.errors,J,x.name):z(n.errors,x.name,J[x.name]):ie(n.errors,x.name))}I&&await te(I,b,y)}}return y.valid},j=()=>{for(const f of l.unMount){const b=C(o,f);b&&(b._f.refs?b._f.refs.every(y=>!li(y)):!li(b._f.ref))&&hi(f)}l.unMount=new Set},F=(f,b)=>(f&&b&&z(a,f,b),!lt($s(),i)),Q=(f,b,y)=>vv(f,l,{...s.mount?a:X(b)?i:Ie(f)?{[f]:b}:b},y,b),pe=f=>Qt(C(s.mount?a:i,f,e.shouldUnregister?C(i,f,[]):[])),we=(f,b,y={})=>{const E=C(o,f);let $=b;if(E){const x=E._f;x&&(!x.disabled&&z(a,f,ws(b,x)),$=Fr(x.ref)&&ue(b)?"":b,gs(x.ref)?[...x.ref.options].forEach(I=>I.selected=$.includes(I.value)):x.refs?Xt(x.ref)?x.refs.length>1?x.refs.forEach(I=>(!I.defaultChecked||!I.disabled)&&(I.checked=Array.isArray($)?!!$.find(H=>H===I.value):$===I.value)):x.refs[0]&&(x.refs[0].checked=!!$):x.refs.forEach(I=>I.checked=I.value===$):oi(x.ref)?x.ref.value="":(x.ref.value=$,x.ref.type||v.values.next({name:f,values:{...a}})))}(y.shouldDirty||y.shouldTouch)&&q(f,$,y.shouldTouch,y.shouldDirty,!0),y.shouldValidate&&pi(f)},Ae=(f,b,y)=>{for(const E in b){const $=b[E],x=`${f}.${E}`,I=C(o,x);(l.array.has(f)||!Vr($)||I&&!I._f)&&!Pt($)?Ae(x,$,y):we(x,$,y)}},ct=(f,b,y={})=>{const E=C(o,f),$=l.array.has(f),x=Le(b);z(a,f,x),$?(v.array.next({name:f,values:{...a}}),(c.isDirty||c.dirtyFields)&&y.shouldDirty&&v.state.next({name:f,dirtyFields:ci(i,a),isDirty:F(f,x)})):E&&!E._f&&!ue(x)?Ae(f,x,y):we(f,x,y),us(f,l)&&v.state.next({...n}),v.values.next({name:f,values:{...a}}),!s.mount&&t()},er=async f=>{const b=f.target;let y=b.name,E=!0;const $=C(o,y),x=()=>b.type?ui($._f):lv(f),I=H=>{E=Number.isNaN(H)||H===C(a,y,H)};if($){let H,J;const Ur=x(),At=f.type===as.BLUR||f.type===as.FOCUS_OUT,cm=!wv($._f)&&!r.resolver&&!C(n.errors,y)&&!$._f.deps||xv(At,C(n.touchedFields,y),n.isSubmitted,h,m),mi=us(y,l,At);z(a,y,Ur),At?($._f.onBlur&&$._f.onBlur(f),u&&u(0)):$._f.onChange&&$._f.onChange(f);const bi=q(y,Ur,At,!1),um=!_e(bi)||mi;if(!At&&v.values.next({name:y,type:f.type,values:{...a}}),cm)return c.isValid&&_(),um&&v.state.next({name:y,...mi?{}:bi});if(!At&&mi&&v.state.next({...n}),O(!0),r.resolver){const{errors:Ts}=await M([y]);if(I(Ur),E){const dm=xs(n.errors,o,y),Ds=xs(Ts,o,dm.name||y);H=Ds.error,y=Ds.name,J=_e(Ts)}}else H=(await bs($,a,w,r.shouldUseNativeValidation))[y],I(Ur),E&&(H?J=!1:c.isValid&&(J=await te(o,!0)));E&&($._f.deps&&pi($._f.deps),N(y,J,H,bi))}},zr=(f,b)=>{if(C(n.errors,b)&&f.focus)return f.focus(),1},pi=async(f,b={})=>{let y,E;const $=ni(f);if(O(!0),r.resolver){const x=await oe(X(f)?f:$);y=_e(x),E=f?!$.some(I=>C(x,I)):y}else f?(E=(await Promise.all($.map(async x=>{const I=C(o,x);return await te(I&&I._f?{[x]:I}:I)}))).every(Boolean),!(!E&&!n.isValid)&&_()):E=y=await te(o);return v.state.next({...!Ie(f)||c.isValid&&y!==n.isValid?{}:{name:f},...r.resolver||!f?{isValid:y}:{},errors:n.errors,isValidating:!1}),b.shouldFocus&&!E&&Mr(o,zr,f?$:l.mount),E},$s=f=>{const b={...i,...s.mount?a:{}};return X(f)?b:Ie(f)?C(b,f):f.map(y=>C(b,y))},Ss=(f,b)=>({invalid:!!C((b||n).errors,f),isDirty:!!C((b||n).dirtyFields,f),isTouched:!!C((b||n).touchedFields,f),error:C((b||n).errors,f)}),om=f=>{f&&ni(f).forEach(b=>ie(n.errors,b)),v.state.next({errors:f?n.errors:{}})},Cs=(f,b,y)=>{const E=(C(o,f,{_f:{}})._f||{}).ref;z(n.errors,f,{...b,ref:E}),v.state.next({name:f,errors:n.errors,isValid:!1}),y&&y.shouldFocus&&E&&E.focus&&E.focus()},am=(f,b)=>Je(f)?v.values.subscribe({next:y=>f(Q(void 0,b),y)}):Q(f,b,!0),hi=(f,b={})=>{for(const y of f?ni(f):l.mount)l.mount.delete(y),l.array.delete(y),b.keepValue||(ie(o,y),ie(a,y)),!b.keepError&&ie(n.errors,y),!b.keepDirty&&ie(n.dirtyFields,y),!b.keepTouched&&ie(n.touchedFields,y),!r.shouldUnregister&&!b.keepDefaultValue&&ie(i,y);v.values.next({values:{...a}}),v.state.next({...n,...b.keepDirty?{isDirty:F()}:{}}),!b.keepIsValid&&_()},Es=({disabled:f,name:b,field:y,fields:E,value:$})=>{if(Qe(f)){const x=f?void 0:X($)?ui(y?y._f:C(E,b)._f):$;z(a,b,x),q(b,x,!1,!1,!0)}},vi=(f,b={})=>{let y=C(o,f);const E=Qe(b.disabled);return z(o,f,{...y||{},_f:{...y&&y._f?y._f:{ref:{name:f}},name:f,mount:!0,...b}}),l.mount.add(f),y?Es({field:y,disabled:b.disabled,name:f}):U(f,!0,b.value),{...E?{disabled:b.disabled}:{},...r.progressive?{required:!!b.required,min:Jt(b.min),max:Jt(b.max),minLength:Jt(b.minLength),maxLength:Jt(b.maxLength),pattern:Jt(b.pattern)}:{},name:f,onChange:er,onBlur:er,ref:$=>{if($){vi(f,b),y=C(o,f);const x=X($.value)&&$.querySelectorAll&&$.querySelectorAll("input,select,textarea")[0]||$,I=yv(x),H=y._f.refs||[];if(I?H.find(J=>J===x):x===y._f.ref)return;z(o,f,{_f:{...y._f,...I?{refs:[...H.filter(li),x,...Array.isArray(C(i,f))?[{}]:[]],ref:{type:x.type,name:f}}:{ref:x}}}),U(f,!1,void 0,x)}else y=C(o,f,{}),y._f&&(y._f.mount=!1),(r.shouldUnregister||b.shouldUnregister)&&!(uv(l.array,f)&&s.action)&&l.unMount.add(f)}}},Ps=()=>r.shouldFocusError&&Mr(o,zr,l.mount),sm=f=>{Qe(f)&&(v.state.next({disabled:f}),Mr(o,b=>{b.disabled=f},0,!1))},Os=(f,b)=>async y=>{y&&(y.preventDefault&&y.preventDefault(),y.persist&&y.persist());let E=Le(a);if(v.state.next({isSubmitting:!0}),r.resolver){const{errors:$,values:x}=await M();n.errors=$,E=x}else await te(o);ie(n.errors,"root"),_e(n.errors)?(v.state.next({errors:{}}),await f(E,y)):(b&&await b({...n.errors},y),Ps(),setTimeout(Ps)),v.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:_e(n.errors),submitCount:n.submitCount+1,errors:n.errors})},lm=(f,b={})=>{C(o,f)&&(X(b.defaultValue)?ct(f,C(i,f)):(ct(f,b.defaultValue),z(i,f,b.defaultValue)),b.keepTouched||ie(n.touchedFields,f),b.keepDirty||(ie(n.dirtyFields,f),n.isDirty=b.defaultValue?F(f,C(i,f)):F()),b.keepError||(ie(n.errors,f),c.isValid&&_()),v.state.next({...n}))},Is=(f,b={})=>{const y=f?Le(f):i,E=Le(y),$=f&&!_e(f)?E:i;if(b.keepDefaultValues||(i=y),!b.keepValues){if(b.keepDirtyValues||g)for(const x of l.mount)C(n.dirtyFields,x)?z($,x,C(a,x)):ct(x,C($,x));else{if(ri&&X(f))for(const x of l.mount){const I=C(o,x);if(I&&I._f){const H=Array.isArray(I._f.refs)?I._f.refs[0]:I._f.ref;if(Fr(H)){const J=H.closest("form");if(J){J.reset();break}}}}o={}}a=e.shouldUnregister?b.keepDefaultValues?Le(i):{}:Le($),v.array.next({values:{...$}}),v.values.next({values:{...$}})}l={mount:new Set,unMount:new Set,array:new Set,watch:new Set,watchAll:!1,focus:""},!s.mount&&t(),s.mount=!c.isValid||!!b.keepIsValid,s.watch=!!e.shouldUnregister,v.state.next({submitCount:b.keepSubmitCount?n.submitCount:0,isDirty:b.keepDirty?n.isDirty:!!(b.keepDefaultValues&&!lt(f,i)),isSubmitted:b.keepIsSubmitted?n.isSubmitted:!1,dirtyFields:b.keepDirtyValues?n.dirtyFields:b.keepDefaultValues&&f?ci(i,f):{},touchedFields:b.keepTouched?n.touchedFields:{},errors:b.keepErrors?n.errors:{},isSubmitSuccessful:b.keepIsSubmitSuccessful?n.isSubmitSuccessful:!1,isSubmitting:!1})},As=(f,b)=>Is(Je(f)?f(a):f,b);return{control:{register:vi,unregister:hi,getFieldState:Ss,handleSubmit:Os,setError:Cs,_executeSchema:M,_getWatch:Q,_getDirty:F,_updateValid:_,_removeUnmounted:j,_updateFieldArray:A,_updateDisabledField:Es,_getFieldArray:pe,_reset:Is,_resetDefaultValues:()=>Je(r.defaultValues)&&r.defaultValues().then(f=>{As(f,r.resetOptions),v.state.next({isLoading:!1})}),_updateFormState:f=>{n={...n,...f}},_disableForm:sm,_subjects:v,_proxyFormState:c,get _fields(){return o},get _formValues(){return a},get _state(){return s},set _state(f){s=f},get _defaultValues(){return i},get _names(){return l},set _names(f){l=f},get _formState(){return n},set _formState(f){n=f},get _options(){return r},set _options(f){r={...r,...f}}},trigger:pi,register:vi,handleSubmit:Os,watch:am,setValue:ct,getValues:$s,reset:As,resetField:lm,clearErrors:om,unregister:hi,setError:Cs,setFocus:(f,b={})=>{const y=C(o,f),E=y&&y._f;if(E){const $=E.refs?E.refs[0]:E.ref;$.focus&&($.focus(),b.shouldSelect&&$.select())}},getFieldState:Ss}}function di(e={}){const t=xe.useRef(),r=xe.useRef(),[n,o]=xe.useState({isDirty:!1,isValidating:!1,isLoading:Je(e.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},errors:{},disabled:!1,defaultValues:Je(e.defaultValues)?void 0:e.defaultValues});t.current||(t.current={...Sv(e,()=>o(a=>({...a}))),formState:n});const i=t.current.control;return i._options=e,hv({subject:i._subjects.state,next:a=>{pv(a,i._proxyFormState,i._updateFormState,!0)&&o({...i._formState})}}),xe.useEffect(()=>i._disableForm(e.disabled),[i,e.disabled]),xe.useEffect(()=>{if(i._proxyFormState.isDirty){const a=i._getDirty();a!==n.isDirty&&i._subjects.state.next({isDirty:a})}},[i,n.isDirty]),xe.useEffect(()=>{e.values&&!lt(e.values,r.current)?(i._reset(e.values,i._options.resetOptions),r.current=e.values):i._resetDefaultValues()},[e.values,i]),xe.useEffect(()=>{i._state.mount||(i._updateValid(),i._state.mount=!0),i._state.watch&&(i._state.watch=!1,i._subjects.state.next({...i._formState})),i._removeUnmounted()}),t.current.formState=fv(n,i),t.current}var ks=function(e,t,r){if(e&&"reportValidity"in e){var n=C(r,t);e.setCustomValidity(n&&n.message||""),e.reportValidity()}},Cv=function(e,t){var r=function(o){var i=t.fields[o];i&&i.ref&&"reportValidity"in i.ref?ks(i.ref,o,e):i.refs&&i.refs.forEach(function(a){return ks(a,o,e)})};for(var n in t.fields)r(n)},Ev=function(e,t){t.shouldUseNativeValidation&&Cv(e,t);var r={};for(var n in e){var o=C(t.fields,n),i=Object.assign(e[n]||{},{ref:o&&o.ref});if(Ov(t.names||Object.keys(e),n)){var a=Object.assign({},Pv(C(r,n)));z(a,"root",i),z(r,n,a)}else z(r,n,i)}return r},Pv=function(e){return Array.isArray(e)?e.filter(Boolean):[]},Ov=function(e,t){return e.some(function(r){return r.startsWith(t+".")})},Iv=function(e,t){for(var r={};e.issues.length;){var n=e.issues[0];if(n.path){var o=n.path.map(function(s){return s.key}).join(".");if(r[o]||(r[o]={message:n.message,type:n.validation}),t){var i=r[o].types,a=i&&i[n.validation];r[o]=ls(o,t,r,n.validation,a?[].concat(a,n.message):n.message)}e.issues.shift()}}return r},fi=function(e,t,r){return r===void 0&&(r={}),function(n,o,i){try{return Promise.resolve(function(a,s){try{var l=function(){function u(c){return{values:r.raw?n:c,errors:{}}}var p=Object.assign({},{abortEarly:!1,abortPipeEarly:!1},t);return r.mode==="sync"?u(Rt(e,n,p)):Promise.resolve($d(e,n,p)).then(u)}()}catch(u){return s(u)}return l&&l.then?l.then(void 0,s):l}(0,function(a){if(a instanceof en)return{values:{},errors:Ev(Iv(a,!i.shouldUseNativeValidation&&i.criteriaMode==="all"),i)};throw a}))}catch(a){return Promise.reject(a)}}};const Av=27,Tv=12,Dv=10,Nv=e=>{const t=Object.fromEntries(new FormData(e).entries());Object.keys(t).length&&e.dispatchEvent(new Event("submit",{bubbles:!0}))},Mv=Or("enum"),Fv=e=>{const t={min:e.minSelected??0,max:e.maxSelected??e.options.length};return fi(Se({checked:io(rn(ro()),r=>Object.entries(r).filter(([n,o])=>o).map(([n,o])=>n),[Vt(t.max,`Please select at most ${t.max} option${t.max!==1?"s":""}`),oo(t.min,`Please select at least ${t.min} option${t.min!==1?"s":""}`)])}))},Lv=({input:e,onSubmitSuccess:t})=>{var l,u;const r=e.key?(l=T.current$.value.flow)==null?void 0:l.data.submissions[e.key]:void 0,n=(e.config.minSelected===1||e.config.minSelected===void 0)&&e.config.maxSelected===1,{register:o,handleSubmit:i,formState:{errors:a}}=di({defaultValues:{checked:n?{}:Mv(r)?Object.fromEntries(r.value.map(p=>[p,!0])):{}},resolver:Fv(e.config)}),s=ti();return d("form",{noValidate:!0,class:"pr-2.5",onChange:p=>{n&&Nv(p.currentTarget)},onSubmit:i(p=>{const c=p.checked;t({type:"enum",value:c})}),children:[d("div",{class:"flex items-center gap-1",children:[d("ul",{style:{maxHeight:6.5*Av+5*Tv+2*Dv},class:He("gutter-stable flex w-full flex-1 flex-wrap gap-3 overflow-y-auto rounded-xl p-2.5 pr-4",{"justify-center":e.config.options.length===1}),children:e.config.options.map((p,c)=>{const v=`checked.${p.value}`,{ref:g,...m}=o(v);return d("li",{class:"relative",children:[d("input",{autoFocus:c===0,ref:h=>{h&&c===0&&(s.current=h),g(h)},id:v,...m,class:"peer sr-only h-full",type:"checkbox"}),d("label",{class:"bg-lowest hover:bg-neutral-2 active:outline-neutral-8 ease-expo-out outline-divider text-neutral-11 peer-checked:outline-accent-7 peer-checked:bg-accent-2 peer-checked:text-accent-9 peer-focus-visible:ring-accent-9 peer-focus-visible:ring-offset-accent-7 block cursor-pointer select-none rounded-2xl px-3 py-1.5 outline outline-1 ring-0 ring-transparent transition-all selection:bg-transparent peer-focus-visible:ring-4",htmlFor:v,children:p.label})]},p.value)})}),d("div",{class:"flex flex-col items-center gap-2",children:[!n&&d(Ct,{}),e.config.minSelected===0&&d(Et,{type:"button",onClick:()=>t({type:"enum",value:[]})})]})]}),d("div",{class:"px-1",children:d(Nr,{error:(u=a.checked)==null?void 0:u.root})})]})},Rv=Or("number"),Br={number:()=>"Please enter a valid number",min:e=>`Please enter a number greater than or equal to ${e}`,max:e=>`Please enter a number less than or equal to ${e}`,decimalCases:e=>`Please enter a number with at most ${e} decimal cases`},Vv=e=>{const t=e.min??Number.MIN_SAFE_INTEGER,r=e.max??Number.MAX_SAFE_INTEGER,n=e.decimalCases??0;return fi(Se({number:tn(Br.number(),[Od(t,Br.min(t)),Pd(r,Br.max(r)),Cd(o=>o===Number(o.toFixed(n)),Br.decimalCases(n))])}))},jv=({input:e,onSubmitSuccess:t})=>{var p;const r=e.config.defaultValue,n=e.key?(p=T.current$.value.flow)==null?void 0:p.data.submissions[e.key]:void 0,{register:o,handleSubmit:i,formState:{errors:a}}=di({defaultValues:{number:r?Number(r):Rv(n)?n.value:void 0},resolver:Vv(e.config)}),{ref:s,...l}=o("number",{required:!e.config.optional,valueAsNumber:!0}),u=L();return ve(()=>{u.current&&(u.current.focus(),u.current.select())},[]),d("form",{class:"flex flex-col gap-1 p-2.5",onSubmit:i(c=>{c.number!==void 0&&t({type:"number",value:c.number})}),children:[d("div",{class:"flex items-center gap-2",children:[d("div",{class:"relative min-w-0 flex-grow",children:[d("input",{...l,id:"chat-input",autocomplete:"off",autoCapitalize:"off",autoCorrect:"off",autoFocus:!0,ref:c=>{c&&(u.current=c),s(c)},type:"text",min:e.config.min,max:e.config.max,class:"outline-divider ease-expo-out placeholder:text-neutral-10 text-neutral-12 focus-visible:outline-accent-7 caret-accent-9 bg-lowest [type=number:-webkit-inner-spin-button] w-full rounded-full px-3 py-1 text-base outline outline-2 transition-all [-webkit-outer-spin-button:none]",placeholder:e.config.placeholder}),e.config.optional&&d(Et,{class:"absolute right-0 top-0",onClick:()=>t(null)})]}),d(Ct,{})]}),d(Nr,{error:a.number})]})},Bv=({input:e,onSubmitSuccess:t})=>d("div",{class:"flex flex-col items-center py-3",children:d("button",{class:"bg-accent-9 hover:bg-accent-10 active:bg-submit-bg-active hover:border-accent-10 active:border-submit-bg-active border-accent-9 ring-accent-6 focus-visible:outline-accent-8 ring-offset-neutral-1 flex cursor-pointer rounded-full border border-solid px-5 py-3 pr-4 text-white outline-none ring-1 ring-offset-[1.5px] transition-all duration-300 focus-visible:outline-2 active:ring-2 active:ring-offset-2",name:e.key,onClick:()=>{t(null)},children:d("span",{class:"flex items-center gap-1.5",children:[d("span",{class:"inline-flex items-center text-sm font-medium",children:e.config.label}),d("svg",{stroke:"currentColor","stroke-width":"1.5",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[d("path",{d:"M4 8L8 4L12 8"}),d("path",{d:"M8 4V13"})]})]})})}),It={empty:"Please enter some text",email:"That doesn’t look like a valid email address",phone:"That doesn’t look like a valid phone number",url:"That doesn’t look like a valid URL"},zv=he(It.phone,[Id(/^\+?[0-9 -]+$/,It.phone)]),Uv={email:{type:"email",inputMode:"email",formNoValidate:!0},phone:{type:"tel",inputMode:"tel"},text:{type:"text",inputMode:"text"},url:{type:"url",inputMode:"url",formNoValidate:!0}},Hv=Or("string"),qv=e=>{const t=`Please enter no more than ${e.maxChars} characters`;return fi(Se({text:{email:he(It.email,[Ed(It.email),Vt(e.maxChars??1/0,t)]),phone:io(zv,r=>r.replace(/[^0-9]/g,""),[Vt(e.maxChars??1/0,t)]),text:he([oo(1,It.empty),Vt(e.maxChars??1/0,t)]),url:he([Ad(It.url),Vt(e.maxChars??1/0,t)])}[e.format]}))},Kv=({input:e,onSubmitSuccess:t})=>{var p;const r=e.key?(p=T.current$.value.flow)==null?void 0:p.data.submissions[e.key]:void 0,n=e.config.defaultValue,{register:o,handleSubmit:i,formState:{errors:a}}=di({defaultValues:{text:n||(Hv(r)?r.value:"")},resolver:qv(e.config)}),{ref:s,...l}=o("text",{required:!e.config.optional}),u=L();return ve(()=>{u.current&&(u.current.focus(),u.current.select())},[]),d("form",{noValidate:!0,class:"flex flex-col gap-1 p-2.5",onSubmit:i(c=>{t({type:"string",value:c.text})}),children:[d("div",{class:"flex items-center gap-2",children:[d("div",{class:"relative min-w-0 flex-grow",children:[d("input",{id:"chat-input",...l,...Uv[e.config.format],autocomplete:"off",autoCapitalize:"off",autoCorrect:"off",autoFocus:!0,ref:c=>{c&&(u.current=c),s(c)},class:"outline-divider ease-expo-out placeholder:text-neutral-10 text-neutral-12 focus-visible:outline-accent-7 caret-accent-9 bg-lowest w-full rounded-full px-3 py-1 text-base outline outline-2 transition-all",placeholder:e.config.placeholder}),e.config.optional&&d(Et,{class:"absolute right-0 top-0",onClick:()=>t(null)})]}),d(Ct,{})]}),d(Nr,{error:a.text})]})},Wv=()=>{var o;const e=(o=T.current$.value.flow)==null?void 0:o.data.currentInput,[t,r]=Vh(),n=L(null);return T.inputHeight$.value=r.height,V(()=>{const i=n.current;if(i)return i.addEventListener("transitionstart",Z.scrollToEnd.smooth),i.addEventListener("transitioncancel",Z.scrollToEnd.smooth),i.addEventListener("transitionend",Z.scrollToEnd.smooth),()=>{i.removeEventListener("transitionstart",Z.scrollToEnd.smooth),i.removeEventListener("transitioncancel",Z.scrollToEnd.smooth),i.removeEventListener("transitionend",Z.scrollToEnd.smooth)}},[]),d("div",{ref:n,class:"ease-expo-out absolute bottom-0 w-full overflow-hidden rounded-b-3xl backdrop-blur-xl transition-all duration-700 will-change-[height]",style:{height:r.height},children:d("div",{ref:t,class:"border-divider flex flex-col justify-end border-t",children:We({input:e}).with({input:Oe.nullish},()=>d("div",{class:"flex items-center gap-2 p-2.5",children:[d("input",{"aria-hidden":"true",id:"chat-input",class:"outline-divider flex-grow rounded-full bg-transparent px-3 py-1 text-base outline outline-2",disabled:!0}),d(Ct,{disabled:!0,"aria-hidden":"true",tabIndex:-1})]})).with({input:{type:"text"}},i=>d(Kv,{onSubmitSuccess:Z.onSubmitSuccessFn$.value,...i})).with({input:{type:"multiple-choice"}},i=>d(Lv,{onSubmitSuccess:Z.onSubmitSuccessFn$.value,...i})).with({input:{type:"boolean"}},i=>d(ev,{onSubmitSuccess:Z.onSubmitSuccessFn$.value,...i})).with({input:{type:"file"}},i=>d(sv,{onSubmitSuccess:Z.onSubmitSuccessFn$.value,...i})).with({input:{type:"submit"}},i=>d(Bv,{onSubmitSuccess:Z.onSubmitSuccessFn$.value,...i})).with({input:{type:"address"}},i=>d(Yh,{onSubmitSuccess:Z.onSubmitSuccessFn$.value,...i})).with({input:{type:"number"}},i=>d(jv,{onSubmitSuccess:Z.onSubmitSuccessFn$.value,...i})).exhaustive()})})},Gv=En("max-w-[min(100%,24rem)] [text-wrap:pretty] leading-snug flex-shrink min-w-[2rem] py-2 px-3 rounded-[18px] min-h-[36px] break-words relative",{variants:{side:{left:"bg-bubble-weak-bg text-neutral-12 shadow-surface-sm outline outline-1 outline-bubble-weak rounded-bl-md",right:"ml-auto bg-accent-9 text-white rounded-br-md shadow-surface-sm shadow-bubble-strong-shadow"},animate:{true:"animate-bubble-in",false:""}},defaultVariants:{side:"left"}}),Yv=({children:e,className:t,animate:r,side:n,...o})=>d("p",{style:{transformOrigin:n==="left"?"0% 50%":"100% 50%"},class:Gv({className:t,side:n,animate:r}),...o,children:e}),Zv=({message:e})=>d("div",{class:"bg-accent-3 flex w-full items-center justify-center overflow-hidden rounded-xl px-2 py-2",children:d("a",{onClick:e.onClick,class:"bg-lowest shadow-surface-sm ring-accent-6 hover:ring-accent-8 active:bg-accent-2 active:text-accent-10 text-accent-9 focus-visible:ring-accent-7/50 text-wrap-balance flex items-center gap-1.5 rounded-full py-2 pl-4 pr-2.5 text-center no-underline ring-1 transition-all focus:outline-none focus-visible:ring-4 focus-visible:ring-offset-2",target:"_blank",href:e.href,children:[e.text,d("svg",{class:"flex-none",width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:d("path",{d:"M3.64645 11.3536C3.45118 11.1583 3.45118 10.8417 3.64645 10.6465L10.2929 4L6 4C5.72386 4 5.5 3.77614 5.5 3.5C5.5 3.22386 5.72386 3 6 3L11.5 3C11.6326 3 11.7598 3.05268 11.8536 3.14645C11.9473 3.24022 12 3.36739 12 3.5L12 9.00001C12 9.27615 11.7761 9.50001 11.5 9.50001C11.2239 9.50001 11 9.27615 11 9.00001V4.70711L4.35355 11.3536C4.15829 11.5488 3.84171 11.5488 3.64645 11.3536Z",fill:"currentColor","fill-rule":"evenodd","clip-rule":"evenodd"})})]})}),Xv=({className:e,...t})=>(V(()=>{Z.scrollToEnd.smooth()}),d("div",{"aria-hidden":!0,children:Z.isBotTyping$.value===!0?d("div",{"aria-label":"Typing…",class:He("flex gap-1 p-4",e),...t,children:Array.from({length:3},(r,n)=>d("div",{class:"bg-accent-9 h-1.5 w-1.5 animate-bounce rounded-full",style:{animationDelay:`${-n*200}ms`}}))}):void 0})),Qv={bot:"left",user:"right"},Jv=En("w-full select-none py-2 text-wrap-balance text-center text-[10px] uppercase tracking-widest drop-shadow-[0_1.5px_var(--i-color-n-1)]",{variants:{variant:{info:"text-neutral-8",warning:"text-[#FFC107]",error:"text-error-9",success:"text-[#4CAF50]"}}}),em=({lastSentMessageFooter:e})=>{var r;const t=((r=T.current$.value.flow)==null?void 0:r.data.messages)??[];return V(()=>{Z.scrollToEnd.smooth()},[t.length]),d("ol",{"aria-label":"Chat messages",class:"mt-auto flex flex-col justify-end gap-2 p-2 pt-[calc(var(--header-height)+1rem)]",children:[t.map((n,o)=>d(G,{children:d("li",{class:"flex",children:We(n).with({type:"system"},i=>d("p",{class:Jv({variant:i.variant}),children:i.text})).with({type:"text",author:Oe.union("bot","user")},i=>{const a=i.author==="user"&&!t.slice(o+1).some(l=>l.type==="text"&&l.author==="user"),s=o===t.length-1;return d(Yv,{animate:s,side:Qv[i.author],children:[i.text,a?e:null]},o)}).with({type:"link"},i=>d(Zv,{message:i})).with({type:"image"},i=>d("img",{class:"shadow-surface-md w-full max-w-[min(100%,24rem)] rounded-2xl",src:i.url,style:{aspectRatio:i.width/i.height}})).with({type:"file"},i=>d(iv,{class:i.author==="bot"?void 0:"ml-auto",file:{name:i.fileName,sizeKb:i.fileSizeKb}})).exhaustive()})},o)),d(Xv,{},"typing")]})},tm=({logger:e,apiClient:t,analytics:r})=>{const{flow:n}=T.current$.value;ke(n,"Flow is required to exist to show chatbot body");const o=T.viewState$.value,{chatRef:i,chatService:a}=qh(),[s,l]=W();return ve(()=>{o==="maximised"&&Z.scrollToEnd.instant()},[o]),ve(()=>{const{state:u,flow:p}=T.current$.peek();if(u!=="loaded")throw new Error(uh.invalid_state);let c=p.data.nodeHistory.at(-1);if(Z.scrollToEnd.instant(),T.setInput(void 0),p.data.isFinished)return;c===void 0?(c=Va(n.nodes).id,T.setCurrentNodeId(c),r.log({event:"FLOW_START",properties:{flow_id:n.id,flow_version:n.version,flow_session_id:p.data.flowSessionId,flow_build:n.build},customProperties:n.context})):T.removeMessagesSentByNodeIds([c]);const{interpret:v,abort:g,undo:m}=$h({context:n.context,analytics:r,apiClient:t,logger:e,flow:n,chatService:a,getSubmissions:()=>{var h;return(h=T.current$.peek().flow)==null?void 0:h.data.submissions},onInterpret:(h,w)=>{const k=T.current$.peek().flow;ke(k),w&&(k.data.sequence=k.data.sequence+1,r.log({event:"FLOW_NODE",properties:{flow_id:n.id,flow_version:n.version,from_node_id:w.id,flow_build:n.build,to_node_id:h.id,sequence:k.data.sequence,flow_session_id:k.data.flowSessionId},customProperties:n.context})),T.setCurrentNodeId(h.id)},onFlowEnd:async()=>{T.markAsFinished();const h=T.current$.peek().flow;ke(h),r.log({event:"FLOW_END",properties:{flow_id:n.id,flow_version:n.version,flow_session_id:h.data.flowSessionId,flow_build:n.build},customProperties:n.context})}});return l(()=>m),v(c),g},[r,t,a,e,n]),d(G,{children:[d("div",{ref:i,className:"hide-scrollbars relative flex w-full max-w-full flex-grow flex-col overflow-y-scroll",style:{WebkitOverflowScrolling:"touch",paddingBottom:T.inputHeight$.value},children:d(em,{lastSentMessageFooter:n.data.isFinished||!s?null:d(nm,{undoFn:s})})}),d(Wv,{})]})},rm=e=>"key"in e.data&&e.data.key?[e.data.key]:"keys"in e.data?Object.values(e.data.keys).filter(t=>typeof t=="string"):[],nm=({undoFn:e})=>d("div",{class:"absolute bottom-0 right-0 flex w-full translate-y-full justify-end",children:d("button",{class:"fr touch-hitbox text-neutral-9 hover:text-neutral-12 rounded-full p-1 text-right text-xs transition-all",onClick:async()=>{const{flow:t}=T.current$.peek();ke(t);const{removed:r}=e(t.data.nodeHistory),n=t.data.nodeHistory.splice(-r);n.length!==0&&(T.removeMessagesSentByNodeIds(n),T.setInput(void 0),n.pop(),n.map(o=>t.nodes.find(i=>i.id===o)).filter(Boolean).flatMap(rm).forEach(o=>delete t.data.submissions[o]),T.current$.value={...T.current$.value})},children:"Undo"})}),im=Object.freeze(Object.defineProperty({__proto__:null,ChatbotBody:tm},Symbol.toStringTag,{value:"Module"}))})();
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const index = require("./index-1a26aac3.cjs");
3
+ const index = require("./index-ff0da338.cjs");
4
4
  require("@inploi/sdk");
5
5
  const isIfBlockConditionMet = (ifBlock, {
6
6
  context,
@@ -1127,7 +1127,7 @@ const useChatService = () => {
1127
1127
  smooth: () => {
1128
1128
  if (!chatRef.current)
1129
1129
  return;
1130
- if (chatRef.current.scrollHeight - chatRef.current.scrollTop <= chatRef.current.clientHeight * 1.5) {
1130
+ if (chatRef.current.scrollHeight - chatRef.current.scrollTop <= chatRef.current.clientHeight * 2) {
1131
1131
  chatRef.current.scrollTo({
1132
1132
  top: chatRef.current.scrollHeight,
1133
1133
  behavior: "smooth"
@@ -1,4 +1,4 @@
1
- import { g as get$1, i as isString$1, k as kbToReadableSize, a as getHeadOrThrow, b as invariant, A as AbortedError, N, c as getFlowSubmissionsPayload, _, d as getDefaultExportFromCjs, h, e as _$1, p, F, o as o$1, f as clsx, y, s as store, j as a$2, l as debounce$1, m as k, n as parse, q as picklist, r as isSubmissionOfType, C as Cn, t as parseAsync, V as ValiError, u as object, v as transform, w as maxLength, x as minLength, z as record, B as boolean, D as number, E as minValue, G as maxValue, H as custom, I as string, J as email, K as url, L as regex, M as cva, O as ERROR_MESSAGES } from "./index-065ff0bb.js";
1
+ import { g as get$1, i as isString$1, k as kbToReadableSize, a as getHeadOrThrow, b as invariant, A as AbortedError, N, c as getFlowSubmissionsPayload, _, d as getDefaultExportFromCjs, h, e as _$1, p, F, o as o$1, f as clsx, y, s as store, j as a$2, l as debounce$1, m as k, n as parse, q as picklist, r as isSubmissionOfType, C as Cn, t as parseAsync, V as ValiError, u as object, v as transform, w as maxLength, x as minLength, z as record, B as boolean, D as number, E as minValue, G as maxValue, H as custom, I as string, J as email, K as url, L as regex, M as cva, O as ERROR_MESSAGES } from "./index-03f425b8.js";
2
2
  import "@inploi/sdk";
3
3
  const isIfBlockConditionMet = (ifBlock, {
4
4
  context,
@@ -1125,7 +1125,7 @@ const useChatService = () => {
1125
1125
  smooth: () => {
1126
1126
  if (!chatRef.current)
1127
1127
  return;
1128
- if (chatRef.current.scrollHeight - chatRef.current.scrollTop <= chatRef.current.clientHeight * 1.5) {
1128
+ if (chatRef.current.scrollHeight - chatRef.current.scrollTop <= chatRef.current.clientHeight * 2) {
1129
1129
  chatRef.current.scrollTo({
1130
1130
  top: chatRef.current.scrollHeight,
1131
1131
  behavior: "smooth"
@@ -5298,7 +5298,7 @@ const StatusBar = ({
5298
5298
  })
5299
5299
  });
5300
5300
  };
5301
- const ChatbotBody = M(() => import("./chatbot-body-a94ce4fa.js").then((module) => module.ChatbotBody));
5301
+ const ChatbotBody = M(() => import("./chatbot-body-f273e7b6.js").then((module) => module.ChatbotBody));
5302
5302
  const chatbotContentClass = cva("selection:bg-accent-4 selection:text-accent-12 fixed bottom-2 left-2 right-2 isolate mx-auto max-h-full max-w-[450px] focus:outline-none", {
5303
5303
  variants: {
5304
5304
  view: {
@@ -5299,7 +5299,7 @@ const StatusBar = ({
5299
5299
  })
5300
5300
  });
5301
5301
  };
5302
- const ChatbotBody = M(() => Promise.resolve().then(() => require("./chatbot-body-9b42fa19.cjs")).then((module2) => module2.ChatbotBody));
5302
+ const ChatbotBody = M(() => Promise.resolve().then(() => require("./chatbot-body-55f3ecd6.cjs")).then((module2) => module2.ChatbotBody));
5303
5303
  const chatbotContentClass = cva("selection:bg-accent-4 selection:text-accent-12 fixed bottom-2 left-2 right-2 isolate mx-auto max-h-full max-w-[450px] focus:outline-none", {
5304
5304
  variants: {
5305
5305
  view: {
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const index = require("./index-1a26aac3.cjs");
3
+ const index = require("./index-ff0da338.cjs");
4
4
  require("@inploi/sdk");
5
5
  exports.chatbotPlugin = index.chatbotPlugin;
@@ -1,4 +1,4 @@
1
- import { P } from "./index-065ff0bb.js";
1
+ import { P } from "./index-03f425b8.js";
2
2
  import "@inploi/sdk";
3
3
  export {
4
4
  P as chatbotPlugin
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inploi/plugin-chatbot",
3
- "version": "3.20.2",
3
+ "version": "3.20.3",
4
4
  "type": "module",
5
5
  "main": "dist/plugin-chatbot.js",
6
6
  "types": "dist/index.d.ts",
@@ -66,10 +66,10 @@
66
66
  "vite": "^4.4.5",
67
67
  "vite-plugin-dts": "^3.7.0",
68
68
  "vite-tsconfig-paths": "^4.2.1",
69
- "@inploi/core": "1.14.2",
70
69
  "@inploi/design-tokens": "0.2.1",
71
70
  "@inploi/sdk": "1.14.1",
72
71
  "eslint-config-custom": "0.1.0",
72
+ "@inploi/core": "1.14.2",
73
73
  "tsconfig": "0.1.0"
74
74
  },
75
75
  "msw": {