@inploi/plugin-chatbot 3.28.2 → 3.28.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 Bg=Object.defineProperty;var zg=(Qe,be,Pe)=>be in Qe?Bg(Qe,be,{enumerable:!0
42
42
  `,Ya="isdk",kp={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"},$p=()=>({getOrCreateChatbotElement:()=>{const e=document.getElementById(Ya);if(e)return document.body.appendChild(e),e;const t=document.createElement("div");return document.body.appendChild(t),t.id=Ya,t}});var Sp=["1","2","3","4","5","6","7","8","9","10","11","12"],Cp={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]}},Ep=(e,t=1,r)=>n=>{const[i,o]=Cp[r][n];return"oklch("+i+"% "+o*t+" "+e+")"},Wn=e=>{const t=Ep(e.hue,e.chroma,e.mode);return Object.fromEntries(Sp.map(r=>[e.prefix+r,e.transform(t(r))]))},Gn=e=>e,Ip=e=>{const t=Object.keys(e).flatMap(r=>{const n=e[r];return typeof n=="object"&&n!==null?Object.keys(n).map(i=>{const o=n[i];return[`${String(r)}.${i}`,o]}):[[r,n]]});return Object.fromEntries(t)},Dr=e=>!!e&&typeof e=="object"&&!Array.isArray(e),Yn=(e,...t)=>{if(!t.length)return e;const r=t.shift();if(Dr(e)&&Dr(r))for(const n in r){const i=r[n];if(Dr(i)){e[n]||Object.assign(e,{[n]:{}});const o=e[n];Dr(o)&&Yn(o,i)}else Object.assign(e,{[n]:r[n]})}return Yn(e,...t)},Op=e=>{function t(r,n){const i=[e.prefix,n.toString().replace(/\./g,"-")].join("");return r==="declaration"?`--${i}`:`var(--${i})`}return t},Tp=()=>({core:e=>({semantic:t=>({component:r=>({from:n=>{const{theme:i,getToken:o}=n,a=p=>o("reference",p.toString()),s=e({theme:i}),l=t({theme:i,core:a,raw:{core:s}}),d=r({theme:i,core:a,semantic:a,raw:{core:s,semantic:l}}),f=Ip(Yn(s,l,d)),c=([p,m],g)=>{const v=[g,p].filter(Boolean).join(".");return typeof m=="object"?Object.entries(m).flatMap(w=>c(w,v)):[[n.getToken("declaration",v),m]]};return{values:f,declarations:Object.fromEntries(Object.entries(f).flatMap(p=>c(p))),ref:p=>o("reference",p.toString())}}})})})});const[Xn,Zn,Xa]=["oklch(0% 0 0)","oklch(100% 0 0)","transparent"],Ap=Tp().core(({theme:e})=>({color:{black:Xn,white:Zn,lowest:e.mode==="light"?Zn:Xn,highest:e.mode==="light"?Xn:Zn,...Wn({prefix:"a-",hue:e.hue,chroma:e.chroma,mode:e.mode,transform:Gn}),...Wn({prefix:"n-",hue:e.hue,chroma:.05,mode:e.mode,transform:Gn}),...Wn({prefix:"e-",hue:20,chroma:e.chroma,mode:e.mode,transform:Gn})},typography:{}})).semantic(({core:e,raw:t,theme:r})=>{const n=(i,o)=>t.core.color[i].replace(")",` / ${o})`);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:Xa,"bg-hover":n("n-10",.4),"bg-active":n("n-10",.5)}}}).component(({raw:e,theme:t,semantic:r,core:n})=>{const i=(o,a)=>e.core.color[o].replace(")",` / ${a})`);return{app:{bg:n(t.mode==="dark"?"color.n-1":"color.n-2")},overlay:{bg:i("black",.4)},bubble:{"weak-bg":n(t.mode==="dark"?"color.n-3":"color.lowest"),"weak-outline":r("color.divider"),"strong-shadow":i("a-9",.05)},"status-bar":{bg:i("n-2",.8),"bg-button":Xa,"bg-button-hover":i("n-10",.4),"bg-button-active":i("n-10",.5)},"submit-button":{"bg-active":n(t.mode==="dark"?"color.a-8":"color.a-11")}}}),Pp=Op({prefix:"i-"}),Np=e=>{const t=Ap.from({theme:e,getToken:Pp}),r=Object.entries(t.declarations).map(([n,i])=>`${n}: ${i};`);return`#isdk {
43
43
  ${r.concat(r).join(`
44
44
  `)}
