toku-form-extensions 0.5.1 → 0.5.2

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/dist/index.umd.js CHANGED
@@ -206,5 +206,5 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
206
206
  `+e._s(s.text)+`
207
207
  `)])}),0)},ny=[],ry=void 0,ay=void 0,iy=void 0,oy=!1,sy=Lt({render:ty,staticRenderFns:ny},ry,ey,ay,oy,iy,!1,void 0,void 0,void 0),ly={name:"TimePanel",components:{ListColumns:K_,ListOptions:sy},inject:{getLocale:{default:function(){return $r}},prefixClass:{default:"mx"}},props:{value:{},defaultValue:{default:function(){var e=new Date;return e.setHours(0,0,0,0),e}},format:{default:"HH:mm:ss"},timeTitleFormat:{type:String,default:"YYYY-MM-DD"},showTimeHeader:{type:Boolean,default:!1},disabledTime:{type:Function,default:function(){return!1}},timePickerOptions:{type:[Object,Function],default:function(){return null}},hourOptions:Array,minuteOptions:Array,secondOptions:Array,hourStep:{type:Number,default:1},minuteStep:{type:Number,default:1},secondStep:{type:Number,default:1},showHour:{type:Boolean,default:void 0},showMinute:{type:Boolean,default:void 0},showSecond:{type:Boolean,default:void 0},use12h:{type:Boolean,default:void 0},scrollDuration:{type:Number,default:100}},data:function(){return{innerValue:Tr(this.value,this.defaultValue)}},computed:{title:function(){var e=this.timeTitleFormat,n=new Date(this.innerValue);return this.formatDate(n,e)},innerForamt:function(){return typeof this.format=="string"?this.format:"HH:mm:ss"},ShowHourMinuteSecondAMPM:function(){var e=this,n=this.innerForamt,i={showHour:/[HhKk]/.test(n),showMinute:/m/.test(n),showSecond:/s/.test(n),use12h:/a/i.test(n)},s={};return Object.keys(i).forEach(function(u){s[u]=typeof e[u]=="boolean"?e[u]:i[u]}),s}},watch:{value:{immediate:!0,handler:function(){this.innerValue=Tr(this.value,this.defaultValue)}}},methods:{formatDate:function(e,n){return ci(e,n,{locale:this.getLocale().formatLocale})},isDisabledTime:function(e){return this.disabledTime(new Date(e))},isDisabledHour:function(e){var n=new Date(e);return this.isDisabledTime(n)&&this.isDisabledTime(n.setMinutes(0,0,0))&&this.isDisabledTime(n.setMinutes(59,59,999))},isDisabledMinute:function(e){var n=new Date(e);return this.isDisabledTime(n)&&this.isDisabledTime(n.setSeconds(0,0))&&this.isDisabledTime(n.setSeconds(59,999))},isDisabledAMPM:function(e){var n=new Date(e),i=n.getHours()<12?0:12,s=i+11;return this.isDisabledTime(n)&&this.isDisabledTime(n.setHours(i,0,0,0))&&this.isDisabledTime(n.setHours(s,59,59,999))},isDisabled:function(e,n){return n==="hour"?this.isDisabledHour(e):n==="minute"?this.isDisabledMinute(e):n==="ampm"?this.isDisabledAMPM(e):this.isDisabledTime(e)},handleSelect:function(e,n){var i=new Date(e);this.isDisabled(e,n)||(this.innerValue=i,this.isDisabledTime(i)||this.$emit("select",i,n))},handleClickTitle:function(){this.$emit("clicktitle")},getClasses:function(e,n){var i=new Date(e);return this.isDisabled(e,n)?"disabled":i.getTime()===this.innerValue.getTime()?"active":""}}},uy=ly,cy=function(){var e=this,n=e.$createElement,i=e._self._c||n;return i("div",{class:e.prefixClass+"-time"},[e.showTimeHeader?i("div",{class:e.prefixClass+"-time-header"},[i("button",{class:e.prefixClass+"-btn "+e.prefixClass+"-btn-text "+e.prefixClass+"-time-header-title",attrs:{type:"button"},on:{click:e.handleClickTitle}},[e._v(`
208
208
  `+e._s(e.title)+`
