@streamline-pulse/formkrafter-wc 0.8.0 → 0.9.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/components/fk-brick-actions.js +1 -1
- package/dist/components/fk-brick-list.js +1 -1
- package/dist/components/fk-brick-mold-item.js +1 -1
- package/dist/components/fk-brick-render.js +1 -1
- package/dist/components/fk-data-grid.js +1 -1
- package/dist/components/fk-drop-area.js +1 -1
- package/dist/components/fk-empty-form.js +1 -1
- package/dist/components/fk-file-input.js +1 -1
- package/dist/components/fk-form-builder.js +1 -1
- package/dist/components/fk-form-render.js +1 -1
- package/dist/components/fk-property-panel.js +1 -1
- package/dist/components/fk-rules-editor.js +1 -1
- package/dist/components/fk-select-input.js +1 -1
- package/dist/components/fk-signature-input.js +1 -1
- package/dist/components/fk-stepper.js +1 -1
- package/dist/components/fk-tabs.js +1 -1
- package/dist/components/index.js +1 -1
- package/dist/components/{p-lfUyDMwX.js → p-BCqgyvtV.js} +1 -1
- package/dist/components/{p-B__57BXb.js → p-BHvB7bTK.js} +1 -1
- package/dist/components/{p-Dy32DQ32.js → p-BOci4bZM.js} +1 -1
- package/dist/components/{p-Bu01BUvZ.js → p-BcjMMe4U.js} +1 -1
- package/dist/components/{p-DxHWiCOh.js → p-BeygY7SP.js} +1 -1
- package/dist/components/{p-DBxl-MIH.js → p-Bk3JHlWR.js} +1 -1
- package/dist/components/{p-CQzlnCWY.js → p-Bx1eYPbI.js} +1 -1
- package/dist/components/{p-qAhhbDM0.js → p-C266Ip4W.js} +1 -1
- package/dist/components/{p-DmUc_MMe.js → p-C2fDSP_j.js} +1 -1
- package/dist/components/{p-CfD_xuFD.js → p-D0iVVR-D.js} +1 -1
- package/dist/components/{p-Ba_UlLpe.js → p-DDMzqPIV.js} +1 -1
- package/dist/components/{p-CjplV1cW.js → p-DtvNONUw.js} +1 -1
- package/dist/components/{p-S9BHdmDo.js → p-Dx5WODHP.js} +1 -1
- package/dist/components/{p-KJC4yRYy.js → p-PFzZmCG2.js} +1 -1
- package/dist/components/{p-DvaooIpr.js → p-ueg_vkWM.js} +1 -1
- package/dist/formkrafter-wc/formkrafter-wc.esm.js +1 -1
- package/dist/formkrafter-wc/index.esm.js +1 -1
- package/dist/formkrafter-wc/{p-dd9f50b2.entry.js → p-21e6dc4a.entry.js} +1 -1
- package/dist/formkrafter-wc/{p-9210eef9.entry.js → p-413cf62f.entry.js} +1 -1
- package/dist/formkrafter-wc/{p-DJXfHHdv.js → p-Q8V68B4U.js} +1 -1
- package/package.json +2 -2
|
@@ -9,4 +9,4 @@ function t(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"de
|
|
|
9
9
|
* https://github.com/Starcounter-Jack/JSON-Patch
|
|
10
10
|
* (c) 2017-2021 Joachim Wester
|
|
11
11
|
* MIT license
|
|
12
|
-
*/function ws(t,e){e.unobserve()}function bs(t,e){var i,r=function(t){return ys.get(t)}(t);if(r){var n=function(t,e){return t.observers.get(e)}(r,e);i=n&&n.observer}else r=new gs(t),ys.set(t,r);if(i)return i;if(i={},r.value=Xn(t),e){i.callback=e,i.next=null;var s=function(){_s(i)},o=function(){clearTimeout(i.next),i.next=setTimeout(s)};"undefined"!=typeof window&&(window.addEventListener("mouseup",o),window.addEventListener("keyup",o),window.addEventListener("mousedown",o),window.addEventListener("keydown",o),window.addEventListener("change",o))}return i.patches=[],i.object=t,i.unobserve=function(){_s(i),clearTimeout(i.next),function(t,e){t.observers.delete(e.callback)}(r,i),"undefined"!=typeof window&&(window.removeEventListener("mouseup",o),window.removeEventListener("keyup",o),window.removeEventListener("mousedown",o),window.removeEventListener("keydown",o),window.removeEventListener("change",o))},r.observers.set(e,new $s(e,i)),i}function _s(t,e){void 0===e&&(e=!1);var i=ys.get(t.object);Es(i.value,t.object,t.patches,"",e),t.patches.length&&fs(i.value,t.patches);var r=t.patches;return r.length>0&&(t.patches=[],t.callback&&t.callback(r)),r}function Es(t,e,i,r,n){if(e!==t){"function"==typeof e.toJSON&&(e=e.toJSON());for(var s=Qn(e),o=Qn(t),a=!1,h=o.length-1;h>=0;h--){var u=t[f=o[h]];if(!Yn(e,f)||void 0===e[f]&&void 0!==u&&!1===Array.isArray(e))Array.isArray(t)===Array.isArray(e)?(n&&i.push({op:"test",path:r+"/"+es(f),value:Xn(u)}),i.push({op:"remove",path:r+"/"+es(f)}),a=!0):(n&&i.push({op:"test",path:r,value:t}),i.push({op:"replace",path:r,value:e}));else{var c=e[f];"object"==typeof u&&null!=u&&"object"==typeof c&&null!=c&&Array.isArray(u)===Array.isArray(c)?Es(u,c,i,r+"/"+es(f),n):u!==c&&(n&&i.push({op:"test",path:r+"/"+es(f),value:Xn(u)}),i.push({op:"replace",path:r+"/"+es(f),value:Xn(c)}))}}if(a||s.length!=o.length)for(h=0;h<s.length;h++){var f;Yn(t,f=s[h])||void 0===e[f]||i.push({op:"add",path:r+"/"+es(f),value:Xn(e[f])})}}}function ks(t,e,i){void 0===i&&(i=!1);var r=[];return Es(t,e,r,"",i),r}var Ss=Object.assign({},vs,Object.freeze({__proto__:null,compare:ks,generate:_s,observe:bs,unobserve:ws}),{JsonPatchError:ss,deepClone:Xn,escapePathComponent:es,unescapePathComponent:is}),xs=Object.freeze({__proto__:null,JsonPatchError:ss,_areEquals:ms,applyOperation:cs,applyPatch:fs,applyReducer:ls,compare:ks,deepClone:Xn,default:Ss,escapePathComponent:es,generate:_s,getValueByPointer:us,observe:bs,unescapePathComponent:is,unobserve:ws,validate:ps,validator:ds});function Os(t){return"object"==typeof t&&null!==t&&!Array.isArray(t)&&Object.keys(t).length>0&&Object.values(t).every((t=>"string"==typeof t))}function js(t,e){return Os(t)?e&&void 0!==t[e]?t[e]:Object.values(t)[0]:t}function Ps(t,e){if(!t)return t;const i={};for(const[r,n]of Object.entries(t))i[r]=js(n,e);return i}var Is={en:{required:"This field is required",minLength:"Must be at least {value} characters",maxLength:"Must be at most {value} characters",min:"Must be at least {value}",max:"Must be at most {value}",pattern:"Invalid format",minItems:"Select at least {value} item(s)",maxItems:"Select at most {value} item(s)",email:"Invalid email address",url:"Invalid URL",type:"Invalid value",custom:"Invalid value"},fr:{required:"Ce champ est obligatoire",minLength:"Minimum {value} caractères",maxLength:"Maximum {value} caractères",min:"Minimum {value}",max:"Maximum {value}",pattern:"Format invalide",minItems:"Sélectionnez au moins {value} élément(s)",maxItems:"Sélectionnez au plus {value} élément(s)",email:"Adresse email invalide",url:"URL invalide",type:"Valeur invalide",custom:"Valeur invalide"}};function Cs(t,e,i){return((Is[e??"en"]??Is.en)[t]??Is.en[t]??"Invalid value").replace("{value}",String(i??""))}function*As(t,e="0"){if(t){yield{brick:t,path:e};for(const[i,r]of(t.children??[]).entries())yield*As(r,`${e}.${i}`)}}function*Ns(t){if(t&&(yield t,"collection"!==t.type))for(const e of t.children??[])yield*Ns(e)}function Ts(t,e){if(t.configs?.key&&e)return t.unWrapData?e:e[t.configs.key]}function Ms(t,e){if(t.configs?.key)return t.unWrapData?e:{[t.configs.key]:e}}var Rs=(t,e)=>{if(!e.includes("."))return t[e];let i=t;for(const t of e.split(".")){if("object"!=typeof i||null===i)return;i=i[t]}return i};function Ds(t,e="label",i="value"){return Array.isArray(t)?t.map((t=>{if("object"==typeof t&&null!==t){const r=t,n=Rs(r,e)??Rs(r,i),s=Rs(r,i)??Rs(r,e);return{label:String(n??""),value:String(s??"")}}return{label:String(t),value:String(t)}})).filter((t=>""!==t.label)):String(t??"").split("\n").map((t=>t.trim())).filter(Boolean).map((t=>({label:t,value:t})))}class Ls{type;dataType;id;name;configsForm;category;styles;unWrapData;isPrivate;validators;defaultConfigs;constructor(t){this.type=t.type,this.dataType=t.dataType,this.id=t.id,this.name=t.name,this.configsForm=t.configsForm,this.category=t.category,this.styles=t.styles,this.unWrapData=t.unWrapData??!1,this.isPrivate=t.isPrivate??!1,this.validators=t.validators??[],this.defaultConfigs=t.defaultConfigs}getBrickEmptySpec(){return{type:this.type,dataType:this.dataType,id:this.id,name:this.name,...void 0!==this.category?{category:this.category}:{},...void 0!==this.configsForm?{configsForm:this.configsForm}:{},...void 0!==this.styles?{styles:this.styles}:{},...void 0!==this.defaultConfigs?{configs:{...this.defaultConfigs}}:{},validators:this.validators}}}var zs=new Set(["__proto__","constructor","prototype"]);class Us{value;constructor(t){this.value=t}}var qs=(t,e,i)=>{t.scopes[t.scopes.length-1].set(e,i)},Fs=t=>{if("number"==typeof t)return t;const e=String(t);if(zs.has(e))throw new Error(`Access to "${e}" is not allowed`);return e},Vs=(t,e)=>({object:Bs(t,e.object),prop:Fs(e.computed?Bs(t,e.property):e.property.name),optional:!0===e.optional}),Bs=(t,e)=>{if(++t.steps>1e5)throw new Error("Sandbox execution budget exceeded");switch(e.type){case"Program":case"BlockStatement":for(const i of e.body){const e=Bs(t,i);if(e instanceof Us)return e}return;case"ReturnStatement":return new Us(e.argument?Bs(t,e.argument):void 0);case"IfStatement":return Bs(t,e.test)?Bs(t,e.consequent):e.alternate?Bs(t,e.alternate):void 0;case"VariableDeclaration":for(const i of e.declarations){const e=i.id;if("Identifier"!==e.type)throw new Error("Only simple variable names are supported");qs(t,e.name,i.init?Bs(t,i.init):void 0)}return;case"ExpressionStatement":return void Bs(t,e.expression);case"Literal":return e.value;case"TemplateLiteral":{const i=e.expressions;let r="";return e.quasis.forEach(((e,n)=>{r+=e.value.cooked??"",n<i.length&&(r+=String(Bs(t,i[n])))})),r}case"Identifier":return((t,e)=>{for(let i=t.scopes.length-1;i>=0;i--)if(t.scopes[i].has(e))return t.scopes[i].get(e);throw new Error(`Unknown identifier "${e}"`)})(t,e.name);case"ThisExpression":return;case"ChainExpression":return Bs(t,e.expression);case"MemberExpression":return((t,e)=>{const{object:i,prop:r,optional:n}=Vs(t,e);if(null==i){if(n)return;throw new Error(`Cannot read "${String(r)}" of ${String(i)}`)}return i[r]})(t,e);case"CallExpression":{const i=e.callee,r=[];for(const i of e.arguments)if("SpreadElement"===i.type){const e=Bs(t,i.argument);Array.isArray(e)&&r.push(...e)}else r.push(Bs(t,i));if("MemberExpression"===i.type){const{object:n,prop:s,optional:o}=Vs(t,i);if(null==n){if(o||!0===e.optional)return;throw new Error(`Cannot call "${String(s)}" of ${String(n)}`)}const a=n[s];if("function"!=typeof a){if(!0===e.optional&&null==a)return;throw new Error(`"${String(s)}" is not a function`)}if(a===Function||a===eval)throw new Error("This function is not allowed");return a.apply(n,r)}const n=Bs(t,i);if("function"!=typeof n){if(!0===e.optional&&null==n)return;throw new Error("Value is not a function")}if(n===Function||n===eval)throw new Error("This function is not allowed");return n(...r)}case"ArrowFunctionExpression":{const i=e.params,r=e.body,n=[...t.scopes];return(...s)=>{const o=new Map;i.forEach(((t,e)=>{if("Identifier"!==t.type)throw new Error("Only simple parameters are supported");o.set(t.name,s[e])}));const a={steps:t.steps,scopes:[...n,o]},h=Bs(a,r);return t.steps=a.steps,h instanceof Us?h.value:!0===e.expression?h:void 0}}case"BinaryExpression":{const i=Bs(t,e.left),r=Bs(t,e.right);switch(e.operator){case"===":return i===r;case"!==":return i!==r;case"==":return i==r;case"!=":return i!=r;case"<":return i<r;case"<=":return i<=r;case">":return i>r;case">=":return i>=r;case"+":return i+r;case"-":return i-r;case"*":return i*r;case"/":return i/r;case"%":return i%r;case"**":return i**r;default:throw new Error(`Unsupported operator "${String(e.operator)}"`)}}case"LogicalExpression":{const i=Bs(t,e.left);switch(e.operator){case"&&":return i&&Bs(t,e.right);case"||":return i||Bs(t,e.right);case"??":return i??Bs(t,e.right);default:throw new Error(`Unsupported operator "${String(e.operator)}"`)}}case"UnaryExpression":{const i=Bs(t,e.argument);switch(e.operator){case"!":return!i;case"-":return-i;case"+":return+i;case"typeof":return typeof i;default:throw new Error(`Unsupported operator "${String(e.operator)}"`)}}case"ConditionalExpression":return Bs(t,e.test)?Bs(t,e.consequent):Bs(t,e.alternate);case"AssignmentExpression":{const i=e.left;if("Identifier"!==i.type||"="!==e.operator)throw new Error("Only simple assignments are supported");const r=Bs(t,e.right);return((t,e,i)=>{for(let r=t.scopes.length-1;r>=0;r--)if(t.scopes[r].has(e))return void t.scopes[r].set(e,i);throw new Error(`Cannot assign to unknown identifier "${e}"`)})(t,i.name,r),r}case"ArrayExpression":{const i=[];for(const r of e.elements)if(r)if("SpreadElement"===r.type){const e=Bs(t,r.argument);Array.isArray(e)&&i.push(...e)}else i.push(Bs(t,r));return i}case"ObjectExpression":{const i={};for(const r of e.properties){if("SpreadElement"===r.type){const e=Bs(t,r.argument);if(e&&"object"==typeof e)for(const[t,r]of Object.entries(e))i[String(Fs(t))]=r;continue}const e=r.key,n=Fs(r.computed?Bs(t,e):"Identifier"===e.type?e.name:e.value);i[String(n)]=Bs(t,r.value)}return i}default:throw new Error(`Unsupported syntax: ${e.type}`)}},Gs={undefined:void 0,NaN:NaN,Infinity:1/0,Math,JSON,Number,String,Boolean,Array,Object,Date,parseInt,parseFloat,isNaN,isFinite};class Hs{defaults;cache=new Map;constructor(t={}){this.defaults=t}resolveUrl(t){return/^https?:\/\//.test(t)||!this.defaults.baseUrl?t:`${this.defaults.baseUrl.replace(/\/$/,"")}/${t.replace(/^\//,"")}`}fetchSpec(t){const e=this.resolveUrl(t);let i=this.cache.get(e);return i||(i=(this.defaults.fetch??globalThis.fetch.bind(globalThis))(e,{headers:this.defaults.headers,credentials:this.defaults.credentials}).then((async e=>{if(!e.ok)throw new Error(`Failed to load spec "${t}" (${e.status})`);return await e.json()})),i.catch((()=>this.cache.delete(e))),this.cache.set(e,i)),i}}class Ks{defaults;cache=new Map;constructor(t={}){this.defaults=t}resolveUrl(t){return/^https?:\/\//.test(t)||!this.defaults.baseUrl?t:`${this.defaults.baseUrl.replace(/\/$/,"")}/${t.replace(/^\//,"")}`}fetchOptions(t){const e=this.resolveUrl(t);let i=this.cache.get(e);return i||(i=(this.defaults.fetch??globalThis.fetch.bind(globalThis))(e,{headers:this.defaults.headers,credentials:this.defaults.credentials}).then((async e=>{if(!e.ok)throw new Error(`Failed to load options "${t}" (${e.status})`);return await e.json()})),i.catch((()=>this.cache.delete(e))),this.cache.set(e,i)),i}}var Js=Symbol.for("formkrafter.core.services"),Ws=globalThis,Zs=Ws[Js]??={jsRunnerService:new class{validateJs(t,e={ecmaVersion:"latest",allowReturnOutsideFunction:!0}){try{return Yt(t,e),{valid:!0}}catch(t){return{valid:!1,error:t instanceof Error?t:new Error(String(t))}}}eval(t,e={}){return function(t,e={}){const i=Yt(t,{ecmaVersion:"latest",allowReturnOutsideFunction:!0}),r={steps:0,scopes:[new Map(Object.entries({...Gs,...e})),new Map]},n=Bs(r,i);return n instanceof Us?n.value:void 0}(t,e)}},dataSourceService:new class{defaults;cache=new Map;constructor(t={}){this.defaults=t}fetchOptions(t,e){const i={...this.defaults.headers,...e?.headers},r={};Object.keys(i).length&&(r.headers=i),this.defaults.credentials&&(r.credentials=this.defaults.credentials);const n=`${t}|${JSON.stringify(r)}`;let s=this.cache.get(n);return s||(s=fetch(t,Object.keys(r).length?r:void 0).then((e=>{if(!e.ok)throw new Error(`Data source request failed (${e.status}): ${t}`);return e.json()})).then((t=>Array.isArray(t)?t:[])).catch((t=>{throw this.cache.delete(n),t})),this.cache.set(n,s)),s}},fileUploadService:new class{async upload(t){const e=globalThis.btoa;if(!e)throw new Error("No base64 encoder available");const i=new Uint8Array(await t.arrayBuffer());let r="";for(const t of i)r+=String.fromCharCode(t);return{name:t.name,type:t.type,size:t.size,url:`data:${t.type};base64,${e(r)}`}}},specSourceService:new Hs,optionSourceService:new Ks};Zs.specSourceService??=new Hs,Zs.optionSourceService??=new Ks;var Ys=(t,e)=>{try{return Zs.jsRunnerService.eval(t,{dataMap:e??{}})}catch(t){return t instanceof Error?t:new Error(String(t))}},Qs=(t,e)=>((t,e)=>((t,e)=>t?.filter((t=>((t,e)=>"jsonLogic"===t.type?null!=t.logic&&!0===n.apply(t.logic,e):"javaScript"===t.type&&!!t.code&&!0===Ys(t.code,e))(t,e))))(t,e)?.map((t=>t.effects)).flat().filter((t=>null!=t)))(t,e)?.map((t=>{let i;return t.property?("boolean"===t.property.type?i=t.boolean:"logic"===t.property.type&&null!=t.logic?i=n.apply(t.logic,e):"code"===t.property.type&&t.code?i=Ys(t.code,e):"string"===t.property.type&&(i=t.string),{[t.property.target]:i}):{}})).flat().reduce(((t,e)=>({...t,...e})),{})??{hidden:!1},Xs=new Un.Ajv({allErrors:!0});Jn(Xs,["email","uri"]),Vn(Xs);var to=new WeakMap,eo=t=>{if("required"===t.keyword)return t.params.missingProperty;if("errorMessage"===t.keyword){const e=t.params.errors?.[0];return e?eo(e):void 0}return t.instancePath.split("/").filter(Boolean)[0]},io=(t,e,i)=>{const r={},n=((t,e)=>{let i=to.get(t);i||(i=new Map,to.set(t,i));const r=e??"";let n=i.get(r);if(!n){const s=function(t,e){if(!t)return;const i={},r=[],n={},s=t=>{const i=js(t,e);return"string"==typeof i?i:void 0};for(const o of Ns(t)){const t=o.configs?.key,a=!0===o.configs?.multiple&&"object"===o.dataType?"array":o.dataType;if(!t||!a||"void"===a)continue;const h=o.validations?.find((t=>"required"===t.validator)),u={type:a,nullable:!h},c={type:Cs("type",e)};for(const t of o.validations??[]){const{validator:i,value:r}=t,n=s(t.message)??Cs(i,e,r);"minLength"===i&&null!=r?(u.minLength=Number(r),c.minLength=n):"maxLength"===i&&null!=r?(u.maxLength=Number(r),c.maxLength=n):"min"===i&&null!=r?(u.minimum=Number(r),c.minimum=n):"max"===i&&null!=r?(u.maximum=Number(r),c.maximum=n):"pattern"===i&&"string"==typeof r&&r?(u.pattern=r,c.pattern=n):"minItems"===i&&null!=r?(u.minItems=Number(r),c.minItems=n):"maxItems"===i&&null!=r?(u.maxItems=Number(r),c.maxItems=n):"email"===i?(u.format="email",c.format=n):"url"===i&&(u.format="uri",c.format=n)}u.errorMessage=c,i[t]=u,h&&(r.push(t),n[t]=s(h.message)??Cs("required",e))}return{type:"object",properties:i,required:r,...Object.keys(n).length?{errorMessage:{required:n}}:{},additionalProperties:!1}}(t,e);if(!s)return;try{n=Xs.compile(s)}catch{return}i.set(r,n)}return n})(t,i);if(n&&!n(e))for(const t of n.errors??[]){const e=eo(t);e&&!(e in r)&&t.message&&(r[e]=t.message)}for(const[n,s]of Object.entries(((t,e,i)=>{const r={},n=e??{};for(const e of Ns(t)){const t=e.configs?.key;if(t)for(const s of e.validations??[]){if("custom"!==s.validator||!s.customValidator)continue;const e=Ys(`const value = dataMap?.[${JSON.stringify(t)}];\n${s.customValidator}`,n);if(!0!==e&&null!=e&&!(t in r))if("string"==typeof e)r[t]=e;else if(e instanceof Error)r[t]=e.message;else{const e=js(s.message,i);r[t]="string"==typeof e?e:Cs("custom",i)}}}return r})(t,e,i)))n in r||(r[n]=s);const s="object"==typeof e&&null!==e?e:void 0;for(const e of((t,e)=>{const i=new Set,r=(t,n)=>{const s=n||!!t.rules?.length&&!0===Qs(t.rules,e).hidden,o=t.configs?.key;if(s&&o&&i.add(o),"collection"!==t.type)for(const e of t.children??[])r(e,s)};return r(t,!1),i})(t,s))delete r[e];return{valid:0===Object.keys(r).length,errors:r}},ro={"palette.search":"Search bricks…","palette.empty":"No brick matches “{query}”","builder.undo":"Undo","builder.redo":"Redo","builder.editLocale":"Editing language","builder.copyJson":"Copy JSON","builder.importJson":"Import JSON","builder.importInvalid":"Invalid form JSON","builder.pasteHint":"Press Ctrl+V to paste a spec","builder.copied":"Copied!","builder.downloadJson":"Download .json","builder.hint":"Select a brick to edit its properties","drop.hint":"Drop a brick here","empty.title":"Your form is empty","empty.hint":"Drag a brick from the palette to get started","actions.move":"Move","actions.duplicate":"Duplicate","actions.delete":"Delete","stepper.back":"← Back","stepper.next":"Next →","stepper.submit":"Submit","panel.cfg.validateSteps":"Validate each step","panel.cfg.allowStepClick":"Allow clicking steps to jump","panel.cfg.showSubmit":"Submit button on last step","panel.cfg.validateTabs":"Validate tab before leaving it","signature.clear":"Clear","panel.tab.config":"Config","panel.tab.validation":"Validation","panel.tab.styles":"Styles","panel.tab.rules":"Rules","panel.key":"Key","panel.label":"Label","panel.placeholder":"Placeholder","panel.prefix":"Prefix","panel.suffix":"Suffix","panel.accept":"Accepted file types","panel.mask":"Input mask (9=digit, a=letter, *=any)","panel.uploadUrl":"Upload URL","panel.cfg.multiple":"Allow multiple files","panel.optionsSource":"Options source","panel.options":"Options (one per line)","panel.content":"Content","panel.dataKey":"Data key","panel.url":"URL","panel.headers":"Headers ({token} reads form data)","panel.searchParam":"Server search param","panel.labelKey":"Label key","panel.valueKey":"Value key","panel.errorMessage":"Error message","panel.required":"Required","panel.minLength":"Min length","panel.maxLength":"Max length","panel.min":"Min","panel.max":"Max","panel.pattern":"Pattern (regex)","panel.minItems":"Min items","panel.maxItems":"Max items","panel.emailFormat":"Email format","panel.urlFormat":"URL format","panel.custom":"Custom (JavaScript)","panel.fallbackMessage":"Fallback message","panel.styleProperty":"property","panel.styleValue":"value","file.choose":"Choose a file…","file.uploading":"Uploading…","file.remove":"Remove file","file.addAnother":"+ Add a file","address.street":"Street","address.city":"City","address.zip":"Postal code","address.country":"Country","grid.addRow":"+ Add row","grid.moveUp":"Move row up","grid.moveDown":"Move row down","grid.removeRow":"Remove row","grid.empty":"No rows yet","grid.columns":"Row template","select.search":"Search…","select.empty":"No options","select.clear":"Clear","rules.when":"When","rules.then":"Then","rules.addRule":"+ Add rule","rules.addEffect":"+ Effect","rules.removeRule":"Remove rule","rules.removeEffect":"Remove effect","rules.mode.simple":"simple","rules.mode.json":"json","rules.mode.js":"JS","category.Inputs":"Inputs","category.Layout":"Layout","category.Data":"Data","brick.text.name":"Text","brick.email.name":"Email","brick.password.name":"Password","brick.url.name":"URL","brick.phone.name":"Phone","brick.textarea.name":"Text area","brick.number.name":"Number","brick.date.name":"Date","brick.time.name":"Time","brick.datetime.name":"Date / Time","brick.select.name":"Select","brick.multi-select.name":"Multi select","brick.radio.name":"Radio","brick.select-boxes.name":"Select boxes","brick.checkbox.name":"Checkbox","brick.tags.name":"Tags","brick.signature.name":"Signature","brick.data-grid.name":"Data grid","brick.address.name":"Address","brick.file.name":"File","brick.hidden.name":"Hidden","brick.content.name":"Content","brick.recap.name":"Recap","brick.nested-form.name":"Nested form","brick.code.name":"Code","nestedForm.ref":"Referenced form","nestedForm.missing":"Set the specRef config to reference a form.","nestedForm.loading":"Loading nested forms…","panel.specRef":"Referenced form (specRef)","panel.optionsRef":"Options catalog (optionsRef)","recap.empty":"Nothing to summarize yet.","recap.yes":"Yes","recap.no":"No","panel.cfg.showEmpty":"Show empty fields","panel.cfg.groupBySections":"Group by section","brick.group.name":"Group","brick.row.name":"Row","brick.column.name":"Column","brick.stepper.name":"Stepper","brick.tabs.name":"Tabs"},no={"palette.search":"Rechercher une brique…","palette.empty":"Aucune brique ne correspond à « {query} »","builder.undo":"Annuler","builder.editLocale":"Langue d'édition","builder.redo":"Rétablir","builder.copyJson":"Copier le JSON","builder.importJson":"Importer le JSON","builder.importInvalid":"JSON de formulaire invalide","builder.pasteHint":"Collez avec Ctrl+V pour importer une spec","builder.copied":"Copié !","builder.downloadJson":"Télécharger le .json","builder.hint":"Sélectionnez une brique pour éditer ses propriétés","drop.hint":"Déposez une brique ici","empty.title":"Votre formulaire est vide","empty.hint":"Glissez une brique depuis la palette pour commencer","actions.move":"Déplacer","actions.duplicate":"Dupliquer","actions.delete":"Supprimer","stepper.back":"← Précédent","stepper.next":"Suivant →","stepper.submit":"Envoyer","panel.cfg.validateSteps":"Valider chaque étape","panel.cfg.allowStepClick":"Autoriser le saut d’étapes au clic","panel.cfg.showSubmit":"Bouton d’envoi à la dernière étape","panel.cfg.validateTabs":"Valider l’onglet avant de le quitter","signature.clear":"Effacer","panel.tab.config":"Config","panel.tab.validation":"Validation","panel.tab.styles":"Styles","panel.tab.rules":"Règles","panel.key":"Clé","panel.label":"Libellé","panel.placeholder":"Placeholder","panel.prefix":"Préfixe","panel.suffix":"Suffixe","panel.accept":"Types de fichiers acceptés","panel.mask":"Masque de saisie (9=chiffre, a=lettre, *=tout)","panel.uploadUrl":"URL d'upload","panel.cfg.multiple":"Autoriser plusieurs fichiers","panel.optionsSource":"Source des options","panel.options":"Options (une par ligne)","panel.content":"Contenu","panel.dataKey":"Clé de données","panel.url":"URL","panel.headers":"En-têtes ({token} lit les données du formulaire)","panel.searchParam":"Paramètre de recherche serveur","panel.labelKey":"Clé du libellé","panel.valueKey":"Clé de la valeur","panel.errorMessage":"Message d'erreur","panel.required":"Obligatoire","panel.minLength":"Longueur min","panel.maxLength":"Longueur max","panel.min":"Min","panel.max":"Max","panel.pattern":"Motif (regex)","panel.minItems":"Éléments min","panel.maxItems":"Éléments max","panel.emailFormat":"Format email","panel.urlFormat":"Format URL","panel.custom":"Personnalisé (JavaScript)","panel.fallbackMessage":"Message par défaut","panel.styleProperty":"propriété","panel.styleValue":"valeur","file.choose":"Choisir un fichier…","file.uploading":"Envoi en cours…","file.remove":"Retirer le fichier","file.addAnother":"+ Ajouter un fichier","address.street":"Rue","address.city":"Ville","address.zip":"Code postal","address.country":"Pays","grid.addRow":"+ Ajouter une ligne","grid.moveUp":"Monter la ligne","grid.moveDown":"Descendre la ligne","grid.removeRow":"Supprimer la ligne","grid.empty":"Aucune ligne","grid.columns":"Modèle de ligne","select.search":"Rechercher…","select.empty":"Aucune option","select.clear":"Effacer","rules.when":"Quand","rules.then":"Alors","rules.addRule":"+ Ajouter une règle","rules.addEffect":"+ Effet","rules.removeRule":"Supprimer la règle","rules.removeEffect":"Supprimer l'effet","rules.mode.simple":"simple","rules.mode.json":"json","rules.mode.js":"JS","category.Inputs":"Champs","category.Layout":"Mise en page","category.Data":"Données","brick.text.name":"Texte","brick.email.name":"Email","brick.password.name":"Mot de passe","brick.url.name":"URL","brick.phone.name":"Téléphone","brick.textarea.name":"Zone de texte","brick.number.name":"Nombre","brick.date.name":"Date","brick.time.name":"Heure","brick.datetime.name":"Date / Heure","brick.select.name":"Liste déroulante","brick.multi-select.name":"Sélection multiple","brick.radio.name":"Boutons radio","brick.select-boxes.name":"Cases à cocher","brick.checkbox.name":"Case à cocher","brick.tags.name":"Étiquettes","brick.signature.name":"Signature","brick.data-grid.name":"Grille de données","brick.address.name":"Adresse","brick.file.name":"Fichier","brick.hidden.name":"Caché","brick.content.name":"Contenu","brick.recap.name":"Récapitulatif","brick.nested-form.name":"Formulaire imbriqué","brick.code.name":"Code","nestedForm.ref":"Formulaire référencé","nestedForm.missing":"Renseignez la config specRef pour référencer un formulaire.","nestedForm.loading":"Chargement des formulaires imbriqués…","panel.specRef":"Formulaire référencé (specRef)","panel.optionsRef":"Catalogue d'options (optionsRef)","recap.empty":"Rien à récapituler pour le moment.","recap.yes":"Oui","recap.no":"Non","panel.cfg.showEmpty":"Afficher les champs vides","panel.cfg.groupBySections":"Regrouper par section","brick.group.name":"Groupe","brick.row.name":"Ligne","brick.column.name":"Colonne","brick.stepper.name":"Étapes","brick.tabs.name":"Onglets"},so=Symbol.for("formkrafter.i18n"),oo=globalThis,ao=oo[so]??={current:{...ro}};function ho(t={}){ao.current={...ro,...t}}function uo(t,e){let i=ao.current[t]??t;for(const[t,r]of Object.entries(e??{}))i=i.replace(`{${t}}`,String(r));return i}function co(t,e){return ao.current[t]??e}function fo(t){return t.split(".").slice(1).map((t=>`/children/${t}`)).join("")}function lo(t,e){if(t.configs?.uid===e)return"";for(const[i,r]of(t.children??[]).entries()){const t=lo(r,e);if(void 0!==t)return`/children/${i}${t}`}}function po(t,e){let i=t;for(const t of e.split(".").slice(1))i=i?.children?.[Number(t)];return i}var mo=(Ss??xs).applyPatch,vo=(t,e,i)=>({spec:mo(t,e,!0,!1).newDocument,patches:e,inverse:i}),yo=(t,e)=>{const i=po(t,e);if(!i)throw new Error(`No brick at path "${e}"`);return i},go=(t,e)=>{const i=lo(t,e);if(void 0===i)throw new Error(`No brick with uid "${e}"`);let r=t;for(const t of i.split("/children/").slice(1))r=r.children[Number(t)];return{pointer:i,brick:r}},$o=t=>JSON.parse(JSON.stringify(t));function wo(t,e,i,r){const n=yo(t,i),s=fo(i),o=$o(e);if(!n.children){const e=`${s}/children`;return vo(t,[{op:"add",path:e,value:[o]}],[{op:"remove",path:e}])}const a=`${s}/children/${Math.min(r??n.children.length,n.children.length)}`;return vo(t,[{op:"add",path:a,value:o}],[{op:"remove",path:a}])}function bo(t,e){if("0"===e)throw new Error("Cannot remove the root brick");const i=yo(t,e),r=fo(e);return vo(t,[{op:"remove",path:r}],[{op:"add",path:r,value:i}])}function _o(t,e,i){if("0"===e||"0"===i)throw new Error("Cannot move the root brick");const r=yo(t,e),n=e.split(".").map(Number),s=i.split(".").map(Number),o=n.length-1,a=n[o],h=s.length>o&&n.slice(0,o).every(((t,e)=>t===s[e])),u=[...s];if(h){if(u[o]===a&&u.length>n.length)throw new Error(`Cannot move a brick into its own subtree ("${e}" → "${i}")`);u[o]>a&&(u[o]-=1)}const c=fo(e),f=fo(u.join("."));return vo(t,[{op:"remove",path:c},{op:"add",path:f,value:r}],[{op:"remove",path:f},{op:"add",path:c,value:r}])}var Eo=t=>({...t,...t.configs?{configs:{...t.configs,uid:crypto.randomUUID()}}:{},...t.children?{children:t.children.map(Eo)}:{}});function ko(t,e){if("0"===e)throw new Error("Cannot duplicate the root brick");const i=yo(t,e),r=e.split("."),n=Number(r[r.length-1])+1,s=fo([...r.slice(0,-1),String(n)].join(".")),o=Eo($o(i));return vo(t,[{op:"add",path:s,value:o}],[{op:"remove",path:s}])}var So=(t,e,i,r,n)=>{const s=`${e}/${i}`;return void 0===n?vo(t,[{op:"add",path:s,value:r}],[{op:"remove",path:s}]):vo(t,[{op:"replace",path:s,value:r}],[{op:"replace",path:s,value:n}])};function xo(t,e,i){const{pointer:r,brick:n}=go(t,e),s={...n.configs,...i};return So(t,r,"configs",s,n.configs)}function Oo(t,e,i){const{pointer:r,brick:n}=go(t,e),s={...n.styles,...i};return So(t,r,"styles",s,n.styles)}function jo(t,e,i){const{pointer:r,brick:n}=go(t,e);return So(t,r,"validations",i,n.validations)}function Po(t,e,i){const{pointer:r,brick:n}=go(t,e);return So(t,r,"rules",i,n.rules)}class Io{past=[];future=[];record(t){this.past.push({patches:t.patches,inverse:t.inverse}),this.future=[]}get canUndo(){return this.past.length>0}get canRedo(){return this.future.length>0}undo(t){const e=this.past.pop();if(e)return this.future.push(e),mo(t,e.inverse,!0,!1).newDocument}redo(t){const e=this.future.pop();if(e)return this.past.push(e),mo(t,e.patches,!0,!1).newDocument}clear(){this.past=[],this.future=[]}}var Co=t=>"nested-form"===t.id&&"string"==typeof t.configs?.specRef,Ao=t=>{if(!t)return!1;for(const{brick:e}of As(t))if(Co(e)&&e.configs?.specRef)return!0;return!1};async function No(t,e={}){const i=e.specSourceService??Zs.specSourceService,r=e.maxDepth??5,n=async(t,e)=>{if(Co(t)&&t.configs?.specRef){const s=String(t.configs.specRef);if(e.includes(s))throw new Error(`Circular nested form reference: ${[...e,s].join(" → ")}`);if(e.length>=r)throw new Error(`Nested forms exceed the maximum depth of ${r} (${s})`);const o=await i.fetchSpec(s),a=await n(structuredClone(o),[...e,s]);return{type:"panel",id:"group",name:t.name,configs:{...t.configs,label:t.configs.label??a.name},styles:t.styles,rules:t.rules,children:a.children??[]}}return t.children?.length?{...t,children:await Promise.all(t.children.map((t=>n(t,e))))}:t};return n(structuredClone(t),[])}export{no as A,Ls as B,Io as S,co as a,Ts as b,wo as c,po as d,bo as e,uo as f,Qs as g,ko as h,Oo as i,jo as j,Po as k,As as l,_o as m,Ao as n,No as o,Os as p,Ds as q,Ps as r,Zs as s,Ys as t,xo as u,io as v,Ms as w,Ns as x,js as y,ho as z}
|
|
12
|
+
*/function ws(t,e){e.unobserve()}function bs(t,e){var i,r=function(t){return ys.get(t)}(t);if(r){var n=function(t,e){return t.observers.get(e)}(r,e);i=n&&n.observer}else r=new gs(t),ys.set(t,r);if(i)return i;if(i={},r.value=Xn(t),e){i.callback=e,i.next=null;var s=function(){_s(i)},o=function(){clearTimeout(i.next),i.next=setTimeout(s)};"undefined"!=typeof window&&(window.addEventListener("mouseup",o),window.addEventListener("keyup",o),window.addEventListener("mousedown",o),window.addEventListener("keydown",o),window.addEventListener("change",o))}return i.patches=[],i.object=t,i.unobserve=function(){_s(i),clearTimeout(i.next),function(t,e){t.observers.delete(e.callback)}(r,i),"undefined"!=typeof window&&(window.removeEventListener("mouseup",o),window.removeEventListener("keyup",o),window.removeEventListener("mousedown",o),window.removeEventListener("keydown",o),window.removeEventListener("change",o))},r.observers.set(e,new $s(e,i)),i}function _s(t,e){void 0===e&&(e=!1);var i=ys.get(t.object);Es(i.value,t.object,t.patches,"",e),t.patches.length&&fs(i.value,t.patches);var r=t.patches;return r.length>0&&(t.patches=[],t.callback&&t.callback(r)),r}function Es(t,e,i,r,n){if(e!==t){"function"==typeof e.toJSON&&(e=e.toJSON());for(var s=Qn(e),o=Qn(t),a=!1,h=o.length-1;h>=0;h--){var u=t[f=o[h]];if(!Yn(e,f)||void 0===e[f]&&void 0!==u&&!1===Array.isArray(e))Array.isArray(t)===Array.isArray(e)?(n&&i.push({op:"test",path:r+"/"+es(f),value:Xn(u)}),i.push({op:"remove",path:r+"/"+es(f)}),a=!0):(n&&i.push({op:"test",path:r,value:t}),i.push({op:"replace",path:r,value:e}));else{var c=e[f];"object"==typeof u&&null!=u&&"object"==typeof c&&null!=c&&Array.isArray(u)===Array.isArray(c)?Es(u,c,i,r+"/"+es(f),n):u!==c&&(n&&i.push({op:"test",path:r+"/"+es(f),value:Xn(u)}),i.push({op:"replace",path:r+"/"+es(f),value:Xn(c)}))}}if(a||s.length!=o.length)for(h=0;h<s.length;h++){var f;Yn(t,f=s[h])||void 0===e[f]||i.push({op:"add",path:r+"/"+es(f),value:Xn(e[f])})}}}function ks(t,e,i){void 0===i&&(i=!1);var r=[];return Es(t,e,r,"",i),r}var Ss=Object.assign({},vs,Object.freeze({__proto__:null,compare:ks,generate:_s,observe:bs,unobserve:ws}),{JsonPatchError:ss,deepClone:Xn,escapePathComponent:es,unescapePathComponent:is}),xs=Object.freeze({__proto__:null,JsonPatchError:ss,_areEquals:ms,applyOperation:cs,applyPatch:fs,applyReducer:ls,compare:ks,deepClone:Xn,default:Ss,escapePathComponent:es,generate:_s,getValueByPointer:us,observe:bs,unescapePathComponent:is,unobserve:ws,validate:ps,validator:ds});function Os(t){return"object"==typeof t&&null!==t&&!Array.isArray(t)&&Object.keys(t).length>0&&Object.values(t).every((t=>"string"==typeof t))}function js(t,e){return Os(t)?e&&void 0!==t[e]?t[e]:Object.values(t)[0]:t}function Ps(t,e){if(!t)return t;const i={};for(const[r,n]of Object.entries(t))i[r]=js(n,e);return i}var Is={en:{required:"This field is required",minLength:"Must be at least {value} characters",maxLength:"Must be at most {value} characters",min:"Must be at least {value}",max:"Must be at most {value}",pattern:"Invalid format",minItems:"Select at least {value} item(s)",maxItems:"Select at most {value} item(s)",email:"Invalid email address",url:"Invalid URL",type:"Invalid value",custom:"Invalid value"},fr:{required:"Ce champ est obligatoire",minLength:"Minimum {value} caractères",maxLength:"Maximum {value} caractères",min:"Minimum {value}",max:"Maximum {value}",pattern:"Format invalide",minItems:"Sélectionnez au moins {value} élément(s)",maxItems:"Sélectionnez au plus {value} élément(s)",email:"Adresse email invalide",url:"URL invalide",type:"Valeur invalide",custom:"Valeur invalide"}};function Cs(t,e,i){return((Is[e??"en"]??Is.en)[t]??Is.en[t]??"Invalid value").replace("{value}",String(i??""))}function*As(t,e="0"){if(t){yield{brick:t,path:e};for(const[i,r]of(t.children??[]).entries())yield*As(r,`${e}.${i}`)}}function*Ns(t){if(t&&(yield t,"collection"!==t.type))for(const e of t.children??[])yield*Ns(e)}function Ts(t,e){if(t.configs?.key&&e)return t.unWrapData?e:e[t.configs.key]}function Ms(t,e){if(t.configs?.key)return t.unWrapData?e:{[t.configs.key]:e}}var Rs=(t,e)=>{if(!e.includes("."))return t[e];let i=t;for(const t of e.split(".")){if("object"!=typeof i||null===i)return;i=i[t]}return i};function Ds(t,e="label",i="value"){return Array.isArray(t)?t.map((t=>{if("object"==typeof t&&null!==t){const r=t,n=Rs(r,e)??Rs(r,i),s=Rs(r,i)??Rs(r,e);return{label:String(n??""),value:String(s??"")}}return{label:String(t),value:String(t)}})).filter((t=>""!==t.label)):String(t??"").split("\n").map((t=>t.trim())).filter(Boolean).map((t=>({label:t,value:t})))}var Ls={"palette.search":"Search bricks…","palette.empty":"No brick matches “{query}”","builder.undo":"Undo","builder.redo":"Redo","builder.editLocale":"Editing language","builder.copyJson":"Copy JSON","builder.importJson":"Import JSON","builder.importInvalid":"Invalid form JSON","builder.pasteHint":"Press Ctrl+V to paste a spec","builder.copied":"Copied!","builder.downloadJson":"Download .json","builder.hint":"Select a brick to edit its properties","drop.hint":"Drop a brick here","empty.title":"Your form is empty","empty.hint":"Drag a brick from the palette to get started","actions.move":"Move","actions.duplicate":"Duplicate","actions.delete":"Delete","stepper.back":"← Back","stepper.next":"Next →","stepper.submit":"Submit","panel.cfg.validateSteps":"Validate each step","panel.cfg.allowStepClick":"Allow clicking steps to jump","panel.cfg.showSubmit":"Submit button on last step","panel.cfg.validateTabs":"Validate tab before leaving it","signature.clear":"Clear","panel.tab.config":"Config","panel.tab.validation":"Validation","panel.tab.styles":"Styles","panel.tab.rules":"Rules","panel.key":"Key","panel.label":"Label","panel.placeholder":"Placeholder","panel.prefix":"Prefix","panel.suffix":"Suffix","panel.accept":"Accepted file types","panel.mask":"Input mask (9=digit, a=letter, *=any)","panel.uploadUrl":"Upload URL","panel.cfg.multiple":"Allow multiple files","panel.optionsSource":"Options source","panel.options":"Options (one per line)","panel.content":"Content","panel.dataKey":"Data key","panel.url":"URL","panel.headers":"Headers ({token} reads form data)","panel.searchParam":"Server search param","panel.labelKey":"Label key","panel.valueKey":"Value key","panel.errorMessage":"Error message","panel.required":"Required","panel.minLength":"Min length","panel.maxLength":"Max length","panel.min":"Min","panel.max":"Max","panel.pattern":"Pattern (regex)","panel.minItems":"Min items","panel.maxItems":"Max items","panel.emailFormat":"Email format","panel.urlFormat":"URL format","panel.custom":"Custom (JavaScript)","panel.fallbackMessage":"Fallback message","panel.styleProperty":"property","panel.styleValue":"value","file.choose":"Choose a file…","file.uploading":"Uploading…","file.remove":"Remove file","file.addAnother":"+ Add a file","address.street":"Street","address.city":"City","address.zip":"Postal code","address.country":"Country","grid.addRow":"+ Add row","grid.moveUp":"Move row up","grid.moveDown":"Move row down","grid.removeRow":"Remove row","grid.empty":"No rows yet","grid.columns":"Row template","select.search":"Search…","select.empty":"No options","select.clear":"Clear","rules.when":"When","rules.then":"Then","rules.addRule":"+ Add rule","rules.addEffect":"+ Effect","rules.removeRule":"Remove rule","rules.removeEffect":"Remove effect","rules.mode.simple":"simple","rules.mode.json":"json","rules.mode.js":"JS","category.Inputs":"Inputs","category.Layout":"Layout","category.Data":"Data","brick.text.name":"Text","brick.email.name":"Email","brick.password.name":"Password","brick.url.name":"URL","brick.phone.name":"Phone","brick.textarea.name":"Text area","brick.number.name":"Number","brick.date.name":"Date","brick.time.name":"Time","brick.datetime.name":"Date / Time","brick.select.name":"Select","brick.multi-select.name":"Multi select","brick.radio.name":"Radio","brick.select-boxes.name":"Select boxes","brick.checkbox.name":"Checkbox","brick.tags.name":"Tags","brick.signature.name":"Signature","brick.data-grid.name":"Data grid","brick.address.name":"Address","brick.file.name":"File","brick.hidden.name":"Hidden","brick.content.name":"Content","brick.recap.name":"Recap","brick.nested-form.name":"Nested form","brick.code.name":"Code","nestedForm.ref":"Referenced form","nestedForm.missing":"Set the specRef config to reference a form.","nestedForm.loading":"Loading nested forms…","panel.specRef":"Referenced form (specRef)","panel.optionsRef":"Options catalog (optionsRef)","recap.empty":"Nothing to summarize yet.","recap.yes":"Yes","recap.no":"No","panel.cfg.showEmpty":"Show empty fields","panel.cfg.groupBySections":"Group by section","brick.group.name":"Group","brick.row.name":"Row","brick.column.name":"Column","brick.stepper.name":"Stepper","brick.tabs.name":"Tabs"},zs={"palette.search":"Rechercher une brique…","palette.empty":"Aucune brique ne correspond à « {query} »","builder.undo":"Annuler","builder.editLocale":"Langue d'édition","builder.redo":"Rétablir","builder.copyJson":"Copier le JSON","builder.importJson":"Importer le JSON","builder.importInvalid":"JSON de formulaire invalide","builder.pasteHint":"Collez avec Ctrl+V pour importer une spec","builder.copied":"Copié !","builder.downloadJson":"Télécharger le .json","builder.hint":"Sélectionnez une brique pour éditer ses propriétés","drop.hint":"Déposez une brique ici","empty.title":"Votre formulaire est vide","empty.hint":"Glissez une brique depuis la palette pour commencer","actions.move":"Déplacer","actions.duplicate":"Dupliquer","actions.delete":"Supprimer","stepper.back":"← Précédent","stepper.next":"Suivant →","stepper.submit":"Envoyer","panel.cfg.validateSteps":"Valider chaque étape","panel.cfg.allowStepClick":"Autoriser le saut d’étapes au clic","panel.cfg.showSubmit":"Bouton d’envoi à la dernière étape","panel.cfg.validateTabs":"Valider l’onglet avant de le quitter","signature.clear":"Effacer","panel.tab.config":"Config","panel.tab.validation":"Validation","panel.tab.styles":"Styles","panel.tab.rules":"Règles","panel.key":"Clé","panel.label":"Libellé","panel.placeholder":"Placeholder","panel.prefix":"Préfixe","panel.suffix":"Suffixe","panel.accept":"Types de fichiers acceptés","panel.mask":"Masque de saisie (9=chiffre, a=lettre, *=tout)","panel.uploadUrl":"URL d'upload","panel.cfg.multiple":"Autoriser plusieurs fichiers","panel.optionsSource":"Source des options","panel.options":"Options (une par ligne)","panel.content":"Contenu","panel.dataKey":"Clé de données","panel.url":"URL","panel.headers":"En-têtes ({token} lit les données du formulaire)","panel.searchParam":"Paramètre de recherche serveur","panel.labelKey":"Clé du libellé","panel.valueKey":"Clé de la valeur","panel.errorMessage":"Message d'erreur","panel.required":"Obligatoire","panel.minLength":"Longueur min","panel.maxLength":"Longueur max","panel.min":"Min","panel.max":"Max","panel.pattern":"Motif (regex)","panel.minItems":"Éléments min","panel.maxItems":"Éléments max","panel.emailFormat":"Format email","panel.urlFormat":"Format URL","panel.custom":"Personnalisé (JavaScript)","panel.fallbackMessage":"Message par défaut","panel.styleProperty":"propriété","panel.styleValue":"valeur","file.choose":"Choisir un fichier…","file.uploading":"Envoi en cours…","file.remove":"Retirer le fichier","file.addAnother":"+ Ajouter un fichier","address.street":"Rue","address.city":"Ville","address.zip":"Code postal","address.country":"Pays","grid.addRow":"+ Ajouter une ligne","grid.moveUp":"Monter la ligne","grid.moveDown":"Descendre la ligne","grid.removeRow":"Supprimer la ligne","grid.empty":"Aucune ligne","grid.columns":"Modèle de ligne","select.search":"Rechercher…","select.empty":"Aucune option","select.clear":"Effacer","rules.when":"Quand","rules.then":"Alors","rules.addRule":"+ Ajouter une règle","rules.addEffect":"+ Effet","rules.removeRule":"Supprimer la règle","rules.removeEffect":"Supprimer l'effet","rules.mode.simple":"simple","rules.mode.json":"json","rules.mode.js":"JS","category.Inputs":"Champs","category.Layout":"Mise en page","category.Data":"Données","brick.text.name":"Texte","brick.email.name":"Email","brick.password.name":"Mot de passe","brick.url.name":"URL","brick.phone.name":"Téléphone","brick.textarea.name":"Zone de texte","brick.number.name":"Nombre","brick.date.name":"Date","brick.time.name":"Heure","brick.datetime.name":"Date / Heure","brick.select.name":"Liste déroulante","brick.multi-select.name":"Sélection multiple","brick.radio.name":"Boutons radio","brick.select-boxes.name":"Cases à cocher","brick.checkbox.name":"Case à cocher","brick.tags.name":"Étiquettes","brick.signature.name":"Signature","brick.data-grid.name":"Grille de données","brick.address.name":"Adresse","brick.file.name":"Fichier","brick.hidden.name":"Caché","brick.content.name":"Contenu","brick.recap.name":"Récapitulatif","brick.nested-form.name":"Formulaire imbriqué","brick.code.name":"Code","nestedForm.ref":"Formulaire référencé","nestedForm.missing":"Renseignez la config specRef pour référencer un formulaire.","nestedForm.loading":"Chargement des formulaires imbriqués…","panel.specRef":"Formulaire référencé (specRef)","panel.optionsRef":"Catalogue d'options (optionsRef)","recap.empty":"Rien à récapituler pour le moment.","recap.yes":"Oui","recap.no":"Non","panel.cfg.showEmpty":"Afficher les champs vides","panel.cfg.groupBySections":"Regrouper par section","brick.group.name":"Groupe","brick.row.name":"Ligne","brick.column.name":"Colonne","brick.stepper.name":"Étapes","brick.tabs.name":"Onglets"},Us=Symbol.for("formkrafter.i18n"),qs=globalThis,Fs=qs[Us]??={current:{...Ls}};function Vs(t={}){Fs.current={...Ls,...t}}function Bs(t,e){let i=Fs.current[t]??t;for(const[t,r]of Object.entries(e??{}))i=i.replace(`{${t}}`,String(r));return i}function Gs(t,e){return Fs.current[t]??e}var Hs=new Set(["__proto__","constructor","prototype"]);class Ks{value;constructor(t){this.value=t}}var Js=(t,e,i)=>{t.scopes[t.scopes.length-1].set(e,i)},Ws=t=>{if("number"==typeof t)return t;const e=String(t);if(Hs.has(e))throw new Error(`Access to "${e}" is not allowed`);return e},Zs=(t,e)=>({object:Ys(t,e.object),prop:Ws(e.computed?Ys(t,e.property):e.property.name),optional:!0===e.optional}),Ys=(t,e)=>{if(++t.steps>1e5)throw new Error("Sandbox execution budget exceeded");switch(e.type){case"Program":case"BlockStatement":for(const i of e.body){const e=Ys(t,i);if(e instanceof Ks)return e}return;case"ReturnStatement":return new Ks(e.argument?Ys(t,e.argument):void 0);case"IfStatement":return Ys(t,e.test)?Ys(t,e.consequent):e.alternate?Ys(t,e.alternate):void 0;case"VariableDeclaration":for(const i of e.declarations){const e=i.id;if("Identifier"!==e.type)throw new Error("Only simple variable names are supported");Js(t,e.name,i.init?Ys(t,i.init):void 0)}return;case"ExpressionStatement":return void Ys(t,e.expression);case"Literal":return e.value;case"TemplateLiteral":{const i=e.expressions;let r="";return e.quasis.forEach(((e,n)=>{r+=e.value.cooked??"",n<i.length&&(r+=String(Ys(t,i[n])))})),r}case"Identifier":return((t,e)=>{for(let i=t.scopes.length-1;i>=0;i--)if(t.scopes[i].has(e))return t.scopes[i].get(e);throw new Error(`Unknown identifier "${e}"`)})(t,e.name);case"ThisExpression":return;case"ChainExpression":return Ys(t,e.expression);case"MemberExpression":return((t,e)=>{const{object:i,prop:r,optional:n}=Zs(t,e);if(null==i){if(n)return;throw new Error(`Cannot read "${String(r)}" of ${String(i)}`)}return i[r]})(t,e);case"CallExpression":{const i=e.callee,r=[];for(const i of e.arguments)if("SpreadElement"===i.type){const e=Ys(t,i.argument);Array.isArray(e)&&r.push(...e)}else r.push(Ys(t,i));if("MemberExpression"===i.type){const{object:n,prop:s,optional:o}=Zs(t,i);if(null==n){if(o||!0===e.optional)return;throw new Error(`Cannot call "${String(s)}" of ${String(n)}`)}const a=n[s];if("function"!=typeof a){if(!0===e.optional&&null==a)return;throw new Error(`"${String(s)}" is not a function`)}if(a===Function||a===eval)throw new Error("This function is not allowed");return a.apply(n,r)}const n=Ys(t,i);if("function"!=typeof n){if(!0===e.optional&&null==n)return;throw new Error("Value is not a function")}if(n===Function||n===eval)throw new Error("This function is not allowed");return n(...r)}case"ArrowFunctionExpression":{const i=e.params,r=e.body,n=[...t.scopes];return(...s)=>{const o=new Map;i.forEach(((t,e)=>{if("Identifier"!==t.type)throw new Error("Only simple parameters are supported");o.set(t.name,s[e])}));const a={steps:t.steps,scopes:[...n,o]},h=Ys(a,r);return t.steps=a.steps,h instanceof Ks?h.value:!0===e.expression?h:void 0}}case"BinaryExpression":{const i=Ys(t,e.left),r=Ys(t,e.right);switch(e.operator){case"===":return i===r;case"!==":return i!==r;case"==":return i==r;case"!=":return i!=r;case"<":return i<r;case"<=":return i<=r;case">":return i>r;case">=":return i>=r;case"+":return i+r;case"-":return i-r;case"*":return i*r;case"/":return i/r;case"%":return i%r;case"**":return i**r;default:throw new Error(`Unsupported operator "${String(e.operator)}"`)}}case"LogicalExpression":{const i=Ys(t,e.left);switch(e.operator){case"&&":return i&&Ys(t,e.right);case"||":return i||Ys(t,e.right);case"??":return i??Ys(t,e.right);default:throw new Error(`Unsupported operator "${String(e.operator)}"`)}}case"UnaryExpression":{const i=Ys(t,e.argument);switch(e.operator){case"!":return!i;case"-":return-i;case"+":return+i;case"typeof":return typeof i;default:throw new Error(`Unsupported operator "${String(e.operator)}"`)}}case"ConditionalExpression":return Ys(t,e.test)?Ys(t,e.consequent):Ys(t,e.alternate);case"AssignmentExpression":{const i=e.left;if("Identifier"!==i.type||"="!==e.operator)throw new Error("Only simple assignments are supported");const r=Ys(t,e.right);return((t,e,i)=>{for(let r=t.scopes.length-1;r>=0;r--)if(t.scopes[r].has(e))return void t.scopes[r].set(e,i);throw new Error(`Cannot assign to unknown identifier "${e}"`)})(t,i.name,r),r}case"ArrayExpression":{const i=[];for(const r of e.elements)if(r)if("SpreadElement"===r.type){const e=Ys(t,r.argument);Array.isArray(e)&&i.push(...e)}else i.push(Ys(t,r));return i}case"ObjectExpression":{const i={};for(const r of e.properties){if("SpreadElement"===r.type){const e=Ys(t,r.argument);if(e&&"object"==typeof e)for(const[t,r]of Object.entries(e))i[String(Ws(t))]=r;continue}const e=r.key,n=Ws(r.computed?Ys(t,e):"Identifier"===e.type?e.name:e.value);i[String(n)]=Ys(t,r.value)}return i}default:throw new Error(`Unsupported syntax: ${e.type}`)}},Qs={undefined:void 0,NaN:NaN,Infinity:1/0,Math,JSON,Number,String,Boolean,Array,Object,Date,parseInt,parseFloat,isNaN,isFinite};class Xs{defaults;cache=new Map;constructor(t={}){this.defaults=t}resolveUrl(t){return/^https?:\/\//.test(t)||!this.defaults.baseUrl?t:`${this.defaults.baseUrl.replace(/\/$/,"")}/${t.replace(/^\//,"")}`}fetchSpec(t){const e=this.resolveUrl(t);let i=this.cache.get(e);return i||(i=(this.defaults.fetch??globalThis.fetch.bind(globalThis))(e,{headers:this.defaults.headers,credentials:this.defaults.credentials}).then((async e=>{if(!e.ok)throw new Error(`Failed to load spec "${t}" (${e.status})`);return await e.json()})),i.catch((()=>this.cache.delete(e))),this.cache.set(e,i)),i}}class to{defaults;cache=new Map;constructor(t={}){this.defaults=t}resolveUrl(t){return/^https?:\/\//.test(t)||!this.defaults.baseUrl?t:`${this.defaults.baseUrl.replace(/\/$/,"")}/${t.replace(/^\//,"")}`}fetchOptions(t){const e=this.resolveUrl(t);let i=this.cache.get(e);return i||(i=(this.defaults.fetch??globalThis.fetch.bind(globalThis))(e,{headers:this.defaults.headers,credentials:this.defaults.credentials}).then((async e=>{if(!e.ok)throw new Error(`Failed to load options "${t}" (${e.status})`);return await e.json()})),i.catch((()=>this.cache.delete(e))),this.cache.set(e,i)),i}}var eo=Symbol.for("formkrafter.core.services"),io=globalThis,ro=io[eo]??={jsRunnerService:new class{validateJs(t,e={ecmaVersion:"latest",allowReturnOutsideFunction:!0}){try{return Yt(t,e),{valid:!0}}catch(t){return{valid:!1,error:t instanceof Error?t:new Error(String(t))}}}eval(t,e={}){return function(t,e={}){const i=Yt(t,{ecmaVersion:"latest",allowReturnOutsideFunction:!0}),r={steps:0,scopes:[new Map(Object.entries({...Qs,...e})),new Map]},n=Ys(r,i);return n instanceof Ks?n.value:void 0}(t,e)}},dataSourceService:new class{defaults;cache=new Map;constructor(t={}){this.defaults=t}fetchOptions(t,e){const i={...this.defaults.headers,...e?.headers},r={};Object.keys(i).length&&(r.headers=i),this.defaults.credentials&&(r.credentials=this.defaults.credentials);const n=`${t}|${JSON.stringify(r)}`;let s=this.cache.get(n);return s||(s=fetch(t,Object.keys(r).length?r:void 0).then((e=>{if(!e.ok)throw new Error(`Data source request failed (${e.status}): ${t}`);return e.json()})).then((t=>Array.isArray(t)?t:[])).catch((t=>{throw this.cache.delete(n),t})),this.cache.set(n,s)),s}},fileUploadService:new class{async upload(t){const e=globalThis.btoa;if(!e)throw new Error("No base64 encoder available");const i=new Uint8Array(await t.arrayBuffer());let r="";for(const t of i)r+=String.fromCharCode(t);return{name:t.name,type:t.type,size:t.size,url:`data:${t.type};base64,${e(r)}`}}},specSourceService:new Xs,optionSourceService:new to};ro.specSourceService??=new Xs,ro.optionSourceService??=new to;var no=(t,e)=>{try{return ro.jsRunnerService.eval(t,{dataMap:e??{}})}catch(t){return t instanceof Error?t:new Error(String(t))}},so=(t,e)=>((t,e)=>((t,e)=>t?.filter((t=>((t,e)=>"jsonLogic"===t.type?null!=t.logic&&!0===n.apply(t.logic,e):"javaScript"===t.type&&!!t.code&&!0===no(t.code,e))(t,e))))(t,e)?.map((t=>t.effects)).flat().filter((t=>null!=t)))(t,e)?.map((t=>{let i;return t.property?("boolean"===t.property.type?i=t.boolean:"logic"===t.property.type&&null!=t.logic?i=n.apply(t.logic,e):"code"===t.property.type&&t.code?i=no(t.code,e):"string"===t.property.type&&(i=t.string),{[t.property.target]:i}):{}})).flat().reduce(((t,e)=>({...t,...e})),{})??{hidden:!1},oo=(t,e)=>{if(Array.isArray(e))return e.map((e=>oo(t,e))).filter(Boolean).join(", ");if(!0===e)return Gs("recap.yes","Yes");if(!1===e)return Gs("recap.no","No");if(e&&"object"==typeof e)return"string"==typeof e.name&&"url"in e?e.name:Object.values(e).filter((t=>"string"==typeof t&&t)).join(" ");const i=String(e??"");if(null!=t.configs?.options){const e=Ds(t.configs.options,"string"==typeof t.configs.labelKey?t.configs.labelKey:"label","string"==typeof t.configs.valueKey?t.configs.valueKey:"value").find((t=>t.value===i));if(e)return e.label}return i},ao=t=>null==t||""===t||Array.isArray(t)&&0===t.length,ho=(t,e)=>String(js(t.configs?.label,e)??t.name??t.configs?.key??""),uo=t=>{const e=[];for(const i of t.children??[]){const t=i.configs?.key;"input"===i.type&&t&&!t.startsWith("_")&&e.push(i)}return e},co=(t,e,i,r,n=!1)=>{if(!t)return[];const s=[];for(const o of t.children??[]){if("recap"===o.id||"action"===o.type)continue;if(!0===so(o.rules,e).hidden)continue;const t=o.configs?.key,a=ho(o,i);if("collection"===o.type){const n=t&&Array.isArray(e?.[t])?e[t]:[];if(!n.length&&!r)continue;const h=uo(o);s.push({kind:"collection",label:a,columns:h.map((t=>ho(t,i))),rows:n.map((t=>h.map((e=>{const i=t?.[e.configs.key];return ao(i)?"—":oo(e,i)}))))});continue}if("panel"===o.type){const t=js(o.configs?.label,i);if(n&&"string"==typeof t&&t.trim()){const n=co(o,e,i,r);n.length&&(s.push({kind:"section",label:t}),s.push(...n));continue}s.push(...co(o,e,i,r,n));continue}if("input"!==o.type||!t||t.startsWith("_"))continue;const h=e?.[t];ao(h)&&!r||s.push({kind:"field",label:a,value:ao(h)?"—":oo(o,h)})}return s};class fo{type;dataType;id;name;configsForm;category;styles;unWrapData;isPrivate;validators;defaultConfigs;constructor(t){this.type=t.type,this.dataType=t.dataType,this.id=t.id,this.name=t.name,this.configsForm=t.configsForm,this.category=t.category,this.styles=t.styles,this.unWrapData=t.unWrapData??!1,this.isPrivate=t.isPrivate??!1,this.validators=t.validators??[],this.defaultConfigs=t.defaultConfigs}getBrickEmptySpec(){return{type:this.type,dataType:this.dataType,id:this.id,name:this.name,...void 0!==this.category?{category:this.category}:{},...void 0!==this.configsForm?{configsForm:this.configsForm}:{},...void 0!==this.styles?{styles:this.styles}:{},...void 0!==this.defaultConfigs?{configs:{...this.defaultConfigs}}:{},validators:this.validators}}}var lo=new Un.Ajv({allErrors:!0});Jn(lo,["email","uri"]),Vn(lo);var po=new WeakMap,mo=t=>{if("required"===t.keyword)return t.params.missingProperty;if("errorMessage"===t.keyword){const e=t.params.errors?.[0];return e?mo(e):void 0}return t.instancePath.split("/").filter(Boolean)[0]},vo=(t,e,i)=>{const r={},n=((t,e)=>{let i=po.get(t);i||(i=new Map,po.set(t,i));const r=e??"";let n=i.get(r);if(!n){const s=function(t,e){if(!t)return;const i={},r=[],n={},s=t=>{const i=js(t,e);return"string"==typeof i?i:void 0};for(const o of Ns(t)){const t=o.configs?.key,a=!0===o.configs?.multiple&&"object"===o.dataType?"array":o.dataType;if(!t||!a||"void"===a)continue;const h=o.validations?.find((t=>"required"===t.validator)),u={type:a,nullable:!h},c={type:Cs("type",e)};for(const t of o.validations??[]){const{validator:i,value:r}=t,n=s(t.message)??Cs(i,e,r);"minLength"===i&&null!=r?(u.minLength=Number(r),c.minLength=n):"maxLength"===i&&null!=r?(u.maxLength=Number(r),c.maxLength=n):"min"===i&&null!=r?(u.minimum=Number(r),c.minimum=n):"max"===i&&null!=r?(u.maximum=Number(r),c.maximum=n):"pattern"===i&&"string"==typeof r&&r?(u.pattern=r,c.pattern=n):"minItems"===i&&null!=r?(u.minItems=Number(r),c.minItems=n):"maxItems"===i&&null!=r?(u.maxItems=Number(r),c.maxItems=n):"email"===i?(u.format="email",c.format=n):"url"===i&&(u.format="uri",c.format=n)}u.errorMessage=c,i[t]=u,h&&(r.push(t),n[t]=s(h.message)??Cs("required",e))}return{type:"object",properties:i,required:r,...Object.keys(n).length?{errorMessage:{required:n}}:{},additionalProperties:!1}}(t,e);if(!s)return;try{n=lo.compile(s)}catch{return}i.set(r,n)}return n})(t,i);if(n&&!n(e))for(const t of n.errors??[]){const e=mo(t);e&&!(e in r)&&t.message&&(r[e]=t.message)}for(const[n,s]of Object.entries(((t,e,i)=>{const r={},n=e??{};for(const e of Ns(t)){const t=e.configs?.key;if(t)for(const s of e.validations??[]){if("custom"!==s.validator||!s.customValidator)continue;const e=no(`const value = dataMap?.[${JSON.stringify(t)}];\n${s.customValidator}`,n);if(!0!==e&&null!=e&&!(t in r))if("string"==typeof e)r[t]=e;else if(e instanceof Error)r[t]=e.message;else{const e=js(s.message,i);r[t]="string"==typeof e?e:Cs("custom",i)}}}return r})(t,e,i)))n in r||(r[n]=s);const s="object"==typeof e&&null!==e?e:void 0;for(const e of((t,e)=>{const i=new Set,r=(t,n)=>{const s=n||!!t.rules?.length&&!0===so(t.rules,e).hidden,o=t.configs?.key;if(s&&o&&i.add(o),"collection"!==t.type)for(const e of t.children??[])r(e,s)};return r(t,!1),i})(t,s))delete r[e];return{valid:0===Object.keys(r).length,errors:r}};function yo(t){return t.split(".").slice(1).map((t=>`/children/${t}`)).join("")}function go(t,e){if(t.configs?.uid===e)return"";for(const[i,r]of(t.children??[]).entries()){const t=go(r,e);if(void 0!==t)return`/children/${i}${t}`}}function $o(t,e){let i=t;for(const t of e.split(".").slice(1))i=i?.children?.[Number(t)];return i}var wo=(Ss??xs).applyPatch,bo=(t,e,i)=>({spec:wo(t,e,!0,!1).newDocument,patches:e,inverse:i}),_o=(t,e)=>{const i=$o(t,e);if(!i)throw new Error(`No brick at path "${e}"`);return i},Eo=(t,e)=>{const i=go(t,e);if(void 0===i)throw new Error(`No brick with uid "${e}"`);let r=t;for(const t of i.split("/children/").slice(1))r=r.children[Number(t)];return{pointer:i,brick:r}},ko=t=>JSON.parse(JSON.stringify(t));function So(t,e,i,r){const n=_o(t,i),s=yo(i),o=ko(e);if(!n.children){const e=`${s}/children`;return bo(t,[{op:"add",path:e,value:[o]}],[{op:"remove",path:e}])}const a=`${s}/children/${Math.min(r??n.children.length,n.children.length)}`;return bo(t,[{op:"add",path:a,value:o}],[{op:"remove",path:a}])}function xo(t,e){if("0"===e)throw new Error("Cannot remove the root brick");const i=_o(t,e),r=yo(e);return bo(t,[{op:"remove",path:r}],[{op:"add",path:r,value:i}])}function Oo(t,e,i){if("0"===e||"0"===i)throw new Error("Cannot move the root brick");const r=_o(t,e),n=e.split(".").map(Number),s=i.split(".").map(Number),o=n.length-1,a=n[o],h=s.length>o&&n.slice(0,o).every(((t,e)=>t===s[e])),u=[...s];if(h){if(u[o]===a&&u.length>n.length)throw new Error(`Cannot move a brick into its own subtree ("${e}" → "${i}")`);u[o]>a&&(u[o]-=1)}const c=yo(e),f=yo(u.join("."));return bo(t,[{op:"remove",path:c},{op:"add",path:f,value:r}],[{op:"remove",path:f},{op:"add",path:c,value:r}])}var jo=t=>({...t,...t.configs?{configs:{...t.configs,uid:crypto.randomUUID()}}:{},...t.children?{children:t.children.map(jo)}:{}});function Po(t,e){if("0"===e)throw new Error("Cannot duplicate the root brick");const i=_o(t,e),r=e.split("."),n=Number(r[r.length-1])+1,s=yo([...r.slice(0,-1),String(n)].join(".")),o=jo(ko(i));return bo(t,[{op:"add",path:s,value:o}],[{op:"remove",path:s}])}var Io=(t,e,i,r,n)=>{const s=`${e}/${i}`;return void 0===n?bo(t,[{op:"add",path:s,value:r}],[{op:"remove",path:s}]):bo(t,[{op:"replace",path:s,value:r}],[{op:"replace",path:s,value:n}])};function Co(t,e,i){const{pointer:r,brick:n}=Eo(t,e),s={...n.configs,...i};return Io(t,r,"configs",s,n.configs)}function Ao(t,e,i){const{pointer:r,brick:n}=Eo(t,e),s={...n.styles,...i};return Io(t,r,"styles",s,n.styles)}function No(t,e,i){const{pointer:r,brick:n}=Eo(t,e);return Io(t,r,"validations",i,n.validations)}function To(t,e,i){const{pointer:r,brick:n}=Eo(t,e);return Io(t,r,"rules",i,n.rules)}class Mo{past=[];future=[];record(t){this.past.push({patches:t.patches,inverse:t.inverse}),this.future=[]}get canUndo(){return this.past.length>0}get canRedo(){return this.future.length>0}undo(t){const e=this.past.pop();if(e)return this.future.push(e),wo(t,e.inverse,!0,!1).newDocument}redo(t){const e=this.future.pop();if(e)return this.past.push(e),wo(t,e.patches,!0,!1).newDocument}clear(){this.past=[],this.future=[]}}var Ro=t=>"nested-form"===t.id&&"string"==typeof t.configs?.specRef,Do=t=>{if(!t)return!1;for(const{brick:e}of As(t))if(Ro(e)&&e.configs?.specRef)return!0;return!1};async function Lo(t,e={}){const i=e.specSourceService??ro.specSourceService,r=e.maxDepth??5,n=async(t,e)=>{if(Ro(t)&&t.configs?.specRef){const s=String(t.configs.specRef);if(e.includes(s))throw new Error(`Circular nested form reference: ${[...e,s].join(" → ")}`);if(e.length>=r)throw new Error(`Nested forms exceed the maximum depth of ${r} (${s})`);const o=await i.fetchSpec(s),a=await n(structuredClone(o),[...e,s]);return{type:"panel",id:"group",name:t.name,configs:{...t.configs,label:t.configs.label??a.name},styles:t.styles,rules:t.rules,children:a.children??[]}}return t.children?.length?{...t,children:await Promise.all(t.children.map((t=>n(t,e))))}:t};return n(structuredClone(t),[])}export{Vs as A,fo as B,zs as C,Mo as S,Gs as a,Ts as b,So as c,$o as d,xo as e,Bs as f,so as g,Po as h,Ao as i,No as j,To as k,As as l,Oo as m,Do as n,Lo as o,Os as p,Ds as q,Ps as r,ro as s,no as t,Co as u,vo as v,Ms as w,Ns as x,co as y,js as z}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@streamline-pulse/formkrafter-wc",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "FormKrafter web components (Stencil)",
|
|
6
6
|
"main": "dist/components/index.js",
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
"@codemirror/state": "^6.7.1",
|
|
63
63
|
"@codemirror/theme-one-dark": "^6.1.3",
|
|
64
64
|
"@codemirror/view": "^6.43.6",
|
|
65
|
-
"@streamline-pulse/formkrafter-core": "0.
|
|
65
|
+
"@streamline-pulse/formkrafter-core": "0.9.0"
|
|
66
66
|
},
|
|
67
67
|
"devDependencies": {
|
|
68
68
|
"@stencil/core": "^4.43.5",
|