45
- }`},Za=({context:e,schema:t,logger:r})=>{if(t)for(const n in t){const i=t[n];if(!i)continue;const o=Pt(e,n,null);if(i.required&&o===null){const a=`Configuration error in context: ${n} is required`;throw r.error(a),new Error(a)}switch(i.type){case"number":if(typeof o!="number")throw new Error(`Configuration error in context: ${n} is not a number`);break;case"string":if(typeof o!="string")throw new Error(`Configuration error in context: ${n} is not a string`);break;default:i.type}}},Dp=({_internal_domManager:e=$p(),theme:t})=>Qe(({apiClient:r,logger:n,analytics:i})=>{let o=!1;const a=()=>{if(typeof window>"u")return;const s=[D("style",{id:"inploi-chatbot-styles"},xp),D("style",{id:"inploi-chatbot-theme"},Np(t))],l=e.getOrCreateChatbotElement();gt(D(Y,{},[s,D(yp,{apiClient:r,logger:n,analytics:i})]),l),o=!0};return{prepare:async()=>{if(!(typeof window>"u"))try{if(o)return;a(),n.info("Chatbot plugin prepared")}catch(s){n.error("Error preparing chatbot plugin",s)}},fetchFlowByJobId:async(s,l)=>{const d=new URLSearchParams({id_type:(l==null?void 0:l.idType)==="inploi"?"internal":"external"});return r.fetch([`/flow/job/${s}`,d.toString()].filter(Boolean).join("?")).then(f=>{const c=sr(_p,f);return{flow:c.flow,title:`Applying for “${c.job.title}”`,flowKeys:[c.job.id,...(l==null?void 0:l.flowKeys)??[]],job:{id:c.job.id,id_type:"external"},...l}})},fetchFlowById:async(s,l)=>r.fetch(`/flow/id/${s}`).then(d=>{var c;const f=sr(wp,d);return{flow:f.flow,title:"Chatbot",flowKeys:(l==null?void 0:l.flowKeys)??[],...l,analytics:{customProperties:{flow_id:f.flow.id,flow_version:f.flow.version,...(c=l==null?void 0:l.analytics)==null?void 0:c.customProperties}}}}),open:async s=>{if(!(typeof window>"u"))try{P.cancelCurrentFlow(),P.viewState$.value="maximised",o||a(),s instanceof Promise?(P.current$.value={state:"loading"},s.then(async l=>{Za({context:l.context||{},schema:l.flow.context_schema,logger:n}),P.startFlow(l)}).catch(l=>{const d=l instanceof Error?l.message:"An error occurred";P.current$.value={state:"error",error:d}})):(Za({context:s.context||{},schema:s.flow.context_schema,logger:n}),P.startFlow(s))}catch(l){n.error("Error starting flow",l)}},close:async()=>{typeof window>"u"||(P.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=Dp;const Gt=(e,{context:t,submissions:r})=>{const[n,...i]=e.data.compareKey.split(".");if(!n)return!1;const o=Qa({context:t,key:n,path:i,submissions:r});if(!o)return!1;switch(o.type){case"address":{const a=Pt(o.value,i.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 o.value!="object"||Array.isArray(o.value))return!1;const a=Pt(o.value,i.join(".")),s={...e,data:{...e.data,compareKey:"_temp"}};switch(typeof a){case"boolean":return Gt(s,{submissions:{_temp:{value:a,type:"boolean"}},context:t});case"string":return Gt(s,{submissions:{_temp:{value:a,type:"string"}},context:t});case"number":return Gt(s,{submissions:{_temp:{value:a,type:"number"}},context:t});case"object":return Array.isArray(a)&&a.every(za)?Gt(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 o.value===a;case"notEquals":return o.value!==a}break}case"string":switch(e.data.compare){case"equals":return o.value===e.data.compareValue;case"contains":return o.value?o.value.includes(e.data.compareValue):!1;case"notEquals":return o.value!==e.data.compareValue;case"notContains":return o.value?!o.value.includes(e.data.compareValue):!0}break;case"number":{try{const a=Number(e.data.compareValue);switch(e.data.compare){case"equals":return o.value===a;case"notEquals":return o.value!==a;case"greaterThan":return o.value>a;case"greaterThanOrEqualTo":return o.value>=a;case"lessThan":return o.value<a;case"lessThanOrEqualTo":return o.value<=a}}catch{return console.error(`Failed to parse number in if-block ${e.id}`,o.value),!1}break}case"enum":switch(e.data.compare){case"equals":return o.value.length===1&&o.value[0]===e.data.compareValue;case"notEquals":return o.value.length===1&&o.value[0]!==e.data.compareValue;case"contains":return o.value.includes(e.data.compareValue);case"notContains":return!o.value.includes(e.data.compareValue)}break}return!1},Mp=/{{\s*([^}]+?)\s*(?:\|\s*([^}]+?)\s*)?}}/g,Re=(e,{context:t,submissions:r})=>e.replace(Mp,(n,i,o="")=>{const[a,...s]=i.trim().split("."),l=Qa({key:a,path:s,submissions:r,context:t});if(!l)return o;switch(l.type){case"boolean":return l.value===!0?"true":"false";case"file":return l.value.map(d=>`${d.name} (${Ut(d.sizeKb)})`).join(", ");case"enum":return l.value.join(", ");case"address":return Object.values(l.value).filter(d=>d&&d.trim().length>0).join(", ");case"number":case"string":return l.value?l.value.toString():o;case"integration":{if(typeof l.value!="object"||Array.isArray(l.value))break;const d=Pt(l.value,s.join("."));switch(typeof d){case"boolean":return d===!0?"true":"false";case"string":return d;case"number":return d.toString();case"object":if(Array.isArray(d)&&d.every(za))return d.join(", ")}break}}return o}),Ja=({node:e,nodes:t,stopWhen:r})=>{if((r==null?void 0:r(e))===!0)return e;const n=e.nextId?t.find(i=>i.id===e.nextId):void 0;if(n)return Ja({node:n,nodes:t,stopWhen:r})},Fp=({childNode:e,nodes:t})=>{const n=t.filter(i=>i.type==="if-block").find(i=>{if(!i.branchId)return!1;const o=t.find(s=>s.id===i.branchId);if(!o)return!1;const a=Ja({node:o,nodes:t,stopWhen:s=>s.id===e.id});return!(!a||a.id!==e.id)});if(n!=null&&n.nextId)return t.find(i=>i.id===n.nextId)},Lp=({flow:e,analytics:t,logger:r,context:n,apiClient:i,getSubmissions:o,chatService:a,onFlowEnd:s,onInterpret:l})=>{let d=new AbortController;const f={...t.service,log:p=>t.service.log({...p,customProperties:{...p.customProperties,...t.customProperties}})},c=async(p,m)=>{const g=o();l==null||l(p,m);try{await Rp({flow:e,analytics:f,logger:r,apiClient:i,context:n,node:p,submissions:g,chat:{sendMessage:async v=>a.send({groupId:p.id,message:v,signal:d.signal}),userInput:async v=>a.input({input:v,signal:d.signal}),addToSubmissions:a.addToSubmissions},next:v=>{const w=v?e.nodes.find(x=>x.id===v):Fp({childNode:p,nodes:e.nodes});return w?c(w,p):s==null?void 0:s(p)},end:()=>s==null?void 0:s(p)})}catch(v){if(v instanceof qt)return;throw v}};return{interpret:async p=>{const m=e.nodes.find(g=>g.id===p)??Ba(e.nodes);return c(m)},undo:p=>{let m=1;const g=e.nodes.find(w=>w.id===p[p.length-1]);for(let w=p.length-2;w>0;w--){const x=p[w],_=e.nodes.find(I=>I.id===x);if(!_||(m++,_.type.startsWith("question-")))break}d.abort(),d=new AbortController;const v=e.nodes.find(w=>w.id===p[p.length-m]);return $e(v,"Undo failed: new start node not found"),c(v,g),{removed:m}},abort:()=>{d.abort()}}};async function Rp(e){const t=e.node;switch(t.type){case"text":return qp({...e,node:t});case"image":return Kp({...e,node:t});case"question-text":return Wp({...e,node:t});case"question-enum":return Yp({...e,node:t});case"question-number":return Gp({...e,node:t});case"question-boolean":return Xp({...e,node:t});case"question-file":return Jp({...e,node:t});case"question-address":return Zp({...e,node:t});case"end-flow":return Qp({...e,node:t});case"if-block":return Hp({...e,node:t});case"jump":return Vp({...e,node:t});case"link":return Up({...e,node:t});case"integration-application-submit":return zp({...e,node:t});case"add-submission":return Bp({...e,node:t});case"integration-workflow-get":throw Error("Workflow should be unreachable");case"identify":return jp({...e,node:t});default:throw new Error(`Unknown node: ${JSON.stringify(t)}`)}}async function jp({next:e,node:t,analytics:r,submissions:n,logger:i}){var a;if(!n)return e(t.nextId);const o=(a=n[t.data.key])==null?void 0:a.value;if(typeof o!="string"&&typeof o!="number")return i.warn(`Failed to identify user, key “${t.data.key}” is not a string or number`),e(t.nextId);r.log({event:"IDENTIFY",properties:{identifier:o.toString()}}),e(t.nextId)}async function Vp({next:e,node:t}){e(t.data.targetId)}async function Bp({next:e,node:t,logger:r,submissions:n,context:i}){if(!n){r.error("Submissions not found");return}n[t.data.key]={type:"string",value:Re(t.data.value,{submissions:n,context:i})},e(t.nextId)}async function zp({chat:e,next:t,node:r,logger:n,apiClient:i,submissions:o,analytics:a,flow:s}){const l=async d=>{d!==!0&&await e.userInput({type:"submit",key:void 0,config:{label:r.data.submitLabel}}),await e.sendMessage({type:"loading"});const{anonymous_id:f,session_id:c}=a.getSessionInfo(),p=await i.fetch("/flow/submit",{method:"POST",body:JSON.stringify({log_submit:!1,integration_id:r.data.integrationId,anonymous_id:f,session_id:c,job:s.job,submissions:sp(o||{})})}).catch(m=>m);r.data.key&&e.addToSubmissions(r.data.key,{type:"integration",value:p}),We(p).with({integration_response:N.select(N.union({service:N.optional(N.string),status:N.number,data:N.any},{service:N.optional(N.string),status:N.number,error:{message:N.string,data:N.any}}))},m=>{a.log({event:"FLOW_SUBMIT",properties:{flow_id:s.id,flow_version:s.version,flow_session_id:s.data.flowSessionId,flow_build:s.build,service:m.service??"INVALID_SERVICE",response:{status:m.status,payload:"data"in m?m.data:m.error.data??null},job:s.job}})}).otherwise(()=>{}),await We(p).with(N.union({ats_data:N.select("redirect",{redirect_url:N.string,message:N.optional(N.union(N.string,N.nullish)),button_text:N.optional(N.union(N.string,N.nullish))})},{integration_response:{data:N.select("redirect",{redirect_url:N.string,message:N.optional(N.union(N.string,N.nullish)),button_text:N.optional(N.union(N.string,N.nullish))})}}),async m=>{if(m.redirect===void 0)return;await e.sendMessage({type:"text",author:"bot",text:m.redirect.message??"Almost there! Please complete your submission here:"});const g=new URL(m.redirect.redirect_url);f&&!g.searchParams.has("anonymous_id")&&g.searchParams.set("anonymous_id",f),await e.sendMessage({type:"link",href:g.toString(),text:m.redirect.button_text??"Complete submission",onClick:()=>{if(!c){n.error("session_id not set, cannot log FLOW_REDIRECT event");return}a.log({event:"FLOW_REDIRECT",properties:{flow_build:s.build,flow_id:s.id,flow_session_id:c,flow_version:s.version,href:g.toString(),job:s.job}})}}),t(r.nextId)}).with({success:!0},async()=>{r.data.skipConfirmation!==!0&&await e.sendMessage({type:"system",variant:"success",text:"Submission completed!"}),t(r.nextId)}).with(N.union({success:!1,ats_data:N.select("error",{message:N.string})},{integration_response:{error:N.select("error",{message:N.string})}}),async m=>{var g;n.error(m.error),await e.sendMessage({type:"system",variant:"error",text:((g=m.error)==null?void 0:g.message)||"Failed to submit"}),await l(!1)}).otherwise(async m=>{n.error(m),await e.sendMessage({type:"system",variant:"error",text:"Failed to submit"}),await l(!1)})};await l(r.data.skipConfirmation)}async function Up({chat:e,next:t,node:r,submissions:n,context:i}){await e.sendMessage({type:"link",href:Re(r.data.href,{submissions:n,context:i}),text:Re(r.data.cta,{submissions:n,context:i})}),t(r.nextId)}async function Hp({submissions:e,next:t,node:r,context:n}){t(Gt(r,{submissions:e,context:n})?r.branchId:r.nextId)}async function qp({chat:e,next:t,node:r,submissions:n,context:i}){await e.sendMessage({author:"bot",type:"text",text:Re(r.data.text,{submissions:n,context:i})}),t(r.nextId)}async function Kp({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 Wp({chat:e,next:t,node:r,submissions:n,context:i}){await e.sendMessage({author:"bot",type:"text",text:Re(r.data.question,{submissions:n,context:i})});const o=r.data.format==="phone"?await e.userInput({key:r.data.key,type:"phone",config:{optional:r.data.optional,placeholder:r.data.placeholder,maxChars:r.data.maxChars,minChars:r.data.minChars}}):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,minChars:r.data.minChars}});o===null?await e.sendMessage({type:"system",variant:"info",text:"Skipped"}):await e.sendMessage({author:"user",type:"text",text:o.value}),t(r.nextId)}async function Gp({chat:e,next:t,node:r,submissions:n,context:i}){await e.sendMessage({author:"bot",type:"text",text:Re(r.data.question,{submissions:n,context:i})});const o=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}});o===null?await e.sendMessage({type:"system",variant:"info",text:"Skipped"}):await e.sendMessage({author:"user",type:"text",text:o.value.toString()}),t(r.nextId)}async function Yp({chat:e,next:t,node:r,submissions:n,context:i}){await e.sendMessage({author:"bot",type:"text",text:Re(r.data.question,{submissions:n,context:i})});const o=await e.userInput({key:r.data.key,type:"multiple-choice",config:r.data});o.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=>o.value.includes(a.value)).map(a=>a.label).join(", ")}),t(r.nextId)}async function Xp({chat:e,next:t,node:r,submissions:n,context:i}){await e.sendMessage({author:"bot",type:"text",text:Re(r.data.question,{submissions:n,context:i})});const o=await e.userInput({key:r.data.key,type:"boolean",config:{optional:r.data.optional,labels:{true:r.data.trueLabel,false:r.data.falseLabel}}});o===null?await e.sendMessage({type:"system",variant:"info",text:"Skipped"}):await e.sendMessage({author:"user",type:"text",text:o.value===!0?r.data.trueLabel:r.data.falseLabel}),t(r.nextId)}async function Zp({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 i=Object.values(n.value).filter(o=>o&&o.trim().length>0).join(", ");await e.sendMessage({author:"user",type:"text",text:i})}return t(r.nextId)}async function Jp({node:e,chat:t,next:r,submissions:n,context:i}){await t.sendMessage({author:"bot",type:"text",text:Re(e.data.question,{submissions:n,context:i})});const o=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(o===null)await t.sendMessage({type:"system",variant:"info",text:"Skipped"});else for(const a of o.value)await t.sendMessage({author:"user",type:"file",fileName:a.name,fileSizeKb:a.sizeKb});r(e.nextId)}async function Qp({chat:e,end:t,node:r}){await e.sendMessage({type:"system",variant:"info",text:r.data.systemMessage}),t()}const Qa=({key:e,path:t,submissions:r,context:n})=>{if(e==="$context"){if(!t)return;const i=Pt(n,t.join("."));switch(typeof i){case"string":return{type:"string",value:i};case"number":return{type:"number",value:i};case"boolean":return{type:"boolean",value:i};default:console.warn(`Unexpected type for $context.${t.join(".")}`,i);return}}return r==null?void 0:r[e]};function Jn(e,t,r){var n,i,o,a,s;t==null&&(t=100);function l(){var f=Date.now()-a;f<t&&f>=0?n=setTimeout(l,t-f):(n=null,r||(s=e.apply(o,i),o=i=null))}var d=function(){o=this,i=arguments,a=Date.now();var f=r&&!n;return n||(n=setTimeout(l,t)),f&&(s=e.apply(o,i),o=i=null),s};return d.clear=function(){n&&(clearTimeout(n),n=null)},d.flush=function(){n&&(s=e.apply(o,i),o=i=null,clearTimeout(n),n=null)},d}Jn.debounce=Jn;var ev=Jn;const es=Pe(ev);function tv(e){let{debounce:t,scroll:r,polyfill:n,offsetSize:i}=e===void 0?{debounce:0,scroll:!1,offsetSize:!1}:e;const o=n||(typeof window>"u"?class{}:window.ResizeObserver);if(!o)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}),d=t?typeof t=="number"?t:t.scroll:null,f=t?typeof t=="number"?t:t.resize:null,c=L(!1);V(()=>(c.current=!0,()=>void(c.current=!1)));const[p,m,g]=he(()=>{const _=()=>{if(!l.current.element)return;const{left:I,top:T,width:O,height:H,bottom:K,right:M,x:F,y:se}=l.current.element.getBoundingClientRect(),re={left:I,top:T,width:O,height:H,bottom:K,right:M,x:F,y:se};l.current.element instanceof HTMLElement&&i&&(re.height=l.current.element.offsetHeight,re.width=l.current.element.offsetWidth),Object.freeze(re),c.current&&!iv(l.current.lastBounds,re)&&s(l.current.lastBounds=re)};return[_,f?es(_,f):_,d?es(_,d):_]},[s,i,d,f]);function v(){l.current.scrollContainers&&(l.current.scrollContainers.forEach(_=>_.removeEventListener("scroll",g,!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 o(g),l.current.resizeObserver.observe(l.current.element),r&&l.current.scrollContainers&&l.current.scrollContainers.forEach(_=>_.addEventListener("scroll",g,{capture:!0,passive:!0})))}const x=_=>{!_||_===l.current.element||(v(),l.current.element=_,l.current.scrollContainers=ts(_),w())};return nv(g,!!r),rv(m),V(()=>{v(),w()},[r,g,m]),V(()=>v,[]),[x,a,p]}function rv(e){V(()=>{const t=e;return window.addEventListener("resize",t),()=>void window.removeEventListener("resize",t)},[e])}function nv(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 ts(e){const t=[];if(!e||e===document.body)return t;const{overflow:r,overflowX:n,overflowY:i}=window.getComputedStyle(e);return[r,n,i].some(o=>o==="auto"||o==="scroll")&&t.push(e),[...t,...ts(e.parentElement)]}const ov=["x","y","top","bottom","left","right","width","height"],iv=(e,t)=>ov.every(r=>e[r]===t[r]),lt=({class:e,...t})=>u("button",{class:ot("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:u("svg",{class:"block",width:"16",height:"16",viewBox:"0 0 16 16",fill:"transparent",stroke:"currentColor","stroke-linecap":"round","stroke-width":"2",children:[u("title",{children:"Send"}),u("path",{d:"M3.5 7.5L8 3L12.5 7.5"}),u("path",{d:"M8 4V13"})]})}),av=25,Qn=Ge({instant:()=>{},smooth:()=>{}}),X={onSubmitSuccessFn$:Ge(()=>{}),isBotTyping$:Ge(!1),scrollToEnd:{instant:()=>Qn.value.instant(),smooth:()=>Qn.value.smooth()}},sv=()=>{const e=L(null);fe(()=>{Qn.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=he(()=>({addToSubmissions:(n,i)=>P.setSubmission(n,i),send:async({message:n,signal:i,groupId:o})=>{if(await We(n).with({author:"bot",type:"text"},async a=>{if(i!=null&&i.aborted)throw new qt;X.isBotTyping$.value=!0;const s=Math.min(Math.max(20,a.text.length),100)*av;await new Promise(l=>setTimeout(l,s,{signal:i})),X.isBotTyping$.value=!1}).otherwise(async()=>{}),i!=null&&i.aborted)throw new qt;P.addMessage(n,o)},input:({input:n,signal:i})=>{if(i!=null&&i.aborted)throw new qt;return P.setInput(n),new Promise(o=>{const a=s=>{if(i!=null&&i.aborted)throw new qt;P.setInput(void 0),n.key&&P.setSubmission(n.key,s),o(s)};X.onSubmitSuccessFn$.value=a})}}),[]);return{chatRef:e,chatService:t}},ct=({class:e,...t})=>u("button",{type:"button",class:ot("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:[u("svg",{class:"block",width:"16",height:"16",viewBox:"0 0 16 16",fill:"transparent",stroke:"currentColor","stroke-linecap":"round","stroke-width":"1.5",children:[u("title",{children:"Skip"}),u("path",{d:"M3.25 11.25A5 5 0 0 1 12 7"}),u("path",{d:"M13.25 4.5V8.25H9.5"})]}),"Skip"]}),eo={Afghanistan:"93",Albania:"355",Algeria:"213","American Samoa":"1 684",Andorra:"376",Angola:"244",Anguilla:"1 264",Antarctica:"672","Antigua and Barbuda":"1 268",Argentina:"54",Armenia:"374",Aruba:"297",Australia:"61",Austria:"43",Azerbaijan:"994",Bahrain:"973",Bangladesh:"880",Barbados:"1 246",Belarus:"375",Belgium:"32",Belize:"501",Benin:"229",Bermuda:"1 441",Bhutan:"975",Bolivia:"591","Bosnia and Herzegovina":"387",Botswana:"267","Bouvet Island":"47",Brazil:"55","British Indian Ocean Territory":"246","British Virgin Islands":"1 284",Brunei:"673",Bulgaria:"359","Burkina Faso":"226",Burundi:"257","Cabo Verde":"238",Cambodia:"855",Cameroon:"237",Canada:"1","Caribbean Netherlands":"599","Cayman Islands":"1 345","Central African Republic":"236",Chad:"235",Chile:"56",China:"86","Christmas Island":"61","Cocos (Keeling) Islands":"61",Colombia:"57",Comoros:"269","Cook Islands":"682","Costa Rica":"506",Croatia:"385",Cuba:"53",Curaçao:"599",Cyprus:"357",Czechia:"420","Côte d'Ivoire":"225","Democratic Republic of the Congo":"243",Denmark:"45",Djibouti:"253","Dominican Republic":"1 809",Ecuador:"593",Egypt:"20","El Salvador":"503","Equatorial Guinea":"240",Eritrea:"291",Estonia:"372",Eswatini:"268",Ethiopia:"251","Falkland Islands (Islas Malvinas)":"500","Faroe Islands":"298",Fiji:"679",Finland:"358",France:"33","French Guiana":"594","French Polynesia":"689","French Southern and Antarctic Lands":"260",Gabon:"241",Georgia:"995",Germany:"49",Ghana:"233",Gibraltar:"350",Greece:"30",Greenland:"299",Grenada:"1 473",Guadeloupe:"590",Guam:"1 671",Guatemala:"502",Guernsey:"44",Guinea:"224","Guinea-Bissau":"245",Guyana:"592",Haiti:"509",Honduras:"504","Hong Kong":"852",Hungary:"36",Iceland:"354",India:"91",Indonesia:"62",Iran:"98",Iraq:"964",Ireland:"352","Isle of Man":"44",Israel:"972",Italy:"39",Jamaica:"1 876",Japan:"81",Jersey:"44",Jordan:"962",Kazakhstan:"7",Kenya:"254",Kiribati:"686",Kosovo:"383",Kuwait:"965",Kyrgyzstan:"996",Laos:"856",Latvia:"371",Lebanon:"961",Lesotho:"266",Liberia:"231",Libya:"218",Liechtenstein:"423",Lithuania:"370",Luxembourg:"352",Macao:"853",Madagascar:"261",Malawi:"265",Malaysia:"60",Maldives:"960",Mali:"223",Malta:"356","Marshall Islands":"692",Martinique:"596",Mauritania:"222",Mauritius:"230",Mayotte:"262",Mexico:"52",Micronesia:"691",Moldova:"373",Monaco:"377",Mongolia:"976",Montenegro:"382",Montserrat:"1 664",Morocco:"212",Mozambique:"258","Myanmar (Burma)":"95",Namibia:"264",Nauru:"674",Nepal:"977",Netherlands:"31","New Caledonia":"687","New Zealand":"64",Nicaragua:"505",Niger:"227",Nigeria:"234",Niue:"683","Norfolk Island":"672","North Korea":"852","North Macedonia":"389","Northern Mariana Islands":"1 670",Norway:"47",Oman:"968",Pakistan:"92",Palau:"680",Palestine:"970",Panama:"507","Papua New Guinea":"675",Paraguay:"595",Peru:"51",Philippines:"63","Pitcairn Islands":"64",Poland:"48",Portugal:"351","Puerto Rico":"1 787",Qatar:"974",Romania:"40",Russia:"7",Rwanda:"250",Réunion:"262","Saint Barthélemy":"590","Saint Helena, Ascension and Tristan da Cunha":"290","Saint Kitts and Nevis":"1 869","Saint Lucia":"1 758","Saint Martin":"590","Saint Pierre and Miquelon":"508","Saint Vincent and the Grenadines":"1 784",Samoa:"685","San Marino":"378","Saudi Arabia":"966",Senegal:"221",Serbia:"381",Seychelles:"248","Sierra Leone":"232",Singapore:"65","Sint Maarten":"1 721",Slovakia:"421",Slovenia:"386","Solomon Islands":"677",Somalia:"252","South Africa":"27","South Georgia and the South Sandwich Islands":"500","South Korea":"82","South Sudan":"211",Spain:"34","Sri Lanka":"94",Sudan:"249",Suriname:"597","Svalbard and Jan Mayen":"47",Sweden:"46",Switzerland:"41",Syria:"963","São Tomé and Príncipe":"293",Taiwan:"886",Tajikistan:"992",Tanzania:"255",Thailand:"66","The Bahamas":"1 242","The Gambia":"220","Timor-Leste":"670",Togo:"228",Tokelau:"690",Tonga:"676","Trinidad and Tobago":"1 868",Tunisia:"216",Turkmenistan:"993","Turks and Caicos Islands":"1 649",Tuvalu:"688",Türkiye:"90","U.S. Virgin Islands":"1 340",Uganda:"256",Ukraine:"380","United Arab Emirates":"971","United Kingdom":"44","United States":"1","United States Minor Outlying Islands":"1",Uruguay:"598",Uzbekistan:"998",Vanuatu:"678","Vatican City":"379",Venezuela:"58",Vietnam:"84","Wallis and Futuna":"681","Western Sahara":"212",Yemen:"967",Zambia:"260",Zimbabwe:"263","Åland Islands":"358"},rs={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"]},Mr=Object.keys(rs),lv=e=>Mr.reduce((t,r)=>{const n=rs[r],i=e.filter(o=>o.types.some(a=>n.includes(a))).map(o=>o.long_name).join(", ");return i&&(t[r]=i),t},{}),cv=document.createElement("div"),uv=()=>he(()=>{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(cv);return{enabled:!0,getPredictions:async n=>{const{predictions:i}=await t.getPlacePredictions({input:n,language:"en"});return i.map(o=>({label:o.description,value:o.place_id}))},getPlaceDetails:async n=>await new Promise((o,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"):o({ok:!0,place:s}))).catch(async o=>(console.error("Failed to get address details",o),{ok:!1}))}},[]),to=e=>u("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:[u("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:u("path",{d:"M10 3L5 8L10 13"})}),u("span",{children:"Back"})]}),ro={label:"Fill in manually",value:""},dv=({input:e,onSubmitSuccess:t})=>{const[r,n]=W(""),[i,o]=W(),[a,s]=W([]),[l,d]=W(),{enabled:f,getPredictions:c,getPlaceDetails:p}=uv(),[m,g]=W(f?"query":"manual"),v=w=>{$e(f,"Query state should not be enabled if Google Places isn't available"),n(w),w===""&&s([]),c(w).then(x=>{s(x)})};switch(V(()=>{if(f&&!(l===void 0||l===""))return p(l).then(w=>{if(!w.ok||!w.place.address_components){o({});return}const x=lv(w.place.address_components);o(x),g("details")}),()=>{o(void 0)}},[l,p,f]),m){case"query":return $e(f,"Query state should not be enabled if Google Places isn't available"),u(fv,{input:e,onSkip:()=>t(null),onAddressSelect:w=>{d(w),g("loading")},onAddressSearch:w=>{v(w)},suggestions:a,query:r});case"loading":return u(no,{input:e,onSubmitSuccess:t,addressFields:{},actions:u(to,{onClick:()=>{d(void 0),g("query")}})});case"details":return $e(i!==void 0),u(no,{input:e,onSubmitSuccess:t,addressFields:i,actions:u(to,{onClick:()=>{d(void 0),g("query")}})});case"manual":return u(no,{input:e,onSubmitSuccess:t,addressFields:{},actions:f?u(to,{onClick:()=>{d(void 0),g("query")}}):void 0})}},fv=({input:e,onSkip:t,suggestions:r,onAddressSelect:n,query:i,onAddressSearch:o})=>{const a=L(null);return fe(()=>{a.current&&(a.current.focus(),a.current.select())},[]),u(Y,{children:[u("form",{noValidate:!0,onSubmit:s=>{s.preventDefault();const d=new FormData(s.currentTarget).get("address");typeof d=="string"&&o(d)},class:"flex gap-1 p-2.5",children:[u("div",{class:"group relative flex-1",children:[u("input",{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||"Type and search for places...",defaultValue:i}),u("button",{type:"submit",class:"touch-hitbox text-neutral-12 hover:bg-neutral-3 fr absolute bottom-0 right-0 top-0 flex cursor-pointer items-center gap-1 rounded-full px-3 transition-all",children:u("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[u("g",{id:"inploi",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round",strokeWidth:"1.5",children:[u("circle",{cx:"7",cy:"7",r:"4"}),u("path",{d:"M10 10L13 13"})]}),u("span",{class:"sr-only",children:"Search"})]})})]}),e.config.optional&&u(ct,{class:"",onClick:t})]}),u("ul",{children:[r.map(s=>u("li",{children:u("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:[u("span",{class:"flex-grow",children:s.label}),u("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:u("path",{d:"M6 3L11 8L6 13"})})]})},s.label)),u("li",{children:u("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(ro.value)},children:u("span",{class:"flex-grow",children:ro.label})})},ro.label)]})]})},hv={line1:"Line 1",line2:"Line 2",line3:"Line 3",city:"City",state:"State",postcode:"Postcode",country:"Country"},no=({addressFields:e,onSubmitSuccess:t,actions:r,input:n})=>{const i=L(null);fe(()=>{if(i.current){const a=i.current.querySelector("input");a&&(a.focus(),a.select())}},[]);const o=Object.keys(eo);return u("form",{class:"bg-neutral-1/90 flex flex-col justify-end gap-2 p-2",onSubmit:a=>{const s=new FormData(a.currentTarget),l=Object.fromEntries(s.entries());t({type:"address",value:l})},children:[u("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:i,children:Mr.map((a,s)=>{const l=`isdk_${a}`,d=n.config.keys[a];return d?u(Y,{children:[u("label",{for:l,class:"text-neutral-9 [&:has(+*>input:focus)]:text-neutral-11 w-24 pb-2 text-xs uppercase leading-3 tracking-widest transition-colors",children:hv[a]}),u("div",{class:"flex flex-col items-stretch gap-1.5",children:[a==="country"?u("div",{class:"relative",children:[u("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:d,id:l,defaultValue:e[a],required:!0,children:[e.country&&!o.includes(e.country)?u("option",{value:e[a],children:e[a]}):u("option",{value:"",children:"Select a country"}),o.map(f=>u("option",{value:f,children:f},f))]}),u("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:u("path",{d:"M4 6.5L8 10.5L12 6.5"})})]}):u("input",{autoFocus:s===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:d,id:l,defaultValue:e[a],required:!0}),s!==Mr.length-1&&u("hr",{class:"border-b-neutral-5 m-0 w-full border-b border-solid"}),s===Mr.length-1&&u("hr",{class:"m-0 w-full border-b border-b-transparent"})]})]}):null})}),u("div",{class:"flex w-full flex-1 ",children:[u("div",{class:"flex-grow",children:r}),u(lt,{class:"flex items-center justify-center"})]})]})},oo=()=>{const e=L(null);return V(()=>{var t;(t=e.current)==null||t.focus()},[]),e},ns=["true","false"],pv=Dd(ns),vv="answer",os="flex items-center gap-2 p-2.5",is=ne(({label:e,...t},r)=>u("button",{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 w-full overflow-hidden rounded-2xl px-2.5 py-2.5 ring-2 transition-all selection:bg-transparent",...t,ref:r,children:u("p",{class:"truncate text-center text-base",children:e})})),gv=({input:e,onSubmitSuccess:t})=>{const r=oo();return u("form",{noValidate:!0,class:"",onSubmit:n=>{n.preventDefault();const i=up(n).value,o=sr(pv,i);t({type:"boolean",value:o==="true"})},children:[u("ul",{class:os,children:ns.map((n,i)=>u("li",{class:"flex-1",children:u(is,{ref:i===0?r:null,type:"submit",name:vv,value:n,label:e.config.labels[n]},n)}))}),e.config.optional&&u("div",{class:"px-2 pb-2",children:u(ct,{class:"w-full",type:"button",onClick:()=>t(null)})})]})},Yt=({error:e})=>!e||!e.message?null:u("div",{role:"alert",class:"text-error-11 flex max-w-full items-center gap-1 overflow-hidden rounded-full px-2 py-2",children:[u("svg",{class:"text-error-9 h-4 w-4",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[u("circle",{cx:"8",cy:"8",r:"6.3",stroke:"currentColor","stroke-width":"1.4"}),u("rect",{x:"7",y:"4",width:"2",height:"5",fill:"currentColor"}),u("rect",{x:"7",y:"10",width:"2",height:"2",fill:"currentColor"})]}),u("p",{class:"truncate pr-1 text-sm",children:e.message})]}),mv=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}),bv=e=>e.reduce((t,r)=>t+r.sizeKb,0),yv=Ht("file"),as=3,wv=({file:e,class:t,...r})=>{const n=e.name.split(".").pop(),i=e.name.replace(new RegExp(`.${n}$`),"");return u("div",{class:ot("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:[u("p",{"aria-label":"File name",class:"text-accent-12 flex flex-grow overflow-hidden",children:[u("span",{class:"block truncate",children:i}),u("span",{children:[".",n]})]}),u("p",{"aria-label":"File size",class:"text-accent-11",children:Ut(e.sizeKb)})]})},ss=({class:e,...t})=>u("li",{class:ot("outline-neutral-6 text-neutral-11 bg-neutral-1 block rounded-md px-1 py-0.5 text-xs outline outline-1",e),...t}),ls=e=>{const t=e.split(".").pop();if(!t)throw new Error("No file extension found");return t?"."+t:""},_v=({allowedExtensions:e,files:t})=>{const r=e.map(n=>n.toLowerCase());return t.every(n=>r.includes(ls(n.name).toLowerCase()))},xv=(e,t)=>{const r=ls(e);return`${e.replace(new RegExp(`${r}$`),"").slice(0,t)}${r}`},kv=({input:e,onSubmitSuccess:t})=>{var f;const r=(f=P.current$.value.flow)==null?void 0:f.data.submissions[e.key],[n,i]=W(yv(r)?r.value:[]),[o,a]=W(),s=n.length-as,l=bv(n),d=oo();return u("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&&!_v({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 ${Ut(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:[u("div",{class:"flex items-center gap-2",children:[u("label",{ref:d,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?u(Y,{children:[u("ul",{class:"flex max-w-full flex-wrap justify-center gap-1 overflow-hidden p-1",children:[n.slice(0,as).map(c=>{const p=c.name.split(".").pop(),m=c.name.replace(new RegExp(`.${p}$`),"");return u(ss,{class:"flex overflow-hidden",children:[u("span",{class:"block truncate",children:m}),u("span",{children:[".",p]})]})}),s>0?u(ss,{children:["+",s," file",s!==1?"s":""]}):null]}),u("p",{class:"text-neutral-11 text-xs",children:[Ut(l)," ",n.length>1?"total":""]})]}):u("div",{class:"flex flex-col justify-center gap-4 pb-6 pt-5",children:[u("header",{class:"flex flex-col items-center gap-0",children:[u("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:u("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"})}),u("p",{class:"text-neutral-12 tracking-[-0.01em]",children:[e.config.allowMultiple?"Select files":"Select a file"," to upload"]}),e.config.fileSizeLimitKib?u("p",{class:"text-neutral-10 text-xs",children:["(max ",Ut(e.config.fileSizeLimitKib),")"]}):null]}),u("aside",{class:"flex flex-col items-center gap-2",children:[u("p",{id:"accepted-filetypes",class:"sr-only",children:"Accepted file extensions"}),u("ul",{"aria-describedby":"accepted-filetypes",class:"flex flex-wrap justify-center gap-2",children:e.config.extensions.map(c=>u("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(".","")}))})]})]}),u("input",{id:"dropzone-file",onInput:async c=>{$e(c.target instanceof HTMLInputElement);const p=c.target.files?Array.from(c.target.files):[],m=await Promise.allSettled(p.map(async v=>{const w=await mv(v);return{name:xv(v.name,42),data:w,sizeKb:v.size/1e3}}));if(m.some(({status:v})=>v==="rejected"))return a({type:"invalid",message:"Invalid file"});const g=m.map(v=>v.status==="fulfilled"?v.value:null).filter(Boolean);i(g)},multiple:e.config.allowMultiple,type:"file",class:"sr-only"})]}),u("div",{class:"flex h-full flex-col items-center gap-2",children:[u(lt,{disabled:n.length===0}),e.config.optional&&u(ct,{onClick:()=>t(null)})]})]}),u(Yt,{error:o})]})};var Xt=e=>e.type==="checkbox",It=e=>e instanceof Date,ue=e=>e==null;const cs=e=>typeof e=="object";var te=e=>!ue(e)&&!Array.isArray(e)&&cs(e)&&!It(e),$v=e=>te(e)&&e.target?Xt(e.target)?e.target.checked:e.target.value:e,Sv=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,Cv=(e,t)=>e.has(Sv(t)),Ev=e=>{const t=e.constructor&&e.constructor.prototype;return te(t)&&t.hasOwnProperty("isPrototypeOf")},io=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function je(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(!(io&&(e instanceof Blob||e instanceof FileList))&&(r||te(e)))if(t=r?[]:{},!r&&!Ev(e))t=e;else for(const n in e)e.hasOwnProperty(n)&&(t[n]=je(e[n]));else return e;return t}var Zt=e=>Array.isArray(e)?e.filter(Boolean):[],J=e=>e===void 0,C=(e,t,r)=>{if(!t||!te(e))return r;const n=Zt(t.split(/[,[\].]+?/)).reduce((i,o)=>ue(i)?i:i[o],e);return J(n)||n===e?J(e[t])?r:e[t]:n},Ze=e=>typeof e=="boolean";const us={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change"},Se={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},Ve={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"};ke.createContext(null);var Iv=(e,t,r,n=!0)=>{const i={defaultValues:t._defaultValues};for(const o in e)Object.defineProperty(i,o,{get:()=>{const a=o;return t._proxyFormState[a]!==Se.all&&(t._proxyFormState[a]=!n||Se.all),r&&(r[a]=!0),e[a]}});return i},we=e=>te(e)&&!Object.keys(e).length,Ov=(e,t,r,n)=>{r(e);const{name:i,...o}=e;return we(o)||Object.keys(o).length>=Object.keys(t).length||Object.keys(o).find(a=>t[a]===(!n||Se.all))},ao=e=>Array.isArray(e)?e:[e];function Tv(e){const t=ke.useRef(e);t.current=e,ke.useEffect(()=>{const r=!e.disabled&&t.current.subject&&t.current.subject.subscribe({next:t.current.next});return()=>{r&&r.unsubscribe()}},[e.disabled])}var Te=e=>typeof e=="string",Av=(e,t,r,n,i)=>Te(e)?(n&&t.watch.add(e),C(r,e,i)):Array.isArray(e)?e.map(o=>(n&&t.watch.add(o),C(r,o))):(n&&(t.watchAll=!0),r),so=e=>/^\w*$/.test(e),ds=e=>Zt(e.replace(/["|']|\]/g,"").split(/\.|\[/));function U(e,t,r){let n=-1;const i=so(t)?[t]:ds(t),o=i.length,a=o-1;for(;++n<o;){const s=i[n];let l=r;if(n!==a){const d=e[s];l=te(d)||Array.isArray(d)?d:isNaN(+i[n+1])?{}:[]}e[s]=l,e=e[s]}return e}var fs=(e,t,r,n,i)=>t?{...r[e],types:{...r[e]&&r[e].types?r[e].types:{},[n]:i||!0}}:{},hs=e=>({isOnSubmit:!e||e===Se.onSubmit,isOnBlur:e===Se.onBlur,isOnChange:e===Se.onChange,isOnAll:e===Se.all,isOnTouch:e===Se.onTouched}),ps=(e,t,r)=>!r&&(t.watchAll||t.watch.has(e)||[...t.watch].some(n=>e.startsWith(n)&&/^\.\w+/.test(e.slice(n.length))));const Fr=(e,t,r,n)=>{for(const i of r||Object.keys(e)){const o=C(e,i);if(o){const{_f:a,...s}=o;if(a){if(a.refs&&a.refs[0]&&t(a.refs[0],i)&&!n)break;if(a.ref&&t(a.ref,a.name)&&!n)break}else te(s)&&Fr(s,t)}}};var Pv=(e,t,r)=>{const n=Zt(C(e,r));return U(n,"root",t[r]),U(e,r,n),e},lo=e=>e.type==="file",Je=e=>typeof e=="function",Lr=e=>{if(!io)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},Rr=e=>Te(e),co=e=>e.type==="radio",jr=e=>e instanceof RegExp;const vs={value:!1,isValid:!1},gs={value:!0,isValid:!0};var ms=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&&!J(e[0].attributes.value)?J(e[0].value)||e[0].value===""?gs:{value:e[0].value,isValid:!0}:gs:vs}return vs};const bs={isValid:!1,value:null};var ys=e=>Array.isArray(e)?e.reduce((t,r)=>r&&r.checked&&!r.disabled?{isValid:!0,value:r.value}:t,bs):bs;function ws(e,t,r="validate"){if(Rr(e)||Array.isArray(e)&&e.every(Rr)||Ze(e)&&!e)return{type:r,message:Rr(e)?e:"",ref:t}}var Ot=e=>te(e)&&!jr(e)?e:{value:e,message:""},_s=async(e,t,r,n,i)=>{const{ref:o,refs:a,required:s,maxLength:l,minLength:d,min:f,max:c,pattern:p,validate:m,name:g,valueAsNumber:v,mount:w,disabled:x}=e._f,_=C(t,g);if(!w||x)return{};const I=a?a[0]:o,T=B=>{n&&I.reportValidity&&(I.setCustomValidity(Ze(B)?"":B||""),I.reportValidity())},O={},H=co(o),K=Xt(o),M=H||K,F=(v||lo(o))&&J(o.value)&&J(_)||Lr(o)&&o.value===""||_===""||Array.isArray(_)&&!_.length,se=fs.bind(null,g,r,O),re=(B,R,Q,ve=Ve.maxLength,_e=Ve.minLength)=>{const Ae=B?R:Q;O[g]={type:B?ve:_e,message:Ae,ref:o,...se(B?ve:_e,Ae)}};if(i?!Array.isArray(_)||!_.length:s&&(!M&&(F||ue(_))||Ze(_)&&!_||K&&!ms(a).isValid||H&&!ys(a).isValid)){const{value:B,message:R}=Rr(s)?{value:!!s,message:s}:Ot(s);if(B&&(O[g]={type:Ve.required,message:R,ref:I,...se(Ve.required,R)},!r))return T(R),O}if(!F&&(!ue(f)||!ue(c))){let B,R;const Q=Ot(c),ve=Ot(f);if(!ue(_)&&!isNaN(_)){const _e=o.valueAsNumber||_&&+_;ue(Q.value)||(B=_e>Q.value),ue(ve.value)||(R=_e<ve.value)}else{const _e=o.valueAsDate||new Date(_),Ae=Kr=>new Date(new Date().toDateString()+" "+Kr),dt=o.type=="time",Qt=o.type=="week";Te(Q.value)&&_&&(B=dt?Ae(_)>Ae(Q.value):Qt?_>Q.value:_e>new Date(Q.value)),Te(ve.value)&&_&&(R=dt?Ae(_)<Ae(ve.value):Qt?_<ve.value:_e<new Date(ve.value))}if((B||R)&&(re(!!B,Q.message,ve.message,Ve.max,Ve.min),!r))return T(O[g].message),O}if((l||d)&&!F&&(Te(_)||i&&Array.isArray(_))){const B=Ot(l),R=Ot(d),Q=!ue(B.value)&&_.length>+B.value,ve=!ue(R.value)&&_.length<+R.value;if((Q||ve)&&(re(Q,B.message,R.message),!r))return T(O[g].message),O}if(p&&!F&&Te(_)){const{value:B,message:R}=Ot(p);if(jr(B)&&!_.match(B)&&(O[g]={type:Ve.pattern,message:R,ref:o,...se(Ve.pattern,R)},!r))return T(R),O}if(m){if(Je(m)){const B=await m(_,t),R=ws(B,I);if(R&&(O[g]={...R,...se(Ve.validate,R.message)},!r))return T(R.message),O}else if(te(m)){let B={};for(const R in m){if(!we(B)&&!r)break;const Q=ws(await m[R](_,t),I,R);Q&&(B={...Q,...se(R,Q.message)},T(Q.message),r&&(O[g]=B))}if(!we(B)&&(O[g]={ref:I,...B},!r))return O}}return T(!0),O};function Nv(e,t){const r=t.slice(0,-1).length;let n=0;for(;n<r;)e=J(e)?n++:e[t[n++]];return e}function Dv(e){for(const t in e)if(e.hasOwnProperty(t)&&!J(e[t]))return!1;return!0}function ae(e,t){const r=Array.isArray(t)?t:so(t)?[t]:ds(t),n=r.length===1?e:Nv(e,r),i=r.length-1,o=r[i];return n&&delete n[o],i!==0&&(te(n)&&we(n)||Array.isArray(n)&&Dv(n))&&ae(e,r.slice(0,-1)),e}function uo(){let e=[];return{get observers(){return e},next:i=>{for(const o of e)o.next&&o.next(i)},subscribe:i=>(e.push(i),{unsubscribe:()=>{e=e.filter(o=>o!==i)}}),unsubscribe:()=>{e=[]}}}var Vr=e=>ue(e)||!cs(e);function ut(e,t){if(Vr(e)||Vr(t))return e===t;if(It(e)&&It(t))return e.getTime()===t.getTime();const r=Object.keys(e),n=Object.keys(t);if(r.length!==n.length)return!1;for(const i of r){const o=e[i];if(!n.includes(i))return!1;if(i!=="ref"){const a=t[i];if(It(o)&&It(a)||te(o)&&te(a)||Array.isArray(o)&&Array.isArray(a)?!ut(o,a):o!==a)return!1}}return!0}var xs=e=>e.type==="select-multiple",Mv=e=>co(e)||Xt(e),fo=e=>Lr(e)&&e.isConnected,ks=e=>{for(const t in e)if(Je(e[t]))return!0;return!1};function Br(e,t={}){const r=Array.isArray(e);if(te(e)||r)for(const n in e)Array.isArray(e[n])||te(e[n])&&!ks(e[n])?(t[n]=Array.isArray(e[n])?[]:{},Br(e[n],t[n])):ue(e[n])||(t[n]=!0);return t}function $s(e,t,r){const n=Array.isArray(e);if(te(e)||n)for(const i in e)Array.isArray(e[i])||te(e[i])&&!ks(e[i])?J(t)||Vr(r[i])?r[i]=Array.isArray(e[i])?Br(e[i],[]):{...Br(e[i])}:$s(e[i],ue(t)?{}:t[i],r[i]):r[i]=!ut(e[i],t[i]);return r}var ho=(e,t)=>$s(e,t,Br(t)),Ss=(e,{valueAsNumber:t,valueAsDate:r,setValueAs:n})=>J(e)?e:t?e===""?NaN:e&&+e:r&&Te(e)?new Date(e):n?n(e):e;function po(e){const t=e.ref;if(!(e.refs?e.refs.every(r=>r.disabled):t.disabled))return lo(t)?t.files:co(t)?ys(e.refs).value:xs(t)?[...t.selectedOptions].map(({value:r})=>r):Xt(t)?ms(e.refs).value:Ss(J(t.value)?e.ref.value:t.value,e)}var Fv=(e,t,r,n)=>{const i={};for(const o of e){const a=C(t,o);a&&U(i,o,a._f)}return{criteriaMode:r,names:[...e],fields:i,shouldUseNativeValidation:n}},Jt=e=>J(e)?e:jr(e)?e.source:te(e)?jr(e.value)?e.value.source:e.value:e,Lv=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate);function Cs(e,t,r){const n=C(e,r);if(n||so(r))return{error:n,name:r};const i=r.split(".");for(;i.length;){const o=i.join("."),a=C(t,o),s=C(e,o);if(a&&!Array.isArray(a)&&r!==o)return{name:r};if(s&&s.type)return{name:o,error:s};i.pop()}return{name:r}}var Rv=(e,t,r,n,i)=>i.isOnAll?!1:!r&&i.isOnTouch?!(t||e):(r?n.isOnBlur:i.isOnBlur)?!e:(r?n.isOnChange:i.isOnChange)?e:!0,jv=(e,t)=>!Zt(C(e,t)).length&&ae(e,t);const Vv={mode:Se.onSubmit,reValidateMode:Se.onChange,shouldFocusError:!0};function Bv(e={},t){let r={...Vv,...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},i={},o=te(r.defaultValues)||te(r.values)?je(r.defaultValues||r.values)||{}:{},a=r.shouldUnregister?{}:je(o),s={action:!1,mount:!1,watch:!1},l={mount:new Set,unMount:new Set,array:new Set,watch:new Set},d,f=0;const c={isDirty:!1,dirtyFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},p={values:uo(),array:uo(),state:uo()},m=e.resetOptions&&e.resetOptions.keepDirtyValues,g=hs(r.mode),v=hs(r.reValidateMode),w=r.criteriaMode===Se.all,x=h=>b=>{clearTimeout(f),f=setTimeout(h,b)},_=async h=>{if(c.isValid||h){const b=r.resolver?we((await F()).errors):await re(i,!0);b!==n.isValid&&p.state.next({isValid:b})}},I=h=>c.isValidating&&p.state.next({isValidating:h}),T=(h,b=[],y,E,$=!0,k=!0)=>{if(E&&y){if(s.action=!0,k&&Array.isArray(C(i,h))){const A=y(C(i,h),E.argA,E.argB);$&&U(i,h,A)}if(k&&Array.isArray(C(n.errors,h))){const A=y(C(n.errors,h),E.argA,E.argB);$&&U(n.errors,h,A),jv(n.errors,h)}if(c.touchedFields&&k&&Array.isArray(C(n.touchedFields,h))){const A=y(C(n.touchedFields,h),E.argA,E.argB);$&&U(n.touchedFields,h,A)}c.dirtyFields&&(n.dirtyFields=ho(o,a)),p.state.next({name:h,isDirty:R(h,b),dirtyFields:n.dirtyFields,errors:n.errors,isValid:n.isValid})}else U(a,h,b)},O=(h,b)=>{U(n.errors,h,b),p.state.next({errors:n.errors})},H=(h,b,y,E)=>{const $=C(i,h);if($){const k=C(a,h,J(y)?C(o,h):y);J(k)||E&&E.defaultChecked||b?U(a,h,b?k:po($._f)):_e(h,k),s.mount&&_()}},K=(h,b,y,E,$)=>{let k=!1,A=!1;const q={name:h};if(!y||E){c.isDirty&&(A=n.isDirty,n.isDirty=q.isDirty=R(),k=A!==q.isDirty);const ee=ut(C(o,h),b);A=C(n.dirtyFields,h),ee?ae(n.dirtyFields,h):U(n.dirtyFields,h,!0),q.dirtyFields=n.dirtyFields,k=k||c.dirtyFields&&A!==!ee}if(y){const ee=C(n.touchedFields,h);ee||(U(n.touchedFields,h,y),q.touchedFields=n.touchedFields,k=k||c.touchedFields&&ee!==y)}return k&&$&&p.state.next(q),k?q:{}},M=(h,b,y,E)=>{const $=C(n.errors,h),k=c.isValid&&Ze(b)&&n.isValid!==b;if(e.delayError&&y?(d=x(()=>O(h,y)),d(e.delayError)):(clearTimeout(f),d=null,y?U(n.errors,h,y):ae(n.errors,h)),(y?!ut($,y):$)||!we(E)||k){const A={...E,...k&&Ze(b)?{isValid:b}:{},errors:n.errors,name:h};n={...n,...A},p.state.next(A)}I(!1)},F=async h=>r.resolver(a,r.context,Fv(h||l.mount,i,r.criteriaMode,r.shouldUseNativeValidation)),se=async h=>{const{errors:b}=await F(h);if(h)for(const y of h){const E=C(b,y);E?U(n.errors,y,E):ae(n.errors,y)}else n.errors=b;return b},re=async(h,b,y={valid:!0})=>{for(const E in h){const $=h[E];if($){const{_f:k,...A}=$;if(k){const q=l.array.has(k.name),ee=await _s($,a,w,r.shouldUseNativeValidation&&!b,q);if(ee[k.name]&&(y.valid=!1,b))break;!b&&(C(ee,k.name)?q?Pv(n.errors,ee,k.name):U(n.errors,k.name,ee[k.name]):ae(n.errors,k.name))}A&&await re(A,b,y)}}return y.valid},B=()=>{for(const h of l.unMount){const b=C(i,h);b&&(b._f.refs?b._f.refs.every(y=>!fo(y)):!fo(b._f.ref))&&bo(h)}l.unMount=new Set},R=(h,b)=>(h&&b&&U(a,h,b),!ut(Fs(),o)),Q=(h,b,y)=>Av(h,l,{...s.mount?a:J(b)?o:Te(h)?{[h]:b}:b},y,b),ve=h=>Zt(C(s.mount?a:o,h,e.shouldUnregister?C(o,h,[]):[])),_e=(h,b,y={})=>{const E=C(i,h);let $=b;if(E){const k=E._f;k&&(!k.disabled&&U(a,h,Ss(b,k)),$=Lr(k.ref)&&ue(b)?"":b,xs(k.ref)?[...k.ref.options].forEach(A=>A.selected=$.includes(A.value)):k.refs?Xt(k.ref)?k.refs.length>1?k.refs.forEach(A=>(!A.defaultChecked||!A.disabled)&&(A.checked=Array.isArray($)?!!$.find(q=>q===A.value):$===A.value)):k.refs[0]&&(k.refs[0].checked=!!$):k.refs.forEach(A=>A.checked=A.value===$):lo(k.ref)?k.ref.value="":(k.ref.value=$,k.ref.type||p.values.next({name:h,values:{...a}})))}(y.shouldDirty||y.shouldTouch)&&K(h,$,y.shouldTouch,y.shouldDirty,!0),y.shouldValidate&&mo(h)},Ae=(h,b,y)=>{for(const E in b){const $=b[E],k=`${h}.${E}`,A=C(i,k);(l.array.has(h)||!Vr($)||A&&!A._f)&&!It($)?Ae(k,$,y):_e(k,$,y)}},dt=(h,b,y={})=>{const E=C(i,h),$=l.array.has(h),k=je(b);U(a,h,k),$?(p.array.next({name:h,values:{...a}}),(c.isDirty||c.dirtyFields)&&y.shouldDirty&&p.state.next({name:h,dirtyFields:ho(o,a),isDirty:R(h,k)})):E&&!E._f&&!ue(k)?Ae(h,k,y):_e(h,k,y),ps(h,l)&&p.state.next({...n}),p.values.next({name:h,values:{...a}}),!s.mount&&t()},Qt=async h=>{const b=h.target;let y=b.name,E=!0;const $=C(i,y),k=()=>b.type?po($._f):$v(h),A=q=>{E=Number.isNaN(q)||q===C(a,y,q)};if($){let q,ee;const Wr=k(),Tt=h.type===us.BLUR||h.type===us.FOCUS_OUT,Rg=!Lv($._f)&&!r.resolver&&!C(n.errors,y)&&!$._f.deps||Rv(Tt,C(n.touchedFields,y),n.isSubmitted,v,g),wo=ps(y,l,Tt);U(a,y,Wr),Tt?($._f.onBlur&&$._f.onBlur(h),d&&d(0)):$._f.onChange&&$._f.onChange(h);const _o=K(y,Wr,Tt,!1),jg=!we(_o)||wo;if(!Tt&&p.values.next({name:y,type:h.type,values:{...a}}),Rg)return c.isValid&&_(),jg&&p.state.next({name:y,...wo?{}:_o});if(!Tt&&wo&&p.state.next({...n}),I(!0),r.resolver){const{errors:Hs}=await F([y]);if(A(Wr),E){const Vg=Cs(n.errors,i,y),qs=Cs(Hs,i,Vg.name||y);q=qs.error,y=qs.name,ee=we(Hs)}}else q=(await _s($,a,w,r.shouldUseNativeValidation))[y],A(Wr),E&&(q?ee=!1:c.isValid&&(ee=await re(i,!0)));E&&($._f.deps&&mo($._f.deps),M(y,ee,q,_o))}},Kr=(h,b)=>{if(C(n.errors,b)&&h.focus)return h.focus(),1},mo=async(h,b={})=>{let y,E;const $=ao(h);if(I(!0),r.resolver){const k=await se(J(h)?h:$);y=we(k),E=h?!$.some(A=>C(k,A)):y}else h?(E=(await Promise.all($.map(async k=>{const A=C(i,k);return await re(A&&A._f?{[k]:A}:A)}))).every(Boolean),!(!E&&!n.isValid)&&_()):E=y=await re(i);return p.state.next({...!Te(h)||c.isValid&&y!==n.isValid?{}:{name:h},...r.resolver||!h?{isValid:y}:{},errors:n.errors,isValidating:!1}),b.shouldFocus&&!E&&Fr(i,Kr,h?$:l.mount),E},Fs=h=>{const b={...o,...s.mount?a:{}};return J(h)?b:Te(h)?C(b,h):h.map(y=>C(b,y))},Ls=(h,b)=>({invalid:!!C((b||n).errors,h),isDirty:!!C((b||n).dirtyFields,h),isTouched:!!C((b||n).touchedFields,h),error:C((b||n).errors,h)}),Dg=h=>{h&&ao(h).forEach(b=>ae(n.errors,b)),p.state.next({errors:h?n.errors:{}})},Rs=(h,b,y)=>{const E=(C(i,h,{_f:{}})._f||{}).ref;U(n.errors,h,{...b,ref:E}),p.state.next({name:h,errors:n.errors,isValid:!1}),y&&y.shouldFocus&&E&&E.focus&&E.focus()},Mg=(h,b)=>Je(h)?p.values.subscribe({next:y=>h(Q(void 0,b),y)}):Q(h,b,!0),bo=(h,b={})=>{for(const y of h?ao(h):l.mount)l.mount.delete(y),l.array.delete(y),b.keepValue||(ae(i,y),ae(a,y)),!b.keepError&&ae(n.errors,y),!b.keepDirty&&ae(n.dirtyFields,y),!b.keepTouched&&ae(n.touchedFields,y),!r.shouldUnregister&&!b.keepDefaultValue&&ae(o,y);p.values.next({values:{...a}}),p.state.next({...n,...b.keepDirty?{isDirty:R()}:{}}),!b.keepIsValid&&_()},js=({disabled:h,name:b,field:y,fields:E,value:$})=>{if(Ze(h)){const k=h?void 0:J($)?po(y?y._f:C(E,b)._f):$;U(a,b,k),K(b,k,!1,!1,!0)}},yo=(h,b={})=>{let y=C(i,h);const E=Ze(b.disabled);return U(i,h,{...y||{},_f:{...y&&y._f?y._f:{ref:{name:h}},name:h,mount:!0,...b}}),l.mount.add(h),y?js({field:y,disabled:b.disabled,name:h}):H(h,!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:h,onChange:Qt,onBlur:Qt,ref:$=>{if($){yo(h,b),y=C(i,h);const k=J($.value)&&$.querySelectorAll&&$.querySelectorAll("input,select,textarea")[0]||$,A=Mv(k),q=y._f.refs||[];if(A?q.find(ee=>ee===k):k===y._f.ref)return;U(i,h,{_f:{...y._f,...A?{refs:[...q.filter(fo),k,...Array.isArray(C(o,h))?[{}]:[]],ref:{type:k.type,name:h}}:{ref:k}}}),H(h,!1,void 0,k)}else y=C(i,h,{}),y._f&&(y._f.mount=!1),(r.shouldUnregister||b.shouldUnregister)&&!(Cv(l.array,h)&&s.action)&&l.unMount.add(h)}}},Vs=()=>r.shouldFocusError&&Fr(i,Kr,l.mount),Fg=h=>{Ze(h)&&(p.state.next({disabled:h}),Fr(i,b=>{b.disabled=h},0,!1))},Bs=(h,b)=>async y=>{y&&(y.preventDefault&&y.preventDefault(),y.persist&&y.persist());let E=je(a);if(p.state.next({isSubmitting:!0}),r.resolver){const{errors:$,values:k}=await F();n.errors=$,E=k}else await re(i);ae(n.errors,"root"),we(n.errors)?(p.state.next({errors:{}}),await h(E,y)):(b&&await b({...n.errors},y),Vs(),setTimeout(Vs)),p.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:we(n.errors),submitCount:n.submitCount+1,errors:n.errors})},Lg=(h,b={})=>{C(i,h)&&(J(b.defaultValue)?dt(h,C(o,h)):(dt(h,b.defaultValue),U(o,h,b.defaultValue)),b.keepTouched||ae(n.touchedFields,h),b.keepDirty||(ae(n.dirtyFields,h),n.isDirty=b.defaultValue?R(h,C(o,h)):R()),b.keepError||(ae(n.errors,h),c.isValid&&_()),p.state.next({...n}))},zs=(h,b={})=>{const y=h?je(h):o,E=je(y),$=h&&!we(h)?E:o;if(b.keepDefaultValues||(o=y),!b.keepValues){if(b.keepDirtyValues||m)for(const k of l.mount)C(n.dirtyFields,k)?U($,k,C(a,k)):dt(k,C($,k));else{if(io&&J(h))for(const k of l.mount){const A=C(i,k);if(A&&A._f){const q=Array.isArray(A._f.refs)?A._f.refs[0]:A._f.ref;if(Lr(q)){const ee=q.closest("form");if(ee){ee.reset();break}}}}i={}}a=e.shouldUnregister?b.keepDefaultValues?je(o):{}:je($),p.array.next({values:{...$}}),p.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,p.state.next({submitCount:b.keepSubmitCount?n.submitCount:0,isDirty:b.keepDirty?n.isDirty:!!(b.keepDefaultValues&&!ut(h,o)),isSubmitted:b.keepIsSubmitted?n.isSubmitted:!1,dirtyFields:b.keepDirtyValues?n.dirtyFields:b.keepDefaultValues&&h?ho(o,h):{},touchedFields:b.keepTouched?n.touchedFields:{},errors:b.keepErrors?n.errors:{},isSubmitSuccessful:b.keepIsSubmitSuccessful?n.isSubmitSuccessful:!1,isSubmitting:!1})},Us=(h,b)=>zs(Je(h)?h(a):h,b);return{control:{register:yo,unregister:bo,getFieldState:Ls,handleSubmit:Bs,setError:Rs,_executeSchema:F,_getWatch:Q,_getDirty:R,_updateValid:_,_removeUnmounted:B,_updateFieldArray:T,_updateDisabledField:js,_getFieldArray:ve,_reset:zs,_resetDefaultValues:()=>Je(r.defaultValues)&&r.defaultValues().then(h=>{Us(h,r.resetOptions),p.state.next({isLoading:!1})}),_updateFormState:h=>{n={...n,...h}},_disableForm:Fg,_subjects:p,_proxyFormState:c,get _fields(){return i},get _formValues(){return a},get _state(){return s},set _state(h){s=h},get _defaultValues(){return o},get _names(){return l},set _names(h){l=h},get _formState(){return n},set _formState(h){n=h},get _options(){return r},set _options(h){r={...r,...h}}},trigger:mo,register:yo,handleSubmit:Bs,watch:Mg,setValue:dt,getValues:Fs,reset:Us,resetField:Lg,clearErrors:Dg,unregister:bo,setError:Rs,setFocus:(h,b={})=>{const y=C(i,h),E=y&&y._f;if(E){const $=E.refs?E.refs[0]:E.ref;$.focus&&($.focus(),b.shouldSelect&&$.select())}},getFieldState:Ls}}function zr(e={}){const t=ke.useRef(),r=ke.useRef(),[n,i]=ke.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={...Bv(e,()=>i(a=>({...a}))),formState:n});const o=t.current.control;return o._options=e,Tv({subject:o._subjects.state,next:a=>{Ov(a,o._proxyFormState,o._updateFormState,!0)&&i({...o._formState})}}),ke.useEffect(()=>o._disableForm(e.disabled),[o,e.disabled]),ke.useEffect(()=>{if(o._proxyFormState.isDirty){const a=o._getDirty();a!==n.isDirty&&o._subjects.state.next({isDirty:a})}},[o,n.isDirty]),ke.useEffect(()=>{e.values&&!ut(e.values,r.current)?(o._reset(e.values,o._options.resetOptions),r.current=e.values):o._resetDefaultValues()},[e.values,o]),ke.useEffect(()=>{o._state.mount||(o._updateValid(),o._state.mount=!0),o._state.watch&&(o._state.watch=!1,o._subjects.state.next({...o._formState})),o._removeUnmounted()}),t.current.formState=Iv(n,o),t.current}var Es=function(e,t,r){if(e&&"reportValidity"in e){var n=C(r,t);e.setCustomValidity(n&&n.message||""),e.reportValidity()}},zv=function(e,t){var r=function(i){var o=t.fields[i];o&&o.ref&&"reportValidity"in o.ref?Es(o.ref,i,e):o.refs&&o.refs.forEach(function(a){return Es(a,i,e)})};for(var n in t.fields)r(n)},Uv=function(e,t){t.shouldUseNativeValidation&&zv(e,t);var r={};for(var n in e){var i=C(t.fields,n),o=Object.assign(e[n]||{},{ref:i&&i.ref});if(qv(t.names||Object.keys(e),n)){var a=Object.assign({},Hv(C(r,n)));U(a,"root",o),U(r,n,a)}else U(r,n,o)}return r},Hv=function(e){return Array.isArray(e)?e.filter(Boolean):[]},qv=function(e,t){return e.some(function(r){return r.startsWith(t+".")})},Kv=function(e,t){for(var r={};e.issues.length;){var n=e.issues[0];if(n.path){var i=n.path.map(function(s){return s.key}).join(".");if(r[i]||(r[i]={message:n.message,type:n.validation}),t){var o=r[i].types,a=o&&o[n.validation];r[i]=fs(i,t,r,n.validation,a?[].concat(a,n.message):n.message)}e.issues.shift()}}return r},Ur=function(e,t,r){return r===void 0&&(r={}),function(n,i,o){try{return Promise.resolve(function(a,s){try{var l=function(){function d(c){return{values:r.raw?n:c,errors:{}}}var f=Object.assign({},{abortEarly:!1,abortPipeEarly:!1},t);return r.mode==="sync"?d(sr(e,n,f)):Promise.resolve(Rd(e,n,f)).then(d)}()}catch(d){return s(d)}return l&&l.then?l.then(void 0,s):l}(0,function(a){if(a instanceof on)return{values:{},errors:Uv(Kv(a,!o.shouldUseNativeValidation&&o.criteriaMode==="all"),o)};throw a}))}catch(a){return Promise.reject(a)}}};const Is=27,Os=12,Ts=10,Wv=Ht("enum"),Gv=e=>{const t={min:e.minSelected??0,max:e.maxSelected??e.options.length};return Ur(Ce({checked:si(ai(oi()),r=>Object.entries(r).filter(([n,i])=>i).map(([n,i])=>n),[lr(t.max,`Please select at most ${t.max} option${t.max!==1?"s":""}`),cr(t.min,`Please select at least ${t.min} option${t.min!==1?"s":""}`)])}))},Yv=ne(({option:e,...t},r)=>u(Y,{children:[u("input",{class:"peer sr-only h-full",type:"checkbox",...t,ref:r}),u("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:t.id,children:e.label})]})),As=$r("gutter-stable flex w-full flex-1 flex-wrap gap-3 overflow-y-auto rounded-xl p-2.5 pr-4",{variants:{variant:{singleOption:"justify-center",booleanLike:os}}}),Xv=({input:e,onSubmitSuccess:t})=>{var d,f;const r=e.key?(d=P.current$.value.flow)==null?void 0:d.data.submissions[e.key]:void 0,n=(e.config.minSelected===1||e.config.minSelected===void 0)&&e.config.maxSelected===1,i=n&&e.config.options.length===2,{register:o,handleSubmit:a,formState:{errors:s}}=zr({defaultValues:{checked:n?{}:Wv(r)?Object.fromEntries(r.value.map(c=>[c,!0])):{}},resolver:Gv(e.config)}),l=oo();return i?u("ul",{style:{maxHeight:6.5*Is+5*Os+2*Ts},class:As({variant:"booleanLike"}),children:e.config.options.map((c,p)=>u("li",{class:"flex-1",children:u(is,{type:"submit",ref:m=>{m&&p===0&&(l.current=m)},label:c.label,value:"true",onClick:()=>t({type:"enum",value:[c.value]})})},c.value))}):u("form",{noValidate:!0,onSubmit:c=>a(p=>{const m=p.checked;t({type:"enum",value:m})})(c),children:[u("div",{class:"flex items-center gap-1",children:[u("ul",{style:{maxHeight:6.5*Is+5*Os+2*Ts},class:As({variant:e.config.options.length===1?"singleOption":void 0}),children:e.config.options.map((c,p)=>{const m=`checked.${c.value}`,{ref:g,...v}=o(m);return u("li",{class:"relative",children:u(Yv,{option:c,autoFocus:p===0,ref:w=>{w&&p===0&&(l.current=w),g(w)},id:m,...v,onClick:n?()=>t({type:"enum",value:[c.value]}):void 0})},c.value)})}),u("div",{class:"flex flex-col items-center gap-2 pr-2.5 pt-2.5",children:[n?null:u(lt,{}),e.config.minSelected===0&&u(ct,{type:"button",onClick:()=>t({type:"enum",value:[]})})]})]}),u("div",{class:"px-1",children:u(Yt,{error:(f=s.checked)==null?void 0:f.root})})]})},Zv=Ht("number"),Hr={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`},Jv=e=>{const t=e.min??Number.MIN_SAFE_INTEGER,r=e.max??Number.MAX_SAFE_INTEGER,n=e.decimalCases??0;return Ur(Ce({number:an(Hr.number(),[Ud(t,Hr.min(t)),zd(r,Hr.max(r)),Vd(i=>i===Number(i.toFixed(n)),Hr.decimalCases(n))])}))},Qv=({input:e,onSubmitSuccess:t})=>{var f;const r=e.config.defaultValue,n=e.key?(f=P.current$.value.flow)==null?void 0:f.data.submissions[e.key]:void 0,{register:i,handleSubmit:o,formState:{errors:a}}=zr({defaultValues:{number:r?Number(r):Zv(n)?n.value:void 0},resolver:Jv(e.config)}),{ref:s,...l}=i("number",{required:!e.config.optional,valueAsNumber:!0}),d=L();return fe(()=>{d.current&&(d.current.focus(),d.current.select())},[]),u("form",{class:"flex flex-col gap-1 p-2.5",onSubmit:o(c=>{c.number!==void 0&&t({type:"number",value:c.number})}),children:[u("div",{class:"flex items-center gap-2",children:[u("div",{class:"relative min-w-0 flex-grow",children:[u("input",{...l,id:"chat-input",autocomplete:"off",autoCapitalize:"off",autoCorrect:"off",autoFocus:!0,ref:c=>{c&&(d.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&&u(ct,{class:"absolute right-0 top-0",onClick:()=>t(null)})]}),u(lt,{})]}),u(Yt,{error:a.number})]})},Ps=e=>{if(e==="")return{countryCode:"",phoneNumber:""};const t=Object.entries(eo).find(i=>e.startsWith(i[1])),r=t?t[1]:"",n=e.replace(r,"");return/^\d+$/.test(n)?{countryCode:r,phoneNumber:n}:{countryCode:"",phoneNumber:""}},eg="44",vo="That doesn’t look like a valid phone number",Ns=e=>({min:`The phone number needs to be at least ${e.minChars} digits long.`,max:`The phone number can't be longer than ${e.maxChars} digits.`}),tg=Ht("string"),rg=xe(vo,[li(/^\+?[0-9 -]+$/,vo)]),ng=xe("Please select a country code",[li(/^\+?[0-9 -]+$/,vo)]),og=()=>Ur(Ce({countryCode:ng,phoneNumber:si(rg,e=>e.replace(/[^0-9]/g,""),[])})),ig=({input:e,onSubmitSuccess:t})=>{var m;const r=e.key?(m=P.current$.value.flow)==null?void 0:m.data.submissions[e.key]:void 0,[n,i]=W(),{register:o,handleSubmit:a,formState:{errors:s},watch:l}=zr({defaultValues:e.config.defaultValue?Ps(e.config.defaultValue):tg(r)?Ps(r.value):{countryCode:eg,phoneNumber:""},resolver:og()}),{ref:d,...f}=o("phoneNumber",{required:!e.config.optional}),c=L(),p=l("countryCode");return fe(()=>{c.current&&(c.current.focus(),c.current.select())},[]),u("form",{noValidate:!0,class:"flex flex-col gap-1 p-2.5",onSubmit:a(g=>{const v=g.phoneNumber.replace(/[^0-9]/g,""),w=g.countryCode.replace(/[^0-9]/g,"");if(i(void 0),v.length+w.length>(e.config.maxChars||1/0))return i(Ns(e.config).max);if(v.length+w.length<(e.config.minChars||0))return i(Ns(e.config).min);t({type:"string",value:p+g.phoneNumber})}),children:[u("div",{class:"flex items-center gap-2",children:[u("div",{class:"relative flex min-w-0 flex-1 flex-grow gap-2",children:[u("label",{class:"text-neutral-12 bg-lowest hover:bg-neutral-5 placeholder:text-neutral-8 focus-visible:outline-accent-7 focus-within:bg-neutral-5 focus-within:outline-accent-7 outline-divider relative flex h-full cursor-pointer appearance-none items-center justify-center overflow-hidden text-ellipsis whitespace-nowrap rounded-l-full border-solid px-3 py-1.5 text-center text-base outline outline-2 transition-all focus-within:outline-none",htmlFor:`isdk_phone_${e.key}`,children:[u("span",{children:["+",p]}),u("select",{...o("countryCode",{}),id:`isdk_phone_${e.key}`,class:"absolute inset-0 opacity-0",children:Object.entries(eo).map(([g,v])=>u("option",{value:v,children:[g," (+",v,")"]},g))})]}),u("input",{...f,id:"chat-input",type:"tel",inputMode:"tel",autocomplete:"off",autoCapitalize:"off",autoCorrect:"off",autoFocus:!0,ref:g=>{g&&(c.current=g),d(g)},class:"outline-divider ease-expo-out placeholder:text-neutral-10 text-neutral-12 focus-visible:outline-accent-7 caret-accent-9 bg-lowest flex-1 rounded-r-full px-3 py-1 text-base outline outline-2 transition-all",placeholder:e.config.placeholder}),e.config.optional&&u(ct,{class:"absolute right-0 top-0",onClick:()=>t(null)})]}),u(lt,{})]}),u(Yt,{error:s.countryCode||s.phoneNumber||{message:n}})]})},ag=({input:e,onSubmitSuccess:t})=>u("div",{class:"flex flex-col items-center py-3",children:u("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:u("span",{class:"flex items-center gap-1.5",children:[u("span",{class:"inline-flex items-center text-sm font-medium",children:e.config.label||"Submit"}),u("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:[u("path",{d:"M4 8L8 4L12 8"}),u("path",{d:"M8 4V13"})]})]})})}),go={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"},sg={email:{type:"email",inputMode:"email",formNoValidate:!0},text:{type:"text",inputMode:"text"},url:{type:"url",inputMode:"url",formNoValidate:!0}},lg=Ht("string"),cg=e=>{const t={maxLength:`Please enter no more than ${e.maxChars??999} characters`,minLength:`Please enter ${e.minChars??1} or more characters`};return Ur(Ce({text:{email:xe(go.email,[Bd(go.email),cr(e.minChars??1,t.minLength),lr(e.maxChars??1/0,t.maxLength)]),text:xe([cr(e.minChars??1,t.minLength),lr(e.maxChars??1/0,t.maxLength)]),url:xe([Hd(go.url),cr(e.minChars??1,t.minLength),lr(e.maxChars??1/0,t.maxLength)])}[e.format]}))},ug=({input:e,onSubmitSuccess:t})=>{var f;const r=e.key?(f=P.current$.value.flow)==null?void 0:f.data.submissions[e.key]:void 0,n=e.config.defaultValue,{register:i,handleSubmit:o,formState:{errors:a}}=zr({defaultValues:{text:n||(lg(r)?r.value:"")},resolver:cg(e.config)}),{ref:s,...l}=i("text",{required:!e.config.optional}),d=L();return fe(()=>{d.current&&(d.current.focus(),d.current.select())},[]),u("form",{noValidate:!0,class:"flex flex-col gap-1 p-2.5",onSubmit:o(c=>{t({type:"string",value:c.text})}),children:[u("div",{class:"flex items-center gap-2",children:[u("div",{class:"relative min-w-0 flex-1",children:[u("input",{id:"chat-input",...l,...sg[e.config.format],autocomplete:"off",autoCapitalize:"off",autoCorrect:"off",autoFocus:!0,ref:c=>{c&&(d.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&&u(ct,{class:"absolute right-0 top-0",onClick:()=>t(null)})]}),u(lt,{})]}),u(Yt,{error:a.text})]})},dg=()=>{var i;const e=(i=P.current$.value.flow)==null?void 0:i.data.currentInput,[t,r]=tv(),n=L(null);return P.inputHeight$.value=r.height,V(()=>{const o=n.current;if(o)return o.addEventListener("transitionstart",X.scrollToEnd.smooth),o.addEventListener("transitioncancel",X.scrollToEnd.smooth),o.addEventListener("transitionend",X.scrollToEnd.smooth),()=>{o.removeEventListener("transitionstart",X.scrollToEnd.smooth),o.removeEventListener("transitioncancel",X.scrollToEnd.smooth),o.removeEventListener("transitionend",X.scrollToEnd.smooth)}},[]),u("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:u("div",{ref:t,class:"border-divider flex flex-col justify-end border-t",children:We({input:e}).with({input:N.nullish},()=>u("div",{class:"flex items-center gap-2 p-2.5",children:[u("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}),u(lt,{disabled:!0,"aria-hidden":"true",tabIndex:-1})]})).with({input:{type:"text"}},o=>u(ug,{onSubmitSuccess:X.onSubmitSuccessFn$.value,...o})).with({input:{type:"phone"}},o=>u(ig,{onSubmitSuccess:X.onSubmitSuccessFn$.value,...o})).with({input:{type:"multiple-choice"}},o=>u(Xv,{onSubmitSuccess:X.onSubmitSuccessFn$.value,...o})).with({input:{type:"boolean"}},o=>u(gv,{onSubmitSuccess:X.onSubmitSuccessFn$.value,...o})).with({input:{type:"file"}},o=>u(kv,{onSubmitSuccess:X.onSubmitSuccessFn$.value,...o})).with({input:{type:"submit"}},o=>u(ag,{onSubmitSuccess:X.onSubmitSuccessFn$.value,...o})).with({input:{type:"address"}},o=>u(dv,{onSubmitSuccess:X.onSubmitSuccessFn$.value,...o})).with({input:{type:"number"}},o=>u(Qv,{onSubmitSuccess:X.onSubmitSuccessFn$.value,...o})).exhaustive()})})};var fg=function(e){return e instanceof RegExp},hg=function(t){var r=/[\\^$.*+?()[\]{}|]/g,n=RegExp(r.source);return t&&n.test(t)?t.replace(r,"\\$&"):t},Ds=function(e){return typeof e=="string"},pg=function(e){var t=[];return e.forEach(function(r){Array.isArray(r)?t=t.concat(r):t.push(r)}),t};function vg(e,t,r){var n=0,i=0;if(e==="")return e;if(!e||!Ds(e))throw new TypeError("First argument to react-string-replace#replaceString must be a string");var o=t;fg(o)||(o=new RegExp("("+hg(o)+")","gi"));for(var a=e.split(o),s=1,l=a.length;s<l;s+=2){if(a[s]===void 0||a[s-1]===void 0){console.warn("reactStringReplace: Encountered undefined value during string replacement. Your RegExp may not be working the way you expect.");continue}i=a[s].length,n+=a[s-1].length,a[s]=r(a[s],s,n),n+=i}return a}var gg=function(t,r,n){return Array.isArray(t)||(t=[t]),pg(t.map(function(i){return Ds(i)?vg(i,r,n):i}))};const qr=Pe(gg),mg=/(\[[^\]]+\]\([^)]+\))/g,bg=/\[([^\]]+)\]\(([^)]+)\)/,yg=/(https?:\/\/[^\s]+)/g,wg=/_(.*?)_/g,_g=/\*\*(.*?)\*\*/g,Ms="text-accent-10 hover:text-accent-11 no-underline underline-offset-2 hover:underline",xg=e=>{const t=qr(e,mg,(o,a)=>{const[,s,l]=o.match(bg)??[];return l?u("a",{class:Ms,href:l,children:s??l},l+a):u("span",{children:"INVALID LINK"})}),r=qr(t,yg,(o,a)=>u("a",{class:Ms,href:o,children:o},o+a)),n=qr(r,wg,(o,a)=>u("em",{children:o},o+a));return qr(n,_g,(o,a)=>u("strong",{children:o},o+a))},kg=$r("select-text 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"}}),$g=({children:e,className:t,animate:r,side:n,...i})=>u("p",{style:{transformOrigin:n==="left"?"0% 50%":"100% 50%"},class:kg({className:t,side:n,animate:r}),...i,children:e}),Sg=({message:e})=>u("div",{class:"bg-accent-3 flex w-full items-center justify-center overflow-hidden rounded-xl px-2 py-2",children:u("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,u("svg",{class:"flex-none",width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:u("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"})})]})}),Cg=({className:e,...t})=>(V(()=>{X.scrollToEnd.smooth()}),u("div",{"aria-hidden":!0,children:X.isBotTyping$.value===!0?u("div",{"aria-label":"Typing…",class:ot("flex gap-1 p-4",e),...t,children:Array.from({length:3},(r,n)=>u("div",{class:"bg-accent-9 h-1.5 w-1.5 animate-bounce rounded-full",style:{animationDelay:`${-n*200}ms`}}))}):void 0})),Eg={bot:"left",user:"right"},Ig=$r("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]"}}}),Og=({lastSentMessageFooter:e})=>{var r;const t=((r=P.current$.value.flow)==null?void 0:r.data.messages)??[];return V(()=>{X.scrollToEnd.smooth()},[t.length]),u("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,i)=>u(Y,{children:u("li",{class:"flex",children:We(n).with({type:"system"},o=>u("p",{class:Ig({variant:o.variant}),children:o.text})).with({type:"text",author:N.union("bot","user")},o=>{const a=o.author==="user"&&!t.slice(i+1).some(d=>d.type==="text"&&d.author==="user"),s=i===t.length-1,l=o.author==="bot"?xg(o.text):o.text;return u($g,{animate:s,side:Eg[o.author],children:[l,a?e:null]},i)}).with({type:"link"},o=>u(Sg,{message:o})).with({type:"image"},o=>u("img",{class:"shadow-surface-md w-full max-w-[min(100%,24rem)] rounded-2xl",src:o.url,style:{aspectRatio:o.width/o.height}})).with({type:"file"},o=>u(wv,{class:o.author==="bot"?void 0:"ml-auto",file:{name:o.fileName,sizeKb:o.fileSizeKb}})).with({type:"loading"},o=>{const a=t[t.length-1];return!(o===a)||X.isBotTyping$.value?null:u("div",{class:"flex flex-grow flex-col items-center justify-center",children:u(Ka,{class:"text-neutral-6 h-8 w-8"})})}).exhaustive()})},i)),u(Cg,{},"typing")]})},Tg=({logger:e,apiClient:t,analytics:r})=>{const{flow:n}=P.current$.value;$e(n,"Flow is required to exist to show chatbot body");const i=P.viewState$.value,{chatRef:o,chatService:a}=sv(),[s,l]=W();return fe(()=>{i==="maximised"&&X.scrollToEnd.instant()},[i]),fe(()=>{var v,w;const{state:d,flow:f}=P.current$.peek();if(d!=="loaded")throw new Error(kp.invalid_state);let c=f.data.nodeHistory.at(-1);if(X.scrollToEnd.instant(),P.setInput(void 0),f.data.isFinished)return;c===void 0?(c=Ba(n.nodes).id,P.setCurrentNodeId(c),r.log({event:"FLOW_START",properties:{flow_id:n.id,flow_version:n.version,flow_session_id:f.data.flowSessionId,flow_build:n.build,job:n.job},customProperties:(v=n.analytics)==null?void 0:v.customProperties})):P.removeMessagesSentByNodeIds([c]);const{interpret:p,abort:m,undo:g}=Lp({context:n.context,analytics:{service:r,customProperties:(w=n.analytics)==null?void 0:w.customProperties},apiClient:t,logger:e,flow:n,chatService:a,getSubmissions:()=>{var x;return(x=P.current$.peek().flow)==null?void 0:x.data.submissions},onInterpret:(x,_)=>{var T;const I=P.current$.peek().flow;$e(I),_&&(I.data.sequence=I.data.sequence+1,r.log({event:"FLOW_NODE",properties:{flow_id:n.id,flow_version:n.version,from_node_id:_.id,flow_build:n.build,to_node_id:x.id,sequence:I.data.sequence,flow_session_id:I.data.flowSessionId,job:n.job},customProperties:(T=n.analytics)==null?void 0:T.customProperties})),P.setCurrentNodeId(x.id)},onFlowEnd:async()=>{var _;P.markAsFinished();const x=P.current$.peek().flow;$e(x),r.log({event:"FLOW_END",properties:{flow_id:n.id,flow_version:n.version,flow_session_id:x.data.flowSessionId,flow_build:n.build,job:n.job},customProperties:(_=n.analytics)==null?void 0:_.customProperties})}});return l(()=>g),p(c),m},[r,t,a,e,n]),u(Y,{children:[u("div",{ref:o,className:"hide-scrollbars relative flex w-full max-w-full flex-grow flex-col overflow-y-scroll",style:{WebkitOverflowScrolling:"touch",paddingBottom:P.inputHeight$.value},children:u(Og,{lastSentMessageFooter:n.data.isFinished||!s?null:u(Pg,{undoFn:s})})}),u(dg,{})]})},Ag=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"):[],Pg=({undoFn:e})=>u("div",{class:"absolute bottom-0 right-0 flex w-full translate-y-full justify-end",children:u("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}=P.current$.peek();$e(t);const{removed:r}=e(t.data.nodeHistory),n=t.data.nodeHistory.splice(-r);n.length!==0&&(P.removeMessagesSentByNodeIds(n),P.setInput(void 0),n.pop(),n.map(i=>t.nodes.find(o=>o.id===i)).filter(Boolean).flatMap(Ag).forEach(i=>delete t.data.submissions[i]),P.current$.value={...P.current$.value})},children:"Undo"})}),Ng=Object.freeze(Object.defineProperty({__proto__:null,ChatbotBody:Tg},Symbol.toStringTag,{value:"Module"}))})();
45
+ }`},Za=({context:e,schema:t,logger:r})=>{if(t)for(const n in t){const i=t[n];if(!i)continue;const o=Pt(e,n,null);if(i.required&&o===null){const a=`Configuration error in context: ${n} is required`;throw r.error(a),new Error(a)}switch(i.type){case"number":if(typeof o!="number")throw new Error(`Configuration error in context: ${n} is not a number`);break;case"string":if(typeof o!="string")throw new Error(`Configuration error in context: ${n} is not a string`);break;default:i.type}}},Dp=({_internal_domManager:e=$p(),theme:t})=>Qe(({apiClient:r,logger:n,analytics:i})=>{let o=!1;const a=()=>{if(typeof window>"u")return;const s=[D("style",{id:"inploi-chatbot-styles"},xp),D("style",{id:"inploi-chatbot-theme"},Np(t))],l=e.getOrCreateChatbotElement();gt(D(Y,{},[s,D(yp,{apiClient:r,logger:n,analytics:i})]),l),o=!0};return{prepare:async()=>{if(!(typeof window>"u"))try{if(o)return;a(),n.info("Chatbot plugin prepared")}catch(s){n.error("Error preparing chatbot plugin",s)}},fetchFlowByJobId:async(s,l)=>{const d=new URLSearchParams({id_type:(l==null?void 0:l.idType)==="inploi"?"internal":"external"});return r.fetch([`/flow/job/${s}`,d.toString()].filter(Boolean).join("?")).then(f=>{const c=sr(_p,f);return{flow:c.flow,title:`Applying for “${c.job.title}”`,flowKeys:[c.job.id,...(l==null?void 0:l.flowKeys)??[]],job:{id:c.job.id,id_type:"external"},...l}})},fetchFlowById:async(s,l)=>r.fetch(`/flow/id/${s}`).then(d=>{var c;const f=sr(wp,d);return{flow:f.flow,title:"Chatbot",flowKeys:(l==null?void 0:l.flowKeys)??[],...l,analytics:{customProperties:{flow_id:f.flow.id,flow_version:f.flow.version,...(c=l==null?void 0:l.analytics)==null?void 0:c.customProperties}}}}),open:async s=>{if(!(typeof window>"u"))try{P.cancelCurrentFlow(),P.viewState$.value="maximised",o||a(),s instanceof Promise?(P.current$.value={state:"loading"},s.then(async l=>{Za({context:l.context||{},schema:l.flow.context_schema,logger:n}),P.startFlow(l)}).catch(l=>{const d=l instanceof Error?l.message:"An error occurred";P.current$.value={state:"error",error:d}})):(Za({context:s.context||{},schema:s.flow.context_schema,logger:n}),P.startFlow(s))}catch(l){n.error("Error starting flow",l)}},close:async()=>{typeof window>"u"||(P.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=Dp;const Gt=(e,{context:t,submissions:r})=>{const[n,...i]=e.data.compareKey.split(".");if(!n)return!1;const o=Qa({context:t,key:n,path:i,submissions:r});if(!o)return!1;switch(o.type){case"address":{const a=Pt(o.value,i.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 o.value!="object"||Array.isArray(o.value))return!1;const a=Pt(o.value,i.join(".")),s={...e,data:{...e.data,compareKey:"_temp"}};switch(typeof a){case"boolean":return Gt(s,{submissions:{_temp:{value:a,type:"boolean"}},context:t});case"string":return Gt(s,{submissions:{_temp:{value:a,type:"string"}},context:t});case"number":return Gt(s,{submissions:{_temp:{value:a,type:"number"}},context:t});case"object":return Array.isArray(a)&&a.every(za)?Gt(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 o.value===a;case"notEquals":return o.value!==a}break}case"string":switch(e.data.compare){case"equals":return o.value===e.data.compareValue;case"contains":return o.value?o.value.includes(e.data.compareValue):!1;case"notEquals":return o.value!==e.data.compareValue;case"notContains":return o.value?!o.value.includes(e.data.compareValue):!0}break;case"number":{try{const a=Number(e.data.compareValue);switch(e.data.compare){case"equals":return o.value===a;case"notEquals":return o.value!==a;case"greaterThan":return o.value>a;case"greaterThanOrEqualTo":return o.value>=a;case"lessThan":return o.value<a;case"lessThanOrEqualTo":return o.value<=a}}catch{return console.error(`Failed to parse number in if-block ${e.id}`,o.value),!1}break}case"enum":switch(e.data.compare){case"equals":return o.value.length===1&&o.value[0]===e.data.compareValue;case"notEquals":return o.value.length===1&&o.value[0]!==e.data.compareValue;case"contains":return o.value.includes(e.data.compareValue);case"notContains":return!o.value.includes(e.data.compareValue)}break}return!1},Mp=/{{\s*([^}]+?)\s*(?:\|\s*([^}]+?)\s*)?}}/g,Re=(e,{context:t,submissions:r})=>e.replace(Mp,(n,i,o="")=>{const[a,...s]=i.trim().split("."),l=Qa({key:a,path:s,submissions:r,context:t});if(!l)return o;switch(l.type){case"boolean":return l.value===!0?"true":"false";case"file":return l.value.map(d=>`${d.name} (${Ut(d.sizeKb)})`).join(", ");case"enum":return l.value.join(", ");case"address":return Object.values(l.value).filter(d=>d&&d.trim().length>0).join(", ");case"number":case"string":return l.value?l.value.toString():o;case"integration":{if(typeof l.value!="object"||Array.isArray(l.value))break;const d=Pt(l.value,s.join("."));switch(typeof d){case"boolean":return d===!0?"true":"false";case"string":return d;case"number":return d.toString();case"object":if(Array.isArray(d)&&d.every(za))return d.join(", ")}break}}return o}),Ja=({node:e,nodes:t,stopWhen:r})=>{if((r==null?void 0:r(e))===!0)return e;const n=e.nextId?t.find(i=>i.id===e.nextId):void 0;if(n)return Ja({node:n,nodes:t,stopWhen:r})},Fp=({childNode:e,nodes:t})=>{const n=t.filter(i=>i.type==="if-block").find(i=>{if(!i.branchId)return!1;const o=t.find(s=>s.id===i.branchId);if(!o)return!1;const a=Ja({node:o,nodes:t,stopWhen:s=>s.id===e.id});return!(!a||a.id!==e.id)});if(n!=null&&n.nextId)return t.find(i=>i.id===n.nextId)},Lp=({flow:e,analytics:t,logger:r,context:n,apiClient:i,getSubmissions:o,chatService:a,onFlowEnd:s,onInterpret:l})=>{let d=new AbortController;const f={...t.service,log:p=>t.service.log({...p,customProperties:{...p.customProperties,...t.customProperties}})},c=async(p,m)=>{const g=o();l==null||l(p,m);try{await Rp({flow:e,analytics:f,logger:r,apiClient:i,context:n,node:p,submissions:g,chat:{sendMessage:async v=>a.send({groupId:p.id,message:v,signal:d.signal}),userInput:async v=>a.input({input:v,signal:d.signal}),addToSubmissions:a.addToSubmissions},next:v=>{const w=v?e.nodes.find(x=>x.id===v):Fp({childNode:p,nodes:e.nodes});return w?c(w,p):s==null?void 0:s(p)},end:()=>s==null?void 0:s(p)})}catch(v){if(v instanceof qt)return;throw v}};return{interpret:async p=>{const m=e.nodes.find(g=>g.id===p)??Ba(e.nodes);return c(m)},undo:p=>{let m=1;const g=e.nodes.find(w=>w.id===p[p.length-1]);for(let w=p.length-2;w>0;w--){const x=p[w],_=e.nodes.find(I=>I.id===x);if(!_||(m++,_.type.startsWith("question-")))break}d.abort(),d=new AbortController;const v=e.nodes.find(w=>w.id===p[p.length-m]);return $e(v,"Undo failed: new start node not found"),c(v,g),{removed:m}},abort:()=>{d.abort()}}};async function Rp(e){const t=e.node;switch(t.type){case"text":return qp({...e,node:t});case"image":return Kp({...e,node:t});case"question-text":return Wp({...e,node:t});case"question-enum":return Yp({...e,node:t});case"question-number":return Gp({...e,node:t});case"question-boolean":return Xp({...e,node:t});case"question-file":return Jp({...e,node:t});case"question-address":return Zp({...e,node:t});case"end-flow":return Qp({...e,node:t});case"if-block":return Hp({...e,node:t});case"jump":return Vp({...e,node:t});case"link":return Up({...e,node:t});case"integration-application-submit":return zp({...e,node:t});case"add-submission":return Bp({...e,node:t});case"integration-workflow-get":throw Error("Workflow should be unreachable");case"identify":return jp({...e,node:t});default:throw new Error(`Unknown node: ${JSON.stringify(t)}`)}}async function jp({next:e,node:t,analytics:r,submissions:n,logger:i}){var a;if(!n)return e(t.nextId);const o=(a=n[t.data.key])==null?void 0:a.value;if(typeof o!="string"&&typeof o!="number")return i.warn(`Failed to identify user, key “${t.data.key}” is not a string or number`),e(t.nextId);r.log({event:"IDENTIFY",properties:{identifier:o.toString()}}),e(t.nextId)}async function Vp({next:e,node:t}){e(t.data.targetId)}async function Bp({next:e,node:t,logger:r,submissions:n,context:i}){if(!n){r.error("Submissions not found");return}n[t.data.key]={type:"string",value:Re(t.data.value,{submissions:n,context:i})},e(t.nextId)}async function zp({chat:e,next:t,node:r,logger:n,apiClient:i,submissions:o,analytics:a,flow:s}){const l=async d=>{d!==!0&&await e.userInput({type:"submit",key:void 0,config:{label:r.data.submitLabel}}),await e.sendMessage({type:"loading"});const{anonymous_id:f,session_id:c}=a.getSessionInfo(),p=await i.fetch("/flow/submit",{method:"POST",body:JSON.stringify({log_submit:!1,integration_id:r.data.integrationId,anonymous_id:f,session_id:c,job:s.job,submissions:sp(o||{})})}).catch(m=>m);r.data.key&&e.addToSubmissions(r.data.key,{type:"integration",value:p}),We(p).with({integration_response:N.select(N.union({service:N.optional(N.string),status:N.number,data:N.any},{service:N.optional(N.string),status:N.number,error:{message:N.string,data:N.any}}))},m=>{a.log({event:"FLOW_SUBMIT",properties:{flow_id:s.id,flow_version:s.version,flow_session_id:s.data.flowSessionId,flow_build:s.build,service:m.service??"INVALID_SERVICE",response:{status:m.status,payload:"data"in m?m.data:m.error.data??null},job:s.job}})}).otherwise(()=>{}),await We(p).with(N.union({ats_data:N.select("redirect",{redirect_url:N.string,message:N.optional(N.union(N.string,N.nullish)),button_text:N.optional(N.union(N.string,N.nullish))})},{integration_response:{data:N.select("redirect",{redirect_url:N.string,message:N.optional(N.union(N.string,N.nullish)),button_text:N.optional(N.union(N.string,N.nullish))})}}),async m=>{if(m.redirect===void 0)return;await e.sendMessage({type:"text",author:"bot",text:m.redirect.message??"Almost there! Please complete your submission here:"});const g=new URL(m.redirect.redirect_url);f&&!g.searchParams.has("anonymous_id")&&g.searchParams.set("anonymous_id",f),await e.sendMessage({type:"link",href:g.toString(),text:m.redirect.button_text??"Complete submission",onClick:()=>{if(!c){n.error("session_id not set, cannot log FLOW_REDIRECT event");return}a.log({event:"FLOW_REDIRECT",properties:{flow_build:s.build,flow_id:s.id,flow_session_id:c,flow_version:s.version,href:g.toString(),job:s.job}})}}),t(r.nextId)}).with({success:!0},async()=>{r.data.skipConfirmation!==!0&&await e.sendMessage({type:"system",variant:"success",text:"Submission completed!"}),t(r.nextId)}).with(N.union({success:!1,ats_data:N.select("error",{message:N.string})},{integration_response:{error:N.select("error",{message:N.string})}}),async m=>{var g;n.error(m.error),await e.sendMessage({type:"system",variant:"error",text:((g=m.error)==null?void 0:g.message)||"Failed to submit"}),await l(!1)}).otherwise(async m=>{n.error(m),await e.sendMessage({type:"system",variant:"error",text:"Failed to submit"}),await l(!1)})};await l(r.data.skipConfirmation)}async function Up({chat:e,next:t,node:r,submissions:n,context:i}){await e.sendMessage({type:"link",href:Re(r.data.href,{submissions:n,context:i}),text:Re(r.data.cta,{submissions:n,context:i})}),t(r.nextId)}async function Hp({submissions:e,next:t,node:r,context:n}){t(Gt(r,{submissions:e,context:n})?r.branchId:r.nextId)}async function qp({chat:e,next:t,node:r,submissions:n,context:i}){await e.sendMessage({author:"bot",type:"text",text:Re(r.data.text,{submissions:n,context:i})}),t(r.nextId)}async function Kp({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 Wp({chat:e,next:t,node:r,submissions:n,context:i}){await e.sendMessage({author:"bot",type:"text",text:Re(r.data.question,{submissions:n,context:i})});const o=r.data.format==="phone"?await e.userInput({key:r.data.key,type:"phone",config:{optional:r.data.optional,placeholder:r.data.placeholder,maxChars:r.data.maxChars,minChars:r.data.minChars}}):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,minChars:r.data.minChars}});o===null?await e.sendMessage({type:"system",variant:"info",text:"Skipped"}):await e.sendMessage({author:"user",type:"text",text:o.value}),t(r.nextId)}async function Gp({chat:e,next:t,node:r,submissions:n,context:i}){await e.sendMessage({author:"bot",type:"text",text:Re(r.data.question,{submissions:n,context:i})});const o=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}});o===null?await e.sendMessage({type:"system",variant:"info",text:"Skipped"}):await e.sendMessage({author:"user",type:"text",text:o.value.toString()}),t(r.nextId)}async function Yp({chat:e,next:t,node:r,submissions:n,context:i}){await e.sendMessage({author:"bot",type:"text",text:Re(r.data.question,{submissions:n,context:i})});const o=await e.userInput({key:r.data.key,type:"multiple-choice",config:r.data});o.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=>o.value.includes(a.value)).map(a=>a.label).join(", ")}),t(r.nextId)}async function Xp({chat:e,next:t,node:r,submissions:n,context:i}){await e.sendMessage({author:"bot",type:"text",text:Re(r.data.question,{submissions:n,context:i})});const o=await e.userInput({key:r.data.key,type:"boolean",config:{optional:r.data.optional,labels:{true:r.data.trueLabel,false:r.data.falseLabel}}});o===null?await e.sendMessage({type:"system",variant:"info",text:"Skipped"}):await e.sendMessage({author:"user",type:"text",text:o.value===!0?r.data.trueLabel:r.data.falseLabel}),t(r.nextId)}async function Zp({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 i=Object.values(n.value).filter(o=>o&&o.trim().length>0).join(", ");await e.sendMessage({author:"user",type:"text",text:i})}return t(r.nextId)}async function Jp({node:e,chat:t,next:r,submissions:n,context:i}){await t.sendMessage({author:"bot",type:"text",text:Re(e.data.question,{submissions:n,context:i})});const o=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(o===null)await t.sendMessage({type:"system",variant:"info",text:"Skipped"});else for(const a of o.value)await t.sendMessage({author:"user",type:"file",fileName:a.name,fileSizeKb:a.sizeKb});r(e.nextId)}async function Qp({chat:e,end:t,node:r}){await e.sendMessage({type:"system",variant:"info",text:r.data.systemMessage}),t()}const Qa=({key:e,path:t,submissions:r,context:n})=>{if(e==="$context"){if(!t)return;const i=Pt(n,t.join("."));switch(typeof i){case"string":return{type:"string",value:i};case"number":return{type:"number",value:i};case"boolean":return{type:"boolean",value:i};default:console.warn(`Unexpected type for $context.${t.join(".")}`,i);return}}return r==null?void 0:r[e]};function Jn(e,t,r){var n,i,o,a,s;t==null&&(t=100);function l(){var f=Date.now()-a;f<t&&f>=0?n=setTimeout(l,t-f):(n=null,r||(s=e.apply(o,i),o=i=null))}var d=function(){o=this,i=arguments,a=Date.now();var f=r&&!n;return n||(n=setTimeout(l,t)),f&&(s=e.apply(o,i),o=i=null),s};return d.clear=function(){n&&(clearTimeout(n),n=null)},d.flush=function(){n&&(s=e.apply(o,i),o=i=null,clearTimeout(n),n=null)},d}Jn.debounce=Jn;var ev=Jn;const es=Pe(ev);function tv(e){let{debounce:t,scroll:r,polyfill:n,offsetSize:i}=e===void 0?{debounce:0,scroll:!1,offsetSize:!1}:e;const o=n||(typeof window>"u"?class{}:window.ResizeObserver);if(!o)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}),d=t?typeof t=="number"?t:t.scroll:null,f=t?typeof t=="number"?t:t.resize:null,c=L(!1);V(()=>(c.current=!0,()=>void(c.current=!1)));const[p,m,g]=he(()=>{const _=()=>{if(!l.current.element)return;const{left:I,top:T,width:O,height:H,bottom:K,right:M,x:F,y:se}=l.current.element.getBoundingClientRect(),re={left:I,top:T,width:O,height:H,bottom:K,right:M,x:F,y:se};l.current.element instanceof HTMLElement&&i&&(re.height=l.current.element.offsetHeight,re.width=l.current.element.offsetWidth),Object.freeze(re),c.current&&!iv(l.current.lastBounds,re)&&s(l.current.lastBounds=re)};return[_,f?es(_,f):_,d?es(_,d):_]},[s,i,d,f]);function v(){l.current.scrollContainers&&(l.current.scrollContainers.forEach(_=>_.removeEventListener("scroll",g,!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 o(g),l.current.resizeObserver.observe(l.current.element),r&&l.current.scrollContainers&&l.current.scrollContainers.forEach(_=>_.addEventListener("scroll",g,{capture:!0,passive:!0})))}const x=_=>{!_||_===l.current.element||(v(),l.current.element=_,l.current.scrollContainers=ts(_),w())};return nv(g,!!r),rv(m),V(()=>{v(),w()},[r,g,m]),V(()=>v,[]),[x,a,p]}function rv(e){V(()=>{const t=e;return window.addEventListener("resize",t),()=>void window.removeEventListener("resize",t)},[e])}function nv(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 ts(e){const t=[];if(!e||e===document.body)return t;const{overflow:r,overflowX:n,overflowY:i}=window.getComputedStyle(e);return[r,n,i].some(o=>o==="auto"||o==="scroll")&&t.push(e),[...t,...ts(e.parentElement)]}const ov=["x","y","top","bottom","left","right","width","height"],iv=(e,t)=>ov.every(r=>e[r]===t[r]),lt=({class:e,...t})=>u("button",{class:ot("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:u("svg",{class:"block",width:"16",height:"16",viewBox:"0 0 16 16",fill:"transparent",stroke:"currentColor","stroke-linecap":"round","stroke-width":"2",children:[u("title",{children:"Send"}),u("path",{d:"M3.5 7.5L8 3L12.5 7.5"}),u("path",{d:"M8 4V13"})]})}),av=25,Qn=Ge({instant:()=>{},smooth:()=>{}}),X={onSubmitSuccessFn$:Ge(()=>{}),isBotTyping$:Ge(!1),scrollToEnd:{instant:()=>Qn.value.instant(),smooth:()=>Qn.value.smooth()}},sv=()=>{const e=L(null);fe(()=>{Qn.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=he(()=>({addToSubmissions:(n,i)=>P.setSubmission(n,i),send:async({message:n,signal:i,groupId:o})=>{if(await We(n).with({author:"bot",type:"text"},async a=>{if(i!=null&&i.aborted)throw new qt;X.isBotTyping$.value=!0;const s=Math.min(Math.max(20,a.text.length),100)*av;await new Promise(l=>setTimeout(l,s,{signal:i})),X.isBotTyping$.value=!1}).otherwise(async()=>{}),i!=null&&i.aborted)throw new qt;P.addMessage(n,o)},input:({input:n,signal:i})=>{if(i!=null&&i.aborted)throw new qt;return P.setInput(n),new Promise(o=>{const a=s=>{if(i!=null&&i.aborted)throw new qt;P.setInput(void 0),n.key&&P.setSubmission(n.key,s),o(s)};X.onSubmitSuccessFn$.value=a})}}),[]);return{chatRef:e,chatService:t}},ct=({class:e,...t})=>u("button",{type:"button",class:ot("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:[u("svg",{class:"block",width:"16",height:"16",viewBox:"0 0 16 16",fill:"transparent",stroke:"currentColor","stroke-linecap":"round","stroke-width":"1.5",children:[u("title",{children:"Skip"}),u("path",{d:"M3.25 11.25A5 5 0 0 1 12 7"}),u("path",{d:"M13.25 4.5V8.25H9.5"})]}),"Skip"]}),eo={Afghanistan:"93",Albania:"355",Algeria:"213","American Samoa":"1 684",Andorra:"376",Angola:"244",Anguilla:"1 264",Antarctica:"672","Antigua and Barbuda":"1 268",Argentina:"54",Armenia:"374",Aruba:"297",Australia:"61",Austria:"43",Azerbaijan:"994",Bahrain:"973",Bangladesh:"880",Barbados:"1 246",Belarus:"375",Belgium:"32",Belize:"501",Benin:"229",Bermuda:"1 441",Bhutan:"975",Bolivia:"591","Bosnia and Herzegovina":"387",Botswana:"267","Bouvet Island":"47",Brazil:"55","British Indian Ocean Territory":"246","British Virgin Islands":"1 284",Brunei:"673",Bulgaria:"359","Burkina Faso":"226",Burundi:"257","Cabo Verde":"238",Cambodia:"855",Cameroon:"237",Canada:"1","Caribbean Netherlands":"599","Cayman Islands":"1 345","Central African Republic":"236",Chad:"235",Chile:"56",China:"86","Christmas Island":"61","Cocos (Keeling) Islands":"61",Colombia:"57",Comoros:"269","Cook Islands":"682","Costa Rica":"506",Croatia:"385",Cuba:"53",Curaçao:"599",Cyprus:"357",Czechia:"420","Côte d'Ivoire":"225","Democratic Republic of the Congo":"243",Denmark:"45",Djibouti:"253","Dominican Republic":"1 809",Ecuador:"593",Egypt:"20","El Salvador":"503","Equatorial Guinea":"240",Eritrea:"291",Estonia:"372",Eswatini:"268",Ethiopia:"251","Falkland Islands (Islas Malvinas)":"500","Faroe Islands":"298",Fiji:"679",Finland:"358",France:"33","French Guiana":"594","French Polynesia":"689","French Southern and Antarctic Lands":"262",Gabon:"241",Georgia:"995",Germany:"49",Ghana:"233",Gibraltar:"350",Greece:"30",Greenland:"299",Grenada:"1 473",Guadeloupe:"590",Guam:"1 671",Guatemala:"502",Guernsey:"44",Guinea:"224","Guinea-Bissau":"245",Guyana:"592",Haiti:"509",Honduras:"504","Hong Kong":"852",Hungary:"36",Iceland:"354",India:"91",Indonesia:"62",Iran:"98",Iraq:"964",Ireland:"353","Isle of Man":"44",Israel:"972",Italy:"39",Jamaica:"1 876",Japan:"81",Jersey:"44",Jordan:"962",Kazakhstan:"7",Kenya:"254",Kiribati:"686",Kosovo:"383",Kuwait:"965",Kyrgyzstan:"996",Laos:"856",Latvia:"371",Lebanon:"961",Lesotho:"266",Liberia:"231",Libya:"218",Liechtenstein:"423",Lithuania:"370",Luxembourg:"352",Macao:"853",Madagascar:"261",Malawi:"265",Malaysia:"60",Maldives:"960",Mali:"223",Malta:"356","Marshall Islands":"692",Martinique:"596",Mauritania:"222",Mauritius:"230",Mayotte:"262",Mexico:"52",Micronesia:"691",Moldova:"373",Monaco:"377",Mongolia:"976",Montenegro:"382",Montserrat:"1 664",Morocco:"212",Mozambique:"258","Myanmar (Burma)":"95",Namibia:"264",Nauru:"674",Nepal:"977",Netherlands:"31","New Caledonia":"687","New Zealand":"64",Nicaragua:"505",Niger:"227",Nigeria:"234",Niue:"683","Norfolk Island":"672","North Korea":"850","North Macedonia":"389","Northern Mariana Islands":"1 670",Norway:"47",Oman:"968",Pakistan:"92",Palau:"680",Palestine:"970",Panama:"507","Papua New Guinea":"675",Paraguay:"595",Peru:"51",Philippines:"63","Pitcairn Islands":"64",Poland:"48",Portugal:"351","Puerto Rico":"1 787",Qatar:"974",Romania:"40",Russia:"7",Rwanda:"250",Réunion:"262","Saint Barthélemy":"590","Saint Helena, Ascension and Tristan da Cunha":"290","Saint Kitts and Nevis":"1 869","Saint Lucia":"1 758","Saint Martin":"590","Saint Pierre and Miquelon":"508","Saint Vincent and the Grenadines":"1 784",Samoa:"685","San Marino":"378","Saudi Arabia":"966",Senegal:"221",Serbia:"381",Seychelles:"248","Sierra Leone":"232",Singapore:"65","Sint Maarten":"1 721",Slovakia:"421",Slovenia:"386","Solomon Islands":"677",Somalia:"252","South Africa":"27","South Georgia and the South Sandwich Islands":"500","South Korea":"82","South Sudan":"211",Spain:"34","Sri Lanka":"94",Sudan:"249",Suriname:"597","Svalbard and Jan Mayen":"47",Sweden:"46",Switzerland:"41",Syria:"963","São Tomé and Príncipe":"239",Taiwan:"886",Tajikistan:"992",Tanzania:"255",Thailand:"66","The Bahamas":"1 242","The Gambia":"220","Timor-Leste":"670",Togo:"228",Tokelau:"690",Tonga:"676","Trinidad and Tobago":"1 868",Tunisia:"216",Turkmenistan:"993","Turks and Caicos Islands":"1 649",Tuvalu:"688",Türkiye:"90","U.S. Virgin Islands":"1 340",Uganda:"256",Ukraine:"380","United Arab Emirates":"971","United Kingdom":"44","United States":"1","United States Minor Outlying Islands":"1",Uruguay:"598",Uzbekistan:"998",Vanuatu:"678","Vatican City":"379",Venezuela:"58",Vietnam:"84","Wallis and Futuna":"681","Western Sahara":"212",Yemen:"967",Zambia:"260",Zimbabwe:"263","Åland Islands":"358"},rs={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"]},Mr=Object.keys(rs),lv=e=>Mr.reduce((t,r)=>{const n=rs[r],i=e.filter(o=>o.types.some(a=>n.includes(a))).map(o=>o.long_name).join(", ");return i&&(t[r]=i),t},{}),cv=document.createElement("div"),uv=()=>he(()=>{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(cv);return{enabled:!0,getPredictions:async n=>{const{predictions:i}=await t.getPlacePredictions({input:n,language:"en"});return i.map(o=>({label:o.description,value:o.place_id}))},getPlaceDetails:async n=>await new Promise((o,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"):o({ok:!0,place:s}))).catch(async o=>(console.error("Failed to get address details",o),{ok:!1}))}},[]),to=e=>u("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:[u("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:u("path",{d:"M10 3L5 8L10 13"})}),u("span",{children:"Back"})]}),ro={label:"Fill in manually",value:""},dv=({input:e,onSubmitSuccess:t})=>{const[r,n]=W(""),[i,o]=W(),[a,s]=W([]),[l,d]=W(),{enabled:f,getPredictions:c,getPlaceDetails:p}=uv(),[m,g]=W(f?"query":"manual"),v=w=>{$e(f,"Query state should not be enabled if Google Places isn't available"),n(w),w===""&&s([]),c(w).then(x=>{s(x)})};switch(V(()=>{if(f&&!(l===void 0||l===""))return p(l).then(w=>{if(!w.ok||!w.place.address_components){o({});return}const x=lv(w.place.address_components);o(x),g("details")}),()=>{o(void 0)}},[l,p,f]),m){case"query":return $e(f,"Query state should not be enabled if Google Places isn't available"),u(fv,{input:e,onSkip:()=>t(null),onAddressSelect:w=>{d(w),g("loading")},onAddressSearch:w=>{v(w)},suggestions:a,query:r});case"loading":return u(no,{input:e,onSubmitSuccess:t,addressFields:{},actions:u(to,{onClick:()=>{d(void 0),g("query")}})});case"details":return $e(i!==void 0),u(no,{input:e,onSubmitSuccess:t,addressFields:i,actions:u(to,{onClick:()=>{d(void 0),g("query")}})});case"manual":return u(no,{input:e,onSubmitSuccess:t,addressFields:{},actions:f?u(to,{onClick:()=>{d(void 0),g("query")}}):void 0})}},fv=({input:e,onSkip:t,suggestions:r,onAddressSelect:n,query:i,onAddressSearch:o})=>{const a=L(null);return fe(()=>{a.current&&(a.current.focus(),a.current.select())},[]),u(Y,{children:[u("form",{noValidate:!0,onSubmit:s=>{s.preventDefault();const d=new FormData(s.currentTarget).get("address");typeof d=="string"&&o(d)},class:"flex gap-1 p-2.5",children:[u("div",{class:"group relative flex-1",children:[u("input",{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||"Type and search for places...",defaultValue:i}),u("button",{type:"submit",class:"touch-hitbox text-neutral-12 hover:bg-neutral-3 fr absolute bottom-0 right-0 top-0 flex cursor-pointer items-center gap-1 rounded-full px-3 transition-all",children:u("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[u("g",{id:"inploi",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round",strokeWidth:"1.5",children:[u("circle",{cx:"7",cy:"7",r:"4"}),u("path",{d:"M10 10L13 13"})]}),u("span",{class:"sr-only",children:"Search"})]})})]}),e.config.optional&&u(ct,{class:"",onClick:t})]}),u("ul",{children:[r.map(s=>u("li",{children:u("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:[u("span",{class:"flex-grow",children:s.label}),u("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:u("path",{d:"M6 3L11 8L6 13"})})]})},s.label)),u("li",{children:u("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(ro.value)},children:u("span",{class:"flex-grow",children:ro.label})})},ro.label)]})]})},hv={line1:"Line 1",line2:"Line 2",line3:"Line 3",city:"City",state:"State",postcode:"Postcode",country:"Country"},no=({addressFields:e,onSubmitSuccess:t,actions:r,input:n})=>{const i=L(null);fe(()=>{if(i.current){const a=i.current.querySelector("input");a&&(a.focus(),a.select())}},[]);const o=Object.keys(eo);return u("form",{class:"bg-neutral-1/90 flex flex-col justify-end gap-2 p-2",onSubmit:a=>{const s=new FormData(a.currentTarget),l=Object.fromEntries(s.entries());t({type:"address",value:l})},children:[u("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:i,children:Mr.map((a,s)=>{const l=`isdk_${a}`,d=n.config.keys[a];return d?u(Y,{children:[u("label",{for:l,class:"text-neutral-9 [&:has(+*>input:focus)]:text-neutral-11 w-24 pb-2 text-xs uppercase leading-3 tracking-widest transition-colors",children:hv[a]}),u("div",{class:"flex flex-col items-stretch gap-1.5",children:[a==="country"?u("div",{class:"relative",children:[u("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:d,id:l,defaultValue:e[a],required:!0,children:[e.country&&!o.includes(e.country)?u("option",{value:e[a],children:e[a]}):u("option",{value:"",children:"Select a country"}),o.map(f=>u("option",{value:f,children:f},f))]}),u("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:u("path",{d:"M4 6.5L8 10.5L12 6.5"})})]}):u("input",{autoFocus:s===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:d,id:l,defaultValue:e[a],required:!0}),s!==Mr.length-1&&u("hr",{class:"border-b-neutral-5 m-0 w-full border-b border-solid"}),s===Mr.length-1&&u("hr",{class:"m-0 w-full border-b border-b-transparent"})]})]}):null})}),u("div",{class:"flex w-full flex-1 ",children:[u("div",{class:"flex-grow",children:r}),u(lt,{class:"flex items-center justify-center"})]})]})},oo=()=>{const e=L(null);return V(()=>{var t;(t=e.current)==null||t.focus()},[]),e},ns=["true","false"],pv=Dd(ns),vv="answer",os="flex items-center gap-2 p-2.5",is=ne(({label:e,...t},r)=>u("button",{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 w-full overflow-hidden rounded-2xl px-2.5 py-2.5 ring-2 transition-all selection:bg-transparent",...t,ref:r,children:u("p",{class:"truncate text-center text-base",children:e})})),gv=({input:e,onSubmitSuccess:t})=>{const r=oo();return u("form",{noValidate:!0,class:"",onSubmit:n=>{n.preventDefault();const i=up(n).value,o=sr(pv,i);t({type:"boolean",value:o==="true"})},children:[u("ul",{class:os,children:ns.map((n,i)=>u("li",{class:"flex-1",children:u(is,{ref:i===0?r:null,type:"submit",name:vv,value:n,label:e.config.labels[n]},n)}))}),e.config.optional&&u("div",{class:"px-2 pb-2",children:u(ct,{class:"w-full",type:"button",onClick:()=>t(null)})})]})},Yt=({error:e})=>!e||!e.message?null:u("div",{role:"alert",class:"text-error-11 flex max-w-full items-center gap-1 overflow-hidden rounded-full px-2 py-2",children:[u("svg",{class:"text-error-9 h-4 w-4",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[u("circle",{cx:"8",cy:"8",r:"6.3",stroke:"currentColor","stroke-width":"1.4"}),u("rect",{x:"7",y:"4",width:"2",height:"5",fill:"currentColor"}),u("rect",{x:"7",y:"10",width:"2",height:"2",fill:"currentColor"})]}),u("p",{class:"truncate pr-1 text-sm",children:e.message})]}),mv=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}),bv=e=>e.reduce((t,r)=>t+r.sizeKb,0),yv=Ht("file"),as=3,wv=({file:e,class:t,...r})=>{const n=e.name.split(".").pop(),i=e.name.replace(new RegExp(`.${n}$`),"");return u("div",{class:ot("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:[u("p",{"aria-label":"File name",class:"text-accent-12 flex flex-grow overflow-hidden",children:[u("span",{class:"block truncate",children:i}),u("span",{children:[".",n]})]}),u("p",{"aria-label":"File size",class:"text-accent-11",children:Ut(e.sizeKb)})]})},ss=({class:e,...t})=>u("li",{class:ot("outline-neutral-6 text-neutral-11 bg-neutral-1 block rounded-md px-1 py-0.5 text-xs outline outline-1",e),...t}),ls=e=>{const t=e.split(".").pop();if(!t)throw new Error("No file extension found");return t?"."+t:""},_v=({allowedExtensions:e,files:t})=>{const r=e.map(n=>n.toLowerCase());return t.every(n=>r.includes(ls(n.name).toLowerCase()))},xv=(e,t)=>{const r=ls(e);return`${e.replace(new RegExp(`${r}$`),"").slice(0,t)}${r}`},kv=({input:e,onSubmitSuccess:t})=>{var f;const r=(f=P.current$.value.flow)==null?void 0:f.data.submissions[e.key],[n,i]=W(yv(r)?r.value:[]),[o,a]=W(),s=n.length-as,l=bv(n),d=oo();return u("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&&!_v({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 ${Ut(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:[u("div",{class:"flex items-center gap-2",children:[u("label",{ref:d,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?u(Y,{children:[u("ul",{class:"flex max-w-full flex-wrap justify-center gap-1 overflow-hidden p-1",children:[n.slice(0,as).map(c=>{const p=c.name.split(".").pop(),m=c.name.replace(new RegExp(`.${p}$`),"");return u(ss,{class:"flex overflow-hidden",children:[u("span",{class:"block truncate",children:m}),u("span",{children:[".",p]})]})}),s>0?u(ss,{children:["+",s," file",s!==1?"s":""]}):null]}),u("p",{class:"text-neutral-11 text-xs",children:[Ut(l)," ",n.length>1?"total":""]})]}):u("div",{class:"flex flex-col justify-center gap-4 pb-6 pt-5",children:[u("header",{class:"flex flex-col items-center gap-0",children:[u("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:u("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"})}),u("p",{class:"text-neutral-12 tracking-[-0.01em]",children:[e.config.allowMultiple?"Select files":"Select a file"," to upload"]}),e.config.fileSizeLimitKib?u("p",{class:"text-neutral-10 text-xs",children:["(max ",Ut(e.config.fileSizeLimitKib),")"]}):null]}),u("aside",{class:"flex flex-col items-center gap-2",children:[u("p",{id:"accepted-filetypes",class:"sr-only",children:"Accepted file extensions"}),u("ul",{"aria-describedby":"accepted-filetypes",class:"flex flex-wrap justify-center gap-2",children:e.config.extensions.map(c=>u("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(".","")}))})]})]}),u("input",{id:"dropzone-file",onInput:async c=>{$e(c.target instanceof HTMLInputElement);const p=c.target.files?Array.from(c.target.files):[],m=await Promise.allSettled(p.map(async v=>{const w=await mv(v);return{name:xv(v.name,42),data:w,sizeKb:v.size/1e3}}));if(m.some(({status:v})=>v==="rejected"))return a({type:"invalid",message:"Invalid file"});const g=m.map(v=>v.status==="fulfilled"?v.value:null).filter(Boolean);i(g)},multiple:e.config.allowMultiple,type:"file",class:"sr-only"})]}),u("div",{class:"flex h-full flex-col items-center gap-2",children:[u(lt,{disabled:n.length===0}),e.config.optional&&u(ct,{onClick:()=>t(null)})]})]}),u(Yt,{error:o})]})};var Xt=e=>e.type==="checkbox",It=e=>e instanceof Date,ue=e=>e==null;const cs=e=>typeof e=="object";var te=e=>!ue(e)&&!Array.isArray(e)&&cs(e)&&!It(e),$v=e=>te(e)&&e.target?Xt(e.target)?e.target.checked:e.target.value:e,Sv=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,Cv=(e,t)=>e.has(Sv(t)),Ev=e=>{const t=e.constructor&&e.constructor.prototype;return te(t)&&t.hasOwnProperty("isPrototypeOf")},io=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function je(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(!(io&&(e instanceof Blob||e instanceof FileList))&&(r||te(e)))if(t=r?[]:{},!r&&!Ev(e))t=e;else for(const n in e)e.hasOwnProperty(n)&&(t[n]=je(e[n]));else return e;return t}var Zt=e=>Array.isArray(e)?e.filter(Boolean):[],J=e=>e===void 0,C=(e,t,r)=>{if(!t||!te(e))return r;const n=Zt(t.split(/[,[\].]+?/)).reduce((i,o)=>ue(i)?i:i[o],e);return J(n)||n===e?J(e[t])?r:e[t]:n},Ze=e=>typeof e=="boolean";const us={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change"},Se={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},Ve={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"};ke.createContext(null);var Iv=(e,t,r,n=!0)=>{const i={defaultValues:t._defaultValues};for(const o in e)Object.defineProperty(i,o,{get:()=>{const a=o;return t._proxyFormState[a]!==Se.all&&(t._proxyFormState[a]=!n||Se.all),r&&(r[a]=!0),e[a]}});return i},we=e=>te(e)&&!Object.keys(e).length,Ov=(e,t,r,n)=>{r(e);const{name:i,...o}=e;return we(o)||Object.keys(o).length>=Object.keys(t).length||Object.keys(o).find(a=>t[a]===(!n||Se.all))},ao=e=>Array.isArray(e)?e:[e];function Tv(e){const t=ke.useRef(e);t.current=e,ke.useEffect(()=>{const r=!e.disabled&&t.current.subject&&t.current.subject.subscribe({next:t.current.next});return()=>{r&&r.unsubscribe()}},[e.disabled])}var Te=e=>typeof e=="string",Av=(e,t,r,n,i)=>Te(e)?(n&&t.watch.add(e),C(r,e,i)):Array.isArray(e)?e.map(o=>(n&&t.watch.add(o),C(r,o))):(n&&(t.watchAll=!0),r),so=e=>/^\w*$/.test(e),ds=e=>Zt(e.replace(/["|']|\]/g,"").split(/\.|\[/));function U(e,t,r){let n=-1;const i=so(t)?[t]:ds(t),o=i.length,a=o-1;for(;++n<o;){const s=i[n];let l=r;if(n!==a){const d=e[s];l=te(d)||Array.isArray(d)?d:isNaN(+i[n+1])?{}:[]}e[s]=l,e=e[s]}return e}var fs=(e,t,r,n,i)=>t?{...r[e],types:{...r[e]&&r[e].types?r[e].types:{},[n]:i||!0}}:{},hs=e=>({isOnSubmit:!e||e===Se.onSubmit,isOnBlur:e===Se.onBlur,isOnChange:e===Se.onChange,isOnAll:e===Se.all,isOnTouch:e===Se.onTouched}),ps=(e,t,r)=>!r&&(t.watchAll||t.watch.has(e)||[...t.watch].some(n=>e.startsWith(n)&&/^\.\w+/.test(e.slice(n.length))));const Fr=(e,t,r,n)=>{for(const i of r||Object.keys(e)){const o=C(e,i);if(o){const{_f:a,...s}=o;if(a){if(a.refs&&a.refs[0]&&t(a.refs[0],i)&&!n)break;if(a.ref&&t(a.ref,a.name)&&!n)break}else te(s)&&Fr(s,t)}}};var Pv=(e,t,r)=>{const n=Zt(C(e,r));return U(n,"root",t[r]),U(e,r,n),e},lo=e=>e.type==="file",Je=e=>typeof e=="function",Lr=e=>{if(!io)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},Rr=e=>Te(e),co=e=>e.type==="radio",jr=e=>e instanceof RegExp;const vs={value:!1,isValid:!1},gs={value:!0,isValid:!0};var ms=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&&!J(e[0].attributes.value)?J(e[0].value)||e[0].value===""?gs:{value:e[0].value,isValid:!0}:gs:vs}return vs};const bs={isValid:!1,value:null};var ys=e=>Array.isArray(e)?e.reduce((t,r)=>r&&r.checked&&!r.disabled?{isValid:!0,value:r.value}:t,bs):bs;function ws(e,t,r="validate"){if(Rr(e)||Array.isArray(e)&&e.every(Rr)||Ze(e)&&!e)return{type:r,message:Rr(e)?e:"",ref:t}}var Ot=e=>te(e)&&!jr(e)?e:{value:e,message:""},_s=async(e,t,r,n,i)=>{const{ref:o,refs:a,required:s,maxLength:l,minLength:d,min:f,max:c,pattern:p,validate:m,name:g,valueAsNumber:v,mount:w,disabled:x}=e._f,_=C(t,g);if(!w||x)return{};const I=a?a[0]:o,T=B=>{n&&I.reportValidity&&(I.setCustomValidity(Ze(B)?"":B||""),I.reportValidity())},O={},H=co(o),K=Xt(o),M=H||K,F=(v||lo(o))&&J(o.value)&&J(_)||Lr(o)&&o.value===""||_===""||Array.isArray(_)&&!_.length,se=fs.bind(null,g,r,O),re=(B,R,Q,ve=Ve.maxLength,_e=Ve.minLength)=>{const Ae=B?R:Q;O[g]={type:B?ve:_e,message:Ae,ref:o,...se(B?ve:_e,Ae)}};if(i?!Array.isArray(_)||!_.length:s&&(!M&&(F||ue(_))||Ze(_)&&!_||K&&!ms(a).isValid||H&&!ys(a).isValid)){const{value:B,message:R}=Rr(s)?{value:!!s,message:s}:Ot(s);if(B&&(O[g]={type:Ve.required,message:R,ref:I,...se(Ve.required,R)},!r))return T(R),O}if(!F&&(!ue(f)||!ue(c))){let B,R;const Q=Ot(c),ve=Ot(f);if(!ue(_)&&!isNaN(_)){const _e=o.valueAsNumber||_&&+_;ue(Q.value)||(B=_e>Q.value),ue(ve.value)||(R=_e<ve.value)}else{const _e=o.valueAsDate||new Date(_),Ae=Kr=>new Date(new Date().toDateString()+" "+Kr),dt=o.type=="time",Qt=o.type=="week";Te(Q.value)&&_&&(B=dt?Ae(_)>Ae(Q.value):Qt?_>Q.value:_e>new Date(Q.value)),Te(ve.value)&&_&&(R=dt?Ae(_)<Ae(ve.value):Qt?_<ve.value:_e<new Date(ve.value))}if((B||R)&&(re(!!B,Q.message,ve.message,Ve.max,Ve.min),!r))return T(O[g].message),O}if((l||d)&&!F&&(Te(_)||i&&Array.isArray(_))){const B=Ot(l),R=Ot(d),Q=!ue(B.value)&&_.length>+B.value,ve=!ue(R.value)&&_.length<+R.value;if((Q||ve)&&(re(Q,B.message,R.message),!r))return T(O[g].message),O}if(p&&!F&&Te(_)){const{value:B,message:R}=Ot(p);if(jr(B)&&!_.match(B)&&(O[g]={type:Ve.pattern,message:R,ref:o,...se(Ve.pattern,R)},!r))return T(R),O}if(m){if(Je(m)){const B=await m(_,t),R=ws(B,I);if(R&&(O[g]={...R,...se(Ve.validate,R.message)},!r))return T(R.message),O}else if(te(m)){let B={};for(const R in m){if(!we(B)&&!r)break;const Q=ws(await m[R](_,t),I,R);Q&&(B={...Q,...se(R,Q.message)},T(Q.message),r&&(O[g]=B))}if(!we(B)&&(O[g]={ref:I,...B},!r))return O}}return T(!0),O};function Nv(e,t){const r=t.slice(0,-1).length;let n=0;for(;n<r;)e=J(e)?n++:e[t[n++]];return e}function Dv(e){for(const t in e)if(e.hasOwnProperty(t)&&!J(e[t]))return!1;return!0}function ae(e,t){const r=Array.isArray(t)?t:so(t)?[t]:ds(t),n=r.length===1?e:Nv(e,r),i=r.length-1,o=r[i];return n&&delete n[o],i!==0&&(te(n)&&we(n)||Array.isArray(n)&&Dv(n))&&ae(e,r.slice(0,-1)),e}function uo(){let e=[];return{get observers(){return e},next:i=>{for(const o of e)o.next&&o.next(i)},subscribe:i=>(e.push(i),{unsubscribe:()=>{e=e.filter(o=>o!==i)}}),unsubscribe:()=>{e=[]}}}var Vr=e=>ue(e)||!cs(e);function ut(e,t){if(Vr(e)||Vr(t))return e===t;if(It(e)&&It(t))return e.getTime()===t.getTime();const r=Object.keys(e),n=Object.keys(t);if(r.length!==n.length)return!1;for(const i of r){const o=e[i];if(!n.includes(i))return!1;if(i!=="ref"){const a=t[i];if(It(o)&&It(a)||te(o)&&te(a)||Array.isArray(o)&&Array.isArray(a)?!ut(o,a):o!==a)return!1}}return!0}var xs=e=>e.type==="select-multiple",Mv=e=>co(e)||Xt(e),fo=e=>Lr(e)&&e.isConnected,ks=e=>{for(const t in e)if(Je(e[t]))return!0;return!1};function Br(e,t={}){const r=Array.isArray(e);if(te(e)||r)for(const n in e)Array.isArray(e[n])||te(e[n])&&!ks(e[n])?(t[n]=Array.isArray(e[n])?[]:{},Br(e[n],t[n])):ue(e[n])||(t[n]=!0);return t}function $s(e,t,r){const n=Array.isArray(e);if(te(e)||n)for(const i in e)Array.isArray(e[i])||te(e[i])&&!ks(e[i])?J(t)||Vr(r[i])?r[i]=Array.isArray(e[i])?Br(e[i],[]):{...Br(e[i])}:$s(e[i],ue(t)?{}:t[i],r[i]):r[i]=!ut(e[i],t[i]);return r}var ho=(e,t)=>$s(e,t,Br(t)),Ss=(e,{valueAsNumber:t,valueAsDate:r,setValueAs:n})=>J(e)?e:t?e===""?NaN:e&&+e:r&&Te(e)?new Date(e):n?n(e):e;function po(e){const t=e.ref;if(!(e.refs?e.refs.every(r=>r.disabled):t.disabled))return lo(t)?t.files:co(t)?ys(e.refs).value:xs(t)?[...t.selectedOptions].map(({value:r})=>r):Xt(t)?ms(e.refs).value:Ss(J(t.value)?e.ref.value:t.value,e)}var Fv=(e,t,r,n)=>{const i={};for(const o of e){const a=C(t,o);a&&U(i,o,a._f)}return{criteriaMode:r,names:[...e],fields:i,shouldUseNativeValidation:n}},Jt=e=>J(e)?e:jr(e)?e.source:te(e)?jr(e.value)?e.value.source:e.value:e,Lv=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate);function Cs(e,t,r){const n=C(e,r);if(n||so(r))return{error:n,name:r};const i=r.split(".");for(;i.length;){const o=i.join("."),a=C(t,o),s=C(e,o);if(a&&!Array.isArray(a)&&r!==o)return{name:r};if(s&&s.type)return{name:o,error:s};i.pop()}return{name:r}}var Rv=(e,t,r,n,i)=>i.isOnAll?!1:!r&&i.isOnTouch?!(t||e):(r?n.isOnBlur:i.isOnBlur)?!e:(r?n.isOnChange:i.isOnChange)?e:!0,jv=(e,t)=>!Zt(C(e,t)).length&&ae(e,t);const Vv={mode:Se.onSubmit,reValidateMode:Se.onChange,shouldFocusError:!0};function Bv(e={},t){let r={...Vv,...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},i={},o=te(r.defaultValues)||te(r.values)?je(r.defaultValues||r.values)||{}:{},a=r.shouldUnregister?{}:je(o),s={action:!1,mount:!1,watch:!1},l={mount:new Set,unMount:new Set,array:new Set,watch:new Set},d,f=0;const c={isDirty:!1,dirtyFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},p={values:uo(),array:uo(),state:uo()},m=e.resetOptions&&e.resetOptions.keepDirtyValues,g=hs(r.mode),v=hs(r.reValidateMode),w=r.criteriaMode===Se.all,x=h=>b=>{clearTimeout(f),f=setTimeout(h,b)},_=async h=>{if(c.isValid||h){const b=r.resolver?we((await F()).errors):await re(i,!0);b!==n.isValid&&p.state.next({isValid:b})}},I=h=>c.isValidating&&p.state.next({isValidating:h}),T=(h,b=[],y,E,$=!0,k=!0)=>{if(E&&y){if(s.action=!0,k&&Array.isArray(C(i,h))){const A=y(C(i,h),E.argA,E.argB);$&&U(i,h,A)}if(k&&Array.isArray(C(n.errors,h))){const A=y(C(n.errors,h),E.argA,E.argB);$&&U(n.errors,h,A),jv(n.errors,h)}if(c.touchedFields&&k&&Array.isArray(C(n.touchedFields,h))){const A=y(C(n.touchedFields,h),E.argA,E.argB);$&&U(n.touchedFields,h,A)}c.dirtyFields&&(n.dirtyFields=ho(o,a)),p.state.next({name:h,isDirty:R(h,b),dirtyFields:n.dirtyFields,errors:n.errors,isValid:n.isValid})}else U(a,h,b)},O=(h,b)=>{U(n.errors,h,b),p.state.next({errors:n.errors})},H=(h,b,y,E)=>{const $=C(i,h);if($){const k=C(a,h,J(y)?C(o,h):y);J(k)||E&&E.defaultChecked||b?U(a,h,b?k:po($._f)):_e(h,k),s.mount&&_()}},K=(h,b,y,E,$)=>{let k=!1,A=!1;const q={name:h};if(!y||E){c.isDirty&&(A=n.isDirty,n.isDirty=q.isDirty=R(),k=A!==q.isDirty);const ee=ut(C(o,h),b);A=C(n.dirtyFields,h),ee?ae(n.dirtyFields,h):U(n.dirtyFields,h,!0),q.dirtyFields=n.dirtyFields,k=k||c.dirtyFields&&A!==!ee}if(y){const ee=C(n.touchedFields,h);ee||(U(n.touchedFields,h,y),q.touchedFields=n.touchedFields,k=k||c.touchedFields&&ee!==y)}return k&&$&&p.state.next(q),k?q:{}},M=(h,b,y,E)=>{const $=C(n.errors,h),k=c.isValid&&Ze(b)&&n.isValid!==b;if(e.delayError&&y?(d=x(()=>O(h,y)),d(e.delayError)):(clearTimeout(f),d=null,y?U(n.errors,h,y):ae(n.errors,h)),(y?!ut($,y):$)||!we(E)||k){const A={...E,...k&&Ze(b)?{isValid:b}:{},errors:n.errors,name:h};n={...n,...A},p.state.next(A)}I(!1)},F=async h=>r.resolver(a,r.context,Fv(h||l.mount,i,r.criteriaMode,r.shouldUseNativeValidation)),se=async h=>{const{errors:b}=await F(h);if(h)for(const y of h){const E=C(b,y);E?U(n.errors,y,E):ae(n.errors,y)}else n.errors=b;return b},re=async(h,b,y={valid:!0})=>{for(const E in h){const $=h[E];if($){const{_f:k,...A}=$;if(k){const q=l.array.has(k.name),ee=await _s($,a,w,r.shouldUseNativeValidation&&!b,q);if(ee[k.name]&&(y.valid=!1,b))break;!b&&(C(ee,k.name)?q?Pv(n.errors,ee,k.name):U(n.errors,k.name,ee[k.name]):ae(n.errors,k.name))}A&&await re(A,b,y)}}return y.valid},B=()=>{for(const h of l.unMount){const b=C(i,h);b&&(b._f.refs?b._f.refs.every(y=>!fo(y)):!fo(b._f.ref))&&bo(h)}l.unMount=new Set},R=(h,b)=>(h&&b&&U(a,h,b),!ut(Fs(),o)),Q=(h,b,y)=>Av(h,l,{...s.mount?a:J(b)?o:Te(h)?{[h]:b}:b},y,b),ve=h=>Zt(C(s.mount?a:o,h,e.shouldUnregister?C(o,h,[]):[])),_e=(h,b,y={})=>{const E=C(i,h);let $=b;if(E){const k=E._f;k&&(!k.disabled&&U(a,h,Ss(b,k)),$=Lr(k.ref)&&ue(b)?"":b,xs(k.ref)?[...k.ref.options].forEach(A=>A.selected=$.includes(A.value)):k.refs?Xt(k.ref)?k.refs.length>1?k.refs.forEach(A=>(!A.defaultChecked||!A.disabled)&&(A.checked=Array.isArray($)?!!$.find(q=>q===A.value):$===A.value)):k.refs[0]&&(k.refs[0].checked=!!$):k.refs.forEach(A=>A.checked=A.value===$):lo(k.ref)?k.ref.value="":(k.ref.value=$,k.ref.type||p.values.next({name:h,values:{...a}})))}(y.shouldDirty||y.shouldTouch)&&K(h,$,y.shouldTouch,y.shouldDirty,!0),y.shouldValidate&&mo(h)},Ae=(h,b,y)=>{for(const E in b){const $=b[E],k=`${h}.${E}`,A=C(i,k);(l.array.has(h)||!Vr($)||A&&!A._f)&&!It($)?Ae(k,$,y):_e(k,$,y)}},dt=(h,b,y={})=>{const E=C(i,h),$=l.array.has(h),k=je(b);U(a,h,k),$?(p.array.next({name:h,values:{...a}}),(c.isDirty||c.dirtyFields)&&y.shouldDirty&&p.state.next({name:h,dirtyFields:ho(o,a),isDirty:R(h,k)})):E&&!E._f&&!ue(k)?Ae(h,k,y):_e(h,k,y),ps(h,l)&&p.state.next({...n}),p.values.next({name:h,values:{...a}}),!s.mount&&t()},Qt=async h=>{const b=h.target;let y=b.name,E=!0;const $=C(i,y),k=()=>b.type?po($._f):$v(h),A=q=>{E=Number.isNaN(q)||q===C(a,y,q)};if($){let q,ee;const Wr=k(),Tt=h.type===us.BLUR||h.type===us.FOCUS_OUT,Rg=!Lv($._f)&&!r.resolver&&!C(n.errors,y)&&!$._f.deps||Rv(Tt,C(n.touchedFields,y),n.isSubmitted,v,g),wo=ps(y,l,Tt);U(a,y,Wr),Tt?($._f.onBlur&&$._f.onBlur(h),d&&d(0)):$._f.onChange&&$._f.onChange(h);const _o=K(y,Wr,Tt,!1),jg=!we(_o)||wo;if(!Tt&&p.values.next({name:y,type:h.type,values:{...a}}),Rg)return c.isValid&&_(),jg&&p.state.next({name:y,...wo?{}:_o});if(!Tt&&wo&&p.state.next({...n}),I(!0),r.resolver){const{errors:Hs}=await F([y]);if(A(Wr),E){const Vg=Cs(n.errors,i,y),qs=Cs(Hs,i,Vg.name||y);q=qs.error,y=qs.name,ee=we(Hs)}}else q=(await _s($,a,w,r.shouldUseNativeValidation))[y],A(Wr),E&&(q?ee=!1:c.isValid&&(ee=await re(i,!0)));E&&($._f.deps&&mo($._f.deps),M(y,ee,q,_o))}},Kr=(h,b)=>{if(C(n.errors,b)&&h.focus)return h.focus(),1},mo=async(h,b={})=>{let y,E;const $=ao(h);if(I(!0),r.resolver){const k=await se(J(h)?h:$);y=we(k),E=h?!$.some(A=>C(k,A)):y}else h?(E=(await Promise.all($.map(async k=>{const A=C(i,k);return await re(A&&A._f?{[k]:A}:A)}))).every(Boolean),!(!E&&!n.isValid)&&_()):E=y=await re(i);return p.state.next({...!Te(h)||c.isValid&&y!==n.isValid?{}:{name:h},...r.resolver||!h?{isValid:y}:{},errors:n.errors,isValidating:!1}),b.shouldFocus&&!E&&Fr(i,Kr,h?$:l.mount),E},Fs=h=>{const b={...o,...s.mount?a:{}};return J(h)?b:Te(h)?C(b,h):h.map(y=>C(b,y))},Ls=(h,b)=>({invalid:!!C((b||n).errors,h),isDirty:!!C((b||n).dirtyFields,h),isTouched:!!C((b||n).touchedFields,h),error:C((b||n).errors,h)}),Dg=h=>{h&&ao(h).forEach(b=>ae(n.errors,b)),p.state.next({errors:h?n.errors:{}})},Rs=(h,b,y)=>{const E=(C(i,h,{_f:{}})._f||{}).ref;U(n.errors,h,{...b,ref:E}),p.state.next({name:h,errors:n.errors,isValid:!1}),y&&y.shouldFocus&&E&&E.focus&&E.focus()},Mg=(h,b)=>Je(h)?p.values.subscribe({next:y=>h(Q(void 0,b),y)}):Q(h,b,!0),bo=(h,b={})=>{for(const y of h?ao(h):l.mount)l.mount.delete(y),l.array.delete(y),b.keepValue||(ae(i,y),ae(a,y)),!b.keepError&&ae(n.errors,y),!b.keepDirty&&ae(n.dirtyFields,y),!b.keepTouched&&ae(n.touchedFields,y),!r.shouldUnregister&&!b.keepDefaultValue&&ae(o,y);p.values.next({values:{...a}}),p.state.next({...n,...b.keepDirty?{isDirty:R()}:{}}),!b.keepIsValid&&_()},js=({disabled:h,name:b,field:y,fields:E,value:$})=>{if(Ze(h)){const k=h?void 0:J($)?po(y?y._f:C(E,b)._f):$;U(a,b,k),K(b,k,!1,!1,!0)}},yo=(h,b={})=>{let y=C(i,h);const E=Ze(b.disabled);return U(i,h,{...y||{},_f:{...y&&y._f?y._f:{ref:{name:h}},name:h,mount:!0,...b}}),l.mount.add(h),y?js({field:y,disabled:b.disabled,name:h}):H(h,!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:h,onChange:Qt,onBlur:Qt,ref:$=>{if($){yo(h,b),y=C(i,h);const k=J($.value)&&$.querySelectorAll&&$.querySelectorAll("input,select,textarea")[0]||$,A=Mv(k),q=y._f.refs||[];if(A?q.find(ee=>ee===k):k===y._f.ref)return;U(i,h,{_f:{...y._f,...A?{refs:[...q.filter(fo),k,...Array.isArray(C(o,h))?[{}]:[]],ref:{type:k.type,name:h}}:{ref:k}}}),H(h,!1,void 0,k)}else y=C(i,h,{}),y._f&&(y._f.mount=!1),(r.shouldUnregister||b.shouldUnregister)&&!(Cv(l.array,h)&&s.action)&&l.unMount.add(h)}}},Vs=()=>r.shouldFocusError&&Fr(i,Kr,l.mount),Fg=h=>{Ze(h)&&(p.state.next({disabled:h}),Fr(i,b=>{b.disabled=h},0,!1))},Bs=(h,b)=>async y=>{y&&(y.preventDefault&&y.preventDefault(),y.persist&&y.persist());let E=je(a);if(p.state.next({isSubmitting:!0}),r.resolver){const{errors:$,values:k}=await F();n.errors=$,E=k}else await re(i);ae(n.errors,"root"),we(n.errors)?(p.state.next({errors:{}}),await h(E,y)):(b&&await b({...n.errors},y),Vs(),setTimeout(Vs)),p.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:we(n.errors),submitCount:n.submitCount+1,errors:n.errors})},Lg=(h,b={})=>{C(i,h)&&(J(b.defaultValue)?dt(h,C(o,h)):(dt(h,b.defaultValue),U(o,h,b.defaultValue)),b.keepTouched||ae(n.touchedFields,h),b.keepDirty||(ae(n.dirtyFields,h),n.isDirty=b.defaultValue?R(h,C(o,h)):R()),b.keepError||(ae(n.errors,h),c.isValid&&_()),p.state.next({...n}))},zs=(h,b={})=>{const y=h?je(h):o,E=je(y),$=h&&!we(h)?E:o;if(b.keepDefaultValues||(o=y),!b.keepValues){if(b.keepDirtyValues||m)for(const k of l.mount)C(n.dirtyFields,k)?U($,k,C(a,k)):dt(k,C($,k));else{if(io&&J(h))for(const k of l.mount){const A=C(i,k);if(A&&A._f){const q=Array.isArray(A._f.refs)?A._f.refs[0]:A._f.ref;if(Lr(q)){const ee=q.closest("form");if(ee){ee.reset();break}}}}i={}}a=e.shouldUnregister?b.keepDefaultValues?je(o):{}:je($),p.array.next({values:{...$}}),p.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,p.state.next({submitCount:b.keepSubmitCount?n.submitCount:0,isDirty:b.keepDirty?n.isDirty:!!(b.keepDefaultValues&&!ut(h,o)),isSubmitted:b.keepIsSubmitted?n.isSubmitted:!1,dirtyFields:b.keepDirtyValues?n.dirtyFields:b.keepDefaultValues&&h?ho(o,h):{},touchedFields:b.keepTouched?n.touchedFields:{},errors:b.keepErrors?n.errors:{},isSubmitSuccessful:b.keepIsSubmitSuccessful?n.isSubmitSuccessful:!1,isSubmitting:!1})},Us=(h,b)=>zs(Je(h)?h(a):h,b);return{control:{register:yo,unregister:bo,getFieldState:Ls,handleSubmit:Bs,setError:Rs,_executeSchema:F,_getWatch:Q,_getDirty:R,_updateValid:_,_removeUnmounted:B,_updateFieldArray:T,_updateDisabledField:js,_getFieldArray:ve,_reset:zs,_resetDefaultValues:()=>Je(r.defaultValues)&&r.defaultValues().then(h=>{Us(h,r.resetOptions),p.state.next({isLoading:!1})}),_updateFormState:h=>{n={...n,...h}},_disableForm:Fg,_subjects:p,_proxyFormState:c,get _fields(){return i},get _formValues(){return a},get _state(){return s},set _state(h){s=h},get _defaultValues(){return o},get _names(){return l},set _names(h){l=h},get _formState(){return n},set _formState(h){n=h},get _options(){return r},set _options(h){r={...r,...h}}},trigger:mo,register:yo,handleSubmit:Bs,watch:Mg,setValue:dt,getValues:Fs,reset:Us,resetField:Lg,clearErrors:Dg,unregister:bo,setError:Rs,setFocus:(h,b={})=>{const y=C(i,h),E=y&&y._f;if(E){const $=E.refs?E.refs[0]:E.ref;$.focus&&($.focus(),b.shouldSelect&&$.select())}},getFieldState:Ls}}function zr(e={}){const t=ke.useRef(),r=ke.useRef(),[n,i]=ke.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={...Bv(e,()=>i(a=>({...a}))),formState:n});const o=t.current.control;return o._options=e,Tv({subject:o._subjects.state,next:a=>{Ov(a,o._proxyFormState,o._updateFormState,!0)&&i({...o._formState})}}),ke.useEffect(()=>o._disableForm(e.disabled),[o,e.disabled]),ke.useEffect(()=>{if(o._proxyFormState.isDirty){const a=o._getDirty();a!==n.isDirty&&o._subjects.state.next({isDirty:a})}},[o,n.isDirty]),ke.useEffect(()=>{e.values&&!ut(e.values,r.current)?(o._reset(e.values,o._options.resetOptions),r.current=e.values):o._resetDefaultValues()},[e.values,o]),ke.useEffect(()=>{o._state.mount||(o._updateValid(),o._state.mount=!0),o._state.watch&&(o._state.watch=!1,o._subjects.state.next({...o._formState})),o._removeUnmounted()}),t.current.formState=Iv(n,o),t.current}var Es=function(e,t,r){if(e&&"reportValidity"in e){var n=C(r,t);e.setCustomValidity(n&&n.message||""),e.reportValidity()}},zv=function(e,t){var r=function(i){var o=t.fields[i];o&&o.ref&&"reportValidity"in o.ref?Es(o.ref,i,e):o.refs&&o.refs.forEach(function(a){return Es(a,i,e)})};for(var n in t.fields)r(n)},Uv=function(e,t){t.shouldUseNativeValidation&&zv(e,t);var r={};for(var n in e){var i=C(t.fields,n),o=Object.assign(e[n]||{},{ref:i&&i.ref});if(qv(t.names||Object.keys(e),n)){var a=Object.assign({},Hv(C(r,n)));U(a,"root",o),U(r,n,a)}else U(r,n,o)}return r},Hv=function(e){return Array.isArray(e)?e.filter(Boolean):[]},qv=function(e,t){return e.some(function(r){return r.startsWith(t+".")})},Kv=function(e,t){for(var r={};e.issues.length;){var n=e.issues[0];if(n.path){var i=n.path.map(function(s){return s.key}).join(".");if(r[i]||(r[i]={message:n.message,type:n.validation}),t){var o=r[i].types,a=o&&o[n.validation];r[i]=fs(i,t,r,n.validation,a?[].concat(a,n.message):n.message)}e.issues.shift()}}return r},Ur=function(e,t,r){return r===void 0&&(r={}),function(n,i,o){try{return Promise.resolve(function(a,s){try{var l=function(){function d(c){return{values:r.raw?n:c,errors:{}}}var f=Object.assign({},{abortEarly:!1,abortPipeEarly:!1},t);return r.mode==="sync"?d(sr(e,n,f)):Promise.resolve(Rd(e,n,f)).then(d)}()}catch(d){return s(d)}return l&&l.then?l.then(void 0,s):l}(0,function(a){if(a instanceof on)return{values:{},errors:Uv(Kv(a,!o.shouldUseNativeValidation&&o.criteriaMode==="all"),o)};throw a}))}catch(a){return Promise.reject(a)}}};const Is=27,Os=12,Ts=10,Wv=Ht("enum"),Gv=e=>{const t={min:e.minSelected??0,max:e.maxSelected??e.options.length};return Ur(Ce({checked:si(ai(oi()),r=>Object.entries(r).filter(([n,i])=>i).map(([n,i])=>n),[lr(t.max,`Please select at most ${t.max} option${t.max!==1?"s":""}`),cr(t.min,`Please select at least ${t.min} option${t.min!==1?"s":""}`)])}))},Yv=ne(({option:e,...t},r)=>u(Y,{children:[u("input",{class:"peer sr-only h-full",type:"checkbox",...t,ref:r}),u("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:t.id,children:e.label})]})),As=$r("gutter-stable flex w-full flex-1 flex-wrap gap-3 overflow-y-auto rounded-xl p-2.5 pr-4",{variants:{variant:{singleOption:"justify-center",booleanLike:os}}}),Xv=({input:e,onSubmitSuccess:t})=>{var d,f;const r=e.key?(d=P.current$.value.flow)==null?void 0:d.data.submissions[e.key]:void 0,n=(e.config.minSelected===1||e.config.minSelected===void 0)&&e.config.maxSelected===1,i=n&&e.config.options.length===2,{register:o,handleSubmit:a,formState:{errors:s}}=zr({defaultValues:{checked:n?{}:Wv(r)?Object.fromEntries(r.value.map(c=>[c,!0])):{}},resolver:Gv(e.config)}),l=oo();return i?u("ul",{style:{maxHeight:6.5*Is+5*Os+2*Ts},class:As({variant:"booleanLike"}),children:e.config.options.map((c,p)=>u("li",{class:"flex-1",children:u(is,{type:"submit",ref:m=>{m&&p===0&&(l.current=m)},label:c.label,value:"true",onClick:()=>t({type:"enum",value:[c.value]})})},c.value))}):u("form",{noValidate:!0,onSubmit:c=>a(p=>{const m=p.checked;t({type:"enum",value:m})})(c),children:[u("div",{class:"flex items-center gap-1",children:[u("ul",{style:{maxHeight:6.5*Is+5*Os+2*Ts},class:As({variant:e.config.options.length===1?"singleOption":void 0}),children:e.config.options.map((c,p)=>{const m=`checked.${c.value}`,{ref:g,...v}=o(m);return u("li",{class:"relative",children:u(Yv,{option:c,autoFocus:p===0,ref:w=>{w&&p===0&&(l.current=w),g(w)},id:m,...v,onClick:n?()=>t({type:"enum",value:[c.value]}):void 0})},c.value)})}),u("div",{class:"flex flex-col items-center gap-2 pr-2.5 pt-2.5",children:[n?null:u(lt,{}),e.config.minSelected===0&&u(ct,{type:"button",onClick:()=>t({type:"enum",value:[]})})]})]}),u("div",{class:"px-1",children:u(Yt,{error:(f=s.checked)==null?void 0:f.root})})]})},Zv=Ht("number"),Hr={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`},Jv=e=>{const t=e.min??Number.MIN_SAFE_INTEGER,r=e.max??Number.MAX_SAFE_INTEGER,n=e.decimalCases??0;return Ur(Ce({number:an(Hr.number(),[Ud(t,Hr.min(t)),zd(r,Hr.max(r)),Vd(i=>i===Number(i.toFixed(n)),Hr.decimalCases(n))])}))},Qv=({input:e,onSubmitSuccess:t})=>{var f;const r=e.config.defaultValue,n=e.key?(f=P.current$.value.flow)==null?void 0:f.data.submissions[e.key]:void 0,{register:i,handleSubmit:o,formState:{errors:a}}=zr({defaultValues:{number:r?Number(r):Zv(n)?n.value:void 0},resolver:Jv(e.config)}),{ref:s,...l}=i("number",{required:!e.config.optional,valueAsNumber:!0}),d=L();return fe(()=>{d.current&&(d.current.focus(),d.current.select())},[]),u("form",{class:"flex flex-col gap-1 p-2.5",onSubmit:o(c=>{c.number!==void 0&&t({type:"number",value:c.number})}),children:[u("div",{class:"flex items-center gap-2",children:[u("div",{class:"relative min-w-0 flex-grow",children:[u("input",{...l,id:"chat-input",autocomplete:"off",autoCapitalize:"off",autoCorrect:"off",autoFocus:!0,ref:c=>{c&&(d.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&&u(ct,{class:"absolute right-0 top-0",onClick:()=>t(null)})]}),u(lt,{})]}),u(Yt,{error:a.number})]})},Ps=e=>{if(e==="")return{countryCode:"",phoneNumber:""};const t=Object.entries(eo).find(i=>e.startsWith(i[1])),r=t?t[1]:"",n=e.replace(r,"");return/^\d+$/.test(n)?{countryCode:r,phoneNumber:n}:{countryCode:"",phoneNumber:""}},eg="44",vo="That doesn’t look like a valid phone number",Ns=e=>({min:`The phone number needs to be at least ${e.minChars} digits long.`,max:`The phone number can't be longer than ${e.maxChars} digits.`}),tg=Ht("string"),rg=xe(vo,[li(/^\+?[0-9 -]+$/,vo)]),ng=xe("Please select a country code",[li(/^\+?[0-9 -]+$/,vo)]),og=()=>Ur(Ce({countryCode:ng,phoneNumber:si(rg,e=>e.replace(/[^0-9]/g,""),[])})),ig=({input:e,onSubmitSuccess:t})=>{var m;const r=e.key?(m=P.current$.value.flow)==null?void 0:m.data.submissions[e.key]:void 0,[n,i]=W(),{register:o,handleSubmit:a,formState:{errors:s},watch:l}=zr({defaultValues:e.config.defaultValue?Ps(e.config.defaultValue):tg(r)?Ps(r.value):{countryCode:eg,phoneNumber:""},resolver:og()}),{ref:d,...f}=o("phoneNumber",{required:!e.config.optional}),c=L(),p=l("countryCode");return fe(()=>{c.current&&(c.current.focus(),c.current.select())},[]),u("form",{noValidate:!0,class:"flex flex-col gap-1 p-2.5",onSubmit:a(g=>{const v=g.phoneNumber.replace(/[^0-9]/g,""),w=g.countryCode.replace(/[^0-9]/g,"");if(i(void 0),v.length+w.length>(e.config.maxChars||1/0))return i(Ns(e.config).max);if(v.length+w.length<(e.config.minChars||0))return i(Ns(e.config).min);t({type:"string",value:p+g.phoneNumber})}),children:[u("div",{class:"flex items-center gap-2",children:[u("div",{class:"relative flex min-w-0 flex-1 flex-grow gap-2",children:[u("label",{class:"text-neutral-12 bg-lowest hover:bg-neutral-5 placeholder:text-neutral-8 focus-visible:outline-accent-7 focus-within:bg-neutral-5 focus-within:outline-accent-7 outline-divider relative flex h-full cursor-pointer appearance-none items-center justify-center overflow-hidden text-ellipsis whitespace-nowrap rounded-l-full border-solid px-3 py-1.5 text-center text-base outline outline-2 transition-all focus-within:outline-none",htmlFor:`isdk_phone_${e.key}`,children:[u("span",{children:["+",p]}),u("select",{...o("countryCode",{}),id:`isdk_phone_${e.key}`,class:"absolute inset-0 opacity-0",children:Object.entries(eo).map(([g,v])=>u("option",{value:v,children:[g," (+",v,")"]},g))})]}),u("input",{...f,id:"chat-input",type:"tel",inputMode:"tel",autocomplete:"off",autoCapitalize:"off",autoCorrect:"off",autoFocus:!0,ref:g=>{g&&(c.current=g),d(g)},class:"outline-divider ease-expo-out placeholder:text-neutral-10 text-neutral-12 focus-visible:outline-accent-7 caret-accent-9 bg-lowest flex-1 rounded-r-full px-3 py-1 text-base outline outline-2 transition-all",placeholder:e.config.placeholder}),e.config.optional&&u(ct,{class:"absolute right-0 top-0",onClick:()=>t(null)})]}),u(lt,{})]}),u(Yt,{error:s.countryCode||s.phoneNumber||{message:n}})]})},ag=({input:e,onSubmitSuccess:t})=>u("div",{class:"flex flex-col items-center py-3",children:u("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:u("span",{class:"flex items-center gap-1.5",children:[u("span",{class:"inline-flex items-center text-sm font-medium",children:e.config.label||"Submit"}),u("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:[u("path",{d:"M4 8L8 4L12 8"}),u("path",{d:"M8 4V13"})]})]})})}),go={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"},sg={email:{type:"email",inputMode:"email",formNoValidate:!0},text:{type:"text",inputMode:"text"},url:{type:"url",inputMode:"url",formNoValidate:!0}},lg=Ht("string"),cg=e=>{const t={maxLength:`Please enter no more than ${e.maxChars??999} characters`,minLength:`Please enter ${e.minChars??1} or more characters`};return Ur(Ce({text:{email:xe(go.email,[Bd(go.email),cr(e.minChars??1,t.minLength),lr(e.maxChars??1/0,t.maxLength)]),text:xe([cr(e.minChars??1,t.minLength),lr(e.maxChars??1/0,t.maxLength)]),url:xe([Hd(go.url),cr(e.minChars??1,t.minLength),lr(e.maxChars??1/0,t.maxLength)])}[e.format]}))},ug=({input:e,onSubmitSuccess:t})=>{var f;const r=e.key?(f=P.current$.value.flow)==null?void 0:f.data.submissions[e.key]:void 0,n=e.config.defaultValue,{register:i,handleSubmit:o,formState:{errors:a}}=zr({defaultValues:{text:n||(lg(r)?r.value:"")},resolver:cg(e.config)}),{ref:s,...l}=i("text",{required:!e.config.optional}),d=L();return fe(()=>{d.current&&(d.current.focus(),d.current.select())},[]),u("form",{noValidate:!0,class:"flex flex-col gap-1 p-2.5",onSubmit:o(c=>{t({type:"string",value:c.text})}),children:[u("div",{class:"flex items-center gap-2",children:[u("div",{class:"relative min-w-0 flex-1",children:[u("input",{id:"chat-input",...l,...sg[e.config.format],autocomplete:"off",autoCapitalize:"off",autoCorrect:"off",autoFocus:!0,ref:c=>{c&&(d.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&&u(ct,{class:"absolute right-0 top-0",onClick:()=>t(null)})]}),u(lt,{})]}),u(Yt,{error:a.text})]})},dg=()=>{var i;const e=(i=P.current$.value.flow)==null?void 0:i.data.currentInput,[t,r]=tv(),n=L(null);return P.inputHeight$.value=r.height,V(()=>{const o=n.current;if(o)return o.addEventListener("transitionstart",X.scrollToEnd.smooth),o.addEventListener("transitioncancel",X.scrollToEnd.smooth),o.addEventListener("transitionend",X.scrollToEnd.smooth),()=>{o.removeEventListener("transitionstart",X.scrollToEnd.smooth),o.removeEventListener("transitioncancel",X.scrollToEnd.smooth),o.removeEventListener("transitionend",X.scrollToEnd.smooth)}},[]),u("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:u("div",{ref:t,class:"border-divider flex flex-col justify-end border-t",children:We({input:e}).with({input:N.nullish},()=>u("div",{class:"flex items-center gap-2 p-2.5",children:[u("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}),u(lt,{disabled:!0,"aria-hidden":"true",tabIndex:-1})]})).with({input:{type:"text"}},o=>u(ug,{onSubmitSuccess:X.onSubmitSuccessFn$.value,...o})).with({input:{type:"phone"}},o=>u(ig,{onSubmitSuccess:X.onSubmitSuccessFn$.value,...o})).with({input:{type:"multiple-choice"}},o=>u(Xv,{onSubmitSuccess:X.onSubmitSuccessFn$.value,...o})).with({input:{type:"boolean"}},o=>u(gv,{onSubmitSuccess:X.onSubmitSuccessFn$.value,...o})).with({input:{type:"file"}},o=>u(kv,{onSubmitSuccess:X.onSubmitSuccessFn$.value,...o})).with({input:{type:"submit"}},o=>u(ag,{onSubmitSuccess:X.onSubmitSuccessFn$.value,...o})).with({input:{type:"address"}},o=>u(dv,{onSubmitSuccess:X.onSubmitSuccessFn$.value,...o})).with({input:{type:"number"}},o=>u(Qv,{onSubmitSuccess:X.onSubmitSuccessFn$.value,...o})).exhaustive()})})};var fg=function(e){return e instanceof RegExp},hg=function(t){var r=/[\\^$.*+?()[\]{}|]/g,n=RegExp(r.source);return t&&n.test(t)?t.replace(r,"\\$&"):t},Ds=function(e){return typeof e=="string"},pg=function(e){var t=[];return e.forEach(function(r){Array.isArray(r)?t=t.concat(r):t.push(r)}),t};function vg(e,t,r){var n=0,i=0;if(e==="")return e;if(!e||!Ds(e))throw new TypeError("First argument to react-string-replace#replaceString must be a string");var o=t;fg(o)||(o=new RegExp("("+hg(o)+")","gi"));for(var a=e.split(o),s=1,l=a.length;s<l;s+=2){if(a[s]===void 0||a[s-1]===void 0){console.warn("reactStringReplace: Encountered undefined value during string replacement. Your RegExp may not be working the way you expect.");continue}i=a[s].length,n+=a[s-1].length,a[s]=r(a[s],s,n),n+=i}return a}var gg=function(t,r,n){return Array.isArray(t)||(t=[t]),pg(t.map(function(i){return Ds(i)?vg(i,r,n):i}))};const qr=Pe(gg),mg=/(\[[^\]]+\]\([^)]+\))/g,bg=/\[([^\]]+)\]\(([^)]+)\)/,yg=/(https?:\/\/[^\s]+)/g,wg=/_(.*?)_/g,_g=/\*\*(.*?)\*\*/g,Ms="text-accent-10 hover:text-accent-11 no-underline underline-offset-2 hover:underline",xg=e=>{const t=qr(e,mg,(o,a)=>{const[,s,l]=o.match(bg)??[];return l?u("a",{class:Ms,href:l,children:s??l},l+a):u("span",{children:"INVALID LINK"})}),r=qr(t,yg,(o,a)=>u("a",{class:Ms,href:o,children:o},o+a)),n=qr(r,wg,(o,a)=>u("em",{children:o},o+a));return qr(n,_g,(o,a)=>u("strong",{children:o},o+a))},kg=$r("select-text 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"}}),$g=({children:e,className:t,animate:r,side:n,...i})=>u("p",{style:{transformOrigin:n==="left"?"0% 50%":"100% 50%"},class:kg({className:t,side:n,animate:r}),...i,children:e}),Sg=({message:e})=>u("div",{class:"bg-accent-3 flex w-full items-center justify-center overflow-hidden rounded-xl px-2 py-2",children:u("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,u("svg",{class:"flex-none",width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:u("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"})})]})}),Cg=({className:e,...t})=>(V(()=>{X.scrollToEnd.smooth()}),u("div",{"aria-hidden":!0,children:X.isBotTyping$.value===!0?u("div",{"aria-label":"Typing…",class:ot("flex gap-1 p-4",e),...t,children:Array.from({length:3},(r,n)=>u("div",{class:"bg-accent-9 h-1.5 w-1.5 animate-bounce rounded-full",style:{animationDelay:`${-n*200}ms`}}))}):void 0})),Eg={bot:"left",user:"right"},Ig=$r("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]"}}}),Og=({lastSentMessageFooter:e})=>{var r;const t=((r=P.current$.value.flow)==null?void 0:r.data.messages)??[];return V(()=>{X.scrollToEnd.smooth()},[t.length]),u("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,i)=>u(Y,{children:u("li",{class:"flex",children:We(n).with({type:"system"},o=>u("p",{class:Ig({variant:o.variant}),children:o.text})).with({type:"text",author:N.union("bot","user")},o=>{const a=o.author==="user"&&!t.slice(i+1).some(d=>d.type==="text"&&d.author==="user"),s=i===t.length-1,l=o.author==="bot"?xg(o.text):o.text;return u($g,{animate:s,side:Eg[o.author],children:[l,a?e:null]},i)}).with({type:"link"},o=>u(Sg,{message:o})).with({type:"image"},o=>u("img",{class:"shadow-surface-md w-full max-w-[min(100%,24rem)] rounded-2xl",src:o.url,style:{aspectRatio:o.width/o.height}})).with({type:"file"},o=>u(wv,{class:o.author==="bot"?void 0:"ml-auto",file:{name:o.fileName,sizeKb:o.fileSizeKb}})).with({type:"loading"},o=>{const a=t[t.length-1];return!(o===a)||X.isBotTyping$.value?null:u("div",{class:"flex flex-grow flex-col items-center justify-center",children:u(Ka,{class:"text-neutral-6 h-8 w-8"})})}).exhaustive()})},i)),u(Cg,{},"typing")]})},Tg=({logger:e,apiClient:t,analytics:r})=>{const{flow:n}=P.current$.value;$e(n,"Flow is required to exist to show chatbot body");const i=P.viewState$.value,{chatRef:o,chatService:a}=sv(),[s,l]=W();return fe(()=>{i==="maximised"&&X.scrollToEnd.instant()},[i]),fe(()=>{var v,w;const{state:d,flow:f}=P.current$.peek();if(d!=="loaded")throw new Error(kp.invalid_state);let c=f.data.nodeHistory.at(-1);if(X.scrollToEnd.instant(),P.setInput(void 0),f.data.isFinished)return;c===void 0?(c=Ba(n.nodes).id,P.setCurrentNodeId(c),r.log({event:"FLOW_START",properties:{flow_id:n.id,flow_version:n.version,flow_session_id:f.data.flowSessionId,flow_build:n.build,job:n.job},customProperties:(v=n.analytics)==null?void 0:v.customProperties})):P.removeMessagesSentByNodeIds([c]);const{interpret:p,abort:m,undo:g}=Lp({context:n.context,analytics:{service:r,customProperties:(w=n.analytics)==null?void 0:w.customProperties},apiClient:t,logger:e,flow:n,chatService:a,getSubmissions:()=>{var x;return(x=P.current$.peek().flow)==null?void 0:x.data.submissions},onInterpret:(x,_)=>{var T;const I=P.current$.peek().flow;$e(I),_&&(I.data.sequence=I.data.sequence+1,r.log({event:"FLOW_NODE",properties:{flow_id:n.id,flow_version:n.version,from_node_id:_.id,flow_build:n.build,to_node_id:x.id,sequence:I.data.sequence,flow_session_id:I.data.flowSessionId,job:n.job},customProperties:(T=n.analytics)==null?void 0:T.customProperties})),P.setCurrentNodeId(x.id)},onFlowEnd:async()=>{var _;P.markAsFinished();const x=P.current$.peek().flow;$e(x),r.log({event:"FLOW_END",properties:{flow_id:n.id,flow_version:n.version,flow_session_id:x.data.flowSessionId,flow_build:n.build,job:n.job},customProperties:(_=n.analytics)==null?void 0:_.customProperties})}});return l(()=>g),p(c),m},[r,t,a,e,n]),u(Y,{children:[u("div",{ref:o,className:"hide-scrollbars relative flex w-full max-w-full flex-grow flex-col overflow-y-scroll",style:{WebkitOverflowScrolling:"touch",paddingBottom:P.inputHeight$.value},children:u(Og,{lastSentMessageFooter:n.data.isFinished||!s?null:u(Pg,{undoFn:s})})}),u(dg,{})]})},Ag=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"):[],Pg=({undoFn:e})=>u("div",{class:"absolute bottom-0 right-0 flex w-full translate-y-full justify-end",children:u("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}=P.current$.peek();$e(t);const{removed:r}=e(t.data.nodeHistory),n=t.data.nodeHistory.splice(-r);n.length!==0&&(P.removeMessagesSentByNodeIds(n),P.setInput(void 0),n.pop(),n.map(i=>t.nodes.find(o=>o.id===i)).filter(Boolean).flatMap(Ag).forEach(i=>delete t.data.submissions[i]),P.current$.value={...P.current$.value})},children:"Undo"})}),Ng=Object.freeze(Object.defineProperty({__proto__:null,ChatbotBody:Tg},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-8f799f13.cjs");
3
+ const index = require("./index-70d48f50.cjs");
4
4
  require("@inploi/sdk");
5
5
  const isIfBlockConditionMet = (ifBlock, {
6
6
  context,
@@ -1414,7 +1414,7 @@ const countries = {
1414
1414
  France: "33",
1415
1415
  "French Guiana": "594",
1416
1416
  "French Polynesia": "689",
1417
- "French Southern and Antarctic Lands": "260",
1417
+ "French Southern and Antarctic Lands": "262",
1418
1418
  Gabon: "241",
1419
1419
  Georgia: "995",
1420
1420
  Germany: "49",
@@ -1439,7 +1439,7 @@ const countries = {
1439
1439
  Indonesia: "62",
1440
1440
  Iran: "98",
1441
1441
  Iraq: "964",
1442
- Ireland: "352",
1442
+ Ireland: "353",
1443
1443
  "Isle of Man": "44",
1444
1444
  Israel: "972",
1445
1445
  Italy: "39",
@@ -1495,7 +1495,7 @@ const countries = {
1495
1495
  Nigeria: "234",
1496
1496
  Niue: "683",
1497
1497
  "Norfolk Island": "672",
1498
- "North Korea": "852",
1498
+ "North Korea": "850",
1499
1499
  "North Macedonia": "389",
1500
1500
  "Northern Mariana Islands": "1 670",
1501
1501
  Norway: "47",
@@ -1549,7 +1549,7 @@ const countries = {
1549
1549
  Sweden: "46",
1550
1550
  Switzerland: "41",
1551
1551
  Syria: "963",
1552
- "São Tomé and Príncipe": "293",
1552
+ "São Tomé and Príncipe": "239",
1553
1553
  Taiwan: "886",
1554
1554
  Tajikistan: "992",
1555
1555
  Tanzania: "255",
@@ -1,4 +1,4 @@
1
- import { g as get$1, i as isString$2, k as kbToReadableSize, a as getHeadOrThrow, b as invariant, A as AbortedError, c as getFlowSubmissionsPayload, N, _, 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 k, m as k$1, n as getFormSubmitter, q as parse, r as picklist, t as isSubmissionOfType, C as Cn, u as parseAsync, V as ValiError, v as object, w as transform, x as cva, z as maxLength, B as minLength, D as record, E as boolean, G as number, H as minValue, I as maxValue, J as custom, K as string, L as regex, M as email, O as url, P as LoadingIndicator, Q as ERROR_MESSAGES } from "./index-5230f617.js";
1
+ import { g as get$1, i as isString$2, k as kbToReadableSize, a as getHeadOrThrow, b as invariant, A as AbortedError, c as getFlowSubmissionsPayload, N, _, 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 k, m as k$1, n as getFormSubmitter, q as parse, r as picklist, t as isSubmissionOfType, C as Cn, u as parseAsync, V as ValiError, v as object, w as transform, x as cva, z as maxLength, B as minLength, D as record, E as boolean, G as number, H as minValue, I as maxValue, J as custom, K as string, L as regex, M as email, O as url, P as LoadingIndicator, Q as ERROR_MESSAGES } from "./index-430056cf.js";
2
2
  import "@inploi/sdk";
3
3
  const isIfBlockConditionMet = (ifBlock, {
4
4
  context,
@@ -1412,7 +1412,7 @@ const countries = {
1412
1412
  France: "33",
1413
1413
  "French Guiana": "594",
1414
1414
  "French Polynesia": "689",
1415
- "French Southern and Antarctic Lands": "260",
1415
+ "French Southern and Antarctic Lands": "262",
1416
1416
  Gabon: "241",
1417
1417
  Georgia: "995",
1418
1418
  Germany: "49",
@@ -1437,7 +1437,7 @@ const countries = {
1437
1437
  Indonesia: "62",
1438
1438
  Iran: "98",
1439
1439
  Iraq: "964",
1440
- Ireland: "352",
1440
+ Ireland: "353",
1441
1441
  "Isle of Man": "44",
1442
1442
  Israel: "972",
1443
1443
  Italy: "39",
@@ -1493,7 +1493,7 @@ const countries = {
1493
1493
  Nigeria: "234",
1494
1494
  Niue: "683",
1495
1495
  "Norfolk Island": "672",
1496
- "North Korea": "852",
1496
+ "North Korea": "850",
1497
1497
  "North Macedonia": "389",
1498
1498
  "Northern Mariana Islands": "1 670",
1499
1499
  Norway: "47",
@@ -1547,7 +1547,7 @@ const countries = {
1547
1547
  Sweden: "46",
1548
1548
  Switzerland: "41",
1549
1549
  Syria: "963",
1550
- "São Tomé and Príncipe": "293",
1550
+ "São Tomé and Príncipe": "239",
1551
1551
  Taiwan: "886",
1552
1552
  Tajikistan: "992",
1553
1553
  Tanzania: "255",
@@ -5320,7 +5320,7 @@ const StatusBar = ({
5320
5320
  };
5321
5321
  function noop() {
5322
5322
  }
5323
- const ChatbotBody = M(() => import("./chatbot-body-1f775f40.js").then((module) => module.ChatbotBody));
5323
+ const ChatbotBody = M(() => import("./chatbot-body-dd8b2ce7.js").then((module) => module.ChatbotBody));
5324
5324
  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 [&:has(.view-switch:active)]:scale-[0.98] transition-all duration-1000 ease-expo-out", {
5325
5325
  variants: {
5326
5326
  view: {
@@ -5321,7 +5321,7 @@ const StatusBar = ({
5321
5321
  };
5322
5322
  function noop() {
5323
5323
  }
5324
- const ChatbotBody = M(() => Promise.resolve().then(() => require("./chatbot-body-bed76074.cjs")).then((module2) => module2.ChatbotBody));
5324
+ const ChatbotBody = M(() => Promise.resolve().then(() => require("./chatbot-body-b09f390e.cjs")).then((module2) => module2.ChatbotBody));
5325
5325
  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 [&:has(.view-switch:active)]:scale-[0.98] transition-all duration-1000 ease-expo-out", {
5326
5326
  variants: {
5327
5327
  view: {
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const index = require("./index-8f799f13.cjs");
3
+ const index = require("./index-70d48f50.cjs");
4
4
  require("@inploi/sdk");
5
5
  exports.chatbotPlugin = index.chatbotPlugin;
@@ -1,4 +1,4 @@
1
- import { R } from "./index-5230f617.js";
1
+ import { R } from "./index-430056cf.js";
2
2
  import "@inploi/sdk";
3
3
  export {
4
4
  R as chatbotPlugin
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inploi/plugin-chatbot",
3
- "version": "3.28.2",
3
+ "version": "3.28.3",
4
4
  "type": "module",
5
5
  "main": "dist/plugin-chatbot.js",
6
6
  "types": "dist/index.d.ts",