@inploi/plugin-chatbot 7.1.0 → 8.0.0
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 +3 -3
- package/cdn/style.css +1 -1
- package/dist/{chatbot-body-b4327f15.js → chatbot-body-9e11b859.js} +952 -1022
- package/dist/chatbot-body-a3863b40.cjs +1 -0
- package/dist/chatbot.d.ts +1 -0
- package/dist/chatbot.dom.d.ts +2 -1
- package/dist/chatbot.idb.d.ts +2 -1
- package/dist/chatbot.lifecycle.test.d.ts +1 -0
- package/dist/chatbot.state.d.ts +247 -1
- package/dist/chatbot.utils.d.ts +0 -1
- package/dist/index-63ff7e92.js +3932 -0
- package/dist/index-cf6d5344.cjs +5 -0
- package/dist/plugin-chatbot.cjs +1 -1
- package/dist/plugin-chatbot.js +1 -1
- package/dist/style.css +1 -1
- package/package.json +4 -4
- package/dist/chatbot-body-f1401333.cjs +0 -1
- package/dist/index-05d5a78d.js +0 -3841
- package/dist/index-d80370e4.cjs +0 -5
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("./index-cf6d5344.cjs");require("@inploi/sdk");const st=({condition:e,context:t,submissions:r,ifBlock:s})=>{const[o,...a]=e.compareKey.split(".");if(!o)return!1;const l=Lt({context:t,key:o,path:a,submissions:r});if(!l)return!1;switch(l.type){case"address":{const i=n.get(l.value,a.join("."));switch(e.compare){case"equals":return i===e.compareValue;case"contains":return i?i.includes(e.compareValue):!1;case"notEquals":return i!==e.compareValue;case"notContains":return i?!i.includes(e.compareValue):!0}break}case"integration":{if(typeof l.value!="object"||Array.isArray(l.value))return!1;const i=n.get(l.value,a.join(".")),f={...s,data:{compareKey:"_temp",compare:e.compare,compareValue:e.compareValue}};switch(typeof i){case"boolean":return xe(f,{submissions:{_temp:{value:i,type:"boolean"}},context:t});case"string":return xe(f,{submissions:{_temp:{value:i,type:"string"}},context:t});case"number":return xe(f,{submissions:{_temp:{value:i,type:"number"}},context:t});case"object":return Array.isArray(i)&&i.every(n.isString)?xe(f,{submissions:{_temp:{value:i,type:"enum"}},context:t}):!1}break}case"boolean":{const i=e.compareValue==="true";switch(e.compare){case"equals":return l.value===i;case"notEquals":return l.value!==i}break}case"phone":case"string":{const i=l.type==="phone"?Fe(l.value):l.value;switch(e.compare){case"equals":return i===e.compareValue;case"contains":return i?i.includes(e.compareValue):!1;case"notEquals":return i!==e.compareValue;case"notContains":return i?!i.includes(e.compareValue):!0}break}case"number":{try{const i=Number(e.compareValue);switch(e.compare){case"equals":return l.value===i;case"notEquals":return l.value!==i;case"greaterThan":return l.value>i;case"greaterThanOrEqualTo":return l.value>=i;case"lessThan":return l.value<i;case"lessThanOrEqualTo":return l.value<=i}}catch{return console.error(`Failed to parse number in if-block ${s.id}`,l.value),!1}break}case"enum":switch(e.compare){case"equals":return l.value.length===1&&l.value[0]===e.compareValue;case"notEquals":return l.value.length===1&&l.value[0]!==e.compareValue;case"contains":return l.value.includes(e.compareValue);case"notContains":return!l.value.includes(e.compareValue)}break}},xe=(e,{context:t,submissions:r})=>{const s="combinator"in e.data?e.data.conditions:[e.data];if(("combinator"in e.data?e.data.combinator:"and")==="or"){for(const a of s)if(st({condition:a,context:t,submissions:r,ifBlock:e}))return!0;return!1}else{for(const a of s)if(!st({condition:a,context:t,submissions:r,ifBlock:e}))return!1;return!0}},rr=/{{\s*([^}]+?)\s*(?:\|\s*([^}]+?)\s*)?}}/g,Y=(e,{context:t,submissions:r})=>e.replace(rr,(s,o,a="")=>{const[l,...i]=o.trim().split("."),f=Lt({key:l,path:i,submissions:r,context:t});if(!f)return a;switch(f.type){case"boolean":return f.value===!0?"true":"false";case"file":return f.value.map(p=>`${p.name} (${n.kbToReadableSize(p.sizeKb)})`).join(", ");case"enum":return f.value.join(", ");case"address":return Object.values(f.value).filter(p=>p&&p.trim().length>0).join(", ");case"number":case"string":return f.value?f.value.toString():a;case"phone":return Fe(f.value);case"integration":{if(typeof f.value!="object"||Array.isArray(f.value))break;const p=n.get(f.value,i.join("."));switch(typeof p){case"boolean":return p===!0?"true":"false";case"string":return p;case"number":return p.toString();case"object":if(Array.isArray(p)&&p.every(n.isString))return p.join(", ")}break}}return a}),It=({node:e,nodes:t,stopWhen:r})=>{if((r==null?void 0:r(e))===!0)return e;const s=e.nextId?t.find(o=>o.id===e.nextId):void 0;if(s)return It({node:s,nodes:t,stopWhen:r})},nr=({childNode:e,nodes:t})=>{const s=t.filter(o=>o.type==="if-block").find(o=>{if(!o.branchId)return!1;const a=t.find(i=>i.id===o.branchId);if(!a)return!1;const l=It({node:a,nodes:t,stopWhen:i=>i.id===e.id});return!(!l||l.id!==e.id)});if(s!=null&&s.nextId)return t.find(o=>o.id===s.nextId)},sr=({flow:e,analytics:t,logger:r,platformClient:s,context:o,apiClient:a,getSubmissions:l,chatService:i,onFlowEnd:f,onInterpret:p,t:C})=>{let v=new AbortController;const h={...t.service,log:y=>t.service.log({...y,customProperties:{...y.customProperties,...t.customProperties}})},b=async(y,E)=>{if(v.signal.aborted)return;const V=l();p==null||p(y,E);try{await ar({flow:e,analytics:h,logger:r,platformClient:s,apiClient:a,context:o,node:y,submissions:V,t:C,chat:{sendMessage:async x=>i.send({groupId:y.id,message:x,signal:v.signal}),userInput:async x=>i.input({input:x,signal:v.signal}),addToSubmissions:(x,_)=>{v.signal.aborted||i.addToSubmissions(x,_)}},next:x=>{const _=x?e.nodes.find(I=>I.id===x):nr({childNode:y,nodes:e.nodes});return _?b(_,y):f==null?void 0:f(y)},end:()=>f==null?void 0:f(y)})}catch(x){if(x instanceof n.AbortedError)return;throw x}};return{interpret:async y=>{const E=e.nodes.find(V=>V.id===y)??n.getHeadOrThrow(e.nodes);return b(E)},undo:y=>{let E=1;const V=e.nodes.find(_=>_.id===y[y.length-1]);for(let _=y.length-2;_>0;_--){const I=y[_],D=e.nodes.find(L=>L.id===I);if(!D||(E++,D.type.startsWith("question-")))break}v.abort(),v=new AbortController;const x=e.nodes.find(_=>_.id===y[y.length-E]);return n.invariant(x,"Undo failed: new start node not found"),b(x,V),{removed:E}},abort:()=>{v.abort()}}},Fe=e=>`+${e.countryCode} ${e.phoneNumber}`;async function ar(e){const t=e.node;switch(t.type){case"text":return pr({...e,node:t});case"image":return gr({...e,node:t});case"question-text":return mr({...e,node:t});case"question-enum":return vr({...e,node:t});case"question-number":return br({...e,node:t});case"question-phone":return yr({...e,node:t});case"question-boolean":return xr({...e,node:t});case"question-file":return kr({...e,node:t});case"question-address":return wr({...e,node:t});case"end-flow":return _r({...e,node:t});case"if-block":return hr({...e,node:t});case"jump":return cr({...e,node:t});case"link":return fr({...e,node:t});case"integration-application-submit":return dr({...e,node:t});case"add-submission":return ur({...e,node:t});case"integration-workflow-get":throw Error("Workflow should be unreachable");case"identify":return or({...e,node:t});case"check-duplicate":return lr({...e,node:t});case"feedback":return ir({...e,node:t});default:throw new Error(`Unknown node: ${JSON.stringify(t)}`)}}const fe=(e,t)=>{var s;const r=(s=e[t])==null?void 0:s.value;if(typeof r!="string"&&typeof r!="number")throw new Error(`Submission at “${t}” is not a string or number`);return r};async function ir({next:e,node:t}){e(t.nextId)}async function or({next:e,node:t,analytics:r,submissions:s,logger:o}){if(!s)return e(t.nextId);try{r.log({event:"IDENTIFY",properties:{identifier:fe(s,t.data.key).toString(),first_name:t.data.firstName?fe(s,t.data.firstName).toString():void 0,last_name:t.data.lastName?fe(s,t.data.lastName).toString():void 0,email:t.data.email?fe(s,t.data.email).toString():void 0,phone_number:t.data.phoneNumber?fe(s,t.data.phoneNumber).toString():void 0,custom_traits:t.data.customTraits?Object.fromEntries(t.data.customTraits.map(({key:a,value:l})=>{var i;return[a,(i=s[l])==null?void 0:i.value]})):void 0}})}catch(a){o.error(a)}finally{e(t.nextId)}}async function lr({next:e,node:t,platformClient:r,submissions:s,flow:o,logger:a,chat:l}){var f;let i={isDuplicate:!1};if(s&&r){const p=t.data.scope==="job"?(f=o.job)==null?void 0:f.id:void 0;if(t.data.scope==="company"||p!=null)try{i=await r.checkDuplicate({email:fe(s,t.data.email).toString(),jobId:p,scope:t.data.scope})}catch(C){a.error("[check-duplicate]",C)}}l.addToSubmissions(t.data.key,{type:"integration",value:i}),e(t.nextId)}async function cr({next:e,node:t}){e(t.data.targetId)}async function ur({next:e,node:t,logger:r,submissions:s,context:o}){if(!s){r.error("Submissions not found");return}s[t.data.key]={type:"string",value:Y(t.data.value,{submissions:s,context:o})},e(t.nextId)}async function dr({chat:e,next:t,node:r,logger:s,apiClient:o,submissions:a,analytics:l,flow:i,t:f}){const p=async C=>{C!==!0&&await e.userInput({type:"submit",key:void 0,config:{label:r.data.submitLabel}}),await e.sendMessage({type:"loading"});const{anonymous_id:v,session_id:h}=l.getSessionInfo(),b=await o.fetch("/flow/submit",{method:"POST",body:JSON.stringify({log_submit:!1,integration_id:r.data.integrationId,anonymous_id:v,session_id:h,job:i.job,submissions:n.getFlowSubmissionsPayload(a||{})})}).catch(y=>y);r.data.key&&e.addToSubmissions(r.data.key,{type:"integration",value:b}),n.M(b).with({integration_response:n.z.select(n.z.union({service:n.z.optional(n.z.string),status:n.z.number,data:n.z.any},{service:n.z.optional(n.z.string),status:n.z.number,error:{message:n.z.string,data:n.z.any}}))},y=>{l.log({event:"FLOW_SUBMIT",properties:{flow_id:i.id,flow_version:i.version,flow_session_id:i.data.flowSessionId,flow_build:i.build,service:y.service??"INVALID_SERVICE",response:{status:y.status,payload:"data"in y?y.data:y.error.data??null},job:i.job}})}).otherwise(()=>{}),await n.M(b).with({integration_response:{data:n.z.select("redirect",{redirect_url:n.z.string,message:n.z.optional(n.z.union(n.z.string,n.z.nullish)),button_text:n.z.optional(n.z.union(n.z.string,n.z.nullish))})}},async y=>{await e.sendMessage({type:"text",author:"bot",text:y.redirect.message??f("submission_redirect_message")});try{const E=new URL(y.redirect.redirect_url);v&&!E.searchParams.has("anonymous_id")&&E.searchParams.set("anonymous_id",v),await e.sendMessage({type:"link",href:E.toString(),text:y.redirect.button_text??f("complete_submission"),onClick:()=>{if(!h){s.error("session_id not set, cannot log FLOW_REDIRECT event");return}l.log({event:"FLOW_REDIRECT",properties:{flow_build:i.build,flow_id:i.id,flow_session_id:h,flow_version:i.version,href:E.toString(),job:i.job}})}})}catch(E){s.error(`Invalid redirect URL: ${y.redirect.redirect_url}`,E),e.sendMessage({type:"system",variant:"error",text:f("redirect_url_error")})}t(r.nextId)}).with({success:!0},async()=>{r.data.skipConfirmation!==!0&&await e.sendMessage({type:"system",variant:"success",text:f("submission_completed")}),t(r.nextId)}).with({integration_response:{error:n.z.select("error",{message:n.z.string})}},async y=>{s.error(y.error),await e.sendMessage({type:"system",variant:"error",text:y.error.message||f("submission_failed")}),await p(!1)}).otherwise(async y=>{s.error(y),await e.sendMessage({type:"system",variant:"error",text:f("submission_failed")}),await p(!1)})};await p(r.data.skipConfirmation)}async function fr({chat:e,next:t,node:r,submissions:s,context:o}){await e.sendMessage({type:"link",href:Y(r.data.href,{submissions:s,context:o}),text:Y(r.data.cta,{submissions:s,context:o})}),t(r.nextId)}async function hr({submissions:e,next:t,node:r,context:s}){t(xe(r,{submissions:e,context:s})?r.branchId:r.nextId)}async function pr({chat:e,next:t,node:r,submissions:s,context:o}){await e.sendMessage({author:"bot",type:"text",text:Y(r.data.text,{submissions:s,context:o})}),t(r.nextId)}async function gr({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 mr({chat:e,next:t,node:r,submissions:s,context:o,t:a}){await e.sendMessage({author:"bot",type:"text",text:Y(r.data.question,{submissions:s,context:o})});const l=r.data.format==="phone"?await e.userInput({key:r.data.key,type:"phone",config:{optional:r.data.optional,placeholder:r.data.placeholder,minChars:r.data.minChars,maxChars:r.data.maxChars,submissionFormat:"text",defaultValue:{}}}):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}});l===null?await e.sendMessage({type:"system",variant:"info",text:a("skipped")}):await e.sendMessage({author:"user",type:"text",text:l.type==="phone"?Fe(l.value):l.value}),t(r.nextId)}async function br({chat:e,next:t,node:r,submissions:s,context:o,t:a}){await e.sendMessage({author:"bot",type:"text",text:Y(r.data.question,{submissions:s,context:o})});const l=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}});l===null?await e.sendMessage({type:"system",variant:"info",text:a("skipped")}):await e.sendMessage({author:"user",type:"text",text:l.value.toString()}),t(r.nextId)}async function yr({chat:e,next:t,node:r,submissions:s,context:o}){await e.sendMessage({author:"bot",type:"text",text:Y(r.data.question,{submissions:s,context:o})});const a=await e.userInput({key:r.data.key,type:"phone",config:{minChars:r.data.minChars,defaultValue:{countryCode:r.data.defaultCountryCode},placeholder:r.data.placeholder,submissionFormat:"phone",optional:r.data.optional}});a===null?await e.sendMessage({type:"system",variant:"info",text:"Skipped"}):await e.sendMessage({author:"user",type:"text",text:a.type==="phone"?Fe(a.value):a.value}),t(r.nextId)}async function vr({chat:e,next:t,node:r,submissions:s,context:o,t:a}){await e.sendMessage({author:"bot",type:"text",text:Y(r.data.question,{submissions:s,context:o})});const l=await e.userInput({key:r.data.key,type:"multiple-choice",config:r.data});l.value.length===0?await e.sendMessage({type:"system",variant:"info",text:a("skipped")}):await e.sendMessage({author:"user",type:"text",text:r.data.options.filter(i=>l.value.includes(i.value)).map(i=>i.label).join(", ")}),t(r.nextId)}async function xr({chat:e,next:t,node:r,submissions:s,context:o,t:a}){await e.sendMessage({author:"bot",type:"text",text:Y(r.data.question,{submissions:s,context:o})});const l=await e.userInput({key:r.data.key,type:"boolean",config:{optional:r.data.optional,labels:{true:r.data.trueLabel,false:r.data.falseLabel}}});l===null?await e.sendMessage({type:"system",variant:"info",text:a("skipped")}):await e.sendMessage({author:"user",type:"text",text:l.value===!0?r.data.trueLabel:r.data.falseLabel}),t(r.nextId)}async function wr({chat:e,next:t,node:r,t:s}){await e.sendMessage({author:"bot",type:"text",text:r.data.question});const o=await e.userInput({type:"address",key:r.data.key,config:{optional:r.data.optional,keys:r.data.keys,placeholder:r.data.placeholder}});if(o===null)await e.sendMessage({type:"system",variant:"info",text:s("skipped")});else{const a=Object.values(o.value).filter(l=>l&&l.trim().length>0).join(", ");await e.sendMessage({author:"user",type:"text",text:a})}return t(r.nextId)}async function kr({node:e,chat:t,next:r,submissions:s,context:o,t:a}){await t.sendMessage({author:"bot",type:"text",text:Y(e.data.question,{submissions:s,context:o})});const l=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(l===null)await t.sendMessage({type:"system",variant:"info",text:a("skipped")});else for(const i of l.value)await t.sendMessage({author:"user",type:"file",fileName:i.name,fileSizeKb:i.sizeKb});r(e.nextId)}async function _r({chat:e,end:t,node:r}){await e.sendMessage({type:"system",variant:"info",text:r.data.systemMessage}),t()}const Lt=({key:e,path:t,submissions:r,context:s})=>{if(e==="$context"){if(!t)return;const o=n.get(s,t.join("."));switch(typeof o){case"string":return{type:"string",value:o};case"number":return{type:"number",value:o};case"boolean":return{type:"boolean",value:o};default:console.warn(`Unexpected type for $context.${t.join(".")}`,o);return}}return r==null?void 0:r[e]};function at(e,t){let r;return(...s)=>{window.clearTimeout(r),r=window.setTimeout(()=>e(...s),t)}}function Cr({debounce:e,scroll:t,polyfill:r,offsetSize:s}={debounce:0,scroll:!1,offsetSize:!1}){const o=r||(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,l]=n.h({left:0,top:0,width:0,height:0,bottom:0,right:0,x:0,y:0}),i=n._({element:null,scrollContainers:null,resizeObserver:null,lastBounds:a,orientationHandler:null}),f=e?typeof e=="number"?e:e.scroll:null,p=e?typeof e=="number"?e:e.resize:null,C=n._(!1);n.p(()=>(C.current=!0,()=>void(C.current=!1)));const[v,h,b]=n.F(()=>{const x=()=>{if(!i.current.element)return;const{left:_,top:I,width:D,height:L,bottom:ae,right:ue,x:Q,y:re}=i.current.element.getBoundingClientRect(),P={left:_,top:I,width:D,height:L,bottom:ae,right:ue,x:Q,y:re};i.current.element instanceof HTMLElement&&s&&(P.height=i.current.element.offsetHeight,P.width=i.current.element.offsetWidth),Object.freeze(P),C.current&&!Fr(i.current.lastBounds,P)&&l(i.current.lastBounds=P)};return[x,p?at(x,p):x,f?at(x,f):x]},[l,s,f,p]);function y(){i.current.scrollContainers&&(i.current.scrollContainers.forEach(x=>x.removeEventListener("scroll",b,!0)),i.current.scrollContainers=null),i.current.resizeObserver&&(i.current.resizeObserver.disconnect(),i.current.resizeObserver=null),i.current.orientationHandler&&("orientation"in screen&&"removeEventListener"in screen.orientation?screen.orientation.removeEventListener("change",i.current.orientationHandler):"onorientationchange"in window&&window.removeEventListener("orientationchange",i.current.orientationHandler))}function E(){i.current.element&&(i.current.resizeObserver=new o(b),i.current.resizeObserver.observe(i.current.element),t&&i.current.scrollContainers&&i.current.scrollContainers.forEach(x=>x.addEventListener("scroll",b,{capture:!0,passive:!0})),i.current.orientationHandler=()=>{b()},"orientation"in screen&&"addEventListener"in screen.orientation?screen.orientation.addEventListener("change",i.current.orientationHandler):"onorientationchange"in window&&window.addEventListener("orientationchange",i.current.orientationHandler))}const V=x=>{!x||x===i.current.element||(y(),i.current.element=x,i.current.scrollContainers=At(x),E())};return Vr(b,!!t),Sr(h),n.p(()=>{y(),E()},[t,b,h]),n.p(()=>y,[]),[V,a,v]}function Sr(e){n.p(()=>{const t=e;return window.addEventListener("resize",t),()=>void window.removeEventListener("resize",t)},[e])}function Vr(e,t){n.p(()=>{if(t){const r=e;return window.addEventListener("scroll",r,{capture:!0,passive:!0}),()=>void window.removeEventListener("scroll",r,!0)}},[e,t])}function At(e){const t=[];if(!e||e===document.body)return t;const{overflow:r,overflowX:s,overflowY:o}=window.getComputedStyle(e);return[r,s,o].some(a=>a==="auto"||a==="scroll")&&t.push(e),[...t,...At(e.parentElement)]}const Er=["x","y","top","bottom","left","right","width","height"],Fr=(e,t)=>Er.every(r=>e[r]===t[r]),le=({class:e,...t})=>{const{t:r}=n.useTranslation();return n.o("button",{class:n.clsx("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:n.o("svg",{class:"block",width:"16",height:"16",viewBox:"0 0 16 16",fill:"transparent",stroke:"currentColor","stroke-linecap":"round","stroke-width":"2",children:[n.o("title",{children:r("send")}),n.o("path",{d:"M3.5 7.5L8 3L12.5 7.5"}),n.o("path",{d:"M8 4V13"})]})})},pe=({error:e})=>!e||!e.message?null:n.o("div",{role:"alert",class:"text-error-11 flex max-w-full items-center gap-1 overflow-hidden rounded-full px-2 py-2",children:[n.o("svg",{class:"text-error-9 h-4 w-4",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[n.o("circle",{cx:"8",cy:"8",r:"6.3",stroke:"currentColor","stroke-width":"1.4"}),n.o("rect",{x:"7",y:"4",width:"2",height:"5",fill:"currentColor"}),n.o("rect",{x:"7",y:"10",width:"2",height:"2",fill:"currentColor"})]}),n.o("p",{class:"truncate pr-1 text-sm",children:e.message})]}),ce=({class:e,...t})=>{const{t:r}=n.useTranslation();return n.o("button",{type:"button",class:n.clsx("fr touch-hitbox text-neutral-10 bg-neutral-1 ring-divider hover:ring-divider active:ring-interactive-bg-hover hover:text-neutral-12 active:text-neutral-12 hover:bg-divider active:bg-interactive-bg-hover flex flex-shrink-0 items-center justify-center gap-1 self-center rounded-full py-1 pl-2 pr-2.5 text-sm ring-1 transition-all",e),...t,children:[n.o("svg",{"aria-hidden":!0,class:"block",width:"16",height:"16",viewBox:"0 0 16 16",fill:"transparent",stroke:"currentColor","stroke-linecap":"round","stroke-width":"1.5",children:[n.o("title",{children:r("skip")}),n.o("path",{d:"M3.25 11.25A5 5 0 0 1 12 7"}),n.o("path",{d:"M13.25 4.5V8.25H9.5"})]}),r("skip")]})},je={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"},_e=n.cva("outline-divider ease-expo-out placeholder:text-neutral-10 text-neutral-12 focus-visible:outline-accent-7 caret-accent-9 bg-lowest py-1 text-base outline outline-2 transition-all",{variants:{optional:{true:"pr-16 pl-3",false:"pl-3 pr-3"}},defaultVariants:{optional:!1}}),Ir="https://api.mapbox.com/search/searchbox/v1/suggest",Lr="ZzRDWFU0dTZ3SF9aWk9RNGl6QzZaWS5RZmlFak13a0hPbGxXZXlNSGN5RUhObUJ6TXpSV08yUW5OdE5tSTZJU1lpd2lJb1JYYXRObmJ2Tm5iaGhHZWx4V1lpb2pJMUp5ZS5rcA==",Ar=e=>atob(e).split("").reverse().join(""),ee=n.object({name:n.string()}),Mr=n.object({suggestions:n.array(n.object({full_address:n.optional(n.string()),place_formatted:n.optional(n.string()),name:n.optional(n.string()),mapbox_id:n.string(),context:n.partial(n.object({address:ee,street:ee,neighborhood:ee,locality:ee,district:ee,place:ee,region:ee,postcode:ee,country:ee}))}))}),Tr=({logger:e,t})=>n.F(()=>{var s;const r=(s=n.store.current$.peek().flow)==null?void 0:s.data.flowSessionId;return r?{enabled:!0,getPredictions:async o=>{var v;const a=new URL(Ir);a.searchParams.set("q",o),a.searchParams.set("session_token",r);const l=(v=n.store.current$.peek().flow)==null?void 0:v.locationOrigin;l&&l.lat!==void 0&&l.lng!==void 0&&l.lat>=-90&&l.lat<=90&&l.lng>=-180&&l.lng<=180&&a.searchParams.set("proximity",`${l.lng},${l.lat}`),a.searchParams.set("access_token",Ar(Lr));const f=await fetch(a);if(!f.ok)return e.error("Failed to get address details",f),{ok:!1,error:t("address_error")};const p=n.safeParse(Mr,await f.json());if(p.success===!1)return e.error("Failed to parse address details",p.issues),{ok:!1,error:t("address_error")};const{suggestions:C}=p.output;return{ok:!0,data:C.map(h=>{var b,y,E,V,x,_,I,D,L;return{label:h.full_address??h.place_formatted??h.name??h.mapbox_id,id:h.mapbox_id,address:{line1:((b=h.context.address)==null?void 0:b.name)??((y=h.context.street)==null?void 0:y.name),line2:void 0,line3:((E=h.context.neighborhood)==null?void 0:E.name)??((V=h.context.locality)==null?void 0:V.name),city:((x=h.context.place)==null?void 0:x.name)??((_=h.context.district)==null?void 0:_.name),state:(I=h.context.region)==null?void 0:I.name,postcode:(D=h.context.postcode)==null?void 0:D.name,country:(L=h.context.country)==null?void 0:L.name}}})}}}:{enabled:!1}},[e,t]),it=e=>{const{t}=n.useTranslation();return n.o("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:[n.o("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:n.o("path",{d:"M10 3L5 8L10 13"})}),n.o("span",{children:t("back")})]})},Nr=({input:e,onSubmitSuccess:t,logger:r})=>{const{t:s}=n.useTranslation(),[o,a]=n.h(),[l,i]=n.h([]),{enabled:f,getPredictions:p}=Tr({logger:r,t:s}),[C,v]=n.h(f?"query":"manual"),[h,b]=n.h(""),[y,E]=n.h(),V=x=>{n.invariant(f,"Query state should not be enabled"),x=x.trim(),x!==(h==null?void 0:h.trim())&&(b(x),x===""&&i([]),E(void 0),p(x).then(_=>{if(_.ok===!1){i([]),E(_.error);return}i(_.data)}))};switch(C){case"query":return n.invariant(f,"Query state should not be enabled"),n.o(Dr,{input:e,onSkip:()=>t(null),onAddressSelect:x=>{if(x===""){a(void 0),v("manual");return}const _=l.find(I=>I.id===x);_&&(a(_.address),v("details"))},onAddressSearch:x=>{V(x)},suggestions:l,query:h,error:y});case"details":return n.invariant(o!==void 0),n.o(lt,{input:e,logger:r,onSubmitSuccess:t,addressFields:o,actions:n.o(it,{onClick:()=>{v("query")}})});case"manual":return n.o(lt,{logger:r,input:e,onSubmitSuccess:t,addressFields:{},actions:f?n.o(it,{onClick:()=>{v("query")}}):void 0})}},Dr=({input:e,onSkip:t,suggestions:r,onAddressSelect:s,query:o,onAddressSearch:a,error:l})=>{const{t:i}=n.useTranslation(),f=n._(null);return n.y(()=>{f.current&&(f.current.focus(),f.current.select())},[]),n.o(n.k,{children:[n.o("form",{noValidate:!0,onSubmit:p=>{p.preventDefault();const v=new FormData(p.currentTarget).get("address");typeof v=="string"&&a(v)},class:"flex gap-2 p-2.5",children:[n.o("div",{class:"group relative flex-1",children:[n.o("input",{ref:f,name:"address",id:"chat-address",autocomplete:"address-line1 country-name postal-code",autoFocus:!0,placeholder:e.config.placeholder||i("address_search"),defaultValue:o,class:_e({optional:!!e.config.optional,className:"w-full rounded-full"})}),n.o("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:n.o("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[n.o("g",{id:"inploi",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round",strokeWidth:"1.5",children:[n.o("circle",{cx:"7",cy:"7",r:"4"}),n.o("path",{d:"M10 10L13 13"})]}),n.o("span",{class:"sr-only",children:i("search")})]})})]}),e.config.optional&&n.o(ce,{class:"relative",onClick:t})]}),l?n.o(pe,{error:{message:l}}):null,n.o("ul",{children:[r.map(p=>n.o("li",{children:n.o("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:()=>{s(p.id)},children:[n.o("span",{class:"flex-grow",children:p.label}),n.o("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:n.o("path",{d:"M6 3L11 8L6 13"})})]})},p.id)),n.o("li",{children:n.o("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:()=>{s("")},children:n.o("span",{class:"flex-grow",children:i("address_manual")})})},"")]})]})},ot=["line1","line2","line3","city","state","postcode","country"],lt=({addressFields:e,onSubmitSuccess:t,actions:r,input:s})=>{const o=n._(null);n.y(()=>{if(o.current){const i=o.current.querySelector("input");i&&(i.focus(),i.select())}},[]);const a=Object.keys(je),{t:l}=n.useTranslation();return n.o("form",{class:"bg-neutral-1/90 flex flex-col justify-end gap-2 p-2",onSubmit:i=>{const f=new FormData(i.currentTarget),p=Object.fromEntries(f.entries());t({type:"address",value:p})},children:[n.o("div",{class:"bg-neutral-3 border-neutral-5 grid items-center gap-1.5 rounded-2xl border pb-2 pl-4 pr-3 pt-3 [grid-template-columns:min-content_1fr]",ref:o,children:ot.map((i,f)=>{const p=`isdk_${i}`,C=s.config.keys[i];return C?n.o(n.k,{children:[n.o("label",{for:p,class:"text-neutral-9 [&:has(+*>input:focus)]:text-neutral-11 w-24 pb-2 text-xs uppercase leading-3 tracking-widest transition-colors",children:l(i)}),n.o("div",{class:"flex flex-col items-stretch gap-1.5",children:[i==="country"?n.o("div",{class:"relative",children:[n.o("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:C,id:p,defaultValue:e[i],required:!0,children:[e.country&&!a.includes(e.country)?n.o("option",{value:e[i],children:e[i]}):n.o("option",{value:"",children:l("select_country")}),a.map(v=>n.o("option",{value:v,children:v},v))]}),n.o("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:n.o("path",{d:"M4 6.5L8 10.5L12 6.5"})})]}):n.o("input",{autoFocus:f===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:C,id:p,defaultValue:e[i],required:!0}),f===ot.length-1?n.o("hr",{class:"m-0 w-full border-b border-b-transparent"}):n.o("hr",{class:"border-b-neutral-5 m-0 w-full border-b border-solid"})]})]}):null})}),n.o("div",{class:"flex w-full flex-1 ",children:[n.o("div",{class:"flex-grow",children:r}),n.o(le,{class:"flex items-center justify-center"})]})]})},Pe=()=>{const e=n._(null);return n.p(()=>{var t;(t=e.current)==null||t.focus()},[]),e},Mt=["true","false"],Rr=n.picklist(Mt),Or="answer",Tt="flex items-center flex-wrap gap-2 p-2.5",Nt="min-w-0 max-w-full flex-auto",Dt=n.k$1(({label:e,...t},r)=>n.o("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 py-2.5 ring-2 transition-all selection:bg-transparent",...t,ref:r,children:n.o("p",{class:"text-center text-base",children:e})})),Br=({input:e,onSubmitSuccess:t})=>{const r=Pe();return n.o("form",{noValidate:!0,class:"",onSubmit:s=>{s.preventDefault();const o=n.getFormSubmitter(s).value,a=n.parse(Rr,o);t({type:"boolean",value:a==="true"})},children:[n.o("ul",{class:Tt,children:Mt.map((s,o)=>n.o("li",{class:Nt,children:n.o(Dt,{ref:o===0?r:null,type:"submit",name:Or,value:s,label:e.config.labels[s]},s)}))}),e.config.optional&&n.o("div",{class:"px-2 pb-2",children:n.o(ce,{class:"relative w-full",type:"button",onClick:()=>t(null)})})]})},zr=e=>new Promise((t,r)=>{const s=new FileReader;s.readAsDataURL(e),s.onload=()=>s.result?t(s.result.toString()):r("No result from reader"),s.onerror=r}),jr=e=>e.reduce((t,r)=>t+r.sizeKb,0),Pr=n.isSubmissionOfType("file"),ct=3,$r=({file:e,class:t,...r})=>{const s=e.name.split(".").pop(),o=e.name.replace(new RegExp(`.${s}$`),"");return n.o("div",{class:n.clsx("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:[n.o("p",{"aria-label":"File name",class:"text-accent-12 flex flex-grow overflow-hidden",children:[n.o("span",{class:"block truncate",children:o}),n.o("span",{children:[".",s]})]}),n.o("p",{"aria-label":"File size",class:"text-accent-11",children:n.kbToReadableSize(e.sizeKb)})]})},ut=({class:e,...t})=>n.o("li",{class:n.clsx("outline-neutral-6 text-neutral-11 bg-neutral-1 block rounded-md px-1 py-0.5 text-xs outline outline-1",e),...t}),Rt=e=>{const t=e.split(".").pop();if(!t)throw new Error("No file extension found");return t?"."+t:""},Ur=({allowedExtensions:e,files:t})=>{const r=e.map(s=>s.toLowerCase());return t.every(s=>r.includes(Rt(s.name).toLowerCase()))},qr=(e,t)=>{const r=Rt(e);return`${e.replace(new RegExp(`${r}$`),"").slice(0,t)}${r}`},Hr=({input:e,onSubmitSuccess:t})=>{var v;const r=(v=n.store.current$.value.flow)==null?void 0:v.data.submissions[e.key],[s,o]=n.h(Pr(r)?r.value:[]),[a,l]=n.h(),i=s.length-ct,f=jr(s),p=Pe(),{t:C}=n.useTranslation();return n.o("form",{class:"flex flex-col gap-1 p-2.5",onSubmit:h=>(h.preventDefault(),l(void 0),s.length===0?l({type:"required",message:C("validation_file")}):e.config.extensions.length>0&&!Ur({allowedExtensions:e.config.extensions,files:s})?l({type:"validate",message:`${C("validation_file_ext",{ext:e.config.extensions.join(", ")})}`}):e.config.fileSizeLimitKib&&f>e.config.fileSizeLimitKib?l({type:"max",message:`File size exceeds limit of ${n.kbToReadableSize(e.config.fileSizeLimitKib)}`}):e.config.allowMultiple===!1&&s.length>1?l({type:"invalid",message:C("validation_file_max",{count:1})}):t({type:"file",value:s})),children:[n.o("div",{class:"flex items-center gap-2",children:[n.o("label",{ref:p,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:[s.length>0?n.o(n.k,{children:[n.o("ul",{class:"flex max-w-full flex-wrap justify-center gap-1 overflow-hidden p-1",children:[s.slice(0,ct).map(h=>{const b=h.name.split(".").pop(),y=h.name.replace(new RegExp(`.${b}$`),"");return n.o(ut,{class:"flex overflow-hidden",children:[n.o("span",{class:"block truncate",children:y}),n.o("span",{children:[".",b]})]})}),i>0?n.o(ut,{children:["+",i," file",i!==1?"s":""]}):null]}),n.o("p",{class:"text-neutral-11 text-xs",children:[n.kbToReadableSize(f)," ",s.length>1?"total":""]})]}):n.o("div",{class:"flex flex-col justify-center gap-4 pb-6 pt-5",children:[n.o("header",{class:"flex flex-col items-center gap-0",children:[n.o("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:n.o("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"})}),n.o("p",{class:"text-neutral-12 tracking-[-0.01em]",children:C("upload_file",{count:e.config.allowMultiple?2:1})}),e.config.fileSizeLimitKib?n.o("p",{class:"text-neutral-10 text-xs",children:["(",C("file_max_size",{size:n.kbToReadableSize(e.config.fileSizeLimitKib)}),")"]}):null]}),n.o("aside",{class:"flex flex-col items-center gap-2",children:[n.o("p",{id:"accepted-filetypes",class:"sr-only",children:C("file_extensions")}),n.o("ul",{"aria-describedby":"accepted-filetypes",class:"flex flex-wrap justify-center gap-2",children:e.config.extensions.map(h=>n.o("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:h.replace(".","")}))})]})]}),n.o("input",{id:"dropzone-file",onInput:async h=>{n.invariant(h.target instanceof HTMLInputElement);const b=h.target.files?Array.from(h.target.files):[],y=await Promise.allSettled(b.map(async V=>{const x=await zr(V);return{name:qr(V.name,42),data:x,sizeKb:V.size/1e3}}));if(y.some(({status:V})=>V==="rejected"))return l({type:"invalid",message:"Invalid file"});const E=y.map(V=>V.status==="fulfilled"?V.value:null).filter(Boolean);o(E)},multiple:e.config.allowMultiple,type:"file",class:"sr-only"})]}),n.o("div",{class:"flex h-full flex-col items-center gap-2",children:[n.o(le,{disabled:s.length===0}),e.config.optional&&n.o(ce,{class:"relative",onClick:()=>t(null)})]})]}),n.o(pe,{error:a})]})};var Ce=e=>e.type==="checkbox",oe=e=>e instanceof Date,H=e=>e==null;const Ot=e=>typeof e=="object";var B=e=>!H(e)&&!Array.isArray(e)&&Ot(e)&&!oe(e),Kr=e=>B(e)&&e.target?Ce(e.target)?e.target.checked:e.target.value:e,Gr=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,Wr=(e,t)=>e.has(Gr(t)),Jr=e=>{const t=e.constructor&&e.constructor.prototype;return B(t)&&t.hasOwnProperty("isPrototypeOf")},$e=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function j(e){if(e instanceof Date)return new Date(e);const t=typeof FileList<"u"&&e instanceof FileList;if($e&&(e instanceof Blob||t))return e;const r=Array.isArray(e);if(!r&&!(B(e)&&Jr(e)))return e;const s=r?[]:Object.create(Object.getPrototypeOf(e));for(const o in e)Object.prototype.hasOwnProperty.call(e,o)&&(s[o]=j(e[o]));return s}var Ie=e=>/^\w*$/.test(e),R=e=>e===void 0,Ue=e=>Array.isArray(e)?e.filter(Boolean):[],qe=e=>Ue(e.replace(/["|']|\]/g,"").split(/\.|\[/)),k=(e,t,r)=>{if(!t||!B(e))return r;const s=(Ie(t)?[t]:qe(t)).reduce((o,a)=>H(o)?o:o[a],e);return R(s)||s===e?R(e[t])?r:e[t]:s},X=e=>typeof e=="boolean",J=e=>typeof e=="function",N=(e,t,r)=>{let s=-1;const o=Ie(t)?[t]:qe(t),a=o.length,l=a-1;for(;++s<a;){const i=o[s];let f=r;if(s!==l){const p=e[i];f=B(p)||Array.isArray(p)?p:isNaN(+o[s+1])?{}:[]}if(i==="__proto__"||i==="constructor"||i==="prototype")return;e[i]=f,e=e[i]}};const dt={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change"},Z={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},te={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},Zr=n.Cn.createContext(null);Zr.displayName="HookFormControlContext";var Xr=(e,t,r,s=!0)=>{const o={defaultValues:t._defaultValues};for(const a in e)Object.defineProperty(o,a,{get:()=>{const l=a;return t._proxyFormState[l]!==Z.all&&(t._proxyFormState[l]=!s||Z.all),r&&(r[l]=!0),e[l]}});return o};const Yr=typeof window<"u"?n.Cn.useLayoutEffect:n.Cn.useEffect;var G=e=>typeof e=="string",Qr=(e,t,r,s,o)=>G(e)?(s&&t.watch.add(e),k(r,e,o)):Array.isArray(e)?e.map(a=>(s&&t.watch.add(a),k(r,a))):(s&&(t.watchAll=!0),r),Be=e=>H(e)||!Ot(e);function se(e,t,r=new WeakSet){if(Be(e)||Be(t))return Object.is(e,t);if(oe(e)&&oe(t))return Object.is(e.getTime(),t.getTime());const s=Object.keys(e),o=Object.keys(t);if(s.length!==o.length)return!1;if(r.has(e)||r.has(t))return!0;r.add(e),r.add(t);for(const a of s){const l=e[a];if(!o.includes(a))return!1;if(a!=="ref"){const i=t[a];if(oe(l)&&oe(i)||B(l)&&B(i)||Array.isArray(l)&&Array.isArray(i)?!se(l,i,r):!Object.is(l,i))return!1}}return!0}const en=n.Cn.createContext(null);en.displayName="HookFormContext";var Bt=(e,t,r,s,o)=>t?{...r[e],types:{...r[e]&&r[e].types?r[e].types:{},[s]:o||!0}}:{},we=e=>Array.isArray(e)?e:[e],ft=()=>{let e=[];return{get observers(){return e},next:o=>{for(const a of e)a.next&&a.next(o)},subscribe:o=>(e.push(o),{unsubscribe:()=>{e=e.filter(a=>a!==o)}}),unsubscribe:()=>{e=[]}}};function zt(e,t){const r={};for(const s in e)if(e.hasOwnProperty(s)){const o=e[s],a=t[s];if(o&&B(o)&&a){const l=zt(o,a);B(l)&&(r[s]=l)}else e[s]&&(r[s]=a)}return r}var q=e=>B(e)&&!Object.keys(e).length,He=e=>e.type==="file",Ve=e=>{if(!$e)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},jt=e=>e.type==="select-multiple",Ke=e=>e.type==="radio",tn=e=>Ke(e)||Ce(e),Oe=e=>Ve(e)&&e.isConnected;function rn(e,t){const r=t.slice(0,-1).length;let s=0;for(;s<r;)e=R(e)?s++:e[t[s++]];return e}function nn(e){for(const t in e)if(e.hasOwnProperty(t)&&!R(e[t]))return!1;return!0}function O(e,t){const r=Array.isArray(t)?t:Ie(t)?[t]:qe(t),s=r.length===1?e:rn(e,r),o=r.length-1,a=r[o];return s&&delete s[a],o!==0&&(B(s)&&q(s)||Array.isArray(s)&&nn(s))&&O(e,r.slice(0,-1)),e}var sn=e=>{for(const t in e)if(J(e[t]))return!0;return!1};function Pt(e){return Array.isArray(e)||B(e)&&!sn(e)}function ze(e,t={}){for(const r in e){const s=e[r];Pt(s)?(t[r]=Array.isArray(s)?[]:{},ze(s,t[r])):R(s)||(t[r]=!0)}return t}function he(e,t,r){r||(r=ze(t));for(const s in e){const o=e[s];if(Pt(o))R(t)||Be(r[s])?r[s]=ze(o,Array.isArray(o)?[]:{}):he(o,H(t)?{}:t[s],r[s]);else{const a=t[s];r[s]=!se(o,a)}}return r}const ht={value:!1,isValid:!1},pt={value:!0,isValid:!0};var $t=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&&!R(e[0].attributes.value)?R(e[0].value)||e[0].value===""?pt:{value:e[0].value,isValid:!0}:pt:ht}return ht},Ut=(e,{valueAsNumber:t,valueAsDate:r,setValueAs:s})=>R(e)?e:t?e===""?NaN:e&&+e:r&&G(e)?new Date(e):s?s(e):e;const gt={isValid:!1,value:null};var qt=e=>Array.isArray(e)?e.reduce((t,r)=>r&&r.checked&&!r.disabled?{isValid:!0,value:r.value}:t,gt):gt;function mt(e){const t=e.ref;return He(t)?t.files:Ke(t)?qt(e.refs).value:jt(t)?[...t.selectedOptions].map(({value:r})=>r):Ce(t)?$t(e.refs).value:Ut(R(t.value)?e.ref.value:t.value,e)}var an=(e,t,r,s)=>{const o={};for(const a of e){const l=k(t,a);l&&N(o,a,l._f)}return{criteriaMode:r,names:[...e],fields:o,shouldUseNativeValidation:s}},Ee=e=>e instanceof RegExp,ye=e=>R(e)?e:Ee(e)?e.source:B(e)?Ee(e.value)?e.value.source:e.value:e,bt=e=>({isOnSubmit:!e||e===Z.onSubmit,isOnBlur:e===Z.onBlur,isOnChange:e===Z.onChange,isOnAll:e===Z.all,isOnTouch:e===Z.onTouched});const yt="AsyncFunction";var on=e=>!!e&&!!e.validate&&!!(J(e.validate)&&e.validate.constructor.name===yt||B(e.validate)&&Object.values(e.validate).find(t=>t.constructor.name===yt)),ln=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate),vt=(e,t,r)=>!r&&(t.watchAll||t.watch.has(e)||[...t.watch].some(s=>e.startsWith(s)&&/^\.\w+/.test(e.slice(s.length))));const ke=(e,t,r,s)=>{for(const o of r||Object.keys(e)){const a=k(e,o);if(a){const{_f:l,...i}=a;if(l){if(l.refs&&l.refs[0]&&t(l.refs[0],o)&&!s)return!0;if(l.ref&&t(l.ref,l.name)&&!s)return!0;if(ke(i,t))break}else if(B(i)&&ke(i,t))break}}};function xt(e,t,r){const s=k(e,r);if(s||Ie(r))return{error:s,name:r};const o=r.split(".");for(;o.length;){const a=o.join("."),l=k(t,a),i=k(e,a);if(l&&!Array.isArray(l)&&r!==a)return{name:r};if(i&&i.type)return{name:a,error:i};if(i&&i.root&&i.root.type)return{name:`${a}.root`,error:i.root};o.pop()}return{name:r}}var cn=(e,t,r,s)=>{r(e);const{name:o,...a}=e;return q(a)||Object.keys(a).length>=Object.keys(t).length||Object.keys(a).find(l=>t[l]===(!s||Z.all))},un=(e,t,r)=>!e||!t||e===t||we(e).some(s=>s&&(r?s===t:s.startsWith(t)||t.startsWith(s))),dn=(e,t,r,s,o)=>o.isOnAll?!1:!r&&o.isOnTouch?!(t||e):(r?s.isOnBlur:o.isOnBlur)?!e:(r?s.isOnChange:o.isOnChange)?e:!0,fn=(e,t)=>!Ue(k(e,t)).length&&O(e,t),hn=(e,t,r)=>{const s=we(k(e,r));return N(s,"root",t[r]),N(e,r,s),e};function wt(e,t,r="validate"){if(G(e)||Array.isArray(e)&&e.every(G)||X(e)&&!e)return{type:r,message:G(e)?e:"",ref:t}}var de=e=>B(e)&&!Ee(e)?e:{value:e,message:""},kt=async(e,t,r,s,o,a)=>{const{ref:l,refs:i,required:f,maxLength:p,minLength:C,min:v,max:h,pattern:b,validate:y,name:E,valueAsNumber:V,mount:x}=e._f,_=k(r,E);if(!x||t.has(E))return{};const I=i?i[0]:l,D=F=>{o&&I.reportValidity&&(I.setCustomValidity(X(F)?"":F||""),I.reportValidity())},L={},ae=Ke(l),ue=Ce(l),Q=ae||ue,re=(V||He(l))&&R(l.value)&&R(_)||Ve(l)&&l.value===""||_===""||Array.isArray(_)&&!_.length,P=Bt.bind(null,E,s,L),Se=(F,A,z,$=te.maxLength,W=te.minLength)=>{const K=F?A:z;L[E]={type:F?$:W,message:K,ref:l,...P(F?$:W,K)}};if(a?!Array.isArray(_)||!_.length:f&&(!Q&&(re||H(_))||X(_)&&!_||ue&&!$t(i).isValid||ae&&!qt(i).isValid)){const{value:F,message:A}=G(f)?{value:!!f,message:f}:de(f);if(F&&(L[E]={type:te.required,message:A,ref:I,...P(te.required,A)},!s))return D(A),L}if(!re&&(!H(v)||!H(h))){let F,A;const z=de(h),$=de(v);if(!H(_)&&!isNaN(_)){const W=l.valueAsNumber||_&&+_;H(z.value)||(F=W>z.value),H($.value)||(A=W<$.value)}else{const W=l.valueAsDate||new Date(_),K=be=>new Date(new Date().toDateString()+" "+be),ge=l.type=="time",me=l.type=="week";G(z.value)&&_&&(F=ge?K(_)>K(z.value):me?_>z.value:W>new Date(z.value)),G($.value)&&_&&(A=ge?K(_)<K($.value):me?_<$.value:W<new Date($.value))}if((F||A)&&(Se(!!F,z.message,$.message,te.max,te.min),!s))return D(L[E].message),L}if((p||C)&&!re&&(G(_)||a&&Array.isArray(_))){const F=de(p),A=de(C),z=!H(F.value)&&_.length>+F.value,$=!H(A.value)&&_.length<+A.value;if((z||$)&&(Se(z,F.message,A.message),!s))return D(L[E].message),L}if(b&&!re&&G(_)){const{value:F,message:A}=de(b);if(Ee(F)&&!_.match(F)&&(L[E]={type:te.pattern,message:A,ref:l,...P(te.pattern,A)},!s))return D(A),L}if(y){if(J(y)){const F=await y(_,r),A=wt(F,I);if(A&&(L[E]={...A,...P(te.validate,A.message)},!s))return D(A.message),L}else if(B(y)){let F={};for(const A in y){if(!q(F)&&!s)break;const z=wt(await y[A](_,r),I,A);z&&(F={...z,...P(A,z.message)},D(z.message),s&&(L[E]=F))}if(!q(F)&&(L[E]={ref:I,...F},!s))return L}}return D(!0),L};const pn={mode:Z.onSubmit,reValidateMode:Z.onChange,shouldFocusError:!0};function gn(e={}){let t={...pn,...e},r={submitCount:0,isDirty:!1,isReady:!1,isLoading:J(t.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:t.errors||{},disabled:t.disabled||!1},s={},o=B(t.defaultValues)||B(t.values)?j(t.defaultValues||t.values)||{}:{},a=t.shouldUnregister?{}:j(o),l={action:!1,mount:!1,watch:!1,keepIsValid:!1},i={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set},f,p=0;const C={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},v={...C};let h={...v};const b={array:ft(),state:ft()},y=t.criteriaMode===Z.all,E=c=>u=>{clearTimeout(p),p=setTimeout(c,u)},V=async c=>{if(!l.keepIsValid&&!t.disabled&&(v.isValid||h.isValid||c)){let u;t.resolver?(u=q((await Q()).errors),x()):u=await P(s,!0),u!==r.isValid&&b.state.next({isValid:u})}},x=(c,u)=>{!t.disabled&&(v.isValidating||v.validatingFields||h.isValidating||h.validatingFields)&&((c||Array.from(i.mount)).forEach(d=>{d&&(u?N(r.validatingFields,d,u):O(r.validatingFields,d))}),b.state.next({validatingFields:r.validatingFields,isValidating:!q(r.validatingFields)}))},_=(c,u=[],d,w,m=!0,g=!0)=>{if(w&&d&&!t.disabled){if(l.action=!0,g&&Array.isArray(k(s,c))){const S=d(k(s,c),w.argA,w.argB);m&&N(s,c,S)}if(g&&Array.isArray(k(r.errors,c))){const S=d(k(r.errors,c),w.argA,w.argB);m&&N(r.errors,c,S),fn(r.errors,c)}if((v.touchedFields||h.touchedFields)&&g&&Array.isArray(k(r.touchedFields,c))){const S=d(k(r.touchedFields,c),w.argA,w.argB);m&&N(r.touchedFields,c,S)}(v.dirtyFields||h.dirtyFields)&&(r.dirtyFields=he(o,a)),b.state.next({name:c,isDirty:F(c,u),dirtyFields:r.dirtyFields,errors:r.errors,isValid:r.isValid})}else N(a,c,u)},I=(c,u)=>{N(r.errors,c,u),b.state.next({errors:r.errors})},D=c=>{r.errors=c,b.state.next({errors:r.errors,isValid:!1})},L=(c,u,d,w)=>{const m=k(s,c);if(m){const g=k(a,c,R(d)?k(o,c):d);R(g)||w&&w.defaultChecked||u?N(a,c,u?g:mt(m._f)):$(c,g),l.mount&&!l.action&&V()}},ae=(c,u,d,w,m)=>{let g=!1,S=!1;const M={name:c};if(!t.disabled){if(!d||w){(v.isDirty||h.isDirty)&&(S=r.isDirty,r.isDirty=M.isDirty=F(),g=S!==M.isDirty);const T=se(k(o,c),u);S=!!k(r.dirtyFields,c),T?O(r.dirtyFields,c):N(r.dirtyFields,c,!0),M.dirtyFields=r.dirtyFields,g=g||(v.dirtyFields||h.dirtyFields)&&S!==!T}if(d){const T=k(r.touchedFields,c);T||(N(r.touchedFields,c,d),M.touchedFields=r.touchedFields,g=g||(v.touchedFields||h.touchedFields)&&T!==d)}g&&m&&b.state.next(M)}return g?M:{}},ue=(c,u,d,w)=>{const m=k(r.errors,c),g=(v.isValid||h.isValid)&&X(u)&&r.isValid!==u;if(t.delayError&&d?(f=E(()=>I(c,d)),f(t.delayError)):(clearTimeout(p),f=null,d?N(r.errors,c,d):O(r.errors,c)),(d?!se(m,d):m)||!q(w)||g){const S={...w,...g&&X(u)?{isValid:u}:{},errors:r.errors,name:c};r={...r,...S},b.state.next(S)}},Q=async c=>(x(c,!0),await t.resolver(a,t.context,an(c||i.mount,s,t.criteriaMode,t.shouldUseNativeValidation))),re=async c=>{const{errors:u}=await Q(c);if(x(c),c)for(const d of c){const w=k(u,d);w?N(r.errors,d,w):O(r.errors,d)}else r.errors=u;return u},P=async(c,u,d={valid:!0})=>{for(const w in c){const m=c[w];if(m){const{_f:g,...S}=m;if(g){const M=i.array.has(g.name),T=m._f&&on(m._f);T&&v.validatingFields&&x([g.name],!0);const U=await kt(m,i.disabled,a,y,t.shouldUseNativeValidation&&!u,M);if(T&&v.validatingFields&&x([g.name]),U[g.name]&&(d.valid=!1,u||e.shouldUseNativeValidation))break;!u&&(k(U,g.name)?M?hn(r.errors,U,g.name):N(r.errors,g.name,U[g.name]):O(r.errors,g.name))}!q(S)&&await P(S,u,d)}}return d.valid},Se=()=>{for(const c of i.unMount){const u=k(s,c);u&&(u._f.refs?u._f.refs.every(d=>!Oe(d)):!Oe(u._f.ref))&&Me(c)}i.unMount=new Set},F=(c,u)=>!t.disabled&&(c&&u&&N(a,c,u),!se(Ge(),o)),A=(c,u,d)=>Qr(c,i,{...l.mount?a:R(u)?o:G(c)?{[c]:u}:u},d,u),z=c=>Ue(k(l.mount?a:o,c,t.shouldUnregister?k(o,c,[]):[])),$=(c,u,d={})=>{const w=k(s,c);let m=u;if(w){const g=w._f;g&&(!g.disabled&&N(a,c,Ut(u,g)),m=Ve(g.ref)&&H(u)?"":u,jt(g.ref)?[...g.ref.options].forEach(S=>S.selected=m.includes(S.value)):g.refs?Ce(g.ref)?g.refs.forEach(S=>{(!S.defaultChecked||!S.disabled)&&(Array.isArray(m)?S.checked=!!m.find(M=>M===S.value):S.checked=m===S.value||!!m)}):g.refs.forEach(S=>S.checked=S.value===m):He(g.ref)?g.ref.value="":(g.ref.value=m,g.ref.type||b.state.next({name:c,values:j(a)})))}(d.shouldDirty||d.shouldTouch)&&ae(c,m,d.shouldTouch,d.shouldDirty,!0),d.shouldValidate&&be(c)},W=(c,u,d)=>{for(const w in u){if(!u.hasOwnProperty(w))return;const m=u[w],g=c+"."+w,S=k(s,g);(i.array.has(c)||B(m)||S&&!S._f)&&!oe(m)?W(g,m,d):$(g,m,d)}},K=(c,u,d={})=>{const w=k(s,c),m=i.array.has(c),g=j(u);N(a,c,g),m?(b.array.next({name:c,values:j(a)}),(v.isDirty||v.dirtyFields||h.isDirty||h.dirtyFields)&&d.shouldDirty&&b.state.next({name:c,dirtyFields:he(o,a),isDirty:F(c,g)})):w&&!w._f&&!H(g)?W(c,g,d):$(c,g,d),vt(c,i)?b.state.next({...r,name:c,values:j(a)}):b.state.next({name:l.mount?c:void 0,values:j(a)})},ge=async c=>{l.mount=!0;const u=c.target;let d=u.name,w=!0;const m=k(s,d),g=T=>{w=Number.isNaN(T)||oe(T)&&isNaN(T.getTime())||se(T,k(a,d,T))},S=bt(t.mode),M=bt(t.reValidateMode);if(m){let T,U;const ie=u.type?mt(m._f):Kr(c),ne=c.type===dt.BLUR||c.type===dt.FOCUS_OUT,Qt=!ln(m._f)&&!t.resolver&&!k(r.errors,d)&&!m._f.deps||dn(ne,k(r.touchedFields,d),r.isSubmitted,M,S),De=vt(d,i,ne);N(a,d,ie),ne?(!u||!u.readOnly)&&(m._f.onBlur&&m._f.onBlur(c),f&&f(0)):m._f.onChange&&m._f.onChange(c);const Re=ae(d,ie,ne),er=!q(Re)||De;if(!ne&&b.state.next({name:d,type:c.type,values:j(a)}),Qt)return(v.isValid||h.isValid)&&(t.mode==="onBlur"?ne&&V():ne||V()),er&&b.state.next({name:d,...De?{}:Re});if(!ne&&De&&b.state.next({...r}),t.resolver){const{errors:rt}=await Q([d]);if(x([d]),g(ie),w){const tr=xt(r.errors,s,d),nt=xt(rt,s,tr.name||d);T=nt.error,d=nt.name,U=q(rt)}}else x([d],!0),T=(await kt(m,i.disabled,a,y,t.shouldUseNativeValidation))[d],x([d]),g(ie),w&&(T?U=!1:(v.isValid||h.isValid)&&(U=await P(s,!0)));w&&(m._f.deps&&(!Array.isArray(m._f.deps)||m._f.deps.length>0)&&be(m._f.deps),ue(d,U,T,Re))}},me=(c,u)=>{if(k(r.errors,u)&&c.focus)return c.focus(),1},be=async(c,u={})=>{let d,w;const m=we(c);if(t.resolver){const g=await re(R(c)?c:m);d=q(g),w=c?!m.some(S=>k(g,S)):d}else c?(w=(await Promise.all(m.map(async g=>{const S=k(s,g);return await P(S&&S._f?{[g]:S}:S)}))).every(Boolean),!(!w&&!r.isValid)&&V()):w=d=await P(s);return b.state.next({...!G(c)||(v.isValid||h.isValid)&&d!==r.isValid?{}:{name:c},...t.resolver||!c?{isValid:d}:{},errors:r.errors}),u.shouldFocus&&!w&&ke(s,me,c?m:i.mount),w},Ge=(c,u)=>{let d={...l.mount?a:o};return u&&(d=zt(u.dirtyFields?r.dirtyFields:r.touchedFields,d)),R(c)?d:G(c)?k(d,c):c.map(w=>k(d,w))},We=(c,u)=>({invalid:!!k((u||r).errors,c),isDirty:!!k((u||r).dirtyFields,c),error:k((u||r).errors,c),isValidating:!!k(r.validatingFields,c),isTouched:!!k((u||r).touchedFields,c)}),Kt=c=>{const u=c?we(c):void 0;u==null||u.forEach(d=>O(r.errors,d)),u?u.forEach(d=>{b.state.next({name:d,errors:r.errors})}):b.state.next({errors:{}})},Je=(c,u,d)=>{const w=(k(s,c,{_f:{}})._f||{}).ref,m=k(r.errors,c)||{},{ref:g,message:S,type:M,...T}=m;N(r.errors,c,{...T,...u,ref:w}),b.state.next({name:c,errors:r.errors,isValid:!1}),d&&d.shouldFocus&&w&&w.focus&&w.focus()},Gt=(c,u)=>J(c)?b.state.subscribe({next:d=>"values"in d&&c(A(void 0,u),d)}):A(c,u,!0),Ze=c=>b.state.subscribe({next:u=>{un(c.name,u.name,c.exact)&&cn(u,c.formState||v,Yt,c.reRenderRoot)&&c.callback({values:{...a},...r,...u,defaultValues:o})}}).unsubscribe,Wt=c=>(l.mount=!0,h={...h,...c.formState},Ze({...c,formState:{...C,...c.formState}})),Me=(c,u={})=>{for(const d of c?we(c):i.mount)i.mount.delete(d),i.array.delete(d),u.keepValue||(O(s,d),O(a,d)),!u.keepError&&O(r.errors,d),!u.keepDirty&&O(r.dirtyFields,d),!u.keepTouched&&O(r.touchedFields,d),!u.keepIsValidating&&O(r.validatingFields,d),!t.shouldUnregister&&!u.keepDefaultValue&&O(o,d);b.state.next({values:j(a)}),b.state.next({...r,...u.keepDirty?{isDirty:F()}:{}}),!u.keepIsValid&&V()},Xe=({disabled:c,name:u})=>{if(X(c)&&l.mount||c||i.disabled.has(u)){const m=i.disabled.has(u)!==!!c;c?i.disabled.add(u):i.disabled.delete(u),m&&l.mount&&!l.action&&V()}},Te=(c,u={})=>{let d=k(s,c);const w=X(u.disabled)||X(t.disabled);return N(s,c,{...d||{},_f:{...d&&d._f?d._f:{ref:{name:c}},name:c,mount:!0,...u}}),i.mount.add(c),d?Xe({disabled:X(u.disabled)?u.disabled:t.disabled,name:c}):L(c,!0,u.value),{...w?{disabled:u.disabled||t.disabled}:{},...t.progressive?{required:!!u.required,min:ye(u.min),max:ye(u.max),minLength:ye(u.minLength),maxLength:ye(u.maxLength),pattern:ye(u.pattern)}:{},name:c,onChange:ge,onBlur:ge,ref:m=>{if(m){Te(c,u),d=k(s,c);const g=R(m.value)&&m.querySelectorAll&&m.querySelectorAll("input,select,textarea")[0]||m,S=tn(g),M=d._f.refs||[];if(S?M.find(T=>T===g):g===d._f.ref)return;N(s,c,{_f:{...d._f,...S?{refs:[...M.filter(Oe),g,...Array.isArray(k(o,c))?[{}]:[]],ref:{type:g.type,name:c}}:{ref:g}}}),L(c,!1,void 0,g)}else d=k(s,c,{}),d._f&&(d._f.mount=!1),(t.shouldUnregister||u.shouldUnregister)&&!(Wr(i.array,c)&&l.action)&&i.unMount.add(c)}}},Ne=()=>t.shouldFocusError&&ke(s,me,i.mount),Jt=c=>{X(c)&&(b.state.next({disabled:c}),ke(s,(u,d)=>{const w=k(s,d);w&&(u.disabled=w._f.disabled||c,Array.isArray(w._f.refs)&&w._f.refs.forEach(m=>{m.disabled=w._f.disabled||c}))},0,!1))},Ye=(c,u)=>async d=>{let w;d&&(d.preventDefault&&d.preventDefault(),d.persist&&d.persist());let m=j(a);if(b.state.next({isSubmitting:!0}),t.resolver){const{errors:g,values:S}=await Q();x(),r.errors=g,m=j(S)}else await P(s);if(i.disabled.size)for(const g of i.disabled)O(m,g);if(O(r.errors,"root"),q(r.errors)){b.state.next({errors:{}});try{await c(m,d)}catch(g){w=g}}else u&&await u({...r.errors},d),Ne(),setTimeout(Ne);if(b.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:q(r.errors)&&!w,submitCount:r.submitCount+1,errors:r.errors}),w)throw w},Zt=(c,u={})=>{k(s,c)&&(R(u.defaultValue)?K(c,j(k(o,c))):(K(c,u.defaultValue),N(o,c,j(u.defaultValue))),u.keepTouched||O(r.touchedFields,c),u.keepDirty||(O(r.dirtyFields,c),r.isDirty=u.defaultValue?F(c,j(k(o,c))):F()),u.keepError||(O(r.errors,c),v.isValid&&V()),b.state.next({...r}))},Qe=(c,u={})=>{const d=c?j(c):o,w=j(d),m=q(c),g=m?o:w;if(u.keepDefaultValues||(o=d),!u.keepValues){if(u.keepDirtyValues){const S=new Set([...i.mount,...Object.keys(he(o,a))]);for(const M of Array.from(S)){const T=k(r.dirtyFields,M),U=k(a,M),ie=k(g,M);T&&!R(U)?N(g,M,U):!T&&!R(ie)&&K(M,ie)}}else{if($e&&R(c))for(const S of i.mount){const M=k(s,S);if(M&&M._f){const T=Array.isArray(M._f.refs)?M._f.refs[0]:M._f.ref;if(Ve(T)){const U=T.closest("form");if(U){U.reset();break}}}}if(u.keepFieldsRef)for(const S of i.mount)K(S,k(g,S));else s={}}a=t.shouldUnregister?u.keepDefaultValues?j(o):{}:j(g),b.array.next({values:{...g}}),b.state.next({values:{...g}})}i={mount:u.keepDirtyValues?i.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},l.mount=!v.isValid||!!u.keepIsValid||!!u.keepDirtyValues||!t.shouldUnregister&&!q(g),l.watch=!!t.shouldUnregister,l.keepIsValid=!!u.keepIsValid,l.action=!1,u.keepErrors||(r.errors={}),b.state.next({submitCount:u.keepSubmitCount?r.submitCount:0,isDirty:m?!1:u.keepDirty?r.isDirty:!!(u.keepDefaultValues&&!se(c,o)),isSubmitted:u.keepIsSubmitted?r.isSubmitted:!1,dirtyFields:m?{}:u.keepDirtyValues?u.keepDefaultValues&&a?he(o,a):r.dirtyFields:u.keepDefaultValues&&c?he(o,c):u.keepDirty?r.dirtyFields:{},touchedFields:u.keepTouched?r.touchedFields:{},errors:u.keepErrors?r.errors:{},isSubmitSuccessful:u.keepIsSubmitSuccessful?r.isSubmitSuccessful:!1,isSubmitting:!1,defaultValues:o})},et=(c,u)=>Qe(J(c)?c(a):c,{...t.resetOptions,...u}),Xt=(c,u={})=>{const d=k(s,c),w=d&&d._f;if(w){const m=w.refs?w.refs[0]:w.ref;m.focus&&setTimeout(()=>{m.focus(),u.shouldSelect&&J(m.select)&&m.select()})}},Yt=c=>{r={...r,...c}},tt={control:{register:Te,unregister:Me,getFieldState:We,handleSubmit:Ye,setError:Je,_subscribe:Ze,_runSchema:Q,_updateIsValidating:x,_focusError:Ne,_getWatch:A,_getDirty:F,_setValid:V,_setFieldArray:_,_setDisabledField:Xe,_setErrors:D,_getFieldArray:z,_reset:Qe,_resetDefaultValues:()=>J(t.defaultValues)&&t.defaultValues().then(c=>{et(c,t.resetOptions),b.state.next({isLoading:!1})}),_removeUnmounted:Se,_disableForm:Jt,_subjects:b,_proxyFormState:v,get _fields(){return s},get _formValues(){return a},get _state(){return l},set _state(c){l=c},get _defaultValues(){return o},get _names(){return i},set _names(c){i=c},get _formState(){return r},get _options(){return t},set _options(c){t={...t,...c}}},subscribe:Wt,trigger:be,register:Te,handleSubmit:Ye,watch:Gt,setValue:K,getValues:Ge,reset:et,resetField:Zt,clearErrors:Kt,unregister:Me,setError:Je,setFocus:Xt,getFieldState:We};return{...tt,formControl:tt}}function Le(e={}){const t=n.Cn.useRef(void 0),r=n.Cn.useRef(void 0),[s,o]=n.Cn.useState({isDirty:!1,isValidating:!1,isLoading:J(e.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1,isReady:!1,defaultValues:J(e.defaultValues)?void 0:e.defaultValues});if(!t.current)if(e.formControl)t.current={...e.formControl,formState:s},e.defaultValues&&!J(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{const{formControl:l,...i}=gn(e);t.current={...i,formState:s}}const a=t.current.control;return a._options=e,Yr(()=>{const l=a._subscribe({formState:a._proxyFormState,callback:()=>o({...a._formState}),reRenderRoot:!0});return o(i=>({...i,isReady:!0})),a._formState.isReady=!0,l},[a]),n.Cn.useEffect(()=>a._disableForm(e.disabled),[a,e.disabled]),n.Cn.useEffect(()=>{e.mode&&(a._options.mode=e.mode),e.reValidateMode&&(a._options.reValidateMode=e.reValidateMode)},[a,e.mode,e.reValidateMode]),n.Cn.useEffect(()=>{e.errors&&(a._setErrors(e.errors),a._focusError())},[a,e.errors]),n.Cn.useEffect(()=>{e.shouldUnregister&&a._subjects.state.next({values:a._getWatch()})},[a,e.shouldUnregister]),n.Cn.useEffect(()=>{if(a._proxyFormState.isDirty){const l=a._getDirty();l!==s.isDirty&&a._subjects.state.next({isDirty:l})}},[a,s.isDirty]),n.Cn.useEffect(()=>{var l;e.values&&!se(e.values,r.current)?(a._reset(e.values,{keepFieldsRef:!0,...a._options.resetOptions}),!((l=a._options.resetOptions)===null||l===void 0)&&l.keepIsValid||a._setValid(),r.current=e.values,o(i=>({...i}))):a._resetDefaultValues()},[a,e.values]),n.Cn.useEffect(()=>{a._state.mount||(a._setValid(),a._state.mount=!0),a._state.watch&&(a._state.watch=!1,a._subjects.state.next({...a._formState})),a._removeUnmounted()}),t.current.formState=n.Cn.useMemo(()=>Xr(s,a),[a,s]),t.current}const _t=(e,t,r)=>{if(e&&"reportValidity"in e){const s=k(r,t);e.setCustomValidity(s&&s.message||""),e.reportValidity()}},mn=(e,t)=>{for(const r in t.fields){const s=t.fields[r];s&&s.ref&&"reportValidity"in s.ref?_t(s.ref,r,e):s.refs&&s.refs.forEach(o=>_t(o,r,e))}},bn=(e,t)=>{t.shouldUseNativeValidation&&mn(e,t);const r={};for(const s in e){const o=k(t.fields,s),a=Object.assign(e[s]||{},{ref:o&&o.ref});if(yn(t.names||Object.keys(e),s)){const l=Object.assign({},k(r,s));N(l,"root",a),N(r,s,l)}else N(r,s,a)}return r},yn=(e,t)=>e.some(r=>r.startsWith(t+"."));var Ae=function(e,t,r){return r===void 0&&(r={}),function(s,o,a){try{var l=!a.shouldUseNativeValidation&&a.criteriaMode==="all";return Promise.resolve(n.safeParseAsync(e,s,Object.assign({},t,{abortPipeEarly:!l}))).then(function(i){if(i.issues){for(var f={};i.issues.length;){var p=i.issues[0],C=n.getDotPath(p);if(C&&(f[C]||(f[C]={message:p.message,type:p.type}),l)){var v=f[C].types,h=v&&v[p.type];f[C]=Bt(C,l,f,p.type,h?[].concat(h,p.message):p.message)}i.issues.shift()}return{values:{},errors:bn(f,a)}}return{values:r.raw?s:i.output,errors:{}}})}catch(i){return Promise.reject(i)}}};const Ct=27,St=12,Vt=10,vn=n.isSubmissionOfType("enum"),xn=(e,t)=>{const r={min:e.minSelected??0,max:e.maxSelected??e.options.length};return Ae(n.object({checked:n.pipe(n.record(n.string(),n.boolean()),n.transform(s=>Object.entries(s).filter(([o,a])=>a).map(([o,a])=>o)),n.maxLength(r.max,t("validation_multiple_choice_max",{count:r.max})),n.minLength(r.min,t("validation_multiple_choice_min",{count:r.min})))}))},wn=n.k$1(({option:e,...t},r)=>n.o(n.k,{children:[n.o("input",{class:"peer sr-only h-full",type:"checkbox",...t,ref:r}),n.o("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})]})),Et=n.cva("gutter-stable flex w-full flex-1 flex-wrap gap-2 overflow-y-auto rounded-xl p-2.5 pr-4",{variants:{variant:{singleOption:"justify-center",booleanLike:Tt}}}),kn=({input:e,onSubmitSuccess:t})=>{var C,v;const r=e.key?(C=n.store.current$.value.flow)==null?void 0:C.data.submissions[e.key]:void 0,s=(e.config.minSelected===1||e.config.minSelected===void 0)&&e.config.maxSelected===1,o=s&&e.config.options.length===2,{t:a}=n.useTranslation(),{register:l,handleSubmit:i,formState:{errors:f}}=Le({defaultValues:{checked:s?{}:vn(r)?Object.fromEntries(r.value.map(h=>[h,!0])):{}},resolver:xn(e.config,a)}),p=Pe();return o?n.o("ul",{style:{maxHeight:6.5*Ct+5*St+2*Vt},class:Et({variant:"booleanLike"}),children:e.config.options.map((h,b)=>n.o("li",{class:Nt,children:n.o(Dt,{type:"submit",ref:y=>{y&&b===0&&(p.current=y)},label:h.label,value:"true",onClick:()=>t({type:"enum",value:[h.value]})})},h.value))}):n.o("form",{noValidate:!0,onSubmit:h=>i(b=>{const y=b.checked;t({type:"enum",value:y})})(h),children:[n.o("div",{class:"flex items-center gap-1",children:[n.o("ul",{style:{maxHeight:6.5*Ct+5*St+2*Vt},class:Et({variant:e.config.options.length===1?"singleOption":void 0}),children:e.config.options.map((h,b)=>{const y=`checked.${h.value}`,{ref:E,...V}=l(y);return n.o("li",{class:"relative",children:n.o(wn,{option:h,autoFocus:b===0,ref:x=>{x&&b===0&&(p.current=x),E(x)},id:y,...V,onClick:s?()=>t({type:"enum",value:[h.value]}):void 0})},h.value)})}),n.o("div",{class:"flex flex-col items-center gap-2 pr-2.5 pt-2.5",children:[s?null:n.o(le,{}),e.config.minSelected===0&&n.o(ce,{class:"relative",type:"button",onClick:()=>t({type:"enum",value:[]})})]})]}),n.o("div",{class:"px-1",children:n.o(pe,{error:(v=f.checked)==null?void 0:v.root})})]})},_n=n.isSubmissionOfType("number"),Cn=(e,t)=>{const r=e.min??Number.MIN_SAFE_INTEGER,s=e.max??Number.MAX_SAFE_INTEGER,o=e.decimalCases??0;return Ae(n.object({number:n.pipe(n.number(t("validation_number")),n.minValue(r,t("validation_number_min",{min:r})),n.maxValue(s,t("validation_number_max",{max:s})),n.check(a=>a===Number(a.toFixed(o)),t("validation_number_decimal_cases",{count:o})))}))},Sn=({input:e,onSubmitSuccess:t})=>{var v;const r=e.config.defaultValue,s=e.key?(v=n.store.current$.value.flow)==null?void 0:v.data.submissions[e.key]:void 0,{t:o}=n.useTranslation(),{register:a,handleSubmit:l,formState:{errors:i}}=Le({defaultValues:{number:r?Number(r):_n(s)?s.value:void 0},resolver:Cn(e.config,o)}),{ref:f,...p}=a("number",{required:!e.config.optional,valueAsNumber:!0}),C=n._();return n.y(()=>{C.current&&(C.current.focus(),C.current.select())},[]),n.o("form",{class:"flex flex-col gap-1 p-2.5",onSubmit:l(h=>{h.number!==void 0&&t({type:"number",value:h.number})}),children:[n.o("div",{class:"flex items-center gap-2",children:[n.o("div",{class:"relative min-w-0 flex-grow",children:[n.o("input",{...p,id:"chat-input",autocomplete:"off",autoCapitalize:"off",autoCorrect:"off",autoFocus:!0,ref:h=>{h&&(C.current=h),f(h)},type:"text",min:e.config.min,max:e.config.max,class:_e({optional:e.config.optional,className:"[type=number:-webkit-inner-spin-button] w-full rounded-full [-webkit-outer-spin-button:none]"}),placeholder:e.config.placeholder}),e.config.optional&&n.o(ce,{class:"absolute bottom-0 right-0.5 top-0",onClick:()=>t(null)})]}),n.o(le,{})]}),n.o(pe,{error:i.number})]})},Vn=e=>{if(e==="")return{countryCode:"",phoneNumber:""};const t=Object.entries(je).find(o=>e.startsWith(o[1])),r=t?t[1]:"",s=e.replace(r,"");return/^\d+$/.test(s)?{countryCode:r,phoneNumber:s}:{countryCode:"",phoneNumber:""}},En="44",Fn=/^[0-9 ]+$/,In=n.isSubmissionOfType("string"),Ln=n.isSubmissionOfType("phone"),An=e=>{const t=n.pipe(n.string(e("validation_country_code")),n.regex(Fn,e("validation_country_code"))),r=n.pipe(n.string(e("validation_phone")),n.minLength(1,e("validation_phone")),n.transform(s=>s.replace(/[^0-9]/g,"")));return Ae(n.object({countryCode:t,phoneNumber:r}))},Mn=({input:e,onSubmitSuccess:t})=>{var E;const r=e.key?(E=n.store.current$.value.flow)==null?void 0:E.data.submissions[e.key]:void 0,{t:s}=n.useTranslation(),[o,a]=n.h(),l=In(r)?Vn(r.value):Ln(r)?r.value:void 0,{register:i,handleSubmit:f,formState:{errors:p},watch:C}=Le({defaultValues:{countryCode:(l==null?void 0:l.countryCode)??e.config.defaultValue.countryCode??En,phoneNumber:(l==null?void 0:l.phoneNumber)??e.config.defaultValue.phoneNumber??""},resolver:An(s)}),{ref:v,...h}=i("phoneNumber",{required:!e.config.optional}),b=n._(),y=C("countryCode");return n.y(()=>{b.current&&(b.current.focus(),b.current.select())},[]),n.o("form",{noValidate:!0,class:"flex flex-col gap-1 p-2.5",onSubmit:f(V=>{const x=V.phoneNumber.replace(/[^0-9]/g,""),_=V.countryCode.replace(/[^0-9]/g,"");a(void 0);const I=e.config.minChars??7,D=x.length+_.length;if(D<I)return a(s("validation_phone_min_chars",{count:I}));const L=e.config.maxChars;if(L!=null&&D>L)return a(s("validation_max_chars",{count:L}));e.config.submissionFormat==="phone"?t({type:"phone",value:{countryCode:_,phoneNumber:x}}):t({type:"string",value:y+V.phoneNumber})}),children:[n.o("div",{class:"flex items-center gap-2",children:[n.o("div",{class:"relative flex min-w-0 flex-1 flex-grow gap-2",children:[n.o("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:[n.o("span",{children:["+",y]}),n.o("select",{...i("countryCode",{}),id:`isdk_phone_${e.key}`,class:"absolute inset-0 opacity-0",children:Object.entries(je).map(([V,x])=>n.o("option",{value:x,children:[V," (+",x,")"]},V))})]}),n.o("input",{...h,id:"chat-input",type:"tel",inputMode:"tel",autocomplete:"off",autoCapitalize:"off",autoCorrect:"off",autoFocus:!0,ref:V=>{V&&(b.current=V),v(V)},class:_e({optional:e.config.optional,className:"min-w-0 flex-1 rounded-r-full"}),placeholder:e.config.placeholder}),e.config.optional&&n.o(ce,{class:"absolute bottom-0 right-1 top-0",onClick:()=>t(null)})]}),n.o(le,{})]}),n.o(pe,{error:p.countryCode||p.phoneNumber||{message:o}})]})},Tn=({input:e,onSubmitSuccess:t})=>n.o("div",{class:"flex flex-col items-center py-3",children:n.o("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:n.o("span",{class:"flex items-center gap-1.5",children:[n.o("span",{class:"inline-flex items-center text-sm font-medium",children:e.config.label||"Submit"}),n.o("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:[n.o("path",{d:"M4 8L8 4L12 8"}),n.o("path",{d:"M8 4V13"})]})]})})}),Nn={date:{type:"date",inputMode:"text"},email:{type:"email",inputMode:"email",formNoValidate:!0},text:{type:"text",inputMode:"text"},url:{type:"url",inputMode:"url",formNoValidate:!0}},Dn=n.isSubmissionOfType("string"),Rn=(e,t)=>{const r={maxLength:t("validation_max_chars",{count:e.maxChars??999}),minLength:t("validation_min_chars",{count:e.minChars??1})};return Ae(n.object({text:{date:n.pipe(n.string(t("validation_date")),n.regex(/^\d{4}-\d{2}-\d{2}$/,t("validation_date"))),email:n.pipe(n.string(t("validation_email")),n.email(t("validation_email")),n.minLength(e.minChars??1,r.minLength),n.maxLength(e.maxChars??1/0,r.maxLength)),text:n.pipe(n.string(),n.minLength(e.minChars??1,r.minLength),n.maxLength(e.maxChars??1/0,r.maxLength)),url:n.pipe(n.string(t("validation_url")),n.url(t("validation_url")),n.minLength(e.minChars??1,r.minLength),n.maxLength(e.maxChars??1/0,r.maxLength))}[e.format]}))},On=({input:e,onSubmitSuccess:t})=>{var v;const{t:r}=n.useTranslation(),s=e.key?(v=n.store.current$.value.flow)==null?void 0:v.data.submissions[e.key]:void 0,o=e.config.defaultValue,{register:a,handleSubmit:l,formState:{errors:i}}=Le({defaultValues:{text:o||(Dn(s)?s.value:"")},resolver:Rn(e.config,r)}),{ref:f,...p}=a("text",{required:!e.config.optional}),C=n._();return n.y(()=>{C.current&&(C.current.focus(),C.current.select())},[]),n.o("form",{noValidate:!0,class:"flex flex-col gap-1 p-2.5",onSubmit:l(h=>{t({type:"string",value:h.text})}),children:[n.o("div",{class:"flex items-center gap-2",children:[n.o("div",{class:"relative min-w-0 flex-1",children:[n.o("input",{id:"chat-input",...p,...Nn[e.config.format],autocomplete:"off",autoCapitalize:"off",autoCorrect:"off",autoFocus:!0,ref:h=>{h&&(C.current=h),f(h)},placeholder:e.config.placeholder,class:_e({optional:!!e.config.optional,className:"w-full rounded-full"})}),e.config.optional&&n.o(ce,{class:"absolute bottom-0 right-0.5 top-0",onClick:()=>t(null)})]}),n.o(le,{})]}),n.o(pe,{error:i.text})]})},Bn={text:On,phone:Mn,"multiple-choice":kn,boolean:Br,file:Hr,submit:Tn,address:Nr,number:Sn},zn=({logger:e})=>{var a;const t=(a=n.store.current$.value.flow)==null?void 0:a.data.currentInput,[r,s]=Cr(),o=n._(null);return n.store.inputHeight$.value=s.height,n.p(()=>{const l=o.current;if(l)return l.addEventListener("transitionstart",n.chatStore.scrollToEnd.smooth),l.addEventListener("transitioncancel",n.chatStore.scrollToEnd.smooth),l.addEventListener("transitionend",n.chatStore.scrollToEnd.smooth),()=>{l.removeEventListener("transitionstart",n.chatStore.scrollToEnd.smooth),l.removeEventListener("transitioncancel",n.chatStore.scrollToEnd.smooth),l.removeEventListener("transitionend",n.chatStore.scrollToEnd.smooth)}},[]),n.o("div",{ref:o,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:s.height},children:n.o("div",{ref:r,class:"border-divider flex flex-col justify-end border-t",children:t?(()=>{const l=Bn[t.type];return n.o(l,{logger:e,onSubmitSuccess:n.chatStore.onSubmitSuccessFn$.value,input:t})})():n.o("div",{class:"flex items-center gap-2 p-2.5",children:[n.o("input",{"aria-hidden":"true",id:"chat-input",class:_e({optional:!1,className:"flex-grow rounded-full"}),disabled:!0}),n.o(le,{disabled:!0,"aria-hidden":"true",tabIndex:-1})]})})})};var jn=function(e){return e instanceof RegExp},Pn=function(t){var r=/[\\^$.*+?()[\]{}|]/g,s=RegExp(r.source);return t&&s.test(t)?t.replace(r,"\\$&"):t},Ht=function(e){return typeof e=="string"},$n=function(e){var t=[];return e.forEach(function(r){Array.isArray(r)?t=t.concat(r):t.push(r)}),t};function Un(e,t,r){var s=0,o=0;if(e==="")return e;if(!e||!Ht(e))throw new TypeError("First argument to react-string-replace#replaceString must be a string");var a=t;jn(a)||(a=new RegExp("("+Pn(a)+")","gi"));for(var l=e.split(a),i=1,f=l.length;i<f;i+=2){if(l[i]===void 0||l[i-1]===void 0){console.warn("reactStringReplace: Encountered undefined value during string replacement. Your RegExp may not be working the way you expect.");continue}o=l[i].length,s+=l[i-1].length,l[i]=r(l[i],i,s),s+=o}return l}var qn=function(t,r,s){return Array.isArray(t)||(t=[t]),$n(t.map(function(o){return Ht(o)?Un(o,r,s):o}))};const ve=n.getDefaultExportFromCjs(qn),Hn=/(\[[^\]]+\]\([^)]+\))/g,Kn=/\[([^\]]+)\]\(([^)]+)\)/,Gn=/(https?:\/\/[^\s]+)/g,Wn=/_(.*?)_/g,Jn=/\*\*(.*?)\*\*/g,Zn=/\\n|\n/g,Ft="text-accent-10 hover:text-accent-11 no-underline underline-offset-2 hover:underline",Xn=e=>{const t=ve(e,Hn,(l,i)=>{const[,f,p]=l.match(Kn)??[];return p?n.o("a",{class:Ft,href:p,children:f??p},p+i):n.o("span",{children:"INVALID LINK"})}),r=ve(t,Gn,(l,i)=>n.o("a",{class:Ft,href:l,children:l},l+i)),s=ve(r,Wn,(l,i)=>n.o("em",{children:l},l+i)),o=ve(s,Jn,(l,i)=>n.o("strong",{children:l},l+i));return ve(o,Zn,(l,i)=>n.o("br",{},`br-${i}`))},Yn=n.cva("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"}}),Qn=({children:e,className:t,animate:r,side:s,...o})=>n.o("p",{style:{transformOrigin:s==="left"?"0% 50%":"100% 50%"},class:Yn({className:t,side:s,animate:r}),...o,children:e}),es=({message:e})=>n.o("div",{class:"bg-accent-3 flex w-full items-center justify-center overflow-hidden rounded-xl px-2 py-2",children:n.o("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,n.o("svg",{class:"flex-none",width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:n.o("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"})})]})}),ts=({className:e,...t})=>(n.p(()=>{n.chatStore.scrollToEnd.smooth()}),n.o("div",{"aria-hidden":!0,children:n.chatStore.isBotTyping$.value===!0?n.o("div",{"aria-label":"Typing…",class:n.clsx("flex gap-1 p-4",e),...t,children:Array.from({length:3},(r,s)=>n.o("div",{class:"bg-accent-9 h-1.5 w-1.5 animate-bounce rounded-full",style:{animationDelay:`${-s*200}ms`}}))}):void 0})),rs={bot:"left",user:"right"},ns=n.cva("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]"}}}),ss=({lastSentMessageFooter:e})=>{var r;const t=((r=n.store.current$.value.flow)==null?void 0:r.data.messages)??[];return n.p(()=>{n.chatStore.scrollToEnd.smooth()},[t.length]),n.o("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((s,o)=>n.o(n.k,{children:n.o("li",{class:"flex",children:n.M(s).with({type:"system"},a=>n.o("p",{class:ns({variant:a.variant}),children:a.text})).with({type:"text",author:n.z.union("bot","user")},a=>{const l=a.author==="user"&&!t.slice(o+1).some(p=>p.type==="text"&&p.author==="user"),i=o===t.length-1,f=a.author==="bot"?Xn(a.text):a.text;return n.o(n.k,{children:[l?e:null,n.o(Qn,{animate:i,side:rs[a.author],children:f},o)]})}).with({type:"link"},a=>n.o(es,{message:a})).with({type:"image"},a=>n.o("img",{class:"shadow-surface-md w-full max-w-[min(100%,24rem)] rounded-2xl",src:a.url,style:{aspectRatio:a.width/a.height}})).with({type:"file"},a=>n.o($r,{class:a.author==="bot"?void 0:"ml-auto",file:{name:a.fileName,sizeKb:a.fileSizeKb}})).with({type:"loading"},a=>{const l=t[t.length-1];return!(a===l)||n.chatStore.isBotTyping$.value?null:n.o("div",{class:"flex flex-grow flex-col items-center justify-center",children:n.o(n.LoadingIndicator,{class:"text-neutral-6 h-8 w-8"})})}).exhaustive()})},o)),n.o(ts,{},"typing")]})},as=({logger:e,apiClient:t,analytics:r,platformClient:s})=>{const{flow:o}=n.store.current$.value;n.invariant(o,"Flow is required to exist to show chatbot body");const a=n.store.viewState$.value,{chatRef:l,chatService:i}=n.useChatService(),{t:f}=n.useTranslation(),[p,C]=n.h();return n.y(()=>{a==="maximised"&&n.chatStore.scrollToEnd.instant()},[a]),n.y(()=>{var x,_;const{state:v,flow:h}=n.store.current$.peek();if(v!=="loaded")throw new Error(f("invalid_state"));let b=h.data.nodeHistory.at(-1);if(n.chatStore.scrollToEnd.instant(),n.store.setInput(void 0),h.data.isFinished)return;b===void 0?(b=n.getHeadOrThrow(o.nodes).id,n.store.setCurrentNodeId(b),r.log({event:"FLOW_START",properties:{flow_id:o.id,flow_version:o.version,flow_session_id:h.data.flowSessionId,flow_build:o.build,job:o.job},customProperties:(x=o.analytics)==null?void 0:x.customProperties})):n.store.removeMessagesSentByNodeIds([b]);const{interpret:y,abort:E,undo:V}=sr({context:o.context,analytics:{service:r,customProperties:(_=o.analytics)==null?void 0:_.customProperties},apiClient:t,logger:e,platformClient:s,flow:o,chatService:i,t:f,getSubmissions:()=>{var I;return(I=n.store.current$.peek().flow)==null?void 0:I.data.submissions},onInterpret:I=>n.store.setCurrentNodeId(I.id),onFlowEnd:async()=>{var D;n.store.markAsFinished();const I=n.store.current$.peek().flow;n.invariant(I),r.log({event:"FLOW_END",properties:{flow_id:o.id,flow_version:o.version,flow_session_id:I.data.flowSessionId,flow_build:o.build,job:o.job},customProperties:(D=o.analytics)==null?void 0:D.customProperties})}});return C(()=>V),y(b),E},[r,t,i,e,o,s,f]),n.o(n.k,{children:[n.o("div",{ref:l,className:"hide-scrollbars relative flex w-full max-w-full flex-grow flex-col overflow-y-scroll",style:{WebkitOverflowScrolling:"touch",paddingBottom:n.store.inputHeight$.value},children:n.o(ss,{lastSentMessageFooter:o.data.isFinished||!p?null:n.o(os,{undoFn:p})})}),n.o(zn,{logger:e})]})},is=e=>e.type==="identify"?[]:"key"in e.data&&e.data.key?[e.data.key]:"keys"in e.data?Object.values(e.data.keys).filter(t=>typeof t=="string"):[],os=({undoFn:e})=>{const{t}=n.useTranslation();return n.o(n.SvgIconButton,{onClick:async()=>{const{flow:r}=n.store.current$.peek();n.invariant(r);const{removed:s}=e(r.data.nodeHistory),o=r.data.nodeHistory.splice(-s);o.length!==0&&(n.store.removeMessagesSentByNodeIds(o),n.store.setInput(void 0),o.pop(),o.map(a=>r.nodes.find(l=>l.id===a)).filter(Boolean).flatMap(is).forEach(a=>delete r.data.submissions[a]),n.store.current$.value={...n.store.current$.value})},children:[n.o("title",{children:t("undo")}),n.o("path",{d:"M3 13h2.67l6.66-6.67a1.9 1.9 0 0 0 0-2.66 1.91 1.91 0 0 0-2.66 0L3 10.33V13Zm4.6-7.25 2.67 2.67"})]})};exports.ChatbotBody=as;
|
package/dist/chatbot.d.ts
CHANGED
|
@@ -80,5 +80,6 @@ export declare const chatbotPlugin: ({ _internal_domManager: dom, theme, terms,
|
|
|
80
80
|
fetchFlowById: (flowId: string, additionalProperties?: FetchFlowByIdAdditionalProperties) => Promise<OpenChatbotParams>;
|
|
81
81
|
open: (params: OpenChatbotParams | Promise<OpenChatbotParams>) => Promise<void>;
|
|
82
82
|
close: () => Promise<void>;
|
|
83
|
+
destroy: () => void;
|
|
83
84
|
};
|
|
84
85
|
export {};
|
package/dist/chatbot.dom.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export declare const createChatbotDomManager: () => {
|
|
2
|
-
|
|
2
|
+
getChatbotElement: () => HTMLDivElement | null;
|
|
3
|
+
getOrCreateChatbotElement: () => HTMLDivElement;
|
|
3
4
|
};
|
|
4
5
|
export type ChatbotDomManager = ReturnType<typeof createChatbotDomManager>;
|
package/dist/chatbot.idb.d.ts
CHANGED
|
@@ -14,5 +14,6 @@ export declare const idb: {
|
|
|
14
14
|
sequence: number;
|
|
15
15
|
submissions: KeyToSubmissionMap;
|
|
16
16
|
} | undefined>;
|
|
17
|
-
setStateData: (params: StartedFlow) =>
|
|
17
|
+
setStateData: (params: StartedFlow) => void;
|
|
18
|
+
flushStateData: () => Promise<unknown>;
|
|
18
19
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/chatbot.state.d.ts
CHANGED
|
@@ -36,7 +36,253 @@ export declare const store: {
|
|
|
36
36
|
current$: import('@preact/signals').Signal<CurrentFlow>;
|
|
37
37
|
viewState$: import('@preact/signals').Signal<"maximised" | "minimised" | "closed">;
|
|
38
38
|
inputHeight$: import('@preact/signals').Signal<number>;
|
|
39
|
-
|
|
39
|
+
prepareFlow: ({ flow, context, flowKeys, title, analytics, job, locationOrigin }: OpenChatbotParams) => Promise<{
|
|
40
|
+
data: FlowStateData;
|
|
41
|
+
startedAt: Date;
|
|
42
|
+
nodeIdToProgress: Record<string, ChatbotFlowProgress>;
|
|
43
|
+
flowKeys: string[];
|
|
44
|
+
id: string;
|
|
45
|
+
version: number;
|
|
46
|
+
nodes: ({
|
|
47
|
+
type: "text";
|
|
48
|
+
id: string;
|
|
49
|
+
data: {
|
|
50
|
+
text: string;
|
|
51
|
+
};
|
|
52
|
+
isHead?: boolean | undefined;
|
|
53
|
+
nextId?: string | undefined;
|
|
54
|
+
} | {
|
|
55
|
+
type: "end-flow";
|
|
56
|
+
id: string;
|
|
57
|
+
data: {
|
|
58
|
+
systemMessage: string;
|
|
59
|
+
};
|
|
60
|
+
isHead?: boolean | undefined;
|
|
61
|
+
nextId?: string | undefined;
|
|
62
|
+
} | {
|
|
63
|
+
type: "integration-application-submit";
|
|
64
|
+
id: string;
|
|
65
|
+
data: {
|
|
66
|
+
integrationId: string;
|
|
67
|
+
skipConfirmation: boolean;
|
|
68
|
+
submitLabel: string;
|
|
69
|
+
submitKeys: "all" | string[];
|
|
70
|
+
key?: string | undefined;
|
|
71
|
+
};
|
|
72
|
+
isHead?: boolean | undefined;
|
|
73
|
+
nextId?: string | undefined;
|
|
74
|
+
} | {
|
|
75
|
+
type: "integration-workflow-get";
|
|
76
|
+
id: string;
|
|
77
|
+
data: {
|
|
78
|
+
integrationId: string;
|
|
79
|
+
};
|
|
80
|
+
isHead?: boolean | undefined;
|
|
81
|
+
nextId?: string | undefined;
|
|
82
|
+
} | {
|
|
83
|
+
type: "link";
|
|
84
|
+
id: string;
|
|
85
|
+
data: {
|
|
86
|
+
href: string;
|
|
87
|
+
cta: string;
|
|
88
|
+
};
|
|
89
|
+
isHead?: boolean | undefined;
|
|
90
|
+
nextId?: string | undefined;
|
|
91
|
+
} | {
|
|
92
|
+
type: "image";
|
|
93
|
+
id: string;
|
|
94
|
+
data: {
|
|
95
|
+
url: string;
|
|
96
|
+
width: number;
|
|
97
|
+
height: number;
|
|
98
|
+
};
|
|
99
|
+
isHead?: boolean | undefined;
|
|
100
|
+
nextId?: string | undefined;
|
|
101
|
+
} | {
|
|
102
|
+
type: "question-boolean";
|
|
103
|
+
id: string;
|
|
104
|
+
data: {
|
|
105
|
+
key: string;
|
|
106
|
+
question: string;
|
|
107
|
+
trueLabel: string;
|
|
108
|
+
falseLabel: string;
|
|
109
|
+
optional: boolean;
|
|
110
|
+
};
|
|
111
|
+
isHead?: boolean | undefined;
|
|
112
|
+
nextId?: string | undefined;
|
|
113
|
+
} | {
|
|
114
|
+
type: "question-text";
|
|
115
|
+
id: string;
|
|
116
|
+
data: {
|
|
117
|
+
key: string;
|
|
118
|
+
question: string;
|
|
119
|
+
optional: boolean;
|
|
120
|
+
format: "date" | "text" | "url" | "email" | "phone";
|
|
121
|
+
placeholder?: string | undefined;
|
|
122
|
+
maxChars?: number | undefined;
|
|
123
|
+
minChars?: number | undefined;
|
|
124
|
+
};
|
|
125
|
+
isHead?: boolean | undefined;
|
|
126
|
+
nextId?: string | undefined;
|
|
127
|
+
} | {
|
|
128
|
+
type: "question-number";
|
|
129
|
+
id: string;
|
|
130
|
+
data: {
|
|
131
|
+
key: string;
|
|
132
|
+
question: string;
|
|
133
|
+
optional: boolean;
|
|
134
|
+
placeholder?: string | undefined;
|
|
135
|
+
decimalCases?: number | undefined;
|
|
136
|
+
min?: number | undefined;
|
|
137
|
+
max?: number | undefined;
|
|
138
|
+
};
|
|
139
|
+
isHead?: boolean | undefined;
|
|
140
|
+
nextId?: string | undefined;
|
|
141
|
+
} | {
|
|
142
|
+
type: "question-phone";
|
|
143
|
+
id: string;
|
|
144
|
+
data: {
|
|
145
|
+
key: string;
|
|
146
|
+
question: string;
|
|
147
|
+
optional: boolean;
|
|
148
|
+
placeholder: string;
|
|
149
|
+
minChars: number;
|
|
150
|
+
defaultCountryCode: string;
|
|
151
|
+
};
|
|
152
|
+
isHead?: boolean | undefined;
|
|
153
|
+
nextId?: string | undefined;
|
|
154
|
+
} | {
|
|
155
|
+
type: "question-enum";
|
|
156
|
+
id: string;
|
|
157
|
+
data: {
|
|
158
|
+
options: {
|
|
159
|
+
value: string;
|
|
160
|
+
label: string;
|
|
161
|
+
}[];
|
|
162
|
+
key: string;
|
|
163
|
+
question: string;
|
|
164
|
+
maxSelected: number;
|
|
165
|
+
minSelected: number;
|
|
166
|
+
};
|
|
167
|
+
isHead?: boolean | undefined;
|
|
168
|
+
nextId?: string | undefined;
|
|
169
|
+
} | {
|
|
170
|
+
type: "question-file";
|
|
171
|
+
id: string;
|
|
172
|
+
data: {
|
|
173
|
+
key: string;
|
|
174
|
+
question: string;
|
|
175
|
+
optional: boolean;
|
|
176
|
+
extensions: string[];
|
|
177
|
+
multiple?: boolean | undefined;
|
|
178
|
+
maxSizeKb?: number | undefined;
|
|
179
|
+
};
|
|
180
|
+
isHead?: boolean | undefined;
|
|
181
|
+
nextId?: string | undefined;
|
|
182
|
+
} | {
|
|
183
|
+
type: "question-address";
|
|
184
|
+
id: string;
|
|
185
|
+
data: {
|
|
186
|
+
keys: {
|
|
187
|
+
line1: string | null;
|
|
188
|
+
line2: string | null;
|
|
189
|
+
line3: string | null;
|
|
190
|
+
city: string | null;
|
|
191
|
+
state: string | null;
|
|
192
|
+
postcode: string | null;
|
|
193
|
+
country: string | null;
|
|
194
|
+
};
|
|
195
|
+
key: string;
|
|
196
|
+
question: string;
|
|
197
|
+
optional: boolean;
|
|
198
|
+
placeholder?: string | undefined;
|
|
199
|
+
};
|
|
200
|
+
isHead?: boolean | undefined;
|
|
201
|
+
nextId?: string | undefined;
|
|
202
|
+
} | {
|
|
203
|
+
type: "if-block";
|
|
204
|
+
id: string;
|
|
205
|
+
data: {
|
|
206
|
+
compareKey: string;
|
|
207
|
+
compareValue: string;
|
|
208
|
+
compare: "equals" | "notEquals" | "contains" | "notContains" | "greaterThan" | "lessThan" | "greaterThanOrEqualTo" | "lessThanOrEqualTo";
|
|
209
|
+
} | {
|
|
210
|
+
combinator: "and" | "or";
|
|
211
|
+
conditions: {
|
|
212
|
+
compareKey: string;
|
|
213
|
+
compareValue: string;
|
|
214
|
+
compare: "equals" | "notEquals" | "contains" | "notContains" | "greaterThan" | "lessThan" | "greaterThanOrEqualTo" | "lessThanOrEqualTo";
|
|
215
|
+
}[];
|
|
216
|
+
};
|
|
217
|
+
isHead?: boolean | undefined;
|
|
218
|
+
nextId?: string | undefined;
|
|
219
|
+
branchId?: string | undefined;
|
|
220
|
+
} | {
|
|
221
|
+
type: "jump";
|
|
222
|
+
id: string;
|
|
223
|
+
data: {
|
|
224
|
+
targetId: string;
|
|
225
|
+
};
|
|
226
|
+
isHead?: boolean | undefined;
|
|
227
|
+
nextId?: string | undefined;
|
|
228
|
+
} | {
|
|
229
|
+
type: "add-submission";
|
|
230
|
+
id: string;
|
|
231
|
+
data: {
|
|
232
|
+
value: string;
|
|
233
|
+
key: string;
|
|
234
|
+
};
|
|
235
|
+
isHead?: boolean | undefined;
|
|
236
|
+
nextId?: string | undefined;
|
|
237
|
+
} | {
|
|
238
|
+
type: "identify";
|
|
239
|
+
id: string;
|
|
240
|
+
data: {
|
|
241
|
+
key: string;
|
|
242
|
+
email?: string | undefined;
|
|
243
|
+
firstName?: string | undefined;
|
|
244
|
+
lastName?: string | undefined;
|
|
245
|
+
phoneNumber?: string | undefined;
|
|
246
|
+
customTraits?: {
|
|
247
|
+
value: string;
|
|
248
|
+
key: string;
|
|
249
|
+
}[] | undefined;
|
|
250
|
+
};
|
|
251
|
+
isHead?: boolean | undefined;
|
|
252
|
+
nextId?: string | undefined;
|
|
253
|
+
} | {
|
|
254
|
+
type: "check-duplicate";
|
|
255
|
+
id: string;
|
|
256
|
+
data: {
|
|
257
|
+
key: string;
|
|
258
|
+
email: string;
|
|
259
|
+
scope: "job" | "company";
|
|
260
|
+
};
|
|
261
|
+
isHead?: boolean | undefined;
|
|
262
|
+
nextId?: string | undefined;
|
|
263
|
+
} | {
|
|
264
|
+
type: "feedback";
|
|
265
|
+
id: string;
|
|
266
|
+
data: {};
|
|
267
|
+
isHead?: boolean | undefined;
|
|
268
|
+
nextId?: string | undefined;
|
|
269
|
+
})[];
|
|
270
|
+
build: number;
|
|
271
|
+
context: Record<string, unknown>;
|
|
272
|
+
title: string;
|
|
273
|
+
analytics: {
|
|
274
|
+
customProperties?: Record<string, unknown>;
|
|
275
|
+
} | undefined;
|
|
276
|
+
job: {
|
|
277
|
+
id: string;
|
|
278
|
+
id_type: "internal" | "external";
|
|
279
|
+
} | undefined;
|
|
280
|
+
locationOrigin: {
|
|
281
|
+
lat?: number;
|
|
282
|
+
lng?: number;
|
|
283
|
+
} | undefined;
|
|
284
|
+
}>;
|
|
285
|
+
commitFlow: (flow: StartedFlow) => void;
|
|
40
286
|
cancelCurrentFlow: () => void;
|
|
41
287
|
markAsFinished: () => void;
|
|
42
288
|
setCurrentNodeId: (currentNodeId: string) => void;
|
package/dist/chatbot.utils.d.ts
CHANGED
|
@@ -235,7 +235,6 @@ export declare function gzip(string: string): string | Promise<string>;
|
|
|
235
235
|
export declare class AbortedError extends Error {
|
|
236
236
|
constructor();
|
|
237
237
|
}
|
|
238
|
-
export declare function debounce<TFn extends (...params: any[]) => void>(func: TFn, timeout?: number): TFn;
|
|
239
238
|
export declare const isString: (value: unknown) => value is string;
|
|
240
239
|
/** Creates a deterministic hash string from an object by JSON stringifying with sorted keys */
|
|
241
240
|
export declare const hashObject: (obj: Record<string, unknown>) => string;
|