@ukhomeoffice/cop-react-form-renderer 8.0.0-alpha.5 → 8.0.0-alpha.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});require('./index.css');const d=require("react/jsx-runtime"),T=require("@ukhomeoffice/cop-react-components"),O=require("react"),mt=require("uuid"),q=require("dayjs"),Re=require("dayjs/plugin/customParseFormat"),tn=require("dayjs/plugin/isToday"),Wr=require("dayjs/plugin/isLeapYear"),ve={add:"Add another",remove:"Remove",change:"Change",item:"Item ${index}"},zr="alert",Jr="autocomplete",Xr="calculation",Qr="checkboxes",Zr="collection",eo="collection-summary",to="container",no="date",so="details",ro="email",oo="file",io="heading",lo="html",ao="inset-text",co="list",uo="multifile",fo="paragraph",ho="phone-number",mo="radios",po="select",Eo="text",Ao="textarea",yo="time",To="warning",b={ALERT:zr,AUTOCOMPLETE:Jr,CALCULATION:Xr,CHECKBOXES:Qr,COLLECTION:Zr,COLLECTION_SUMMARY:eo,CONTAINER:to,DATE:no,DETAILS:so,EMAIL:ro,FILE:oo,HEADING:io,HTML:lo,INSET_TEXT:ao,LIST:co,MULTI_FILE:uo,PARAGRAPH:fo,PHONE_NUMBER:ho,RADIOS:mo,SELECT:po,TEXT:Eo,TEXT_AREA:Ao,TIME:yo,WARNING:To},So="blur",Co="submit",go="cancel",Te={BLUR:So,SUBMIT:Co,CANCEL:go},bo="cya",wo="hub",Io="partial-cya",te={CYA:bo,HUB:wo,PARTIAL_CYA:Io},_o="cya",Po="form",xo="form-with-task-list",No="hub-and-spoke",Oo="task-list",Ro="task-list-cya",vo="wizard",Z={CYA:_o,FORM:Po,FORM_WITH_TASK:xo,HUB:No,TASK:Oo,TASK_CYA:Ro,WIZARD:vo},Lo="CYA",Do="TASK",he={CYA:Lo,TASK:Do},Ut="cancel",cs="collectionAdd",us="collectionDuplicate",ds="collectionRemove",fs="navigate",Mt="saveAndContinue",kt="saveAndNavigate",$t="saveAndReturn",Bt="submit",st={CANCEL:Ut,COLLECTION_ADD:cs,COLLECTION_DUPLICATE:us,COLLECTION_REMOVE:ds,NAVIGATE:fs,SAVE_AND_CONTINUE:Mt,SAVE_AND_NAVIGATE:kt,SAVE_AND_RETURN:$t,SUBMIT:Bt},Fo={[Ut]:{type:Ut,validate:!1,label:"Cancel",classModifiers:"secondary"},[cs]:void 0,[us]:void 0,[ds]:void 0,[fs]:void 0,[Mt]:{type:Mt,validate:!0,label:"Save and continue"},[kt]:{type:kt,validate:!0,label:"Save and continue"},[$t]:{type:$t,validate:!1,label:"Save and return later",classModifiers:"secondary"},[Bt]:{type:Bt,validate:!0}},G={TYPES:st,DEFAULTS:Fo},hs="complete",ms="inProgress",ps="notStarted",Es="cannotStartYet",As="skipped",jo={COMPLETE:hs,IN_PROGRESS:ms,NOT_STARTED:ps,CANNOT_START_YET:Es,SKIPPED:As},Uo={[hs]:{label:"Completed",colour:"dark-blue"},[ms]:{label:"In Progress",colour:"white"},[ps]:{label:"Not Started",colour:"dark-grey"},[Es]:{label:"Cannot Start Yet",colour:"dark-grey"},[As]:{label:"Skipped",colour:"dark-grey"}},B={TYPES:jo,DETAILS:Uo},Mo={CollectionLabels:ve,ComponentTypes:b,EventTypes:Te,FormPages:te,FormTypes:Z,HubFormats:he,PageAction:G,TaskStates:B},ys=e=>{try{const t=ko(e);return!t&&t!==0?"":t}catch(t){console.error(t.message)}return""},ko=e=>{if(!e||!e.formula)throw new Error("Missing 'formula' definition");const{name:t}={...e.formula};switch(t){case"multiply":return Xe(e,(n,s)=>n*s);case"divide":return Xe(e,(n,s)=>n/s);case"plus":return Xe(e,(n,s)=>n+s);case"minus":return Xe(e,(n,s)=>n-s);default:throw new Error(t?`Unsupported operation '${t}'`:"Calculation formula 'name' cannot be empty")}},Xe=(e,t)=>{const{args:n}={...e.formula};if(n.length<2)throw new Error("Requires more than one argument for calculation");return $o(n.map(s=>Bo(s,e.formData)).reduce((s,r,o)=>o===0?r:t(s,r),0),e)},$o=(e,t)=>{const n=t.formula.round;if(!n&&n!==0||!e)return e;if(n===0)return parseInt(e,10);const s=Math.pow(10,n);return Math.round((e+Number.EPSILON)*s)/s},Bo=(e,t)=>{const n=Object.keys(e);if(n.length===1){const s=n[0],r=e[s];switch(s){case"field":{const o=Yo(r,t);return!o&&o!==0?NaN:parseFloat(o)}case"value":return parseFloat(r);case"formula":return ys({...e,formData:t});default:throw new Error("Only accept following as argument field: {field, value, or formula}")}}else throw new Error("Argument cannot have more than one reference")},Yo=(e,t)=>T.Utils.interpolateString("${"+e+"}",t),Ho=(e,t)=>{if(["in","nin","includesAllOf","!includesAllOf"].includes(e.op))return e.values;if(typeof e.value=="string"&&e.value?.startsWith("field::")){const n=e.value.replace("field::","");return le.getSource(t,n)}return e.value},Qe=e=>{if(Array.isArray(e))return e.length;if(typeof e=="string"){const t=e.replace(/,/g,"");return Number.isNaN(t)?null:parseFloat(t)}return typeof e=="number"?e:null},nn=(e,t,n)=>{if(e&&typeof e=="object"){const s=Ho(e,n);switch(e.op){case"=":case"eq":return s===t;case"!=":case"<>":case"ne":case"neq":return s!==t;case"in":return Array.isArray(s)?s.includes(t):!1;case"nin":return Array.isArray(s)?s.includes(t)===!1:!0;case"<":{const r=Qe(t),o=Qe(s);return r!=null&&o!=null&&r<o}case">":{const r=Qe(t),o=Qe(s);return r!=null&&o!=null&&r>o}case"contains":return t?.toString().toLowerCase().includes(s);case"!contains":return!t?.toString().toLowerCase().includes(s);case"includes":return Array.isArray(t)?t.includes(s):!1;case"!includes":return Array.isArray(t)?!t.includes(s):!0;case"includesObjectProp":return Array.isArray(t)?t.some(r=>r[e.key]===s):!1;case"!includesObjectProp":return Array.isArray(t)?!t.some(r=>r[e.key]===s):!0;case"includesAllOf":return Array.isArray(t)?s.every(r=>t.includes(r)):!1;case"!includesAllOf":return Array.isArray(t)?!s.every(r=>t.includes(r)):!0;default:return!1}}return!0},Vo=e=>{if(e.show_when){let t=e.show_when.type?e.show_when.conditions:e.show_when;const n=e.full_path;return t=Array.isArray(t)?t:[t],t.map(s=>{const r=le.getDataPath(s.field,n);return{...s,field:r}})}},qo=e=>Array.isArray(e)||!!(e.field&&e.op),Ts=e=>e&&!qo(e)?Vo(e):e,Ss=(e,t,n="and")=>{const s=Array.isArray(e)?e:[e],r=o=>{if(Array.isArray(o.conditions))return Ss(o.conditions,t,o.type);const i=o.field.startsWith("interpolate::")?T.Utils.interpolateString(o.field,t).replace("interpolate::",""):o.field,l=le.getSource(t,i);return nn(o,l,t)};return n==="and"?s.every(r):s.some(r)},xe=(e,t)=>{const n=Ts(e);return n?Ss(n,t):!0},Go=(e,t)=>{const n=Ts(e);return n?(Array.isArray(n)?n:[n]).some(r=>{const o=le.getSource(t,r.field);return nn(r,o,t)}):!0},se={meetsOne:Go,meetsAll:xe,met:nn},Ko=(e,t)=>{const n=e;return t.forEach((s,r)=>{if(s.refdata_match){const o=s.refdata_match,i=Object.keys(o)[0],l=e.findIndex(a=>a[i]===o[i]);l>=0&&(n[l]={...e[l],nested:s.nested})}s.combineWithRefdata&&!n.includes(s)&&(r>0&&typeof t[r-1]=="string"&&n.push(t[r-1]),n.push(s))}),n},Ze=(e,t)=>t.map(n=>n.show_when&&!(n.show_when.type==="or"?se.meetsOne(n,e.formData):se.meetsAll(n,e.formData))?null:typeof n=="string"?n:n.value?(e.alternativeHintField&&(n.hint=n[e.alternativeHintField]),{...n,value:T.Utils.interpolateString(n.value,e.formData),label:T.Utils.interpolateString(n.label,e.formData),hint:T.Utils.interpolateString(n.hint,e.formData)}):n.label).filter(n=>n),Wo=(e,t)=>{const n=e.formData[t].map(s=>({value:T.Utils.interpolateString(e.item.value,s),label:T.Utils.interpolateString(e.item.label,s),hint:T.Utils.interpolateString(e.item.hint,s)}));return e.data.options?[...n,...e.data.options]:n},Cs=(e,t)=>{if(e){if(e?.data?.collection&&e?.item){const n=Wo(e,e?.data?.collection);return t(Ze(e,n))}if(e.options&&e?.data?.options&&e?.data?.url){const n=Ko(e.options,e.data.options);return t(Ze(e,n))}if(e.options)return t(Ze(e,e.options));if(e.data&&e.data.options)return t(Ze(e,e.data.options))}return t([])},zo=6e3,Jo=(e,t)=>{const n=e===0;let s=0;return n&&(s=1),n||(s=t.substring(e-1).startsWith(" ")?2:3),s},xn=e=>e===0,gs=(e,t)=>typeof e!="string"?!1:e.toLowerCase().includes(t),Xo=(e,t)=>{let n=0;return e.synonyms.some(r=>gs(r,t))&&(n=4),n},Qo=(e,t,n)=>{let s=0;return e.item.extraFieldsToSearch.some(o=>{const i=t[o];return gs(i,n)})&&(s=5),s},Zo=(e,t,n,s)=>{const r=n?n(e).toLowerCase():e.label.toLowerCase()||"";let o=0;const i=r.indexOf(t);return i!==-1&&(o=Jo(i,r)),xn(o)&&e.synonyms&&(o=Xo(e,t)),xn(o)&&s.item?.extraFieldsToSearch&&(o=Qo(s,e,t)),{score:o,label:r,option:e}},ei=(e,t,n)=>(s,r)=>{const o=Zo(r,e,t,n);return o.score>0&&s.push(o),s},ti=(e,t)=>(e.score-t.score)*16+e.label.localeCompare(t.label),ni=e=>{let t=[];Cs(e,s=>{t=s});const n=e?.item?T.Utils.itemLabel(e.item):null;return(s,r)=>{const o=typeof s=="string"?s.toLowerCase():"",i=t.reduce(ei(o,n,e),[]).sort(ti).slice(0,zo).map(l=>l.option);r(i)}},Ie=".",sn="/",bs=`${Ie}${Ie}`,Nn=`${Ie}${sn}`,Yt=e=>e.join(Ie),Ht=(e,t=Ie)=>e.split(t),si=e=>e===bs,ri=e=>[Ie,bs].indexOf(e)>-1,oi=e=>e&&e.indexOf(Ie)===0,ii=e=>e.indexOf(Nn)===0?e:`${Nn}${e}`,li=(e,t)=>{const n=ii(t),s=Ht(n,sn).filter(si).length+1,r=e?Ht(e):[];return s>=r.length?"":Yt(r.slice(0,-s))},ai=(e,t)=>{const n=Ht(t,sn).filter(s=>!ri(s));return e?`${e}.${Yt(n)}`:Yt(n)},ci=(e,t)=>oi(e)?ai(li(t,e),e):e,ui=(e,t)=>{if(Array.isArray(e))return e[parseInt(t,10)]},di=e=>e.includes("["),fi=e=>e.replace("]","").split("["),ee=(e,t)=>{if(t)return t.split(".").reduce((n,s)=>{if(n&&di(s)){const[r,o]=fi(s);return ui(n[r],o)}return n?n[s]:void 0},e)},hi=(e,t)=>{let n=e.value||e.id,s=e.label||e.name;return t&&(n=e[t.value]||n,s=e[t.label]||s),{value:n?.toString(),label:s}},mi=(e,t)=>Array.isArray(e)?e.map(n=>typeof n=="string"?n:{...n,...hi(n,t)}):[],pi=(e,t)=>{const n=Object.keys(e).filter(r=>!(r in t)),s=e;n.forEach(r=>delete s[r])},ws=(e,t,n,s=!1)=>{if(t&&e){const r=s?t.replace(/\[/g,".").replace(/\]/g,"").split("."):t.split("."),o=r.pop();let i=e;r.forEach(l=>{(!i[l]||typeof i[l]!="object")&&(i[l]={}),i=i[l]}),i[o]=n}return e},Is=(e,t)=>{const n=t;e.source&&(n[e.fieldId]=ee(n,e.source.field))},Ei=(e,t)=>{e.forEach(n=>Is(n,t))},Ai=(e,t)=>{e.forEach(n=>{n.components.filter(s=>!s.use).forEach(s=>Is(s,t))})},yi=(e,t,n)=>{const s={...n};return Ei(t,s),Ai(e,s),s},Ti=(e,t)=>({...e,components:_s(e.components,t)}),Si=(e,t)=>({...e,item:_s(e.item,t)}),_s=(e,t)=>e.map(n=>Ps(n,t)),Ps=(e,t)=>{if(e){if(e.type===b.CONTAINER)return Ti(e,t);if(e.type===b.COLLECTION)return Si(e,t);if(e.type===b.SELECT)return e;if(e.data?.url&&!e.data?.skipUrlInterpolation)return{...e,data:{...e.data,url:T.Utils.interpolateString(e.data.url,t)}}}return e},le={applyFormula:ys,getAutocompleteSource:ni,getDataPath:ci,getOptions:Cs,getSource:ee,refData:{setupUrl:Ps,toOptions:mi},deleteValues:pi,setDataItem:ws,setupForm:yi},Ye=(e,t)=>Array.isArray(e)?t.refdata_match?e.some(n=>n.id===t.refdata_match.id):e.includes(t.value):e===t.value,Ce=(e,t)=>!e||e.hidden&&e.disabled?!1:e.show_when?.type==="or"?se.meetsOne(e,t):se.meetsAll(e,t),He=(e,t)=>{let n=[];return e?.forEach(s=>{n.push(s),Ce(s,t)&&s.data?.options?.forEach(r=>{const o=t?.[s.id]||le.getSource(t,s.full_path);Array.isArray(r.nested)&&Ye(o,r)&&Ce(r,t)&&(n=n.concat(r.nested))})}),n},On=["source","use","show_when","options","additionalValidation","full_path","fullPath","formData"],Q=(e,t=[])=>{const n=Array.isArray(t)?[...On,...t]:On;return e&&typeof e=="object"?Object.keys(e).reduce((s,r)=>n.includes(r)?s:{...s,[r]:e[r]},{}):{}};function xs(e,t){return function(){return e.apply(t,arguments)}}const{toString:Ci}=Object.prototype,{getPrototypeOf:rn}=Object,{iterator:pt,toStringTag:Ns}=Symbol,Et=(e=>t=>{const n=Ci.call(t);return e[n]||(e[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),Ae=e=>(e=e.toLowerCase(),t=>Et(t)===e),At=e=>t=>typeof t===e,{isArray:Le}=Array,Ne=At("undefined");function Ve(e){return e!==null&&!Ne(e)&&e.constructor!==null&&!Ne(e.constructor)&&ce(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const Os=Ae("ArrayBuffer");function gi(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&Os(e.buffer),t}const bi=At("string"),ce=At("function"),Rs=At("number"),qe=e=>e!==null&&typeof e=="object",wi=e=>e===!0||e===!1,rt=e=>{if(Et(e)!=="object")return!1;const t=rn(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Ns in e)&&!(pt in e)},Ii=e=>{if(!qe(e)||Ve(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch{return!1}},_i=Ae("Date"),Pi=Ae("File"),xi=e=>!!(e&&typeof e.uri<"u"),Ni=e=>e&&typeof e.getParts<"u",Oi=Ae("Blob"),Ri=Ae("FileList"),vi=e=>qe(e)&&ce(e.pipe);function Li(){return typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}}const Rn=Li(),vn=typeof Rn.FormData<"u"?Rn.FormData:void 0,Di=e=>{let t;return e&&(vn&&e instanceof vn||ce(e.append)&&((t=Et(e))==="formdata"||t==="object"&&ce(e.toString)&&e.toString()==="[object FormData]"))},Fi=Ae("URLSearchParams"),[ji,Ui,Mi,ki]=["ReadableStream","Request","Response","Headers"].map(Ae),$i=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Ge(e,t,{allOwnKeys:n=!1}={}){if(e===null||typeof e>"u")return;let s,r;if(typeof e!="object"&&(e=[e]),Le(e))for(s=0,r=e.length;s<r;s++)t.call(null,e[s],s,e);else{if(Ve(e))return;const o=n?Object.getOwnPropertyNames(e):Object.keys(e),i=o.length;let l;for(s=0;s<i;s++)l=o[s],t.call(null,e[l],l,e)}}function vs(e,t){if(Ve(e))return null;t=t.toLowerCase();const n=Object.keys(e);let s=n.length,r;for(;s-- >0;)if(r=n[s],t===r.toLowerCase())return r;return null}const be=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,Ls=e=>!Ne(e)&&e!==be;function Vt(){const{caseless:e,skipUndefined:t}=Ls(this)&&this||{},n={},s=(r,o)=>{if(o==="__proto__"||o==="constructor"||o==="prototype")return;const i=e&&vs(n,o)||o;rt(n[i])&&rt(r)?n[i]=Vt(n[i],r):rt(r)?n[i]=Vt({},r):Le(r)?n[i]=r.slice():(!t||!Ne(r))&&(n[i]=r)};for(let r=0,o=arguments.length;r<o;r++)arguments[r]&&Ge(arguments[r],s);return n}const Bi=(e,t,n,{allOwnKeys:s}={})=>(Ge(t,(r,o)=>{n&&ce(r)?Object.defineProperty(e,o,{value:xs(r,n),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(e,o,{value:r,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:s}),e),Yi=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),Hi=(e,t,n,s)=>{e.prototype=Object.create(t.prototype,s),Object.defineProperty(e.prototype,"constructor",{value:e,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(e,"super",{value:t.prototype}),n&&Object.assign(e.prototype,n)},Vi=(e,t,n,s)=>{let r,o,i;const l={};if(t=t||{},e==null)return t;do{for(r=Object.getOwnPropertyNames(e),o=r.length;o-- >0;)i=r[o],(!s||s(i,e,t))&&!l[i]&&(t[i]=e[i],l[i]=!0);e=n!==!1&&rn(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},qi=(e,t,n)=>{e=String(e),(n===void 0||n>e.length)&&(n=e.length),n-=t.length;const s=e.indexOf(t,n);return s!==-1&&s===n},Gi=e=>{if(!e)return null;if(Le(e))return e;let t=e.length;if(!Rs(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},Ki=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&rn(Uint8Array)),Wi=(e,t)=>{const s=(e&&e[pt]).call(e);let r;for(;(r=s.next())&&!r.done;){const o=r.value;t.call(e,o[0],o[1])}},zi=(e,t)=>{let n;const s=[];for(;(n=e.exec(t))!==null;)s.push(n);return s},Ji=Ae("HTMLFormElement"),Xi=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,s,r){return s.toUpperCase()+r}),Ln=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),Qi=Ae("RegExp"),Ds=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),s={};Ge(n,(r,o)=>{let i;(i=t(r,o,e))!==!1&&(s[o]=i||r)}),Object.defineProperties(e,s)},Zi=e=>{Ds(e,(t,n)=>{if(ce(e)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;const s=e[n];if(ce(s)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")})}})},el=(e,t)=>{const n={},s=r=>{r.forEach(o=>{n[o]=!0})};return Le(e)?s(e):s(String(e).split(t)),n},tl=()=>{},nl=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function sl(e){return!!(e&&ce(e.append)&&e[Ns]==="FormData"&&e[pt])}const rl=e=>{const t=new Array(10),n=(s,r)=>{if(qe(s)){if(t.indexOf(s)>=0)return;if(Ve(s))return s;if(!("toJSON"in s)){t[r]=s;const o=Le(s)?[]:{};return Ge(s,(i,l)=>{const a=n(i,r+1);!Ne(a)&&(o[l]=a)}),t[r]=void 0,o}}return s};return n(e,0)},ol=Ae("AsyncFunction"),il=e=>e&&(qe(e)||ce(e))&&ce(e.then)&&ce(e.catch),Fs=((e,t)=>e?setImmediate:t?((n,s)=>(be.addEventListener("message",({source:r,data:o})=>{r===be&&o===n&&s.length&&s.shift()()},!1),r=>{s.push(r),be.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):n=>setTimeout(n))(typeof setImmediate=="function",ce(be.postMessage)),ll=typeof queueMicrotask<"u"?queueMicrotask.bind(be):typeof process<"u"&&process.nextTick||Fs,al=e=>e!=null&&ce(e[pt]),E={isArray:Le,isArrayBuffer:Os,isBuffer:Ve,isFormData:Di,isArrayBufferView:gi,isString:bi,isNumber:Rs,isBoolean:wi,isObject:qe,isPlainObject:rt,isEmptyObject:Ii,isReadableStream:ji,isRequest:Ui,isResponse:Mi,isHeaders:ki,isUndefined:Ne,isDate:_i,isFile:Pi,isReactNativeBlob:xi,isReactNative:Ni,isBlob:Oi,isRegExp:Qi,isFunction:ce,isStream:vi,isURLSearchParams:Fi,isTypedArray:Ki,isFileList:Ri,forEach:Ge,merge:Vt,extend:Bi,trim:$i,stripBOM:Yi,inherits:Hi,toFlatObject:Vi,kindOf:Et,kindOfTest:Ae,endsWith:qi,toArray:Gi,forEachEntry:Wi,matchAll:zi,isHTMLForm:Ji,hasOwnProperty:Ln,hasOwnProp:Ln,reduceDescriptors:Ds,freezeMethods:Zi,toObjectSet:el,toCamelCase:Xi,noop:tl,toFiniteNumber:nl,findKey:vs,global:be,isContextDefined:Ls,isSpecCompliantForm:sl,toJSONObject:rl,isAsyncFn:ol,isThenable:il,setImmediate:Fs,asap:ll,isIterable:al};let F=class js extends Error{static from(t,n,s,r,o,i){const l=new js(t.message,n||t.code,s,r,o);return l.cause=t,l.name=t.name,t.status!=null&&l.status==null&&(l.status=t.status),i&&Object.assign(l,i),l}constructor(t,n,s,r,o){super(t),Object.defineProperty(this,"message",{value:t,enumerable:!0,writable:!0,configurable:!0}),this.name="AxiosError",this.isAxiosError=!0,n&&(this.code=n),s&&(this.config=s),r&&(this.request=r),o&&(this.response=o,this.status=o.status)}toJSON(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:E.toJSONObject(this.config),code:this.code,status:this.status}}};F.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE";F.ERR_BAD_OPTION="ERR_BAD_OPTION";F.ECONNABORTED="ECONNABORTED";F.ETIMEDOUT="ETIMEDOUT";F.ERR_NETWORK="ERR_NETWORK";F.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS";F.ERR_DEPRECATED="ERR_DEPRECATED";F.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE";F.ERR_BAD_REQUEST="ERR_BAD_REQUEST";F.ERR_CANCELED="ERR_CANCELED";F.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT";F.ERR_INVALID_URL="ERR_INVALID_URL";const cl=null;function qt(e){return E.isPlainObject(e)||E.isArray(e)}function Us(e){return E.endsWith(e,"[]")?e.slice(0,-2):e}function Nt(e,t,n){return e?e.concat(t).map(function(r,o){return r=Us(r),!n&&o?"["+r+"]":r}).join(n?".":""):t}function ul(e){return E.isArray(e)&&!e.some(qt)}const dl=E.toFlatObject(E,{},null,function(t){return/^is[A-Z]/.test(t)});function yt(e,t,n){if(!E.isObject(e))throw new TypeError("target must be an object");t=t||new FormData,n=E.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(p,A){return!E.isUndefined(A[p])});const s=n.metaTokens,r=n.visitor||u,o=n.dots,i=n.indexes,a=(n.Blob||typeof Blob<"u"&&Blob)&&E.isSpecCompliantForm(t);if(!E.isFunction(r))throw new TypeError("visitor must be a function");function c(h){if(h===null)return"";if(E.isDate(h))return h.toISOString();if(E.isBoolean(h))return h.toString();if(!a&&E.isBlob(h))throw new F("Blob is not supported. Use a Buffer instead.");return E.isArrayBuffer(h)||E.isTypedArray(h)?a&&typeof Blob=="function"?new Blob([h]):Buffer.from(h):h}function u(h,p,A){let w=h;if(E.isReactNative(t)&&E.isReactNativeBlob(h))return t.append(Nt(A,p,o),c(h)),!1;if(h&&!A&&typeof h=="object"){if(E.endsWith(p,"{}"))p=s?p:p.slice(0,-2),h=JSON.stringify(h);else if(E.isArray(h)&&ul(h)||(E.isFileList(h)||E.endsWith(p,"[]"))&&(w=E.toArray(h)))return p=Us(p),w.forEach(function(C,I){!(E.isUndefined(C)||C===null)&&t.append(i===!0?Nt([p],I,o):i===null?p:p+"[]",c(C))}),!1}return qt(h)?!0:(t.append(Nt(A,p,o),c(h)),!1)}const m=[],f=Object.assign(dl,{defaultVisitor:u,convertValue:c,isVisitable:qt});function y(h,p){if(!E.isUndefined(h)){if(m.indexOf(h)!==-1)throw Error("Circular reference detected in "+p.join("."));m.push(h),E.forEach(h,function(w,L){(!(E.isUndefined(w)||w===null)&&r.call(t,w,E.isString(L)?L.trim():L,p,f))===!0&&y(w,p?p.concat(L):[L])}),m.pop()}}if(!E.isObject(e))throw new TypeError("data must be an object");return y(e),t}function Dn(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(s){return t[s]})}function on(e,t){this._pairs=[],e&&yt(e,this,t)}const Ms=on.prototype;Ms.append=function(t,n){this._pairs.push([t,n])};Ms.toString=function(t){const n=t?function(s){return t.call(this,s,Dn)}:Dn;return this._pairs.map(function(r){return n(r[0])+"="+n(r[1])},"").join("&")};function fl(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function ks(e,t,n){if(!t)return e;const s=n&&n.encode||fl,r=E.isFunction(n)?{serialize:n}:n,o=r&&r.serialize;let i;if(o?i=o(t,r):i=E.isURLSearchParams(t)?t.toString():new on(t,r).toString(s),i){const l=e.indexOf("#");l!==-1&&(e=e.slice(0,l)),e+=(e.indexOf("?")===-1?"?":"&")+i}return e}class Fn{constructor(){this.handlers=[]}use(t,n,s){return this.handlers.push({fulfilled:t,rejected:n,synchronous:s?s.synchronous:!1,runWhen:s?s.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){E.forEach(this.handlers,function(s){s!==null&&t(s)})}}const ln={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0},hl=typeof URLSearchParams<"u"?URLSearchParams:on,ml=typeof FormData<"u"?FormData:null,pl=typeof Blob<"u"?Blob:null,El={isBrowser:!0,classes:{URLSearchParams:hl,FormData:ml,Blob:pl},protocols:["http","https","file","blob","url","data"]},an=typeof window<"u"&&typeof document<"u",Gt=typeof navigator=="object"&&navigator||void 0,Al=an&&(!Gt||["ReactNative","NativeScript","NS"].indexOf(Gt.product)<0),yl=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",Tl=an&&window.location.href||"http://localhost",Sl=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:an,hasStandardBrowserEnv:Al,hasStandardBrowserWebWorkerEnv:yl,navigator:Gt,origin:Tl},Symbol.toStringTag,{value:"Module"})),ie={...Sl,...El};function Cl(e,t){return yt(e,new ie.classes.URLSearchParams,{visitor:function(n,s,r,o){return ie.isNode&&E.isBuffer(n)?(this.append(s,n.toString("base64")),!1):o.defaultVisitor.apply(this,arguments)},...t})}function gl(e){return E.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function bl(e){const t={},n=Object.keys(e);let s;const r=n.length;let o;for(s=0;s<r;s++)o=n[s],t[o]=e[o];return t}function $s(e){function t(n,s,r,o){let i=n[o++];if(i==="__proto__")return!0;const l=Number.isFinite(+i),a=o>=n.length;return i=!i&&E.isArray(r)?r.length:i,a?(E.hasOwnProp(r,i)?r[i]=[r[i],s]:r[i]=s,!l):((!r[i]||!E.isObject(r[i]))&&(r[i]=[]),t(n,s,r[i],o)&&E.isArray(r[i])&&(r[i]=bl(r[i])),!l)}if(E.isFormData(e)&&E.isFunction(e.entries)){const n={};return E.forEachEntry(e,(s,r)=>{t(gl(s),r,n,0)}),n}return null}function wl(e,t,n){if(E.isString(e))try{return(t||JSON.parse)(e),E.trim(e)}catch(s){if(s.name!=="SyntaxError")throw s}return(n||JSON.stringify)(e)}const Ke={transitional:ln,adapter:["xhr","http","fetch"],transformRequest:[function(t,n){const s=n.getContentType()||"",r=s.indexOf("application/json")>-1,o=E.isObject(t);if(o&&E.isHTMLForm(t)&&(t=new FormData(t)),E.isFormData(t))return r?JSON.stringify($s(t)):t;if(E.isArrayBuffer(t)||E.isBuffer(t)||E.isStream(t)||E.isFile(t)||E.isBlob(t)||E.isReadableStream(t))return t;if(E.isArrayBufferView(t))return t.buffer;if(E.isURLSearchParams(t))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let l;if(o){if(s.indexOf("application/x-www-form-urlencoded")>-1)return Cl(t,this.formSerializer).toString();if((l=E.isFileList(t))||s.indexOf("multipart/form-data")>-1){const a=this.env&&this.env.FormData;return yt(l?{"files[]":t}:t,a&&new a,this.formSerializer)}}return o||r?(n.setContentType("application/json",!1),wl(t)):t}],transformResponse:[function(t){const n=this.transitional||Ke.transitional,s=n&&n.forcedJSONParsing,r=this.responseType==="json";if(E.isResponse(t)||E.isReadableStream(t))return t;if(t&&E.isString(t)&&(s&&!this.responseType||r)){const i=!(n&&n.silentJSONParsing)&&r;try{return JSON.parse(t,this.parseReviver)}catch(l){if(i)throw l.name==="SyntaxError"?F.from(l,F.ERR_BAD_RESPONSE,this,null,this.response):l}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:ie.classes.FormData,Blob:ie.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};E.forEach(["delete","get","head","post","put","patch"],e=>{Ke.headers[e]={}});const Il=E.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),_l=e=>{const t={};let n,s,r;return e&&e.split(`
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});require('./index.css');const d=require("react/jsx-runtime"),T=require("@ukhomeoffice/cop-react-components"),O=require("react"),mt=require("uuid"),q=require("dayjs"),Re=require("dayjs/plugin/customParseFormat"),tn=require("dayjs/plugin/isToday"),Wr=require("dayjs/plugin/isLeapYear"),ve={add:"Add another",remove:"Remove",change:"Change",item:"Item ${index}"},zr="alert",Jr="autocomplete",Xr="calculation",Qr="checkboxes",Zr="collection",eo="collection-summary",to="container",no="date",so="details",ro="email",oo="file",io="heading",lo="html",ao="inset-text",co="list",uo="multifile",fo="paragraph",ho="phone-number",mo="radios",po="select",Eo="text",Ao="textarea",yo="time",To="warning",b={ALERT:zr,AUTOCOMPLETE:Jr,CALCULATION:Xr,CHECKBOXES:Qr,COLLECTION:Zr,COLLECTION_SUMMARY:eo,CONTAINER:to,DATE:no,DETAILS:so,EMAIL:ro,FILE:oo,HEADING:io,HTML:lo,INSET_TEXT:ao,LIST:co,MULTI_FILE:uo,PARAGRAPH:fo,PHONE_NUMBER:ho,RADIOS:mo,SELECT:po,TEXT:Eo,TEXT_AREA:Ao,TIME:yo,WARNING:To},So="blur",Co="submit",go="cancel",Te={BLUR:So,SUBMIT:Co,CANCEL:go},bo="cya",wo="hub",Io="partial-cya",te={CYA:bo,HUB:wo,PARTIAL_CYA:Io},_o="cya",Po="form",xo="form-with-task-list",No="hub-and-spoke",Oo="task-list",Ro="task-list-cya",vo="wizard",Z={CYA:_o,FORM:Po,FORM_WITH_TASK:xo,HUB:No,TASK:Oo,TASK_CYA:Ro,WIZARD:vo},Lo="CYA",Do="TASK",he={CYA:Lo,TASK:Do},Ut="cancel",cs="collectionAdd",us="collectionDuplicate",ds="collectionRemove",fs="navigate",Mt="saveAndContinue",kt="saveAndNavigate",$t="saveAndReturn",Bt="submit",st={CANCEL:Ut,COLLECTION_ADD:cs,COLLECTION_DUPLICATE:us,COLLECTION_REMOVE:ds,NAVIGATE:fs,SAVE_AND_CONTINUE:Mt,SAVE_AND_NAVIGATE:kt,SAVE_AND_RETURN:$t,SUBMIT:Bt},Fo={[Ut]:{type:Ut,validate:!1,label:"Cancel",classModifiers:"secondary"},[cs]:void 0,[us]:void 0,[ds]:void 0,[fs]:void 0,[Mt]:{type:Mt,validate:!0,label:"Save and continue"},[kt]:{type:kt,validate:!0,label:"Save and continue"},[$t]:{type:$t,validate:!1,label:"Save and return later",classModifiers:"secondary"},[Bt]:{type:Bt,validate:!0}},G={TYPES:st,DEFAULTS:Fo},hs="complete",ms="inProgress",ps="notStarted",Es="cannotStartYet",As="skipped",jo={COMPLETE:hs,IN_PROGRESS:ms,NOT_STARTED:ps,CANNOT_START_YET:Es,SKIPPED:As},Uo={[hs]:{label:"Completed",colour:"dark-blue"},[ms]:{label:"In Progress",colour:"white"},[ps]:{label:"Not Started",colour:"dark-grey"},[Es]:{label:"Cannot Start Yet",colour:"dark-grey"},[As]:{label:"Skipped",colour:"dark-grey"}},B={TYPES:jo,DETAILS:Uo},Mo={CollectionLabels:ve,ComponentTypes:b,EventTypes:Te,FormPages:te,FormTypes:Z,HubFormats:he,PageAction:G,TaskStates:B},ys=e=>{try{const t=ko(e);return!t&&t!==0?"":t}catch(t){console.error(t.message)}return""},ko=e=>{if(!e||!e.formula)throw new Error("Missing 'formula' definition");const{name:t}={...e.formula};switch(t){case"multiply":return Xe(e,(n,s)=>n*s);case"divide":return Xe(e,(n,s)=>n/s);case"plus":return Xe(e,(n,s)=>n+s);case"minus":return Xe(e,(n,s)=>n-s);default:throw new Error(t?`Unsupported operation '${t}'`:"Calculation formula 'name' cannot be empty")}},Xe=(e,t)=>{const{args:n}={...e.formula};if(n.length<2)throw new Error("Requires more than one argument for calculation");return $o(n.map(s=>Bo(s,e.formData)).reduce((s,r,o)=>o===0?r:t(s,r),0),e)},$o=(e,t)=>{const n=t.formula.round;if(!n&&n!==0||!e)return e;if(n===0)return parseInt(e,10);const s=Math.pow(10,n);return Math.round((e+Number.EPSILON)*s)/s},Bo=(e,t)=>{const n=Object.keys(e);if(n.length===1){const s=n[0],r=e[s];switch(s){case"field":{const o=Yo(r,t);return!o&&o!==0?NaN:parseFloat(o)}case"value":return parseFloat(r);case"formula":return ys({...e,formData:t});default:throw new Error("Only accept following as argument field: {field, value, or formula}")}}else throw new Error("Argument cannot have more than one reference")},Yo=(e,t)=>T.Utils.interpolateString("${"+e+"}",t),Ho=(e,t)=>{if(["in","nin","includesAllOf","!includesAllOf"].includes(e.op))return e.values;if(typeof e.value=="string"&&e.value?.startsWith("field::")){const n=e.value.replace("field::","");return le.getSource(t,n)}return e.value},Qe=e=>{if(Array.isArray(e))return e.length;if(typeof e=="string"){const t=e.replace(/,/g,"");return Number.isNaN(t)?null:parseFloat(t)}return typeof e=="number"?e:null},nn=(e,t,n)=>{if(e&&typeof e=="object"){const s=Ho(e,n);switch(e.op){case"=":case"eq":return s===t;case"!=":case"<>":case"ne":case"neq":return s!==t;case"in":return Array.isArray(s)?s.includes(t):!1;case"nin":return Array.isArray(s)?s.includes(t)===!1:!0;case"<":{const r=Qe(t),o=Qe(s);return r!=null&&o!=null&&r<o}case">":{const r=Qe(t),o=Qe(s);return r!=null&&o!=null&&r>o}case"contains":return t?.toString().toLowerCase().includes(s);case"!contains":return!t?.toString().toLowerCase().includes(s);case"includes":return Array.isArray(t)?t.includes(s):!1;case"!includes":return Array.isArray(t)?!t.includes(s):!0;case"includesObjectProp":return Array.isArray(t)?t.some(r=>r[e.key]===s):!1;case"!includesObjectProp":return Array.isArray(t)?!t.some(r=>r[e.key]===s):!0;case"includesAllOf":return Array.isArray(t)?s.every(r=>t.includes(r)):!1;case"!includesAllOf":return Array.isArray(t)?!s.every(r=>t.includes(r)):!0;default:return!1}}return!0},Vo=e=>{if(e.show_when){let t=e.show_when.type?e.show_when.conditions:e.show_when;const n=e.full_path;return t=Array.isArray(t)?t:[t],t.map(s=>{const r=le.getDataPath(s.field,n);return{...s,field:r}})}},qo=e=>Array.isArray(e)||!!(e.field&&e.op),Ts=e=>e&&!qo(e)?Vo(e):e,Ss=(e,t,n="and")=>{const s=Array.isArray(e)?e:[e],r=o=>{if(Array.isArray(o.conditions))return Ss(o.conditions,t,o.type);const i=o.field.startsWith("interpolate::")?T.Utils.interpolateString(o.field,t).replace("interpolate::",""):o.field,l=le.getSource(t,i);return nn(o,l,t)};return n==="and"?s.every(r):s.some(r)},xe=(e,t)=>{const n=Ts(e);return n?Ss(n,t):!0},Go=(e,t)=>{const n=Ts(e);return n?(Array.isArray(n)?n:[n]).some(r=>{const o=le.getSource(t,r.field);return nn(r,o,t)}):!0},se={meetsOne:Go,meetsAll:xe,met:nn},Ko=(e,t)=>{const n=e;return t.forEach((s,r)=>{if(s.refdata_match){const o=s.refdata_match,i=Object.keys(o)[0],l=e.findIndex(a=>a[i]===o[i]);l>=0&&(n[l]={...e[l],nested:s.nested})}s.combineWithRefdata&&!n.includes(s)&&(r>0&&typeof t[r-1]=="string"&&n.push(t[r-1]),n.push(s))}),n},Ze=(e,t)=>t.map(n=>n.show_when&&!(n.show_when.type==="or"?se.meetsOne(n,e.formData):se.meetsAll(n,e.formData))?null:typeof n=="string"?n:n.value?(e.alternativeHintField&&(n.hint=n[e.alternativeHintField]),{...n,value:T.Utils.interpolateString(n.value,e.formData),label:T.Utils.interpolateString(n.label,e.formData),hint:T.Utils.interpolateString(n.hint,e.formData)}):n.label).filter(n=>n),Wo=(e,t)=>{const n=e.formData[t].map(s=>({value:T.Utils.interpolateString(e.item.value,s),label:T.Utils.interpolateString(e.item.label,s),hint:T.Utils.interpolateString(e.item.hint,s)}));return e.data.options?[...n,...e.data.options]:n},Cs=(e,t)=>{if(e){if(e?.data?.collection&&e?.item){const n=Wo(e,e?.data?.collection);return t(Ze(e,n))}if(e.options&&e?.data?.options&&e?.data?.url){const n=Ko(e.options,e.data.options);return t(Ze(e,n))}if(e.options)return t(Ze(e,e.options));if(e.data&&e.data.options)return t(Ze(e,e.data.options))}return t([])},zo=6e3,Jo=(e,t)=>{const n=e===0;let s=0;return n&&(s=1),n||(s=t.substring(e-1).startsWith(" ")?2:3),s},xn=e=>e===0,gs=(e,t)=>typeof e!="string"?!1:e.toLowerCase().includes(t),Xo=(e,t)=>{let n=0;return e.synonyms.some(r=>gs(r,t))&&(n=4),n},Qo=(e,t,n)=>{let s=0;return e.item.extraFieldsToSearch.some(o=>{const i=t[o];return gs(i,n)})&&(s=5),s},Zo=(e,t,n,s)=>{const r=n?n(e).toLowerCase():e.label.toLowerCase()||"";let o=0;const i=r.indexOf(t);return i!==-1&&(o=Jo(i,r)),xn(o)&&e.synonyms&&(o=Xo(e,t)),xn(o)&&s.item?.extraFieldsToSearch&&(o=Qo(s,e,t)),{score:o,label:r,option:e}},ei=(e,t,n)=>(s,r)=>{const o=Zo(r,e,t,n);return o.score>0&&s.push(o),s},ti=(e,t)=>(e.score-t.score)*16+e.label.localeCompare(t.label),ni=e=>{let t=[];Cs(e,s=>{t=s});const n=e?.item?T.Utils.itemLabel(e.item):null;return(s,r)=>{const o=typeof s=="string"?s.toLowerCase():"",i=t.reduce(ei(o,n,e),[]).sort(ti).slice(0,zo).map(l=>l.option);r(i)}},Ie=".",sn="/",bs=`${Ie}${Ie}`,Nn=`${Ie}${sn}`,Yt=e=>e.join(Ie),Ht=(e,t=Ie)=>e.split(t),si=e=>e===bs,ri=e=>[Ie,bs].indexOf(e)>-1,oi=e=>e&&e.indexOf(Ie)===0,ii=e=>e.indexOf(Nn)===0?e:`${Nn}${e}`,li=(e,t)=>{const n=ii(t),s=Ht(n,sn).filter(si).length+1,r=e?Ht(e):[];return s>=r.length?"":Yt(r.slice(0,-s))},ai=(e,t)=>{const n=Ht(t,sn).filter(s=>!ri(s));return e?`${e}.${Yt(n)}`:Yt(n)},ci=(e,t)=>oi(e)?ai(li(t,e),e):e,ui=(e,t)=>{if(Array.isArray(e))return e[parseInt(t,10)]},di=e=>e.includes("["),fi=e=>e.replace("]","").split("["),ee=(e,t)=>{if(t)return t.split(".").reduce((n,s)=>{if(n&&di(s)){const[r,o]=fi(s);return ui(n[r],o)}return n?n[s]:void 0},e)},hi=(e,t)=>{let n=e.value||e.id,s=e.label||e.name;return t&&(n=e[t.value]||n,s=e[t.label]||s),{value:n?.toString(),label:s}},mi=(e,t)=>Array.isArray(e)?e.map(n=>typeof n=="string"?n:{...n,...hi(n,t)}):[],pi=(e,t)=>{const n=Object.keys(e).filter(r=>!(r in t)),s=e;n.forEach(r=>delete s[r])},ws=(e,t,n,s=!1)=>{if(t&&e){const r=s?t.replace(/\[/g,".").replace(/\]/g,"").split("."):t.split("."),o=r.pop();let i=e;r.forEach(l=>{(!i[l]||typeof i[l]!="object")&&(i[l]={}),i=i[l]}),i[o]=n}return e},Is=(e,t)=>{const n=t;e.source&&(n[e.fieldId]=ee(n,e.source.field))},Ei=(e,t)=>{e.forEach(n=>Is(n,t))},Ai=(e,t)=>{e.forEach(n=>{n.components.filter(s=>!s.use).forEach(s=>Is(s,t))})},yi=(e,t,n)=>{const s={...n};return Ei(t,s),Ai(e,s),s},Ti=(e,t)=>({...e,components:_s(e.components,t)}),Si=(e,t)=>({...e,item:_s(e.item,t)}),_s=(e,t)=>e.map(n=>Ps(n,t)),Ps=(e,t)=>{if(e){if(e.type===b.CONTAINER)return Ti(e,t);if(e.type===b.COLLECTION)return Si(e,t);if(e.type===b.SELECT)return e;if(e.data?.url&&!e.data?.skipUrlInterpolation)return{...e,data:{...e.data,url:T.Utils.interpolateString(e.data.url,t)}}}return e},le={applyFormula:ys,getAutocompleteSource:ni,getDataPath:ci,getOptions:Cs,getSource:ee,refData:{setupUrl:Ps,toOptions:mi},deleteValues:pi,setDataItem:ws,setupForm:yi},Ye=(e,t)=>Array.isArray(e)?t.refdata_match?e.some(n=>n.id===t.refdata_match.id):e.includes(t.value):e===t.value,Ce=(e,t)=>!e||e.hidden&&e.disabled?!1:e.show_when?.type==="or"?se.meetsOne(e,t):se.meetsAll(e,t),He=(e,t)=>{let n=[];return e?.forEach(s=>{n.push(s),Ce(s,t)&&s.data?.options?.forEach(r=>{const o=t?.[s.id]||le.getSource(t,s.full_path);Array.isArray(r.nested)&&Ye(o,r)&&Ce(r,t)&&(n=n.concat(r.nested))})}),n},On=["source","use","show_when","options","additionalValidation","full_path","fullPath","formData"],Q=(e,t)=>{const n=Array.isArray(t)?[...On,...t]:On;return e&&typeof e=="object"?Object.keys(e).reduce((s,r)=>n.includes(r)?s:{...s,[r]:e[r]},{}):{}};function xs(e,t){return function(){return e.apply(t,arguments)}}const{toString:Ci}=Object.prototype,{getPrototypeOf:rn}=Object,{iterator:pt,toStringTag:Ns}=Symbol,Et=(e=>t=>{const n=Ci.call(t);return e[n]||(e[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),Ae=e=>(e=e.toLowerCase(),t=>Et(t)===e),At=e=>t=>typeof t===e,{isArray:Le}=Array,Ne=At("undefined");function Ve(e){return e!==null&&!Ne(e)&&e.constructor!==null&&!Ne(e.constructor)&&ce(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const Os=Ae("ArrayBuffer");function gi(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&Os(e.buffer),t}const bi=At("string"),ce=At("function"),Rs=At("number"),qe=e=>e!==null&&typeof e=="object",wi=e=>e===!0||e===!1,rt=e=>{if(Et(e)!=="object")return!1;const t=rn(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Ns in e)&&!(pt in e)},Ii=e=>{if(!qe(e)||Ve(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch{return!1}},_i=Ae("Date"),Pi=Ae("File"),xi=e=>!!(e&&typeof e.uri<"u"),Ni=e=>e&&typeof e.getParts<"u",Oi=Ae("Blob"),Ri=Ae("FileList"),vi=e=>qe(e)&&ce(e.pipe);function Li(){return typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}}const Rn=Li(),vn=typeof Rn.FormData<"u"?Rn.FormData:void 0,Di=e=>{let t;return e&&(vn&&e instanceof vn||ce(e.append)&&((t=Et(e))==="formdata"||t==="object"&&ce(e.toString)&&e.toString()==="[object FormData]"))},Fi=Ae("URLSearchParams"),[ji,Ui,Mi,ki]=["ReadableStream","Request","Response","Headers"].map(Ae),$i=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Ge(e,t,{allOwnKeys:n=!1}={}){if(e===null||typeof e>"u")return;let s,r;if(typeof e!="object"&&(e=[e]),Le(e))for(s=0,r=e.length;s<r;s++)t.call(null,e[s],s,e);else{if(Ve(e))return;const o=n?Object.getOwnPropertyNames(e):Object.keys(e),i=o.length;let l;for(s=0;s<i;s++)l=o[s],t.call(null,e[l],l,e)}}function vs(e,t){if(Ve(e))return null;t=t.toLowerCase();const n=Object.keys(e);let s=n.length,r;for(;s-- >0;)if(r=n[s],t===r.toLowerCase())return r;return null}const be=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,Ls=e=>!Ne(e)&&e!==be;function Vt(){const{caseless:e,skipUndefined:t}=Ls(this)&&this||{},n={},s=(r,o)=>{if(o==="__proto__"||o==="constructor"||o==="prototype")return;const i=e&&vs(n,o)||o;rt(n[i])&&rt(r)?n[i]=Vt(n[i],r):rt(r)?n[i]=Vt({},r):Le(r)?n[i]=r.slice():(!t||!Ne(r))&&(n[i]=r)};for(let r=0,o=arguments.length;r<o;r++)arguments[r]&&Ge(arguments[r],s);return n}const Bi=(e,t,n,{allOwnKeys:s}={})=>(Ge(t,(r,o)=>{n&&ce(r)?Object.defineProperty(e,o,{value:xs(r,n),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(e,o,{value:r,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:s}),e),Yi=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),Hi=(e,t,n,s)=>{e.prototype=Object.create(t.prototype,s),Object.defineProperty(e.prototype,"constructor",{value:e,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(e,"super",{value:t.prototype}),n&&Object.assign(e.prototype,n)},Vi=(e,t,n,s)=>{let r,o,i;const l={};if(t=t||{},e==null)return t;do{for(r=Object.getOwnPropertyNames(e),o=r.length;o-- >0;)i=r[o],(!s||s(i,e,t))&&!l[i]&&(t[i]=e[i],l[i]=!0);e=n!==!1&&rn(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},qi=(e,t,n)=>{e=String(e),(n===void 0||n>e.length)&&(n=e.length),n-=t.length;const s=e.indexOf(t,n);return s!==-1&&s===n},Gi=e=>{if(!e)return null;if(Le(e))return e;let t=e.length;if(!Rs(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},Ki=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&rn(Uint8Array)),Wi=(e,t)=>{const s=(e&&e[pt]).call(e);let r;for(;(r=s.next())&&!r.done;){const o=r.value;t.call(e,o[0],o[1])}},zi=(e,t)=>{let n;const s=[];for(;(n=e.exec(t))!==null;)s.push(n);return s},Ji=Ae("HTMLFormElement"),Xi=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,s,r){return s.toUpperCase()+r}),Ln=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),Qi=Ae("RegExp"),Ds=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),s={};Ge(n,(r,o)=>{let i;(i=t(r,o,e))!==!1&&(s[o]=i||r)}),Object.defineProperties(e,s)},Zi=e=>{Ds(e,(t,n)=>{if(ce(e)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;const s=e[n];if(ce(s)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")})}})},el=(e,t)=>{const n={},s=r=>{r.forEach(o=>{n[o]=!0})};return Le(e)?s(e):s(String(e).split(t)),n},tl=()=>{},nl=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function sl(e){return!!(e&&ce(e.append)&&e[Ns]==="FormData"&&e[pt])}const rl=e=>{const t=new Array(10),n=(s,r)=>{if(qe(s)){if(t.indexOf(s)>=0)return;if(Ve(s))return s;if(!("toJSON"in s)){t[r]=s;const o=Le(s)?[]:{};return Ge(s,(i,l)=>{const a=n(i,r+1);!Ne(a)&&(o[l]=a)}),t[r]=void 0,o}}return s};return n(e,0)},ol=Ae("AsyncFunction"),il=e=>e&&(qe(e)||ce(e))&&ce(e.then)&&ce(e.catch),Fs=((e,t)=>e?setImmediate:t?((n,s)=>(be.addEventListener("message",({source:r,data:o})=>{r===be&&o===n&&s.length&&s.shift()()},!1),r=>{s.push(r),be.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):n=>setTimeout(n))(typeof setImmediate=="function",ce(be.postMessage)),ll=typeof queueMicrotask<"u"?queueMicrotask.bind(be):typeof process<"u"&&process.nextTick||Fs,al=e=>e!=null&&ce(e[pt]),E={isArray:Le,isArrayBuffer:Os,isBuffer:Ve,isFormData:Di,isArrayBufferView:gi,isString:bi,isNumber:Rs,isBoolean:wi,isObject:qe,isPlainObject:rt,isEmptyObject:Ii,isReadableStream:ji,isRequest:Ui,isResponse:Mi,isHeaders:ki,isUndefined:Ne,isDate:_i,isFile:Pi,isReactNativeBlob:xi,isReactNative:Ni,isBlob:Oi,isRegExp:Qi,isFunction:ce,isStream:vi,isURLSearchParams:Fi,isTypedArray:Ki,isFileList:Ri,forEach:Ge,merge:Vt,extend:Bi,trim:$i,stripBOM:Yi,inherits:Hi,toFlatObject:Vi,kindOf:Et,kindOfTest:Ae,endsWith:qi,toArray:Gi,forEachEntry:Wi,matchAll:zi,isHTMLForm:Ji,hasOwnProperty:Ln,hasOwnProp:Ln,reduceDescriptors:Ds,freezeMethods:Zi,toObjectSet:el,toCamelCase:Xi,noop:tl,toFiniteNumber:nl,findKey:vs,global:be,isContextDefined:Ls,isSpecCompliantForm:sl,toJSONObject:rl,isAsyncFn:ol,isThenable:il,setImmediate:Fs,asap:ll,isIterable:al};let F=class js extends Error{static from(t,n,s,r,o,i){const l=new js(t.message,n||t.code,s,r,o);return l.cause=t,l.name=t.name,t.status!=null&&l.status==null&&(l.status=t.status),i&&Object.assign(l,i),l}constructor(t,n,s,r,o){super(t),Object.defineProperty(this,"message",{value:t,enumerable:!0,writable:!0,configurable:!0}),this.name="AxiosError",this.isAxiosError=!0,n&&(this.code=n),s&&(this.config=s),r&&(this.request=r),o&&(this.response=o,this.status=o.status)}toJSON(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:E.toJSONObject(this.config),code:this.code,status:this.status}}};F.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE";F.ERR_BAD_OPTION="ERR_BAD_OPTION";F.ECONNABORTED="ECONNABORTED";F.ETIMEDOUT="ETIMEDOUT";F.ERR_NETWORK="ERR_NETWORK";F.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS";F.ERR_DEPRECATED="ERR_DEPRECATED";F.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE";F.ERR_BAD_REQUEST="ERR_BAD_REQUEST";F.ERR_CANCELED="ERR_CANCELED";F.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT";F.ERR_INVALID_URL="ERR_INVALID_URL";const cl=null;function qt(e){return E.isPlainObject(e)||E.isArray(e)}function Us(e){return E.endsWith(e,"[]")?e.slice(0,-2):e}function Nt(e,t,n){return e?e.concat(t).map(function(r,o){return r=Us(r),!n&&o?"["+r+"]":r}).join(n?".":""):t}function ul(e){return E.isArray(e)&&!e.some(qt)}const dl=E.toFlatObject(E,{},null,function(t){return/^is[A-Z]/.test(t)});function yt(e,t,n){if(!E.isObject(e))throw new TypeError("target must be an object");t=t||new FormData,n=E.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(p,A){return!E.isUndefined(A[p])});const s=n.metaTokens,r=n.visitor||u,o=n.dots,i=n.indexes,a=(n.Blob||typeof Blob<"u"&&Blob)&&E.isSpecCompliantForm(t);if(!E.isFunction(r))throw new TypeError("visitor must be a function");function c(h){if(h===null)return"";if(E.isDate(h))return h.toISOString();if(E.isBoolean(h))return h.toString();if(!a&&E.isBlob(h))throw new F("Blob is not supported. Use a Buffer instead.");return E.isArrayBuffer(h)||E.isTypedArray(h)?a&&typeof Blob=="function"?new Blob([h]):Buffer.from(h):h}function u(h,p,A){let w=h;if(E.isReactNative(t)&&E.isReactNativeBlob(h))return t.append(Nt(A,p,o),c(h)),!1;if(h&&!A&&typeof h=="object"){if(E.endsWith(p,"{}"))p=s?p:p.slice(0,-2),h=JSON.stringify(h);else if(E.isArray(h)&&ul(h)||(E.isFileList(h)||E.endsWith(p,"[]"))&&(w=E.toArray(h)))return p=Us(p),w.forEach(function(C,I){!(E.isUndefined(C)||C===null)&&t.append(i===!0?Nt([p],I,o):i===null?p:p+"[]",c(C))}),!1}return qt(h)?!0:(t.append(Nt(A,p,o),c(h)),!1)}const m=[],f=Object.assign(dl,{defaultVisitor:u,convertValue:c,isVisitable:qt});function y(h,p){if(!E.isUndefined(h)){if(m.indexOf(h)!==-1)throw Error("Circular reference detected in "+p.join("."));m.push(h),E.forEach(h,function(w,L){(!(E.isUndefined(w)||w===null)&&r.call(t,w,E.isString(L)?L.trim():L,p,f))===!0&&y(w,p?p.concat(L):[L])}),m.pop()}}if(!E.isObject(e))throw new TypeError("data must be an object");return y(e),t}function Dn(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(s){return t[s]})}function on(e,t){this._pairs=[],e&&yt(e,this,t)}const Ms=on.prototype;Ms.append=function(t,n){this._pairs.push([t,n])};Ms.toString=function(t){const n=t?function(s){return t.call(this,s,Dn)}:Dn;return this._pairs.map(function(r){return n(r[0])+"="+n(r[1])},"").join("&")};function fl(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function ks(e,t,n){if(!t)return e;const s=n&&n.encode||fl,r=E.isFunction(n)?{serialize:n}:n,o=r&&r.serialize;let i;if(o?i=o(t,r):i=E.isURLSearchParams(t)?t.toString():new on(t,r).toString(s),i){const l=e.indexOf("#");l!==-1&&(e=e.slice(0,l)),e+=(e.indexOf("?")===-1?"?":"&")+i}return e}class Fn{constructor(){this.handlers=[]}use(t,n,s){return this.handlers.push({fulfilled:t,rejected:n,synchronous:s?s.synchronous:!1,runWhen:s?s.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){E.forEach(this.handlers,function(s){s!==null&&t(s)})}}const ln={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0},hl=typeof URLSearchParams<"u"?URLSearchParams:on,ml=typeof FormData<"u"?FormData:null,pl=typeof Blob<"u"?Blob:null,El={isBrowser:!0,classes:{URLSearchParams:hl,FormData:ml,Blob:pl},protocols:["http","https","file","blob","url","data"]},an=typeof window<"u"&&typeof document<"u",Gt=typeof navigator=="object"&&navigator||void 0,Al=an&&(!Gt||["ReactNative","NativeScript","NS"].indexOf(Gt.product)<0),yl=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",Tl=an&&window.location.href||"http://localhost",Sl=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:an,hasStandardBrowserEnv:Al,hasStandardBrowserWebWorkerEnv:yl,navigator:Gt,origin:Tl},Symbol.toStringTag,{value:"Module"})),ie={...Sl,...El};function Cl(e,t){return yt(e,new ie.classes.URLSearchParams,{visitor:function(n,s,r,o){return ie.isNode&&E.isBuffer(n)?(this.append(s,n.toString("base64")),!1):o.defaultVisitor.apply(this,arguments)},...t})}function gl(e){return E.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function bl(e){const t={},n=Object.keys(e);let s;const r=n.length;let o;for(s=0;s<r;s++)o=n[s],t[o]=e[o];return t}function $s(e){function t(n,s,r,o){let i=n[o++];if(i==="__proto__")return!0;const l=Number.isFinite(+i),a=o>=n.length;return i=!i&&E.isArray(r)?r.length:i,a?(E.hasOwnProp(r,i)?r[i]=[r[i],s]:r[i]=s,!l):((!r[i]||!E.isObject(r[i]))&&(r[i]=[]),t(n,s,r[i],o)&&E.isArray(r[i])&&(r[i]=bl(r[i])),!l)}if(E.isFormData(e)&&E.isFunction(e.entries)){const n={};return E.forEachEntry(e,(s,r)=>{t(gl(s),r,n,0)}),n}return null}function wl(e,t,n){if(E.isString(e))try{return(t||JSON.parse)(e),E.trim(e)}catch(s){if(s.name!=="SyntaxError")throw s}return(n||JSON.stringify)(e)}const Ke={transitional:ln,adapter:["xhr","http","fetch"],transformRequest:[function(t,n){const s=n.getContentType()||"",r=s.indexOf("application/json")>-1,o=E.isObject(t);if(o&&E.isHTMLForm(t)&&(t=new FormData(t)),E.isFormData(t))return r?JSON.stringify($s(t)):t;if(E.isArrayBuffer(t)||E.isBuffer(t)||E.isStream(t)||E.isFile(t)||E.isBlob(t)||E.isReadableStream(t))return t;if(E.isArrayBufferView(t))return t.buffer;if(E.isURLSearchParams(t))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let l;if(o){if(s.indexOf("application/x-www-form-urlencoded")>-1)return Cl(t,this.formSerializer).toString();if((l=E.isFileList(t))||s.indexOf("multipart/form-data")>-1){const a=this.env&&this.env.FormData;return yt(l?{"files[]":t}:t,a&&new a,this.formSerializer)}}return o||r?(n.setContentType("application/json",!1),wl(t)):t}],transformResponse:[function(t){const n=this.transitional||Ke.transitional,s=n&&n.forcedJSONParsing,r=this.responseType==="json";if(E.isResponse(t)||E.isReadableStream(t))return t;if(t&&E.isString(t)&&(s&&!this.responseType||r)){const i=!(n&&n.silentJSONParsing)&&r;try{return JSON.parse(t,this.parseReviver)}catch(l){if(i)throw l.name==="SyntaxError"?F.from(l,F.ERR_BAD_RESPONSE,this,null,this.response):l}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:ie.classes.FormData,Blob:ie.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};E.forEach(["delete","get","head","post","put","patch"],e=>{Ke.headers[e]={}});const Il=E.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),_l=e=>{const t={};let n,s,r;return e&&e.split(`
2
2
  `).forEach(function(i){r=i.indexOf(":"),n=i.substring(0,r).trim().toLowerCase(),s=i.substring(r+1).trim(),!(!n||t[n]&&Il[n])&&(n==="set-cookie"?t[n]?t[n].push(s):t[n]=[s]:t[n]=t[n]?t[n]+", "+s:s)}),t},jn=Symbol("internals"),Pl=e=>!/[\r\n]/.test(e);function Bs(e,t){if(!(e===!1||e==null)){if(E.isArray(e)){e.forEach(n=>Bs(n,t));return}if(!Pl(String(e)))throw new Error(`Invalid character in header content ["${t}"]`)}}function Me(e){return e&&String(e).trim().toLowerCase()}function xl(e){let t=e.length;for(;t>0;){const n=e.charCodeAt(t-1);if(n!==10&&n!==13)break;t-=1}return t===e.length?e:e.slice(0,t)}function ot(e){return e===!1||e==null?e:E.isArray(e)?e.map(ot):xl(String(e))}function Nl(e){const t=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let s;for(;s=n.exec(e);)t[s[1]]=s[2];return t}const Ol=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function Ot(e,t,n,s,r){if(E.isFunction(s))return s.call(this,t,n);if(r&&(t=n),!!E.isString(t)){if(E.isString(s))return t.indexOf(s)!==-1;if(E.isRegExp(s))return s.test(t)}}function Rl(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,n,s)=>n.toUpperCase()+s)}function vl(e,t){const n=E.toCamelCase(" "+t);["get","set","has"].forEach(s=>{Object.defineProperty(e,s+n,{value:function(r,o,i){return this[s].call(this,t,r,o,i)},configurable:!0})})}let ue=class{constructor(t){t&&this.set(t)}set(t,n,s){const r=this;function o(l,a,c){const u=Me(a);if(!u)throw new Error("header name must be a non-empty string");const m=E.findKey(r,u);(!m||r[m]===void 0||c===!0||c===void 0&&r[m]!==!1)&&(Bs(l,a),r[m||a]=ot(l))}const i=(l,a)=>E.forEach(l,(c,u)=>o(c,u,a));if(E.isPlainObject(t)||t instanceof this.constructor)i(t,n);else if(E.isString(t)&&(t=t.trim())&&!Ol(t))i(_l(t),n);else if(E.isObject(t)&&E.isIterable(t)){let l={},a,c;for(const u of t){if(!E.isArray(u))throw TypeError("Object iterator must return a key-value pair");l[c=u[0]]=(a=l[c])?E.isArray(a)?[...a,u[1]]:[a,u[1]]:u[1]}i(l,n)}else t!=null&&o(n,t,s);return this}get(t,n){if(t=Me(t),t){const s=E.findKey(this,t);if(s){const r=this[s];if(!n)return r;if(n===!0)return Nl(r);if(E.isFunction(n))return n.call(this,r,s);if(E.isRegExp(n))return n.exec(r);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,n){if(t=Me(t),t){const s=E.findKey(this,t);return!!(s&&this[s]!==void 0&&(!n||Ot(this,this[s],s,n)))}return!1}delete(t,n){const s=this;let r=!1;function o(i){if(i=Me(i),i){const l=E.findKey(s,i);l&&(!n||Ot(s,s[l],l,n))&&(delete s[l],r=!0)}}return E.isArray(t)?t.forEach(o):o(t),r}clear(t){const n=Object.keys(this);let s=n.length,r=!1;for(;s--;){const o=n[s];(!t||Ot(this,this[o],o,t,!0))&&(delete this[o],r=!0)}return r}normalize(t){const n=this,s={};return E.forEach(this,(r,o)=>{const i=E.findKey(s,o);if(i){n[i]=ot(r),delete n[o];return}const l=t?Rl(o):String(o).trim();l!==o&&delete n[o],n[l]=ot(r),s[l]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const n=Object.create(null);return E.forEach(this,(s,r)=>{s!=null&&s!==!1&&(n[r]=t&&E.isArray(s)?s.join(", "):s)}),n}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,n])=>t+": "+n).join(`
3
3
  `)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...n){const s=new this(t);return n.forEach(r=>s.set(r)),s}static accessor(t){const s=(this[jn]=this[jn]={accessors:{}}).accessors,r=this.prototype;function o(i){const l=Me(i);s[l]||(vl(r,i),s[l]=!0)}return E.isArray(t)?t.forEach(o):o(t),this}};ue.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);E.reduceDescriptors(ue.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(s){this[n]=s}}});E.freezeMethods(ue);function Rt(e,t){const n=this||Ke,s=t||n,r=ue.from(s.headers);let o=s.data;return E.forEach(e,function(l){o=l.call(n,o,r.normalize(),t?t.status:void 0)}),r.normalize(),o}function Ys(e){return!!(e&&e.__CANCEL__)}let We=class extends F{constructor(t,n,s){super(t??"canceled",F.ERR_CANCELED,n,s),this.name="CanceledError",this.__CANCEL__=!0}};function Hs(e,t,n){const s=n.config.validateStatus;!n.status||!s||s(n.status)?e(n):t(new F("Request failed with status code "+n.status,[F.ERR_BAD_REQUEST,F.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function Ll(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function Dl(e,t){e=e||10;const n=new Array(e),s=new Array(e);let r=0,o=0,i;return t=t!==void 0?t:1e3,function(a){const c=Date.now(),u=s[o];i||(i=c),n[r]=a,s[r]=c;let m=o,f=0;for(;m!==r;)f+=n[m++],m=m%e;if(r=(r+1)%e,r===o&&(o=(o+1)%e),c-i<t)return;const y=u&&c-u;return y?Math.round(f*1e3/y):void 0}}function Fl(e,t){let n=0,s=1e3/t,r,o;const i=(c,u=Date.now())=>{n=u,r=null,o&&(clearTimeout(o),o=null),e(...c)};return[(...c)=>{const u=Date.now(),m=u-n;m>=s?i(c,u):(r=c,o||(o=setTimeout(()=>{o=null,i(r)},s-m)))},()=>r&&i(r)]}const ct=(e,t,n=3)=>{let s=0;const r=Dl(50,250);return Fl(o=>{const i=o.loaded,l=o.lengthComputable?o.total:void 0,a=i-s,c=r(a),u=i<=l;s=i;const m={loaded:i,total:l,progress:l?i/l:void 0,bytes:a,rate:c||void 0,estimated:c&&l&&u?(l-i)/c:void 0,event:o,lengthComputable:l!=null,[t?"download":"upload"]:!0};e(m)},n)},Un=(e,t)=>{const n=e!=null;return[s=>t[0]({lengthComputable:n,total:e,loaded:s}),t[1]]},Mn=e=>(...t)=>E.asap(()=>e(...t)),jl=ie.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,ie.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(ie.origin),ie.navigator&&/(msie|trident)/i.test(ie.navigator.userAgent)):()=>!0,Ul=ie.hasStandardBrowserEnv?{write(e,t,n,s,r,o,i){if(typeof document>"u")return;const l=[`${e}=${encodeURIComponent(t)}`];E.isNumber(n)&&l.push(`expires=${new Date(n).toUTCString()}`),E.isString(s)&&l.push(`path=${s}`),E.isString(r)&&l.push(`domain=${r}`),o===!0&&l.push("secure"),E.isString(i)&&l.push(`SameSite=${i}`),document.cookie=l.join("; ")},read(e){if(typeof document>"u")return null;const t=document.cookie.match(new RegExp("(?:^|; )"+e+"=([^;]*)"));return t?decodeURIComponent(t[1]):null},remove(e){this.write(e,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function Ml(e){return typeof e!="string"?!1:/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function kl(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function Vs(e,t,n){let s=!Ml(t);return e&&(s||n==!1)?kl(e,t):t}const kn=e=>e instanceof ue?{...e}:e;function _e(e,t){t=t||{};const n={};function s(c,u,m,f){return E.isPlainObject(c)&&E.isPlainObject(u)?E.merge.call({caseless:f},c,u):E.isPlainObject(u)?E.merge({},u):E.isArray(u)?u.slice():u}function r(c,u,m,f){if(E.isUndefined(u)){if(!E.isUndefined(c))return s(void 0,c,m,f)}else return s(c,u,m,f)}function o(c,u){if(!E.isUndefined(u))return s(void 0,u)}function i(c,u){if(E.isUndefined(u)){if(!E.isUndefined(c))return s(void 0,c)}else return s(void 0,u)}function l(c,u,m){if(m in t)return s(c,u);if(m in e)return s(void 0,c)}const a={url:o,method:o,data:o,baseURL:i,transformRequest:i,transformResponse:i,paramsSerializer:i,timeout:i,timeoutMessage:i,withCredentials:i,withXSRFToken:i,adapter:i,responseType:i,xsrfCookieName:i,xsrfHeaderName:i,onUploadProgress:i,onDownloadProgress:i,decompress:i,maxContentLength:i,maxBodyLength:i,beforeRedirect:i,transport:i,httpAgent:i,httpsAgent:i,cancelToken:i,socketPath:i,responseEncoding:i,validateStatus:l,headers:(c,u,m)=>r(kn(c),kn(u),m,!0)};return E.forEach(Object.keys({...e,...t}),function(u){if(u==="__proto__"||u==="constructor"||u==="prototype")return;const m=E.hasOwnProp(a,u)?a[u]:r,f=m(e[u],t[u],u);E.isUndefined(f)&&m!==l||(n[u]=f)}),n}const qs=e=>{const t=_e({},e);let{data:n,withXSRFToken:s,xsrfHeaderName:r,xsrfCookieName:o,headers:i,auth:l}=t;if(t.headers=i=ue.from(i),t.url=ks(Vs(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),l&&i.set("Authorization","Basic "+btoa((l.username||"")+":"+(l.password?unescape(encodeURIComponent(l.password)):""))),E.isFormData(n)){if(ie.hasStandardBrowserEnv||ie.hasStandardBrowserWebWorkerEnv)i.setContentType(void 0);else if(E.isFunction(n.getHeaders)){const a=n.getHeaders(),c=["content-type","content-length"];Object.entries(a).forEach(([u,m])=>{c.includes(u.toLowerCase())&&i.set(u,m)})}}if(ie.hasStandardBrowserEnv&&(s&&E.isFunction(s)&&(s=s(t)),s||s!==!1&&jl(t.url))){const a=r&&o&&Ul.read(o);a&&i.set(r,a)}return t},$l=typeof XMLHttpRequest<"u",Bl=$l&&function(e){return new Promise(function(n,s){const r=qs(e);let o=r.data;const i=ue.from(r.headers).normalize();let{responseType:l,onUploadProgress:a,onDownloadProgress:c}=r,u,m,f,y,h;function p(){y&&y(),h&&h(),r.cancelToken&&r.cancelToken.unsubscribe(u),r.signal&&r.signal.removeEventListener("abort",u)}let A=new XMLHttpRequest;A.open(r.method.toUpperCase(),r.url,!0),A.timeout=r.timeout;function w(){if(!A)return;const C=ue.from("getAllResponseHeaders"in A&&A.getAllResponseHeaders()),_={data:!l||l==="text"||l==="json"?A.responseText:A.response,status:A.status,statusText:A.statusText,headers:C,config:e,request:A};Hs(function(S){n(S),p()},function(S){s(S),p()},_),A=null}"onloadend"in A?A.onloadend=w:A.onreadystatechange=function(){!A||A.readyState!==4||A.status===0&&!(A.responseURL&&A.responseURL.indexOf("file:")===0)||setTimeout(w)},A.onabort=function(){A&&(s(new F("Request aborted",F.ECONNABORTED,e,A)),A=null)},A.onerror=function(I){const _=I&&I.message?I.message:"Network Error",U=new F(_,F.ERR_NETWORK,e,A);U.event=I||null,s(U),A=null},A.ontimeout=function(){let I=r.timeout?"timeout of "+r.timeout+"ms exceeded":"timeout exceeded";const _=r.transitional||ln;r.timeoutErrorMessage&&(I=r.timeoutErrorMessage),s(new F(I,_.clarifyTimeoutError?F.ETIMEDOUT:F.ECONNABORTED,e,A)),A=null},o===void 0&&i.setContentType(null),"setRequestHeader"in A&&E.forEach(i.toJSON(),function(I,_){A.setRequestHeader(_,I)}),E.isUndefined(r.withCredentials)||(A.withCredentials=!!r.withCredentials),l&&l!=="json"&&(A.responseType=r.responseType),c&&([f,h]=ct(c,!0),A.addEventListener("progress",f)),a&&A.upload&&([m,y]=ct(a),A.upload.addEventListener("progress",m),A.upload.addEventListener("loadend",y)),(r.cancelToken||r.signal)&&(u=C=>{A&&(s(!C||C.type?new We(null,e,A):C),A.abort(),A=null)},r.cancelToken&&r.cancelToken.subscribe(u),r.signal&&(r.signal.aborted?u():r.signal.addEventListener("abort",u)));const L=Ll(r.url);if(L&&ie.protocols.indexOf(L)===-1){s(new F("Unsupported protocol "+L+":",F.ERR_BAD_REQUEST,e));return}A.send(o||null)})},Yl=(e,t)=>{const{length:n}=e=e?e.filter(Boolean):[];if(t||n){let s=new AbortController,r;const o=function(c){if(!r){r=!0,l();const u=c instanceof Error?c:this.reason;s.abort(u instanceof F?u:new We(u instanceof Error?u.message:u))}};let i=t&&setTimeout(()=>{i=null,o(new F(`timeout of ${t}ms exceeded`,F.ETIMEDOUT))},t);const l=()=>{e&&(i&&clearTimeout(i),i=null,e.forEach(c=>{c.unsubscribe?c.unsubscribe(o):c.removeEventListener("abort",o)}),e=null)};e.forEach(c=>c.addEventListener("abort",o));const{signal:a}=s;return a.unsubscribe=()=>E.asap(l),a}},Hl=function*(e,t){let n=e.byteLength;if(n<t){yield e;return}let s=0,r;for(;s<n;)r=s+t,yield e.slice(s,r),s=r},Vl=async function*(e,t){for await(const n of ql(e))yield*Hl(n,t)},ql=async function*(e){if(e[Symbol.asyncIterator]){yield*e;return}const t=e.getReader();try{for(;;){const{done:n,value:s}=await t.read();if(n)break;yield s}}finally{await t.cancel()}},$n=(e,t,n,s)=>{const r=Vl(e,t);let o=0,i,l=a=>{i||(i=!0,s&&s(a))};return new ReadableStream({async pull(a){try{const{done:c,value:u}=await r.next();if(c){l(),a.close();return}let m=u.byteLength;if(n){let f=o+=m;n(f)}a.enqueue(new Uint8Array(u))}catch(c){throw l(c),c}},cancel(a){return l(a),r.return()}},{highWaterMark:2})},Bn=64*1024,{isFunction:et}=E,Gl=(({Request:e,Response:t})=>({Request:e,Response:t}))(E.global),{ReadableStream:Yn,TextEncoder:Hn}=E.global,Vn=(e,...t)=>{try{return!!e(...t)}catch{return!1}},Kl=e=>{e=E.merge.call({skipUndefined:!0},Gl,e);const{fetch:t,Request:n,Response:s}=e,r=t?et(t):typeof fetch=="function",o=et(n),i=et(s);if(!r)return!1;const l=r&&et(Yn),a=r&&(typeof Hn=="function"?(h=>p=>h.encode(p))(new Hn):async h=>new Uint8Array(await new n(h).arrayBuffer())),c=o&&l&&Vn(()=>{let h=!1;const p=new Yn,A=new n(ie.origin,{body:p,method:"POST",get duplex(){return h=!0,"half"}}).headers.has("Content-Type");return p.cancel(),h&&!A}),u=i&&l&&Vn(()=>E.isReadableStream(new s("").body)),m={stream:u&&(h=>h.body)};r&&["text","arrayBuffer","blob","formData","stream"].forEach(h=>{!m[h]&&(m[h]=(p,A)=>{let w=p&&p[h];if(w)return w.call(p);throw new F(`Response type '${h}' is not supported`,F.ERR_NOT_SUPPORT,A)})});const f=async h=>{if(h==null)return 0;if(E.isBlob(h))return h.size;if(E.isSpecCompliantForm(h))return(await new n(ie.origin,{method:"POST",body:h}).arrayBuffer()).byteLength;if(E.isArrayBufferView(h)||E.isArrayBuffer(h))return h.byteLength;if(E.isURLSearchParams(h)&&(h=h+""),E.isString(h))return(await a(h)).byteLength},y=async(h,p)=>{const A=E.toFiniteNumber(h.getContentLength());return A??f(p)};return async h=>{let{url:p,method:A,data:w,signal:L,cancelToken:C,timeout:I,onDownloadProgress:_,onUploadProgress:U,responseType:S,headers:R,withCredentials:v="same-origin",fetchOptions:D}=qs(h),x=t||fetch;S=S?(S+"").toLowerCase():"text";let k=Yl([L,C&&C.toAbortSignal()],I),P=null;const N=k&&k.unsubscribe&&(()=>{k.unsubscribe()});let j;try{if(U&&c&&A!=="get"&&A!=="head"&&(j=await y(R,w))!==0){let J=new n(p,{method:"POST",body:w,duplex:"half"}),de;if(E.isFormData(w)&&(de=J.headers.get("content-type"))&&R.setContentType(de),J.body){const[ae,fe]=Un(j,ct(Mn(U)));w=$n(J.body,Bn,ae,fe)}}E.isString(v)||(v=v?"include":"omit");const M=o&&"credentials"in n.prototype,Y={...D,signal:k,method:A.toUpperCase(),headers:R.normalize().toJSON(),body:w,duplex:"half",credentials:M?v:void 0};P=o&&new n(p,Y);let H=await(o?x(P,D):x(p,Y));const V=u&&(S==="stream"||S==="response");if(u&&(_||V&&N)){const J={};["status","statusText","headers"].forEach(re=>{J[re]=H[re]});const de=E.toFiniteNumber(H.headers.get("content-length")),[ae,fe]=_&&Un(de,ct(Mn(_),!0))||[];H=new s($n(H.body,Bn,ae,()=>{fe&&fe(),N&&N()}),J)}S=S||"text";let K=await m[E.findKey(m,S)||"text"](H,h);return!V&&N&&N(),await new Promise((J,de)=>{Hs(J,de,{data:K,headers:ue.from(H.headers),status:H.status,statusText:H.statusText,config:h,request:P})})}catch(M){throw N&&N(),M&&M.name==="TypeError"&&/Load failed|fetch/i.test(M.message)?Object.assign(new F("Network Error",F.ERR_NETWORK,h,P,M&&M.response),{cause:M.cause||M}):F.from(M,M&&M.code,h,P,M&&M.response)}}},Wl=new Map,Gs=e=>{let t=e&&e.env||{};const{fetch:n,Request:s,Response:r}=t,o=[s,r,n];let i=o.length,l=i,a,c,u=Wl;for(;l--;)a=o[l],c=u.get(a),c===void 0&&u.set(a,c=l?new Map:Kl(t)),u=c;return c};Gs();const cn={http:cl,xhr:Bl,fetch:{get:Gs}};E.forEach(cn,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const qn=e=>`- ${e}`,zl=e=>E.isFunction(e)||e===null||e===!1;function Jl(e,t){e=E.isArray(e)?e:[e];const{length:n}=e;let s,r;const o={};for(let i=0;i<n;i++){s=e[i];let l;if(r=s,!zl(s)&&(r=cn[(l=String(s)).toLowerCase()],r===void 0))throw new F(`Unknown adapter '${l}'`);if(r&&(E.isFunction(r)||(r=r.get(t))))break;o[l||"#"+i]=r}if(!r){const i=Object.entries(o).map(([a,c])=>`adapter ${a} `+(c===!1?"is not supported by the environment":"is not available in the build"));let l=n?i.length>1?`since :
4
4
  `+i.map(qn).join(`
package/dist/index.js CHANGED
@@ -464,7 +464,7 @@ import './index.css';const $e = {
464
464
  "full_path",
465
465
  "fullPath",
466
466
  "formData"
467
- ], ee = (e, t = []) => {
467
+ ], ee = (e, t) => {
468
468
  const n = Array.isArray(t) ? [...Mn, ...t] : Mn;
469
469
  return e && typeof e == "object" ? Object.keys(e).reduce((r, s) => n.includes(s) ? r : {
470
470
  ...r,
@@ -10,5 +10,5 @@ export declare const JSON_ONLY_PROPERTIES: string[];
10
10
  * @param {Array} alsoRemove An array of additional properties to remove.
11
11
  * @returns A clean(er) JSON object.
12
12
  */
13
- declare const cleanAttributes: (options: any, alsoRemove?: never[]) => {};
13
+ declare const cleanAttributes: (options: any, alsoRemove?: string[]) => {};
14
14
  export default cleanAttributes;
@@ -1,5 +1,5 @@
1
1
  declare const Component: {
2
- clean: (options: any, alsoRemove?: never[]) => {};
2
+ clean: (options: any, alsoRemove?: string[]) => {};
3
3
  defaultValue: (component: any, formData: any) => any;
4
4
  defaultValueFromConfig: (component: any, data: any) => any;
5
5
  editable: (options: any) => any;
@@ -32,7 +32,7 @@ declare const Utils: {
32
32
  setData: (collectionName: any, newData: any, formData: any) => void;
33
33
  };
34
34
  Component: {
35
- clean: (options: any, alsoRemove?: never[]) => {};
35
+ clean: (options: any, alsoRemove?: string[]) => {};
36
36
  defaultValue: (component: any, formData: any) => any;
37
37
  defaultValueFromConfig: (component: any, data: any) => any;
38
38
  editable: (options: any) => any;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ukhomeoffice/cop-react-form-renderer",
3
- "version": "8.0.0-alpha.5",
3
+ "version": "8.0.0-alpha.6",
4
4
  "engines": {
5
5
  "node": "24.14.1"
6
6
  },
@@ -25,9 +25,9 @@
25
25
  },
26
26
  "peerDependencies": {
27
27
  "@ukhomeoffice/cop-react-components": "6.0.0",
28
+ "dayjs": "1.11.0",
28
29
  "react": ">=16.14.0 <20",
29
- "react-dom": ">=16.14.0 <20",
30
- "dayjs": "1.11.0"
30
+ "react-dom": ">=16.14.0 <20"
31
31
  },
32
32
  "devDependencies": {
33
33
  "@chromatic-com/storybook": "5.0.1",
@@ -64,6 +64,7 @@
64
64
  "react-dom": "19.2.4",
65
65
  "react-test-renderer": "19.2.4",
66
66
  "rimraf": "6.1.2",
67
+ "rollup-plugin-copy": "^3.5.0",
67
68
  "sass-embedded": "1.97.3",
68
69
  "storybook": "10.2.19",
69
70
  "storybook-addon-mock": "^6.0.1",