@kong-ui-public/forms 4.7.36 → 4.8.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/dist/forms.es.js CHANGED
@@ -3175,6 +3175,12 @@ const iu = /* @__PURE__ */ x(Jd, [["render", ru], ["__scopeId", "data-v-70998d5b
3175
3175
  }), ou = /* @__PURE__ */ x(au, [["__scopeId", "data-v-d046a15a"]]), su = {
3176
3176
  mixins: [fe],
3177
3177
  emits: ["model-updated"],
3178
+ computed: {
3179
+ items() {
3180
+ var e, t;
3181
+ return this.schema.values ? this.schema.values : (t = (e = this.schema.elements) == null ? void 0 : e.one_of) != null && t.length ? this.schema.elements.one_of.map((n) => ({ label: n, value: n })) : [];
3182
+ }
3183
+ },
3178
3184
  methods: {
3179
3185
  onUpdate(e) {
3180
3186
  this.$emit("model-updated", e, this.schema.model);
@@ -3186,7 +3192,7 @@ function lu(e, t, n, r, a, i) {
3186
3192
  return d(), I(l, {
3187
3193
  "aria-labelledby": e.getLabelId(e.schema),
3188
3194
  "data-testid": "field-multiselect",
3189
- items: e.schema.values,
3195
+ items: i.items,
3190
3196
  "label-attributes": { info: e.schema.help },
3191
3197
  "model-value": e.value,
3192
3198
  placeholder: e.schema.placeholder,
package/dist/forms.umd.js CHANGED
@@ -1,3 +1,3 @@
1
- (function(O,t){typeof exports=="object"&&typeof module<"u"?t(exports,require("vue"),require("@kong/icons"),require("@kong-ui-public/i18n")):typeof define=="function"&&define.amd?define(["exports","vue","@kong/icons","@kong-ui-public/i18n"],t):(O=typeof globalThis<"u"?globalThis:O||self,t(O["kong-ui-public-forms"]={},O.Vue,O.KongIcons,O["kong-ui-public-i18n"]))})(this,function(O,t,oe,Fe){"use strict";function mt(e,n){for(var o=-1,r=e==null?0:e.length;++o<r&&n(e[o],o,e)!==!1;);return e}function Pn(e){return function(n,o,r){for(var i=-1,a=Object(n),d=r(n),l=d.length;l--;){var s=d[++i];if(o(a[s],s,a)===!1)break}return n}}var Kn=Pn();function xn(e,n){for(var o=-1,r=Array(e);++o<e;)r[o]=n(o);return r}var ut=typeof global=="object"&&global&&global.Object===Object&&global,zn=typeof self=="object"&&self&&self.Object===Object&&self,Z=ut||zn||Function("return this")(),re=Z.Symbol,ft=Object.prototype,Yn=ft.hasOwnProperty,Hn=ft.toString,Ve=re?re.toStringTag:void 0;function Gn(e){var n=Yn.call(e,Ve),o=e[Ve];try{e[Ve]=void 0;var r=!0}catch{}var i=Hn.call(e);return r&&(n?e[Ve]=o:delete e[Ve]),i}var Wn=Object.prototype,Zn=Wn.toString;function Jn(e){return Zn.call(e)}var Xn="[object Null]",Qn="[object Undefined]",ht=re?re.toStringTag:void 0;function ae(e){return e==null?e===void 0?Qn:Xn:ht&&ht in Object(e)?Gn(e):Jn(e)}function ie(e){return e!=null&&typeof e=="object"}var eo="[object Arguments]";function pt(e){return ie(e)&&ae(e)==eo}var gt=Object.prototype,to=gt.hasOwnProperty,no=gt.propertyIsEnumerable,oo=pt(function(){return arguments}())?pt:function(e){return ie(e)&&to.call(e,"callee")&&!no.call(e,"callee")},le=Array.isArray;function ro(){return!1}var yt=typeof O=="object"&&O&&!O.nodeType&&O,bt=yt&&typeof module=="object"&&module&&!module.nodeType&&module,ao=bt&&bt.exports===yt,kt=ao?Z.Buffer:void 0,io=kt?kt.isBuffer:void 0,wt=io||ro,lo=9007199254740991,so=/^(?:0|[1-9]\d*)$/;function Ct(e,n){var o=typeof e;return n=n??lo,!!n&&(o=="number"||o!="symbol"&&so.test(e))&&e>-1&&e%1==0&&e<n}var co=9007199254740991;function _t(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=co}var mo="[object Arguments]",uo="[object Array]",fo="[object Boolean]",ho="[object Date]",po="[object Error]",go="[object Function]",yo="[object Map]",bo="[object Number]",ko="[object Object]",wo="[object RegExp]",Co="[object Set]",_o="[object String]",Eo="[object WeakMap]",Mo="[object ArrayBuffer]",So="[object DataView]",Vo="[object Float32Array]",To="[object Float64Array]",No="[object Int8Array]",Bo="[object Int16Array]",Io="[object Int32Array]",Ao="[object Uint8Array]",Oo="[object Uint8ClampedArray]",Fo="[object Uint16Array]",Uo="[object Uint32Array]",$={};$[Vo]=$[To]=$[No]=$[Bo]=$[Io]=$[Ao]=$[Oo]=$[Fo]=$[Uo]=!0,$[mo]=$[uo]=$[Mo]=$[fo]=$[So]=$[ho]=$[po]=$[go]=$[yo]=$[bo]=$[ko]=$[wo]=$[Co]=$[_o]=$[Eo]=!1;function $o(e){return ie(e)&&_t(e.length)&&!!$[ae(e)]}function He(e){return function(n){return e(n)}}var Et=typeof O=="object"&&O&&!O.nodeType&&O,Te=Et&&typeof module=="object"&&module&&!module.nodeType&&module,Lo=Te&&Te.exports===Et,Ge=Lo&&ut.process,Ce=function(){try{var e=Te&&Te.require&&Te.require("util").types;return e||Ge&&Ge.binding&&Ge.binding("util")}catch{}}(),Mt=Ce&&Ce.isTypedArray,jo=Mt?He(Mt):$o,Do=Object.prototype,vo=Do.hasOwnProperty;function St(e,n){var o=le(e),r=!o&&oo(e),i=!o&&!r&&wt(e),a=!o&&!r&&!i&&jo(e),d=o||r||i||a,l=d?xn(e.length,String):[],s=l.length;for(var c in e)(n||vo.call(e,c))&&!(d&&(c=="length"||i&&(c=="offset"||c=="parent")||a&&(c=="buffer"||c=="byteLength"||c=="byteOffset")||Ct(c,s)))&&l.push(c);return l}var qo=Object.prototype;function We(e){var n=e&&e.constructor,o=typeof n=="function"&&n.prototype||qo;return e===o}function Vt(e,n){return function(o){return e(n(o))}}var Ro=Vt(Object.keys,Object),Po=Object.prototype,Ko=Po.hasOwnProperty;function xo(e){if(!We(e))return Ro(e);var n=[];for(var o in Object(e))Ko.call(e,o)&&o!="constructor"&&n.push(o);return n}function H(e){var n=typeof e;return e!=null&&(n=="object"||n=="function")}var zo="[object AsyncFunction]",Yo="[object Function]",Ho="[object GeneratorFunction]",Go="[object Proxy]";function L(e){if(!H(e))return!1;var n=ae(e);return n==Yo||n==Ho||n==zo||n==Go}function Ue(e){return e!=null&&_t(e.length)&&!L(e)}function $e(e){return Ue(e)?St(e):xo(e)}function Wo(e,n){return e&&Kn(e,n,$e)}function Zo(e,n){return function(o,r){if(o==null)return o;if(!Ue(o))return e(o,r);for(var i=o.length,a=-1,d=Object(o);++a<i&&r(d[a],a,d)!==!1;);return o}}var Jo=Zo(Wo);function Ze(e){return e}function Xo(e){return typeof e=="function"?e:Ze}function x(e,n){var o=le(e)?mt:Jo;return o(e,Xo(n))}var Qo="[object Symbol]";function Le(e){return typeof e=="symbol"||ie(e)&&ae(e)==Qo}var er=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,tr=/^\w*$/;function nr(e,n){if(le(e))return!1;var o=typeof e;return o=="number"||o=="symbol"||o=="boolean"||e==null||Le(e)?!0:tr.test(e)||!er.test(e)||n!=null&&e in Object(n)}var Je=Z["__core-js_shared__"],Tt=function(){var e=/[^.]+$/.exec(Je&&Je.keys&&Je.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function or(e){return!!Tt&&Tt in e}var rr=Function.prototype,ar=rr.toString;function ue(e){if(e!=null){try{return ar.call(e)}catch{}try{return e+""}catch{}}return""}var ir=/[\\^$.*+?()[\]{}|]/g,lr=/^\[object .+?Constructor\]$/,sr=Function.prototype,dr=Object.prototype,cr=sr.toString,mr=dr.hasOwnProperty,ur=RegExp("^"+cr.call(mr).replace(ir,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function fr(e){if(!H(e)||or(e))return!1;var n=L(e)?ur:lr;return n.test(ue(e))}function hr(e,n){return e==null?void 0:e[n]}function fe(e,n){var o=hr(e,n);return fr(o)?o:void 0}var Ne=fe(Object,"create");function pr(){this.__data__=Ne?Ne(null):{},this.size=0}function gr(e){var n=this.has(e)&&delete this.__data__[e];return this.size-=n?1:0,n}var yr="__lodash_hash_undefined__",br=Object.prototype,kr=br.hasOwnProperty;function wr(e){var n=this.__data__;if(Ne){var o=n[e];return o===yr?void 0:o}return kr.call(n,e)?n[e]:void 0}var Cr=Object.prototype,_r=Cr.hasOwnProperty;function Er(e){var n=this.__data__;return Ne?n[e]!==void 0:_r.call(n,e)}var Mr="__lodash_hash_undefined__";function Sr(e,n){var o=this.__data__;return this.size+=this.has(e)?0:1,o[e]=Ne&&n===void 0?Mr:n,this}function he(e){var n=-1,o=e==null?0:e.length;for(this.clear();++n<o;){var r=e[n];this.set(r[0],r[1])}}he.prototype.clear=pr,he.prototype.delete=gr,he.prototype.get=wr,he.prototype.has=Er,he.prototype.set=Sr;function Vr(){this.__data__=[],this.size=0}function je(e,n){return e===n||e!==e&&n!==n}function De(e,n){for(var o=e.length;o--;)if(je(e[o][0],n))return o;return-1}var Tr=Array.prototype,Nr=Tr.splice;function Br(e){var n=this.__data__,o=De(n,e);if(o<0)return!1;var r=n.length-1;return o==r?n.pop():Nr.call(n,o,1),--this.size,!0}function Ir(e){var n=this.__data__,o=De(n,e);return o<0?void 0:n[o][1]}function Ar(e){return De(this.__data__,e)>-1}function Or(e,n){var o=this.__data__,r=De(o,e);return r<0?(++this.size,o.push([e,n])):o[r][1]=n,this}function Q(e){var n=-1,o=e==null?0:e.length;for(this.clear();++n<o;){var r=e[n];this.set(r[0],r[1])}}Q.prototype.clear=Vr,Q.prototype.delete=Br,Q.prototype.get=Ir,Q.prototype.has=Ar,Q.prototype.set=Or;var Be=fe(Z,"Map");function Fr(){this.size=0,this.__data__={hash:new he,map:new(Be||Q),string:new he}}function Ur(e){var n=typeof e;return n=="string"||n=="number"||n=="symbol"||n=="boolean"?e!=="__proto__":e===null}function ve(e,n){var o=e.__data__;return Ur(n)?o[typeof n=="string"?"string":"hash"]:o.map}function $r(e){var n=ve(this,e).delete(e);return this.size-=n?1:0,n}function Lr(e){return ve(this,e).get(e)}function jr(e){return ve(this,e).has(e)}function Dr(e,n){var o=ve(this,e),r=o.size;return o.set(e,n),this.size+=o.size==r?0:1,this}function ee(e){var n=-1,o=e==null?0:e.length;for(this.clear();++n<o;){var r=e[n];this.set(r[0],r[1])}}ee.prototype.clear=Fr,ee.prototype.delete=$r,ee.prototype.get=Lr,ee.prototype.has=jr,ee.prototype.set=Dr;var vr="Expected a function";function Xe(e,n){if(typeof e!="function"||n!=null&&typeof n!="function")throw new TypeError(vr);var o=function(){var r=arguments,i=n?n.apply(this,r):r[0],a=o.cache;if(a.has(i))return a.get(i);var d=e.apply(this,r);return o.cache=a.set(i,d)||a,d};return o.cache=new(Xe.Cache||ee),o}Xe.Cache=ee;var qr=500;function Rr(e){var n=Xe(e,function(r){return o.size===qr&&o.clear(),r}),o=n.cache;return n}var Pr=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Kr=/\\(\\)?/g,xr=Rr(function(e){var n=[];return e.charCodeAt(0)===46&&n.push(""),e.replace(Pr,function(o,r,i,a){n.push(i?a.replace(Kr,"$1"):r||o)}),n});function zr(e,n){for(var o=-1,r=e==null?0:e.length,i=Array(r);++o<r;)i[o]=n(e[o],o,e);return i}var Yr=1/0,Nt=re?re.prototype:void 0,Bt=Nt?Nt.toString:void 0;function It(e){if(typeof e=="string")return e;if(le(e))return zr(e,It)+"";if(Le(e))return Bt?Bt.call(e):"";var n=e+"";return n=="0"&&1/e==-Yr?"-0":n}function At(e){return e==null?"":It(e)}function Hr(e,n){return le(e)?e:nr(e,n)?[e]:xr(At(e))}var Gr=1/0;function Wr(e){if(typeof e=="string"||Le(e))return e;var n=e+"";return n=="0"&&1/e==-Gr?"-0":n}function Zr(e,n){n=Hr(n,e);for(var o=0,r=n.length;e!=null&&o<r;)e=e[Wr(n[o++])];return o&&o==r?e:void 0}function F(e,n,o){var r=e==null?void 0:Zr(e,n);return r===void 0?o:r}function q(e){return e==null}const se="kong-ui-forms-api",pe="autofill",G="autofillSlot";function Jr(){this.__data__=new Q,this.size=0}function Xr(e){var n=this.__data__,o=n.delete(e);return this.size=n.size,o}function Qr(e){return this.__data__.get(e)}function ea(e){return this.__data__.has(e)}var ta=200;function na(e,n){var o=this.__data__;if(o instanceof Q){var r=o.__data__;if(!Be||r.length<ta-1)return r.push([e,n]),this.size=++o.size,this;o=this.__data__=new ee(r)}return o.set(e,n),this.size=o.size,this}function _e(e){var n=this.__data__=new Q(e);this.size=n.size}_e.prototype.clear=Jr,_e.prototype.delete=Xr,_e.prototype.get=Qr,_e.prototype.has=ea,_e.prototype.set=na;var qe=function(){try{var e=fe(Object,"defineProperty");return e({},"",{}),e}catch{}}();function Ot(e,n,o){n=="__proto__"&&qe?qe(e,n,{configurable:!0,enumerable:!0,value:o,writable:!0}):e[n]=o}var oa=Object.prototype,ra=oa.hasOwnProperty;function Ft(e,n,o){var r=e[n];(!(ra.call(e,n)&&je(r,o))||o===void 0&&!(n in e))&&Ot(e,n,o)}function Re(e,n,o,r){var i=!o;o||(o={});for(var a=-1,d=n.length;++a<d;){var l=n[a],s=void 0;s===void 0&&(s=e[l]),i?Ot(o,l,s):Ft(o,l,s)}return o}function aa(e,n){return e&&Re(n,$e(n),e)}function ia(e){var n=[];if(e!=null)for(var o in Object(e))n.push(o);return n}var la=Object.prototype,sa=la.hasOwnProperty;function da(e){if(!H(e))return ia(e);var n=We(e),o=[];for(var r in e)r=="constructor"&&(n||!sa.call(e,r))||o.push(r);return o}function Pe(e){return Ue(e)?St(e,!0):da(e)}function ca(e,n){return e&&Re(n,Pe(n),e)}var Ut=typeof O=="object"&&O&&!O.nodeType&&O,$t=Ut&&typeof module=="object"&&module&&!module.nodeType&&module,ma=$t&&$t.exports===Ut,Lt=ma?Z.Buffer:void 0,jt=Lt?Lt.allocUnsafe:void 0;function ua(e,n){if(n)return e.slice();var o=e.length,r=jt?jt(o):new e.constructor(o);return e.copy(r),r}function fa(e,n){var o=-1,r=e.length;for(n||(n=Array(r));++o<r;)n[o]=e[o];return n}function ha(e,n){for(var o=-1,r=e==null?0:e.length,i=0,a=[];++o<r;){var d=e[o];n(d,o,e)&&(a[i++]=d)}return a}function Dt(){return[]}var pa=Object.prototype,ga=pa.propertyIsEnumerable,vt=Object.getOwnPropertySymbols,Qe=vt?function(e){return e==null?[]:(e=Object(e),ha(vt(e),function(n){return ga.call(e,n)}))}:Dt;function ya(e,n){return Re(e,Qe(e),n)}function qt(e,n){for(var o=-1,r=n.length,i=e.length;++o<r;)e[i+o]=n[o];return e}var Rt=Vt(Object.getPrototypeOf,Object),ba=Object.getOwnPropertySymbols,Pt=ba?function(e){for(var n=[];e;)qt(n,Qe(e)),e=Rt(e);return n}:Dt;function ka(e,n){return Re(e,Pt(e),n)}function Kt(e,n,o){var r=n(e);return le(e)?r:qt(r,o(e))}function wa(e){return Kt(e,$e,Qe)}function Ca(e){return Kt(e,Pe,Pt)}var et=fe(Z,"DataView"),tt=fe(Z,"Promise"),Ee=fe(Z,"Set"),nt=fe(Z,"WeakMap"),xt="[object Map]",_a="[object Object]",zt="[object Promise]",Yt="[object Set]",Ht="[object WeakMap]",Gt="[object DataView]",Ea=ue(et),Ma=ue(Be),Sa=ue(tt),Va=ue(Ee),Ta=ue(nt),te=ae;(et&&te(new et(new ArrayBuffer(1)))!=Gt||Be&&te(new Be)!=xt||tt&&te(tt.resolve())!=zt||Ee&&te(new Ee)!=Yt||nt&&te(new nt)!=Ht)&&(te=function(e){var n=ae(e),o=n==_a?e.constructor:void 0,r=o?ue(o):"";if(r)switch(r){case Ea:return Gt;case Ma:return xt;case Sa:return zt;case Va:return Yt;case Ta:return Ht}return n});var Na=Object.prototype,Ba=Na.hasOwnProperty;function Ia(e){var n=e.length,o=new e.constructor(n);return n&&typeof e[0]=="string"&&Ba.call(e,"index")&&(o.index=e.index,o.input=e.input),o}var Wt=Z.Uint8Array;function ot(e){var n=new e.constructor(e.byteLength);return new Wt(n).set(new Wt(e)),n}function Aa(e,n){var o=n?ot(e.buffer):e.buffer;return new e.constructor(o,e.byteOffset,e.byteLength)}var Oa=/\w*$/;function Fa(e){var n=new e.constructor(e.source,Oa.exec(e));return n.lastIndex=e.lastIndex,n}var Zt=re?re.prototype:void 0,Jt=Zt?Zt.valueOf:void 0;function Ua(e){return Jt?Object(Jt.call(e)):{}}function $a(e,n){var o=n?ot(e.buffer):e.buffer;return new e.constructor(o,e.byteOffset,e.length)}var La="[object Boolean]",ja="[object Date]",Da="[object Map]",va="[object Number]",qa="[object RegExp]",Ra="[object Set]",Pa="[object String]",Ka="[object Symbol]",xa="[object ArrayBuffer]",za="[object DataView]",Ya="[object Float32Array]",Ha="[object Float64Array]",Ga="[object Int8Array]",Wa="[object Int16Array]",Za="[object Int32Array]",Ja="[object Uint8Array]",Xa="[object Uint8ClampedArray]",Qa="[object Uint16Array]",ei="[object Uint32Array]";function ti(e,n,o){var r=e.constructor;switch(n){case xa:return ot(e);case La:case ja:return new r(+e);case za:return Aa(e,o);case Ya:case Ha:case Ga:case Wa:case Za:case Ja:case Xa:case Qa:case ei:return $a(e,o);case Da:return new r;case va:case Pa:return new r(e);case qa:return Fa(e);case Ra:return new r;case Ka:return Ua(e)}}var Xt=Object.create,ni=function(){function e(){}return function(n){if(!H(n))return{};if(Xt)return Xt(n);e.prototype=n;var o=new e;return e.prototype=void 0,o}}();function oi(e){return typeof e.constructor=="function"&&!We(e)?ni(Rt(e)):{}}var ri="[object Map]";function ai(e){return ie(e)&&te(e)==ri}var Qt=Ce&&Ce.isMap,ii=Qt?He(Qt):ai,li="[object Set]";function si(e){return ie(e)&&te(e)==li}var en=Ce&&Ce.isSet,di=en?He(en):si,ci=1,mi=2,ui=4,tn="[object Arguments]",fi="[object Array]",hi="[object Boolean]",pi="[object Date]",gi="[object Error]",nn="[object Function]",yi="[object GeneratorFunction]",bi="[object Map]",ki="[object Number]",on="[object Object]",wi="[object RegExp]",Ci="[object Set]",_i="[object String]",Ei="[object Symbol]",Mi="[object WeakMap]",Si="[object ArrayBuffer]",Vi="[object DataView]",Ti="[object Float32Array]",Ni="[object Float64Array]",Bi="[object Int8Array]",Ii="[object Int16Array]",Ai="[object Int32Array]",Oi="[object Uint8Array]",Fi="[object Uint8ClampedArray]",Ui="[object Uint16Array]",$i="[object Uint32Array]",U={};U[tn]=U[fi]=U[Si]=U[Vi]=U[hi]=U[pi]=U[Ti]=U[Ni]=U[Bi]=U[Ii]=U[Ai]=U[bi]=U[ki]=U[on]=U[wi]=U[Ci]=U[_i]=U[Ei]=U[Oi]=U[Fi]=U[Ui]=U[$i]=!0,U[gi]=U[nn]=U[Mi]=!1;function Ie(e,n,o,r,i,a){var d,l=n&ci,s=n&mi,c=n&ui;if(d!==void 0)return d;if(!H(e))return e;var m=le(e);if(m){if(d=Ia(e),!l)return fa(e,d)}else{var u=te(e),g=u==nn||u==yi;if(wt(e))return ua(e,l);if(u==on||u==tn||g&&!i){if(d=s||g?{}:oi(e),!l)return s?ka(e,ca(d,e)):ya(e,aa(d,e))}else{if(!U[u])return i?e:{};d=ti(e,u,l)}}a||(a=new _e);var S=a.get(e);if(S)return S;a.set(e,d),di(e)?e.forEach(function(C){d.add(Ie(C,n,o,C,e,a))}):ii(e)&&e.forEach(function(C,k){d.set(k,Ie(C,n,o,k,e,a))});var I=c?s?Ca:wa:s?Pe:$e,f=m?void 0:I(e);return mt(f||e,function(C,k){f&&(k=C,C=e[k]),Ft(d,k,Ie(C,n,o,k,e,a))}),d}var Li=1,ji=4;function ne(e){return Ie(e,Li|ji)}const rt=(e,n="")=>typeof e.id<"u"?n+e.id:n+(e.inputName||e.label||e.model||"").toString().trim().toLowerCase().replace(/ |_/g,"-").replace(/-{2,}/g,"-").replace(/^-+|-+$/g,"").replace(/([^a-zA-Z0-9-]+)/g,""),rn=(e="")=>e.toString().trim().replace(/ /g,"-").replace(/-{2,}/g,"-").replace(/^-+|-+$/g,"").replace(/([^a-zA-Z0-9-_/./:]+)/g,"");var Di="[object String]";function ge(e){return typeof e=="string"||!le(e)&&ie(e)&&ae(e)==Di}const an={methods:{getFieldRowClasses(e){const n=this.fieldErrors(e).length>0,o={[F(this.options,"validationErrorClass","error")]:n,[F(this.options,"validationSuccessClass","valid")]:!n,disabled:this.fieldDisabled(e),readonly:this.fieldReadonly(e),featured:this.fieldFeatured(e),required:this.fieldRequired(e)};return Array.isArray(e.styleClasses)?x(e.styleClasses,r=>o[r]=!0):ge(e.styleClasses)&&(o[e.styleClasses]=!0),q(e.type)||(o["field-"+e.type]=!0),o},fieldErrors(e){return this.errors.filter(o=>o.field.fieldName===e.fieldName).map(o=>o.error)},fieldDisabled(e){return L(e.disabled)?e.disabled.call(this,this.model,e,this):q(e.disabled)?!1:e.disabled},fieldReadonly(e){return L(e.readonly)?e.readonly.call(this,this.model,e,this):q(e.readonly)?!1:e.readonly},fieldFeatured(e){return L(e.featured)?e.featured.call(this,this.model,e,this):q(e.featured)?!1:e.featured},fieldRequired(e){return L(e.required)?e.required.call(this,this.model,e,this):q(e.required)?!1:e.required}}};var at=function(){return Z.Date.now()},vi=/\s/;function qi(e){for(var n=e.length;n--&&vi.test(e.charAt(n)););return n}var Ri=/^\s+/;function Pi(e){return e&&e.slice(0,qi(e)+1).replace(Ri,"")}var ln=NaN,Ki=/^[-+]0x[0-9a-f]+$/i,xi=/^0b[01]+$/i,zi=/^0o[0-7]+$/i,Yi=parseInt;function it(e){if(typeof e=="number")return e;if(Le(e))return ln;if(H(e)){var n=typeof e.valueOf=="function"?e.valueOf():e;e=H(n)?n+"":n}if(typeof e!="string")return e===0?e:+e;e=Pi(e);var o=xi.test(e);return o||zi.test(e)?Yi(e.slice(2),o?2:8):Ki.test(e)?ln:+e}var Hi="Expected a function",Gi=Math.max,Wi=Math.min;function Ae(e,n,o){var r,i,a,d,l,s,c=0,m=!1,u=!1,g=!0;if(typeof e!="function")throw new TypeError(Hi);n=it(n)||0,H(o)&&(m=!!o.leading,u="maxWait"in o,a=u?Gi(it(o.maxWait)||0,n):a,g="trailing"in o?!!o.trailing:g);function S(h){var p=r,M=i;return r=i=void 0,c=h,d=e.apply(M,p),d}function I(h){return c=h,l=setTimeout(k,n),m?S(h):d}function f(h){var p=h-s,M=h-c,T=n-p;return u?Wi(T,a-M):T}function C(h){var p=h-s,M=h-c;return s===void 0||p>=n||p<0||u&&M>=a}function k(){var h=at();if(C(h))return B(h);l=setTimeout(k,f(h))}function B(h){return l=void 0,g&&r?S(h):(r=i=void 0,d)}function w(){l!==void 0&&clearTimeout(l),c=0,r=s=i=l=void 0}function V(){return l===void 0?d:B(at())}function A(){var h=at(),p=C(h);if(r=arguments,i=this,s=h,p){if(l===void 0)return I(s);if(u)return clearTimeout(l),l=setTimeout(k,n),S(s)}return l===void 0&&(l=setTimeout(k,n)),d}return A.cancel=w,A.flush=V,A}var Zi="__lodash_hash_undefined__";function Ji(e){return this.__data__.set(e,Zi),this}function Xi(e){return this.__data__.has(e)}function Ke(e){var n=-1,o=e==null?0:e.length;for(this.__data__=new ee;++n<o;)this.add(e[n])}Ke.prototype.add=Ke.prototype.push=Ji,Ke.prototype.has=Xi;function Qi(e,n,o,r){for(var i=e.length,a=o+-1;++a<i;)if(n(e[a],a,e))return a;return-1}function el(e){return e!==e}function tl(e,n,o){for(var r=o-1,i=e.length;++r<i;)if(e[r]===n)return r;return-1}function nl(e,n,o){return n===n?tl(e,n,o):Qi(e,el,o)}function ol(e,n){var o=e==null?0:e.length;return!!o&&nl(e,n,0)>-1}function rl(e,n){return e.has(n)}function al(){}function sn(e){var n=-1,o=Array(e.size);return e.forEach(function(r){o[++n]=r}),o}var il=1/0,ll=Ee&&1/sn(new Ee([,-0]))[1]==il?function(e){return new Ee(e)}:al,sl=200;function dl(e,n,o){var r=-1,i=ol,a=e.length,d=!0,l=[],s=l;if(a>=sl){var c=ll(e);if(c)return sn(c);d=!1,i=rl,s=new Ke}else s=l;e:for(;++r<a;){var m=e[r],u=m;if(m=m!==0?m:0,d&&u===u){for(var g=s.length;g--;)if(s[g]===u)continue e;l.push(m)}else i(s,u,o)||(s!==l&&s.push(u),l.push(m))}return l}function dn(e){return e&&e.length?dl(e):[]}var cl=0;function cn(e){var n=++cl;return At(e)+n}function ml(e,n,o){switch(o.length){case 0:return e.call(n);case 1:return e.call(n,o[0]);case 2:return e.call(n,o[0],o[1]);case 3:return e.call(n,o[0],o[1],o[2])}return e.apply(n,o)}var mn=Math.max;function ul(e,n,o){return n=mn(n===void 0?e.length-1:n,0),function(){for(var r=arguments,i=-1,a=mn(r.length-n,0),d=Array(a);++i<a;)d[i]=r[n+i];i=-1;for(var l=Array(n+1);++i<n;)l[i]=r[i];return l[n]=o(d),ml(e,this,l)}}function fl(e){return function(){return e}}var hl=qe?function(e,n){return qe(e,"toString",{configurable:!0,enumerable:!1,value:fl(n),writable:!0})}:Ze,pl=800,gl=16,yl=Date.now;function bl(e){var n=0,o=0;return function(){var r=yl(),i=gl-(r-o);if(o=r,i>0){if(++n>=pl)return arguments[0]}else n=0;return e.apply(void 0,arguments)}}var kl=bl(hl);function wl(e,n){return kl(ul(e,n,Ze),e+"")}function Cl(e,n,o){if(!H(o))return!1;var r=typeof n;return(r=="number"?Ue(o)&&Ct(n,o.length):r=="string"&&n in o)?je(o[n],e):!1}var un=Object.prototype,_l=un.hasOwnProperty,El=wl(function(e,n){e=Object(e);var o=-1,r=n.length,i=r>2?n[2]:void 0;for(i&&Cl(n[0],n[1],i)&&(r=1);++o<r;)for(var a=n[o],d=Pe(a),l=-1,s=d.length;++l<s;){var c=d[l],m=e[c];(m===void 0||je(m,un[c])&&!_l.call(e,c))&&(e[c]=a[c])}return e}),Ml=Z.isFinite;function Sl(e){return typeof e=="number"&&Ml(e)}var fn=1/0,Vl=17976931348623157e292;function Tl(e){if(!e)return e===0?e:0;if(e=it(e),e===fn||e===-fn){var n=e<0?-1:1;return n*Vl}return e===e?e:0}function Nl(e){var n=Tl(e),o=n%1;return n===n?o?n-o:n:0}function Bl(e){return typeof e=="number"&&e==Nl(e)}var Il="[object Number]";function lt(e){return typeof e=="number"||ie(e)&&ae(e)==Il}var hn=/d{1,4}|M{1,4}|YY(?:YY)?|S{1,3}|Do|ZZ|Z|([HhMsDm])\1?|[aA]|"[^"]*"|'[^']*'/g,de="\\d\\d?",ce="\\d\\d",Al="\\d{3}",Ol="\\d{4}",Oe="[^\\s]+",pn=/\[([^]*?)\]/gm;function gn(e,n){for(var o=[],r=0,i=e.length;r<i;r++)o.push(e[r].substr(0,n));return o}var yn=function(e){return function(n,o){var r=o[e].map(function(a){return a.toLowerCase()}),i=r.indexOf(n.toLowerCase());return i>-1?i:null}};function ye(e){for(var n=[],o=1;o<arguments.length;o++)n[o-1]=arguments[o];for(var r=0,i=n;r<i.length;r++){var a=i[r];for(var d in a)e[d]=a[d]}return e}var bn=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],kn=["January","February","March","April","May","June","July","August","September","October","November","December"],Fl=gn(kn,3),Ul=gn(bn,3),wn={dayNamesShort:Ul,dayNames:bn,monthNamesShort:Fl,monthNames:kn,amPm:["am","pm"],DoFn:function(e){return e+["th","st","nd","rd"][e%10>3?0:(e-e%10!==10?1:0)*e%10]}},xe=ye({},wn),$l=function(e){return xe=ye(xe,e)},Cn=function(e){return e.replace(/[|\\{()[^$+*?.-]/g,"\\$&")},Y=function(e,n){for(n===void 0&&(n=2),e=String(e);e.length<n;)e="0"+e;return e},Ll={D:function(e){return String(e.getDate())},DD:function(e){return Y(e.getDate())},Do:function(e,n){return n.DoFn(e.getDate())},d:function(e){return String(e.getDay())},dd:function(e){return Y(e.getDay())},ddd:function(e,n){return n.dayNamesShort[e.getDay()]},dddd:function(e,n){return n.dayNames[e.getDay()]},M:function(e){return String(e.getMonth()+1)},MM:function(e){return Y(e.getMonth()+1)},MMM:function(e,n){return n.monthNamesShort[e.getMonth()]},MMMM:function(e,n){return n.monthNames[e.getMonth()]},YY:function(e){return Y(String(e.getFullYear()),4).substr(2)},YYYY:function(e){return Y(e.getFullYear(),4)},h:function(e){return String(e.getHours()%12||12)},hh:function(e){return Y(e.getHours()%12||12)},H:function(e){return String(e.getHours())},HH:function(e){return Y(e.getHours())},m:function(e){return String(e.getMinutes())},mm:function(e){return Y(e.getMinutes())},s:function(e){return String(e.getSeconds())},ss:function(e){return Y(e.getSeconds())},S:function(e){return String(Math.round(e.getMilliseconds()/100))},SS:function(e){return Y(Math.round(e.getMilliseconds()/10),2)},SSS:function(e){return Y(e.getMilliseconds(),3)},a:function(e,n){return e.getHours()<12?n.amPm[0]:n.amPm[1]},A:function(e,n){return e.getHours()<12?n.amPm[0].toUpperCase():n.amPm[1].toUpperCase()},ZZ:function(e){var n=e.getTimezoneOffset();return(n>0?"-":"+")+Y(Math.floor(Math.abs(n)/60)*100+Math.abs(n)%60,4)},Z:function(e){var n=e.getTimezoneOffset();return(n>0?"-":"+")+Y(Math.floor(Math.abs(n)/60),2)+":"+Y(Math.abs(n)%60,2)}},_n=function(e){return+e-1},En=[null,de],Mn=[null,Oe],Sn=["isPm",Oe,function(e,n){var o=e.toLowerCase();return o===n.amPm[0]?0:o===n.amPm[1]?1:null}],Vn=["timezoneOffset","[^\\s]*?[\\+\\-]\\d\\d:?\\d\\d|[^\\s]*?Z?",function(e){var n=(e+"").match(/([+-]|\d\d)/gi);if(n){var o=+n[1]*60+parseInt(n[2],10);return n[0]==="+"?o:-o}return 0}],jl={D:["day",de],DD:["day",ce],Do:["day",de+Oe,function(e){return parseInt(e,10)}],M:["month",de,_n],MM:["month",ce,_n],YY:["year",ce,function(e){var n=new Date,o=+(""+n.getFullYear()).substr(0,2);return+(""+(+e>68?o-1:o)+e)}],h:["hour",de,void 0,"isPm"],hh:["hour",ce,void 0,"isPm"],H:["hour",de],HH:["hour",ce],m:["minute",de],mm:["minute",ce],s:["second",de],ss:["second",ce],YYYY:["year",Ol],S:["millisecond","\\d",function(e){return+e*100}],SS:["millisecond",ce,function(e){return+e*10}],SSS:["millisecond",Al],d:En,dd:En,ddd:Mn,dddd:Mn,MMM:["month",Oe,yn("monthNamesShort")],MMMM:["month",Oe,yn("monthNames")],a:Sn,A:Sn,ZZ:Vn,Z:Vn},ze={default:"ddd MMM DD YYYY HH:mm:ss",shortDate:"M/D/YY",mediumDate:"MMM D, YYYY",longDate:"MMMM D, YYYY",fullDate:"dddd, MMMM D, YYYY",isoDate:"YYYY-MM-DD",isoDateTime:"YYYY-MM-DDTHH:mm:ssZ",shortTime:"HH:mm",mediumTime:"HH:mm:ss",longTime:"HH:mm:ss.SSS"},Dl=function(e){return ye(ze,e)},vl=function(e,n,o){if(n===void 0&&(n=ze.default),o===void 0&&(o={}),typeof e=="number"&&(e=new Date(e)),Object.prototype.toString.call(e)!=="[object Date]"||isNaN(e.getTime()))throw new Error("Invalid Date pass to format");n=ze[n]||n;var r=[];n=n.replace(pn,function(a,d){return r.push(d),"@@@"});var i=ye(ye({},xe),o);return n=n.replace(hn,function(a){return Ll[a](e,i)}),n.replace(/@@@/g,function(){return r.shift()})};function ql(e,n,o){if(o===void 0&&(o={}),typeof n!="string")throw new Error("Invalid format in fecha parse");if(n=ze[n]||n,e.length>1e3)return null;var r=new Date,i={year:r.getFullYear(),month:0,day:1,hour:0,minute:0,second:0,millisecond:0,isPm:null,timezoneOffset:null},a=[],d=[],l=n.replace(pn,function(V,A){return d.push(Cn(A)),"@@@"}),s={},c={};l=Cn(l).replace(hn,function(V){var A=jl[V],h=A[0],p=A[1],M=A[3];if(s[h])throw new Error("Invalid format. "+h+" specified twice in format");return s[h]=!0,M&&(c[M]=!0),a.push(A),"("+p+")"}),Object.keys(c).forEach(function(V){if(!s[V])throw new Error("Invalid format. "+V+" is required in specified format")}),l=l.replace(/@@@/g,function(){return d.shift()});var m=e.match(new RegExp(l,"i"));if(!m)return null;for(var u=ye(ye({},xe),o),g=1;g<m.length;g++){var S=a[g-1],I=S[0],f=S[2],C=f?f(m[g],u):+m[g];if(C==null)return null;i[I]=C}i.isPm===1&&i.hour!=null&&+i.hour!=12?i.hour=+i.hour+12:i.isPm===0&&+i.hour==12&&(i.hour=0);var k;if(i.timezoneOffset==null){k=new Date(i.year,i.month,i.day,i.hour,i.minute,i.second,i.millisecond);for(var B=[["month","getMonth"],["day","getDate"],["hour","getHours"],["minute","getMinutes"],["second","getSeconds"]],g=0,w=B.length;g<w;g++)if(s[B[g][0]]&&i[B[g][0]]!==k[B[g][1]]())return null}else if(k=new Date(Date.UTC(i.year,i.month,i.day,i.hour,i.minute-i.timezoneOffset,i.second,i.millisecond)),i.month>11||i.month<0||i.day>31||i.day<1||i.hour>23||i.hour<0||i.minute>59||i.minute<0||i.second>59||i.second<0)return null;return k}var Me={format:vl,parse:ql,defaultI18n:wn,setGlobalDateI18n:$l,setGlobalDateMasks:Dl};const K={fieldIsRequired:"This field is required!",invalidFormat:"Invalid format!",numberTooSmall:"The number is too small! Minimum: {0}",numberTooBig:"The number is too big! Maximum: {0}",invalidNumber:"Invalid number",invalidInteger:"The value is not an integer",textTooSmall:"The length of text is too small! Current: {0}, Minimum: {1}",textTooBig:"The length of text is too big! Current: {0}, Maximum: {1}",thisNotText:"This is not a text!",thisNotArray:"This is not an array!",selectMinItems:"Select minimum {0} items!",selectMaxItems:"Select maximum {0} items!",invalidDate:"Invalid date!",dateIsEarly:"The date is too early! Current: {0}, Minimum: {1}",dateIsLate:"The date is too late! Current: {0}, Maximum: {1}",invalidEmail:"Invalid e-mail address!",invalidURL:"Invalid URL!",invalidCard:"Invalid card format!",invalidCardNumber:"Invalid card number!",invalidTextContainNumber:"Invalid text! Cannot contains numbers or special characters",invalidTextContainSpec:"Invalid text! Cannot contains special characters"};function J(e,n,o=K){return q(e)||e===""?n?[v(o.fieldIsRequired)]:[]:null}function v(e,...n){if(e!=null&&n.length>0)for(let o=0;o<n.length;o++)e=e.replace("{"+(o-1)+"}",n[o]);return e}const be={resources:K,required(e,n,o,r=K){return J(e,n.required,r)},number(e,n,o,r=K){const i=J(e,n.required,r);if(i!=null)return i;const a=[];return Sl(e)?(!q(n.min)&&e<n.min&&a.push(v(r.numberTooSmall,n.min)),!q(n.max)&&e>n.max&&a.push(v(r.numberTooBig,n.max))):a.push(v(r.invalidNumber)),a},integer(e,n,o,r=K){const i=J(e,n.required,r);if(i!=null)return i;const a=be.number(e,n,o,r);return Bl(e)||a.push(v(r.invalidInteger)),a},double(e,n,o,r=K){const i=J(e,n.required,r);if(i!=null)return i;if(!lt(e)||isNaN(e))return[v(r.invalidNumber)]},string(e,n,o,r=K){const i=J(e,n.required,r);if(i!=null)return i;const a=[];return ge(e)?(!q(n.min)&&e.length<n.min&&a.push(v(r.textTooSmall,e.length,n.min)),!q(n.max)&&e.length>n.max&&a.push(v(r.textTooBig,e.length,n.max))):a.push(v(r.thisNotText)),a},array(e,n,o,r=K){if(n.required){if(!Array.isArray(e))return[v(r.thisNotArray)];if(e.length===0)return[v(r.fieldIsRequired)]}if(!q(e)){if(!q(n.min)&&e.length<n.min)return[v(r.selectMinItems,n.min)];if(!q(n.max)&&e.length>n.max)return[v(r.selectMaxItems,n.max)]}},date(e,n,o,r=K){const i=J(e,n.required,r);if(i!=null)return i;const a=new Date(e);if(isNaN(a.getDate()))return[v(r.invalidDate)];const d=[];if(!q(n.min)){const l=new Date(n.min);a.valueOf()<l.valueOf()&&d.push(v(r.dateIsEarly,Me.format(a),Me.format(l)))}if(!q(n.max)){const l=new Date(n.max);a.valueOf()>l.valueOf()&&d.push(v(r.dateIsLate,Me.format(a),Me.format(l)))}return d},regexp(e,n,o,r=K){const i=J(e,n.required,r);if(i!=null)return i;if(!q(n.pattern)&&!new RegExp(n.pattern).test(e))return[v(r.invalidFormat)]},email(e,n,o,r=K){const i=J(e,n.required,r);if(i!=null)return i;if(!/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(e))return[v(r.invalidEmail)]},url(e,n,o,r=K){const i=J(e,n.required,r);if(i!=null)return i;if(!/https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,4}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)/g.test(e))return[v(r.invalidURL)]},creditCard(e,n,o,r=K){const i=J(e,n.required,r);if(i!=null)return i;const a=/^(?:4[0-9]{12}(?:[0-9]{3})?|5[1-5][0-9]{14}|6(?:011|5[0-9][0-9])[0-9]{12}|3[47][0-9]{13}|3(?:0[0-5]|[68][0-9])[0-9]{11}|(?:2131|1800|35\d{3})\d{11})$/,d=e.replace(/[^0-9]+/g,"");if(!a.test(d))return[v(r.invalidCard)];let l=0,s,c,m;for(let u=d.length-1;u>=0;u--)s=d.substring(u,u+1),c=parseInt(s,10),m?(c*=2,c>=10?l+=c%10+1:l+=c):l+=c,m=!m;if(!(l%10===0&&d))return[v(r.invalidCardNumber)]},alpha(e,n,o,r=K){const i=J(e,n.required,r);if(i!=null)return i;if(!/^[a-zA-Z]*$/.test(e))return[v(r.invalidTextContainNumber)]},alphaNumeric(e,n,o,r=K){const i=J(e,n.required,r);if(i!=null)return i;if(!/^[a-zA-Z0-9]*$/.test(e))return[v(r.invalidTextContainSpec)]}};Object.keys(be).forEach(e=>{const n=be[e];L(n)&&(n.locale=o=>(r,i,a)=>n(r,i,a,El(o,K)))});function Tn(e){return ge(e)?be[e]!=null?be[e]:(console.warn(`'${e}' is not a validator function!`),null):e}function st(e,n,o){let r=F(o.context,"schema.attributes",{});const i=n.value||"input";ge(i)&&(r=F(r,i)||r),x(r,(a,d)=>{e.setAttribute(d,a)})}const X={name:"abstractField",props:["vfg","model","schema","formOptions","disabled"],emits:["validated","modelUpdated"],data(){return{errors:[],debouncedValidateFunc:null,debouncedFormatFunc:null}},directives:{attributes:{beforeMount:st,updated:st,componentUpdated:st}},computed:{value:{cache:!1,get(){let e;return L(F(this.schema,"get"))?e=this.schema.get(this.model):e=F(this.model,this.schema.model),this.formatValueToField(e)},set(e){const n=this.value;e=this.formatValueToModel(e),L(e)?e(e,n):this.updateModelValue(e,n)}}},methods:{validate(e){this.clearValidationErrors();const n=F(this.formOptions,"validateAsync",!1);let o=[];if(this.schema.validator&&this.schema.readonly!==!0&&this.disabled!==!0){const i=[];Array.isArray(this.schema.validator)?x(this.schema.validator,a=>{i.push(Tn(a).bind(this))}):i.push(Tn(this.schema.validator).bind(this)),x(i,a=>{if(n)o.push(a(this.value,this.schema,this.model));else{const d=a(this.value,this.schema,this.model);d&&L(d.then)?d.then(l=>{l&&(this.errors=this.errors.concat(l));const s=this.errors.length===0;this.$emit("validated",s,this.errors,this)}):d&&(o=o.concat(d))}})}const r=i=>{let a=[];x(dn(i),l=>{Array.isArray(l)&&l.length>0?a=a.concat(l):ge(l)&&a.push(l)}),L(this.schema.onValidated)&&this.schema.onValidated.call(this,this.model,a,this.schema);const d=a.length===0;return e||this.$emit("validated",d,a,this),this.errors=a,a};return n?Promise.all(o).then(r):r(o)},debouncedValidate(){L(this.debouncedValidateFunc)||(this.debouncedValidateFunc=Ae(this.validate.bind(this),F(this.schema,"validateDebounceTime",F(this.formOptions,"validateDebounceTime",500)))),this.debouncedValidateFunc()},updateModelValue(e,n){let o=!1;L(this.schema.set)?(this.schema.set(this.model,e),o=!0):this.schema.model&&(this.setModelValueByPath(this.schema.model,e),o=!0),o&&(this.$emit("modelUpdated",e,this.schema.model),L(this.schema.onChanged)&&this.schema.onChanged.call(this,this.model,e,n,this.schema),F(this.formOptions,"validateAfterChanged",!1)===!0&&(F(this.schema,"validateDebounceTime",F(this.formOptions,"validateDebounceTime",0))>0?this.debouncedValidate():this.validate()))},clearValidationErrors(){this.errors.splice(0)},setModelValueByPath(e,n){let o=e.replace(/\[(\w+)\]/g,".$1");o=o.replace(/^\./,"");let r=this.model;const i=o.split(".");let a=0;const d=i.length;for(;a<d;){const l=i[a];if(a<d-1)r[l]!==void 0||(r[l]={}),r=r[l];else{r[l]=n;return}++a}},getFieldID(e,n=!1){const o=F(this.formOptions,"fieldIdPrefix","");return rt(e,o)+(n?"-"+cn():"")},getLabelId(e){return`${this.getFieldID(e)}-label`},getFieldClasses(){return F(this.schema,"fieldClasses",[])},formatValueToField(e){return e},formatValueToModel(e){return e}}},Rl=Object.freeze(Object.defineProperty({__proto__:null,default:X},Symbol.toStringTag,{value:"Module"})),j=(e,n)=>{const o=e.__vccOpts||e;for(const[r,i]of n)o[r]=i;return o},Pl={mixins:[X],emits:["model-updated"],data(){return{isOpen:!1}},computed:{openClass(){return this.isOpen?"open":"closed"},fieldCount(){return this.schema.fields.length},titleText(){return`${this.isOpen?"Hide":"View"} ${this.fieldCount} Advanced Fields`}},methods:{handleOpen(){this.isOpen=!this.isOpen},updateModel(e,n){this.$emit("model-updated",e,n)}}},Kl={class:"advanced-field-dropdown-wrapper","data-testid":"advanced-field-dropdown-wrapper"},xl={class:"material-icons"};function zl(e,n,o,r,i,a){const d=t.resolveComponent("vue-form-generator");return t.openBlock(),t.createElementBlock("div",Kl,[t.createElementVNode("button",{class:"advanced-field-title",type:"button",onClick:n[0]||(n[0]=(...l)=>a.handleOpen&&a.handleOpen(...l))},[t.createElementVNode("i",xl,t.toDisplayString(i.isOpen?"keyboard_arrow_up":"keyboard_arrow_right"),1),t.createElementVNode("span",null,t.toDisplayString(a.titleText),1)]),t.createElementVNode("div",{class:t.normalizeClass(["advanced-field-dropdown",a.openClass])},[t.createVNode(d,{model:e.model,options:{helpAsHtml:!0},schema:e.schema,onModelUpdated:a.updateModel},null,8,["model","schema","onModelUpdated"])],2)])}const Yl=j(Pl,[["render",zl],["__scopeId","data-v-6f4089bd"]]),Hl={class:"array-card-container"},Nn=j(t.defineComponent({__name:"FieldArrayCardContainer",props:{model:{type:Object,default:()=>null},schema:{type:Object,default:()=>null},index:{type:Number,default:void 0}},emits:["remove-item"],setup(e){const n=e;return t.provide("vfg-array-item-index",n.index),(o,r)=>{const i=t.resolveComponent("KCard"),a=t.resolveComponent("KButton");return t.openBlock(),t.createElementBlock("div",Hl,[t.createVNode(i,{class:"card"},{default:t.withCtx(()=>[t.renderSlot(o.$slots,"default",{},void 0,!0)]),_:3}),t.createVNode(a,{appearance:"tertiary",class:"array-card-remove-button",onClick:r[0]||(r[0]=d=>o.$emit("remove-item"))},{default:t.withCtx(()=>[t.createVNode(t.unref(oe.TrashIcon))]),_:1})])}}}),[["__scopeId","data-v-96055692"]]),Gl={class:"array-item-wrapper"},Wl={class:"array-item"},Zl={class:"array-item-after"},Bn=j(t.defineComponent({__name:"FieldArrayItem",props:{model:{type:String,default:""}},emits:["remove-item"],setup(e){return(n,o)=>{const r=t.resolveComponent("KButton");return t.openBlock(),t.createElementBlock("div",Gl,[t.createElementVNode("div",Wl,[t.renderSlot(n.$slots,"default",{},void 0,!0),t.createVNode(r,{appearance:"tertiary",class:"delete",onClick:o[0]||(o[0]=i=>n.$emit("remove-item"))},{default:t.withCtx(()=>[t.createVNode(t.unref(oe.TrashIcon))]),_:1})]),t.createElementVNode("div",Zl,[t.renderSlot(n.$slots,"after",{},void 0,!0)])])}}}),[["__scopeId","data-v-eb9975cc"]]),Jl={class:"multi-item-wrapper"},In=j(t.defineComponent({__name:"FieldArrayMultiItem",emits:["remove-item"],setup(e){return(n,o)=>{const r=t.resolveComponent("KButton");return t.openBlock(),t.createElementBlock("div",Jl,[t.renderSlot(n.$slots,"default",{},void 0,!0),t.createVNode(r,{appearance:"danger",class:"delete",onClick:o[0]||(o[0]=i=>n.$emit("remove-item"))},{default:t.withCtx(()=>o[1]||(o[1]=[t.createTextVNode(" - Remove Field ")])),_:1}),o[2]||(o[2]=t.createElementVNode("hr",null,null,-1))])}}}),[["__scopeId","data-v-37458a0a"]]),Xl="[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}";function Ql(e){return e?e.length===36&&new RegExp(`^${Xl}$`).test(e):!1}const dt=50,ke={CREATE_NOT_FROM_ENTITY:"CREATE_NOT_FROM_ENTITY",CREATE_FROM_ENTITY:"CREATE_FROM_ENTITY",UPDATE_ENTITY:"UPDATE_ENTITY",SET_REFERRAL_VALUE:"SET_REFERRAL_VALUE"};function es(e,n,o){return o?ke.SET_REFERRAL_VALUE:e&&!n||!e&&n?ke.UPDATE_ENTITY:e&&n?ke.CREATE_FROM_ENTITY:ke.CREATE_NOT_FROM_ENTITY}const ts={mixins:[X],inject:[se],emits:["model-updated"],data(){return{suggestions:[],idValue:"",message:"Type something to search",items:[],initialItems:[],loading:!1}},computed:{fieldState(){return es(this.model[this.schema.model],this.associatedEntity||this.entityId,this.bypassSearch)},associatedEntity(){return this.$route&&this.$route.params[this.entity]},entity(){return this.schema.entity},bypassSearch(){return this.$route&&this.$route.query&&this.$route.query.no_search}},async created(){await this.$nextTick();let e,n;switch(this.fieldState){case ke.UPDATE_ENTITY:if(!this[se]){console.warn("[@kong-ui-public/forms] No API service provided");break}n=(await this[se].getOne(this.entity,this.model[this.schema.model])).data,e=this.getItem(this.schema.entityDataKey?n[this.schema.entityDataKey]:n),this.idValue=e.id;break;case ke.CREATE_FROM_ENTITY:this.idValue=this.associatedEntity.id;break;case ke.SET_REFERRAL_VALUE:this.idValue=this.value}try{e&&(this.initialItems=[{...e,label:this.getSuggestionLabel(e),value:e.id}]),this.items=this.initialItems}catch(o){this.message=`There was an error loading ${this.schema.entity}`,console.error("err!",o)}},methods:{onQueryChange(e){e.trim().length===0&&(this.items=[],this.message="Type something to search"),typeof this.performSearch!="function"&&(this.performSearch=Ae(this.search,500)),this.performSearch(e)},async search(e){if(e.trim().length===0)return;this.loading=!0;const n=[],o=[],r=this.getInputFields(),i=new Set;Ql(e)&&r.includes("id")?o.push((async()=>{const a=await this.fetchExact(e);n.push({...a,label:this.getSuggestionLabel(a),value:a.id})})()):o.push(...r.filter(a=>a!=="id").map(async a=>{(await this.fetchSuggestions(e,a)).forEach(l=>{i.has(l.id)||(i.add(l.id),n.push({...l,label:this.getSuggestionLabel(l),value:l.id}))})})),await Promise.all(o),this.items=n,this.items.length===0&&(this.message="No results"),this.loading=!1},getItem(e){return e.data?e.data.length>0?e.data[0]:[]:e},async fetchUntilLimit(e){const n=[];let o=null;if(!this[se])return console.warn("[@kong-ui-public/forms] No API service provided"),[];for(;n.length<dt;){const r=await this[se].getAll(this.entity,{size:dt,offset:o,...e});if(n.push(...r.data.data),o=r.data.offset,!o)break}return n.slice(0,dt)},async fetchSuggestions(e,n){return this.fetchUntilLimit({[n]:e})},async fetchExact(e){return this[se]?(await this[se].getOne(this.entity,e)).data:(console.warn("[@kong-ui-public/forms] No API service provided"),{})},getInputFields(){var e,n;return((n=(e=this.schema)==null?void 0:e.inputValues)==null?void 0:n.fields)||[]},getSuggestionLabel(e){const n=this.getInputFields();return n.length&&e?n.map(o=>e[o]).filter(Boolean).join(" - "):""},updateModel(e){this.$emit("model-updated",e!=null&&e.length?e:null,this.schema.model)},onSelected(e){this.idValue=e&&e.id,this.updateModel(this.getReturnValue(e||{}))},getReturnValue(e){var o;const n=(o=this.schema)==null?void 0:o.returnKey;return n?e[n]:e.id}}},ns={class:"field-wrap autosuggest"},os=["data-testid","data-testlabel"],rs=["data-testid"],as={class:"autosuggest__results_message"};function is(e,n,o,r,i,a){const d=t.resolveComponent("KSelect");return t.openBlock(),t.createElementBlock("div",ns,[t.createVNode(d,{id:e.schema.model,ref:"suggestion",modelValue:i.idValue,"onUpdate:modelValue":n[0]||(n[0]=l=>i.idValue=l),clearable:"","enable-filtering":"","filter-function":()=>!0,items:i.items,loading:i.loading,placeholder:e.schema.placeholder,width:"100%",onChange:a.onSelected,onQueryChange:a.onQueryChange},{"item-template":t.withCtx(({item:l})=>[t.createElementVNode("span",{class:"first-part","data-testid":l.id&&`${l.id}-0`,"data-testlabel":l.label},t.toDisplayString(a.getSuggestionLabel(l).split(" - ")[0]),9,os),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(a.getSuggestionLabel(l).split(" - ").slice(1),(s,c)=>(t.openBlock(),t.createElementBlock("span",{key:c,class:"field-span","data-testid":l.id&&`${l.id}-${c+1}`||c+1},t.toDisplayString(s),9,rs))),128))]),empty:t.withCtx(()=>[t.createElementVNode("div",as,[t.createElementVNode("span",null,t.toDisplayString(i.message),1)])]),_:1},8,["id","modelValue","items","loading","placeholder","onChange","onQueryChange"])])}const An=j(ts,[["render",is],["__scopeId","data-v-dd2fda9e"]]);function ls(e){const n=t.ref([]),o=t.ref(null),r=f=>ge(f)?be[f]!=null?be[f]:(console.warn(`'${f}' is not a validator function!`),null):f,i=t.computed({get(){var C,k;let f;return L(F(e.schema,"get"))?f=e.schema.get((C=e.model)==null?void 0:C.value):f=F((k=e.model)==null?void 0:k.value,e.schema.model),S(f)},set(f){const C=i;f=I(f),L(f)?f(f,C):l(f,C)}}),a=f=>{var V;s();const C=(V=e.schema)==null?void 0:V.validator,k=F(e.formOptions,"validateAsync",!1);let B=[];if(C&&e.schema.readonly!==!0&&e.disabled!==!0){const A=[];Array.isArray(C)?x(C,h=>{A.push(r(h))}):A.push(r(C)),x(A,h=>{var p,M;if(k)B.push(h(i.value,e.schema,(p=e.model)==null?void 0:p.value));else{const T=h(i.value,e.schema,(M=e.model)==null?void 0:M.value);T&&L(T.then)?T.then(y=>{y&&(n.value=n.value.concat(y));const b=n.value.length===0;e.emitValidated&&e.emitValidated({isValid:b,errors:n.value,field:e.schema})}):T&&(B=B.concat(T))}})}const w=A=>{var p,M;let h=[];if(x(dn(A),T=>{Array.isArray(T)&&T.length>0?h=h.concat(T):ge(T)&&h.push(T)}),L((p=e.schema)==null?void 0:p.onValidated)&&e.schema.onValidated((M=e.model)==null?void 0:M.value,h,e.schema),!f){const T=h.length===0;e.emitValidated&&e.emitValidated({isValid:T,errors:h,field:e.schema})}return A=h,h};return k?Promise.all(B).then(w):w(B)},d=()=>{L(o.value)?o.value():o.value=Ae(a,F(e.schema,"validateDebounceTime",F(e.formOptions,"validateDebounceTime",500)))},l=(f,C)=>{var B,w,V;let k=!1;L(e.schema.set)?(e.schema.set((B=e.model)==null?void 0:B.value,f),k=!0):e.schema.model&&(c(e.schema.model,f),k=!0),k&&(e.emitModelUpdated&&((w=e.model)!=null&&w.value)&&e.emitModelUpdated({value:f,model:e.schema.model}),L(e.schema.onChanged)&&e.schema.onChanged((V=e.model)==null?void 0:V.value,f,C,e.schema),F(e.formOptions,"validateAfterChanged",!1)===!0&&(F(e.schema,"validateDebounceTime",F(e.formOptions,"validateDebounceTime",0))>0?d():a()))},s=()=>{n.value.splice(0)},c=(f,C)=>{var h;let k=f.replace(/\[(\w+)\]/g,".$1");k=k.replace(/^\./,"");let B=((h=e.model)==null?void 0:h.value)||{},w=0;const V=k.split("."),A=V.length;for(;w<A;){const p=V[w];if(w<A-1)B[p]!==void 0||(B[p]={}),B=B[p];else{B[p]=C;return}++w}},m=(f,C=!1)=>{const k=F(e.formOptions,"fieldIdPrefix","");return rt(f,k)+(C?"-"+cn():"")},u=f=>`${m(f)}-label`,g=()=>F(e.schema,"fieldClasses",[]),S=f=>e.formatValueToField&&typeof e.formatValueToField=="function"?e.formatValueToField(f):f,I=f=>e.formatValueToModel&&typeof e.formatValueToModel=="function"?e.formatValueToModel(f):f;return{value:i,clearValidationErrors:s,getFieldID:m,getLabelId:u,getFieldClasses:g,updateModelValue:l}}const we={useAbstractFields:ls},ss={class:"form-field-wrapper"},On=j(t.defineComponent({__name:"FieldInput",props:{disabled:{type:Boolean,default:!1},formOptions:{type:Object,default:()=>{}},model:{type:Object,default:()=>{}},schema:{type:Object,required:!0},vfg:{type:Object,required:!0},errors:{type:Array,default:()=>[]},hint:{type:String,default:""}},emits:["modelUpdated"],setup(e,{expose:n,emit:o}){const r=e,i=o,a=t.toRefs(r),d=t.inject(G,void 0),{updateModelValue:l,getFieldID:s,clearValidationErrors:c,value:m}=we.useAbstractFields({model:a.model,schema:r.schema,formOptions:r.formOptions,emitModelUpdated:w=>{i("modelUpdated",w.value,w.model)}});n({clearValidationErrors:c});const u=t.computed(()=>{var V;const w=(V=r.schema)==null?void 0:V.inputType.toLowerCase();switch(w){case"string":return"text";case"datetime":return"datetime-local";default:return w||"text"}}),g={date:"YYYY-MM-DD",datetime:"YYYY-MM-DD HH:mm:ss","datetime-local":"YYYY-MM-DDTHH:mm:ss"},S=(w,V)=>{var M,T;let A=w;const h=g[u.value]||"",p=Me.parse(w,h);p&&((M=r.schema)!=null&&M.format?A=Me.format(p,(T=r.schema)==null?void 0:T.format):A=p.valueOf()),l(A,V)},I=(w,V)=>{lt(w)||(w=NaN),l(w,V)},f=w=>{let V=w;switch(u.value){case"number":case"range":lt(parseFloat(w))&&(V=parseFloat(w));break}m.value=V,l(V,w)},C=w=>{m.value=w,l(w,w)},k=t.ref(null),B=()=>{var w;L(k.value)&&((w=k.value)==null||w.flush())};return t.onMounted(()=>{switch(u.value){case"number":case"range":k.value=Ae((w,V)=>{I(w,V)},parseInt(F(r.schema,"debounceFormatTimeout",1e3)),{trailing:!0,leading:!1});break;case"date":case"datetime":case"datetime-local":k.value=Ae((w,V)=>{S(w,V)},parseInt(F(r.schema,"debounceFormatTimeout",1e3)),{trailing:!0,leading:!1});break}}),t.onBeforeMount(()=>{u.value==="checkbox"?console.warn("The use of 'checkbox' inputType with 'input' type fields is deprecated. Use 'checkbox' type instead."):u.value==="radio"?console.warn("The use of 'radio' inputType with 'input' type fields is deprecated. Use 'radio' type instead."):u.value==="file"&&console.warn("The 'file' type in input field is deprecated. Use 'file' field instead.")}),(w,V)=>{const A=t.resolveComponent("KInput");return t.openBlock(),t.createElementBlock("div",ss,[t.createVNode(A,t.mergeProps(w.$attrs,{id:t.unref(s)(e.schema),autocomplete:e.schema.autocomplete,class:e.schema.fieldClasses,disabled:e.disabled||void 0,help:e.hint?e.hint:u.value==="color"||u.value==="range"?t.unref(m):void 0,max:e.schema.max,maxlength:e.schema.maxlength,min:e.schema.min,minlength:e.schema.minlength,"model-value":t.unref(m),name:e.schema.inputName,pattern:e.schema.pattern,placeholder:e.schema.placeholder,readonly:e.schema.readonly,required:e.schema.required,"show-password-mask-toggle":u.value==="password",type:u.value,width:e.schema.width,onBlur:B,"onUpdate:modelValue":f}),null,16,["id","autocomplete","class","disabled","help","max","maxlength","min","minlength","model-value","name","pattern","placeholder","readonly","required","show-password-mask-toggle","type","width"]),(t.openBlock(),t.createBlock(t.resolveDynamicComponent(t.unref(d)),{schema:e.schema,update:C,value:t.unref(m)},null,8,["schema","value"]))])}}}),[["__scopeId","data-v-fe1132bb"]]),ds={name:"FieldMetric",components:{AddIcon:oe.AddIcon,TrashIcon:oe.TrashIcon},mixins:[X],emits:["remove-item"],data(){return{contentVisible:!1}}},cs={key:0,class:"content"};function ms(e,n,o,r,i,a){const d=t.resolveComponent("AddIcon"),l=t.resolveComponent("TrashIcon"),s=t.resolveComponent("KButton");return t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["field-dropdown",{active:i.contentVisible}])},[t.createElementVNode("div",{class:"title",onClick:n[0]||(n[0]=c=>i.contentVisible=!i.contentVisible)},[t.createTextVNode(t.toDisplayString(e.model.name?e.model.name:"New Item")+" ",1),t.createVNode(d,{class:"metric-add-icon"})]),t.createVNode(t.Transition,{name:"slide-fade"},{default:t.withCtx(()=>[i.contentVisible?(t.openBlock(),t.createElementBlock("div",cs,[t.renderSlot(e.$slots,"default"),t.createVNode(s,{appearance:"tertiary",class:"metric-remove-button",onClick:n[1]||(n[1]=c=>e.$emit("remove-item"))},{default:t.withCtx(()=>[t.createVNode(l)]),_:1})])):t.createCommentVNode("",!0)]),_:3})],2)}const Fn=j(ds,[["render",ms]]),us={mixins:[X],emits:["modelUpdated"],data(){return{attributes:this.schema?this.schema.attributes:void 0,newKeyType:"string",newKeyName:"",keyTypes:{}}},created(){this.value||(this.value={})},mounted(){if(!this.value)return;const e=Object.keys(this.value),n={};for(let o=0;o<e.length;o++){const r=e[o];n[r]=typeof this.value[r]}this.keyTypes=n},methods:{removeElement(e){const n=this.value;delete n[e],this.value=JSON.parse(JSON.stringify(n));const o=this.keyTypes;delete o[e],this.keyTypes=JSON.parse(JSON.stringify(o))},addKey(){this.value[this.newKeyName]=void 0,this.value={...this.value},this.keyTypes[this.newKeyName]=this.newKeyType,this.keyTypes={...this.keyTypes},this.newKeyName=""},updateModel(e,n){this.$emit("modelUpdated",e,n)}}},fs={class:"field-object-container"},hs={key:1},ps=["id"],gs={key:0},ys=["onUpdate:modelValue"],bs={key:1},ks=["onUpdate:modelValue"],ws={key:2},Cs=["onUpdate:modelValue"],_s=["onClick"];function Es(e,n,o,r,i,a){const d=t.resolveComponent("vue-form-generator"),l=t.resolveDirective("attributes");return t.withDirectives((t.openBlock(),t.createElementBlock("div",fs,[e.schema.schema?(t.openBlock(),t.createBlock(d,{key:0,model:e.value,options:e.formOptions,schema:e.schema.schema,onModelUpdated:a.updateModel},null,8,["model","options","schema","onModelUpdated"])):(t.openBlock(),t.createElementBlock("div",hs,[t.createElementVNode("table",{id:e.getFieldID(e.schema),class:t.normalizeClass(e.schema.fieldClasses)},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.value,(s,c)=>(t.openBlock(),t.createElementBlock("tr",{key:c},[t.createElementVNode("td",null,t.toDisplayString(c),1),i.keyTypes[c]==="string"?(t.openBlock(),t.createElementBlock("td",gs,[t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":m=>e.value[c]=m,type:"text"},null,8,ys),[[t.vModelText,e.value[c]]])])):t.createCommentVNode("",!0),i.keyTypes[c]==="boolean"?(t.openBlock(),t.createElementBlock("td",bs,[t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":m=>e.value[c]=m,type:"checkbox"},null,8,ks),[[t.vModelCheckbox,e.value[c]]])])):t.createCommentVNode("",!0),i.keyTypes[c]==="number"?(t.openBlock(),t.createElementBlock("td",ws,[t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":m=>e.value[c]=m,type:"number"},null,8,Cs),[[t.vModelText,e.value[c]]])])):t.createCommentVNode("",!0),t.createElementVNode("td",null,[t.createElementVNode("input",{type:"button",value:"x",onClick:m=>a.removeElement(c)},null,8,_s)])]))),128))],10,ps),t.withDirectives(t.createElementVNode("select",{"onUpdate:modelValue":n[0]||(n[0]=s=>i.newKeyType=s)},n[3]||(n[3]=[t.createElementVNode("option",{value:"string"}," String ",-1),t.createElementVNode("option",{value:"number"}," Number ",-1),t.createElementVNode("option",{value:"boolean"}," Boolean ",-1)]),512),[[t.vModelSelect,i.newKeyType]]),t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":n[1]||(n[1]=s=>i.newKeyName=s),type:"text"},null,512),[[t.vModelText,i.newKeyName]]),t.createElementVNode("input",{type:"button",value:"Add key",onClick:n[2]||(n[2]=(...s)=>a.addKey&&a.addKey(...s))})]))])),[[l,i.attributes]])}const Un=j(us,[["render",Es],["__scopeId","data-v-b7e3dcd7"]]),Ms={components:{TrashIcon:oe.TrashIcon},mixins:[X],inject:{autofillSlot:{from:G,default:void 0}},emits:["model-updated"],data(){return{newKeyName:""}},computed:{subSchema(){return this.schema.schema&&this.schema.schema.fields[0].schema},subFields(){return!this.subSchema&&this.schema.fields},hasObjectKeys(){return this.value&&Object.keys(this.value).length>0},transformedModel(){return this.subSchema&&this.subSchema.fields.length>=1&&this.subSchema.fields[0].type==="array"?new Proxy(this.model[this.schema.model],{get:(e,n)=>({[this.schema.model]:e[n]}),set:(e,n,o)=>e[n]=o[this.schema.model]}):this.model[this.schema.model]},valueInputType(){var e;return["number","integer"].includes((e=this.schema.values)==null?void 0:e.type)?"number":"text"}},mounted(){this.value||(this.value={});let e=[];this.subSchema?e=this.subSchema.fields:this.subFields&&(e=this.schema.fields[0].schema),this.value=this.transformMapModelValuesToObject(this.model,e,this.schema.model)},methods:{removeElement(e){const n=this.value;delete n[e],this.value={...n}},transformMapModelValuesToObject(e,n,o){const r={};return Object.keys(e).map(i=>{const a=i.indexOf(o+"-");if(a>-1&&Array.isArray(n))if(n.length>0){const l=i.split("-").filter(c=>n.find(m=>m.model===c)),s=i.split(`-${l}`)[0].split(`${o}-`)[1];l.length?r[s]={...r[s],[l]:e[i]}:r[i.substring(a+`${o}-`.length)]=e[i]}else r[i.substring(`${o}-`.length)]=e[i];else{const l=i.split("-").filter(c=>c===this.schema.model),s=i.split(`-${l}`)[0].split(`${o}-`)[1];s&&(r[s]=e[i])}return i}),r},addKey(){var r;const e=this.subSchema&&Array.isArray(this.subSchema.fields)&&this.subSchema.fields.length===1&&this.subSchema.fields[0].type==="array",n=((r=this.schema.values)==null?void 0:r.default)??(this.valueInputType==="number"?0:""),o=this.subSchema?e?[""]:{}:n;this.value[this.newKeyName]=o,this.newKeyName=""},updateModel(e,n){this.$emit("model-updated",this.model[this.schema.model],n)}}},Ss=["id"],Vs=["data-testid"],Ts={class:"item-wrapper"},Ns={class:"index-wrapper"},Bs={key:0},Is={key:1},As=["onUpdate:modelValue","placeholder","type","onInput"],Os={key:0,class:"hint"},Fs={class:"input-item"},Us=["placeholder"],$s={key:0,class:"hint"};function Ls(e,n,o,r,i,a){const d=t.resolveComponent("TrashIcon"),l=t.resolveComponent("KButton"),s=t.resolveComponent("vue-form-generator");return t.openBlock(),t.createElementBlock("div",{id:e.getFieldID(e.schema),class:t.normalizeClass(["object-advanced-wrapper",e.schema.fieldClasses])},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.value,(c,m)=>(t.openBlock(),t.createElementBlock("div",{key:m,"data-testid":`field-object-key-${m}`},[t.createElementVNode("div",null,[t.createElementVNode("div",Ts,[t.createElementVNode("div",Ns,[t.createElementVNode("strong",null,t.toDisplayString(m),1),t.createElementVNode("div",null,[t.createVNode(l,{appearance:"tertiary",class:"delete",icon:"",type:"button",onClick:u=>a.removeElement(m)},{default:t.withCtx(()=>[t.createVNode(d)]),_:2},1032,["onClick"])])]),n[1]||(n[1]=t.createElementVNode("hr",{class:"divider"},null,-1)),a.subSchema?(t.openBlock(),t.createElementBlock("div",Bs,[t.createVNode(s,{model:a.transformedModel[m],options:{helpAsHtml:!0},schema:a.subSchema,onModelUpdated:a.updateModel},null,8,["model","schema","onModelUpdated"])])):(t.openBlock(),t.createElementBlock("div",Is,[t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":u=>e.value[m]=u,class:"form-control",placeholder:e.schema.fields&&e.schema.fields[0].schema.placeholder,type:a.valueInputType,onInput:u=>a.updateModel(e.value[m],e.model[e.schema.model])},null,40,As),[[t.vModelDynamic,e.value[m]]]),e.schema.fields&&e.schema.fields[0].schema.hint?(t.openBlock(),t.createElementBlock("p",Os,t.toDisplayString(e.schema.fields[0].schema.hint),1)):t.createCommentVNode("",!0),(t.openBlock(),t.createBlock(t.resolveDynamicComponent(a.autofillSlot),{schema:e.schema.fields&&e.schema.fields[0].schema||e.schema.values,update:u=>e.value[m]=u,value:e.value[m]},null,8,["schema","update","value"]))])),n[2]||(n[2]=t.createElementVNode("hr",{class:"wide-divider"},null,-1))])])],8,Vs))),128)),t.createElementVNode("div",{class:t.normalizeClass(["input-wrapper",{indent:a.hasObjectKeys}])},[t.createElementVNode("div",Fs,[t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":n[0]||(n[0]=c=>i.newKeyName=c),class:"form-control","data-testid":"keyname-input",placeholder:e.schema.placeholder,type:"text"},null,8,Us),[[t.vModelText,i.newKeyName]]),t.createVNode(l,{appearance:"tertiary","data-testid":"add-key",disabled:!i.newKeyName,onClick:a.addKey},{default:t.withCtx(()=>[t.createTextVNode(" + Add "+t.toDisplayString(e.schema.buttonLabel||e.schema.label),1)]),_:1},8,["disabled","onClick"])]),e.schema.hintText?(t.openBlock(),t.createElementBlock("p",$s,t.toDisplayString(e.schema.hintText),1)):t.createCommentVNode("",!0)],2)],10,Ss)}const $n=j(Ms,[["render",Ls],["__scopeId","data-v-9a0290c4"]]),js={class:"radio-selection-group"},Ln=j(t.defineComponent({__name:"FieldRadio",props:{disabled:{type:Boolean,default:!1},formOptions:{type:Object,default:()=>{}},model:{type:Object,default:()=>{}},schema:{type:Object,required:!0},vfg:{type:Object,required:!0},errors:{type:Array,default:()=>[]},hint:{type:String,default:""}},emits:["modelUpdated"],setup(e,{expose:n,emit:o}){const r=e,i=o,a=t.toRefs(r),{updateModelValue:d,value:l,clearValidationErrors:s}=we.useAbstractFields({model:a.model,schema:r.schema,formOptions:r.formOptions,emitModelUpdated:m=>{i("modelUpdated",m.value,m.model)}});n({clearValidationErrors:s});const c=m=>{let u=m;typeof m=="string"&&(u=m.split(","),r.schema.array||(u=u.toString())),d(u,m)};return(m,u)=>{const g=t.resolveComponent("KRadio");return t.openBlock(),t.createElementBlock("div",js,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.schema.values,(S,I)=>(t.openBlock(),t.createBlock(g,{id:e.schema.name+"-"+I,key:S.value,modelValue:t.unref(l),"onUpdate:modelValue":u[0]||(u[0]=f=>t.isRef(l)?l.value=f:null),label:S.name,"label-attributes":{info:e.schema.help},name:e.schema.name,required:e.schema.required||void 0,"selected-value":S.value,onChange:c},null,8,["id","modelValue","label","label-attributes","name","required","selected-value"]))),128))])}}}),[["__scopeId","data-v-09b8afda"]]),jn=t.defineComponent({__name:"FieldSelect",props:{disabled:{type:Boolean,default:!1},formOptions:{type:Object,default:()=>{}},model:{type:Object,default:()=>{}},schema:{type:Object,required:!0},vfg:{type:Object,required:!0},errors:{type:Array,default:()=>[]},hint:{type:String,default:""}},emits:["modelUpdated"],setup(e,{expose:n,emit:o}){const r=e,i=o,a=t.computed(()=>r.schema.selectOptions||{}),d=f=>q(f)?null:f,l=t.toRefs(r),{getFieldID:s,clearValidationErrors:c,value:m}=we.useAbstractFields({model:l.model,schema:r.schema,formOptions:r.formOptions,formatValueToField:d,emitModelUpdated:f=>{i("modelUpdated",f.value,f.model)}});n({clearValidationErrors:c});const u=t.computed(()=>{const f=r.schema.values;return g(typeof f=="function"?f.apply(this,[r.model,r.schema]):f)}),g=f=>{const C=[];return f.forEach(k=>{C.push({label:I(k),value:S(k),disabled:typeof k=="object"&&k.disabled||void 0,group:typeof k=="object"&&String(k.group||"").toUpperCase()||void 0})}),C},S=f=>{if(H(f)){if(a.value&&typeof a.value.value<"u")return f[a.value.value];if(typeof f.id<"u")return String(f.id);throw new Error("`id` is not defined. If you want to use another key name, add a `value` property under `selectOptions` in the schema. https://icebob.gitbooks.io/vueformgenerator/content/fields/select.html#select-field-with-object-items")}else return f},I=f=>{if(H(f)){if(a.value&&typeof a.value.name<"u")return f[a.value.name];if(typeof f.name<"u")return String(f.name);throw new Error("`name` is not defined. If you want to use another key name, add a `name` property under `selectOptions` in the schema. https://icebob.gitbooks.io/vueformgenerator/content/fields/select.html#select-field-with-object-items")}else return String(f)};return(f,C)=>{const k=t.resolveComponent("KSelect");return t.openBlock(),t.createBlock(k,{id:t.unref(s)(e.schema),modelValue:t.unref(m),"onUpdate:modelValue":C[0]||(C[0]=B=>t.isRef(m)?m.value=B:null),class:t.normalizeClass(e.schema.fieldClasses),clearable:!e.schema.required,disabled:e.disabled||void 0,items:u.value,"kpop-attributes":{"data-testid":`${t.unref(s)(e.schema)}-items`},"label-attributes":{info:e.schema.help},name:e.schema.inputName,placeholder:a.value.hideNoneSelectedText?void 0:a.value.noneSelectedText||"Nothing Selected",required:e.schema.required||void 0,width:"100%"},null,8,["id","modelValue","class","clearable","disabled","items","kpop-attributes","label-attributes","name","placeholder","required"])}}}),Ds={name:"FieldArray",components:{FieldArrayItem:Bn,FieldArrayMultiItem:In,FieldSelect:jn,FieldMetric:Fn,FieldObject:Un,FieldObjectAdvanced:$n,FieldAutoSuggest:An,FieldRadio:Ln,FieldArrayCardContainer:Nn,FieldInput:On},mixins:[X],inject:{autofillSlot:{from:G,default:void 0}},props:{newElementButtonLabel:{type:String,default:"New Item"},removeElementButtonLabel:{type:String,default:"x"}},emits:["refreshModel"],methods:{generateSchema(e,n,o){var i,a,d;let r;return n&&(r=JSON.parse(JSON.stringify(n)),(d=(a=(i=r.schema)==null?void 0:i.fields)==null?void 0:a.map)==null||d.call(a,l=>(l.id=`${l.id||l.model}-${o}`,l))),{...r,set(l,s){e[o]=s},get(){return e[o]}}},newElement(){let e=this.value,n;(!e||!e.push)&&(e=[]),this.schema.items&&this.schema.items.default&&(typeof this.schema.items.default=="function"?n=this.schema.items.default():n=this.schema.items.default),e.push(n),this.value=[...e]},removeElement(e){this.value=this.value.filter((n,o)=>o!==e)},getFieldType(e){return"field-"+e.type},modelUpdated(){this.$emit("refreshModel")},handleInput(e,n){this.value=this.value.map((o,r)=>r===n?e:o)}}},vs=["id"],qs={key:1},Rs=["onUpdate:modelValue","aria-labelledby","type"],Ps=["onUpdate:modelValue","aria-labelledby"];function Ks(e,n,o,r,i,a){const d=t.resolveComponent("KTextArea"),l=t.resolveComponent("KInput"),s=t.resolveComponent("KButton");return e.schema?(t.openBlock(),t.createElementBlock("div",{key:0,id:e.getFieldID(e.schema),class:t.normalizeClass(e.schema.fieldClasses)},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.value,(c,m)=>(t.openBlock(),t.createElementBlock("div",{key:m,class:t.normalizeClass(e.schema.fieldItemsClasses)},[e.schema.items&&e.schema.itemContainerComponent?(t.openBlock(),t.createBlock(t.resolveDynamicComponent(e.schema.itemContainerComponent),{key:0,index:m,model:c,schema:a.generateSchema(e.value,e.schema.items,m),onRemoveItem:u=>a.removeElement(m)},{default:t.withCtx(()=>[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(a.getFieldType(e.schema.items)),{"form-options":e.formOptions,model:c,schema:a.generateSchema(e.value,e.schema.items,m),onModelUpdated:a.modelUpdated},null,40,["form-options","model","schema","onModelUpdated"]))]),_:2},1064,["index","model","schema","onRemoveItem"])):e.schema.items?(t.openBlock(),t.createElementBlock("span",qs,[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(a.getFieldType(e.schema.items)),{"form-options":e.formOptions,model:c,schema:a.generateSchema(e.value,e.schema.items,m),onModelUpdated:a.modelUpdated},null,40,["form-options","model","schema","onModelUpdated"]))])):e.schema.itemContainerComponent?(t.openBlock(),t.createBlock(t.resolveDynamicComponent(e.schema.itemContainerComponent),{key:2,"data-testid":`${e.getFieldID(e.schema)}-item-${m}`,model:c,schema:a.generateSchema(e.value,e.schema.items,m),onRemoveItem:u=>a.removeElement(m)},{after:t.withCtx(()=>[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(a.autofillSlot),{schema:e.schema,update:u=>e.value[m]=u,value:e.value[m]},null,8,["schema","update","value"]))]),default:t.withCtx(()=>{var u;return[e.schema.inputAttributes&&e.schema.inputAttributes.type==="textarea"?(t.openBlock(),t.createBlock(d,t.mergeProps({key:0,ref_for:!0},e.schema.inputAttributes,{id:e.getFieldID(e.schema),modelValue:e.value[m],"onUpdate:modelValue":g=>e.value[m]=g,"aria-labelledby":e.getLabelId(e.schema),class:e.schema.fieldClasses,maxlength:e.schema.max,minlength:e.schema.min,name:e.schema.inputName,placeholder:e.schema.placeholder,readonly:e.schema.readonly,required:e.schema.required,rows:e.schema.rows||2}),null,16,["id","modelValue","onUpdate:modelValue","aria-labelledby","class","maxlength","minlength","name","placeholder","readonly","required","rows"])):!e.schema.inputAttributes||!e.schema.inputAttributes.type||e.schema.inputAttributes.type==="text"||e.schema.inputAttributes.type==="number"?(t.openBlock(),t.createBlock(l,t.mergeProps({key:1,"aria-labelledby":e.getLabelId(e.schema),ref_for:!0},e.schema.inputAttributes,{"model-value":e.value[m],type:e.schema.inputAttributes&&e.schema.inputAttributes.type||"text",onInput:g=>{a.handleInput(g,m)}}),null,16,["aria-labelledby","model-value","type","onInput"])):t.withDirectives((t.openBlock(),t.createElementBlock("input",t.mergeProps({key:2,"onUpdate:modelValue":g=>e.value[m]=g,"aria-labelledby":e.getLabelId(e.schema),ref_for:!0},e.schema.inputAttributes,{type:((u=e.schema.inputAttributes)==null?void 0:u.type)||"text"}),null,16,Rs)),[[t.vModelDynamic,e.value[m]]])]}),_:2},1064,["data-testid","model","schema","onRemoveItem"])):(t.openBlock(),t.createElementBlock(t.Fragment,{key:3},[t.withDirectives(t.createElementVNode("input",t.mergeProps({ref_for:!0},e.schema.inputAttributes,{"onUpdate:modelValue":u=>e.value[m]=u,"aria-labelledby":e.getLabelId(e.schema),type:"text"}),null,16,Ps),[[t.vModelText,e.value[m]]]),(t.openBlock(),t.createBlock(t.resolveDynamicComponent(a.autofillSlot),{schema:e.schema,update:u=>e.value[m]=u,value:e.value[m]},null,8,["schema","update","value"]))],64))],2))),128)),t.createVNode(s,{appearance:"tertiary",class:t.normalizeClass(e.schema.newElementButtonLabelClasses),"data-testid":`add-${e.getFieldID(e.schema)}`,type:"button",onClick:a.newElement},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(e.schema.newElementButtonLabel||o.newElementButtonLabel),1)]),_:1},8,["class","data-testid","onClick"])],10,vs)):t.createCommentVNode("",!0)}const xs=j(Ds,[["render",Ks],["__scopeId","data-v-367d2ee8"]]),zs={class:"form-field-wrapper field-checkbox"},Ys=j(t.defineComponent({__name:"FieldCheckbox",props:{disabled:{type:Boolean,default:!1},formOptions:{type:Object,default:()=>{}},model:{type:Object,default:()=>{}},schema:{type:Object,required:!0},vfg:{type:Object,required:!0},errors:{type:Array,default:()=>[]},hint:{type:String,default:""}},emits:["modelUpdated"],setup(e,{expose:n,emit:o}){const r=e,i=o,a=t.toRefs(r),{getFieldID:d,value:l,clearValidationErrors:s}=we.useAbstractFields({model:a.model,schema:r.schema,formOptions:r.formOptions,emitModelUpdated:c=>{i("modelUpdated",c.value,c.model)}});return n({clearValidationErrors:s}),(c,m)=>{const u=t.resolveComponent("KCheckbox");return t.openBlock(),t.createElementBlock("div",zs,[t.createVNode(u,t.mergeProps(c.$attrs,{id:t.unref(d)(e.schema),modelValue:t.unref(l),"onUpdate:modelValue":m[0]||(m[0]=g=>t.isRef(l)?l.value=g:null),autocomplete:e.schema.autocomplete,class:e.schema.fieldClasses,disabled:e.disabled||void 0,help:e.hint?e.hint:void 0,name:e.schema.inputName,readonly:e.schema.readonly,required:e.schema.required,width:e.schema.width}),null,16,["id","modelValue","autocomplete","class","disabled","help","name","readonly","required","width"])])}}}),[["__scopeId","data-v-6b4ee1cd"]]);var Hs=4;function Dn(e){return Ie(e,Hs)}const Gs={class:"wrapper"},Ws=["disabled"],Zs=["id","checked","disabled","onChange","name"],Js=["disabled"],Xs={class:"info"},Qs={class:"dropList"},ed=["id","checked","disabled","onChange","name"];function td(e,n,o,r,i,a){const d=t.resolveDirective("attributes");return t.withDirectives((t.openBlock(),t.createElementBlock("div",Gs,[e.schema.listBox?(t.openBlock(),t.createElementBlock("div",{key:0,class:"listbox form-control",disabled:e.disabled||null},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(a.items,l=>(t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["list-row",{"is-checked":a.isItemChecked(l)}])},[t.createElementVNode("label",null,[t.withDirectives(t.createElementVNode("input",{id:e.getFieldID(e.schema,!0),type:"checkbox",checked:a.isItemChecked(l)||null,disabled:e.disabled||null,onChange:s=>a.onChanged(s,l),name:a.getInputName(l)},null,40,Zs),[[d,"input"]]),t.createTextVNode(t.toDisplayString(a.getItemName(l)),1)])],2))),256))],8,Ws)):t.createCommentVNode("",!0),e.schema.listBox?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("div",{key:1,class:"combobox form-control",disabled:e.disabled||null},[t.createElementVNode("div",{class:t.normalizeClass(["mainRow",{expanded:i.comboExpanded}]),onClick:n[0]||(n[0]=(...l)=>a.onExpandCombo&&a.onExpandCombo(...l))},[t.createElementVNode("div",Xs,t.toDisplayString(a.selectedCount)+" selected",1),n[1]||(n[1]=t.createElementVNode("div",{class:"arrow"},null,-1))],2),t.createElementVNode("div",Qs,[i.comboExpanded?(t.openBlock(!0),t.createElementBlock(t.Fragment,{key:0},t.renderList(a.items,l=>(t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["list-row",{"is-checked":a.isItemChecked(l)}])},[t.createElementVNode("label",null,[t.withDirectives(t.createElementVNode("input",{id:e.getFieldID(e.schema,!0),type:"checkbox",checked:a.isItemChecked(l)||null,disabled:e.disabled||null,onChange:s=>a.onChanged(s,l),name:a.getInputName(l)},null,40,ed),[[d,"input"]]),t.createTextVNode(t.toDisplayString(a.getItemName(l)),1)])],2))),256)):t.createCommentVNode("",!0)])],8,Js))])),[[d,"wrapper"]])}const nd=j({mixins:[X],data(){return{comboExpanded:!1}},computed:{items(){const e=this.schema.values;return typeof e=="function"?e.apply(this,[this.model,this.schema]):e},selectedCount(){return this.value?this.value.length:0}},methods:{getInputName(e){return this.schema&&this.schema.inputName&&this.schema.inputName.length>0?rn(this.schema.inputName+"_"+this.getItemValue(e)):rn(this.getItemValue(e))},getItemValue(e){if(H(e)){if(typeof this.schema.checklistOptions<"u"&&typeof this.schema.checklistOptions.value<"u")return e[this.schema.checklistOptions.value];if(typeof e.value<"u")return e.value;throw new Error("`value` is not defined. If you want to use another key name, add a `value` property under `checklistOptions` in the schema. https://icebob.gitbooks.io/vueformgenerator/content/fields/checklist.html#checklist-field-with-object-values")}else return e},getItemName(e){if(H(e)){if(typeof this.schema.checklistOptions<"u"&&typeof this.schema.checklistOptions.name<"u")return e[this.schema.checklistOptions.name];if(typeof e.name<"u")return e.name;throw new Error("`name` is not defined. If you want to use another key name, add a `name` property under `checklistOptions` in the schema. https://icebob.gitbooks.io/vueformgenerator/content/fields/checklist.html#checklist-field-with-object-values")}else return e},isItemChecked(e){return this.value&&this.value.indexOf(this.getItemValue(e))!==-1},onChanged(e,n){if((q(this.value)||!Array.isArray(this.value))&&(this.value=[]),e.target.checked){const o=Dn(this.value);o.push(this.getItemValue(n)),this.value=o}else{const o=Dn(this.value);o.splice(this.value.indexOf(this.getItemValue(n)),1),this.value=o}},onExpandCombo(){this.comboExpanded=!this.comboExpanded}}},[["render",td]]),od={name:"FieldKeyValuePairs",components:{TrashIcon:oe.TrashIcon},mixins:[X],inject:{autofillSlot:{from:G,default:void 0}},data(){return{pairs:[]}},watch:{pairs:{handler(){this.updateValue()},deep:!0}},created(){var n,o;this.value||(this.value={});const e=((o=this.model)==null?void 0:o[(n=this.schema)==null?void 0:n.model])??{};Object.keys(e).forEach(r=>{this.pairs.push({key:r,value:e[r]})})},methods:{onInput(e,n,o){this.pairs[n][o]=e.target.value},updateValue(){this.value=this.pairs.reduce((e,{key:n,value:o})=>({...e,...n&&o?{[n]:o}:null}),{})},addPair(){this.pairs.push({key:"",value:""})},removePair(e){this.pairs.splice(e,1)}}},rd={class:"key-value-pairs-editor"},ad={class:"pair-item-cell"},id=["data-testid","placeholder","value","onInput"],ld={class:"pair-item-cell"},sd=["data-testid","placeholder","value","onInput"];function dd(e,n,o,r,i,a){const d=t.resolveComponent("TrashIcon"),l=t.resolveComponent("KButton");return t.openBlock(),t.createElementBlock("div",rd,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(i.pairs,(s,c)=>(t.openBlock(),t.createElementBlock("div",{key:c,class:"pair-item"},[t.createElementVNode("div",ad,[t.createElementVNode("input",{class:"form-control","data-testid":`${e.getFieldID(e.schema)}-pair-key-${c}`,placeholder:e.schema.keyInputPlaceholder??"Key",type:"text",value:s.key,onInput:m=>{a.onInput(m,c,"key")}},null,40,id),(t.openBlock(),t.createBlock(t.resolveDynamicComponent(a.autofillSlot),{schema:e.schema,update:m=>a.onInput({target:{value:m}},c,"key"),value:s.key},null,8,["schema","update","value"]))]),t.createElementVNode("div",ld,[t.createElementVNode("input",{class:"form-control","data-testid":`${e.getFieldID(e.schema)}-pair-value-${c}`,placeholder:e.schema.valueInputPlaceholder??"Value",type:"text",value:s.value,onInput:m=>{a.onInput(m,c,"value")}},null,40,sd),(t.openBlock(),t.createBlock(t.resolveDynamicComponent(a.autofillSlot),{schema:e.schema,update:m=>a.onInput({target:{value:m}},c,"value"),value:s.value},null,8,["schema","update","value"]))]),t.createVNode(l,{appearance:"tertiary","data-testid":`${e.getFieldID(e.schema)}-remove-pair-${c}`,onClick:()=>{a.removePair(c)}},{default:t.withCtx(()=>[t.createVNode(d)]),_:2},1032,["data-testid","onClick"])]))),128)),t.createVNode(l,{appearance:"tertiary",class:t.normalizeClass(e.schema.newElementButtonLabelClasses),"data-testid":`${e.getFieldID(e.schema)}-add-pair`,type:"button",onClick:a.addPair},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(e.schema.newElementButtonLabel??"+ Add Pair"),1)]),_:1},8,["class","data-testid","onClick"])])}const cd=j(od,[["render",dd],["__scopeId","data-v-70998d5b"]]),md=j(t.defineComponent({__name:"FieldLabel",props:{disabled:{type:Boolean,default:!1},formOptions:{type:Object,default:()=>{}},model:{type:Object,default:()=>{}},schema:{type:Object,required:!0},vfg:{type:Object,required:!0}},setup(e){const n=e,o=t.toRefs(n),{getFieldID:r,value:i}=we.useAbstractFields({model:o.model,schema:n.schema,formOptions:n.formOptions});return(a,d)=>{const l=t.resolveComponent("KLabel");return t.openBlock(),t.createElementBlock("span",{class:t.normalizeClass(["field-label",e.schema.fieldClasses])},[t.createVNode(l,{id:t.unref(r)(e.schema)},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(t.unref(i)),1)]),_:1},8,["id"])],2)}}}),[["__scopeId","data-v-d046a15a"]]),ud={mixins:[X],emits:["model-updated"],methods:{onUpdate(e){this.$emit("model-updated",e,this.schema.model)}}};function fd(e,n,o,r,i,a){const d=t.resolveComponent("KMultiselect");return t.openBlock(),t.createBlock(d,{"aria-labelledby":e.getLabelId(e.schema),"data-testid":"field-multiselect",items:e.schema.values,"label-attributes":{info:e.schema.help},"model-value":e.value,placeholder:e.schema.placeholder,required:e.schema.required||void 0,width:"100%","onUpdate:modelValue":a.onUpdate},null,8,["aria-labelledby","items","label-attributes","model-value","placeholder","required","onUpdate:modelValue"])}const hd=j(ud,[["render",fd]]),pd={mixins:[X],emits:["model-updated"],data(){return{checkedGroup:null,fieldModel:{...this.model},fieldSchema:[]}},watch:{checkedGroup:{handler(e,n){if(n===null){this.fieldModel={...this.model};return}const o=this.schema.fields[e].fields,r=this.schema.fields[n].fields;r&&r.forEach(i=>this.updateModel("",i.model)),o&&o.forEach(i=>this.updateModel(this.fieldModel[i.model],i.model))}}},async created(){await this.$nextTick(),this.schema.fields.forEach((e,n)=>{e.fields&&e.fields.forEach(o=>{this.model[o.model]&&(this.checkedGroup=n,this.fieldSchema.push(o.model))})}),this.checkedGroup===null&&(this.checkedGroup=0)},methods:{updateModel(e,n){this.$emit("model-updated",e,n)}}},gd={class:"selection-group"},yd={class:"form-group horizontal-radios"},bd={class:"radio-group"},kd=["value"],wd={class:"control-help"},Cd={class:"option-field"},_d={class:"option-field-container"};function Ed(e,n,o,r,i,a){const d=t.resolveComponent("vue-form-generator");return t.openBlock(),t.createElementBlock("div",gd,[t.createElementVNode("div",yd,[t.createElementVNode("div",bd,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.schema.fields,(l,s)=>(t.openBlock(),t.createElementBlock("div",{key:s,class:"option-group"},[t.createElementVNode("label",{class:t.normalizeClass(["k-label",`${l.label}-check`])},[t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":n[0]||(n[0]=c=>i.checkedGroup=c),class:"k-input",type:"radio",value:s},null,8,kd),[[t.vModelRadio,i.checkedGroup]]),t.createTextVNode(" "+t.toDisplayString(l.label)+" ",1),t.createElementVNode("div",wd,t.toDisplayString(l.description),1)],2)]))),128))])]),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.schema.fields,(l,s)=>(t.openBlock(),t.createElementBlock("div",{key:s,class:"option-group"},[t.withDirectives(t.createElementVNode("div",Cd,[t.createElementVNode("div",_d,[t.createVNode(d,{model:e.model,options:{helpAsHtml:!0},schema:{fields:l.fields},onModelUpdated:a.updateModel},null,8,["model","schema","onModelUpdated"])])],512),[[t.vShow,l.fields&&i.checkedGroup===s]])]))),128))])}const Md=j(pd,[["render",Ed],["__scopeId","data-v-0aaaf597"]]),Ye={general:{packageName:"forms"},"post-function":{tags:{hint:"e.g. tag1, tag2, tag3",newElementButtonLabel:"+ Add"},enabled:{newElementButtonLabel:"+ Add"},selectionGroup:{newElementButtonLabel:"+ Add"},instance_name:{newElementButtonLabel:"+ Add"},name:{newElementButtonLabel:"+ Add"},"config-certificate":{help:"Array of stringified Lua code to be cached and run in sequence during the certificate phase.",newElementButtonLabel:"+ Add"},"config-access":{help:"Array of stringified Lua code to be cached and run in sequence during the access phase.",newElementButtonLabel:"+ Add"},"config-body_filter":{help:"Array of stringified Lua code to be cached and run in sequence during the body_filter phase.",newElementButtonLabel:"+ Add"},"config-header_filter":{help:"Array of stringified Lua code to be cached and run in sequence during the header_filter phase.",newElementButtonLabel:"+ Add"},"config-functions":{newElementButtonLabel:"+ Add"},"config-log":{newElementButtonLabel:"+ Add"},"config-rewrite":{newElementButtonLabel:"+ Add"},"config-ws_client_frame":{newElementButtonLabel:"+ Add"},"config-ws_close":{newElementButtonLabel:"+ Add"},"config-ws_handshake":{newElementButtonLabel:"+ Add"},"config-ws_upstream_frame":{newElementButtonLabel:"+ Add"}},"exit-transformer":{"config-functions":{newElementButtonLabel:"+ Add"}},rla:{view_advanced_fields:"View Advanced Fields",window_type:{label:"Rate Limit Window Type",help:"Sets the time window type to either <code>sliding</code> (default) or <code>fixed</code>.<br><ul><li>Sliding windows apply the rate limiting logic while taking into account previous hit rates (from the window that immediately precedes the current) using a dynamic weight.</li><li>Fixed windows consist of buckets that are statically assigned to a definitive time range, each request is mapped to only one fixed window based on its timestamp and will affect only that window&#39;s counters.</li></ul>",options:{fixed:"Fixed",sliding:"Sliding"}},request_limits:{title:"Request Limits",subtitle:"Set one or more limits on the number of API requests allowed within a defined timeframe.",label:"Limit",label_index:"Limit {index}",request_number:"Request number",time_interval:"Time interval",interval_determiner:"Every",seconds:"Seconds"},start_with_a_use_case:"Start with a use case:",use_case_index:"Use case {index}",error_message:{label:"Error Message",code_placeholder:"Code Message",message_placeholder:"Error Message",help:"Set a custom error code and message to be returned when the rate limit is exceeded."},identifiers:{label:"Identifiers",options:{ip:"IP",credential:"Credential",consumer:"Consumer",service:"Service",header:"Header",path:"Path","consumer-group":"Consumer Group"}},redis:{title:"Configure your Redis",address_example:"e.g. localhost:6379"}},vfg:{labels:{on:"On",off:"Off"}}},Sd={class:"form-field-wrapper"},Vd=t.defineComponent({__name:"FieldSwitch",props:{disabled:{type:Boolean,default:!1},formOptions:{type:Object,default:()=>{}},model:{type:Object,default:()=>{}},schema:{type:Object,required:!0},vfg:{type:Object,required:!0},errors:{type:Array,default:()=>[]},hint:{type:String,default:""}},emits:["modelUpdated"],setup(e,{expose:n,emit:o}){const r=e,i=o,{t:a}=Fe.createI18n("en-us",Ye),d=g=>g!=null&&r.schema.valueOn?g===r.schema.valueOn:g,l=g=>g!=null&&r.schema.valueOn?g?r.schema.valueOn:r.schema.valueOff:g,s=t.toRefs(r),{getFieldID:c,value:m,clearValidationErrors:u}=we.useAbstractFields({model:s.model,schema:r.schema,formOptions:r.formOptions,formatValueToField:d,formatValueToModel:l,emitModelUpdated:g=>{i("modelUpdated",g.value,g.model)}});return n({clearValidationErrors:u}),(g,S)=>{const I=t.resolveComponent("KInputSwitch");return t.openBlock(),t.createElementBlock("div",Sd,[t.createVNode(I,{id:t.unref(c)(e.schema),modelValue:t.unref(m),"onUpdate:modelValue":S[0]||(S[0]=f=>t.isRef(m)?m.value=f:null),autocomplete:e.schema.autocomplete,class:t.normalizeClass(e.schema.fieldClasses),disabled:e.disabled||void 0,label:t.unref(m)?e.schema.textOn||t.unref(a)("vfg.labels.on"):e.schema.textOff||t.unref(a)("vfg.labels.off"),"label-attributes":{info:e.schema.help},name:e.schema.inputName,required:e.schema.required||void 0},null,8,["id","modelValue","autocomplete","class","disabled","label","label-attributes","name","required"])])}}}),Td={class:"field-textarea"},Nd={name:"FormGroup",components:Object.freeze(Object.defineProperty({__proto__:null,FieldAdvanced:Yl,FieldArray:xs,FieldArrayCardContainer:Nn,FieldArrayItem:Bn,FieldArrayMultiItem:In,FieldAutoSuggest:An,FieldCheckbox:Ys,FieldChecklist:nd,FieldInput:On,FieldKeyValuePairs:cd,FieldLabel:md,FieldMetric:Fn,FieldMultiselect:hd,FieldObject:Un,FieldObjectAdvanced:$n,FieldRadio:Ln,FieldSelect:jn,FieldSelectionGroup:Md,FieldSwitch:Vd,FieldTextArea:j(t.defineComponent({__name:"FieldTextArea",props:{disabled:{type:Boolean,default:!1},formOptions:{type:Object,default:()=>{}},model:{type:Object,default:()=>{}},schema:{type:Object,required:!0},vfg:{type:Object,required:!0},errors:{type:Array,default:()=>[]},hint:{type:String,default:""}},emits:["modelUpdated"],setup(e,{expose:n,emit:o}){const r=e,i=o,a=t.toRefs(r),d=t.inject(G,void 0),{updateModelValue:l,getFieldID:s,clearValidationErrors:c,value:m}=we.useAbstractFields({model:a.model,schema:r.schema,formOptions:r.formOptions,emitModelUpdated:g=>{i("modelUpdated",g.value,g.model)}});n({clearValidationErrors:c});const u=g=>{m.value=g,l(g,g)};return(g,S)=>{const I=t.resolveComponent("KTextArea");return t.openBlock(),t.createElementBlock("div",Td,[t.createVNode(I,t.mergeProps(g.$attrs,{id:t.unref(s)(e.schema),modelValue:t.unref(m),"onUpdate:modelValue":S[0]||(S[0]=f=>t.isRef(m)?m.value=f:null),class:e.schema.fieldClasses,disabled:e.disabled||void 0,help:e.hint||void 0,maxlength:e.schema.max,minlength:e.schema.min,name:e.schema.inputName,placeholder:e.schema.placeholder,readonly:e.schema.readonly,required:e.schema.required,rows:e.schema.rows||2}),null,16,["id","modelValue","class","disabled","help","maxlength","minlength","name","placeholder","readonly","required","rows"]),(t.openBlock(),t.createBlock(t.resolveDynamicComponent(t.unref(d)),{schema:e.schema,update:u,value:t.unref(m)},null,8,["schema","value"]))])}}}),[["__scopeId","data-v-b6cec018"]])},Symbol.toStringTag,{value:"Module"})),mixins:[an],inject:{"vfg-array-item-index":{default:void 0}},props:{vfg:{type:Object,required:!0},model:{type:Object,default:()=>{}},options:{type:Object,default:()=>{}},field:{type:Object,required:!0},errors:{type:Array,default(){return[]}}},emits:["validated","modelUpdated","refreshModel"],data(){return{child:t.ref()}},computed:{schema(){var n;if(!((n=this.field)!=null&&n.schema)||!Array.isArray(this.field.schema.fields))return this.field;const e=this["vfg-array-item-index"];return typeof e!="number"||Number.isNaN(e)?this.field:{...this.field,schema:{...this.field.schema,fields:this.field.schema.fields.map(o=>({...o,...o.id?{id:`${o.id}-${e}`}:void 0}))}}}},methods:{fieldTypeHasLabel(e){if(q(e.label))return!1;let n="";switch(e.type==="input"?n=e.inputType:n=e.type,n){case"button":case"submit":case"reset":return!1;default:return!0}},getFieldID(e){const n=F(this.options,"fieldIdPrefix","");return rt(e,n)},getTooltipId(e){return`${this.getFieldID(e)}-tooltip`},getFieldType(e){return"field-"+e.type},getButtonType(e){return F(e,"type","button")},onFieldValidated(e,n,o){this.$emit("validated",e,n,o)},buttonVisibility(e){return e.buttons&&e.buttons.length>0},buttonClickHandler(e,n,o){return e.onclick.call(this,this.model,n,o,this)},fieldHint(e){return L(e.hint)?e.hint.call(this,this.model,e,this):e.hint},fieldErrors(e){return this.errors.filter(n=>n.field.fieldName===e.fieldName).map(n=>n.error)},onRefreshModel(){this.$emit("refreshModel")},onModelUpdated(e,n){this.$emit("modelUpdated",e,n)},validate(e){return this.$refs.child.validate(e)},clearValidationErrors(){if(this.$refs.child)return this.$refs.child.clearValidationErrors()},formattedLabel(e){return e?e.replace(/^[cC]onfig\./,""):""}}},Bd=["innerHTML"],Id={class:"icon-wrapper"},Ad=["innerHTML"],Od={key:0,class:"link-wrapper"},Fd={class:"field-wrap"},Ud={key:0,class:"buttons"},$d=["type","onClick","textContent"],Ld=["innerHTML"],jd={key:2,class:"errors help-block"},Dd=["innerHTML"];function vd(e,n,o,r,i,a){const d=t.resolveComponent("KExternalLink"),l=t.resolveComponent("KLabel");return t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["form-group",e.getFieldRowClasses(o.field)])},[a.fieldTypeHasLabel(o.field)?(t.openBlock(),t.createBlock(l,{key:0,"aria-describedby":o.field.help?a.getTooltipId(o.field):void 0,class:t.normalizeClass([o.field.labelClasses,"form-group-label"]),for:a.getFieldID(o.field),info:!o.options.helpAsHtml&&o.field.help?o.field.help:void 0,"tooltip-attributes":o.field.help?{maxWidth:"300",placement:"top",tooltipId:a.getTooltipId(o.field)}:void 0},t.createSlots({default:t.withCtx(()=>[t.createElementVNode("div",Id,[t.createElementVNode("span",{innerHTML:a.formattedLabel(o.field.label)},null,8,Ad)]),o.field.link?(t.openBlock(),t.createElementBlock("div",Od,[t.createVNode(d,{href:o.field.link},{default:t.withCtx(()=>n[0]||(n[0]=[t.createElementVNode("span",{class:"section-header"},"More info",-1)])),_:1},8,["href"])])):t.createCommentVNode("",!0)]),_:2},[o.options.helpAsHtml&&o.field.help?{name:"tooltip",fn:t.withCtx(()=>[t.createElementVNode("div",{innerHTML:o.field.help},null,8,Bd)]),key:"0"}:void 0]),1032,["aria-describedby","class","for","info","tooltip-attributes"])):t.createCommentVNode("",!0),t.createElementVNode("div",Fd,[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(a.getFieldType(o.field)),t.mergeProps(e.$attrs,{ref:"child",disabled:e.fieldDisabled(o.field)||null,"form-options":o.options,hint:o.field.hint&&a.getFieldType(o.field)==="field-input"?a.fieldHint(o.field):void 0,model:o.model,schema:a.schema,vfg:o.vfg,onModelUpdated:a.onModelUpdated,onRefreshModel:a.onRefreshModel,onValidated:a.onFieldValidated}),null,16,["disabled","form-options","hint","model","schema","vfg","onModelUpdated","onRefreshModel","onValidated"])),a.buttonVisibility(o.field)?(t.openBlock(),t.createElementBlock("div",Ud,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(o.field.buttons,(s,c)=>(t.openBlock(),t.createElementBlock("button",{key:c,class:t.normalizeClass(s.classes),type:a.getButtonType(s),onClick:m=>a.buttonClickHandler(s,o.field,m),textContent:t.toDisplayString(s.label)},null,10,$d))),128))])):t.createCommentVNode("",!0)]),o.field.hint&&a.getFieldType(o.field)!=="field-input"?(t.openBlock(),t.createElementBlock("div",{key:1,class:"hint",innerHTML:a.fieldHint(o.field)},null,8,Ld)):t.createCommentVNode("",!0),a.fieldErrors(o.field).length>0?(t.openBlock(),t.createElementBlock("div",jd,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(a.fieldErrors(o.field),(s,c)=>(t.openBlock(),t.createElementBlock("span",{key:c,innerHTML:s},null,8,Dd))),128))])):t.createCommentVNode("",!0)],2)}const qd={name:"FormGenerator",components:{formGroup:j(Nd,[["render",vd],["__scopeId","data-v-49ca89d6"]])},mixins:[an],inject:{autofillSlot:{from:G,default:void 0}},provide(){var e;return{...!this.autofillSlot&&{[G]:(e=this.$slots)==null?void 0:e[pe]}}},props:{schema:{type:Object,default:()=>{}},model:{type:Object,default:()=>{}},options:{type:Object,default(){return{validateAfterLoad:!1,validateAfterChanged:!1,child:t.ref([]),fieldIdPrefix:"",validateAsync:!1,validationErrorClass:"error",validationSuccessClass:"",helpAsHtml:!1}}},multiple:{type:Boolean,default:!1},isNewModel:{type:Boolean,default:!1},tag:{type:String,default:"fieldset",validator:function(e){return e.length>0}}},emits:["validated","modelUpdated","refreshModel"],data(){return{vfg:this,errors:[],children:t.ref([]),collapseStates:{}}},computed:{fields(){const e=[];return this.schema&&this.schema.fields&&x(this.schema.fields,n=>{(!this.multiple||n.multi===!0)&&e.push(n)}),e},groups(){const e=[];return this.schema&&this.schema.groups&&x(this.schema.groups.slice(0),n=>{e.push(n)}),e}},watch:{model:{deep:!0,handler(e,n){n!==e&&e!=null&&this.$nextTick(()=>{this.options.validateAfterLoad===!0&&this.isNewModel!==!0?this.validate():this.clearValidationErrors()})}}},mounted(){this.$nextTick(()=>{this.model&&(this.options.validateAfterLoad===!0&&this.isNewModel!==!0?this.validate():this.clearValidationErrors())})},methods:{fieldVisible(e){return L(e.visible)?e.visible.call(this,this.model,e,this):q(e.visible)?!0:e.visible},onFieldValidated(e,n,o){this.errors=this.errors.filter(i=>i.field.fieldName!==o.schema.fieldName),!e&&n&&n.length>0&&x(n,i=>{this.errors.push({field:o.schema,error:i})});const r=this.errors.length===0;this.$emit("validated",r,this.errors,this)},onRefreshModel(){this.$emit("refreshModel")},onModelUpdated(e,n){this.$emit("modelUpdated",e,n)},validate(e=null){e===null&&(e=F(this.options,"validateAsync",!1)),this.clearValidationErrors();const n=[],o=[];x(this.$refs.children,i=>{L(i.validate)&&(n.push(i.$refs.child),o.push(i.$refs.child.validate(!0)))});const r=i=>{const a=[];x(i,(l,s)=>{Array.isArray(l)&&l.length>0&&x(l,c=>{a.push({field:n[s].schema,error:c})})}),this.errors=a;const d=a.length===0;return this.$emit("validated",d,a,this),e?a:d};return e?Promise.all(o).then(r):r(o)},clearValidationErrors(){this.errors.splice(0),x(this.$refs.children,e=>{e.clearValidationErrors()})}}},Rd={key:0,class:"vue-form-generator"},Pd={key:0};function Kd(e,n,o,r,i,a){const d=t.resolveComponent("form-group"),l=t.resolveComponent("KCollapse");return o.schema!=null?(t.openBlock(),t.createElementBlock("div",Rd,[o.schema.fields?(t.openBlock(),t.createBlock(t.resolveDynamicComponent(o.tag),{key:0},{default:t.withCtx(()=>[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(a.fields,s=>(t.openBlock(),t.createElementBlock(t.Fragment,{key:s.model},[a.fieldVisible(s)?(t.openBlock(),t.createBlock(d,{key:0,ref_for:!0,ref:"children",errors:i.errors,field:s,model:o.model,options:o.options,vfg:i.vfg,onModelUpdated:a.onModelUpdated,onRefreshModel:a.onRefreshModel,onValidated:a.onFieldValidated},null,8,["errors","field","model","options","vfg","onModelUpdated","onRefreshModel","onValidated"])):t.createCommentVNode("",!0)],64))),128))]),_:1})):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(a.groups,(s,c)=>(t.openBlock(),t.createElementBlock(t.Fragment,{key:`group-${c}`},[s.collapsible!==void 0&&s.collapsible!==!1?(t.openBlock(),t.createBlock(l,{key:0,class:"root-level-collapse","model-value":!1,title:s.collapsible.title},t.createSlots({default:t.withCtx(()=>{var m,u,g,S;return[(m=s.slots)!=null&&m.beforeContent?t.renderSlot(e.$slots,(u=s.slots)==null?void 0:u.beforeContent,{key:0}):t.createCommentVNode("",!0),s.fields.length===0&&((g=s.slots)!=null&&g.emptyState)?t.renderSlot(e.$slots,(S=s.slots)==null?void 0:S.emptyState,{key:1}):(t.openBlock(),t.createBlock(t.resolveDynamicComponent(o.tag),{key:2,class:t.normalizeClass(e.getFieldRowClasses(s))},{default:t.withCtx(()=>[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(s.fields,I=>(t.openBlock(),t.createElementBlock(t.Fragment,{key:I.model},[a.fieldVisible(I)?(t.openBlock(),t.createBlock(d,{key:0,ref_for:!0,ref:"children",errors:i.errors,field:I,model:o.model,options:o.options,vfg:i.vfg,onModelUpdated:a.onModelUpdated,onRefreshModel:a.onRefreshModel,onValidated:a.onFieldValidated},null,8,["errors","field","model","options","vfg","onModelUpdated","onRefreshModel","onValidated"])):t.createCommentVNode("",!0)],64))),128))]),_:2},1032,["class"])),s.collapsible!==!0&&s.collapsible.nestedCollapsible&&s.collapsible.nestedCollapsible.fields.length>0?(t.openBlock(),t.createBlock(l,{key:3,class:"nested-collapse","model-value":i.collapseStates[`group-${c}-nested`]??!0,"trigger-alignment":"leading","trigger-label":i.collapseStates[`group-${c}-nested`]??!0?s.collapsible.nestedCollapsible.triggerLabel.expand:s.collapsible.nestedCollapsible.triggerLabel.collapse,"onUpdate:modelValue":I=>i.collapseStates[`group-${c}-nested`]=I},{default:t.withCtx(()=>[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(o.tag),{class:t.normalizeClass(e.getFieldRowClasses(s))},{default:t.withCtx(()=>[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(s.collapsible.nestedCollapsible.fields,I=>(t.openBlock(),t.createElementBlock(t.Fragment,{key:I.model},[a.fieldVisible(I)?(t.openBlock(),t.createBlock(d,{key:0,ref_for:!0,ref:"children",errors:i.errors,field:I,model:o.model,options:o.options,vfg:i.vfg,onModelUpdated:a.onModelUpdated,onRefreshModel:a.onRefreshModel,onValidated:a.onFieldValidated},null,8,["errors","field","model","options","vfg","onModelUpdated","onRefreshModel","onValidated"])):t.createCommentVNode("",!0)],64))),128))]),_:2},1032,["class"]))]),_:2},1032,["model-value","trigger-label","onUpdate:modelValue"])):t.createCommentVNode("",!0)]}),_:2},[s.collapsible.description?{name:"visible-content",fn:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(s.collapsible.description),1)]),key:"0"}:void 0]),1032,["title"])):(t.openBlock(),t.createBlock(t.resolveDynamicComponent(o.tag),{key:1,class:t.normalizeClass(e.getFieldRowClasses(s))},{default:t.withCtx(()=>[s.legend?(t.openBlock(),t.createElementBlock("legend",Pd,t.toDisplayString(s.legend),1)):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(s.fields,m=>(t.openBlock(),t.createElementBlock(t.Fragment,{key:m.model},[a.fieldVisible(m)?(t.openBlock(),t.createBlock(d,{key:0,ref_for:!0,ref:"children",errors:i.errors,field:m,model:o.model,options:o.options,vfg:i.vfg,onModelUpdated:a.onModelUpdated,onRefreshModel:a.onRefreshModel,onValidated:a.onFieldValidated},null,8,["errors","field","model","options","vfg","onModelUpdated","onRefreshModel","onValidated"])):t.createCommentVNode("",!0)],64))),128))]),_:2},1032,["class"]))],64))),128))])):t.createCommentVNode("",!0)}const z=j(qd,[["render",Kd]]),vn=new Set(["config-client_id","config-client_secret","config-issuer"]),qn=new Set(["config-scopes_claim","config-scopes_required","config-audience_claim","config-audience_required","config-roles_claim","config-roles_required","config-groups_claim","config-groups_required","config-authenticated_groups_claim"]),xd={name:"OIDCForm",components:{VueFormGenerator:z},provide(){var e;return{[G]:(e=this.$slots)==null?void 0:e[pe]}},props:{formModel:{type:Object,required:!0},formSchema:{type:Object,required:!0},formOptions:{type:Object,default:()=>{}},onModelUpdated:{type:Function,required:!0},isEditing:{type:Boolean,required:!0}},data(){return{init:!1,authMethods:[],sessionManagement:!1,globalFields:null,commonFieldsSchema:null,authFieldsSchema:null,advancedFieldsSchema:{fields:[]},advancedFields:null,tabs:[{hash:"#common",title:"Common"},{hash:"#authorization",title:"Authorization"},{hash:"#advanced",title:"Advanced"}]}},computed:{displayForm(){return this.formModel.id&&this.isEditing||!this.isEditing}},watch:{formModel:{handler:function(){this.oidcSetup()}}},mounted(){this.oidcSetup()},methods:{oidcSetup(){var e;if(!this.init){this.init=!0,this.globalFields={fields:this.formSchema.fields.filter(o=>!o.model.startsWith("config")&&o.model!=="tags")};const n=this.formSchema.fields.reduce((o,r)=>(o[r.model]=r,o),{});this.commonFieldsSchema={fields:Array.from(vn).reduce((o,r)=>(n[r]&&o.push(n[r]),o),[])},this.authFieldsSchema={fields:Array.from(qn).reduce((o,r)=>(n[r]&&o.push(n[r]),o),[])},this.advancedFieldsSchema={fields:this.formSchema.fields.filter(o=>o.model.startsWith("config")&&o.model!=="config-auth_methods"&&!vn.has(o.model)&&!qn.has(o.model)||o.model==="tags").reduce((o,r)=>{var i,a,d,l;switch(r.model){case"config-client_jwk":{if(Array.isArray((a=(i=r.items)==null?void 0:i.schema)==null?void 0:a.fields))for(const s of r.items.schema.fields)s.label=s.model;o.push({...r,link:"https://docs.konghq.com/hub/kong-inc/openid-connect/#jwk-record",newElementButtonLabel:"+ Add Client JWK",...Array.isArray((l=(d=r.items)==null?void 0:d.schema)==null?void 0:l.fields)&&r.items.schema.fields.map(s=>({...s,label:s.model}))});break}case"config-session_redis_cluster_nodes":{o.push({...r,link:"https://docs.konghq.com/hub/kong-inc/openid-connect/#host-record",newElementButtonLabel:"+ Add Cluster Node"});break}default:o.push(r)}return o},[])},this.sessionManagement=this.isEditing?this.formModel["config-auth_methods"].includes("session"):!1,this.authMethods=[{label:"Authorization Code Flow",value:"authorization_code",hint:"authorization code flow",prop:this.isEditing?this.formModel["config-auth_methods"].includes("authorization_code"):!1},{label:"Bearer Access Token",value:"bearer",hint:"JWT access token verification",prop:this.isEditing?this.formModel["config-auth_methods"].includes("bearer"):!1},{label:"Client Credentials Grant",value:"client_credentials",hint:"OAuth client credentials grant",prop:this.isEditing?this.formModel["config-auth_methods"].includes("client_credentials"):!1},{label:"Passwords Grant",value:"password",hint:"OAuth legacy password grant",prop:this.isEditing?this.formModel["config-auth_methods"].includes("password"):!1},{label:"Introspection",value:"introspection",hint:"OAuth introspection",prop:this.isEditing?this.formModel["config-auth_methods"].includes("introspection"):!1},{label:"UserInfo",value:"userinfo",hint:"OpenID Connect user info endpoint authentication",prop:this.isEditing?this.formModel["config-auth_methods"].includes("userinfo"):!1},{label:"Kong OAuth",value:"kong_oauth2",hint:"Kong OAuth plugin issued tokens verification",prop:this.isEditing?this.formModel["config-auth_methods"].includes("kong_oauth2"):!1},{label:"Refresh Token",value:"refresh_token",hint:"OAuth refresh token grant",prop:this.isEditing?this.formModel["config-auth_methods"].includes("refresh_token"):!1}];for(const o of[this.commonFieldsSchema,this.authFieldsSchema,this.advancedFieldsSchema])for(const r of o.fields){const i=(e=n[r.model])==null?void 0:e.help;r.help===void 0&&typeof i=="string"&&(r.help=i)}}},getAuthMethodsValue(e,n){const o=[];for(let r=0;r<this.authMethods.length;r++)this.authMethods[r].prop&&this.authMethods[r].value!==e&&o.push(this.authMethods[r].value);return this.sessionManagement&&e&&o.push("session"),n&&(e?o.push(e):o.push("session")),o},handleUpdate(e,n){this.formModel["config-auth_methods"]=this.getAuthMethodsValue(n,e),this.onModelUpdated()}}},zd={class:"general-settings"},Yd={class:"link-wrapper"},Hd={class:"auth-method-container"},Gd={class:"general-settings"},Wd={class:"link-wrapper"},Zd={class:"general-settings"},Jd={class:"link-wrapper"};function Xd(e,n,o,r,i,a){const d=t.resolveComponent("VueFormGenerator"),l=t.resolveComponent("KExternalLink"),s=t.resolveComponent("KLabel"),c=t.resolveComponent("KCheckbox"),m=t.resolveComponent("KInputSwitch"),u=t.resolveComponent("KTabs");return t.openBlock(),t.createElementBlock("div",null,[o.formModel.id&&o.isEditing||!o.isEditing?(t.openBlock(),t.createBlock(d,{key:0,class:"global-fields",model:o.formModel,options:o.formOptions,schema:i.globalFields,onModelUpdated:o.onModelUpdated},null,8,["model","options","schema","onModelUpdated"])):t.createCommentVNode("",!0),t.createVNode(u,{tabs:i.tabs},{common:t.withCtx(()=>[t.createElementVNode("div",zd,[t.createElementVNode("div",Yd,[t.createVNode(l,{href:"https://docs.konghq.com/hub/kong-inc/openid-connect/#important-configuration-parameters"},{default:t.withCtx(()=>n[1]||(n[1]=[t.createElementVNode("span",{class:"section-header"},"Common Configuration Settings",-1)])),_:1})]),n[3]||(n[3]=t.createElementVNode("div",{class:"description"}," Parameters for enabling the OpenID Connect plugin. Set these parameters before adding authorization, authentication, or other advanced configuration details. ",-1)),a.displayForm?(t.openBlock(),t.createBlock(d,{key:0,model:o.formModel,options:o.formOptions,schema:i.commonFieldsSchema,onModelUpdated:o.onModelUpdated},null,8,["model","options","schema","onModelUpdated"])):t.createCommentVNode("",!0),t.createVNode(s,null,{default:t.withCtx(()=>n[2]||(n[2]=[t.createTextVNode("Auth Methods")])),_:1}),t.createElementVNode("div",Hd,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(i.authMethods,g=>(t.openBlock(),t.createElementBlock("div",{key:g.value,class:"auth-method"},[t.createVNode(c,{modelValue:g.prop,"onUpdate:modelValue":S=>g.prop=S,onChange:S=>a.handleUpdate(S,g.value)},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(g.label),1)]),_:2},1032,["modelValue","onUpdate:modelValue","onChange"])]))),128))]),t.createVNode(m,{modelValue:i.sessionManagement,"onUpdate:modelValue":n[0]||(n[0]=g=>i.sessionManagement=g),label:"Enable Session Management",onChange:a.handleUpdate},null,8,["modelValue","onChange"])])]),authorization:t.withCtx(()=>[t.createElementVNode("div",Gd,[t.createElementVNode("div",Wd,[t.createVNode(l,{href:"https://docs.konghq.com/hub/kong-inc/openid-connect/#authorization"},{default:t.withCtx(()=>n[4]||(n[4]=[t.createElementVNode("span",{class:"section-header"},"Authorization Configuration Settings",-1)])),_:1})]),n[5]||(n[5]=t.createElementVNode("div",{class:"description"}," Parameters for setting up claims-based authorization. ",-1)),a.displayForm?(t.openBlock(),t.createBlock(d,{key:0,model:o.formModel,options:o.formOptions,schema:i.authFieldsSchema,onModelUpdated:o.onModelUpdated},{"autofill-provider":t.withCtx(g=>[t.renderSlot(e.$slots,"autofill-provider",t.normalizeProps(t.guardReactiveProps(g)),void 0,!0)]),_:3},8,["model","options","schema","onModelUpdated"])):t.createCommentVNode("",!0)])]),advanced:t.withCtx(()=>[t.createElementVNode("div",Zd,[t.createElementVNode("div",Jd,[t.createVNode(l,{href:"https://docs.konghq.com/hub/kong-inc/openid-connect/"},{default:t.withCtx(()=>n[6]||(n[6]=[t.createElementVNode("span",{class:"section-header"},"Advanced Configuration Settings",-1)])),_:1})]),n[7]||(n[7]=t.createElementVNode("div",{class:"description"}," Advanced parameters for manually configuring the OpenID Connect plugin. ",-1)),a.displayForm?(t.openBlock(),t.createBlock(d,{key:0,model:o.formModel,options:o.formOptions,schema:i.advancedFieldsSchema,onModelUpdated:o.onModelUpdated},null,8,["model","options","schema","onModelUpdated"])):t.createCommentVNode("",!0)])]),_:3},8,["tabs"])])}const Qd=j(xd,[["render",Xd],["__scopeId","data-v-bb72c68e"]]),ec=j(t.defineComponent({__name:"PostFunction",props:{formModel:{type:Object,required:!0},formSchema:{type:Object,required:!0},formOptions:{type:Object,default:()=>{}},onModelUpdated:{type:Function,required:!0},isEditing:{type:Boolean,required:!0}},setup(e){var d;t.provide(G,(d=t.useSlots())==null?void 0:d[pe]);const{t:n,te:o}=Fe.createI18n("en-us",Ye),r=e,i=t.computed(()=>r.formModel.id&&r.isEditing||!r.isEditing),a=t.computed(()=>{const l=r.formSchema;return l.fields.map(s=>{const c=`post-function.${s.model}`;return s.hint=o(`${c}.hint`)&&n(`${c}.hint`)||s.hint,s.help=o(`${c}.help`)&&n(`${c}.help`)||s.help,s.newElementButtonLabel=o(`${c}.newElementButtonLabel`)&&n(`${c}.newElementButtonLabel`)||s.newElementButtonLabel,s.model!=="tags"&&(s.valueType==="array"||s.type==="array")&&(s.type="array",s.valueArrayType="array",s.itemContainerComponent="FieldArrayItem",s.fieldClasses="post-function-array-item-container",s.fieldItemsClasses="post-function-array-item",s.inputAttributes={...s.inputAttributes,type:"textarea"}),s}),l});return(l,s)=>i.value?(t.openBlock(),t.createBlock(z,{key:0,model:e.formModel,options:e.formOptions,schema:a.value,onModelUpdated:e.onModelUpdated},null,8,["model","options","schema","onModelUpdated"])):t.createCommentVNode("",!0)}}),[["__scopeId","data-v-f54f37ae"]]),tc=j(t.defineComponent({__name:"ExitTransformer",props:{formModel:{type:Object,required:!0},formSchema:{type:Object,required:!0},formOptions:{type:Object,default:()=>{}},onModelUpdated:{type:Function,required:!0},isEditing:{type:Boolean,required:!0}},setup(e){var d;t.provide(G,(d=t.useSlots())==null?void 0:d[pe]);const{t:n,te:o}=Fe.createI18n("en-us",Ye),r=e,i=t.computed(()=>r.formModel.id&&r.isEditing||!r.isEditing),a=t.computed(()=>{const l=r.formSchema;return l.fields.map(s=>{const c=`exit-transformer.${s.model}`;return s.hint=o(`${c}.hint`)&&n(`${c}.hint`)||s.hint,s.help=o(`${c}.help`)&&n(`${c}.help`)||s.help,s.newElementButtonLabel=o(`${c}.newElementButtonLabel`)&&n(`${c}.newElementButtonLabel`)||s.newElementButtonLabel,s.model!=="tags"&&(s.valueType==="array"||s.type==="array")&&(s.type="array",s.valueArrayType="array",s.itemContainerComponent="FieldArrayItem",s.fieldClasses="exit-transformer-array-item-container",s.fieldItemsClasses="exit-transformer-array-item",s.inputAttributes={...s.inputAttributes,type:"textarea"}),s}),l});return(l,s)=>i.value?(t.openBlock(),t.createBlock(z,{key:0,model:e.formModel,options:e.formOptions,schema:a.value,onModelUpdated:e.onModelUpdated},null,8,["model","options","schema","onModelUpdated"])):t.createCommentVNode("",!0)}}),[["__scopeId","data-v-0d5c541f"]]),nc={fields:[{inputType:"text",label:"Config.Account Email",model:"config-account_email",required:!0,type:"input"},{inputType:"text",label:"Config.Account Key.Key Id",model:"config-account_key-key_id",required:!0,type:"input"},{type:"input",inputType:"text",valueType:"string",label:"Config.Account Key.Key Set",model:"config-account_key-key_set",order:0,disabled:!1},{type:"checkbox",default:!1,valueType:"boolean",label:"Config.Allow Any Domain",model:"config-allow_any_domain",order:0,disabled:!1}]},oc={fields:[{type:"input",default:"",inputType:"text",valueType:"string",model:"config-api_uri",label:"Config.Api Uri",order:0,disabled:!1},{type:"checkbox",default:!1,valueType:"boolean",model:"config-tos_accepted",label:"Config.Tos Accepted",order:0,disabled:!1}]},rc={fields:[{type:"input",default:"",inputType:"text",valueType:"string",model:"config-api_uri",label:"Config.Api Uri",order:0,disabled:!1},{type:"input",inputType:"text",valueType:"string",model:"config-eab_hmac_key",label:"Config.Eab Hmac Key",order:0,disabled:!1},{type:"input",inputType:"text",valueType:"string",model:"config-eab_kid",label:"Config.Eab Kid",order:0,disabled:!1}]},ac={class:"general-settings"},ic={class:"sub-form"},lc={class:"general-settings"},sc={class:"sub-form"},dc={class:"general-settings"},cc=j(t.defineComponent({__name:"ACMEForm",props:{formModel:{type:Object,required:!0},formSchema:{type:Object,required:!0},formOptions:{type:Object,default:()=>{}},onModelUpdated:{type:Function,required:!0},isEditing:{type:Boolean,required:!0}},setup(e){var A;t.provide(G,(A=t.useSlots())==null?void 0:A[pe]);const n=e,o=t.ref("zeroSsl"),r=t.ref("shm"),i=t.computed(()=>{var p;const h={};if((p=n.formSchema)!=null&&p.fields)for(const M of n.formSchema.fields)h[M.model]=M;return h}),a=t.computed(()=>{var p;const h=ne(nc);for(const M of h.fields){const T=(p=i.value[M.model])==null?void 0:p.help;M.help===void 0&&typeof T=="string"&&(M.help=T)}return h}),d=t.computed(()=>{var p;const h=ne(oc);for(const M of h.fields){const T=(p=i.value[M.model])==null?void 0:p.help;M.help===void 0&&typeof T=="string"&&(M.help=T)}return h}),l=t.computed(()=>{var p;const h=ne(rc);for(const M of h.fields){const T=(p=i.value[M.model])==null?void 0:p.help;M.help===void 0&&typeof T=="string"&&(M.help=T)}return h}),s=t.computed(()=>({fields:n.formSchema.fields.filter(h=>!h.model.startsWith("config")&&h.model!=="tags")})),c=t.computed(()=>({fields:a.value.fields.filter(p=>!d.value.fields.some(M=>M.model===p.model)&&!l.value.fields.some(M=>M.model===p.model))})),m=t.computed(()=>({fields:n.formSchema.fields.filter(p=>p.model.startsWith("config-storage")&&!p.model.startsWith("config-storage_config-consul")&&!p.model.startsWith("config-storage_config-redis")&&!p.model.startsWith("config-storage_config-shm")&&!p.model.startsWith("config-storage_config-vault"))})),u=t.computed(()=>({fields:n.formSchema.fields.filter(p=>p.model.startsWith("config-storage_config-consul"))})),g=t.computed(()=>({fields:n.formSchema.fields.filter(p=>p.model.startsWith("config-storage_config-redis"))})),S=t.computed(()=>({fields:n.formSchema.fields.filter(p=>p.model.startsWith("config-storage_config-shm"))})),I=t.computed(()=>({fields:n.formSchema.fields.filter(p=>p.model.startsWith("config-storage_config-vault"))})),f=t.computed(()=>({fields:n.formSchema.fields.filter(h=>h.model.startsWith("config")&&!c.value.fields.filter(p=>p.model===h.model).length&&!m.value.fields.filter(p=>p.model===h.model).length||h.model==="tags")})),C=t.computed(()=>n.formModel.id&&n.isEditing||!n.isEditing),k=[{hash:"#general",title:"General"},{hash:"#storage",title:"Storage"},{hash:"#advanced",title:"Advanced"}],B=[{label:"Lets Encrypt",value:"letsEncrypt"},{label:"Zero SSL",value:"zeroSsl",selected:!0},{label:"Other",value:"other"}];t.onMounted(()=>{o.value==="zeroSsl"&&(n.formModel["config-api_uri"]="https://acme.zerossl.com/v2/DV90")});const w=h=>{o.value=h.value,(h.value==="zeroSsl"||h.value==="other")&&(h.value==="zeroSsl"?n.formModel["config-api_uri"]="https://acme.zerossl.com/v2/DV90":n.formModel["config-api_uri"]="https://acme.example.com/",n.formModel["config-tos_accepted"]=!1),h.value==="letsEncrypt"&&(n.formModel["config-api_uri"]="https://acme-v02.api.letsencrypt.org/directory",n.formModel["config-eab_hmac_key"]="",n.formModel["config-eab_kid"]=""),n.onModelUpdated()},V=(h,p)=>{p==="config-storage"&&(r.value=h),n.onModelUpdated()};return(h,p)=>{const M=t.resolveComponent("KSelect"),T=t.resolveComponent("KTabs");return t.openBlock(),t.createElementBlock("div",null,[e.formModel.id&&e.isEditing||!e.isEditing?(t.openBlock(),t.createBlock(z,{key:0,class:"global-fields",model:e.formModel,options:e.formOptions,schema:s.value,onModelUpdated:e.onModelUpdated},null,8,["model","options","schema","onModelUpdated"])):t.createCommentVNode("",!0),t.createVNode(T,{tabs:k},{general:t.withCtx(()=>[t.createElementVNode("div",ac,[p[0]||(p[0]=t.createElementVNode("div",{class:"header-wrapper"},[t.createElementVNode("span",{class:"section-header"},"General Configuration Settings")],-1)),p[1]||(p[1]=t.createElementVNode("div",{class:"description"}," Parameters for enabling the ACME plugin. ",-1)),C.value?(t.openBlock(),t.createBlock(z,{key:0,model:e.formModel,options:e.formOptions,schema:c.value,onModelUpdated:e.onModelUpdated},null,8,["model","options","schema","onModelUpdated"])):t.createCommentVNode("",!0),p[2]||(p[2]=t.createElementVNode("hr",null,null,-1)),t.createVNode(M,{class:"issuer-select",items:B,label:"Issuer",onChange:w}),t.createElementVNode("div",ic,[o.value==="letsEncrypt"?(t.openBlock(),t.createBlock(z,{key:0,model:e.formModel,options:e.formOptions,schema:d.value,onModelUpdated:e.onModelUpdated},null,8,["model","options","schema","onModelUpdated"])):t.createCommentVNode("",!0),o.value==="zeroSsl"||o.value==="other"?(t.openBlock(),t.createBlock(z,{key:1,model:e.formModel,options:e.formOptions,schema:l.value,onModelUpdated:e.onModelUpdated},null,8,["model","options","schema","onModelUpdated"])):t.createCommentVNode("",!0)])])]),storage:t.withCtx(()=>[t.createElementVNode("div",lc,[p[3]||(p[3]=t.createElementVNode("div",{class:"header-wrapper"},[t.createElementVNode("span",{class:"section-header"},"Storage Configuration Settings")],-1)),p[4]||(p[4]=t.createElementVNode("div",{class:"description"}," Parameters for setting up storage. ",-1)),C.value?(t.openBlock(),t.createBlock(z,{key:0,model:e.formModel,options:e.formOptions,schema:m.value,onModelUpdated:V},null,8,["model","options","schema"])):t.createCommentVNode("",!0),t.createElementVNode("div",sc,[r.value==="consul"?(t.openBlock(),t.createBlock(z,{key:0,model:e.formModel,options:e.formOptions,schema:u.value,onModelUpdated:e.onModelUpdated},null,8,["model","options","schema","onModelUpdated"])):t.createCommentVNode("",!0),r.value==="redis"?(t.openBlock(),t.createBlock(z,{key:1,model:e.formModel,options:e.formOptions,schema:g.value,onModelUpdated:e.onModelUpdated},null,8,["model","options","schema","onModelUpdated"])):t.createCommentVNode("",!0),r.value==="shm"?(t.openBlock(),t.createBlock(z,{key:2,model:e.formModel,options:e.formOptions,schema:S.value,onModelUpdated:e.onModelUpdated},null,8,["model","options","schema","onModelUpdated"])):t.createCommentVNode("",!0),r.value==="vault"?(t.openBlock(),t.createBlock(z,{key:3,model:e.formModel,options:e.formOptions,schema:I.value,onModelUpdated:e.onModelUpdated},null,8,["model","options","schema","onModelUpdated"])):t.createCommentVNode("",!0)])])]),advanced:t.withCtx(()=>[t.createElementVNode("div",dc,[p[5]||(p[5]=t.createElementVNode("div",{class:"header-wrapper"},[t.createElementVNode("span",{class:"section-header"},"Advanced Configuration Settings")],-1)),p[6]||(p[6]=t.createElementVNode("div",{class:"description"}," Advanced parameters for manually configuring the ACME plugin. ",-1)),C.value?(t.openBlock(),t.createBlock(z,{key:0,model:e.formModel,options:e.formOptions,schema:f.value,onModelUpdated:e.onModelUpdated},null,8,["model","options","schema","onModelUpdated"])):t.createCommentVNode("",!0)])]),_:1})])}}}),[["__scopeId","data-v-bb5a3a33"]]),mc={class:"rla-form-basic-fields"},uc={class:"rla-form-request-limits-subtitle"},fc={class:"rla-form-request-limits-content"},hc={class:"rla-form-window-type"},pc=["innerHTML"],gc={class:"rla-form-window-type-radios"},yc={class:"rla-form-request-limits-items"},bc={class:"rla-form-request-limits-row"},kc=["id"],wc={class:"rla-form-request-limits-actions"},Cc={key:0,class:"rla-form-request-limits-examples"},_c={class:"rla-form-request-limits-examples-badges"},Ec=["innerHTML"],Mc={id:"rla-form-error-legend",class:"rla-form-error-inputs"},Sc=Object.freeze(Object.defineProperty({__proto__:null,ACMEForm:cc,ExitTransformer:tc,OIDCForm:Qd,PostFunction:ec,RLAForm:j(t.defineComponent({__name:"RLAForm",props:{formSchema:{},formModel:{},formOptions:{},onModelUpdated:{type:Function},isEditing:{type:Boolean}},setup(e){var T;t.provide(G,(T=t.useSlots())==null?void 0:T[pe]);const n={fixed:[{label:"500 requests every hour",description:"A fixed limit of 500 requests per hour resetting sharply on the hour, ensuring no user can exceed this limit.",config:{limit:500,window_size:3600}},{label:"200 requests every 30 minutes",description:"Users are allowed 200 requests per 30 minutes, resetting exactly on the 30 minute mark with no carryover of unused limits.",config:{limit:200,window_size:1800}},{label:"500 requests every day",description:"A strict limit of 5000 requests per day resetting promptly at midnight, preventing any burst traffic or inconsistent user experiences.",config:{limit:500,window_size:86400}}],sliding:[{label:"100 requests every hour",description:"Maximum of 100 requests every rolling hour, continuously adjusting the count over the course of the hour. No hard limit or known reset.",config:{limit:100,window_size:3600}},{label:"300 requests every 30 minutes",description:"Each user can make up to 300 requests in any rolling 30 minute period, with older requests dropping off as new requests are made.",config:{limit:300,window_size:1800}},{label:"500 requests every hour",description:`Each user is allowed 500 requests per hour.
1
+ (function(O,t){typeof exports=="object"&&typeof module<"u"?t(exports,require("vue"),require("@kong/icons"),require("@kong-ui-public/i18n")):typeof define=="function"&&define.amd?define(["exports","vue","@kong/icons","@kong-ui-public/i18n"],t):(O=typeof globalThis<"u"?globalThis:O||self,t(O["kong-ui-public-forms"]={},O.Vue,O.KongIcons,O["kong-ui-public-i18n"]))})(this,function(O,t,oe,Fe){"use strict";function mt(e,n){for(var o=-1,r=e==null?0:e.length;++o<r&&n(e[o],o,e)!==!1;);return e}function Pn(e){return function(n,o,r){for(var i=-1,a=Object(n),d=r(n),l=d.length;l--;){var s=d[++i];if(o(a[s],s,a)===!1)break}return n}}var Kn=Pn();function xn(e,n){for(var o=-1,r=Array(e);++o<e;)r[o]=n(o);return r}var ut=typeof global=="object"&&global&&global.Object===Object&&global,zn=typeof self=="object"&&self&&self.Object===Object&&self,Z=ut||zn||Function("return this")(),re=Z.Symbol,ft=Object.prototype,Yn=ft.hasOwnProperty,Hn=ft.toString,Ve=re?re.toStringTag:void 0;function Gn(e){var n=Yn.call(e,Ve),o=e[Ve];try{e[Ve]=void 0;var r=!0}catch{}var i=Hn.call(e);return r&&(n?e[Ve]=o:delete e[Ve]),i}var Wn=Object.prototype,Zn=Wn.toString;function Jn(e){return Zn.call(e)}var Xn="[object Null]",Qn="[object Undefined]",ht=re?re.toStringTag:void 0;function ae(e){return e==null?e===void 0?Qn:Xn:ht&&ht in Object(e)?Gn(e):Jn(e)}function ie(e){return e!=null&&typeof e=="object"}var eo="[object Arguments]";function pt(e){return ie(e)&&ae(e)==eo}var gt=Object.prototype,to=gt.hasOwnProperty,no=gt.propertyIsEnumerable,oo=pt(function(){return arguments}())?pt:function(e){return ie(e)&&to.call(e,"callee")&&!no.call(e,"callee")},le=Array.isArray;function ro(){return!1}var yt=typeof O=="object"&&O&&!O.nodeType&&O,bt=yt&&typeof module=="object"&&module&&!module.nodeType&&module,ao=bt&&bt.exports===yt,kt=ao?Z.Buffer:void 0,io=kt?kt.isBuffer:void 0,wt=io||ro,lo=9007199254740991,so=/^(?:0|[1-9]\d*)$/;function Ct(e,n){var o=typeof e;return n=n??lo,!!n&&(o=="number"||o!="symbol"&&so.test(e))&&e>-1&&e%1==0&&e<n}var co=9007199254740991;function _t(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=co}var mo="[object Arguments]",uo="[object Array]",fo="[object Boolean]",ho="[object Date]",po="[object Error]",go="[object Function]",yo="[object Map]",bo="[object Number]",ko="[object Object]",wo="[object RegExp]",Co="[object Set]",_o="[object String]",Eo="[object WeakMap]",Mo="[object ArrayBuffer]",So="[object DataView]",Vo="[object Float32Array]",To="[object Float64Array]",No="[object Int8Array]",Bo="[object Int16Array]",Io="[object Int32Array]",Ao="[object Uint8Array]",Oo="[object Uint8ClampedArray]",Fo="[object Uint16Array]",Uo="[object Uint32Array]",$={};$[Vo]=$[To]=$[No]=$[Bo]=$[Io]=$[Ao]=$[Oo]=$[Fo]=$[Uo]=!0,$[mo]=$[uo]=$[Mo]=$[fo]=$[So]=$[ho]=$[po]=$[go]=$[yo]=$[bo]=$[ko]=$[wo]=$[Co]=$[_o]=$[Eo]=!1;function $o(e){return ie(e)&&_t(e.length)&&!!$[ae(e)]}function He(e){return function(n){return e(n)}}var Et=typeof O=="object"&&O&&!O.nodeType&&O,Te=Et&&typeof module=="object"&&module&&!module.nodeType&&module,Lo=Te&&Te.exports===Et,Ge=Lo&&ut.process,Ce=function(){try{var e=Te&&Te.require&&Te.require("util").types;return e||Ge&&Ge.binding&&Ge.binding("util")}catch{}}(),Mt=Ce&&Ce.isTypedArray,jo=Mt?He(Mt):$o,Do=Object.prototype,vo=Do.hasOwnProperty;function St(e,n){var o=le(e),r=!o&&oo(e),i=!o&&!r&&wt(e),a=!o&&!r&&!i&&jo(e),d=o||r||i||a,l=d?xn(e.length,String):[],s=l.length;for(var c in e)(n||vo.call(e,c))&&!(d&&(c=="length"||i&&(c=="offset"||c=="parent")||a&&(c=="buffer"||c=="byteLength"||c=="byteOffset")||Ct(c,s)))&&l.push(c);return l}var qo=Object.prototype;function We(e){var n=e&&e.constructor,o=typeof n=="function"&&n.prototype||qo;return e===o}function Vt(e,n){return function(o){return e(n(o))}}var Ro=Vt(Object.keys,Object),Po=Object.prototype,Ko=Po.hasOwnProperty;function xo(e){if(!We(e))return Ro(e);var n=[];for(var o in Object(e))Ko.call(e,o)&&o!="constructor"&&n.push(o);return n}function H(e){var n=typeof e;return e!=null&&(n=="object"||n=="function")}var zo="[object AsyncFunction]",Yo="[object Function]",Ho="[object GeneratorFunction]",Go="[object Proxy]";function L(e){if(!H(e))return!1;var n=ae(e);return n==Yo||n==Ho||n==zo||n==Go}function Ue(e){return e!=null&&_t(e.length)&&!L(e)}function $e(e){return Ue(e)?St(e):xo(e)}function Wo(e,n){return e&&Kn(e,n,$e)}function Zo(e,n){return function(o,r){if(o==null)return o;if(!Ue(o))return e(o,r);for(var i=o.length,a=-1,d=Object(o);++a<i&&r(d[a],a,d)!==!1;);return o}}var Jo=Zo(Wo);function Ze(e){return e}function Xo(e){return typeof e=="function"?e:Ze}function x(e,n){var o=le(e)?mt:Jo;return o(e,Xo(n))}var Qo="[object Symbol]";function Le(e){return typeof e=="symbol"||ie(e)&&ae(e)==Qo}var er=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,tr=/^\w*$/;function nr(e,n){if(le(e))return!1;var o=typeof e;return o=="number"||o=="symbol"||o=="boolean"||e==null||Le(e)?!0:tr.test(e)||!er.test(e)||n!=null&&e in Object(n)}var Je=Z["__core-js_shared__"],Tt=function(){var e=/[^.]+$/.exec(Je&&Je.keys&&Je.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function or(e){return!!Tt&&Tt in e}var rr=Function.prototype,ar=rr.toString;function ue(e){if(e!=null){try{return ar.call(e)}catch{}try{return e+""}catch{}}return""}var ir=/[\\^$.*+?()[\]{}|]/g,lr=/^\[object .+?Constructor\]$/,sr=Function.prototype,dr=Object.prototype,cr=sr.toString,mr=dr.hasOwnProperty,ur=RegExp("^"+cr.call(mr).replace(ir,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function fr(e){if(!H(e)||or(e))return!1;var n=L(e)?ur:lr;return n.test(ue(e))}function hr(e,n){return e==null?void 0:e[n]}function fe(e,n){var o=hr(e,n);return fr(o)?o:void 0}var Ne=fe(Object,"create");function pr(){this.__data__=Ne?Ne(null):{},this.size=0}function gr(e){var n=this.has(e)&&delete this.__data__[e];return this.size-=n?1:0,n}var yr="__lodash_hash_undefined__",br=Object.prototype,kr=br.hasOwnProperty;function wr(e){var n=this.__data__;if(Ne){var o=n[e];return o===yr?void 0:o}return kr.call(n,e)?n[e]:void 0}var Cr=Object.prototype,_r=Cr.hasOwnProperty;function Er(e){var n=this.__data__;return Ne?n[e]!==void 0:_r.call(n,e)}var Mr="__lodash_hash_undefined__";function Sr(e,n){var o=this.__data__;return this.size+=this.has(e)?0:1,o[e]=Ne&&n===void 0?Mr:n,this}function he(e){var n=-1,o=e==null?0:e.length;for(this.clear();++n<o;){var r=e[n];this.set(r[0],r[1])}}he.prototype.clear=pr,he.prototype.delete=gr,he.prototype.get=wr,he.prototype.has=Er,he.prototype.set=Sr;function Vr(){this.__data__=[],this.size=0}function je(e,n){return e===n||e!==e&&n!==n}function De(e,n){for(var o=e.length;o--;)if(je(e[o][0],n))return o;return-1}var Tr=Array.prototype,Nr=Tr.splice;function Br(e){var n=this.__data__,o=De(n,e);if(o<0)return!1;var r=n.length-1;return o==r?n.pop():Nr.call(n,o,1),--this.size,!0}function Ir(e){var n=this.__data__,o=De(n,e);return o<0?void 0:n[o][1]}function Ar(e){return De(this.__data__,e)>-1}function Or(e,n){var o=this.__data__,r=De(o,e);return r<0?(++this.size,o.push([e,n])):o[r][1]=n,this}function Q(e){var n=-1,o=e==null?0:e.length;for(this.clear();++n<o;){var r=e[n];this.set(r[0],r[1])}}Q.prototype.clear=Vr,Q.prototype.delete=Br,Q.prototype.get=Ir,Q.prototype.has=Ar,Q.prototype.set=Or;var Be=fe(Z,"Map");function Fr(){this.size=0,this.__data__={hash:new he,map:new(Be||Q),string:new he}}function Ur(e){var n=typeof e;return n=="string"||n=="number"||n=="symbol"||n=="boolean"?e!=="__proto__":e===null}function ve(e,n){var o=e.__data__;return Ur(n)?o[typeof n=="string"?"string":"hash"]:o.map}function $r(e){var n=ve(this,e).delete(e);return this.size-=n?1:0,n}function Lr(e){return ve(this,e).get(e)}function jr(e){return ve(this,e).has(e)}function Dr(e,n){var o=ve(this,e),r=o.size;return o.set(e,n),this.size+=o.size==r?0:1,this}function ee(e){var n=-1,o=e==null?0:e.length;for(this.clear();++n<o;){var r=e[n];this.set(r[0],r[1])}}ee.prototype.clear=Fr,ee.prototype.delete=$r,ee.prototype.get=Lr,ee.prototype.has=jr,ee.prototype.set=Dr;var vr="Expected a function";function Xe(e,n){if(typeof e!="function"||n!=null&&typeof n!="function")throw new TypeError(vr);var o=function(){var r=arguments,i=n?n.apply(this,r):r[0],a=o.cache;if(a.has(i))return a.get(i);var d=e.apply(this,r);return o.cache=a.set(i,d)||a,d};return o.cache=new(Xe.Cache||ee),o}Xe.Cache=ee;var qr=500;function Rr(e){var n=Xe(e,function(r){return o.size===qr&&o.clear(),r}),o=n.cache;return n}var Pr=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Kr=/\\(\\)?/g,xr=Rr(function(e){var n=[];return e.charCodeAt(0)===46&&n.push(""),e.replace(Pr,function(o,r,i,a){n.push(i?a.replace(Kr,"$1"):r||o)}),n});function zr(e,n){for(var o=-1,r=e==null?0:e.length,i=Array(r);++o<r;)i[o]=n(e[o],o,e);return i}var Yr=1/0,Nt=re?re.prototype:void 0,Bt=Nt?Nt.toString:void 0;function It(e){if(typeof e=="string")return e;if(le(e))return zr(e,It)+"";if(Le(e))return Bt?Bt.call(e):"";var n=e+"";return n=="0"&&1/e==-Yr?"-0":n}function At(e){return e==null?"":It(e)}function Hr(e,n){return le(e)?e:nr(e,n)?[e]:xr(At(e))}var Gr=1/0;function Wr(e){if(typeof e=="string"||Le(e))return e;var n=e+"";return n=="0"&&1/e==-Gr?"-0":n}function Zr(e,n){n=Hr(n,e);for(var o=0,r=n.length;e!=null&&o<r;)e=e[Wr(n[o++])];return o&&o==r?e:void 0}function F(e,n,o){var r=e==null?void 0:Zr(e,n);return r===void 0?o:r}function q(e){return e==null}const se="kong-ui-forms-api",pe="autofill",G="autofillSlot";function Jr(){this.__data__=new Q,this.size=0}function Xr(e){var n=this.__data__,o=n.delete(e);return this.size=n.size,o}function Qr(e){return this.__data__.get(e)}function ea(e){return this.__data__.has(e)}var ta=200;function na(e,n){var o=this.__data__;if(o instanceof Q){var r=o.__data__;if(!Be||r.length<ta-1)return r.push([e,n]),this.size=++o.size,this;o=this.__data__=new ee(r)}return o.set(e,n),this.size=o.size,this}function _e(e){var n=this.__data__=new Q(e);this.size=n.size}_e.prototype.clear=Jr,_e.prototype.delete=Xr,_e.prototype.get=Qr,_e.prototype.has=ea,_e.prototype.set=na;var qe=function(){try{var e=fe(Object,"defineProperty");return e({},"",{}),e}catch{}}();function Ot(e,n,o){n=="__proto__"&&qe?qe(e,n,{configurable:!0,enumerable:!0,value:o,writable:!0}):e[n]=o}var oa=Object.prototype,ra=oa.hasOwnProperty;function Ft(e,n,o){var r=e[n];(!(ra.call(e,n)&&je(r,o))||o===void 0&&!(n in e))&&Ot(e,n,o)}function Re(e,n,o,r){var i=!o;o||(o={});for(var a=-1,d=n.length;++a<d;){var l=n[a],s=void 0;s===void 0&&(s=e[l]),i?Ot(o,l,s):Ft(o,l,s)}return o}function aa(e,n){return e&&Re(n,$e(n),e)}function ia(e){var n=[];if(e!=null)for(var o in Object(e))n.push(o);return n}var la=Object.prototype,sa=la.hasOwnProperty;function da(e){if(!H(e))return ia(e);var n=We(e),o=[];for(var r in e)r=="constructor"&&(n||!sa.call(e,r))||o.push(r);return o}function Pe(e){return Ue(e)?St(e,!0):da(e)}function ca(e,n){return e&&Re(n,Pe(n),e)}var Ut=typeof O=="object"&&O&&!O.nodeType&&O,$t=Ut&&typeof module=="object"&&module&&!module.nodeType&&module,ma=$t&&$t.exports===Ut,Lt=ma?Z.Buffer:void 0,jt=Lt?Lt.allocUnsafe:void 0;function ua(e,n){if(n)return e.slice();var o=e.length,r=jt?jt(o):new e.constructor(o);return e.copy(r),r}function fa(e,n){var o=-1,r=e.length;for(n||(n=Array(r));++o<r;)n[o]=e[o];return n}function ha(e,n){for(var o=-1,r=e==null?0:e.length,i=0,a=[];++o<r;){var d=e[o];n(d,o,e)&&(a[i++]=d)}return a}function Dt(){return[]}var pa=Object.prototype,ga=pa.propertyIsEnumerable,vt=Object.getOwnPropertySymbols,Qe=vt?function(e){return e==null?[]:(e=Object(e),ha(vt(e),function(n){return ga.call(e,n)}))}:Dt;function ya(e,n){return Re(e,Qe(e),n)}function qt(e,n){for(var o=-1,r=n.length,i=e.length;++o<r;)e[i+o]=n[o];return e}var Rt=Vt(Object.getPrototypeOf,Object),ba=Object.getOwnPropertySymbols,Pt=ba?function(e){for(var n=[];e;)qt(n,Qe(e)),e=Rt(e);return n}:Dt;function ka(e,n){return Re(e,Pt(e),n)}function Kt(e,n,o){var r=n(e);return le(e)?r:qt(r,o(e))}function wa(e){return Kt(e,$e,Qe)}function Ca(e){return Kt(e,Pe,Pt)}var et=fe(Z,"DataView"),tt=fe(Z,"Promise"),Ee=fe(Z,"Set"),nt=fe(Z,"WeakMap"),xt="[object Map]",_a="[object Object]",zt="[object Promise]",Yt="[object Set]",Ht="[object WeakMap]",Gt="[object DataView]",Ea=ue(et),Ma=ue(Be),Sa=ue(tt),Va=ue(Ee),Ta=ue(nt),te=ae;(et&&te(new et(new ArrayBuffer(1)))!=Gt||Be&&te(new Be)!=xt||tt&&te(tt.resolve())!=zt||Ee&&te(new Ee)!=Yt||nt&&te(new nt)!=Ht)&&(te=function(e){var n=ae(e),o=n==_a?e.constructor:void 0,r=o?ue(o):"";if(r)switch(r){case Ea:return Gt;case Ma:return xt;case Sa:return zt;case Va:return Yt;case Ta:return Ht}return n});var Na=Object.prototype,Ba=Na.hasOwnProperty;function Ia(e){var n=e.length,o=new e.constructor(n);return n&&typeof e[0]=="string"&&Ba.call(e,"index")&&(o.index=e.index,o.input=e.input),o}var Wt=Z.Uint8Array;function ot(e){var n=new e.constructor(e.byteLength);return new Wt(n).set(new Wt(e)),n}function Aa(e,n){var o=n?ot(e.buffer):e.buffer;return new e.constructor(o,e.byteOffset,e.byteLength)}var Oa=/\w*$/;function Fa(e){var n=new e.constructor(e.source,Oa.exec(e));return n.lastIndex=e.lastIndex,n}var Zt=re?re.prototype:void 0,Jt=Zt?Zt.valueOf:void 0;function Ua(e){return Jt?Object(Jt.call(e)):{}}function $a(e,n){var o=n?ot(e.buffer):e.buffer;return new e.constructor(o,e.byteOffset,e.length)}var La="[object Boolean]",ja="[object Date]",Da="[object Map]",va="[object Number]",qa="[object RegExp]",Ra="[object Set]",Pa="[object String]",Ka="[object Symbol]",xa="[object ArrayBuffer]",za="[object DataView]",Ya="[object Float32Array]",Ha="[object Float64Array]",Ga="[object Int8Array]",Wa="[object Int16Array]",Za="[object Int32Array]",Ja="[object Uint8Array]",Xa="[object Uint8ClampedArray]",Qa="[object Uint16Array]",ei="[object Uint32Array]";function ti(e,n,o){var r=e.constructor;switch(n){case xa:return ot(e);case La:case ja:return new r(+e);case za:return Aa(e,o);case Ya:case Ha:case Ga:case Wa:case Za:case Ja:case Xa:case Qa:case ei:return $a(e,o);case Da:return new r;case va:case Pa:return new r(e);case qa:return Fa(e);case Ra:return new r;case Ka:return Ua(e)}}var Xt=Object.create,ni=function(){function e(){}return function(n){if(!H(n))return{};if(Xt)return Xt(n);e.prototype=n;var o=new e;return e.prototype=void 0,o}}();function oi(e){return typeof e.constructor=="function"&&!We(e)?ni(Rt(e)):{}}var ri="[object Map]";function ai(e){return ie(e)&&te(e)==ri}var Qt=Ce&&Ce.isMap,ii=Qt?He(Qt):ai,li="[object Set]";function si(e){return ie(e)&&te(e)==li}var en=Ce&&Ce.isSet,di=en?He(en):si,ci=1,mi=2,ui=4,tn="[object Arguments]",fi="[object Array]",hi="[object Boolean]",pi="[object Date]",gi="[object Error]",nn="[object Function]",yi="[object GeneratorFunction]",bi="[object Map]",ki="[object Number]",on="[object Object]",wi="[object RegExp]",Ci="[object Set]",_i="[object String]",Ei="[object Symbol]",Mi="[object WeakMap]",Si="[object ArrayBuffer]",Vi="[object DataView]",Ti="[object Float32Array]",Ni="[object Float64Array]",Bi="[object Int8Array]",Ii="[object Int16Array]",Ai="[object Int32Array]",Oi="[object Uint8Array]",Fi="[object Uint8ClampedArray]",Ui="[object Uint16Array]",$i="[object Uint32Array]",U={};U[tn]=U[fi]=U[Si]=U[Vi]=U[hi]=U[pi]=U[Ti]=U[Ni]=U[Bi]=U[Ii]=U[Ai]=U[bi]=U[ki]=U[on]=U[wi]=U[Ci]=U[_i]=U[Ei]=U[Oi]=U[Fi]=U[Ui]=U[$i]=!0,U[gi]=U[nn]=U[Mi]=!1;function Ie(e,n,o,r,i,a){var d,l=n&ci,s=n&mi,c=n&ui;if(d!==void 0)return d;if(!H(e))return e;var m=le(e);if(m){if(d=Ia(e),!l)return fa(e,d)}else{var u=te(e),g=u==nn||u==yi;if(wt(e))return ua(e,l);if(u==on||u==tn||g&&!i){if(d=s||g?{}:oi(e),!l)return s?ka(e,ca(d,e)):ya(e,aa(d,e))}else{if(!U[u])return i?e:{};d=ti(e,u,l)}}a||(a=new _e);var S=a.get(e);if(S)return S;a.set(e,d),di(e)?e.forEach(function(C){d.add(Ie(C,n,o,C,e,a))}):ii(e)&&e.forEach(function(C,k){d.set(k,Ie(C,n,o,k,e,a))});var I=c?s?Ca:wa:s?Pe:$e,f=m?void 0:I(e);return mt(f||e,function(C,k){f&&(k=C,C=e[k]),Ft(d,k,Ie(C,n,o,k,e,a))}),d}var Li=1,ji=4;function ne(e){return Ie(e,Li|ji)}const rt=(e,n="")=>typeof e.id<"u"?n+e.id:n+(e.inputName||e.label||e.model||"").toString().trim().toLowerCase().replace(/ |_/g,"-").replace(/-{2,}/g,"-").replace(/^-+|-+$/g,"").replace(/([^a-zA-Z0-9-]+)/g,""),rn=(e="")=>e.toString().trim().replace(/ /g,"-").replace(/-{2,}/g,"-").replace(/^-+|-+$/g,"").replace(/([^a-zA-Z0-9-_/./:]+)/g,"");var Di="[object String]";function ge(e){return typeof e=="string"||!le(e)&&ie(e)&&ae(e)==Di}const an={methods:{getFieldRowClasses(e){const n=this.fieldErrors(e).length>0,o={[F(this.options,"validationErrorClass","error")]:n,[F(this.options,"validationSuccessClass","valid")]:!n,disabled:this.fieldDisabled(e),readonly:this.fieldReadonly(e),featured:this.fieldFeatured(e),required:this.fieldRequired(e)};return Array.isArray(e.styleClasses)?x(e.styleClasses,r=>o[r]=!0):ge(e.styleClasses)&&(o[e.styleClasses]=!0),q(e.type)||(o["field-"+e.type]=!0),o},fieldErrors(e){return this.errors.filter(o=>o.field.fieldName===e.fieldName).map(o=>o.error)},fieldDisabled(e){return L(e.disabled)?e.disabled.call(this,this.model,e,this):q(e.disabled)?!1:e.disabled},fieldReadonly(e){return L(e.readonly)?e.readonly.call(this,this.model,e,this):q(e.readonly)?!1:e.readonly},fieldFeatured(e){return L(e.featured)?e.featured.call(this,this.model,e,this):q(e.featured)?!1:e.featured},fieldRequired(e){return L(e.required)?e.required.call(this,this.model,e,this):q(e.required)?!1:e.required}}};var at=function(){return Z.Date.now()},vi=/\s/;function qi(e){for(var n=e.length;n--&&vi.test(e.charAt(n)););return n}var Ri=/^\s+/;function Pi(e){return e&&e.slice(0,qi(e)+1).replace(Ri,"")}var ln=NaN,Ki=/^[-+]0x[0-9a-f]+$/i,xi=/^0b[01]+$/i,zi=/^0o[0-7]+$/i,Yi=parseInt;function it(e){if(typeof e=="number")return e;if(Le(e))return ln;if(H(e)){var n=typeof e.valueOf=="function"?e.valueOf():e;e=H(n)?n+"":n}if(typeof e!="string")return e===0?e:+e;e=Pi(e);var o=xi.test(e);return o||zi.test(e)?Yi(e.slice(2),o?2:8):Ki.test(e)?ln:+e}var Hi="Expected a function",Gi=Math.max,Wi=Math.min;function Ae(e,n,o){var r,i,a,d,l,s,c=0,m=!1,u=!1,g=!0;if(typeof e!="function")throw new TypeError(Hi);n=it(n)||0,H(o)&&(m=!!o.leading,u="maxWait"in o,a=u?Gi(it(o.maxWait)||0,n):a,g="trailing"in o?!!o.trailing:g);function S(h){var p=r,M=i;return r=i=void 0,c=h,d=e.apply(M,p),d}function I(h){return c=h,l=setTimeout(k,n),m?S(h):d}function f(h){var p=h-s,M=h-c,T=n-p;return u?Wi(T,a-M):T}function C(h){var p=h-s,M=h-c;return s===void 0||p>=n||p<0||u&&M>=a}function k(){var h=at();if(C(h))return B(h);l=setTimeout(k,f(h))}function B(h){return l=void 0,g&&r?S(h):(r=i=void 0,d)}function w(){l!==void 0&&clearTimeout(l),c=0,r=s=i=l=void 0}function V(){return l===void 0?d:B(at())}function A(){var h=at(),p=C(h);if(r=arguments,i=this,s=h,p){if(l===void 0)return I(s);if(u)return clearTimeout(l),l=setTimeout(k,n),S(s)}return l===void 0&&(l=setTimeout(k,n)),d}return A.cancel=w,A.flush=V,A}var Zi="__lodash_hash_undefined__";function Ji(e){return this.__data__.set(e,Zi),this}function Xi(e){return this.__data__.has(e)}function Ke(e){var n=-1,o=e==null?0:e.length;for(this.__data__=new ee;++n<o;)this.add(e[n])}Ke.prototype.add=Ke.prototype.push=Ji,Ke.prototype.has=Xi;function Qi(e,n,o,r){for(var i=e.length,a=o+-1;++a<i;)if(n(e[a],a,e))return a;return-1}function el(e){return e!==e}function tl(e,n,o){for(var r=o-1,i=e.length;++r<i;)if(e[r]===n)return r;return-1}function nl(e,n,o){return n===n?tl(e,n,o):Qi(e,el,o)}function ol(e,n){var o=e==null?0:e.length;return!!o&&nl(e,n,0)>-1}function rl(e,n){return e.has(n)}function al(){}function sn(e){var n=-1,o=Array(e.size);return e.forEach(function(r){o[++n]=r}),o}var il=1/0,ll=Ee&&1/sn(new Ee([,-0]))[1]==il?function(e){return new Ee(e)}:al,sl=200;function dl(e,n,o){var r=-1,i=ol,a=e.length,d=!0,l=[],s=l;if(a>=sl){var c=ll(e);if(c)return sn(c);d=!1,i=rl,s=new Ke}else s=l;e:for(;++r<a;){var m=e[r],u=m;if(m=m!==0?m:0,d&&u===u){for(var g=s.length;g--;)if(s[g]===u)continue e;l.push(m)}else i(s,u,o)||(s!==l&&s.push(u),l.push(m))}return l}function dn(e){return e&&e.length?dl(e):[]}var cl=0;function cn(e){var n=++cl;return At(e)+n}function ml(e,n,o){switch(o.length){case 0:return e.call(n);case 1:return e.call(n,o[0]);case 2:return e.call(n,o[0],o[1]);case 3:return e.call(n,o[0],o[1],o[2])}return e.apply(n,o)}var mn=Math.max;function ul(e,n,o){return n=mn(n===void 0?e.length-1:n,0),function(){for(var r=arguments,i=-1,a=mn(r.length-n,0),d=Array(a);++i<a;)d[i]=r[n+i];i=-1;for(var l=Array(n+1);++i<n;)l[i]=r[i];return l[n]=o(d),ml(e,this,l)}}function fl(e){return function(){return e}}var hl=qe?function(e,n){return qe(e,"toString",{configurable:!0,enumerable:!1,value:fl(n),writable:!0})}:Ze,pl=800,gl=16,yl=Date.now;function bl(e){var n=0,o=0;return function(){var r=yl(),i=gl-(r-o);if(o=r,i>0){if(++n>=pl)return arguments[0]}else n=0;return e.apply(void 0,arguments)}}var kl=bl(hl);function wl(e,n){return kl(ul(e,n,Ze),e+"")}function Cl(e,n,o){if(!H(o))return!1;var r=typeof n;return(r=="number"?Ue(o)&&Ct(n,o.length):r=="string"&&n in o)?je(o[n],e):!1}var un=Object.prototype,_l=un.hasOwnProperty,El=wl(function(e,n){e=Object(e);var o=-1,r=n.length,i=r>2?n[2]:void 0;for(i&&Cl(n[0],n[1],i)&&(r=1);++o<r;)for(var a=n[o],d=Pe(a),l=-1,s=d.length;++l<s;){var c=d[l],m=e[c];(m===void 0||je(m,un[c])&&!_l.call(e,c))&&(e[c]=a[c])}return e}),Ml=Z.isFinite;function Sl(e){return typeof e=="number"&&Ml(e)}var fn=1/0,Vl=17976931348623157e292;function Tl(e){if(!e)return e===0?e:0;if(e=it(e),e===fn||e===-fn){var n=e<0?-1:1;return n*Vl}return e===e?e:0}function Nl(e){var n=Tl(e),o=n%1;return n===n?o?n-o:n:0}function Bl(e){return typeof e=="number"&&e==Nl(e)}var Il="[object Number]";function lt(e){return typeof e=="number"||ie(e)&&ae(e)==Il}var hn=/d{1,4}|M{1,4}|YY(?:YY)?|S{1,3}|Do|ZZ|Z|([HhMsDm])\1?|[aA]|"[^"]*"|'[^']*'/g,de="\\d\\d?",ce="\\d\\d",Al="\\d{3}",Ol="\\d{4}",Oe="[^\\s]+",pn=/\[([^]*?)\]/gm;function gn(e,n){for(var o=[],r=0,i=e.length;r<i;r++)o.push(e[r].substr(0,n));return o}var yn=function(e){return function(n,o){var r=o[e].map(function(a){return a.toLowerCase()}),i=r.indexOf(n.toLowerCase());return i>-1?i:null}};function ye(e){for(var n=[],o=1;o<arguments.length;o++)n[o-1]=arguments[o];for(var r=0,i=n;r<i.length;r++){var a=i[r];for(var d in a)e[d]=a[d]}return e}var bn=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],kn=["January","February","March","April","May","June","July","August","September","October","November","December"],Fl=gn(kn,3),Ul=gn(bn,3),wn={dayNamesShort:Ul,dayNames:bn,monthNamesShort:Fl,monthNames:kn,amPm:["am","pm"],DoFn:function(e){return e+["th","st","nd","rd"][e%10>3?0:(e-e%10!==10?1:0)*e%10]}},xe=ye({},wn),$l=function(e){return xe=ye(xe,e)},Cn=function(e){return e.replace(/[|\\{()[^$+*?.-]/g,"\\$&")},Y=function(e,n){for(n===void 0&&(n=2),e=String(e);e.length<n;)e="0"+e;return e},Ll={D:function(e){return String(e.getDate())},DD:function(e){return Y(e.getDate())},Do:function(e,n){return n.DoFn(e.getDate())},d:function(e){return String(e.getDay())},dd:function(e){return Y(e.getDay())},ddd:function(e,n){return n.dayNamesShort[e.getDay()]},dddd:function(e,n){return n.dayNames[e.getDay()]},M:function(e){return String(e.getMonth()+1)},MM:function(e){return Y(e.getMonth()+1)},MMM:function(e,n){return n.monthNamesShort[e.getMonth()]},MMMM:function(e,n){return n.monthNames[e.getMonth()]},YY:function(e){return Y(String(e.getFullYear()),4).substr(2)},YYYY:function(e){return Y(e.getFullYear(),4)},h:function(e){return String(e.getHours()%12||12)},hh:function(e){return Y(e.getHours()%12||12)},H:function(e){return String(e.getHours())},HH:function(e){return Y(e.getHours())},m:function(e){return String(e.getMinutes())},mm:function(e){return Y(e.getMinutes())},s:function(e){return String(e.getSeconds())},ss:function(e){return Y(e.getSeconds())},S:function(e){return String(Math.round(e.getMilliseconds()/100))},SS:function(e){return Y(Math.round(e.getMilliseconds()/10),2)},SSS:function(e){return Y(e.getMilliseconds(),3)},a:function(e,n){return e.getHours()<12?n.amPm[0]:n.amPm[1]},A:function(e,n){return e.getHours()<12?n.amPm[0].toUpperCase():n.amPm[1].toUpperCase()},ZZ:function(e){var n=e.getTimezoneOffset();return(n>0?"-":"+")+Y(Math.floor(Math.abs(n)/60)*100+Math.abs(n)%60,4)},Z:function(e){var n=e.getTimezoneOffset();return(n>0?"-":"+")+Y(Math.floor(Math.abs(n)/60),2)+":"+Y(Math.abs(n)%60,2)}},_n=function(e){return+e-1},En=[null,de],Mn=[null,Oe],Sn=["isPm",Oe,function(e,n){var o=e.toLowerCase();return o===n.amPm[0]?0:o===n.amPm[1]?1:null}],Vn=["timezoneOffset","[^\\s]*?[\\+\\-]\\d\\d:?\\d\\d|[^\\s]*?Z?",function(e){var n=(e+"").match(/([+-]|\d\d)/gi);if(n){var o=+n[1]*60+parseInt(n[2],10);return n[0]==="+"?o:-o}return 0}],jl={D:["day",de],DD:["day",ce],Do:["day",de+Oe,function(e){return parseInt(e,10)}],M:["month",de,_n],MM:["month",ce,_n],YY:["year",ce,function(e){var n=new Date,o=+(""+n.getFullYear()).substr(0,2);return+(""+(+e>68?o-1:o)+e)}],h:["hour",de,void 0,"isPm"],hh:["hour",ce,void 0,"isPm"],H:["hour",de],HH:["hour",ce],m:["minute",de],mm:["minute",ce],s:["second",de],ss:["second",ce],YYYY:["year",Ol],S:["millisecond","\\d",function(e){return+e*100}],SS:["millisecond",ce,function(e){return+e*10}],SSS:["millisecond",Al],d:En,dd:En,ddd:Mn,dddd:Mn,MMM:["month",Oe,yn("monthNamesShort")],MMMM:["month",Oe,yn("monthNames")],a:Sn,A:Sn,ZZ:Vn,Z:Vn},ze={default:"ddd MMM DD YYYY HH:mm:ss",shortDate:"M/D/YY",mediumDate:"MMM D, YYYY",longDate:"MMMM D, YYYY",fullDate:"dddd, MMMM D, YYYY",isoDate:"YYYY-MM-DD",isoDateTime:"YYYY-MM-DDTHH:mm:ssZ",shortTime:"HH:mm",mediumTime:"HH:mm:ss",longTime:"HH:mm:ss.SSS"},Dl=function(e){return ye(ze,e)},vl=function(e,n,o){if(n===void 0&&(n=ze.default),o===void 0&&(o={}),typeof e=="number"&&(e=new Date(e)),Object.prototype.toString.call(e)!=="[object Date]"||isNaN(e.getTime()))throw new Error("Invalid Date pass to format");n=ze[n]||n;var r=[];n=n.replace(pn,function(a,d){return r.push(d),"@@@"});var i=ye(ye({},xe),o);return n=n.replace(hn,function(a){return Ll[a](e,i)}),n.replace(/@@@/g,function(){return r.shift()})};function ql(e,n,o){if(o===void 0&&(o={}),typeof n!="string")throw new Error("Invalid format in fecha parse");if(n=ze[n]||n,e.length>1e3)return null;var r=new Date,i={year:r.getFullYear(),month:0,day:1,hour:0,minute:0,second:0,millisecond:0,isPm:null,timezoneOffset:null},a=[],d=[],l=n.replace(pn,function(V,A){return d.push(Cn(A)),"@@@"}),s={},c={};l=Cn(l).replace(hn,function(V){var A=jl[V],h=A[0],p=A[1],M=A[3];if(s[h])throw new Error("Invalid format. "+h+" specified twice in format");return s[h]=!0,M&&(c[M]=!0),a.push(A),"("+p+")"}),Object.keys(c).forEach(function(V){if(!s[V])throw new Error("Invalid format. "+V+" is required in specified format")}),l=l.replace(/@@@/g,function(){return d.shift()});var m=e.match(new RegExp(l,"i"));if(!m)return null;for(var u=ye(ye({},xe),o),g=1;g<m.length;g++){var S=a[g-1],I=S[0],f=S[2],C=f?f(m[g],u):+m[g];if(C==null)return null;i[I]=C}i.isPm===1&&i.hour!=null&&+i.hour!=12?i.hour=+i.hour+12:i.isPm===0&&+i.hour==12&&(i.hour=0);var k;if(i.timezoneOffset==null){k=new Date(i.year,i.month,i.day,i.hour,i.minute,i.second,i.millisecond);for(var B=[["month","getMonth"],["day","getDate"],["hour","getHours"],["minute","getMinutes"],["second","getSeconds"]],g=0,w=B.length;g<w;g++)if(s[B[g][0]]&&i[B[g][0]]!==k[B[g][1]]())return null}else if(k=new Date(Date.UTC(i.year,i.month,i.day,i.hour,i.minute-i.timezoneOffset,i.second,i.millisecond)),i.month>11||i.month<0||i.day>31||i.day<1||i.hour>23||i.hour<0||i.minute>59||i.minute<0||i.second>59||i.second<0)return null;return k}var Me={format:vl,parse:ql,defaultI18n:wn,setGlobalDateI18n:$l,setGlobalDateMasks:Dl};const K={fieldIsRequired:"This field is required!",invalidFormat:"Invalid format!",numberTooSmall:"The number is too small! Minimum: {0}",numberTooBig:"The number is too big! Maximum: {0}",invalidNumber:"Invalid number",invalidInteger:"The value is not an integer",textTooSmall:"The length of text is too small! Current: {0}, Minimum: {1}",textTooBig:"The length of text is too big! Current: {0}, Maximum: {1}",thisNotText:"This is not a text!",thisNotArray:"This is not an array!",selectMinItems:"Select minimum {0} items!",selectMaxItems:"Select maximum {0} items!",invalidDate:"Invalid date!",dateIsEarly:"The date is too early! Current: {0}, Minimum: {1}",dateIsLate:"The date is too late! Current: {0}, Maximum: {1}",invalidEmail:"Invalid e-mail address!",invalidURL:"Invalid URL!",invalidCard:"Invalid card format!",invalidCardNumber:"Invalid card number!",invalidTextContainNumber:"Invalid text! Cannot contains numbers or special characters",invalidTextContainSpec:"Invalid text! Cannot contains special characters"};function J(e,n,o=K){return q(e)||e===""?n?[v(o.fieldIsRequired)]:[]:null}function v(e,...n){if(e!=null&&n.length>0)for(let o=0;o<n.length;o++)e=e.replace("{"+(o-1)+"}",n[o]);return e}const be={resources:K,required(e,n,o,r=K){return J(e,n.required,r)},number(e,n,o,r=K){const i=J(e,n.required,r);if(i!=null)return i;const a=[];return Sl(e)?(!q(n.min)&&e<n.min&&a.push(v(r.numberTooSmall,n.min)),!q(n.max)&&e>n.max&&a.push(v(r.numberTooBig,n.max))):a.push(v(r.invalidNumber)),a},integer(e,n,o,r=K){const i=J(e,n.required,r);if(i!=null)return i;const a=be.number(e,n,o,r);return Bl(e)||a.push(v(r.invalidInteger)),a},double(e,n,o,r=K){const i=J(e,n.required,r);if(i!=null)return i;if(!lt(e)||isNaN(e))return[v(r.invalidNumber)]},string(e,n,o,r=K){const i=J(e,n.required,r);if(i!=null)return i;const a=[];return ge(e)?(!q(n.min)&&e.length<n.min&&a.push(v(r.textTooSmall,e.length,n.min)),!q(n.max)&&e.length>n.max&&a.push(v(r.textTooBig,e.length,n.max))):a.push(v(r.thisNotText)),a},array(e,n,o,r=K){if(n.required){if(!Array.isArray(e))return[v(r.thisNotArray)];if(e.length===0)return[v(r.fieldIsRequired)]}if(!q(e)){if(!q(n.min)&&e.length<n.min)return[v(r.selectMinItems,n.min)];if(!q(n.max)&&e.length>n.max)return[v(r.selectMaxItems,n.max)]}},date(e,n,o,r=K){const i=J(e,n.required,r);if(i!=null)return i;const a=new Date(e);if(isNaN(a.getDate()))return[v(r.invalidDate)];const d=[];if(!q(n.min)){const l=new Date(n.min);a.valueOf()<l.valueOf()&&d.push(v(r.dateIsEarly,Me.format(a),Me.format(l)))}if(!q(n.max)){const l=new Date(n.max);a.valueOf()>l.valueOf()&&d.push(v(r.dateIsLate,Me.format(a),Me.format(l)))}return d},regexp(e,n,o,r=K){const i=J(e,n.required,r);if(i!=null)return i;if(!q(n.pattern)&&!new RegExp(n.pattern).test(e))return[v(r.invalidFormat)]},email(e,n,o,r=K){const i=J(e,n.required,r);if(i!=null)return i;if(!/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(e))return[v(r.invalidEmail)]},url(e,n,o,r=K){const i=J(e,n.required,r);if(i!=null)return i;if(!/https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,4}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)/g.test(e))return[v(r.invalidURL)]},creditCard(e,n,o,r=K){const i=J(e,n.required,r);if(i!=null)return i;const a=/^(?:4[0-9]{12}(?:[0-9]{3})?|5[1-5][0-9]{14}|6(?:011|5[0-9][0-9])[0-9]{12}|3[47][0-9]{13}|3(?:0[0-5]|[68][0-9])[0-9]{11}|(?:2131|1800|35\d{3})\d{11})$/,d=e.replace(/[^0-9]+/g,"");if(!a.test(d))return[v(r.invalidCard)];let l=0,s,c,m;for(let u=d.length-1;u>=0;u--)s=d.substring(u,u+1),c=parseInt(s,10),m?(c*=2,c>=10?l+=c%10+1:l+=c):l+=c,m=!m;if(!(l%10===0&&d))return[v(r.invalidCardNumber)]},alpha(e,n,o,r=K){const i=J(e,n.required,r);if(i!=null)return i;if(!/^[a-zA-Z]*$/.test(e))return[v(r.invalidTextContainNumber)]},alphaNumeric(e,n,o,r=K){const i=J(e,n.required,r);if(i!=null)return i;if(!/^[a-zA-Z0-9]*$/.test(e))return[v(r.invalidTextContainSpec)]}};Object.keys(be).forEach(e=>{const n=be[e];L(n)&&(n.locale=o=>(r,i,a)=>n(r,i,a,El(o,K)))});function Tn(e){return ge(e)?be[e]!=null?be[e]:(console.warn(`'${e}' is not a validator function!`),null):e}function st(e,n,o){let r=F(o.context,"schema.attributes",{});const i=n.value||"input";ge(i)&&(r=F(r,i)||r),x(r,(a,d)=>{e.setAttribute(d,a)})}const X={name:"abstractField",props:["vfg","model","schema","formOptions","disabled"],emits:["validated","modelUpdated"],data(){return{errors:[],debouncedValidateFunc:null,debouncedFormatFunc:null}},directives:{attributes:{beforeMount:st,updated:st,componentUpdated:st}},computed:{value:{cache:!1,get(){let e;return L(F(this.schema,"get"))?e=this.schema.get(this.model):e=F(this.model,this.schema.model),this.formatValueToField(e)},set(e){const n=this.value;e=this.formatValueToModel(e),L(e)?e(e,n):this.updateModelValue(e,n)}}},methods:{validate(e){this.clearValidationErrors();const n=F(this.formOptions,"validateAsync",!1);let o=[];if(this.schema.validator&&this.schema.readonly!==!0&&this.disabled!==!0){const i=[];Array.isArray(this.schema.validator)?x(this.schema.validator,a=>{i.push(Tn(a).bind(this))}):i.push(Tn(this.schema.validator).bind(this)),x(i,a=>{if(n)o.push(a(this.value,this.schema,this.model));else{const d=a(this.value,this.schema,this.model);d&&L(d.then)?d.then(l=>{l&&(this.errors=this.errors.concat(l));const s=this.errors.length===0;this.$emit("validated",s,this.errors,this)}):d&&(o=o.concat(d))}})}const r=i=>{let a=[];x(dn(i),l=>{Array.isArray(l)&&l.length>0?a=a.concat(l):ge(l)&&a.push(l)}),L(this.schema.onValidated)&&this.schema.onValidated.call(this,this.model,a,this.schema);const d=a.length===0;return e||this.$emit("validated",d,a,this),this.errors=a,a};return n?Promise.all(o).then(r):r(o)},debouncedValidate(){L(this.debouncedValidateFunc)||(this.debouncedValidateFunc=Ae(this.validate.bind(this),F(this.schema,"validateDebounceTime",F(this.formOptions,"validateDebounceTime",500)))),this.debouncedValidateFunc()},updateModelValue(e,n){let o=!1;L(this.schema.set)?(this.schema.set(this.model,e),o=!0):this.schema.model&&(this.setModelValueByPath(this.schema.model,e),o=!0),o&&(this.$emit("modelUpdated",e,this.schema.model),L(this.schema.onChanged)&&this.schema.onChanged.call(this,this.model,e,n,this.schema),F(this.formOptions,"validateAfterChanged",!1)===!0&&(F(this.schema,"validateDebounceTime",F(this.formOptions,"validateDebounceTime",0))>0?this.debouncedValidate():this.validate()))},clearValidationErrors(){this.errors.splice(0)},setModelValueByPath(e,n){let o=e.replace(/\[(\w+)\]/g,".$1");o=o.replace(/^\./,"");let r=this.model;const i=o.split(".");let a=0;const d=i.length;for(;a<d;){const l=i[a];if(a<d-1)r[l]!==void 0||(r[l]={}),r=r[l];else{r[l]=n;return}++a}},getFieldID(e,n=!1){const o=F(this.formOptions,"fieldIdPrefix","");return rt(e,o)+(n?"-"+cn():"")},getLabelId(e){return`${this.getFieldID(e)}-label`},getFieldClasses(){return F(this.schema,"fieldClasses",[])},formatValueToField(e){return e},formatValueToModel(e){return e}}},Rl=Object.freeze(Object.defineProperty({__proto__:null,default:X},Symbol.toStringTag,{value:"Module"})),j=(e,n)=>{const o=e.__vccOpts||e;for(const[r,i]of n)o[r]=i;return o},Pl={mixins:[X],emits:["model-updated"],data(){return{isOpen:!1}},computed:{openClass(){return this.isOpen?"open":"closed"},fieldCount(){return this.schema.fields.length},titleText(){return`${this.isOpen?"Hide":"View"} ${this.fieldCount} Advanced Fields`}},methods:{handleOpen(){this.isOpen=!this.isOpen},updateModel(e,n){this.$emit("model-updated",e,n)}}},Kl={class:"advanced-field-dropdown-wrapper","data-testid":"advanced-field-dropdown-wrapper"},xl={class:"material-icons"};function zl(e,n,o,r,i,a){const d=t.resolveComponent("vue-form-generator");return t.openBlock(),t.createElementBlock("div",Kl,[t.createElementVNode("button",{class:"advanced-field-title",type:"button",onClick:n[0]||(n[0]=(...l)=>a.handleOpen&&a.handleOpen(...l))},[t.createElementVNode("i",xl,t.toDisplayString(i.isOpen?"keyboard_arrow_up":"keyboard_arrow_right"),1),t.createElementVNode("span",null,t.toDisplayString(a.titleText),1)]),t.createElementVNode("div",{class:t.normalizeClass(["advanced-field-dropdown",a.openClass])},[t.createVNode(d,{model:e.model,options:{helpAsHtml:!0},schema:e.schema,onModelUpdated:a.updateModel},null,8,["model","schema","onModelUpdated"])],2)])}const Yl=j(Pl,[["render",zl],["__scopeId","data-v-6f4089bd"]]),Hl={class:"array-card-container"},Nn=j(t.defineComponent({__name:"FieldArrayCardContainer",props:{model:{type:Object,default:()=>null},schema:{type:Object,default:()=>null},index:{type:Number,default:void 0}},emits:["remove-item"],setup(e){const n=e;return t.provide("vfg-array-item-index",n.index),(o,r)=>{const i=t.resolveComponent("KCard"),a=t.resolveComponent("KButton");return t.openBlock(),t.createElementBlock("div",Hl,[t.createVNode(i,{class:"card"},{default:t.withCtx(()=>[t.renderSlot(o.$slots,"default",{},void 0,!0)]),_:3}),t.createVNode(a,{appearance:"tertiary",class:"array-card-remove-button",onClick:r[0]||(r[0]=d=>o.$emit("remove-item"))},{default:t.withCtx(()=>[t.createVNode(t.unref(oe.TrashIcon))]),_:1})])}}}),[["__scopeId","data-v-96055692"]]),Gl={class:"array-item-wrapper"},Wl={class:"array-item"},Zl={class:"array-item-after"},Bn=j(t.defineComponent({__name:"FieldArrayItem",props:{model:{type:String,default:""}},emits:["remove-item"],setup(e){return(n,o)=>{const r=t.resolveComponent("KButton");return t.openBlock(),t.createElementBlock("div",Gl,[t.createElementVNode("div",Wl,[t.renderSlot(n.$slots,"default",{},void 0,!0),t.createVNode(r,{appearance:"tertiary",class:"delete",onClick:o[0]||(o[0]=i=>n.$emit("remove-item"))},{default:t.withCtx(()=>[t.createVNode(t.unref(oe.TrashIcon))]),_:1})]),t.createElementVNode("div",Zl,[t.renderSlot(n.$slots,"after",{},void 0,!0)])])}}}),[["__scopeId","data-v-eb9975cc"]]),Jl={class:"multi-item-wrapper"},In=j(t.defineComponent({__name:"FieldArrayMultiItem",emits:["remove-item"],setup(e){return(n,o)=>{const r=t.resolveComponent("KButton");return t.openBlock(),t.createElementBlock("div",Jl,[t.renderSlot(n.$slots,"default",{},void 0,!0),t.createVNode(r,{appearance:"danger",class:"delete",onClick:o[0]||(o[0]=i=>n.$emit("remove-item"))},{default:t.withCtx(()=>o[1]||(o[1]=[t.createTextVNode(" - Remove Field ")])),_:1}),o[2]||(o[2]=t.createElementVNode("hr",null,null,-1))])}}}),[["__scopeId","data-v-37458a0a"]]),Xl="[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}";function Ql(e){return e?e.length===36&&new RegExp(`^${Xl}$`).test(e):!1}const dt=50,ke={CREATE_NOT_FROM_ENTITY:"CREATE_NOT_FROM_ENTITY",CREATE_FROM_ENTITY:"CREATE_FROM_ENTITY",UPDATE_ENTITY:"UPDATE_ENTITY",SET_REFERRAL_VALUE:"SET_REFERRAL_VALUE"};function es(e,n,o){return o?ke.SET_REFERRAL_VALUE:e&&!n||!e&&n?ke.UPDATE_ENTITY:e&&n?ke.CREATE_FROM_ENTITY:ke.CREATE_NOT_FROM_ENTITY}const ts={mixins:[X],inject:[se],emits:["model-updated"],data(){return{suggestions:[],idValue:"",message:"Type something to search",items:[],initialItems:[],loading:!1}},computed:{fieldState(){return es(this.model[this.schema.model],this.associatedEntity||this.entityId,this.bypassSearch)},associatedEntity(){return this.$route&&this.$route.params[this.entity]},entity(){return this.schema.entity},bypassSearch(){return this.$route&&this.$route.query&&this.$route.query.no_search}},async created(){await this.$nextTick();let e,n;switch(this.fieldState){case ke.UPDATE_ENTITY:if(!this[se]){console.warn("[@kong-ui-public/forms] No API service provided");break}n=(await this[se].getOne(this.entity,this.model[this.schema.model])).data,e=this.getItem(this.schema.entityDataKey?n[this.schema.entityDataKey]:n),this.idValue=e.id;break;case ke.CREATE_FROM_ENTITY:this.idValue=this.associatedEntity.id;break;case ke.SET_REFERRAL_VALUE:this.idValue=this.value}try{e&&(this.initialItems=[{...e,label:this.getSuggestionLabel(e),value:e.id}]),this.items=this.initialItems}catch(o){this.message=`There was an error loading ${this.schema.entity}`,console.error("err!",o)}},methods:{onQueryChange(e){e.trim().length===0&&(this.items=[],this.message="Type something to search"),typeof this.performSearch!="function"&&(this.performSearch=Ae(this.search,500)),this.performSearch(e)},async search(e){if(e.trim().length===0)return;this.loading=!0;const n=[],o=[],r=this.getInputFields(),i=new Set;Ql(e)&&r.includes("id")?o.push((async()=>{const a=await this.fetchExact(e);n.push({...a,label:this.getSuggestionLabel(a),value:a.id})})()):o.push(...r.filter(a=>a!=="id").map(async a=>{(await this.fetchSuggestions(e,a)).forEach(l=>{i.has(l.id)||(i.add(l.id),n.push({...l,label:this.getSuggestionLabel(l),value:l.id}))})})),await Promise.all(o),this.items=n,this.items.length===0&&(this.message="No results"),this.loading=!1},getItem(e){return e.data?e.data.length>0?e.data[0]:[]:e},async fetchUntilLimit(e){const n=[];let o=null;if(!this[se])return console.warn("[@kong-ui-public/forms] No API service provided"),[];for(;n.length<dt;){const r=await this[se].getAll(this.entity,{size:dt,offset:o,...e});if(n.push(...r.data.data),o=r.data.offset,!o)break}return n.slice(0,dt)},async fetchSuggestions(e,n){return this.fetchUntilLimit({[n]:e})},async fetchExact(e){return this[se]?(await this[se].getOne(this.entity,e)).data:(console.warn("[@kong-ui-public/forms] No API service provided"),{})},getInputFields(){var e,n;return((n=(e=this.schema)==null?void 0:e.inputValues)==null?void 0:n.fields)||[]},getSuggestionLabel(e){const n=this.getInputFields();return n.length&&e?n.map(o=>e[o]).filter(Boolean).join(" - "):""},updateModel(e){this.$emit("model-updated",e!=null&&e.length?e:null,this.schema.model)},onSelected(e){this.idValue=e&&e.id,this.updateModel(this.getReturnValue(e||{}))},getReturnValue(e){var o;const n=(o=this.schema)==null?void 0:o.returnKey;return n?e[n]:e.id}}},ns={class:"field-wrap autosuggest"},os=["data-testid","data-testlabel"],rs=["data-testid"],as={class:"autosuggest__results_message"};function is(e,n,o,r,i,a){const d=t.resolveComponent("KSelect");return t.openBlock(),t.createElementBlock("div",ns,[t.createVNode(d,{id:e.schema.model,ref:"suggestion",modelValue:i.idValue,"onUpdate:modelValue":n[0]||(n[0]=l=>i.idValue=l),clearable:"","enable-filtering":"","filter-function":()=>!0,items:i.items,loading:i.loading,placeholder:e.schema.placeholder,width:"100%",onChange:a.onSelected,onQueryChange:a.onQueryChange},{"item-template":t.withCtx(({item:l})=>[t.createElementVNode("span",{class:"first-part","data-testid":l.id&&`${l.id}-0`,"data-testlabel":l.label},t.toDisplayString(a.getSuggestionLabel(l).split(" - ")[0]),9,os),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(a.getSuggestionLabel(l).split(" - ").slice(1),(s,c)=>(t.openBlock(),t.createElementBlock("span",{key:c,class:"field-span","data-testid":l.id&&`${l.id}-${c+1}`||c+1},t.toDisplayString(s),9,rs))),128))]),empty:t.withCtx(()=>[t.createElementVNode("div",as,[t.createElementVNode("span",null,t.toDisplayString(i.message),1)])]),_:1},8,["id","modelValue","items","loading","placeholder","onChange","onQueryChange"])])}const An=j(ts,[["render",is],["__scopeId","data-v-dd2fda9e"]]);function ls(e){const n=t.ref([]),o=t.ref(null),r=f=>ge(f)?be[f]!=null?be[f]:(console.warn(`'${f}' is not a validator function!`),null):f,i=t.computed({get(){var C,k;let f;return L(F(e.schema,"get"))?f=e.schema.get((C=e.model)==null?void 0:C.value):f=F((k=e.model)==null?void 0:k.value,e.schema.model),S(f)},set(f){const C=i;f=I(f),L(f)?f(f,C):l(f,C)}}),a=f=>{var V;s();const C=(V=e.schema)==null?void 0:V.validator,k=F(e.formOptions,"validateAsync",!1);let B=[];if(C&&e.schema.readonly!==!0&&e.disabled!==!0){const A=[];Array.isArray(C)?x(C,h=>{A.push(r(h))}):A.push(r(C)),x(A,h=>{var p,M;if(k)B.push(h(i.value,e.schema,(p=e.model)==null?void 0:p.value));else{const T=h(i.value,e.schema,(M=e.model)==null?void 0:M.value);T&&L(T.then)?T.then(y=>{y&&(n.value=n.value.concat(y));const b=n.value.length===0;e.emitValidated&&e.emitValidated({isValid:b,errors:n.value,field:e.schema})}):T&&(B=B.concat(T))}})}const w=A=>{var p,M;let h=[];if(x(dn(A),T=>{Array.isArray(T)&&T.length>0?h=h.concat(T):ge(T)&&h.push(T)}),L((p=e.schema)==null?void 0:p.onValidated)&&e.schema.onValidated((M=e.model)==null?void 0:M.value,h,e.schema),!f){const T=h.length===0;e.emitValidated&&e.emitValidated({isValid:T,errors:h,field:e.schema})}return A=h,h};return k?Promise.all(B).then(w):w(B)},d=()=>{L(o.value)?o.value():o.value=Ae(a,F(e.schema,"validateDebounceTime",F(e.formOptions,"validateDebounceTime",500)))},l=(f,C)=>{var B,w,V;let k=!1;L(e.schema.set)?(e.schema.set((B=e.model)==null?void 0:B.value,f),k=!0):e.schema.model&&(c(e.schema.model,f),k=!0),k&&(e.emitModelUpdated&&((w=e.model)!=null&&w.value)&&e.emitModelUpdated({value:f,model:e.schema.model}),L(e.schema.onChanged)&&e.schema.onChanged((V=e.model)==null?void 0:V.value,f,C,e.schema),F(e.formOptions,"validateAfterChanged",!1)===!0&&(F(e.schema,"validateDebounceTime",F(e.formOptions,"validateDebounceTime",0))>0?d():a()))},s=()=>{n.value.splice(0)},c=(f,C)=>{var h;let k=f.replace(/\[(\w+)\]/g,".$1");k=k.replace(/^\./,"");let B=((h=e.model)==null?void 0:h.value)||{},w=0;const V=k.split("."),A=V.length;for(;w<A;){const p=V[w];if(w<A-1)B[p]!==void 0||(B[p]={}),B=B[p];else{B[p]=C;return}++w}},m=(f,C=!1)=>{const k=F(e.formOptions,"fieldIdPrefix","");return rt(f,k)+(C?"-"+cn():"")},u=f=>`${m(f)}-label`,g=()=>F(e.schema,"fieldClasses",[]),S=f=>e.formatValueToField&&typeof e.formatValueToField=="function"?e.formatValueToField(f):f,I=f=>e.formatValueToModel&&typeof e.formatValueToModel=="function"?e.formatValueToModel(f):f;return{value:i,clearValidationErrors:s,getFieldID:m,getLabelId:u,getFieldClasses:g,updateModelValue:l}}const we={useAbstractFields:ls},ss={class:"form-field-wrapper"},On=j(t.defineComponent({__name:"FieldInput",props:{disabled:{type:Boolean,default:!1},formOptions:{type:Object,default:()=>{}},model:{type:Object,default:()=>{}},schema:{type:Object,required:!0},vfg:{type:Object,required:!0},errors:{type:Array,default:()=>[]},hint:{type:String,default:""}},emits:["modelUpdated"],setup(e,{expose:n,emit:o}){const r=e,i=o,a=t.toRefs(r),d=t.inject(G,void 0),{updateModelValue:l,getFieldID:s,clearValidationErrors:c,value:m}=we.useAbstractFields({model:a.model,schema:r.schema,formOptions:r.formOptions,emitModelUpdated:w=>{i("modelUpdated",w.value,w.model)}});n({clearValidationErrors:c});const u=t.computed(()=>{var V;const w=(V=r.schema)==null?void 0:V.inputType.toLowerCase();switch(w){case"string":return"text";case"datetime":return"datetime-local";default:return w||"text"}}),g={date:"YYYY-MM-DD",datetime:"YYYY-MM-DD HH:mm:ss","datetime-local":"YYYY-MM-DDTHH:mm:ss"},S=(w,V)=>{var M,T;let A=w;const h=g[u.value]||"",p=Me.parse(w,h);p&&((M=r.schema)!=null&&M.format?A=Me.format(p,(T=r.schema)==null?void 0:T.format):A=p.valueOf()),l(A,V)},I=(w,V)=>{lt(w)||(w=NaN),l(w,V)},f=w=>{let V=w;switch(u.value){case"number":case"range":lt(parseFloat(w))&&(V=parseFloat(w));break}m.value=V,l(V,w)},C=w=>{m.value=w,l(w,w)},k=t.ref(null),B=()=>{var w;L(k.value)&&((w=k.value)==null||w.flush())};return t.onMounted(()=>{switch(u.value){case"number":case"range":k.value=Ae((w,V)=>{I(w,V)},parseInt(F(r.schema,"debounceFormatTimeout",1e3)),{trailing:!0,leading:!1});break;case"date":case"datetime":case"datetime-local":k.value=Ae((w,V)=>{S(w,V)},parseInt(F(r.schema,"debounceFormatTimeout",1e3)),{trailing:!0,leading:!1});break}}),t.onBeforeMount(()=>{u.value==="checkbox"?console.warn("The use of 'checkbox' inputType with 'input' type fields is deprecated. Use 'checkbox' type instead."):u.value==="radio"?console.warn("The use of 'radio' inputType with 'input' type fields is deprecated. Use 'radio' type instead."):u.value==="file"&&console.warn("The 'file' type in input field is deprecated. Use 'file' field instead.")}),(w,V)=>{const A=t.resolveComponent("KInput");return t.openBlock(),t.createElementBlock("div",ss,[t.createVNode(A,t.mergeProps(w.$attrs,{id:t.unref(s)(e.schema),autocomplete:e.schema.autocomplete,class:e.schema.fieldClasses,disabled:e.disabled||void 0,help:e.hint?e.hint:u.value==="color"||u.value==="range"?t.unref(m):void 0,max:e.schema.max,maxlength:e.schema.maxlength,min:e.schema.min,minlength:e.schema.minlength,"model-value":t.unref(m),name:e.schema.inputName,pattern:e.schema.pattern,placeholder:e.schema.placeholder,readonly:e.schema.readonly,required:e.schema.required,"show-password-mask-toggle":u.value==="password",type:u.value,width:e.schema.width,onBlur:B,"onUpdate:modelValue":f}),null,16,["id","autocomplete","class","disabled","help","max","maxlength","min","minlength","model-value","name","pattern","placeholder","readonly","required","show-password-mask-toggle","type","width"]),(t.openBlock(),t.createBlock(t.resolveDynamicComponent(t.unref(d)),{schema:e.schema,update:C,value:t.unref(m)},null,8,["schema","value"]))])}}}),[["__scopeId","data-v-fe1132bb"]]),ds={name:"FieldMetric",components:{AddIcon:oe.AddIcon,TrashIcon:oe.TrashIcon},mixins:[X],emits:["remove-item"],data(){return{contentVisible:!1}}},cs={key:0,class:"content"};function ms(e,n,o,r,i,a){const d=t.resolveComponent("AddIcon"),l=t.resolveComponent("TrashIcon"),s=t.resolveComponent("KButton");return t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["field-dropdown",{active:i.contentVisible}])},[t.createElementVNode("div",{class:"title",onClick:n[0]||(n[0]=c=>i.contentVisible=!i.contentVisible)},[t.createTextVNode(t.toDisplayString(e.model.name?e.model.name:"New Item")+" ",1),t.createVNode(d,{class:"metric-add-icon"})]),t.createVNode(t.Transition,{name:"slide-fade"},{default:t.withCtx(()=>[i.contentVisible?(t.openBlock(),t.createElementBlock("div",cs,[t.renderSlot(e.$slots,"default"),t.createVNode(s,{appearance:"tertiary",class:"metric-remove-button",onClick:n[1]||(n[1]=c=>e.$emit("remove-item"))},{default:t.withCtx(()=>[t.createVNode(l)]),_:1})])):t.createCommentVNode("",!0)]),_:3})],2)}const Fn=j(ds,[["render",ms]]),us={mixins:[X],emits:["modelUpdated"],data(){return{attributes:this.schema?this.schema.attributes:void 0,newKeyType:"string",newKeyName:"",keyTypes:{}}},created(){this.value||(this.value={})},mounted(){if(!this.value)return;const e=Object.keys(this.value),n={};for(let o=0;o<e.length;o++){const r=e[o];n[r]=typeof this.value[r]}this.keyTypes=n},methods:{removeElement(e){const n=this.value;delete n[e],this.value=JSON.parse(JSON.stringify(n));const o=this.keyTypes;delete o[e],this.keyTypes=JSON.parse(JSON.stringify(o))},addKey(){this.value[this.newKeyName]=void 0,this.value={...this.value},this.keyTypes[this.newKeyName]=this.newKeyType,this.keyTypes={...this.keyTypes},this.newKeyName=""},updateModel(e,n){this.$emit("modelUpdated",e,n)}}},fs={class:"field-object-container"},hs={key:1},ps=["id"],gs={key:0},ys=["onUpdate:modelValue"],bs={key:1},ks=["onUpdate:modelValue"],ws={key:2},Cs=["onUpdate:modelValue"],_s=["onClick"];function Es(e,n,o,r,i,a){const d=t.resolveComponent("vue-form-generator"),l=t.resolveDirective("attributes");return t.withDirectives((t.openBlock(),t.createElementBlock("div",fs,[e.schema.schema?(t.openBlock(),t.createBlock(d,{key:0,model:e.value,options:e.formOptions,schema:e.schema.schema,onModelUpdated:a.updateModel},null,8,["model","options","schema","onModelUpdated"])):(t.openBlock(),t.createElementBlock("div",hs,[t.createElementVNode("table",{id:e.getFieldID(e.schema),class:t.normalizeClass(e.schema.fieldClasses)},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.value,(s,c)=>(t.openBlock(),t.createElementBlock("tr",{key:c},[t.createElementVNode("td",null,t.toDisplayString(c),1),i.keyTypes[c]==="string"?(t.openBlock(),t.createElementBlock("td",gs,[t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":m=>e.value[c]=m,type:"text"},null,8,ys),[[t.vModelText,e.value[c]]])])):t.createCommentVNode("",!0),i.keyTypes[c]==="boolean"?(t.openBlock(),t.createElementBlock("td",bs,[t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":m=>e.value[c]=m,type:"checkbox"},null,8,ks),[[t.vModelCheckbox,e.value[c]]])])):t.createCommentVNode("",!0),i.keyTypes[c]==="number"?(t.openBlock(),t.createElementBlock("td",ws,[t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":m=>e.value[c]=m,type:"number"},null,8,Cs),[[t.vModelText,e.value[c]]])])):t.createCommentVNode("",!0),t.createElementVNode("td",null,[t.createElementVNode("input",{type:"button",value:"x",onClick:m=>a.removeElement(c)},null,8,_s)])]))),128))],10,ps),t.withDirectives(t.createElementVNode("select",{"onUpdate:modelValue":n[0]||(n[0]=s=>i.newKeyType=s)},n[3]||(n[3]=[t.createElementVNode("option",{value:"string"}," String ",-1),t.createElementVNode("option",{value:"number"}," Number ",-1),t.createElementVNode("option",{value:"boolean"}," Boolean ",-1)]),512),[[t.vModelSelect,i.newKeyType]]),t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":n[1]||(n[1]=s=>i.newKeyName=s),type:"text"},null,512),[[t.vModelText,i.newKeyName]]),t.createElementVNode("input",{type:"button",value:"Add key",onClick:n[2]||(n[2]=(...s)=>a.addKey&&a.addKey(...s))})]))])),[[l,i.attributes]])}const Un=j(us,[["render",Es],["__scopeId","data-v-b7e3dcd7"]]),Ms={components:{TrashIcon:oe.TrashIcon},mixins:[X],inject:{autofillSlot:{from:G,default:void 0}},emits:["model-updated"],data(){return{newKeyName:""}},computed:{subSchema(){return this.schema.schema&&this.schema.schema.fields[0].schema},subFields(){return!this.subSchema&&this.schema.fields},hasObjectKeys(){return this.value&&Object.keys(this.value).length>0},transformedModel(){return this.subSchema&&this.subSchema.fields.length>=1&&this.subSchema.fields[0].type==="array"?new Proxy(this.model[this.schema.model],{get:(e,n)=>({[this.schema.model]:e[n]}),set:(e,n,o)=>e[n]=o[this.schema.model]}):this.model[this.schema.model]},valueInputType(){var e;return["number","integer"].includes((e=this.schema.values)==null?void 0:e.type)?"number":"text"}},mounted(){this.value||(this.value={});let e=[];this.subSchema?e=this.subSchema.fields:this.subFields&&(e=this.schema.fields[0].schema),this.value=this.transformMapModelValuesToObject(this.model,e,this.schema.model)},methods:{removeElement(e){const n=this.value;delete n[e],this.value={...n}},transformMapModelValuesToObject(e,n,o){const r={};return Object.keys(e).map(i=>{const a=i.indexOf(o+"-");if(a>-1&&Array.isArray(n))if(n.length>0){const l=i.split("-").filter(c=>n.find(m=>m.model===c)),s=i.split(`-${l}`)[0].split(`${o}-`)[1];l.length?r[s]={...r[s],[l]:e[i]}:r[i.substring(a+`${o}-`.length)]=e[i]}else r[i.substring(`${o}-`.length)]=e[i];else{const l=i.split("-").filter(c=>c===this.schema.model),s=i.split(`-${l}`)[0].split(`${o}-`)[1];s&&(r[s]=e[i])}return i}),r},addKey(){var r;const e=this.subSchema&&Array.isArray(this.subSchema.fields)&&this.subSchema.fields.length===1&&this.subSchema.fields[0].type==="array",n=((r=this.schema.values)==null?void 0:r.default)??(this.valueInputType==="number"?0:""),o=this.subSchema?e?[""]:{}:n;this.value[this.newKeyName]=o,this.newKeyName=""},updateModel(e,n){this.$emit("model-updated",this.model[this.schema.model],n)}}},Ss=["id"],Vs=["data-testid"],Ts={class:"item-wrapper"},Ns={class:"index-wrapper"},Bs={key:0},Is={key:1},As=["onUpdate:modelValue","placeholder","type","onInput"],Os={key:0,class:"hint"},Fs={class:"input-item"},Us=["placeholder"],$s={key:0,class:"hint"};function Ls(e,n,o,r,i,a){const d=t.resolveComponent("TrashIcon"),l=t.resolveComponent("KButton"),s=t.resolveComponent("vue-form-generator");return t.openBlock(),t.createElementBlock("div",{id:e.getFieldID(e.schema),class:t.normalizeClass(["object-advanced-wrapper",e.schema.fieldClasses])},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.value,(c,m)=>(t.openBlock(),t.createElementBlock("div",{key:m,"data-testid":`field-object-key-${m}`},[t.createElementVNode("div",null,[t.createElementVNode("div",Ts,[t.createElementVNode("div",Ns,[t.createElementVNode("strong",null,t.toDisplayString(m),1),t.createElementVNode("div",null,[t.createVNode(l,{appearance:"tertiary",class:"delete",icon:"",type:"button",onClick:u=>a.removeElement(m)},{default:t.withCtx(()=>[t.createVNode(d)]),_:2},1032,["onClick"])])]),n[1]||(n[1]=t.createElementVNode("hr",{class:"divider"},null,-1)),a.subSchema?(t.openBlock(),t.createElementBlock("div",Bs,[t.createVNode(s,{model:a.transformedModel[m],options:{helpAsHtml:!0},schema:a.subSchema,onModelUpdated:a.updateModel},null,8,["model","schema","onModelUpdated"])])):(t.openBlock(),t.createElementBlock("div",Is,[t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":u=>e.value[m]=u,class:"form-control",placeholder:e.schema.fields&&e.schema.fields[0].schema.placeholder,type:a.valueInputType,onInput:u=>a.updateModel(e.value[m],e.model[e.schema.model])},null,40,As),[[t.vModelDynamic,e.value[m]]]),e.schema.fields&&e.schema.fields[0].schema.hint?(t.openBlock(),t.createElementBlock("p",Os,t.toDisplayString(e.schema.fields[0].schema.hint),1)):t.createCommentVNode("",!0),(t.openBlock(),t.createBlock(t.resolveDynamicComponent(a.autofillSlot),{schema:e.schema.fields&&e.schema.fields[0].schema||e.schema.values,update:u=>e.value[m]=u,value:e.value[m]},null,8,["schema","update","value"]))])),n[2]||(n[2]=t.createElementVNode("hr",{class:"wide-divider"},null,-1))])])],8,Vs))),128)),t.createElementVNode("div",{class:t.normalizeClass(["input-wrapper",{indent:a.hasObjectKeys}])},[t.createElementVNode("div",Fs,[t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":n[0]||(n[0]=c=>i.newKeyName=c),class:"form-control","data-testid":"keyname-input",placeholder:e.schema.placeholder,type:"text"},null,8,Us),[[t.vModelText,i.newKeyName]]),t.createVNode(l,{appearance:"tertiary","data-testid":"add-key",disabled:!i.newKeyName,onClick:a.addKey},{default:t.withCtx(()=>[t.createTextVNode(" + Add "+t.toDisplayString(e.schema.buttonLabel||e.schema.label),1)]),_:1},8,["disabled","onClick"])]),e.schema.hintText?(t.openBlock(),t.createElementBlock("p",$s,t.toDisplayString(e.schema.hintText),1)):t.createCommentVNode("",!0)],2)],10,Ss)}const $n=j(Ms,[["render",Ls],["__scopeId","data-v-9a0290c4"]]),js={class:"radio-selection-group"},Ln=j(t.defineComponent({__name:"FieldRadio",props:{disabled:{type:Boolean,default:!1},formOptions:{type:Object,default:()=>{}},model:{type:Object,default:()=>{}},schema:{type:Object,required:!0},vfg:{type:Object,required:!0},errors:{type:Array,default:()=>[]},hint:{type:String,default:""}},emits:["modelUpdated"],setup(e,{expose:n,emit:o}){const r=e,i=o,a=t.toRefs(r),{updateModelValue:d,value:l,clearValidationErrors:s}=we.useAbstractFields({model:a.model,schema:r.schema,formOptions:r.formOptions,emitModelUpdated:m=>{i("modelUpdated",m.value,m.model)}});n({clearValidationErrors:s});const c=m=>{let u=m;typeof m=="string"&&(u=m.split(","),r.schema.array||(u=u.toString())),d(u,m)};return(m,u)=>{const g=t.resolveComponent("KRadio");return t.openBlock(),t.createElementBlock("div",js,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.schema.values,(S,I)=>(t.openBlock(),t.createBlock(g,{id:e.schema.name+"-"+I,key:S.value,modelValue:t.unref(l),"onUpdate:modelValue":u[0]||(u[0]=f=>t.isRef(l)?l.value=f:null),label:S.name,"label-attributes":{info:e.schema.help},name:e.schema.name,required:e.schema.required||void 0,"selected-value":S.value,onChange:c},null,8,["id","modelValue","label","label-attributes","name","required","selected-value"]))),128))])}}}),[["__scopeId","data-v-09b8afda"]]),jn=t.defineComponent({__name:"FieldSelect",props:{disabled:{type:Boolean,default:!1},formOptions:{type:Object,default:()=>{}},model:{type:Object,default:()=>{}},schema:{type:Object,required:!0},vfg:{type:Object,required:!0},errors:{type:Array,default:()=>[]},hint:{type:String,default:""}},emits:["modelUpdated"],setup(e,{expose:n,emit:o}){const r=e,i=o,a=t.computed(()=>r.schema.selectOptions||{}),d=f=>q(f)?null:f,l=t.toRefs(r),{getFieldID:s,clearValidationErrors:c,value:m}=we.useAbstractFields({model:l.model,schema:r.schema,formOptions:r.formOptions,formatValueToField:d,emitModelUpdated:f=>{i("modelUpdated",f.value,f.model)}});n({clearValidationErrors:c});const u=t.computed(()=>{const f=r.schema.values;return g(typeof f=="function"?f.apply(this,[r.model,r.schema]):f)}),g=f=>{const C=[];return f.forEach(k=>{C.push({label:I(k),value:S(k),disabled:typeof k=="object"&&k.disabled||void 0,group:typeof k=="object"&&String(k.group||"").toUpperCase()||void 0})}),C},S=f=>{if(H(f)){if(a.value&&typeof a.value.value<"u")return f[a.value.value];if(typeof f.id<"u")return String(f.id);throw new Error("`id` is not defined. If you want to use another key name, add a `value` property under `selectOptions` in the schema. https://icebob.gitbooks.io/vueformgenerator/content/fields/select.html#select-field-with-object-items")}else return f},I=f=>{if(H(f)){if(a.value&&typeof a.value.name<"u")return f[a.value.name];if(typeof f.name<"u")return String(f.name);throw new Error("`name` is not defined. If you want to use another key name, add a `name` property under `selectOptions` in the schema. https://icebob.gitbooks.io/vueformgenerator/content/fields/select.html#select-field-with-object-items")}else return String(f)};return(f,C)=>{const k=t.resolveComponent("KSelect");return t.openBlock(),t.createBlock(k,{id:t.unref(s)(e.schema),modelValue:t.unref(m),"onUpdate:modelValue":C[0]||(C[0]=B=>t.isRef(m)?m.value=B:null),class:t.normalizeClass(e.schema.fieldClasses),clearable:!e.schema.required,disabled:e.disabled||void 0,items:u.value,"kpop-attributes":{"data-testid":`${t.unref(s)(e.schema)}-items`},"label-attributes":{info:e.schema.help},name:e.schema.inputName,placeholder:a.value.hideNoneSelectedText?void 0:a.value.noneSelectedText||"Nothing Selected",required:e.schema.required||void 0,width:"100%"},null,8,["id","modelValue","class","clearable","disabled","items","kpop-attributes","label-attributes","name","placeholder","required"])}}}),Ds={name:"FieldArray",components:{FieldArrayItem:Bn,FieldArrayMultiItem:In,FieldSelect:jn,FieldMetric:Fn,FieldObject:Un,FieldObjectAdvanced:$n,FieldAutoSuggest:An,FieldRadio:Ln,FieldArrayCardContainer:Nn,FieldInput:On},mixins:[X],inject:{autofillSlot:{from:G,default:void 0}},props:{newElementButtonLabel:{type:String,default:"New Item"},removeElementButtonLabel:{type:String,default:"x"}},emits:["refreshModel"],methods:{generateSchema(e,n,o){var i,a,d;let r;return n&&(r=JSON.parse(JSON.stringify(n)),(d=(a=(i=r.schema)==null?void 0:i.fields)==null?void 0:a.map)==null||d.call(a,l=>(l.id=`${l.id||l.model}-${o}`,l))),{...r,set(l,s){e[o]=s},get(){return e[o]}}},newElement(){let e=this.value,n;(!e||!e.push)&&(e=[]),this.schema.items&&this.schema.items.default&&(typeof this.schema.items.default=="function"?n=this.schema.items.default():n=this.schema.items.default),e.push(n),this.value=[...e]},removeElement(e){this.value=this.value.filter((n,o)=>o!==e)},getFieldType(e){return"field-"+e.type},modelUpdated(){this.$emit("refreshModel")},handleInput(e,n){this.value=this.value.map((o,r)=>r===n?e:o)}}},vs=["id"],qs={key:1},Rs=["onUpdate:modelValue","aria-labelledby","type"],Ps=["onUpdate:modelValue","aria-labelledby"];function Ks(e,n,o,r,i,a){const d=t.resolveComponent("KTextArea"),l=t.resolveComponent("KInput"),s=t.resolveComponent("KButton");return e.schema?(t.openBlock(),t.createElementBlock("div",{key:0,id:e.getFieldID(e.schema),class:t.normalizeClass(e.schema.fieldClasses)},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.value,(c,m)=>(t.openBlock(),t.createElementBlock("div",{key:m,class:t.normalizeClass(e.schema.fieldItemsClasses)},[e.schema.items&&e.schema.itemContainerComponent?(t.openBlock(),t.createBlock(t.resolveDynamicComponent(e.schema.itemContainerComponent),{key:0,index:m,model:c,schema:a.generateSchema(e.value,e.schema.items,m),onRemoveItem:u=>a.removeElement(m)},{default:t.withCtx(()=>[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(a.getFieldType(e.schema.items)),{"form-options":e.formOptions,model:c,schema:a.generateSchema(e.value,e.schema.items,m),onModelUpdated:a.modelUpdated},null,40,["form-options","model","schema","onModelUpdated"]))]),_:2},1064,["index","model","schema","onRemoveItem"])):e.schema.items?(t.openBlock(),t.createElementBlock("span",qs,[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(a.getFieldType(e.schema.items)),{"form-options":e.formOptions,model:c,schema:a.generateSchema(e.value,e.schema.items,m),onModelUpdated:a.modelUpdated},null,40,["form-options","model","schema","onModelUpdated"]))])):e.schema.itemContainerComponent?(t.openBlock(),t.createBlock(t.resolveDynamicComponent(e.schema.itemContainerComponent),{key:2,"data-testid":`${e.getFieldID(e.schema)}-item-${m}`,model:c,schema:a.generateSchema(e.value,e.schema.items,m),onRemoveItem:u=>a.removeElement(m)},{after:t.withCtx(()=>[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(a.autofillSlot),{schema:e.schema,update:u=>e.value[m]=u,value:e.value[m]},null,8,["schema","update","value"]))]),default:t.withCtx(()=>{var u;return[e.schema.inputAttributes&&e.schema.inputAttributes.type==="textarea"?(t.openBlock(),t.createBlock(d,t.mergeProps({key:0,ref_for:!0},e.schema.inputAttributes,{id:e.getFieldID(e.schema),modelValue:e.value[m],"onUpdate:modelValue":g=>e.value[m]=g,"aria-labelledby":e.getLabelId(e.schema),class:e.schema.fieldClasses,maxlength:e.schema.max,minlength:e.schema.min,name:e.schema.inputName,placeholder:e.schema.placeholder,readonly:e.schema.readonly,required:e.schema.required,rows:e.schema.rows||2}),null,16,["id","modelValue","onUpdate:modelValue","aria-labelledby","class","maxlength","minlength","name","placeholder","readonly","required","rows"])):!e.schema.inputAttributes||!e.schema.inputAttributes.type||e.schema.inputAttributes.type==="text"||e.schema.inputAttributes.type==="number"?(t.openBlock(),t.createBlock(l,t.mergeProps({key:1,"aria-labelledby":e.getLabelId(e.schema),ref_for:!0},e.schema.inputAttributes,{"model-value":e.value[m],type:e.schema.inputAttributes&&e.schema.inputAttributes.type||"text",onInput:g=>{a.handleInput(g,m)}}),null,16,["aria-labelledby","model-value","type","onInput"])):t.withDirectives((t.openBlock(),t.createElementBlock("input",t.mergeProps({key:2,"onUpdate:modelValue":g=>e.value[m]=g,"aria-labelledby":e.getLabelId(e.schema),ref_for:!0},e.schema.inputAttributes,{type:((u=e.schema.inputAttributes)==null?void 0:u.type)||"text"}),null,16,Rs)),[[t.vModelDynamic,e.value[m]]])]}),_:2},1064,["data-testid","model","schema","onRemoveItem"])):(t.openBlock(),t.createElementBlock(t.Fragment,{key:3},[t.withDirectives(t.createElementVNode("input",t.mergeProps({ref_for:!0},e.schema.inputAttributes,{"onUpdate:modelValue":u=>e.value[m]=u,"aria-labelledby":e.getLabelId(e.schema),type:"text"}),null,16,Ps),[[t.vModelText,e.value[m]]]),(t.openBlock(),t.createBlock(t.resolveDynamicComponent(a.autofillSlot),{schema:e.schema,update:u=>e.value[m]=u,value:e.value[m]},null,8,["schema","update","value"]))],64))],2))),128)),t.createVNode(s,{appearance:"tertiary",class:t.normalizeClass(e.schema.newElementButtonLabelClasses),"data-testid":`add-${e.getFieldID(e.schema)}`,type:"button",onClick:a.newElement},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(e.schema.newElementButtonLabel||o.newElementButtonLabel),1)]),_:1},8,["class","data-testid","onClick"])],10,vs)):t.createCommentVNode("",!0)}const xs=j(Ds,[["render",Ks],["__scopeId","data-v-367d2ee8"]]),zs={class:"form-field-wrapper field-checkbox"},Ys=j(t.defineComponent({__name:"FieldCheckbox",props:{disabled:{type:Boolean,default:!1},formOptions:{type:Object,default:()=>{}},model:{type:Object,default:()=>{}},schema:{type:Object,required:!0},vfg:{type:Object,required:!0},errors:{type:Array,default:()=>[]},hint:{type:String,default:""}},emits:["modelUpdated"],setup(e,{expose:n,emit:o}){const r=e,i=o,a=t.toRefs(r),{getFieldID:d,value:l,clearValidationErrors:s}=we.useAbstractFields({model:a.model,schema:r.schema,formOptions:r.formOptions,emitModelUpdated:c=>{i("modelUpdated",c.value,c.model)}});return n({clearValidationErrors:s}),(c,m)=>{const u=t.resolveComponent("KCheckbox");return t.openBlock(),t.createElementBlock("div",zs,[t.createVNode(u,t.mergeProps(c.$attrs,{id:t.unref(d)(e.schema),modelValue:t.unref(l),"onUpdate:modelValue":m[0]||(m[0]=g=>t.isRef(l)?l.value=g:null),autocomplete:e.schema.autocomplete,class:e.schema.fieldClasses,disabled:e.disabled||void 0,help:e.hint?e.hint:void 0,name:e.schema.inputName,readonly:e.schema.readonly,required:e.schema.required,width:e.schema.width}),null,16,["id","modelValue","autocomplete","class","disabled","help","name","readonly","required","width"])])}}}),[["__scopeId","data-v-6b4ee1cd"]]);var Hs=4;function Dn(e){return Ie(e,Hs)}const Gs={class:"wrapper"},Ws=["disabled"],Zs=["id","checked","disabled","onChange","name"],Js=["disabled"],Xs={class:"info"},Qs={class:"dropList"},ed=["id","checked","disabled","onChange","name"];function td(e,n,o,r,i,a){const d=t.resolveDirective("attributes");return t.withDirectives((t.openBlock(),t.createElementBlock("div",Gs,[e.schema.listBox?(t.openBlock(),t.createElementBlock("div",{key:0,class:"listbox form-control",disabled:e.disabled||null},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(a.items,l=>(t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["list-row",{"is-checked":a.isItemChecked(l)}])},[t.createElementVNode("label",null,[t.withDirectives(t.createElementVNode("input",{id:e.getFieldID(e.schema,!0),type:"checkbox",checked:a.isItemChecked(l)||null,disabled:e.disabled||null,onChange:s=>a.onChanged(s,l),name:a.getInputName(l)},null,40,Zs),[[d,"input"]]),t.createTextVNode(t.toDisplayString(a.getItemName(l)),1)])],2))),256))],8,Ws)):t.createCommentVNode("",!0),e.schema.listBox?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("div",{key:1,class:"combobox form-control",disabled:e.disabled||null},[t.createElementVNode("div",{class:t.normalizeClass(["mainRow",{expanded:i.comboExpanded}]),onClick:n[0]||(n[0]=(...l)=>a.onExpandCombo&&a.onExpandCombo(...l))},[t.createElementVNode("div",Xs,t.toDisplayString(a.selectedCount)+" selected",1),n[1]||(n[1]=t.createElementVNode("div",{class:"arrow"},null,-1))],2),t.createElementVNode("div",Qs,[i.comboExpanded?(t.openBlock(!0),t.createElementBlock(t.Fragment,{key:0},t.renderList(a.items,l=>(t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["list-row",{"is-checked":a.isItemChecked(l)}])},[t.createElementVNode("label",null,[t.withDirectives(t.createElementVNode("input",{id:e.getFieldID(e.schema,!0),type:"checkbox",checked:a.isItemChecked(l)||null,disabled:e.disabled||null,onChange:s=>a.onChanged(s,l),name:a.getInputName(l)},null,40,ed),[[d,"input"]]),t.createTextVNode(t.toDisplayString(a.getItemName(l)),1)])],2))),256)):t.createCommentVNode("",!0)])],8,Js))])),[[d,"wrapper"]])}const nd=j({mixins:[X],data(){return{comboExpanded:!1}},computed:{items(){const e=this.schema.values;return typeof e=="function"?e.apply(this,[this.model,this.schema]):e},selectedCount(){return this.value?this.value.length:0}},methods:{getInputName(e){return this.schema&&this.schema.inputName&&this.schema.inputName.length>0?rn(this.schema.inputName+"_"+this.getItemValue(e)):rn(this.getItemValue(e))},getItemValue(e){if(H(e)){if(typeof this.schema.checklistOptions<"u"&&typeof this.schema.checklistOptions.value<"u")return e[this.schema.checklistOptions.value];if(typeof e.value<"u")return e.value;throw new Error("`value` is not defined. If you want to use another key name, add a `value` property under `checklistOptions` in the schema. https://icebob.gitbooks.io/vueformgenerator/content/fields/checklist.html#checklist-field-with-object-values")}else return e},getItemName(e){if(H(e)){if(typeof this.schema.checklistOptions<"u"&&typeof this.schema.checklistOptions.name<"u")return e[this.schema.checklistOptions.name];if(typeof e.name<"u")return e.name;throw new Error("`name` is not defined. If you want to use another key name, add a `name` property under `checklistOptions` in the schema. https://icebob.gitbooks.io/vueformgenerator/content/fields/checklist.html#checklist-field-with-object-values")}else return e},isItemChecked(e){return this.value&&this.value.indexOf(this.getItemValue(e))!==-1},onChanged(e,n){if((q(this.value)||!Array.isArray(this.value))&&(this.value=[]),e.target.checked){const o=Dn(this.value);o.push(this.getItemValue(n)),this.value=o}else{const o=Dn(this.value);o.splice(this.value.indexOf(this.getItemValue(n)),1),this.value=o}},onExpandCombo(){this.comboExpanded=!this.comboExpanded}}},[["render",td]]),od={name:"FieldKeyValuePairs",components:{TrashIcon:oe.TrashIcon},mixins:[X],inject:{autofillSlot:{from:G,default:void 0}},data(){return{pairs:[]}},watch:{pairs:{handler(){this.updateValue()},deep:!0}},created(){var n,o;this.value||(this.value={});const e=((o=this.model)==null?void 0:o[(n=this.schema)==null?void 0:n.model])??{};Object.keys(e).forEach(r=>{this.pairs.push({key:r,value:e[r]})})},methods:{onInput(e,n,o){this.pairs[n][o]=e.target.value},updateValue(){this.value=this.pairs.reduce((e,{key:n,value:o})=>({...e,...n&&o?{[n]:o}:null}),{})},addPair(){this.pairs.push({key:"",value:""})},removePair(e){this.pairs.splice(e,1)}}},rd={class:"key-value-pairs-editor"},ad={class:"pair-item-cell"},id=["data-testid","placeholder","value","onInput"],ld={class:"pair-item-cell"},sd=["data-testid","placeholder","value","onInput"];function dd(e,n,o,r,i,a){const d=t.resolveComponent("TrashIcon"),l=t.resolveComponent("KButton");return t.openBlock(),t.createElementBlock("div",rd,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(i.pairs,(s,c)=>(t.openBlock(),t.createElementBlock("div",{key:c,class:"pair-item"},[t.createElementVNode("div",ad,[t.createElementVNode("input",{class:"form-control","data-testid":`${e.getFieldID(e.schema)}-pair-key-${c}`,placeholder:e.schema.keyInputPlaceholder??"Key",type:"text",value:s.key,onInput:m=>{a.onInput(m,c,"key")}},null,40,id),(t.openBlock(),t.createBlock(t.resolveDynamicComponent(a.autofillSlot),{schema:e.schema,update:m=>a.onInput({target:{value:m}},c,"key"),value:s.key},null,8,["schema","update","value"]))]),t.createElementVNode("div",ld,[t.createElementVNode("input",{class:"form-control","data-testid":`${e.getFieldID(e.schema)}-pair-value-${c}`,placeholder:e.schema.valueInputPlaceholder??"Value",type:"text",value:s.value,onInput:m=>{a.onInput(m,c,"value")}},null,40,sd),(t.openBlock(),t.createBlock(t.resolveDynamicComponent(a.autofillSlot),{schema:e.schema,update:m=>a.onInput({target:{value:m}},c,"value"),value:s.value},null,8,["schema","update","value"]))]),t.createVNode(l,{appearance:"tertiary","data-testid":`${e.getFieldID(e.schema)}-remove-pair-${c}`,onClick:()=>{a.removePair(c)}},{default:t.withCtx(()=>[t.createVNode(d)]),_:2},1032,["data-testid","onClick"])]))),128)),t.createVNode(l,{appearance:"tertiary",class:t.normalizeClass(e.schema.newElementButtonLabelClasses),"data-testid":`${e.getFieldID(e.schema)}-add-pair`,type:"button",onClick:a.addPair},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(e.schema.newElementButtonLabel??"+ Add Pair"),1)]),_:1},8,["class","data-testid","onClick"])])}const cd=j(od,[["render",dd],["__scopeId","data-v-70998d5b"]]),md=j(t.defineComponent({__name:"FieldLabel",props:{disabled:{type:Boolean,default:!1},formOptions:{type:Object,default:()=>{}},model:{type:Object,default:()=>{}},schema:{type:Object,required:!0},vfg:{type:Object,required:!0}},setup(e){const n=e,o=t.toRefs(n),{getFieldID:r,value:i}=we.useAbstractFields({model:o.model,schema:n.schema,formOptions:n.formOptions});return(a,d)=>{const l=t.resolveComponent("KLabel");return t.openBlock(),t.createElementBlock("span",{class:t.normalizeClass(["field-label",e.schema.fieldClasses])},[t.createVNode(l,{id:t.unref(r)(e.schema)},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(t.unref(i)),1)]),_:1},8,["id"])],2)}}}),[["__scopeId","data-v-d046a15a"]]),ud={mixins:[X],emits:["model-updated"],computed:{items(){var e,n;return this.schema.values?this.schema.values:(n=(e=this.schema.elements)==null?void 0:e.one_of)!=null&&n.length?this.schema.elements.one_of.map(o=>({label:o,value:o})):[]}},methods:{onUpdate(e){this.$emit("model-updated",e,this.schema.model)}}};function fd(e,n,o,r,i,a){const d=t.resolveComponent("KMultiselect");return t.openBlock(),t.createBlock(d,{"aria-labelledby":e.getLabelId(e.schema),"data-testid":"field-multiselect",items:a.items,"label-attributes":{info:e.schema.help},"model-value":e.value,placeholder:e.schema.placeholder,required:e.schema.required||void 0,width:"100%","onUpdate:modelValue":a.onUpdate},null,8,["aria-labelledby","items","label-attributes","model-value","placeholder","required","onUpdate:modelValue"])}const hd=j(ud,[["render",fd]]),pd={mixins:[X],emits:["model-updated"],data(){return{checkedGroup:null,fieldModel:{...this.model},fieldSchema:[]}},watch:{checkedGroup:{handler(e,n){if(n===null){this.fieldModel={...this.model};return}const o=this.schema.fields[e].fields,r=this.schema.fields[n].fields;r&&r.forEach(i=>this.updateModel("",i.model)),o&&o.forEach(i=>this.updateModel(this.fieldModel[i.model],i.model))}}},async created(){await this.$nextTick(),this.schema.fields.forEach((e,n)=>{e.fields&&e.fields.forEach(o=>{this.model[o.model]&&(this.checkedGroup=n,this.fieldSchema.push(o.model))})}),this.checkedGroup===null&&(this.checkedGroup=0)},methods:{updateModel(e,n){this.$emit("model-updated",e,n)}}},gd={class:"selection-group"},yd={class:"form-group horizontal-radios"},bd={class:"radio-group"},kd=["value"],wd={class:"control-help"},Cd={class:"option-field"},_d={class:"option-field-container"};function Ed(e,n,o,r,i,a){const d=t.resolveComponent("vue-form-generator");return t.openBlock(),t.createElementBlock("div",gd,[t.createElementVNode("div",yd,[t.createElementVNode("div",bd,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.schema.fields,(l,s)=>(t.openBlock(),t.createElementBlock("div",{key:s,class:"option-group"},[t.createElementVNode("label",{class:t.normalizeClass(["k-label",`${l.label}-check`])},[t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":n[0]||(n[0]=c=>i.checkedGroup=c),class:"k-input",type:"radio",value:s},null,8,kd),[[t.vModelRadio,i.checkedGroup]]),t.createTextVNode(" "+t.toDisplayString(l.label)+" ",1),t.createElementVNode("div",wd,t.toDisplayString(l.description),1)],2)]))),128))])]),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.schema.fields,(l,s)=>(t.openBlock(),t.createElementBlock("div",{key:s,class:"option-group"},[t.withDirectives(t.createElementVNode("div",Cd,[t.createElementVNode("div",_d,[t.createVNode(d,{model:e.model,options:{helpAsHtml:!0},schema:{fields:l.fields},onModelUpdated:a.updateModel},null,8,["model","schema","onModelUpdated"])])],512),[[t.vShow,l.fields&&i.checkedGroup===s]])]))),128))])}const Md=j(pd,[["render",Ed],["__scopeId","data-v-0aaaf597"]]),Ye={general:{packageName:"forms"},"post-function":{tags:{hint:"e.g. tag1, tag2, tag3",newElementButtonLabel:"+ Add"},enabled:{newElementButtonLabel:"+ Add"},selectionGroup:{newElementButtonLabel:"+ Add"},instance_name:{newElementButtonLabel:"+ Add"},name:{newElementButtonLabel:"+ Add"},"config-certificate":{help:"Array of stringified Lua code to be cached and run in sequence during the certificate phase.",newElementButtonLabel:"+ Add"},"config-access":{help:"Array of stringified Lua code to be cached and run in sequence during the access phase.",newElementButtonLabel:"+ Add"},"config-body_filter":{help:"Array of stringified Lua code to be cached and run in sequence during the body_filter phase.",newElementButtonLabel:"+ Add"},"config-header_filter":{help:"Array of stringified Lua code to be cached and run in sequence during the header_filter phase.",newElementButtonLabel:"+ Add"},"config-functions":{newElementButtonLabel:"+ Add"},"config-log":{newElementButtonLabel:"+ Add"},"config-rewrite":{newElementButtonLabel:"+ Add"},"config-ws_client_frame":{newElementButtonLabel:"+ Add"},"config-ws_close":{newElementButtonLabel:"+ Add"},"config-ws_handshake":{newElementButtonLabel:"+ Add"},"config-ws_upstream_frame":{newElementButtonLabel:"+ Add"}},"exit-transformer":{"config-functions":{newElementButtonLabel:"+ Add"}},rla:{view_advanced_fields:"View Advanced Fields",window_type:{label:"Rate Limit Window Type",help:"Sets the time window type to either <code>sliding</code> (default) or <code>fixed</code>.<br><ul><li>Sliding windows apply the rate limiting logic while taking into account previous hit rates (from the window that immediately precedes the current) using a dynamic weight.</li><li>Fixed windows consist of buckets that are statically assigned to a definitive time range, each request is mapped to only one fixed window based on its timestamp and will affect only that window&#39;s counters.</li></ul>",options:{fixed:"Fixed",sliding:"Sliding"}},request_limits:{title:"Request Limits",subtitle:"Set one or more limits on the number of API requests allowed within a defined timeframe.",label:"Limit",label_index:"Limit {index}",request_number:"Request number",time_interval:"Time interval",interval_determiner:"Every",seconds:"Seconds"},start_with_a_use_case:"Start with a use case:",use_case_index:"Use case {index}",error_message:{label:"Error Message",code_placeholder:"Code Message",message_placeholder:"Error Message",help:"Set a custom error code and message to be returned when the rate limit is exceeded."},identifiers:{label:"Identifiers",options:{ip:"IP",credential:"Credential",consumer:"Consumer",service:"Service",header:"Header",path:"Path","consumer-group":"Consumer Group"}},redis:{title:"Configure your Redis",address_example:"e.g. localhost:6379"}},vfg:{labels:{on:"On",off:"Off"}}},Sd={class:"form-field-wrapper"},Vd=t.defineComponent({__name:"FieldSwitch",props:{disabled:{type:Boolean,default:!1},formOptions:{type:Object,default:()=>{}},model:{type:Object,default:()=>{}},schema:{type:Object,required:!0},vfg:{type:Object,required:!0},errors:{type:Array,default:()=>[]},hint:{type:String,default:""}},emits:["modelUpdated"],setup(e,{expose:n,emit:o}){const r=e,i=o,{t:a}=Fe.createI18n("en-us",Ye),d=g=>g!=null&&r.schema.valueOn?g===r.schema.valueOn:g,l=g=>g!=null&&r.schema.valueOn?g?r.schema.valueOn:r.schema.valueOff:g,s=t.toRefs(r),{getFieldID:c,value:m,clearValidationErrors:u}=we.useAbstractFields({model:s.model,schema:r.schema,formOptions:r.formOptions,formatValueToField:d,formatValueToModel:l,emitModelUpdated:g=>{i("modelUpdated",g.value,g.model)}});return n({clearValidationErrors:u}),(g,S)=>{const I=t.resolveComponent("KInputSwitch");return t.openBlock(),t.createElementBlock("div",Sd,[t.createVNode(I,{id:t.unref(c)(e.schema),modelValue:t.unref(m),"onUpdate:modelValue":S[0]||(S[0]=f=>t.isRef(m)?m.value=f:null),autocomplete:e.schema.autocomplete,class:t.normalizeClass(e.schema.fieldClasses),disabled:e.disabled||void 0,label:t.unref(m)?e.schema.textOn||t.unref(a)("vfg.labels.on"):e.schema.textOff||t.unref(a)("vfg.labels.off"),"label-attributes":{info:e.schema.help},name:e.schema.inputName,required:e.schema.required||void 0},null,8,["id","modelValue","autocomplete","class","disabled","label","label-attributes","name","required"])])}}}),Td={class:"field-textarea"},Nd={name:"FormGroup",components:Object.freeze(Object.defineProperty({__proto__:null,FieldAdvanced:Yl,FieldArray:xs,FieldArrayCardContainer:Nn,FieldArrayItem:Bn,FieldArrayMultiItem:In,FieldAutoSuggest:An,FieldCheckbox:Ys,FieldChecklist:nd,FieldInput:On,FieldKeyValuePairs:cd,FieldLabel:md,FieldMetric:Fn,FieldMultiselect:hd,FieldObject:Un,FieldObjectAdvanced:$n,FieldRadio:Ln,FieldSelect:jn,FieldSelectionGroup:Md,FieldSwitch:Vd,FieldTextArea:j(t.defineComponent({__name:"FieldTextArea",props:{disabled:{type:Boolean,default:!1},formOptions:{type:Object,default:()=>{}},model:{type:Object,default:()=>{}},schema:{type:Object,required:!0},vfg:{type:Object,required:!0},errors:{type:Array,default:()=>[]},hint:{type:String,default:""}},emits:["modelUpdated"],setup(e,{expose:n,emit:o}){const r=e,i=o,a=t.toRefs(r),d=t.inject(G,void 0),{updateModelValue:l,getFieldID:s,clearValidationErrors:c,value:m}=we.useAbstractFields({model:a.model,schema:r.schema,formOptions:r.formOptions,emitModelUpdated:g=>{i("modelUpdated",g.value,g.model)}});n({clearValidationErrors:c});const u=g=>{m.value=g,l(g,g)};return(g,S)=>{const I=t.resolveComponent("KTextArea");return t.openBlock(),t.createElementBlock("div",Td,[t.createVNode(I,t.mergeProps(g.$attrs,{id:t.unref(s)(e.schema),modelValue:t.unref(m),"onUpdate:modelValue":S[0]||(S[0]=f=>t.isRef(m)?m.value=f:null),class:e.schema.fieldClasses,disabled:e.disabled||void 0,help:e.hint||void 0,maxlength:e.schema.max,minlength:e.schema.min,name:e.schema.inputName,placeholder:e.schema.placeholder,readonly:e.schema.readonly,required:e.schema.required,rows:e.schema.rows||2}),null,16,["id","modelValue","class","disabled","help","maxlength","minlength","name","placeholder","readonly","required","rows"]),(t.openBlock(),t.createBlock(t.resolveDynamicComponent(t.unref(d)),{schema:e.schema,update:u,value:t.unref(m)},null,8,["schema","value"]))])}}}),[["__scopeId","data-v-b6cec018"]])},Symbol.toStringTag,{value:"Module"})),mixins:[an],inject:{"vfg-array-item-index":{default:void 0}},props:{vfg:{type:Object,required:!0},model:{type:Object,default:()=>{}},options:{type:Object,default:()=>{}},field:{type:Object,required:!0},errors:{type:Array,default(){return[]}}},emits:["validated","modelUpdated","refreshModel"],data(){return{child:t.ref()}},computed:{schema(){var n;if(!((n=this.field)!=null&&n.schema)||!Array.isArray(this.field.schema.fields))return this.field;const e=this["vfg-array-item-index"];return typeof e!="number"||Number.isNaN(e)?this.field:{...this.field,schema:{...this.field.schema,fields:this.field.schema.fields.map(o=>({...o,...o.id?{id:`${o.id}-${e}`}:void 0}))}}}},methods:{fieldTypeHasLabel(e){if(q(e.label))return!1;let n="";switch(e.type==="input"?n=e.inputType:n=e.type,n){case"button":case"submit":case"reset":return!1;default:return!0}},getFieldID(e){const n=F(this.options,"fieldIdPrefix","");return rt(e,n)},getTooltipId(e){return`${this.getFieldID(e)}-tooltip`},getFieldType(e){return"field-"+e.type},getButtonType(e){return F(e,"type","button")},onFieldValidated(e,n,o){this.$emit("validated",e,n,o)},buttonVisibility(e){return e.buttons&&e.buttons.length>0},buttonClickHandler(e,n,o){return e.onclick.call(this,this.model,n,o,this)},fieldHint(e){return L(e.hint)?e.hint.call(this,this.model,e,this):e.hint},fieldErrors(e){return this.errors.filter(n=>n.field.fieldName===e.fieldName).map(n=>n.error)},onRefreshModel(){this.$emit("refreshModel")},onModelUpdated(e,n){this.$emit("modelUpdated",e,n)},validate(e){return this.$refs.child.validate(e)},clearValidationErrors(){if(this.$refs.child)return this.$refs.child.clearValidationErrors()},formattedLabel(e){return e?e.replace(/^[cC]onfig\./,""):""}}},Bd=["innerHTML"],Id={class:"icon-wrapper"},Ad=["innerHTML"],Od={key:0,class:"link-wrapper"},Fd={class:"field-wrap"},Ud={key:0,class:"buttons"},$d=["type","onClick","textContent"],Ld=["innerHTML"],jd={key:2,class:"errors help-block"},Dd=["innerHTML"];function vd(e,n,o,r,i,a){const d=t.resolveComponent("KExternalLink"),l=t.resolveComponent("KLabel");return t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["form-group",e.getFieldRowClasses(o.field)])},[a.fieldTypeHasLabel(o.field)?(t.openBlock(),t.createBlock(l,{key:0,"aria-describedby":o.field.help?a.getTooltipId(o.field):void 0,class:t.normalizeClass([o.field.labelClasses,"form-group-label"]),for:a.getFieldID(o.field),info:!o.options.helpAsHtml&&o.field.help?o.field.help:void 0,"tooltip-attributes":o.field.help?{maxWidth:"300",placement:"top",tooltipId:a.getTooltipId(o.field)}:void 0},t.createSlots({default:t.withCtx(()=>[t.createElementVNode("div",Id,[t.createElementVNode("span",{innerHTML:a.formattedLabel(o.field.label)},null,8,Ad)]),o.field.link?(t.openBlock(),t.createElementBlock("div",Od,[t.createVNode(d,{href:o.field.link},{default:t.withCtx(()=>n[0]||(n[0]=[t.createElementVNode("span",{class:"section-header"},"More info",-1)])),_:1},8,["href"])])):t.createCommentVNode("",!0)]),_:2},[o.options.helpAsHtml&&o.field.help?{name:"tooltip",fn:t.withCtx(()=>[t.createElementVNode("div",{innerHTML:o.field.help},null,8,Bd)]),key:"0"}:void 0]),1032,["aria-describedby","class","for","info","tooltip-attributes"])):t.createCommentVNode("",!0),t.createElementVNode("div",Fd,[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(a.getFieldType(o.field)),t.mergeProps(e.$attrs,{ref:"child",disabled:e.fieldDisabled(o.field)||null,"form-options":o.options,hint:o.field.hint&&a.getFieldType(o.field)==="field-input"?a.fieldHint(o.field):void 0,model:o.model,schema:a.schema,vfg:o.vfg,onModelUpdated:a.onModelUpdated,onRefreshModel:a.onRefreshModel,onValidated:a.onFieldValidated}),null,16,["disabled","form-options","hint","model","schema","vfg","onModelUpdated","onRefreshModel","onValidated"])),a.buttonVisibility(o.field)?(t.openBlock(),t.createElementBlock("div",Ud,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(o.field.buttons,(s,c)=>(t.openBlock(),t.createElementBlock("button",{key:c,class:t.normalizeClass(s.classes),type:a.getButtonType(s),onClick:m=>a.buttonClickHandler(s,o.field,m),textContent:t.toDisplayString(s.label)},null,10,$d))),128))])):t.createCommentVNode("",!0)]),o.field.hint&&a.getFieldType(o.field)!=="field-input"?(t.openBlock(),t.createElementBlock("div",{key:1,class:"hint",innerHTML:a.fieldHint(o.field)},null,8,Ld)):t.createCommentVNode("",!0),a.fieldErrors(o.field).length>0?(t.openBlock(),t.createElementBlock("div",jd,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(a.fieldErrors(o.field),(s,c)=>(t.openBlock(),t.createElementBlock("span",{key:c,innerHTML:s},null,8,Dd))),128))])):t.createCommentVNode("",!0)],2)}const qd={name:"FormGenerator",components:{formGroup:j(Nd,[["render",vd],["__scopeId","data-v-49ca89d6"]])},mixins:[an],inject:{autofillSlot:{from:G,default:void 0}},provide(){var e;return{...!this.autofillSlot&&{[G]:(e=this.$slots)==null?void 0:e[pe]}}},props:{schema:{type:Object,default:()=>{}},model:{type:Object,default:()=>{}},options:{type:Object,default(){return{validateAfterLoad:!1,validateAfterChanged:!1,child:t.ref([]),fieldIdPrefix:"",validateAsync:!1,validationErrorClass:"error",validationSuccessClass:"",helpAsHtml:!1}}},multiple:{type:Boolean,default:!1},isNewModel:{type:Boolean,default:!1},tag:{type:String,default:"fieldset",validator:function(e){return e.length>0}}},emits:["validated","modelUpdated","refreshModel"],data(){return{vfg:this,errors:[],children:t.ref([]),collapseStates:{}}},computed:{fields(){const e=[];return this.schema&&this.schema.fields&&x(this.schema.fields,n=>{(!this.multiple||n.multi===!0)&&e.push(n)}),e},groups(){const e=[];return this.schema&&this.schema.groups&&x(this.schema.groups.slice(0),n=>{e.push(n)}),e}},watch:{model:{deep:!0,handler(e,n){n!==e&&e!=null&&this.$nextTick(()=>{this.options.validateAfterLoad===!0&&this.isNewModel!==!0?this.validate():this.clearValidationErrors()})}}},mounted(){this.$nextTick(()=>{this.model&&(this.options.validateAfterLoad===!0&&this.isNewModel!==!0?this.validate():this.clearValidationErrors())})},methods:{fieldVisible(e){return L(e.visible)?e.visible.call(this,this.model,e,this):q(e.visible)?!0:e.visible},onFieldValidated(e,n,o){this.errors=this.errors.filter(i=>i.field.fieldName!==o.schema.fieldName),!e&&n&&n.length>0&&x(n,i=>{this.errors.push({field:o.schema,error:i})});const r=this.errors.length===0;this.$emit("validated",r,this.errors,this)},onRefreshModel(){this.$emit("refreshModel")},onModelUpdated(e,n){this.$emit("modelUpdated",e,n)},validate(e=null){e===null&&(e=F(this.options,"validateAsync",!1)),this.clearValidationErrors();const n=[],o=[];x(this.$refs.children,i=>{L(i.validate)&&(n.push(i.$refs.child),o.push(i.$refs.child.validate(!0)))});const r=i=>{const a=[];x(i,(l,s)=>{Array.isArray(l)&&l.length>0&&x(l,c=>{a.push({field:n[s].schema,error:c})})}),this.errors=a;const d=a.length===0;return this.$emit("validated",d,a,this),e?a:d};return e?Promise.all(o).then(r):r(o)},clearValidationErrors(){this.errors.splice(0),x(this.$refs.children,e=>{e.clearValidationErrors()})}}},Rd={key:0,class:"vue-form-generator"},Pd={key:0};function Kd(e,n,o,r,i,a){const d=t.resolveComponent("form-group"),l=t.resolveComponent("KCollapse");return o.schema!=null?(t.openBlock(),t.createElementBlock("div",Rd,[o.schema.fields?(t.openBlock(),t.createBlock(t.resolveDynamicComponent(o.tag),{key:0},{default:t.withCtx(()=>[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(a.fields,s=>(t.openBlock(),t.createElementBlock(t.Fragment,{key:s.model},[a.fieldVisible(s)?(t.openBlock(),t.createBlock(d,{key:0,ref_for:!0,ref:"children",errors:i.errors,field:s,model:o.model,options:o.options,vfg:i.vfg,onModelUpdated:a.onModelUpdated,onRefreshModel:a.onRefreshModel,onValidated:a.onFieldValidated},null,8,["errors","field","model","options","vfg","onModelUpdated","onRefreshModel","onValidated"])):t.createCommentVNode("",!0)],64))),128))]),_:1})):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(a.groups,(s,c)=>(t.openBlock(),t.createElementBlock(t.Fragment,{key:`group-${c}`},[s.collapsible!==void 0&&s.collapsible!==!1?(t.openBlock(),t.createBlock(l,{key:0,class:"root-level-collapse","model-value":!1,title:s.collapsible.title},t.createSlots({default:t.withCtx(()=>{var m,u,g,S;return[(m=s.slots)!=null&&m.beforeContent?t.renderSlot(e.$slots,(u=s.slots)==null?void 0:u.beforeContent,{key:0}):t.createCommentVNode("",!0),s.fields.length===0&&((g=s.slots)!=null&&g.emptyState)?t.renderSlot(e.$slots,(S=s.slots)==null?void 0:S.emptyState,{key:1}):(t.openBlock(),t.createBlock(t.resolveDynamicComponent(o.tag),{key:2,class:t.normalizeClass(e.getFieldRowClasses(s))},{default:t.withCtx(()=>[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(s.fields,I=>(t.openBlock(),t.createElementBlock(t.Fragment,{key:I.model},[a.fieldVisible(I)?(t.openBlock(),t.createBlock(d,{key:0,ref_for:!0,ref:"children",errors:i.errors,field:I,model:o.model,options:o.options,vfg:i.vfg,onModelUpdated:a.onModelUpdated,onRefreshModel:a.onRefreshModel,onValidated:a.onFieldValidated},null,8,["errors","field","model","options","vfg","onModelUpdated","onRefreshModel","onValidated"])):t.createCommentVNode("",!0)],64))),128))]),_:2},1032,["class"])),s.collapsible!==!0&&s.collapsible.nestedCollapsible&&s.collapsible.nestedCollapsible.fields.length>0?(t.openBlock(),t.createBlock(l,{key:3,class:"nested-collapse","model-value":i.collapseStates[`group-${c}-nested`]??!0,"trigger-alignment":"leading","trigger-label":i.collapseStates[`group-${c}-nested`]??!0?s.collapsible.nestedCollapsible.triggerLabel.expand:s.collapsible.nestedCollapsible.triggerLabel.collapse,"onUpdate:modelValue":I=>i.collapseStates[`group-${c}-nested`]=I},{default:t.withCtx(()=>[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(o.tag),{class:t.normalizeClass(e.getFieldRowClasses(s))},{default:t.withCtx(()=>[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(s.collapsible.nestedCollapsible.fields,I=>(t.openBlock(),t.createElementBlock(t.Fragment,{key:I.model},[a.fieldVisible(I)?(t.openBlock(),t.createBlock(d,{key:0,ref_for:!0,ref:"children",errors:i.errors,field:I,model:o.model,options:o.options,vfg:i.vfg,onModelUpdated:a.onModelUpdated,onRefreshModel:a.onRefreshModel,onValidated:a.onFieldValidated},null,8,["errors","field","model","options","vfg","onModelUpdated","onRefreshModel","onValidated"])):t.createCommentVNode("",!0)],64))),128))]),_:2},1032,["class"]))]),_:2},1032,["model-value","trigger-label","onUpdate:modelValue"])):t.createCommentVNode("",!0)]}),_:2},[s.collapsible.description?{name:"visible-content",fn:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(s.collapsible.description),1)]),key:"0"}:void 0]),1032,["title"])):(t.openBlock(),t.createBlock(t.resolveDynamicComponent(o.tag),{key:1,class:t.normalizeClass(e.getFieldRowClasses(s))},{default:t.withCtx(()=>[s.legend?(t.openBlock(),t.createElementBlock("legend",Pd,t.toDisplayString(s.legend),1)):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(s.fields,m=>(t.openBlock(),t.createElementBlock(t.Fragment,{key:m.model},[a.fieldVisible(m)?(t.openBlock(),t.createBlock(d,{key:0,ref_for:!0,ref:"children",errors:i.errors,field:m,model:o.model,options:o.options,vfg:i.vfg,onModelUpdated:a.onModelUpdated,onRefreshModel:a.onRefreshModel,onValidated:a.onFieldValidated},null,8,["errors","field","model","options","vfg","onModelUpdated","onRefreshModel","onValidated"])):t.createCommentVNode("",!0)],64))),128))]),_:2},1032,["class"]))],64))),128))])):t.createCommentVNode("",!0)}const z=j(qd,[["render",Kd]]),vn=new Set(["config-client_id","config-client_secret","config-issuer"]),qn=new Set(["config-scopes_claim","config-scopes_required","config-audience_claim","config-audience_required","config-roles_claim","config-roles_required","config-groups_claim","config-groups_required","config-authenticated_groups_claim"]),xd={name:"OIDCForm",components:{VueFormGenerator:z},provide(){var e;return{[G]:(e=this.$slots)==null?void 0:e[pe]}},props:{formModel:{type:Object,required:!0},formSchema:{type:Object,required:!0},formOptions:{type:Object,default:()=>{}},onModelUpdated:{type:Function,required:!0},isEditing:{type:Boolean,required:!0}},data(){return{init:!1,authMethods:[],sessionManagement:!1,globalFields:null,commonFieldsSchema:null,authFieldsSchema:null,advancedFieldsSchema:{fields:[]},advancedFields:null,tabs:[{hash:"#common",title:"Common"},{hash:"#authorization",title:"Authorization"},{hash:"#advanced",title:"Advanced"}]}},computed:{displayForm(){return this.formModel.id&&this.isEditing||!this.isEditing}},watch:{formModel:{handler:function(){this.oidcSetup()}}},mounted(){this.oidcSetup()},methods:{oidcSetup(){var e;if(!this.init){this.init=!0,this.globalFields={fields:this.formSchema.fields.filter(o=>!o.model.startsWith("config")&&o.model!=="tags")};const n=this.formSchema.fields.reduce((o,r)=>(o[r.model]=r,o),{});this.commonFieldsSchema={fields:Array.from(vn).reduce((o,r)=>(n[r]&&o.push(n[r]),o),[])},this.authFieldsSchema={fields:Array.from(qn).reduce((o,r)=>(n[r]&&o.push(n[r]),o),[])},this.advancedFieldsSchema={fields:this.formSchema.fields.filter(o=>o.model.startsWith("config")&&o.model!=="config-auth_methods"&&!vn.has(o.model)&&!qn.has(o.model)||o.model==="tags").reduce((o,r)=>{var i,a,d,l;switch(r.model){case"config-client_jwk":{if(Array.isArray((a=(i=r.items)==null?void 0:i.schema)==null?void 0:a.fields))for(const s of r.items.schema.fields)s.label=s.model;o.push({...r,link:"https://docs.konghq.com/hub/kong-inc/openid-connect/#jwk-record",newElementButtonLabel:"+ Add Client JWK",...Array.isArray((l=(d=r.items)==null?void 0:d.schema)==null?void 0:l.fields)&&r.items.schema.fields.map(s=>({...s,label:s.model}))});break}case"config-session_redis_cluster_nodes":{o.push({...r,link:"https://docs.konghq.com/hub/kong-inc/openid-connect/#host-record",newElementButtonLabel:"+ Add Cluster Node"});break}default:o.push(r)}return o},[])},this.sessionManagement=this.isEditing?this.formModel["config-auth_methods"].includes("session"):!1,this.authMethods=[{label:"Authorization Code Flow",value:"authorization_code",hint:"authorization code flow",prop:this.isEditing?this.formModel["config-auth_methods"].includes("authorization_code"):!1},{label:"Bearer Access Token",value:"bearer",hint:"JWT access token verification",prop:this.isEditing?this.formModel["config-auth_methods"].includes("bearer"):!1},{label:"Client Credentials Grant",value:"client_credentials",hint:"OAuth client credentials grant",prop:this.isEditing?this.formModel["config-auth_methods"].includes("client_credentials"):!1},{label:"Passwords Grant",value:"password",hint:"OAuth legacy password grant",prop:this.isEditing?this.formModel["config-auth_methods"].includes("password"):!1},{label:"Introspection",value:"introspection",hint:"OAuth introspection",prop:this.isEditing?this.formModel["config-auth_methods"].includes("introspection"):!1},{label:"UserInfo",value:"userinfo",hint:"OpenID Connect user info endpoint authentication",prop:this.isEditing?this.formModel["config-auth_methods"].includes("userinfo"):!1},{label:"Kong OAuth",value:"kong_oauth2",hint:"Kong OAuth plugin issued tokens verification",prop:this.isEditing?this.formModel["config-auth_methods"].includes("kong_oauth2"):!1},{label:"Refresh Token",value:"refresh_token",hint:"OAuth refresh token grant",prop:this.isEditing?this.formModel["config-auth_methods"].includes("refresh_token"):!1}];for(const o of[this.commonFieldsSchema,this.authFieldsSchema,this.advancedFieldsSchema])for(const r of o.fields){const i=(e=n[r.model])==null?void 0:e.help;r.help===void 0&&typeof i=="string"&&(r.help=i)}}},getAuthMethodsValue(e,n){const o=[];for(let r=0;r<this.authMethods.length;r++)this.authMethods[r].prop&&this.authMethods[r].value!==e&&o.push(this.authMethods[r].value);return this.sessionManagement&&e&&o.push("session"),n&&(e?o.push(e):o.push("session")),o},handleUpdate(e,n){this.formModel["config-auth_methods"]=this.getAuthMethodsValue(n,e),this.onModelUpdated()}}},zd={class:"general-settings"},Yd={class:"link-wrapper"},Hd={class:"auth-method-container"},Gd={class:"general-settings"},Wd={class:"link-wrapper"},Zd={class:"general-settings"},Jd={class:"link-wrapper"};function Xd(e,n,o,r,i,a){const d=t.resolveComponent("VueFormGenerator"),l=t.resolveComponent("KExternalLink"),s=t.resolveComponent("KLabel"),c=t.resolveComponent("KCheckbox"),m=t.resolveComponent("KInputSwitch"),u=t.resolveComponent("KTabs");return t.openBlock(),t.createElementBlock("div",null,[o.formModel.id&&o.isEditing||!o.isEditing?(t.openBlock(),t.createBlock(d,{key:0,class:"global-fields",model:o.formModel,options:o.formOptions,schema:i.globalFields,onModelUpdated:o.onModelUpdated},null,8,["model","options","schema","onModelUpdated"])):t.createCommentVNode("",!0),t.createVNode(u,{tabs:i.tabs},{common:t.withCtx(()=>[t.createElementVNode("div",zd,[t.createElementVNode("div",Yd,[t.createVNode(l,{href:"https://docs.konghq.com/hub/kong-inc/openid-connect/#important-configuration-parameters"},{default:t.withCtx(()=>n[1]||(n[1]=[t.createElementVNode("span",{class:"section-header"},"Common Configuration Settings",-1)])),_:1})]),n[3]||(n[3]=t.createElementVNode("div",{class:"description"}," Parameters for enabling the OpenID Connect plugin. Set these parameters before adding authorization, authentication, or other advanced configuration details. ",-1)),a.displayForm?(t.openBlock(),t.createBlock(d,{key:0,model:o.formModel,options:o.formOptions,schema:i.commonFieldsSchema,onModelUpdated:o.onModelUpdated},null,8,["model","options","schema","onModelUpdated"])):t.createCommentVNode("",!0),t.createVNode(s,null,{default:t.withCtx(()=>n[2]||(n[2]=[t.createTextVNode("Auth Methods")])),_:1}),t.createElementVNode("div",Hd,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(i.authMethods,g=>(t.openBlock(),t.createElementBlock("div",{key:g.value,class:"auth-method"},[t.createVNode(c,{modelValue:g.prop,"onUpdate:modelValue":S=>g.prop=S,onChange:S=>a.handleUpdate(S,g.value)},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(g.label),1)]),_:2},1032,["modelValue","onUpdate:modelValue","onChange"])]))),128))]),t.createVNode(m,{modelValue:i.sessionManagement,"onUpdate:modelValue":n[0]||(n[0]=g=>i.sessionManagement=g),label:"Enable Session Management",onChange:a.handleUpdate},null,8,["modelValue","onChange"])])]),authorization:t.withCtx(()=>[t.createElementVNode("div",Gd,[t.createElementVNode("div",Wd,[t.createVNode(l,{href:"https://docs.konghq.com/hub/kong-inc/openid-connect/#authorization"},{default:t.withCtx(()=>n[4]||(n[4]=[t.createElementVNode("span",{class:"section-header"},"Authorization Configuration Settings",-1)])),_:1})]),n[5]||(n[5]=t.createElementVNode("div",{class:"description"}," Parameters for setting up claims-based authorization. ",-1)),a.displayForm?(t.openBlock(),t.createBlock(d,{key:0,model:o.formModel,options:o.formOptions,schema:i.authFieldsSchema,onModelUpdated:o.onModelUpdated},{"autofill-provider":t.withCtx(g=>[t.renderSlot(e.$slots,"autofill-provider",t.normalizeProps(t.guardReactiveProps(g)),void 0,!0)]),_:3},8,["model","options","schema","onModelUpdated"])):t.createCommentVNode("",!0)])]),advanced:t.withCtx(()=>[t.createElementVNode("div",Zd,[t.createElementVNode("div",Jd,[t.createVNode(l,{href:"https://docs.konghq.com/hub/kong-inc/openid-connect/"},{default:t.withCtx(()=>n[6]||(n[6]=[t.createElementVNode("span",{class:"section-header"},"Advanced Configuration Settings",-1)])),_:1})]),n[7]||(n[7]=t.createElementVNode("div",{class:"description"}," Advanced parameters for manually configuring the OpenID Connect plugin. ",-1)),a.displayForm?(t.openBlock(),t.createBlock(d,{key:0,model:o.formModel,options:o.formOptions,schema:i.advancedFieldsSchema,onModelUpdated:o.onModelUpdated},null,8,["model","options","schema","onModelUpdated"])):t.createCommentVNode("",!0)])]),_:3},8,["tabs"])])}const Qd=j(xd,[["render",Xd],["__scopeId","data-v-bb72c68e"]]),ec=j(t.defineComponent({__name:"PostFunction",props:{formModel:{type:Object,required:!0},formSchema:{type:Object,required:!0},formOptions:{type:Object,default:()=>{}},onModelUpdated:{type:Function,required:!0},isEditing:{type:Boolean,required:!0}},setup(e){var d;t.provide(G,(d=t.useSlots())==null?void 0:d[pe]);const{t:n,te:o}=Fe.createI18n("en-us",Ye),r=e,i=t.computed(()=>r.formModel.id&&r.isEditing||!r.isEditing),a=t.computed(()=>{const l=r.formSchema;return l.fields.map(s=>{const c=`post-function.${s.model}`;return s.hint=o(`${c}.hint`)&&n(`${c}.hint`)||s.hint,s.help=o(`${c}.help`)&&n(`${c}.help`)||s.help,s.newElementButtonLabel=o(`${c}.newElementButtonLabel`)&&n(`${c}.newElementButtonLabel`)||s.newElementButtonLabel,s.model!=="tags"&&(s.valueType==="array"||s.type==="array")&&(s.type="array",s.valueArrayType="array",s.itemContainerComponent="FieldArrayItem",s.fieldClasses="post-function-array-item-container",s.fieldItemsClasses="post-function-array-item",s.inputAttributes={...s.inputAttributes,type:"textarea"}),s}),l});return(l,s)=>i.value?(t.openBlock(),t.createBlock(z,{key:0,model:e.formModel,options:e.formOptions,schema:a.value,onModelUpdated:e.onModelUpdated},null,8,["model","options","schema","onModelUpdated"])):t.createCommentVNode("",!0)}}),[["__scopeId","data-v-f54f37ae"]]),tc=j(t.defineComponent({__name:"ExitTransformer",props:{formModel:{type:Object,required:!0},formSchema:{type:Object,required:!0},formOptions:{type:Object,default:()=>{}},onModelUpdated:{type:Function,required:!0},isEditing:{type:Boolean,required:!0}},setup(e){var d;t.provide(G,(d=t.useSlots())==null?void 0:d[pe]);const{t:n,te:o}=Fe.createI18n("en-us",Ye),r=e,i=t.computed(()=>r.formModel.id&&r.isEditing||!r.isEditing),a=t.computed(()=>{const l=r.formSchema;return l.fields.map(s=>{const c=`exit-transformer.${s.model}`;return s.hint=o(`${c}.hint`)&&n(`${c}.hint`)||s.hint,s.help=o(`${c}.help`)&&n(`${c}.help`)||s.help,s.newElementButtonLabel=o(`${c}.newElementButtonLabel`)&&n(`${c}.newElementButtonLabel`)||s.newElementButtonLabel,s.model!=="tags"&&(s.valueType==="array"||s.type==="array")&&(s.type="array",s.valueArrayType="array",s.itemContainerComponent="FieldArrayItem",s.fieldClasses="exit-transformer-array-item-container",s.fieldItemsClasses="exit-transformer-array-item",s.inputAttributes={...s.inputAttributes,type:"textarea"}),s}),l});return(l,s)=>i.value?(t.openBlock(),t.createBlock(z,{key:0,model:e.formModel,options:e.formOptions,schema:a.value,onModelUpdated:e.onModelUpdated},null,8,["model","options","schema","onModelUpdated"])):t.createCommentVNode("",!0)}}),[["__scopeId","data-v-0d5c541f"]]),nc={fields:[{inputType:"text",label:"Config.Account Email",model:"config-account_email",required:!0,type:"input"},{inputType:"text",label:"Config.Account Key.Key Id",model:"config-account_key-key_id",required:!0,type:"input"},{type:"input",inputType:"text",valueType:"string",label:"Config.Account Key.Key Set",model:"config-account_key-key_set",order:0,disabled:!1},{type:"checkbox",default:!1,valueType:"boolean",label:"Config.Allow Any Domain",model:"config-allow_any_domain",order:0,disabled:!1}]},oc={fields:[{type:"input",default:"",inputType:"text",valueType:"string",model:"config-api_uri",label:"Config.Api Uri",order:0,disabled:!1},{type:"checkbox",default:!1,valueType:"boolean",model:"config-tos_accepted",label:"Config.Tos Accepted",order:0,disabled:!1}]},rc={fields:[{type:"input",default:"",inputType:"text",valueType:"string",model:"config-api_uri",label:"Config.Api Uri",order:0,disabled:!1},{type:"input",inputType:"text",valueType:"string",model:"config-eab_hmac_key",label:"Config.Eab Hmac Key",order:0,disabled:!1},{type:"input",inputType:"text",valueType:"string",model:"config-eab_kid",label:"Config.Eab Kid",order:0,disabled:!1}]},ac={class:"general-settings"},ic={class:"sub-form"},lc={class:"general-settings"},sc={class:"sub-form"},dc={class:"general-settings"},cc=j(t.defineComponent({__name:"ACMEForm",props:{formModel:{type:Object,required:!0},formSchema:{type:Object,required:!0},formOptions:{type:Object,default:()=>{}},onModelUpdated:{type:Function,required:!0},isEditing:{type:Boolean,required:!0}},setup(e){var A;t.provide(G,(A=t.useSlots())==null?void 0:A[pe]);const n=e,o=t.ref("zeroSsl"),r=t.ref("shm"),i=t.computed(()=>{var p;const h={};if((p=n.formSchema)!=null&&p.fields)for(const M of n.formSchema.fields)h[M.model]=M;return h}),a=t.computed(()=>{var p;const h=ne(nc);for(const M of h.fields){const T=(p=i.value[M.model])==null?void 0:p.help;M.help===void 0&&typeof T=="string"&&(M.help=T)}return h}),d=t.computed(()=>{var p;const h=ne(oc);for(const M of h.fields){const T=(p=i.value[M.model])==null?void 0:p.help;M.help===void 0&&typeof T=="string"&&(M.help=T)}return h}),l=t.computed(()=>{var p;const h=ne(rc);for(const M of h.fields){const T=(p=i.value[M.model])==null?void 0:p.help;M.help===void 0&&typeof T=="string"&&(M.help=T)}return h}),s=t.computed(()=>({fields:n.formSchema.fields.filter(h=>!h.model.startsWith("config")&&h.model!=="tags")})),c=t.computed(()=>({fields:a.value.fields.filter(p=>!d.value.fields.some(M=>M.model===p.model)&&!l.value.fields.some(M=>M.model===p.model))})),m=t.computed(()=>({fields:n.formSchema.fields.filter(p=>p.model.startsWith("config-storage")&&!p.model.startsWith("config-storage_config-consul")&&!p.model.startsWith("config-storage_config-redis")&&!p.model.startsWith("config-storage_config-shm")&&!p.model.startsWith("config-storage_config-vault"))})),u=t.computed(()=>({fields:n.formSchema.fields.filter(p=>p.model.startsWith("config-storage_config-consul"))})),g=t.computed(()=>({fields:n.formSchema.fields.filter(p=>p.model.startsWith("config-storage_config-redis"))})),S=t.computed(()=>({fields:n.formSchema.fields.filter(p=>p.model.startsWith("config-storage_config-shm"))})),I=t.computed(()=>({fields:n.formSchema.fields.filter(p=>p.model.startsWith("config-storage_config-vault"))})),f=t.computed(()=>({fields:n.formSchema.fields.filter(h=>h.model.startsWith("config")&&!c.value.fields.filter(p=>p.model===h.model).length&&!m.value.fields.filter(p=>p.model===h.model).length||h.model==="tags")})),C=t.computed(()=>n.formModel.id&&n.isEditing||!n.isEditing),k=[{hash:"#general",title:"General"},{hash:"#storage",title:"Storage"},{hash:"#advanced",title:"Advanced"}],B=[{label:"Lets Encrypt",value:"letsEncrypt"},{label:"Zero SSL",value:"zeroSsl",selected:!0},{label:"Other",value:"other"}];t.onMounted(()=>{o.value==="zeroSsl"&&(n.formModel["config-api_uri"]="https://acme.zerossl.com/v2/DV90")});const w=h=>{o.value=h.value,(h.value==="zeroSsl"||h.value==="other")&&(h.value==="zeroSsl"?n.formModel["config-api_uri"]="https://acme.zerossl.com/v2/DV90":n.formModel["config-api_uri"]="https://acme.example.com/",n.formModel["config-tos_accepted"]=!1),h.value==="letsEncrypt"&&(n.formModel["config-api_uri"]="https://acme-v02.api.letsencrypt.org/directory",n.formModel["config-eab_hmac_key"]="",n.formModel["config-eab_kid"]=""),n.onModelUpdated()},V=(h,p)=>{p==="config-storage"&&(r.value=h),n.onModelUpdated()};return(h,p)=>{const M=t.resolveComponent("KSelect"),T=t.resolveComponent("KTabs");return t.openBlock(),t.createElementBlock("div",null,[e.formModel.id&&e.isEditing||!e.isEditing?(t.openBlock(),t.createBlock(z,{key:0,class:"global-fields",model:e.formModel,options:e.formOptions,schema:s.value,onModelUpdated:e.onModelUpdated},null,8,["model","options","schema","onModelUpdated"])):t.createCommentVNode("",!0),t.createVNode(T,{tabs:k},{general:t.withCtx(()=>[t.createElementVNode("div",ac,[p[0]||(p[0]=t.createElementVNode("div",{class:"header-wrapper"},[t.createElementVNode("span",{class:"section-header"},"General Configuration Settings")],-1)),p[1]||(p[1]=t.createElementVNode("div",{class:"description"}," Parameters for enabling the ACME plugin. ",-1)),C.value?(t.openBlock(),t.createBlock(z,{key:0,model:e.formModel,options:e.formOptions,schema:c.value,onModelUpdated:e.onModelUpdated},null,8,["model","options","schema","onModelUpdated"])):t.createCommentVNode("",!0),p[2]||(p[2]=t.createElementVNode("hr",null,null,-1)),t.createVNode(M,{class:"issuer-select",items:B,label:"Issuer",onChange:w}),t.createElementVNode("div",ic,[o.value==="letsEncrypt"?(t.openBlock(),t.createBlock(z,{key:0,model:e.formModel,options:e.formOptions,schema:d.value,onModelUpdated:e.onModelUpdated},null,8,["model","options","schema","onModelUpdated"])):t.createCommentVNode("",!0),o.value==="zeroSsl"||o.value==="other"?(t.openBlock(),t.createBlock(z,{key:1,model:e.formModel,options:e.formOptions,schema:l.value,onModelUpdated:e.onModelUpdated},null,8,["model","options","schema","onModelUpdated"])):t.createCommentVNode("",!0)])])]),storage:t.withCtx(()=>[t.createElementVNode("div",lc,[p[3]||(p[3]=t.createElementVNode("div",{class:"header-wrapper"},[t.createElementVNode("span",{class:"section-header"},"Storage Configuration Settings")],-1)),p[4]||(p[4]=t.createElementVNode("div",{class:"description"}," Parameters for setting up storage. ",-1)),C.value?(t.openBlock(),t.createBlock(z,{key:0,model:e.formModel,options:e.formOptions,schema:m.value,onModelUpdated:V},null,8,["model","options","schema"])):t.createCommentVNode("",!0),t.createElementVNode("div",sc,[r.value==="consul"?(t.openBlock(),t.createBlock(z,{key:0,model:e.formModel,options:e.formOptions,schema:u.value,onModelUpdated:e.onModelUpdated},null,8,["model","options","schema","onModelUpdated"])):t.createCommentVNode("",!0),r.value==="redis"?(t.openBlock(),t.createBlock(z,{key:1,model:e.formModel,options:e.formOptions,schema:g.value,onModelUpdated:e.onModelUpdated},null,8,["model","options","schema","onModelUpdated"])):t.createCommentVNode("",!0),r.value==="shm"?(t.openBlock(),t.createBlock(z,{key:2,model:e.formModel,options:e.formOptions,schema:S.value,onModelUpdated:e.onModelUpdated},null,8,["model","options","schema","onModelUpdated"])):t.createCommentVNode("",!0),r.value==="vault"?(t.openBlock(),t.createBlock(z,{key:3,model:e.formModel,options:e.formOptions,schema:I.value,onModelUpdated:e.onModelUpdated},null,8,["model","options","schema","onModelUpdated"])):t.createCommentVNode("",!0)])])]),advanced:t.withCtx(()=>[t.createElementVNode("div",dc,[p[5]||(p[5]=t.createElementVNode("div",{class:"header-wrapper"},[t.createElementVNode("span",{class:"section-header"},"Advanced Configuration Settings")],-1)),p[6]||(p[6]=t.createElementVNode("div",{class:"description"}," Advanced parameters for manually configuring the ACME plugin. ",-1)),C.value?(t.openBlock(),t.createBlock(z,{key:0,model:e.formModel,options:e.formOptions,schema:f.value,onModelUpdated:e.onModelUpdated},null,8,["model","options","schema","onModelUpdated"])):t.createCommentVNode("",!0)])]),_:1})])}}}),[["__scopeId","data-v-bb5a3a33"]]),mc={class:"rla-form-basic-fields"},uc={class:"rla-form-request-limits-subtitle"},fc={class:"rla-form-request-limits-content"},hc={class:"rla-form-window-type"},pc=["innerHTML"],gc={class:"rla-form-window-type-radios"},yc={class:"rla-form-request-limits-items"},bc={class:"rla-form-request-limits-row"},kc=["id"],wc={class:"rla-form-request-limits-actions"},Cc={key:0,class:"rla-form-request-limits-examples"},_c={class:"rla-form-request-limits-examples-badges"},Ec=["innerHTML"],Mc={id:"rla-form-error-legend",class:"rla-form-error-inputs"},Sc=Object.freeze(Object.defineProperty({__proto__:null,ACMEForm:cc,ExitTransformer:tc,OIDCForm:Qd,PostFunction:ec,RLAForm:j(t.defineComponent({__name:"RLAForm",props:{formSchema:{},formModel:{},formOptions:{},onModelUpdated:{type:Function},isEditing:{type:Boolean}},setup(e){var T;t.provide(G,(T=t.useSlots())==null?void 0:T[pe]);const n={fixed:[{label:"500 requests every hour",description:"A fixed limit of 500 requests per hour resetting sharply on the hour, ensuring no user can exceed this limit.",config:{limit:500,window_size:3600}},{label:"200 requests every 30 minutes",description:"Users are allowed 200 requests per 30 minutes, resetting exactly on the 30 minute mark with no carryover of unused limits.",config:{limit:200,window_size:1800}},{label:"500 requests every day",description:"A strict limit of 5000 requests per day resetting promptly at midnight, preventing any burst traffic or inconsistent user experiences.",config:{limit:500,window_size:86400}}],sliding:[{label:"100 requests every hour",description:"Maximum of 100 requests every rolling hour, continuously adjusting the count over the course of the hour. No hard limit or known reset.",config:{limit:100,window_size:3600}},{label:"300 requests every 30 minutes",description:"Each user can make up to 300 requests in any rolling 30 minute period, with older requests dropping off as new requests are made.",config:{limit:300,window_size:1800}},{label:"500 requests every hour",description:`Each user is allowed 500 requests per hour.
2
2
  If the limit is exceeded and the user receives a 429 error, each additional request within the sliding window (hour)
3
3
  will extend the wait time by about 12 minutes, continuously adjusting as new requests are made.`,config:{limit:500,window_size:3600}}]},o=new Set(["selectionGroup",...["identifier","limit","window_size","error_code","error_message"].map(y=>`config-${y}`)]),r=y=>y===void 0?!1:o.has(y),{t:i}=Fe.createI18n("en-us",Ye),a=e,d=t.computed(()=>{var b,_;const y=(_=(b=a.formSchema)==null?void 0:b.fields)==null?void 0:_.find(E=>E.type==="selectionGroup"&&E.model==="selectionGroup");if(y)return{fields:[y]}}),l=t.computed(()=>{var W,me;const y=((me=(W=a.formSchema)==null?void 0:W.fields)==null?void 0:me.filter(P=>!r(P.model)))??[],b=[],_=[],E=[];let D=!1;for(const P of y){const Se=P.model;if(Se!==void 0){if(Se.startsWith("config-redis-")){(P.model==="config-redis-cluster_addresses"||P.model==="config-redis-sentinel_addresses")&&(P.inputAttributes.help=i("rla.redis.address_example")),_.push(P);continue}D?E.push(P):b.push(P),P.model==="config-strategy"&&(D=!0)}}return{endsWithStrategy:{fields:b},redis:{fields:_},afterStrategy:{fields:E}}}),s=t.computed(()=>{const y=a.formModel["config-window_type"];return Object.prototype.hasOwnProperty.call(n,y)?n[y]:[]}),c=t.computed(()=>{var y,b;return(b=(y=a.formSchema)==null?void 0:y.fields)==null?void 0:b.find(_=>_.model==="config-identifier")}),m=t.computed(()=>{var y,b,_;return(((_=(b=(y=a.formSchema)==null?void 0:y.fields)==null?void 0:b.find(E=>E.model==="config-identifier"))==null?void 0:_.values)??[]).map(E=>({label:i(`rla.identifiers.options.${E}`),value:E}))}),u=t.ref(),g=t.ref(!0),S=t.computed(()=>{var y,b,_;return a.formModel["config-window_type"]??((_=(b=(y=a.formSchema)==null?void 0:y.fields)==null?void 0:b.find(E=>E.model==="config-window_type"))==null?void 0:_.default)}),I=t.computed(()=>{var b,_,E,D,W,me;const y=(E=(_=(b=a.formSchema)==null?void 0:b.fields)==null?void 0:_.find(P=>P.model==="config-window_type"))==null?void 0:E.default;return(((me=(W=(D=a.formSchema)==null?void 0:D.fields)==null?void 0:W.find(P=>P.model==="config-window_type"))==null?void 0:me.values)??[]).sort((P,Se)=>P===y?-1:Se===y?1:0)}),f=t.computed(()=>{var b;const y=(b=a.formModel["config-limit"])==null?void 0:b.map((_,E)=>{var D,W;return{limit:_,windowSize:(W=(D=a.formModel)==null?void 0:D["config-window_size"])==null?void 0:W[E]}});return!Array.isArray(y)||y.length===0?[{limit:void 0,windowSize:void 0}]:y}),C=t.computed(()=>{var y,b,_,E;return((y=a.formModel)==null?void 0:y["config-identifier"])??((E=(_=(b=a.formSchema)==null?void 0:b.fields)==null?void 0:_.find(D=>D.model==="config-identifier"))==null?void 0:E.default)}),k=t.computed(()=>{var y,b,_,E;return((y=a.formModel)==null?void 0:y["config-error_code"])??((E=(_=(b=a.formSchema)==null?void 0:b.fields)==null?void 0:_.find(D=>D.model==="config-error_code"))==null?void 0:E.default)}),B=t.computed(()=>{var y,b,_,E;return((y=a.formModel)==null?void 0:y["config-error_message"])??((E=(_=(b=a.formSchema)==null?void 0:b.fields)==null?void 0:_.find(D=>D.model==="config-error_message"))==null?void 0:E.default)}),w=(y,b)=>{if(b===u.value){a.onModelUpdated([],"config-limit"),a.onModelUpdated([],"config-window_size"),t.nextTick(()=>{u.value=void 0});return}a.onModelUpdated([y.config.limit],"config-limit"),a.onModelUpdated([y.config.window_size],"config-window_size"),t.nextTick(()=>{u.value=b})},V=y=>{u.value!==void 0&&(u.value=void 0),y!==null&&a.onModelUpdated(y.toString(),"config-window_type")},A=(y,b)=>{var E;u.value!==void 0&&(u.value=void 0);const _=ne(((E=a.formModel)==null?void 0:E["config-limit"])??[]);_[y]=b,a.onModelUpdated(_,"config-limit")},h=(y,b)=>{var E;u.value!==void 0&&(u.value=void 0);const _=ne(((E=a.formModel)==null?void 0:E["config-window_size"])??[]);_[y]=b,a.onModelUpdated(_,"config-window_size")},p=y=>{var E,D;u.value!==void 0&&(u.value=void 0);const b=ne(((E=a.formModel)==null?void 0:E["config-limit"])??[]),_=ne(((D=a.formModel)==null?void 0:D["config-window_size"])??[]);b.length===0&&b.push(void 0),_.length===0&&_.push(void 0),b.splice(y+1,0,void 0),_.splice(y+1,0,void 0),a.onModelUpdated(b,"config-limit"),a.onModelUpdated(_,"config-window_size")},M=y=>{var b,_;if(f.value.length>1){u.value!==void 0&&(u.value=void 0);const E=ne(((b=a.formModel)==null?void 0:b["config-limit"])??[]),D=ne(((_=a.formModel)==null?void 0:_["config-window_size"])??[]);E.length===0&&E.push(void 0),D.length===0&&D.push(void 0),E.splice(y,1),D.splice(y,1),a.onModelUpdated(E,"config-limit"),a.onModelUpdated(D,"config-window_size")}};return(y,b)=>{const _=t.resolveComponent("VueFormGenerator"),E=t.resolveComponent("KLabel"),D=t.resolveComponent("KRadio"),W=t.resolveComponent("KInput"),me=t.resolveComponent("KButton"),P=t.resolveComponent("KBadge"),Se=t.resolveComponent("KTooltip"),Rn=t.resolveComponent("KCard"),Bc=t.resolveComponent("KSelect"),Ic=t.resolveComponent("KCollapse");return t.openBlock(),t.createElementBlock(t.Fragment,null,[t.createElementVNode("div",mc,[t.createVNode(_,{model:y.formModel,options:y.formOptions,schema:d.value,onModelUpdated:b[0]||(b[0]=(N,R)=>y.onModelUpdated(N,R))},null,8,["model","options","schema"]),t.createVNode(Rn,{class:"rla-form-request-limits"},{title:t.withCtx(()=>[t.createVNode(E,{class:"rla-form-request-limits-title",for:"rla-form-request-limits-legend",required:""},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(t.unref(i)("rla.request_limits.title")),1)]),_:1}),t.createElementVNode("div",uc,t.toDisplayString(t.unref(i)("rla.request_limits.subtitle")),1)]),default:t.withCtx(()=>[t.createElementVNode("div",fc,[t.createElementVNode("div",hc,[t.createVNode(E,{class:"rla-form-window-type-label","tooltip-attributes":{maxWidth:"300",placement:"top"}},{tooltip:t.withCtx(()=>[t.createElementVNode("div",{innerHTML:t.unref(i)("rla.window_type.help")},null,8,pc)]),default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(t.unref(i)("rla.window_type.label"))+" ",1)]),_:1}),t.createElementVNode("div",gc,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(I.value,N=>(t.openBlock(),t.createBlock(D,{key:`window-type-${N}`,"model-value":S.value,name:N,"selected-value":N,"onUpdate:modelValue":V},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(t.unref(i)(`rla.window_type.options.${N}`)),1)]),_:2},1032,["model-value","name","selected-value"]))),128))])]),t.createElementVNode("div",yc,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(f.value,(N,R)=>(t.openBlock(),t.createElementBlock("div",{key:R.toString()},[t.createVNode(E,{for:`rla-form-request-limits-item-${R}-legend`},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(t.unref(i)("rla.request_limits.label_index",{index:R+1})),1)]),_:2},1032,["for"]),t.createElementVNode("div",bc,[t.createElementVNode("legend",{id:`rla-form-request-limits-item-${R}-legend`,class:"rla-form-request-limits-inputs"},[t.createVNode(W,{"model-value":N.limit&&N.limit.toString(),placeholder:t.unref(i)("rla.request_limits.request_number"),type:"number","onUpdate:modelValue":ct=>A(R,Number.parseInt(ct))},null,8,["model-value","placeholder","onUpdate:modelValue"]),t.createElementVNode("div",null,t.toDisplayString(t.unref(i)("rla.request_limits.interval_determiner")),1),t.createVNode(W,{"model-value":N.windowSize&&N.windowSize.toString(),placeholder:t.unref(i)("rla.request_limits.time_interval"),type:"number","onUpdate:modelValue":ct=>h(R,Number.parseInt(ct))},null,8,["model-value","placeholder","onUpdate:modelValue"]),t.createElementVNode("div",null,t.toDisplayString(t.unref(i)("rla.request_limits.seconds")),1)],8,kc),t.createElementVNode("div",wc,[t.createVNode(me,{appearance:"tertiary",disabled:f.value.length<=1,onClick:()=>M(R)},{default:t.withCtx(()=>[t.createVNode(t.unref(oe.RemoveIcon))]),_:2},1032,["disabled","onClick"]),t.createVNode(me,{appearance:"tertiary",onClick:()=>p(R)},{default:t.withCtx(()=>[t.createVNode(t.unref(oe.AddIcon))]),_:2},1032,["onClick"])])])]))),128))]),s.value.length>0?(t.openBlock(),t.createElementBlock("div",Cc,[t.createElementVNode("div",null,t.toDisplayString(t.unref(i)("rla.start_with_a_use_case")),1),t.createElementVNode("div",_c,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(s.value,(N,R)=>(t.openBlock(),t.createBlock(Se,{key:`use-case-${R}`,"max-width":"300"},{content:t.withCtx(()=>[t.createElementVNode("div",null,t.toDisplayString(N.description),1),b[9]||(b[9]=t.createElementVNode("br",null,null,-1)),t.createElementVNode("div",null,t.toDisplayString(t.unref(i)("rla.request_limits.label"))+": "+t.toDisplayString(N.config.limit),1),t.createElementVNode("div",null,t.toDisplayString(t.unref(i)("rla.request_limits.time_interval"))+": "+t.toDisplayString(N.config.window_size),1)]),default:t.withCtx(()=>[t.createVNode(P,{appearance:u.value===`${S.value}-${R}`?"info":"decorative",class:"rla-form-request-limits-examples-badge",onClick:()=>w(N,`${S.value}-${R}`)},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(N.label),1)]),_:2},1032,["appearance","onClick"])]),_:2},1024))),128))])])):t.createCommentVNode("",!0)])]),_:1}),t.createVNode(Bc,{modelValue:C.value,"onUpdate:modelValue":b[1]||(b[1]=N=>C.value=N),class:"rla-form-identifiers",items:m.value,label:t.unref(i)("rla.identifiers.label"),"label-attributes":{tooltipAttributes:{maxWidth:"300",placement:"top"}},required:"",onSelected:b[2]||(b[2]=N=>a.onModelUpdated(N.value,"config-identifier"))},{"label-tooltip":t.withCtx(()=>[t.createElementVNode("div",{innerHTML:c.value&&c.value.help},null,8,Ec)]),_:1},8,["modelValue","items","label"]),t.createElementVNode("div",null,[t.createVNode(E,{for:"rla-form-error-legend",info:t.unref(i)("rla.error_message.help"),required:"","tooltip-attributes":{maxWidth:"300",placement:"top"}},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(t.unref(i)("rla.error_message.label")),1)]),_:1},8,["info"]),t.createElementVNode("legend",Mc,[t.createVNode(W,{class:"input-error-code","model-value":k.value&&k.value.toString(),placeholder:t.unref(i)("rla.error_message.code_placeholder"),type:"number","onUpdate:modelValue":b[3]||(b[3]=N=>y.onModelUpdated(Number.parseInt(N),"config-error_code"))},null,8,["model-value","placeholder"]),b[10]||(b[10]=t.createElementVNode("div",null,":",-1)),t.createVNode(W,{"model-value":B.value,placeholder:t.unref(i)("rla.error_message.message_placeholder"),"onUpdate:modelValue":b[4]||(b[4]=N=>y.onModelUpdated(N,"config-error_message"))},null,8,["model-value","placeholder"])])])]),t.createVNode(Ic,{modelValue:g.value,"onUpdate:modelValue":b[8]||(b[8]=N=>g.value=N),"trigger-label":t.unref(i)("rla.view_advanced_fields")},{default:t.withCtx(()=>[t.createVNode(_,{model:y.formModel,options:y.formOptions,schema:l.value.endsWithStrategy,onModelUpdated:b[5]||(b[5]=(N,R)=>y.onModelUpdated(N,R))},null,8,["model","options","schema"]),y.formModel["config-strategy"]==="redis"?(t.openBlock(),t.createBlock(Rn,{key:0,class:"rla-form-redis-card",title:t.unref(i)("rla.redis.title")},{default:t.withCtx(()=>[t.createVNode(_,{model:y.formModel,options:y.formOptions,schema:l.value.redis,onModelUpdated:b[6]||(b[6]=(N,R)=>y.onModelUpdated(N,R))},null,8,["model","options","schema"])]),_:1},8,["title"])):t.createCommentVNode("",!0),t.createVNode(_,{class:t.normalizeClass({"rla-last-vfg":y.formModel["config-strategy"]!=="redis"}),model:y.formModel,options:y.formOptions,schema:l.value.afterStrategy,onModelUpdated:b[7]||(b[7]=(N,R)=>y.onModelUpdated(N,R))},null,8,["class","model","options","schema"])]),_:1},8,["modelValue","trigger-label"])],64)}}}),[["__scopeId","data-v-7089d0ea"]])},Symbol.toStringTag,{value:"Module"})),Vc=["array","metric","advanced","selectionGroup","object-advanced"],Tc={install:e=>{e.component("VueFormGenerator",z)}},Nc=e=>({"openid-connect":"OIDCForm","post-function":"PostFunction","pre-function":"PostFunction","exit-transformer":"ExitTransformer","rate-limiting-advanced":"RLAForm"})[e];O.AUTOFILL_SLOT=G,O.AUTOFILL_SLOT_NAME=pe,O.FORMS_API_KEY=se,O.VueFormGenerator=z,O.abstractField=Rl,O.customFields=Vc,O.default=Tc,O.getSharedFormName=Nc,O.sharedForms=Sc,Object.defineProperties(O,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
@@ -1,4 +1,6 @@
1
- declare const _default: import("vue").DefineComponent<{}, {}, {}, {}, {
1
+ declare const _default: import("vue").DefineComponent<{}, {}, {}, {
2
+ items(): any;
3
+ }, {
2
4
  onUpdate(value: any): void;
3
5
  }, {
4
6
  name: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kong-ui-public/forms",
3
- "version": "4.7.36",
3
+ "version": "4.8.0",
4
4
  "type": "module",
5
5
  "main": "./dist/forms.umd.js",
6
6
  "module": "./dist/forms.es.js",