209
- `)])]):e._e(),e._v(" "),i("div",{class:e.prefixClass+"-time-content"},[e.timePickerOptions?i("list-options",{attrs:{date:e.innerValue,"get-classes":e.getClasses,options:e.timePickerOptions,format:e.innerForamt},on:{select:e.handleSelect}}):i("list-columns",e._b({attrs:{date:e.innerValue,"get-classes":e.getClasses,"hour-options":e.hourOptions,"minute-options":e.minuteOptions,"second-options":e.secondOptions,"hour-step":e.hourStep,"minute-step":e.minuteStep,"second-step":e.secondStep,"scroll-duration":e.scrollDuration},on:{select:e.handleSelect}},"list-columns",e.ShowHourMinuteSecondAMPM,!1))],1)])},fy=[],dy=void 0,py=void 0,hy=void 0,my=!1,Bn=Lt({render:cy,staticRenderFns:fy},dy,uy,py,my,hy,!1,void 0,void 0,void 0),va={name:"TimeRange",inject:{prefixClass:{default:"mx"}},props:Ee({},Bn.props),data:function(){return{startValue:new Date(NaN),endValue:new Date(NaN)}},watch:{value:{immediate:!0,handler:function(){if(pi(this.value)){var e=da(this.value,2),n=e[0],i=e[1];this.startValue=n,this.endValue=i}else this.startValue=new Date(NaN),this.endValue=new Date(NaN)}}},methods:{emitChange:function(e,n){var i=[this.startValue,this.endValue];this.$emit("select",i,e==="time"?"time-range":e,n)},handleSelectStart:function(e,n){this.startValue=e,this.endValue.getTime()>=e.getTime()||(this.endValue=e),this.emitChange(n,0)},handleSelectEnd:function(e,n){this.endValue=e,this.startValue.getTime()<=e.getTime()||(this.startValue=e),this.emitChange(n,1)},disabledStartTime:function(e){return this.disabledTime(e,0)},disabledEndTime:function(e){return e.getTime()<this.startValue.getTime()||this.disabledTime(e,1)}},render:function(){var e=arguments[0],n=Array.isArray(this.defaultValue)?this.defaultValue:[this.defaultValue,this.defaultValue],i=this.prefixClass;return e("div",{class:"".concat(i,"-range-wrapper")},[e(Bn,{props:Ee({},Ee({},this.$props,{value:this.startValue,defaultValue:n[0],disabledTime:this.disabledStartTime})),on:Ee({},Ee({},this.$listeners,{select:this.handleSelectStart}))}),e(Bn,{props:Ee({},Ee({},this.$props,{value:this.endValue,defaultValue:n[1],disabledTime:this.disabledEndTime})),on:Ee({},Ee({},this.$listeners,{select:this.handleSelectEnd}))})])}},_s={name:"DatetimePanel",inject:{prefixClass:{default:"mx"}},emits:["select","update:show-time-panel"],props:Ee({},or.props,{},Bn.props,{showTimePanel:{type:Boolean,default:void 0}}),data:function(){return{defaultTimeVisible:!1,currentValue:this.value}},computed:{timeVisible:function(){return typeof this.showTimePanel=="boolean"?this.showTimePanel:this.defaultTimeVisible}},watch:{value:function(e){this.currentValue=e}},methods:{closeTimePanel:function(){this.defaultTimeVisible=!1,this.$emit("update:show-time-panel",!1)},openTimePanel:function(){this.defaultTimeVisible=!0,this.$emit("update:show-time-panel",!0)},emitDate:function(e,n){this.$emit("select",e,n)},handleSelect:function(e,n){n==="date"&&this.openTimePanel();var i=hi(e,Tr(this.value,this.defaultValue));if(this.disabledTime(new Date(i))&&(i=hi(e,this.defaultValue),this.disabledTime(new Date(i)))){this.currentValue=i;return}this.emitDate(i,n)}},render:function(){var e=arguments[0],n={props:Ee({},Dr(this.$props,Object.keys(or.props)),{type:"date",value:this.currentValue}),on:{select:this.handleSelect}},i={props:Ee({},Dr(this.$props,Object.keys(Bn.props)),{showTimeHeader:!0,value:this.currentValue}),on:{select:this.emitDate,clicktitle:this.closeTimePanel}},s=this.prefixClass;return e("div",[e(or,pa([{},n])),this.timeVisible&&e(Bn,pa([{class:"".concat(s,"-calendar-time")},i]))])}},Cc={name:"DatetimeRange",inject:{prefixClass:{default:"mx"}},emits:["select","update:show-time-panel"],props:Ee({},ma.props,{},va.props,{showTimePanel:{type:Boolean,default:void 0}}),data:function(){return{defaultTimeVisible:!1,currentValue:this.value}},computed:{timeVisible:function(){return typeof this.showTimePanel=="boolean"?this.showTimePanel:this.defaultTimeVisible}},watch:{value:function(e){this.currentValue=e}},methods:{closeTimePanel:function(){this.defaultTimeVisible=!1,this.$emit("update:show-time-panel",!1)},openTimePanel:function(){this.defaultTimeVisible=!0,this.$emit("update:show-time-panel",!0)},emitDate:function(e,n){this.$emit("select",e,n)},handleSelect:function(e,n){var i=this;n==="date"&&this.openTimePanel();var s=Array.isArray(this.defaultValue)?this.defaultValue:[this.defaultValue,this.defaultValue],u=e.map(function(c,d){var m=pi(i.value)?i.value[d]:s[d];return hi(c,m)});if(u[1].getTime()<u[0].getTime()&&(u=[u[0],u[0]]),u.some(this.disabledTime)&&(u=e.map(function(c,d){return hi(c,s[d])}),u.some(this.disabledTime))){this.currentValue=u;return}this.emitDate(u,n)}},render:function(){var e=arguments[0],n={props:Ee({},Dr(this.$props,Object.keys(ma.props)),{type:"date",value:this.currentValue}),on:{select:this.handleSelect}},i={props:Ee({},Dr(this.$props,Object.keys(va.props)),{value:this.currentValue,showTimeHeader:!0}),on:{select:this.emitDate,clicktitle:this.closeTimePanel}},s=this.prefixClass;return e("div",[e(ma,pa([{},n])),this.timeVisible&&e(va,pa([{class:"".concat(s,"-calendar-time")},i]))])}},vy={default:or,time:Bn,datetime:_s},gy={default:ma,time:va,datetime:Cc},Yn={name:"DatePicker",provide:function(){var e=this;return{getLocale:function(){return e.locale},getWeek:this.getWeek,prefixClass:this.prefixClass,dispatchDatePicker:this.$emit.bind(this)}},props:Ee({},_s.props,{value:{},valueType:{type:String,default:"date"},type:{type:String,default:"date"},format:{type:String},formatter:{type:Object},range:{type:Boolean,default:!1},multiple:{type:Boolean,default:!1},rangeSeparator:{type:String},lang:{type:[String,Object]},placeholder:{type:String,default:""},editable:{type:Boolean,default:!0},disabled:{type:Boolean,default:!1},clearable:{type:Boolean,default:!0},prefixClass:{type:String,default:"mx"},inputClass:{},inputAttr:{type:Object,default:function(){return{}}},appendToBody:{type:Boolean,default:!0},open:{type:Boolean,default:void 0},popupClass:{},popupStyle:{type:Object,default:function(){return{}}},inline:{type:Boolean,default:!1},confirm:{type:Boolean,default:!1},confirmText:{type:String,default:"OK"},renderInputText:{type:Function},shortcuts:{type:Array,validator:function(e){return Array.isArray(e)&&e.every(function(n){return pn(n)&&typeof n.text=="string"&&typeof n.onClick=="function"})},default:function(){return[]}}}),data:function(){return{currentValue:null,userInput:null,defaultOpen:!1,mouseInInput:!1}},computed:{popupVisible:function(){return!this.disabled&&(typeof this.open=="boolean"?this.open:this.defaultOpen)},innerRangeSeparator:function(){return this.rangeSeparator||(this.multiple?",":" ~ ")},innerFormat:function(){var e={date:"YYYY-MM-DD",datetime:"YYYY-MM-DD HH:mm:ss",year:"YYYY",month:"YYYY-MM",time:"HH:mm:ss",week:"w"};return this.format||e[this.type]||e.date},innerValue:function(){var e=this.value;return this.validMultipleType?(e=Array.isArray(e)?e:[],e.map(this.value2date)):this.range?(e=Array.isArray(e)?e.slice(0,2):[null,null],e.map(this.value2date)):this.value2date(e)},text:function(){var e=this;return this.userInput!==null?this.userInput:typeof this.renderInputText=="function"?this.renderInputText(this.innerValue):this.isValidValue(this.innerValue)?Array.isArray(this.innerValue)?this.innerValue.map(function(n){return e.formatDate(n)}).join(this.innerRangeSeparator):this.formatDate(this.innerValue):""},showClearIcon:function(){return!this.disabled&&this.clearable&&this.text&&this.mouseInInput},locale:function(){return pn(this.lang)?wc($r(),this.lang):$r(this.lang)},validMultipleType:function(){var e=["date","month","year"];return this.multiple&&!this.range&&e.indexOf(this.type)!==-1}},watch:{innerValue:{immediate:!0,handler:function(e){this.currentValue=e}},popupVisible:{handler:function(e){e&&(this.currentValue=this.innerValue)}}},created:function(){di(this.format)==="object"&&console.warn("[vue2-datepicker]: The prop `format` don't support Object any more. You can use the new prop `formatter` to replace it")},methods:{handleMouseEnter:function(){this.mouseInInput=!0},handleMouseLeave:function(){this.mouseInInput=!1},handleClickOutSide:function(e){var n=e.target;this.$el.contains(n)||this.closePopup()},getFormatter:function(e){return pn(this.formatter)&&this.formatter[e]||pn(this.format)&&this.format[e]},getWeek:function(e,n){return typeof this.getFormatter("getWeek")=="function"?this.getFormatter("getWeek")(e,n):os(e,n)},parseDate:function(e,n){if(n=n||this.innerFormat,typeof this.getFormatter("parse")=="function")return this.getFormatter("parse")(e,n);var i=new Date;return Jv(e,n,{locale:this.locale.formatLocale,backupDate:i})},formatDate:function(e,n){return n=n||this.innerFormat,typeof this.getFormatter("stringify")=="function"?this.getFormatter("stringify")(e,n):ci(e,n,{locale:this.locale.formatLocale})},value2date:function(e){switch(this.valueType){case"date":return e instanceof Date?new Date(e.getTime()):new Date(NaN);case"timestamp":return typeof e=="number"?new Date(e):new Date(NaN);case"format":return typeof e=="string"?this.parseDate(e):new Date(NaN);default:return typeof e=="string"?this.parseDate(e,this.valueType):new Date(NaN)}},date2value:function(e){if(!wn(e))return null;switch(this.valueType){case"date":return e;case"timestamp":return e.getTime();case"format":return this.formatDate(e);default:return this.formatDate(e,this.valueType)}},emitValue:function(e,n){var i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;this.userInput=null;var s=Array.isArray(e)?e.map(this.date2value):this.date2value(e);return this.$emit("input",s),this.$emit("change",s,n),i&&this.closePopup(),s},isValidValue:function(e){return this.validMultipleType?cg(e):this.range?pi(e):wn(e)},isValidValueAndNotDisabled:function(e){if(!this.isValidValue(e))return!1;var n=typeof this.disabledDate=="function"?this.disabledDate:function(){return!1},i=typeof this.disabledTime=="function"?this.disabledTime:function(){return!1};return Array.isArray(e)||(e=[e]),e.every(function(s){return!n(s)&&!i(s)})},handleMultipleDates:function(e,n){if(this.validMultipleType&&n){var i=n.filter(function(s){return s.getTime()!==e.getTime()});return i.length===n.length&&i.push(e),i}return e},handleSelectDate:function(e,n,i){e=this.handleMultipleDates(e,i),this.confirm?this.currentValue=e:this.emitValue(e,n,!this.validMultipleType&&(n===this.type||n==="time"))},clear:function(){this.emitValue(this.range?[null,null]:null),this.$emit("clear")},handleClear:function(e){e.stopPropagation(),this.clear()},handleConfirmDate:function(){var e=this.emitValue(this.currentValue);this.$emit("confirm",e)},handleSelectShortcut:function(e){var n=e.currentTarget.getAttribute("data-index"),i=this.shortcuts[parseInt(n,10)];if(pn(i)&&typeof i.onClick=="function"){var s=i.onClick(this);s&&this.emitValue(s)}},openPopup:function(e){this.popupVisible||this.disabled||(this.defaultOpen=!0,this.$emit("open",e),this.$emit("update:open",!0))},closePopup:function(){this.popupVisible&&(this.defaultOpen=!1,this.$emit("close"),this.$emit("update:open",!1))},blur:function(){this.$refs.input&&this.$refs.input.blur()},focus:function(){this.$refs.input&&this.$refs.input.focus()},handleInputChange:function(){var e=this;if(!(!this.editable||this.userInput===null)){var n=this.userInput.trim();if(this.userInput=null,n===""){this.clear();return}var i;if(this.validMultipleType)i=n.split(this.innerRangeSeparator).map(function(u){return e.parseDate(u.trim())});else if(this.range){var s=n.split(this.innerRangeSeparator);s.length!==2&&(s=n.split(this.innerRangeSeparator.trim())),i=s.map(function(u){return e.parseDate(u.trim())})}else i=this.parseDate(n);this.isValidValueAndNotDisabled(i)?(this.emitValue(i),this.blur()):this.$emit("input-error",n)}},handleInputInput:function(e){this.userInput=typeof e=="string"?e:e.target.value},handleInputKeydown:function(e){var n=e.keyCode;n===9?this.closePopup():n===13&&this.handleInputChange()},handleInputBlur:function(e){this.$emit("blur",e)},handleInputFocus:function(e){this.openPopup(e),this.$emit("focus",e)},hasSlot:function(e){return!!(this.$slots[e]||this.$scopedSlots[e])},renderSlot:function(e,n,i){var s=this.$scopedSlots[e];return s?s(i)||n:this.$slots[e]||n},renderInput:function(){var e=this.$createElement,n=this.prefixClass,i=Ee({name:"date",type:"text",autocomplete:"off",value:this.text,class:this.inputClass||"".concat(this.prefixClass,"-input"),readonly:!this.editable,disabled:this.disabled,placeholder:this.placeholder},this.inputAttr),s=i.value,u=i.class,c=eg(i,["value","class"]),d={keydown:this.handleInputKeydown,focus:this.handleInputFocus,blur:this.handleInputBlur,input:this.handleInputInput,change:this.handleInputChange},m=this.renderSlot("input",e("input",{domProps:{value:s},class:u,attrs:Ee({},c),on:Ee({},d),ref:"input"}),{props:i,events:d}),_=this.type==="time"?e(Hg):e(Pg);return e("div",{class:"".concat(n,"-input-wrapper"),on:{mouseenter:this.handleMouseEnter,mouseleave:this.handleMouseLeave,click:this.openPopup},ref:"inputWrapper"},[m,this.showClearIcon?e("i",{class:"".concat(n,"-icon-clear"),on:{click:this.handleClear}},[this.renderSlot("icon-clear",e(Kg))]):e("i",{class:"".concat(n,"-icon-calendar")},[this.renderSlot("icon-calendar",_)])])},renderContent:function(){var e=this.$createElement,n=this.range?gy:vy,i=n[this.type]||n.default,s=Ee({},Dr(this.$props,Object.keys(i.props)),{value:this.currentValue}),u=Ee({},Dr(this.$listeners,i.emits||[]),{select:this.handleSelectDate}),c=e(i,pa([{},{props:s,on:u,ref:"picker"}]));return e("div",{class:"".concat(this.prefixClass,"-datepicker-body")},[this.renderSlot("content",c,{value:this.currentValue,emit:this.handleSelectDate})])},renderSidebar:function(){var e=this,n=this.$createElement,i=this.prefixClass;return n("div",{class:"".concat(i,"-datepicker-sidebar")},[this.renderSlot("sidebar",null,{value:this.currentValue,emit:this.handleSelectDate}),this.shortcuts.map(function(s,u){return n("button",{key:u,attrs:{"data-index":u,type:"button"},class:"".concat(i,"-btn ").concat(i,"-btn-text ").concat(i,"-btn-shortcut"),on:{click:e.handleSelectShortcut}},[s.text])})])},renderHeader:function(){var e=this.$createElement;return e("div",{class:"".concat(this.prefixClass,"-datepicker-header")},[this.renderSlot("header",null,{value:this.currentValue,emit:this.handleSelectDate})])},renderFooter:function(){var e=this.$createElement,n=this.prefixClass;return e("div",{class:"".concat(n,"-datepicker-footer")},[this.renderSlot("footer",null,{value:this.currentValue,emit:this.handleSelectDate}),this.confirm?e("button",{attrs:{type:"button"},class:"".concat(n,"-btn ").concat(n,"-datepicker-btn-confirm"),on:{click:this.handleConfirmDate}},[this.confirmText]):null])}},render:function(){var e,n=arguments[0],i=this.prefixClass,s=this.inline,u=this.disabled,c=this.hasSlot("sidebar")||this.shortcuts.length?this.renderSidebar():null,d=n("div",{class:"".concat(i,"-datepicker-content")},[this.hasSlot("header")?this.renderHeader():null,this.renderContent(),this.hasSlot("footer")||this.confirm?this.renderFooter():null]);return n("div",{class:(e={},ir(e,"".concat(i,"-datepicker"),!0),ir(e,"".concat(i,"-datepicker-range"),this.range),ir(e,"".concat(i,"-datepicker-inline"),s),ir(e,"disabled",u),e)},[s?null:this.renderInput(),s?n("div",{class:"".concat(i,"-datepicker-main")},[c,d]):n(Ag,{ref:"popup",class:this.popupClass,style:this.popupStyle,attrs:{visible:this.popupVisible,appendToBody:this.appendToBody},on:{clickoutside:this.handleClickOutSide}},[c,d])])}};Yn.locale=xc,Yn.install=function(e){e.component(Yn.name,Yn)},typeof window<"u"&&window.Vue&&Yn.install(window.Vue),us(Yn,{CalendarPanel:or,CalendarRange:ma,TimePanel:Bn,TimeRange:va,DatetimePanel:_s,DatetimeRange:Cc});const cT="",_y=v.defineComponent({__name:"SignupField",props:{id:null,value:null,label:null,disabled:{type:Boolean},displayInfo:{type:Boolean},type:null,decimals:null,leftIcon:null,rightIcon:null,placeholder:null,helperText:null,errorText:null,required:{type:Boolean},regex:null,isMobile:{type:Boolean},autocomplete:{type:Boolean},isExternalId:{type:Boolean}},emits:["input","right-icon-click"],setup(r,{emit:e}){const n=r,i=v.ref(!1),s=v.ref(!1),u=v.computed(()=>{var j;return s.value?"Obligatorio":n.errorText||((j=n.regex)==null?void 0:j.message)}),c=v.computed(()=>n.placeholder||""),d=v.computed(()=>i.value?u.value:Sr(n.helperText)),m=v.computed(()=>{let j="";return i.value&&(j+=" input-error"),j}),_=v.computed(()=>{let j="t-field__helper-text";return i.value&&(j+=" error"),j}),y=()=>{n.regex&&typeof n.value=="string"?i.value=!RegExp(n.regex.pattern).test(n.value):n.required&&(i.value=!n.value,s.value=!n.value)};return v.watch(()=>n.value,y),{__sfc:!0,props:n,emits:e,isError:i,displayRequired:s,errorText:u,placeholder:c,lowerLabel:d,inputClass:m,lowerLabelClass:_,validate:y,handleInput:j=>{e("input",j)},handleDatePicker:j=>{e("input",j)},handleRightIconClick:()=>{e("right-icon-click")},stringToHTML:Sr,Datepicker:Yn,TIconButton:Lu,TTextInput:Pu,TTypography:dn}}}),fT="";function Hn(r,e,n,i,s,u,c,d){var m=typeof r=="function"?r.options:r;e&&(m.render=e,m.staticRenderFns=n,m._compiled=!0),i&&(m.functional=!0),u&&(m._scopeId="data-v-"+u);var _;if(c?(_=function(T){T=T||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext,!T&&typeof __VUE_SSR_CONTEXT__<"u"&&(T=__VUE_SSR_CONTEXT__),s&&s.call(this,T),T&&T._registeredComponents&&T._registeredComponents.add(c)},m._ssrRegister=_):s&&(_=d?function(){s.call(this,(m.functional?this.parent:this).$root.$options.shadowRoot)}:s),_)if(m.functional){m._injectStyles=_;var y=m.render;m.render=function(W,j){return _.call(j),y(W,j)}}else{var b=m.beforeCreate;m.beforeCreate=b?[].concat(b,_):[_]}return{exports:r,options:m}}var yy=function(){var e=this,n=e._self._c,i=e._self._setupProxy;return n("div",{staticClass:"t-field"},[e.label?n("label",{staticClass:"t-field__label",attrs:{for:e.id},domProps:{innerHTML:e._s(i.stringToHTML(e.label))}}):e._e(),e.displayInfo?n(i.TTypography,{attrs:{variant:"b3"}},[e._v(" "+e._s(e.value)+" ")]):e.type==="date"?n("div",{staticClass:"t-field__calendar"},[n(i.Datepicker,{staticClass:"date-class",attrs:{value:e.value,"append-to-body":!1,format:"DD/MM/YYYY"},on:{input:i.handleDatePicker}})],1):n("div",{staticClass:"t-field__input"},[n(i.TTextInput,{class:i.inputClass,attrs:{id:e.id,value:e.value,placeholder:i.placeholder,type:e.type,disabled:e.disabled,"right-icon":e.rightIcon,"left-icon":e.leftIcon,"full-width":"",error:i.isError},on:{input:i.handleInput},scopedSlots:e._u([{key:"helperText",fn:function(){return[n("p",{class:i.lowerLabelClass,attrs:{for:e.id},domProps:{innerHTML:e._s(i.lowerLabel)}})]},proxy:!0}])}),e.isExternalId&&e.autocomplete?n(i.TIconButton,{attrs:{icon:"magnifying-glass"},on:{click:i.handleRightIconClick}}):e._e()],1)],1)},by=[],wy=Hn(_y,yy,by,!1,null,"eb6b377b",null,null);const xy=wy.exports,Sy=v.defineComponent({__name:"SignupFields",props:{fieldsType:null,title:null,fields:null,autocomplete:{type:Boolean},accounts:null,isMobile:{type:Boolean}},emits:["input","search"],setup(r,{emit:e}){const n=r,i=(b,T)=>{e("input",{id:b,value:T})},{shouldShowField:s}=ri(),u=v.computed(()=>n.fields.filter(s)),c=v.computed(()=>{const b={};return u.value.forEach(T=>{b[T.name]=T.value}),b});return{__sfc:!0,props:n,emit:e,handleInput:i,shouldShowField:s,fieldsToShow:u,variables:c,getFieldValue:b=>b.displayInfo&&ai(b.value)&&!b.autocompleted?ni(b.value,c.value):b.value,isFieldSearchable:b=>b.isExternalId&&n.autocomplete,handleRightIconClick:()=>{e("search")},retrocompatibleIcon:b=>b==="DollarIcon"?"currency-dollar":b,TTypography:dn,TSelect:Nu,stringToHTML:Sr,SignupFieldComponent:xy}}}),dT="";var Cy=function(){var e=this,n=e._self._c,i=e._self._setupProxy;return n("div",{staticClass:"fields"},[n(i.TTypography,{attrs:{variant:"s2","font-weight":"medium"}},[e._v(" "+e._s(e.title)+" ")]),e._l(i.fieldsToShow,function(s){var u,c;return[e.fieldsType==="invoice"&&s.isAccount?n(i.TSelect,{key:s.id||s.name,staticClass:"t-select",attrs:{placeholder:s.placeholder,value:(u=s.value)==null?void 0:u.toString(),"full-width":""},on:{input:d=>i.handleInput(s.id||s.id||s.name,d)},scopedSlots:e._u([{key:"label",fn:function(){return[s.label?n("label",{staticClass:"t-select__label",attrs:{for:s.id||s.name},domProps:{innerHTML:e._s(i.stringToHTML(s.label))}}):e._e()]},proxy:!0},{key:"helperText",fn:function(){return[s.helperText?n("p",{staticClass:"t-select__helper-text",domProps:{innerHTML:e._s(i.stringToHTML(s.helperText))}}):e._e()]},proxy:!0}],null,!0)},e._l(e.accounts,function({id:d,name:m}){return n("option",{key:d,domProps:{value:d}},[e._v(" "+e._s(m)+" ")])}),0):s.defaultOptions!==void 0?n(i.TSelect,{key:s.id||s.name,staticClass:"t-select",attrs:{placeholder:s.placeholder,value:(c=s.value)==null?void 0:c.toString(),"full-width":""},on:{input:d=>i.handleInput(s.id||s.name,d)},scopedSlots:e._u([{key:"label",fn:function(){return[s.label?n("label",{staticClass:"t-select__label",attrs:{for:s.id||s.name},domProps:{innerHTML:e._s(i.stringToHTML(s.label))}}):e._e()]},proxy:!0},{key:"helperText",fn:function(){return[s.helperText?n("p",{staticClass:"t-select__helper-text",domProps:{innerHTML:e._s(i.stringToHTML(s.helperText))}}):e._e()]},proxy:!0}],null,!0)},e._l(s.defaultOptions,function(d){return n("option",{key:d.toString(),domProps:{value:d.toString()}},[e._v(" "+e._s(d)+" ")])}),0):n(i.SignupFieldComponent,{key:s.name,attrs:{id:s.id||s.name,value:i.getFieldValue(s),type:s.type,label:s.label,placeholder:s.placeholder,decimals:s.decimals,"helper-text":s.helperText,"left-icon":i.retrocompatibleIcon(s.leftIcon),required:s.required,regex:s.regex,"display-info":s.displayInfo,"right-icon":i.isFieldSearchable(s)?"ph:magnifying-glass":void 0,"is-mobile":e.isMobile,autocomplete:i.props.autocomplete,"is-external-id":s.isExternalId},on:{input:d=>i.handleInput(s.id||s.name,d),"right-icon-click":function(d){i.isFieldSearchable(s)&&i.handleRightIconClick()}}})]})],2)},Ty=[],ky=Hn(Sy,Cy,Ty,!1,null,"69401ded",null,null);const Dy=ky.exports,Ey=v.defineComponent({__name:"SignupCompleted",props:{type:{default:"success"},errorMessage:null,errorButtonLabel:null,successMessage:null,successButtonLabel:null},emits:["reset"],setup(r){const e=r,n=v.computed(()=>e.type==="error"?e.errorMessage:e.successMessage),i=v.computed(()=>e.type==="error"?e.errorButtonLabel:e.successButtonLabel);return{__sfc:!0,props:e,message:n,buttonText:i,TButton:wr,TTypography:dn}}}),pT="";var $y=function(){var e=this,n=e._self._c,i=e._self._setupProxy;return n("div",{staticClass:"success-form"},[n(i.TTypography,{attrs:{variant:"h1"}},[e._v(" "+e._s(i.message)+" ")]),n(i.TButton,{attrs:{variant:"secondary"},on:{click:function(s){return e.$emit("reset")}}},[e._v(" "+e._s(i.buttonText)+" ")])],1)},Ay=[],Iy=Hn(Ey,$y,Ay,!1,null,"dd9e3f67",null,null);const My=Iy.exports,hT="",Fy=v.defineComponent({__name:"CustomForm",props:{customerFields:null,invoiceFields:null,countryIso:null,isLoading:{type:Boolean},submitFormStatus:null,signupCompleted:{type:Boolean,default:!1},isAutocompleteEnabled:{type:Boolean},accounts:null,disableSubmit:{type:Boolean,default:!1},showSendByEmail:{type:Boolean,default:!1},invoiceFieldsTitle:{default:"Plan de pagos"},customerFieldsTitle:{default:"Información Cliente"},buttonLabel:{default:"Registrar"},sendByEmailText:{default:"Enviar información a correo electrónico"},errorMessage:{default:"Error en la creación"},errorButtonLabel:{default:"Intentar nuevamente"},successMessage:{default:"Inscripción exitosa"},successButtonLabel:{default:"Registrar nuevo cliente"},isMobile:{type:Boolean,default:!1},buttonColor:{default:"#5c0087"}},emits:["submit-form-data","reset","autocomplete-subscription","autocomplete-external-id"],setup(r,{emit:e}){const n=r,i=v.ref(n.customerFields),s=v.ref(n.invoiceFields),u=v.ref(n.isLoading),c=v.ref(n.submitFormStatus),d=v.ref(n.signupCompleted),m=v.ref(n.errorMessage),_=v.ref(n.isAutocompleteEnabled),y=v.ref(!n.showSendByEmail),b=v.computed(()=>[...i.value,...s.value]),{shouldShowField:T}=ri(b),{cleanGovernmentId:W}=Wu(),j=Fu({colors:{primary:{main:n.buttonColor}}});v.watch(n,z=>{i.value=z.customerFields,s.value=z.invoiceFields,u.value=z.isLoading,c.value=z.submitFormStatus,d.value=z.signupCompleted,m.value=z.errorMessage,_.value=z.isAutocompleteEnabled});const L=(z,F)=>z.type==="number"&&z.decimals?(Math.round(Number(F)*10**z.decimals)/10**z.decimals).toString():F,Y=()=>{const z=i.value.find(({isExternalId:F})=>F);e("autocomplete-external-id",z==null?void 0:z.value)},G=(z,{id:F,value:B})=>{const U=z.findIndex(K=>F===K.id||F===K.name);if(U!==-1){const K=z[U];v.set(K,"value",L(K,B)),K.name==="product_id"&&_.value&&e("autocomplete-subscription",B)}},ee=()=>{const z={};return b.value.forEach(F=>{T(F)&&(z[F.name]=F.value)}),z},Z=()=>{const z=ee(),F={additional_data:{},customer_metadata:{},subscription_metadata:{},invoice_metadata:{},send_mail:y.value};return b.value.forEach(B=>{if(B.value){if(B.relatedField&&!T(B))return;let{value:U}=B;B.displayInfo&&ai(B.value)&&!B.autocompleted&&(U=ni(U,z)),B.name.includes("customer_metadata")?F.customer_metadata[B.name.replace("customer_metadata_","")]=U:B.name.includes("subscription_metadata")?F.subscription_metadata[B.name.replace("subscription_metadata_","")]=U:B.name.includes("invoice_metadata")?F.invoice_metadata[B.name.replace("invoice_metadata_","")]=U:B.name.includes("additional_data")?F.additional_data[B.name.replace("additional_data_","")]=U:B.name==="government_id"&&n.countryIso==="CL"?F[B.name]=W(U,n.countryIso):B.name==="due_date"&&Bu(U)?F[B.name]=Hu(U):B.isAccount?F.id_account=U:F[B.name]=U}}),F},ge=()=>{let z=!0;return b.value.forEach(F=>{const B=F.required&&(F.value===void 0||F.value==="")&&(!F.relatedField||T(F)),U=F.regex&&!RegExp(F.regex.pattern).test(F.value)&&(!F.relatedField||T(F));(B||U)&&(z=!1)}),z};return{__sfc:!0,props:n,emit:e,customerFields:i,invoiceFields:s,isLoading:u,submitFormStatus:c,signupCompleted:d,errorMessage:m,isAutocompleteEnabled:_,sendEmail:y,allFields:b,shouldShowField:T,cleanGovernmentId:W,theme:j,formatFieldValue:L,handleSearch:Y,handleInput:G,getVariables:ee,buildSignupRequestBody:Z,validateFormValues:ge,submitForm:()=>{if(!ge())return;const F=Z();e("submit-form-data",F)},TButton:wr,TThemeProvider:Ru,TCheckbox:ju,SignupFields:Dy,SignupCompleted:My}}}),mT="";var Oy=function(){var e=this,n=e._self._c,i=e._self._setupProxy;return n(i.TThemeProvider,{attrs:{theme:i.theme}},[n("main",[n("transition",{attrs:{name:"slide-fade",mode:"out-in"}},[i.signupCompleted?n(i.SignupCompleted,{attrs:{type:i.submitFormStatus,"error-message":i.errorMessage,"error-button-label":e.errorButtonLabel,"success-message":e.successMessage,"success-button-label":e.successButtonLabel},on:{reset:function(s){return i.emit("reset")}}}):n("div",{staticClass:"custom-form__container"},[n("div",{staticClass:"custom-form__fields",class:[e.isMobile?"custom-form__fields--rows":"custom-form__fields--columns"]},[i.customerFields.length?n(i.SignupFields,{attrs:{fields:i.customerFields,"fields-type":"customer",title:e.customerFieldsTitle,autocomplete:i.isAutocompleteEnabled,accounts:e.accounts,"is-mobile":e.isMobile},on:{input:s=>i.handleInput(i.customerFields,s),search:i.handleSearch}}):e._e(),i.invoiceFields.length?n(i.SignupFields,{attrs:{fields:i.invoiceFields,"fields-type":"invoice",title:e.invoiceFieldsTitle,accounts:e.accounts,"is-mobile":e.isMobile},on:{input:s=>i.handleInput(i.invoiceFields,s)}}):e._e()],1),n(i.TCheckbox,{attrs:{"label-position":"right",size:"small",id:"send_email"},model:{value:i.sendEmail,callback:function(s){i.sendEmail=s},expression:"sendEmail"}},[e._v(" "+e._s(e.sendByEmailText)+" ")]),n(i.TButton,{attrs:{disabled:e.disableSubmit,size:"large",loading:i.isLoading,"full-width":e.isMobile},on:{click:i.submitForm}},[e._v(" "+e._s(e.buttonLabel)+" ")])],1)],1)],1)])},Ry=[],Ly=Hn(Fy,Oy,Ry,!1,null,"3c8a08d8",null,null);const Py=Ly.exports,Ny=v.defineComponent({__name:"CustomField",props:{id:null,value:null,label:null,disabled:{type:Boolean},displayInfo:{type:Boolean},type:null,decimals:null,leftIcon:null,rightIcon:null,placeholder:null,helperText:null,errorText:null,required:{type:Boolean},regex:null,isMobile:{type:Boolean},autocomplete:{type:Boolean},isExternalId:{type:Boolean}},emits:["input","right-icon-click"],setup(r,{emit:e}){const n=r;v.useCssVars((Y,G)=>({"5598dcdd":G.grayMain,"0e5a85b8":G.grayMedium1,"4aae2b87":G.error}));const i=Oe(),s=v.computed(()=>i.value.colors.error),u=v.computed(()=>i.value.colors.gray.main),c=v.computed(()=>i.value.colors.gray.medium1),d=v.ref(!1),m=v.ref(!1),_=v.computed(()=>{var Y;return m.value?"Obligatorio":n.errorText??((Y=n.regex)==null?void 0:Y.message)}),y=v.computed(()=>n.placeholder||""),b=v.computed(()=>d.value?_.value:Sr(n.helperText)),T=()=>{n.regex&&typeof n.value=="string"?d.value=!RegExp(n.regex.pattern).test(n.value):n.required&&(d.value=!n.value,m.value=!n.value)};return v.watch(()=>n.value,T),{__sfc:!0,props:n,emits:e,theme:i,error:s,grayMain:u,grayMedium1:c,isError:d,displayRequired:m,errorText:_,placeholder:y,lowerLabel:b,validate:T,handleInput:Y=>{e("input",Y)},handleDatePicker:Y=>{e("input",Y)},handleRightIconClick:()=>{e("right-icon-click")},stringToHTML:Sr,Datepicker:Yn,TIconButton:Lu,TTextInput:Pu,TTypography:dn}}}),vT="";var jy=function(){var e=this,n=e._self._c,i=e._self._setupProxy;return n("div",{staticClass:"t-field"},[e.label?n("label",{staticClass:"t-field__label",attrs:{for:e.id},domProps:{innerHTML:e._s(i.stringToHTML(e.label))}}):e._e(),e.displayInfo?n(i.TTypography,{attrs:{variant:"b3"}},[e._v(" "+e._s(e.value)+" ")]):e.type==="date"?n("div",{staticClass:"t-field__calendar"},[n(i.Datepicker,{staticClass:"date-class",attrs:{value:e.value,"append-to-body":!1,format:"DD/MM/YYYY"},on:{input:i.handleDatePicker}})],1):n("div",{staticClass:"t-field__input"},[n(i.TTextInput,{attrs:{id:e.id,value:e.value,placeholder:i.placeholder,type:e.type,disabled:e.disabled,"right-icon":e.rightIcon,"left-icon":e.leftIcon,"full-width":"",error:i.isError},on:{input:i.handleInput},scopedSlots:e._u([{key:"helperText",fn:function(){return[n("p",{class:["t-field__helper-text",{isError:"t-field--error"}],attrs:{for:e.id},domProps:{innerHTML:e._s(i.lowerLabel)}})]},proxy:!0}])}),e.isExternalId&&e.autocomplete?n(i.TIconButton,{attrs:{icon:"magnifying-glass"},on:{click:i.handleRightIconClick}}):e._e()],1)],1)},zy=[],Wy=Hn(Ny,jy,zy,!1,null,"01281269",null,null);const By=Wy.exports,Yy=v.defineComponent({__name:"FieldsSection",props:{fieldsType:null,title:null,fields:null,autocomplete:{type:Boolean},accounts:null,isMobile:{type:Boolean}},emits:["input","search"],setup(r,{emit:e}){const n=r,i=(b,T)=>{e("input",{id:b,value:T})},s=()=>{e("search")},{shouldShowField:u}=ri(),c=v.computed(()=>n.fields.filter(u)),d=v.computed(()=>{const b={};return c.value.forEach(T=>{b[T.name]=T.value}),b});return{__sfc:!0,props:n,emit:e,handleInput:i,handleRightIconClick:s,shouldShowField:u,fieldsToShow:c,variables:d,getFieldValue:b=>b.displayInfo&&ai(b.value)&&!b.autocompleted?ni(b.value,d.value):b.value,isFieldSearchable:b=>b.isExternalId&&n.autocomplete,retrocompatibleIcon:b=>b==="DollarIcon"?"currency-dollar":b,TTypography:dn,TSelect:Nu,stringToHTML:Sr,CustomField:By}}}),gT="";var Hy=function(){var e=this,n=e._self._c,i=e._self._setupProxy;return n("div",{staticClass:"fields-section"},[e.title?n(i.TTypography,{staticClass:"fields-section__title",attrs:{variant:"s4","font-weight":"semibold"}},[e._v(" "+e._s(e.title)+" ")]):e._e(),n("div",{staticClass:"fields-section__container"},[e._l(i.fieldsToShow,function(s){var u,c;return[e.fieldsType==="invoice"&&s.isAccount?n(i.TSelect,{key:s.id||s.name,attrs:{placeholder:s.placeholder,value:(u=s.value)==null?void 0:u.toString(),"full-width":""},on:{input:d=>i.handleInput(s.id||s.id||s.name,d)},scopedSlots:e._u([{key:"label",fn:function(){return[s.label?n("p",{staticClass:"t-select__label",attrs:{for:s.id||s.name},domProps:{innerHTML:e._s(i.stringToHTML(s.label))}}):e._e()]},proxy:!0},{key:"helperText",fn:function(){return[s.helperText?n("p",{staticClass:"t-select__helper-text",domProps:{innerHTML:e._s(i.stringToHTML(s.helperText))}}):e._e()]},proxy:!0}],null,!0)},e._l(e.accounts,function({id:d,name:m}){return n("option",{key:d,domProps:{value:d}},[e._v(" "+e._s(m)+" ")])}),0):s.defaultOptions!==void 0?n(i.TSelect,{key:s.id||s.name,staticClass:"t-select",attrs:{placeholder:s.placeholder,value:(c=s.value)==null?void 0:c.toString(),"full-width":""},on:{input:d=>i.handleInput(s.id||s.name,d)},scopedSlots:e._u([{key:"label",fn:function(){return[s.label?n("p",{staticClass:"t-select__label",attrs:{for:s.id||s.name},domProps:{innerHTML:e._s(i.stringToHTML(s.label))}}):e._e()]},proxy:!0},{key:"helperText",fn:function(){return[s.helperText?n("p",{staticClass:"t-select__helper-text",domProps:{innerHTML:e._s(i.stringToHTML(s.helperText))}}):e._e()]},proxy:!0}],null,!0)},e._l(s.defaultOptions,function(d){return n("option",{key:d.toString(),domProps:{value:d.toString()}},[e._v(" "+e._s(d)+" ")])}),0):n(i.CustomField,{key:s.name,attrs:{id:s.id||s.name,value:i.getFieldValue(s),type:s.type,label:s.label,placeholder:s.placeholder,decimals:s.decimals,"helper-text":s.helperText,"left-icon":i.retrocompatibleIcon(s.leftIcon),required:s.required,regex:s.regex,"display-info":s.displayInfo,"right-icon":i.isFieldSearchable(s)?"ph:magnifying-glass":void 0,"is-mobile":e.isMobile,autocomplete:i.props.autocomplete,"is-external-id":s.isExternalId},on:{input:d=>i.handleInput(s.id||s.name,d),"right-icon-click":function(d){i.isFieldSearchable(s)&&i.handleRightIconClick()}}})]})],2)],1)},Uy=[],qy=Hn(Yy,Hy,Uy,!1,null,"57cb6298",null,null);const Gy=qy.exports,Zy=v.defineComponent({__name:"TAlertError",props:{fullWidth:{type:Boolean},size:null},setup(r){v.useCssVars((i,s)=>({"6bb31bba":s.error}));const e=Oe(),n=v.computed(()=>e.value.colors.error);return{__sfc:!0,theme:e,error:n,TTypography:dn,TIcon:ti}}}),_T="";var Vy=function(){var e=this,n=e._self._c,i=e._self._setupProxy;return n("div",{class:["t-alert-error",{"t-alert-error--full-width":e.fullWidth}]},[n(i.TIcon,{class:[`t-alert-error__icon--${e.size}`],attrs:{icon:"x-circle",variant:"solid",color:"error"}}),n(i.TTypography,{staticClass:"t-alert-error__text",attrs:{variant:e.size==="small"?"b4":"b3"}},[e._t("default")],2)],1)},Xy=[],Ky=Hn(Zy,Vy,Xy,!1,null,"f5dee371",null,null);const Jy=Ky.exports,Qy=v.defineComponent({__name:"TCustomForm",props:{countryIso:null,accounts:{default:()=>[]},isMobile:{type:Boolean},title:null,layout:{default:"columns"},topSubtitle:null,bottomSubtitle:null,customerFieldsTitle:null,customerFields:{default:()=>[]},invoiceFieldsTitle:null,invoiceFields:{default:()=>[]},enableAutocomplete:{type:Boolean},checkboxes:{default:()=>[]},themeColor:{default:"#5c0087"},loading:{type:Boolean},formLinkLabel:null,disableSubmit:{type:Boolean},buttonLabel:{default:"Registrar"},errorMessage:null},emits:["submit-form-data","reset","autocomplete-subscription","autocomplete-external-id","form-link-clicked"],setup(r,{emit:e}){const n=r;v.useCssVars((B,U)=>({"1ad47e6c":U.grayMain,"310b02aa":U.grayMedium1,ba38aea6:U.grayLight2}));const i=Fu({colors:{primary:{main:n.themeColor}}}),s=Oe(),u=v.computed(()=>s.value.colors.gray.medium1),c=v.computed(()=>s.value.colors.gray.light2),d=v.computed(()=>s.value.colors.gray.main),m=v.ref(n.customerFields),_=v.ref(n.invoiceFields),y=v.ref(n.checkboxes.map(B=>({...B,type:"checkbox"}))),b=v.computed(()=>[...m.value,..._.value,...y.value]),{shouldShowField:T}=ri(b),W=v.computed(()=>y.value.filter(T)),j=(B,U)=>B.type==="number"&&B.decimals?(Math.round(Number(U)*10**B.decimals)/10**B.decimals).toString():U,L=()=>{const B=m.value.find(({isExternalId:U})=>U);e("autocomplete-external-id",B==null?void 0:B.value)},Y=(B,{id:U,value:K})=>{const Re=B.findIndex(rt=>U===rt.id||U===rt.name);if(Re!==-1){const rt=B[Re];Ko(rt)?v.set(rt,"value",K):(v.set(rt,"value",j(rt,K)),rt.name==="product_id"&&n.enableAutocomplete&&e("autocomplete-subscription",K))}},G=()=>{const B={};return b.value.forEach(U=>{T(U)&&(B[U.name]=U.value)}),B},{cleanGovernmentId:ee}=Wu(),Z=()=>{const B=G(),U={additional_data:{},customer_metadata:{},subscription_metadata:{},invoice_metadata:{},checkboxes_values:{}};return b.value.forEach(K=>{if(!(K.relatedField&&!T(K))){if(Ko(K))U.checkboxes_values[K.id]=K.value??!1;else if(K.value){let{value:Re}=K;ai(K.value)&&K.displayInfo&&!K.autocompleted&&(Re=ni(Re,B)),K.name.includes("customer_metadata")?U.customer_metadata[K.name.replace("customer_metadata_","")]=Re:K.name.includes("subscription_metadata")?U.subscription_metadata[K.name.replace("subscription_metadata_","")]=Re:K.name.includes("invoice_metadata")?U.invoice_metadata[K.name.replace("invoice_metadata_","")]=Re:K.name.includes("additional_data")?U.additional_data[K.name.replace("additional_data_","")]=Re:K.name==="government_id"&&n.countryIso==="CL"?U[K.name]=ee(Re,n.countryIso):K.name==="due_date"&&Bu(Re)?U[K.name]=Hu(Re):K.isAccount?U.id_account=Re:U[K.name]=Re}}}),U},ge=()=>{let B=!0;return b.value.forEach(U=>{if(Ko(U))return;const K=U.required&&(U.value===void 0||U.value==="")&&(!U.relatedField||T(U)),Re=U.regex&&!RegExp(U.regex.pattern).test(U.value)&&(!U.relatedField||T(U));(K||Re)&&(B=!1)}),B},he=()=>{if(!ge())return;const U=Z();e("submit-form-data",U)},z=v.ref(null),F=()=>{var B;(B=z.value)==null||B.scrollIntoView({behavior:"smooth"})};return v.watch(n,B=>{m.value=B.customerFields,_.value=B.invoiceFields,B.errorMessage&&F()}),{__sfc:!0,props:n,emit:e,formTheme:i,theme:s,grayMedium1:u,grayLight2:c,grayMain:d,customerFields:m,invoiceFields:_,checkboxes:y,allFields:b,shouldShowField:T,checkboxesToShow:W,formatFieldValue:j,handleSearch:L,handleInput:Y,getVariables:G,cleanGovernmentId:ee,buildSignupRequestBody:Z,validateFormValues:ge,submitForm:he,top:z,scrollToTop:F,TButton:wr,TThemeProvider:Ru,TCheckbox:ju,TTypography:dn,FieldsSection:Gy,TAlertError:Jy}}}),yT="";var e0=function(){var s;var e=this,n=e._self._c,i=e._self._setupProxy;return n(i.TThemeProvider,{attrs:{theme:i.formTheme}},[n("div",{ref:"top",staticClass:"t-custom-form__layout",class:{"t-custom-form__layout--mobile":e.isMobile}},[e.title?n(i.TTypography,{style:{textAlign:"center"},attrs:{variant:"s2","font-weight":"semibold"}},[e._v(" "+e._s(e.title)+" ")]):e._e(),e.topSubtitle?n(i.TTypography,{style:{textAlign:"center"},attrs:{variant:"b2","font-weight":"semibold"}},[e._v(e._s(e.topSubtitle))]):e._e(),e.errorMessage?n(i.TAlertError,{attrs:{size:e.isMobile?"small":"large","full-width":e.isMobile||e.layout==="rows"}},[e._v(e._s(e.errorMessage))]):e._e(),n("div",{class:["t-custom-form__fields-container",e.isMobile?"t-custom-form__fields-container--mobile":"t-custom-form__fields-container--desktop"]},[n("div",{class:["t-custom-form__fields-layout",e.isMobile?"t-custom-form__fields-layout--rows":`t-custom-form__fields-layout--${e.layout}`]},[i.customerFields.length?n(i.FieldsSection,{attrs:{fields:i.customerFields,"fields-type":"customer",title:e.customerFieldsTitle,autocomplete:e.enableAutocomplete,accounts:e.accounts,"is-mobile":e.isMobile},on:{input:u=>i.handleInput(i.customerFields,u),search:i.handleSearch}}):e._e(),i.customerFields.length&&i.invoiceFields.length?n("div",{class:[e.isMobile?"t-custom-form__sepparation-line--rows":`t-custom-form__sepparation-line--${e.layout}`]}):e._e(),i.invoiceFields.length?n(i.FieldsSection,{attrs:{fields:i.invoiceFields,"fields-type":"invoice",title:e.invoiceFieldsTitle,accounts:e.accounts,"is-mobile":e.isMobile},on:{input:u=>i.handleInput(i.invoiceFields,u)}}):e._e()],1),e.formLinkLabel?n(i.TButton,{staticClass:"t-custom-form__link",attrs:{variant:"tertiary"},on:{click:function(u){return i.emit("form-link-clicked")}}},[e._v(e._s(e.formLinkLabel))]):e._e()],1),e.bottomSubtitle?n(i.TTypography,{style:{textAlign:"center"},attrs:{variant:"b2","font-weight":"semibold"}},[e._v(e._s(e.bottomSubtitle))]):e._e(),(s=i.checkboxesToShow)!=null&&s.length?n("div",{staticClass:"t-custom-form__checkboxes"},e._l(i.checkboxesToShow,function(u){return n(i.TCheckbox,{key:u.id,staticClass:"t-custom-form__checkbox",attrs:{"label-position":"right",size:"small",value:u.value},on:{input:c=>i.handleInput(i.checkboxes,{id:u.id,value:c})}},[e._v(" "+e._s(u.label)+" ")])}),1):e._e(),n(i.TButton,{class:{"t-custom-form__submit-button":!e.isMobile},attrs:{size:"medium",disabled:e.disableSubmit,loading:i.props.loading,"full-width":e.isMobile},on:{click:i.submitForm}},[e._v(" "+e._s(e.buttonLabel)+" ")])],1)])},t0=[],n0=Hn(Qy,e0,t0,!1,null,"0cf921f9",null,null);const r0=n0.exports;jn.CustomForm=Py,jn.TCustomForm=r0,Object.defineProperty(jn,Symbol.toStringTag,{value:"Module"})});
209
+ `)])]):e._e(),e._v(" "),i("div",{class:e.prefixClass+"-time-content"},[e.timePickerOptions?i("list-options",{attrs:{date:e.innerValue,"get-classes":e.getClasses,options:e.timePickerOptions,format:e.innerForamt},on:{select:e.handleSelect}}):i("list-columns",e._b({attrs:{date:e.innerValue,"get-classes":e.getClasses,"hour-options":e.hourOptions,"minute-options":e.minuteOptions,"second-options":e.secondOptions,"hour-step":e.hourStep,"minute-step":e.minuteStep,"second-step":e.secondStep,"scroll-duration":e.scrollDuration},on:{select:e.handleSelect}},"list-columns",e.ShowHourMinuteSecondAMPM,!1))],1)])},fy=[],dy=void 0,py=void 0,hy=void 0,my=!1,Bn=Lt({render:cy,staticRenderFns:fy},dy,uy,py,my,hy,!1,void 0,void 0,void 0),va={name:"TimeRange",inject:{prefixClass:{default:"mx"}},props:Ee({},Bn.props),data:function(){return{startValue:new Date(NaN),endValue:new Date(NaN)}},watch:{value:{immediate:!0,handler:function(){if(pi(this.value)){var e=da(this.value,2),n=e[0],i=e[1];this.startValue=n,this.endValue=i}else this.startValue=new Date(NaN),this.endValue=new Date(NaN)}}},methods:{emitChange:function(e,n){var i=[this.startValue,this.endValue];this.$emit("select",i,e==="time"?"time-range":e,n)},handleSelectStart:function(e,n){this.startValue=e,this.endValue.getTime()>=e.getTime()||(this.endValue=e),this.emitChange(n,0)},handleSelectEnd:function(e,n){this.endValue=e,this.startValue.getTime()<=e.getTime()||(this.startValue=e),this.emitChange(n,1)},disabledStartTime:function(e){return this.disabledTime(e,0)},disabledEndTime:function(e){return e.getTime()<this.startValue.getTime()||this.disabledTime(e,1)}},render:function(){var e=arguments[0],n=Array.isArray(this.defaultValue)?this.defaultValue:[this.defaultValue,this.defaultValue],i=this.prefixClass;return e("div",{class:"".concat(i,"-range-wrapper")},[e(Bn,{props:Ee({},Ee({},this.$props,{value:this.startValue,defaultValue:n[0],disabledTime:this.disabledStartTime})),on:Ee({},Ee({},this.$listeners,{select:this.handleSelectStart}))}),e(Bn,{props:Ee({},Ee({},this.$props,{value:this.endValue,defaultValue:n[1],disabledTime:this.disabledEndTime})),on:Ee({},Ee({},this.$listeners,{select:this.handleSelectEnd}))})])}},_s={name:"DatetimePanel",inject:{prefixClass:{default:"mx"}},emits:["select","update:show-time-panel"],props:Ee({},or.props,{},Bn.props,{showTimePanel:{type:Boolean,default:void 0}}),data:function(){return{defaultTimeVisible:!1,currentValue:this.value}},computed:{timeVisible:function(){return typeof this.showTimePanel=="boolean"?this.showTimePanel:this.defaultTimeVisible}},watch:{value:function(e){this.currentValue=e}},methods:{closeTimePanel:function(){this.defaultTimeVisible=!1,this.$emit("update:show-time-panel",!1)},openTimePanel:function(){this.defaultTimeVisible=!0,this.$emit("update:show-time-panel",!0)},emitDate:function(e,n){this.$emit("select",e,n)},handleSelect:function(e,n){n==="date"&&this.openTimePanel();var i=hi(e,Tr(this.value,this.defaultValue));if(this.disabledTime(new Date(i))&&(i=hi(e,this.defaultValue),this.disabledTime(new Date(i)))){this.currentValue=i;return}this.emitDate(i,n)}},render:function(){var e=arguments[0],n={props:Ee({},Dr(this.$props,Object.keys(or.props)),{type:"date",value:this.currentValue}),on:{select:this.handleSelect}},i={props:Ee({},Dr(this.$props,Object.keys(Bn.props)),{showTimeHeader:!0,value:this.currentValue}),on:{select:this.emitDate,clicktitle:this.closeTimePanel}},s=this.prefixClass;return e("div",[e(or,pa([{},n])),this.timeVisible&&e(Bn,pa([{class:"".concat(s,"-calendar-time")},i]))])}},Cc={name:"DatetimeRange",inject:{prefixClass:{default:"mx"}},emits:["select","update:show-time-panel"],props:Ee({},ma.props,{},va.props,{showTimePanel:{type:Boolean,default:void 0}}),data:function(){return{defaultTimeVisible:!1,currentValue:this.value}},computed:{timeVisible:function(){return typeof this.showTimePanel=="boolean"?this.showTimePanel:this.defaultTimeVisible}},watch:{value:function(e){this.currentValue=e}},methods:{closeTimePanel:function(){this.defaultTimeVisible=!1,this.$emit("update:show-time-panel",!1)},openTimePanel:function(){this.defaultTimeVisible=!0,this.$emit("update:show-time-panel",!0)},emitDate:function(e,n){this.$emit("select",e,n)},handleSelect:function(e,n){var i=this;n==="date"&&this.openTimePanel();var s=Array.isArray(this.defaultValue)?this.defaultValue:[this.defaultValue,this.defaultValue],u=e.map(function(c,d){var m=pi(i.value)?i.value[d]:s[d];return hi(c,m)});if(u[1].getTime()<u[0].getTime()&&(u=[u[0],u[0]]),u.some(this.disabledTime)&&(u=e.map(function(c,d){return hi(c,s[d])}),u.some(this.disabledTime))){this.currentValue=u;return}this.emitDate(u,n)}},render:function(){var e=arguments[0],n={props:Ee({},Dr(this.$props,Object.keys(ma.props)),{type:"date",value:this.currentValue}),on:{select:this.handleSelect}},i={props:Ee({},Dr(this.$props,Object.keys(va.props)),{value:this.currentValue,showTimeHeader:!0}),on:{select:this.emitDate,clicktitle:this.closeTimePanel}},s=this.prefixClass;return e("div",[e(ma,pa([{},n])),this.timeVisible&&e(va,pa([{class:"".concat(s,"-calendar-time")},i]))])}},vy={default:or,time:Bn,datetime:_s},gy={default:ma,time:va,datetime:Cc},Yn={name:"DatePicker",provide:function(){var e=this;return{getLocale:function(){return e.locale},getWeek:this.getWeek,prefixClass:this.prefixClass,dispatchDatePicker:this.$emit.bind(this)}},props:Ee({},_s.props,{value:{},valueType:{type:String,default:"date"},type:{type:String,default:"date"},format:{type:String},formatter:{type:Object},range:{type:Boolean,default:!1},multiple:{type:Boolean,default:!1},rangeSeparator:{type:String},lang:{type:[String,Object]},placeholder:{type:String,default:""},editable:{type:Boolean,default:!0},disabled:{type:Boolean,default:!1},clearable:{type:Boolean,default:!0},prefixClass:{type:String,default:"mx"},inputClass:{},inputAttr:{type:Object,default:function(){return{}}},appendToBody:{type:Boolean,default:!0},open:{type:Boolean,default:void 0},popupClass:{},popupStyle:{type:Object,default:function(){return{}}},inline:{type:Boolean,default:!1},confirm:{type:Boolean,default:!1},confirmText:{type:String,default:"OK"},renderInputText:{type:Function},shortcuts:{type:Array,validator:function(e){return Array.isArray(e)&&e.every(function(n){return pn(n)&&typeof n.text=="string"&&typeof n.onClick=="function"})},default:function(){return[]}}}),data:function(){return{currentValue:null,userInput:null,defaultOpen:!1,mouseInInput:!1}},computed:{popupVisible:function(){return!this.disabled&&(typeof this.open=="boolean"?this.open:this.defaultOpen)},innerRangeSeparator:function(){return this.rangeSeparator||(this.multiple?",":" ~ ")},innerFormat:function(){var e={date:"YYYY-MM-DD",datetime:"YYYY-MM-DD HH:mm:ss",year:"YYYY",month:"YYYY-MM",time:"HH:mm:ss",week:"w"};return this.format||e[this.type]||e.date},innerValue:function(){var e=this.value;return this.validMultipleType?(e=Array.isArray(e)?e:[],e.map(this.value2date)):this.range?(e=Array.isArray(e)?e.slice(0,2):[null,null],e.map(this.value2date)):this.value2date(e)},text:function(){var e=this;return this.userInput!==null?this.userInput:typeof this.renderInputText=="function"?this.renderInputText(this.innerValue):this.isValidValue(this.innerValue)?Array.isArray(this.innerValue)?this.innerValue.map(function(n){return e.formatDate(n)}).join(this.innerRangeSeparator):this.formatDate(this.innerValue):""},showClearIcon:function(){return!this.disabled&&this.clearable&&this.text&&this.mouseInInput},locale:function(){return pn(this.lang)?wc($r(),this.lang):$r(this.lang)},validMultipleType:function(){var e=["date","month","year"];return this.multiple&&!this.range&&e.indexOf(this.type)!==-1}},watch:{innerValue:{immediate:!0,handler:function(e){this.currentValue=e}},popupVisible:{handler:function(e){e&&(this.currentValue=this.innerValue)}}},created:function(){di(this.format)==="object"&&console.warn("[vue2-datepicker]: The prop `format` don't support Object any more. You can use the new prop `formatter` to replace it")},methods:{handleMouseEnter:function(){this.mouseInInput=!0},handleMouseLeave:function(){this.mouseInInput=!1},handleClickOutSide:function(e){var n=e.target;this.$el.contains(n)||this.closePopup()},getFormatter:function(e){return pn(this.formatter)&&this.formatter[e]||pn(this.format)&&this.format[e]},getWeek:function(e,n){return typeof this.getFormatter("getWeek")=="function"?this.getFormatter("getWeek")(e,n):os(e,n)},parseDate:function(e,n){if(n=n||this.innerFormat,typeof this.getFormatter("parse")=="function")return this.getFormatter("parse")(e,n);var i=new Date;return Jv(e,n,{locale:this.locale.formatLocale,backupDate:i})},formatDate:function(e,n){return n=n||this.innerFormat,typeof this.getFormatter("stringify")=="function"?this.getFormatter("stringify")(e,n):ci(e,n,{locale:this.locale.formatLocale})},value2date:function(e){switch(this.valueType){case"date":return e instanceof Date?new Date(e.getTime()):new Date(NaN);case"timestamp":return typeof e=="number"?new Date(e):new Date(NaN);case"format":return typeof e=="string"?this.parseDate(e):new Date(NaN);default:return typeof e=="string"?this.parseDate(e,this.valueType):new Date(NaN)}},date2value:function(e){if(!wn(e))return null;switch(this.valueType){case"date":return e;case"timestamp":return e.getTime();case"format":return this.formatDate(e);default:return this.formatDate(e,this.valueType)}},emitValue:function(e,n){var i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;this.userInput=null;var s=Array.isArray(e)?e.map(this.date2value):this.date2value(e);return this.$emit("input",s),this.$emit("change",s,n),i&&this.closePopup(),s},isValidValue:function(e){return this.validMultipleType?cg(e):this.range?pi(e):wn(e)},isValidValueAndNotDisabled:function(e){if(!this.isValidValue(e))return!1;var n=typeof this.disabledDate=="function"?this.disabledDate:function(){return!1},i=typeof this.disabledTime=="function"?this.disabledTime:function(){return!1};return Array.isArray(e)||(e=[e]),e.every(function(s){return!n(s)&&!i(s)})},handleMultipleDates:function(e,n){if(this.validMultipleType&&n){var i=n.filter(function(s){return s.getTime()!==e.getTime()});return i.length===n.length&&i.push(e),i}return e},handleSelectDate:function(e,n,i){e=this.handleMultipleDates(e,i),this.confirm?this.currentValue=e:this.emitValue(e,n,!this.validMultipleType&&(n===this.type||n==="time"))},clear:function(){this.emitValue(this.range?[null,null]:null),this.$emit("clear")},handleClear:function(e){e.stopPropagation(),this.clear()},handleConfirmDate:function(){var e=this.emitValue(this.currentValue);this.$emit("confirm",e)},handleSelectShortcut:function(e){var n=e.currentTarget.getAttribute("data-index"),i=this.shortcuts[parseInt(n,10)];if(pn(i)&&typeof i.onClick=="function"){var s=i.onClick(this);s&&this.emitValue(s)}},openPopup:function(e){this.popupVisible||this.disabled||(this.defaultOpen=!0,this.$emit("open",e),this.$emit("update:open",!0))},closePopup:function(){this.popupVisible&&(this.defaultOpen=!1,this.$emit("close"),this.$emit("update:open",!1))},blur:function(){this.$refs.input&&this.$refs.input.blur()},focus:function(){this.$refs.input&&this.$refs.input.focus()},handleInputChange:function(){var e=this;if(!(!this.editable||this.userInput===null)){var n=this.userInput.trim();if(this.userInput=null,n===""){this.clear();return}var i;if(this.validMultipleType)i=n.split(this.innerRangeSeparator).map(function(u){return e.parseDate(u.trim())});else if(this.range){var s=n.split(this.innerRangeSeparator);s.length!==2&&(s=n.split(this.innerRangeSeparator.trim())),i=s.map(function(u){return e.parseDate(u.trim())})}else i=this.parseDate(n);this.isValidValueAndNotDisabled(i)?(this.emitValue(i),this.blur()):this.$emit("input-error",n)}},handleInputInput:function(e){this.userInput=typeof e=="string"?e:e.target.value},handleInputKeydown:function(e){var n=e.keyCode;n===9?this.closePopup():n===13&&this.handleInputChange()},handleInputBlur:function(e){this.$emit("blur",e)},handleInputFocus:function(e){this.openPopup(e),this.$emit("focus",e)},hasSlot:function(e){return!!(this.$slots[e]||this.$scopedSlots[e])},renderSlot:function(e,n,i){var s=this.$scopedSlots[e];return s?s(i)||n:this.$slots[e]||n},renderInput:function(){var e=this.$createElement,n=this.prefixClass,i=Ee({name:"date",type:"text",autocomplete:"off",value:this.text,class:this.inputClass||"".concat(this.prefixClass,"-input"),readonly:!this.editable,disabled:this.disabled,placeholder:this.placeholder},this.inputAttr),s=i.value,u=i.class,c=eg(i,["value","class"]),d={keydown:this.handleInputKeydown,focus:this.handleInputFocus,blur:this.handleInputBlur,input:this.handleInputInput,change:this.handleInputChange},m=this.renderSlot("input",e("input",{domProps:{value:s},class:u,attrs:Ee({},c),on:Ee({},d),ref:"input"}),{props:i,events:d}),_=this.type==="time"?e(Hg):e(Pg);return e("div",{class:"".concat(n,"-input-wrapper"),on:{mouseenter:this.handleMouseEnter,mouseleave:this.handleMouseLeave,click:this.openPopup},ref:"inputWrapper"},[m,this.showClearIcon?e("i",{class:"".concat(n,"-icon-clear"),on:{click:this.handleClear}},[this.renderSlot("icon-clear",e(Kg))]):e("i",{class:"".concat(n,"-icon-calendar")},[this.renderSlot("icon-calendar",_)])])},renderContent:function(){var e=this.$createElement,n=this.range?gy:vy,i=n[this.type]||n.default,s=Ee({},Dr(this.$props,Object.keys(i.props)),{value:this.currentValue}),u=Ee({},Dr(this.$listeners,i.emits||[]),{select:this.handleSelectDate}),c=e(i,pa([{},{props:s,on:u,ref:"picker"}]));return e("div",{class:"".concat(this.prefixClass,"-datepicker-body")},[this.renderSlot("content",c,{value:this.currentValue,emit:this.handleSelectDate})])},renderSidebar:function(){var e=this,n=this.$createElement,i=this.prefixClass;return n("div",{class:"".concat(i,"-datepicker-sidebar")},[this.renderSlot("sidebar",null,{value:this.currentValue,emit:this.handleSelectDate}),this.shortcuts.map(function(s,u){return n("button",{key:u,attrs:{"data-index":u,type:"button"},class:"".concat(i,"-btn ").concat(i,"-btn-text ").concat(i,"-btn-shortcut"),on:{click:e.handleSelectShortcut}},[s.text])})])},renderHeader:function(){var e=this.$createElement;return e("div",{class:"".concat(this.prefixClass,"-datepicker-header")},[this.renderSlot("header",null,{value:this.currentValue,emit:this.handleSelectDate})])},renderFooter:function(){var e=this.$createElement,n=this.prefixClass;return e("div",{class:"".concat(n,"-datepicker-footer")},[this.renderSlot("footer",null,{value:this.currentValue,emit:this.handleSelectDate}),this.confirm?e("button",{attrs:{type:"button"},class:"".concat(n,"-btn ").concat(n,"-datepicker-btn-confirm"),on:{click:this.handleConfirmDate}},[this.confirmText]):null])}},render:function(){var e,n=arguments[0],i=this.prefixClass,s=this.inline,u=this.disabled,c=this.hasSlot("sidebar")||this.shortcuts.length?this.renderSidebar():null,d=n("div",{class:"".concat(i,"-datepicker-content")},[this.hasSlot("header")?this.renderHeader():null,this.renderContent(),this.hasSlot("footer")||this.confirm?this.renderFooter():null]);return n("div",{class:(e={},ir(e,"".concat(i,"-datepicker"),!0),ir(e,"".concat(i,"-datepicker-range"),this.range),ir(e,"".concat(i,"-datepicker-inline"),s),ir(e,"disabled",u),e)},[s?null:this.renderInput(),s?n("div",{class:"".concat(i,"-datepicker-main")},[c,d]):n(Ag,{ref:"popup",class:this.popupClass,style:this.popupStyle,attrs:{visible:this.popupVisible,appendToBody:this.appendToBody},on:{clickoutside:this.handleClickOutSide}},[c,d])])}};Yn.locale=xc,Yn.install=function(e){e.component(Yn.name,Yn)},typeof window<"u"&&window.Vue&&Yn.install(window.Vue),us(Yn,{CalendarPanel:or,CalendarRange:ma,TimePanel:Bn,TimeRange:va,DatetimePanel:_s,DatetimeRange:Cc});const cT="",_y=v.defineComponent({__name:"SignupField",props:{id:null,value:null,label:null,disabled:{type:Boolean},displayInfo:{type:Boolean},type:null,decimals:null,leftIcon:null,rightIcon:null,placeholder:null,helperText:null,errorText:null,required:{type:Boolean},regex:null,isMobile:{type:Boolean},autocomplete:{type:Boolean},isExternalId:{type:Boolean}},emits:["input","right-icon-click"],setup(r,{emit:e}){const n=r,i=v.ref(!1),s=v.ref(!1),u=v.computed(()=>{var j;return s.value?"Obligatorio":n.errorText||((j=n.regex)==null?void 0:j.message)}),c=v.computed(()=>n.placeholder||""),d=v.computed(()=>i.value?u.value:Sr(n.helperText)),m=v.computed(()=>{let j="";return i.value&&(j+=" input-error"),j}),_=v.computed(()=>{let j="t-field__helper-text";return i.value&&(j+=" error"),j}),y=()=>{n.regex&&typeof n.value=="string"?i.value=!RegExp(n.regex.pattern).test(n.value):n.required&&(i.value=!n.value,s.value=!n.value)};return v.watch(()=>n.value,y),{__sfc:!0,props:n,emits:e,isError:i,displayRequired:s,errorText:u,placeholder:c,lowerLabel:d,inputClass:m,lowerLabelClass:_,validate:y,handleInput:j=>{e("input",j)},handleDatePicker:j=>{e("input",j)},handleRightIconClick:()=>{e("right-icon-click")},stringToHTML:Sr,Datepicker:Yn,TIconButton:Lu,TTextInput:Pu,TTypography:dn}}}),fT="";function Hn(r,e,n,i,s,u,c,d){var m=typeof r=="function"?r.options:r;e&&(m.render=e,m.staticRenderFns=n,m._compiled=!0),i&&(m.functional=!0),u&&(m._scopeId="data-v-"+u);var _;if(c?(_=function(T){T=T||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext,!T&&typeof __VUE_SSR_CONTEXT__<"u"&&(T=__VUE_SSR_CONTEXT__),s&&s.call(this,T),T&&T._registeredComponents&&T._registeredComponents.add(c)},m._ssrRegister=_):s&&(_=d?function(){s.call(this,(m.functional?this.parent:this).$root.$options.shadowRoot)}:s),_)if(m.functional){m._injectStyles=_;var y=m.render;m.render=function(W,j){return _.call(j),y(W,j)}}else{var b=m.beforeCreate;m.beforeCreate=b?[].concat(b,_):[_]}return{exports:r,options:m}}var yy=function(){var e=this,n=e._self._c,i=e._self._setupProxy;return n("div",{staticClass:"t-field"},[e.label?n("label",{staticClass:"t-field__label",attrs:{for:e.id},domProps:{innerHTML:e._s(i.stringToHTML(e.label))}}):e._e(),e.displayInfo?n(i.TTypography,{attrs:{variant:"b3"}},[e._v(" "+e._s(e.value)+" ")]):e.type==="date"?n("div",{staticClass:"t-field__calendar"},[n(i.Datepicker,{staticClass:"date-class",attrs:{value:e.value,"append-to-body":!1,format:"DD/MM/YYYY"},on:{input:i.handleDatePicker}})],1):n("div",{staticClass:"t-field__input"},[n(i.TTextInput,{class:i.inputClass,attrs:{id:e.id,value:e.value,placeholder:i.placeholder,type:e.type,disabled:e.disabled,"right-icon":e.rightIcon,"left-icon":e.leftIcon,"full-width":"",error:i.isError},on:{input:i.handleInput},scopedSlots:e._u([{key:"helperText",fn:function(){return[n("p",{class:i.lowerLabelClass,attrs:{for:e.id},domProps:{innerHTML:e._s(i.lowerLabel)}})]},proxy:!0}])}),e.isExternalId&&e.autocomplete?n(i.TIconButton,{attrs:{icon:"magnifying-glass"},on:{click:i.handleRightIconClick}}):e._e()],1)],1)},by=[],wy=Hn(_y,yy,by,!1,null,"eb6b377b",null,null);const xy=wy.exports,Sy=v.defineComponent({__name:"SignupFields",props:{fieldsType:null,title:null,fields:null,autocomplete:{type:Boolean},accounts:null,isMobile:{type:Boolean}},emits:["input","search"],setup(r,{emit:e}){const n=r,i=(b,T)=>{e("input",{id:b,value:T})},{shouldShowField:s}=ri(),u=v.computed(()=>n.fields.filter(s)),c=v.computed(()=>{const b={};return u.value.forEach(T=>{b[T.name]=T.value}),b});return{__sfc:!0,props:n,emit:e,handleInput:i,shouldShowField:s,fieldsToShow:u,variables:c,getFieldValue:b=>b.displayInfo&&ai(b.value)&&!b.autocompleted?ni(b.value,c.value):b.value,isFieldSearchable:b=>b.isExternalId&&n.autocomplete,handleRightIconClick:()=>{e("search")},retrocompatibleIcon:b=>b==="DollarIcon"?"currency-dollar":b,TTypography:dn,TSelect:Nu,stringToHTML:Sr,SignupFieldComponent:xy}}}),dT="";var Cy=function(){var e=this,n=e._self._c,i=e._self._setupProxy;return n("div",{staticClass:"fields"},[n(i.TTypography,{attrs:{variant:"s2","font-weight":"medium"}},[e._v(" "+e._s(e.title)+" ")]),e._l(i.fieldsToShow,function(s){var u,c;return[e.fieldsType==="invoice"&&s.isAccount?n(i.TSelect,{key:s.id||s.name,staticClass:"t-select",attrs:{placeholder:s.placeholder,value:(u=s.value)==null?void 0:u.toString(),"full-width":""},on:{input:d=>i.handleInput(s.id||s.id||s.name,d)},scopedSlots:e._u([{key:"label",fn:function(){return[s.label?n("label",{staticClass:"t-select__label",attrs:{for:s.id||s.name},domProps:{innerHTML:e._s(i.stringToHTML(s.label))}}):e._e()]},proxy:!0},{key:"helperText",fn:function(){return[s.helperText?n("p",{staticClass:"t-select__helper-text",domProps:{innerHTML:e._s(i.stringToHTML(s.helperText))}}):e._e()]},proxy:!0}],null,!0)},e._l(e.accounts,function({id:d,name:m}){return n("option",{key:d,domProps:{value:d}},[e._v(" "+e._s(m)+" ")])}),0):s.defaultOptions!==void 0?n(i.TSelect,{key:s.id||s.name,staticClass:"t-select",attrs:{placeholder:s.placeholder,value:(c=s.value)==null?void 0:c.toString(),"full-width":""},on:{input:d=>i.handleInput(s.id||s.name,d)},scopedSlots:e._u([{key:"label",fn:function(){return[s.label?n("label",{staticClass:"t-select__label",attrs:{for:s.id||s.name},domProps:{innerHTML:e._s(i.stringToHTML(s.label))}}):e._e()]},proxy:!0},{key:"helperText",fn:function(){return[s.helperText?n("p",{staticClass:"t-select__helper-text",domProps:{innerHTML:e._s(i.stringToHTML(s.helperText))}}):e._e()]},proxy:!0}],null,!0)},e._l(s.defaultOptions,function(d){return n("option",{key:d.toString(),domProps:{value:d.toString()}},[e._v(" "+e._s(d)+" ")])}),0):n(i.SignupFieldComponent,{key:s.name,attrs:{id:s.id||s.name,value:i.getFieldValue(s),type:s.type,label:s.label,placeholder:s.placeholder,decimals:s.decimals,"helper-text":s.helperText,"left-icon":i.retrocompatibleIcon(s.leftIcon),required:s.required,regex:s.regex,"display-info":s.displayInfo,"right-icon":i.isFieldSearchable(s)?"ph:magnifying-glass":void 0,"is-mobile":e.isMobile,autocomplete:i.props.autocomplete,"is-external-id":s.isExternalId},on:{input:d=>i.handleInput(s.id||s.name,d),"right-icon-click":function(d){i.isFieldSearchable(s)&&i.handleRightIconClick()}}})]})],2)},Ty=[],ky=Hn(Sy,Cy,Ty,!1,null,"69401ded",null,null);const Dy=ky.exports,Ey=v.defineComponent({__name:"SignupCompleted",props:{type:{default:"success"},errorMessage:null,errorButtonLabel:null,successMessage:null,successButtonLabel:null},emits:["reset"],setup(r){const e=r,n=v.computed(()=>e.type==="error"?e.errorMessage:e.successMessage),i=v.computed(()=>e.type==="error"?e.errorButtonLabel:e.successButtonLabel);return{__sfc:!0,props:e,message:n,buttonText:i,TButton:wr,TTypography:dn}}}),pT="";var $y=function(){var e=this,n=e._self._c,i=e._self._setupProxy;return n("div",{staticClass:"success-form"},[n(i.TTypography,{attrs:{variant:"h1"}},[e._v(" "+e._s(i.message)+" ")]),n(i.TButton,{attrs:{variant:"secondary"},on:{click:function(s){return e.$emit("reset")}}},[e._v(" "+e._s(i.buttonText)+" ")])],1)},Ay=[],Iy=Hn(Ey,$y,Ay,!1,null,"dd9e3f67",null,null);const My=Iy.exports,hT="",Fy=v.defineComponent({__name:"CustomForm",props:{customerFields:null,invoiceFields:null,countryIso:null,isLoading:{type:Boolean},submitFormStatus:null,signupCompleted:{type:Boolean,default:!1},isAutocompleteEnabled:{type:Boolean},accounts:null,disableSubmit:{type:Boolean,default:!1},showSendByEmail:{type:Boolean,default:!1},invoiceFieldsTitle:{default:"Plan de pagos"},customerFieldsTitle:{default:"Información Cliente"},buttonLabel:{default:"Registrar"},sendByEmailText:{default:"Enviar información a correo electrónico"},errorMessage:{default:"Error en la creación"},errorButtonLabel:{default:"Intentar nuevamente"},successMessage:{default:"Inscripción exitosa"},successButtonLabel:{default:"Registrar nuevo cliente"},isMobile:{type:Boolean,default:!1},buttonColor:{default:"#5c0087"}},emits:["submit-form-data","reset","autocomplete-subscription","autocomplete-external-id"],setup(r,{emit:e}){const n=r,i=v.ref(n.customerFields),s=v.ref(n.invoiceFields),u=v.ref(n.isLoading),c=v.ref(n.submitFormStatus),d=v.ref(n.signupCompleted),m=v.ref(n.errorMessage),_=v.ref(n.isAutocompleteEnabled),y=v.ref(!n.showSendByEmail),b=v.computed(()=>[...i.value,...s.value]),{shouldShowField:T}=ri(b),{cleanGovernmentId:W}=Wu(),j=Fu({colors:{primary:{main:n.buttonColor}}});v.watch(n,z=>{i.value=z.customerFields,s.value=z.invoiceFields,u.value=z.isLoading,c.value=z.submitFormStatus,d.value=z.signupCompleted,m.value=z.errorMessage,_.value=z.isAutocompleteEnabled});const L=(z,F)=>z.type==="number"&&z.decimals?(Math.round(Number(F)*10**z.decimals)/10**z.decimals).toString():F,Y=()=>{const z=i.value.find(({isExternalId:F})=>F);e("autocomplete-external-id",z==null?void 0:z.value)},G=(z,{id:F,value:B})=>{const U=z.findIndex(K=>F===K.id||F===K.name);if(U!==-1){const K=z[U];v.set(K,"value",L(K,B)),K.name==="product_id"&&_.value&&e("autocomplete-subscription",B)}},ee=()=>{const z={};return b.value.forEach(F=>{T(F)&&(z[F.name]=F.value)}),z},Z=()=>{const z=ee(),F={additional_data:{},customer_metadata:{},subscription_metadata:{},invoice_metadata:{},send_mail:y.value};return b.value.forEach(B=>{if(B.value){if(B.relatedField&&!T(B))return;let{value:U}=B;B.displayInfo&&ai(B.value)&&!B.autocompleted&&(U=ni(U,z)),B.name.includes("customer_metadata")?F.customer_metadata[B.name.replace("customer_metadata_","")]=U:B.name.includes("subscription_metadata")?F.subscription_metadata[B.name.replace("subscription_metadata_","")]=U:B.name.includes("invoice_metadata")?F.invoice_metadata[B.name.replace("invoice_metadata_","")]=U:B.name.includes("additional_data")?F.additional_data[B.name.replace("additional_data_","")]=U:B.name==="government_id"&&n.countryIso==="CL"?F[B.name]=W(U,n.countryIso):B.name==="due_date"&&Bu(U)?F[B.name]=Hu(U):B.isAccount?F.id_account=U:F[B.name]=U}}),F},ge=()=>{let z=!0;return b.value.forEach(F=>{const B=F.required&&(F.value===void 0||F.value==="")&&(!F.relatedField||T(F)),U=F.regex&&!RegExp(F.regex.pattern).test(F.value)&&(!F.relatedField||T(F));(B||U)&&(z=!1)}),z};return{__sfc:!0,props:n,emit:e,customerFields:i,invoiceFields:s,isLoading:u,submitFormStatus:c,signupCompleted:d,errorMessage:m,isAutocompleteEnabled:_,sendEmail:y,allFields:b,shouldShowField:T,cleanGovernmentId:W,theme:j,formatFieldValue:L,handleSearch:Y,handleInput:G,getVariables:ee,buildSignupRequestBody:Z,validateFormValues:ge,submitForm:()=>{if(!ge())return;const F=Z();e("submit-form-data",F)},TButton:wr,TThemeProvider:Ru,TCheckbox:ju,SignupFields:Dy,SignupCompleted:My}}}),mT="";var Oy=function(){var e=this,n=e._self._c,i=e._self._setupProxy;return n(i.TThemeProvider,{attrs:{theme:i.theme}},[n("main",[n("transition",{attrs:{name:"slide-fade",mode:"out-in"}},[i.signupCompleted?n(i.SignupCompleted,{attrs:{type:i.submitFormStatus,"error-message":i.errorMessage,"error-button-label":e.errorButtonLabel,"success-message":e.successMessage,"success-button-label":e.successButtonLabel},on:{reset:function(s){return i.emit("reset")}}}):n("div",{staticClass:"custom-form__container"},[n("div",{staticClass:"custom-form__fields",class:[e.isMobile?"custom-form__fields--rows":"custom-form__fields--columns"]},[i.customerFields.length?n(i.SignupFields,{attrs:{fields:i.customerFields,"fields-type":"customer",title:e.customerFieldsTitle,autocomplete:i.isAutocompleteEnabled,accounts:e.accounts,"is-mobile":e.isMobile},on:{input:s=>i.handleInput(i.customerFields,s),search:i.handleSearch}}):e._e(),i.invoiceFields.length?n(i.SignupFields,{attrs:{fields:i.invoiceFields,"fields-type":"invoice",title:e.invoiceFieldsTitle,accounts:e.accounts,"is-mobile":e.isMobile},on:{input:s=>i.handleInput(i.invoiceFields,s)}}):e._e()],1),n(i.TCheckbox,{attrs:{"label-position":"right",size:"small",id:"send_email"},model:{value:i.sendEmail,callback:function(s){i.sendEmail=s},expression:"sendEmail"}},[e._v(" "+e._s(e.sendByEmailText)+" ")]),n(i.TButton,{attrs:{disabled:e.disableSubmit,size:"large",loading:i.isLoading,"full-width":e.isMobile},on:{click:i.submitForm}},[e._v(" "+e._s(e.buttonLabel)+" ")])],1)],1)],1)])},Ry=[],Ly=Hn(Fy,Oy,Ry,!1,null,"3c8a08d8",null,null);const Py=Ly.exports,Ny=v.defineComponent({__name:"CustomField",props:{id:null,value:null,label:null,disabled:{type:Boolean},displayInfo:{type:Boolean},type:null,decimals:null,leftIcon:null,rightIcon:null,placeholder:null,helperText:null,errorText:null,required:{type:Boolean},regex:null,isMobile:{type:Boolean},autocomplete:{type:Boolean},isExternalId:{type:Boolean}},emits:["input","right-icon-click"],setup(r,{emit:e}){const n=r;v.useCssVars((Y,G)=>({"5598dcdd":G.grayMain,"0e5a85b8":G.grayMedium1,"4aae2b87":G.error}));const i=Oe(),s=v.computed(()=>i.value.colors.error),u=v.computed(()=>i.value.colors.gray.main),c=v.computed(()=>i.value.colors.gray.medium1),d=v.ref(!1),m=v.ref(!1),_=v.computed(()=>{var Y;return m.value?"Obligatorio":n.errorText??((Y=n.regex)==null?void 0:Y.message)}),y=v.computed(()=>n.placeholder||""),b=v.computed(()=>d.value?_.value:Sr(n.helperText)),T=()=>{n.regex&&typeof n.value=="string"?d.value=!RegExp(n.regex.pattern).test(n.value):n.required&&(d.value=!n.value,m.value=!n.value)};return v.watch(()=>n.value,T),{__sfc:!0,props:n,emits:e,theme:i,error:s,grayMain:u,grayMedium1:c,isError:d,displayRequired:m,errorText:_,placeholder:y,lowerLabel:b,validate:T,handleInput:Y=>{e("input",Y)},handleDatePicker:Y=>{e("input",Y)},handleRightIconClick:()=>{e("right-icon-click")},stringToHTML:Sr,Datepicker:Yn,TIconButton:Lu,TTextInput:Pu,TTypography:dn}}}),vT="";var jy=function(){var e=this,n=e._self._c,i=e._self._setupProxy;return n("div",{staticClass:"t-field"},[e.label?n("label",{staticClass:"t-field__label",attrs:{for:e.id},domProps:{innerHTML:e._s(i.stringToHTML(e.label))}}):e._e(),e.displayInfo?n(i.TTypography,{attrs:{variant:"b3"}},[e._v(" "+e._s(e.value)+" ")]):e.type==="date"?n("div",{staticClass:"t-field__calendar"},[n(i.Datepicker,{staticClass:"date-class",attrs:{value:e.value,"append-to-body":!1,format:"DD/MM/YYYY"},on:{input:i.handleDatePicker}})],1):n("div",{staticClass:"t-field__input"},[n(i.TTextInput,{attrs:{id:e.id,value:e.value,placeholder:i.placeholder,type:e.type,disabled:e.disabled,"right-icon":e.rightIcon,"left-icon":e.leftIcon,"full-width":"",error:i.isError},on:{input:i.handleInput},scopedSlots:e._u([{key:"helperText",fn:function(){return[n("p",{class:["t-field__helper-text",{isError:"t-field--error"}],attrs:{for:e.id},domProps:{innerHTML:e._s(i.lowerLabel)}})]},proxy:!0}])}),e.isExternalId&&e.autocomplete?n(i.TIconButton,{attrs:{icon:"magnifying-glass"},on:{click:i.handleRightIconClick}}):e._e()],1)],1)},zy=[],Wy=Hn(Ny,jy,zy,!1,null,"01281269",null,null);const By=Wy.exports,Yy=v.defineComponent({__name:"FieldsSection",props:{fieldsType:null,title:null,fields:null,autocomplete:{type:Boolean},accounts:null,isMobile:{type:Boolean}},emits:["input","search"],setup(r,{emit:e}){const n=r,i=(b,T)=>{e("input",{id:b,value:T})},s=()=>{e("search")},{shouldShowField:u}=ri(),c=v.computed(()=>n.fields.filter(u)),d=v.computed(()=>{const b={};return c.value.forEach(T=>{b[T.name]=T.value}),b});return{__sfc:!0,props:n,emit:e,handleInput:i,handleRightIconClick:s,shouldShowField:u,fieldsToShow:c,variables:d,getFieldValue:b=>b.displayInfo&&ai(b.value)&&!b.autocompleted?ni(b.value,d.value):b.value,isFieldSearchable:b=>b.isExternalId&&n.autocomplete,retrocompatibleIcon:b=>b==="DollarIcon"?"currency-dollar":b,TTypography:dn,TSelect:Nu,stringToHTML:Sr,CustomField:By}}}),gT="";var Hy=function(){var e=this,n=e._self._c,i=e._self._setupProxy;return n("div",{staticClass:"fields-section"},[e.title?n(i.TTypography,{staticClass:"fields-section__title",attrs:{variant:"s4","font-weight":"semibold"}},[e._v(" "+e._s(e.title)+" ")]):e._e(),n("div",{staticClass:"fields-section__container"},[e._l(i.fieldsToShow,function(s){var u,c;return[e.fieldsType==="invoice"&&s.isAccount?n(i.TSelect,{key:s.id||s.name,attrs:{placeholder:s.placeholder,value:(u=s.value)==null?void 0:u.toString(),"full-width":""},on:{input:d=>i.handleInput(s.id||s.id||s.name,d)},scopedSlots:e._u([{key:"label",fn:function(){return[s.label?n("p",{staticClass:"t-select__label",attrs:{for:s.id||s.name},domProps:{innerHTML:e._s(i.stringToHTML(s.label))}}):e._e()]},proxy:!0},{key:"helperText",fn:function(){return[s.helperText?n("p",{staticClass:"t-select__helper-text",domProps:{innerHTML:e._s(i.stringToHTML(s.helperText))}}):e._e()]},proxy:!0}],null,!0)},e._l(e.accounts,function({id:d,name:m}){return n("option",{key:d,domProps:{value:d}},[e._v(" "+e._s(m)+" ")])}),0):s.defaultOptions!==void 0?n(i.TSelect,{key:s.id||s.name,staticClass:"t-select",attrs:{placeholder:s.placeholder,value:(c=s.value)==null?void 0:c.toString(),"full-width":""},on:{input:d=>i.handleInput(s.id||s.name,d)},scopedSlots:e._u([{key:"label",fn:function(){return[s.label?n("p",{staticClass:"t-select__label",attrs:{for:s.id||s.name},domProps:{innerHTML:e._s(i.stringToHTML(s.label))}}):e._e()]},proxy:!0},{key:"helperText",fn:function(){return[s.helperText?n("p",{staticClass:"t-select__helper-text",domProps:{innerHTML:e._s(i.stringToHTML(s.helperText))}}):e._e()]},proxy:!0}],null,!0)},e._l(s.defaultOptions,function(d){return n("option",{key:d.toString(),domProps:{value:d.toString()}},[e._v(" "+e._s(d)+" ")])}),0):n(i.CustomField,{key:s.name,attrs:{id:s.id||s.name,value:i.getFieldValue(s),type:s.type,label:s.label,placeholder:s.placeholder,decimals:s.decimals,"helper-text":s.helperText,"left-icon":i.retrocompatibleIcon(s.leftIcon),required:s.required,regex:s.regex,"display-info":s.displayInfo,"right-icon":i.isFieldSearchable(s)?"ph:magnifying-glass":void 0,"is-mobile":e.isMobile,autocomplete:i.props.autocomplete,"is-external-id":s.isExternalId},on:{input:d=>i.handleInput(s.id||s.name,d),"right-icon-click":function(d){i.isFieldSearchable(s)&&i.handleRightIconClick()}}})]})],2)],1)},Uy=[],qy=Hn(Yy,Hy,Uy,!1,null,"57cb6298",null,null);const Gy=qy.exports,Zy=v.defineComponent({__name:"TAlertError",props:{fullWidth:{type:Boolean},size:null},setup(r){v.useCssVars((i,s)=>({"6bb31bba":s.error}));const e=Oe(),n=v.computed(()=>e.value.colors.error);return{__sfc:!0,theme:e,error:n,TTypography:dn,TIcon:ti}}}),_T="";var Vy=function(){var e=this,n=e._self._c,i=e._self._setupProxy;return n("div",{class:["t-alert-error",{"t-alert-error--full-width":e.fullWidth}]},[n(i.TIcon,{class:[`t-alert-error__icon--${e.size}`],attrs:{icon:"x-circle",variant:"solid",color:"error"}}),n(i.TTypography,{staticClass:"t-alert-error__text",attrs:{variant:e.size==="small"?"b4":"b3"}},[e._t("default")],2)],1)},Xy=[],Ky=Hn(Zy,Vy,Xy,!1,null,"f5dee371",null,null);const Jy=Ky.exports,Qy=v.defineComponent({__name:"TCustomForm",props:{countryIso:null,accounts:{default:()=>[]},isMobile:{type:Boolean},title:null,layout:{default:"columns"},topSubtitle:null,bottomSubtitle:null,customerFieldsTitle:null,customerFields:{default:()=>[]},invoiceFieldsTitle:null,invoiceFields:{default:()=>[]},enableAutocomplete:{type:Boolean},checkboxes:{default:()=>[]},themeColor:{default:"#5c0087"},loading:{type:Boolean},formLinkLabel:null,disableSubmit:{type:Boolean},buttonLabel:{default:"Registrar"},errorMessage:null},emits:["submit-form-data","reset","autocomplete-subscription","autocomplete-external-id","form-link-clicked"],setup(r,{emit:e}){const n=r;v.useCssVars((B,U)=>({"2c5cfebb":U.grayMain,bf08a1cc:U.grayMedium1,f059a344:U.grayLight2}));const i=Fu({colors:{primary:{main:n.themeColor}}}),s=Oe(),u=v.computed(()=>s.value.colors.gray.medium1),c=v.computed(()=>s.value.colors.gray.light2),d=v.computed(()=>s.value.colors.gray.main),m=v.ref(n.customerFields),_=v.ref(n.invoiceFields),y=v.ref(n.checkboxes.map(B=>({...B,type:"checkbox"}))),b=v.computed(()=>[...m.value,..._.value,...y.value]),{shouldShowField:T}=ri(b),W=v.computed(()=>y.value.filter(T)),j=(B,U)=>B.type==="number"&&B.decimals?(Math.round(Number(U)*10**B.decimals)/10**B.decimals).toString():U,L=()=>{const B=m.value.find(({isExternalId:U})=>U);e("autocomplete-external-id",B==null?void 0:B.value)},Y=(B,{id:U,value:K})=>{const Re=B.findIndex(rt=>U===rt.id||U===rt.name);if(Re!==-1){const rt=B[Re];Ko(rt)?v.set(rt,"value",K):(v.set(rt,"value",j(rt,K)),rt.name==="product_id"&&n.enableAutocomplete&&e("autocomplete-subscription",K))}},G=()=>{const B={};return b.value.forEach(U=>{T(U)&&(B[U.name]=U.value)}),B},{cleanGovernmentId:ee}=Wu(),Z=()=>{const B=G(),U={additional_data:{},customer_metadata:{},subscription_metadata:{},invoice_metadata:{},checkboxes_values:{}};return b.value.forEach(K=>{if(!(K.relatedField&&!T(K))){if(Ko(K))U.checkboxes_values[K.id]=K.value??!1;else if(K.value){let{value:Re}=K;ai(K.value)&&K.displayInfo&&!K.autocompleted&&(Re=ni(Re,B)),K.name.includes("customer_metadata")?U.customer_metadata[K.name.replace("customer_metadata_","")]=Re:K.name.includes("subscription_metadata")?U.subscription_metadata[K.name.replace("subscription_metadata_","")]=Re:K.name.includes("invoice_metadata")?U.invoice_metadata[K.name.replace("invoice_metadata_","")]=Re:K.name.includes("additional_data")?U.additional_data[K.name.replace("additional_data_","")]=Re:K.name==="government_id"&&n.countryIso==="CL"?U[K.name]=ee(Re,n.countryIso):K.name==="due_date"&&Bu(Re)?U[K.name]=Hu(Re):K.isAccount?U.id_account=Re:U[K.name]=Re}}}),U},ge=()=>{let B=!0;return b.value.forEach(U=>{if(Ko(U))return;const K=U.required&&(U.value===void 0||U.value==="")&&(!U.relatedField||T(U)),Re=U.regex&&!RegExp(U.regex.pattern).test(U.value)&&(!U.relatedField||T(U));(K||Re)&&(B=!1)}),B},he=()=>{if(!ge())return;const U=Z();e("submit-form-data",U)},z=v.ref(null),F=()=>{var B;(B=z.value)==null||B.scrollIntoView({behavior:"smooth"})};return v.watch(n,B=>{m.value=B.customerFields,_.value=B.invoiceFields,B.errorMessage&&F()}),{__sfc:!0,props:n,emit:e,formTheme:i,theme:s,grayMedium1:u,grayLight2:c,grayMain:d,customerFields:m,invoiceFields:_,checkboxes:y,allFields:b,shouldShowField:T,checkboxesToShow:W,formatFieldValue:j,handleSearch:L,handleInput:Y,getVariables:G,cleanGovernmentId:ee,buildSignupRequestBody:Z,validateFormValues:ge,submitForm:he,top:z,scrollToTop:F,TButton:wr,TThemeProvider:Ru,TCheckbox:ju,TTypography:dn,FieldsSection:Gy,TAlertError:Jy}}}),yT="";var e0=function(){var s;var e=this,n=e._self._c,i=e._self._setupProxy;return n(i.TThemeProvider,{attrs:{theme:i.formTheme}},[n("div",{ref:"top",staticClass:"t-custom-form__layout",class:{"t-custom-form__layout--mobile":e.isMobile}},[e.title?n(i.TTypography,{style:{textAlign:"center"},attrs:{variant:"s2","font-weight":"semibold"}},[e._v(" "+e._s(e.title)+" ")]):e._e(),e.topSubtitle?n(i.TTypography,{style:{textAlign:"center"},attrs:{variant:"b2","font-weight":"semibold"}},[e._v(e._s(e.topSubtitle))]):e._e(),e.errorMessage?n(i.TAlertError,{attrs:{size:e.isMobile?"small":"large","full-width":e.isMobile||e.layout==="rows"}},[e._v(e._s(e.errorMessage))]):e._e(),n("div",{class:["t-custom-form__fields-container",e.isMobile?"t-custom-form__fields-container--mobile":"t-custom-form__fields-container--desktop"]},[n("div",{class:["t-custom-form__fields-layout",e.isMobile?"t-custom-form__fields-layout--rows":`t-custom-form__fields-layout--${e.layout}`]},[i.customerFields.length?n(i.FieldsSection,{attrs:{fields:i.customerFields,"fields-type":"customer",title:e.customerFieldsTitle,autocomplete:e.enableAutocomplete,accounts:e.accounts,"is-mobile":e.isMobile},on:{input:u=>i.handleInput(i.customerFields,u),search:i.handleSearch}}):e._e(),i.customerFields.length&&i.invoiceFields.length?n("div",{class:[e.isMobile?"t-custom-form__sepparation-line--rows":`t-custom-form__sepparation-line--${e.layout}`]}):e._e(),i.invoiceFields.length?n(i.FieldsSection,{attrs:{fields:i.invoiceFields,"fields-type":"invoice",title:e.invoiceFieldsTitle,accounts:e.accounts,"is-mobile":e.isMobile},on:{input:u=>i.handleInput(i.invoiceFields,u)}}):e._e()],1),e.formLinkLabel?n(i.TButton,{staticClass:"t-custom-form__link",attrs:{variant:"tertiary"},on:{click:function(u){return i.emit("form-link-clicked")}}},[e._v(e._s(e.formLinkLabel))]):e._e()],1),e.bottomSubtitle?n(i.TTypography,{style:{textAlign:"center"},attrs:{variant:"b2","font-weight":"semibold"}},[e._v(e._s(e.bottomSubtitle))]):e._e(),(s=i.checkboxesToShow)!=null&&s.length?n("div",{staticClass:"t-custom-form__checkboxes"},e._l(i.checkboxesToShow,function(u){return n(i.TCheckbox,{key:u.id,staticClass:"t-custom-form__checkbox",attrs:{id:u.id,"label-position":"right",size:"small",value:u.value},on:{input:c=>i.handleInput(i.checkboxes,{id:u.id,value:c})}},[e._v(" "+e._s(u.label)+" ")])}),1):e._e(),n(i.TButton,{class:{"t-custom-form__submit-button":!e.isMobile},attrs:{size:"medium",disabled:e.disableSubmit,loading:i.props.loading,"full-width":e.isMobile},on:{click:i.submitForm}},[e._v(" "+e._s(e.buttonLabel)+" ")])],1)])},t0=[],n0=Hn(Qy,e0,t0,!1,null,"fef35332",null,null);const r0=n0.exports;jn.CustomForm=Py,jn.TCustomForm=r0,Object.defineProperty(jn,Symbol.toStringTag,{value:"Module"})});
210
210
  //# sourceMappingURL=index.umd.js.map